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

Source for file Embed.php

Documentation is available at Embed.php

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

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