[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/bundled-libs/Text/Wiki/Rule/ -> include.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4: */
   3  // +----------------------------------------------------------------------+
   4  // | PHP version 4                                                        |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 1997-2003 The PHP Group                                |
   7  // +----------------------------------------------------------------------+
   8  // | This source file is subject to version 2.0 of the PHP license,       |
   9  // | that is bundled with this package in the file LICENSE, and is        |
  10  // | available through the world-wide-web at                              |
  11  // | http://www.php.net/license/2_02.txt.                                 |
  12  // | If you did not receive a copy of the PHP license and are unable to   |
  13  // | obtain it through the world-wide-web, please send a note to          |
  14  // | license@php.net so we can mail you a copy immediately.               |
  15  // +----------------------------------------------------------------------+
  16  // | Authors: Paul M. Jones <pmjones@ciaweb.net>                          |
  17  // +----------------------------------------------------------------------+
  18  //
  19  // $Id: include.php,v 1.2 2004/12/02 10:54:32 nohn Exp $
  20  
  21  
  22  /**
  23  * 
  24  * This class implements a Text_Wiki_Rule to include the results of a
  25  * script directly into the source at parse-time; thus, the output of the
  26  * script will be parsed by Text_Wiki.  This differs from the 'embed'
  27  * rule, which incorporates the results at render-time, meaning that the
  28  * 'embed' content is not parsed by Text_Wiki.
  29  *
  30  * This rule is inherently not secure; it allows cross-site scripting to
  31  * occur if the embedded output has <script> or other similar tags.  Be
  32  * careful.
  33  *
  34  * @author Paul M. Jones <pmjones@ciaweb.net>
  35  *
  36  * @package Text_Wiki
  37  *
  38  */
  39  
  40  class Text_Wiki_Rule_include extends Text_Wiki_Rule {
  41      
  42      
  43      /**
  44      * 
  45      * The regular expression used to find source text matching this
  46      * rule.
  47      * 
  48      * @access public
  49      * 
  50      * @var string
  51      * 
  52      */
  53      
  54      var $regex = '/(\[\[include )(.+?)(\]\])/i';
  55      
  56      
  57      /**
  58      * 
  59      * Includes the results of the script directly into the source; the output
  60      * will subsequently be parsed by the remaining Text_Wiki rules.
  61      * 
  62      * @access public
  63      *
  64      * @param array &$matches The array of matches from parse().
  65      *
  66      * @return The results of the included script.
  67      *
  68      */
  69      
  70      function process(&$matches)
  71      {
  72          $file = $this->_conf['base'] . $matches[2];
  73          ob_start();
  74          include($file);
  75          $output = ob_get_contents();
  76          ob_end_clean();
  77          return $output;
  78      }
  79  }
  80  ?>


Généré le : Sat Nov 24 09:00:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics