Text_Wiki
[ class tree: Text_Wiki ] [ index: Text_Wiki ] [ all elements ]

Source for file Include.php

Documentation is available at Include.php

  1. <?php
  2. // $Id: Include.php,v 1.1 2004/06/06 15:44:34 pmjones Exp $
  3.  
  4.  
  5. /**
  6. * This class implements a Text_Wiki_Parse to include the results of a
  7. * script directly into the source at parse-time; thus, the output of the
  8. * script will be parsed by Text_Wiki.  This differs from the 'embed'
  9. * rule, which incorporates the results at render-time, meaning that the
  10. * 'embed' content is not parsed by Text_Wiki.
  11. *
  12. * DANGER!
  13. * This rule is inherently not secure; it allows cross-site scripting to
  14. * occur if the embedded output has <script> or other similar tags.  Be
  15. * careful.
  16. *
  17. @author Paul M. Jones <pmjones@ciaweb.net>
  18. *
  19. @package Text_Wiki
  20. *
  21. */
  22.  
  23.     
  24.     $conf = array(
  25.         'base' => '/path/to/scripts/'
  26.     );
  27.     
  28.     /**
  29.     * 
  30.     * The regular expression used to find source text matching this
  31.     * rule.
  32.     * 
  33.     * @access public
  34.     * 
  35.     * @var string 
  36.     * 
  37.     */
  38.     
  39.     var $regex = '/(\[\[include )(.+?)(\]\])/i';
  40.     
  41.     
  42.     /**
  43.     * 
  44.     * Includes the results of the script directly into the source; the output
  45.     * will subsequently be parsed by the remaining Text_Wiki rules.
  46.     * 
  47.     * @access public
  48.     *
  49.     * @param array &$matches The array of matches from parse().
  50.     *
  51.     * @return The results of the included script.
  52.     *
  53.     */
  54.     
  55.     function process(&$matches)
  56.     {
  57.         $file $this->getConf(['base']'./'$matches[2];
  58.         ob_start();
  59.         include($file);
  60.         $output ob_get_contents();
  61.         ob_end_clean();
  62.         return $output;
  63.     }
  64. }
  65. ?>

Documentation generated on Mon, 11 Mar 2019 10:17:16 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.