[ Index ] |
|
Code source de Serendipity 1.2 |
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: embed.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 embed the contents of a URL 25 * inside the page at render-time. Typically used to get script output. 26 * This differs from the 'include' rule, which incorporates results at 27 * parse-time; 'embed' output does not get parsed by Text_Wiki, while 28 * 'include' ouput does. 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_embed 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 = '/(\[\[embed )(.+?)(\]\])/i'; 55 56 57 /** 58 * 59 * Generates a token entry for the matched text. Token options are: 60 * 61 * 'text' => The full matched text, not including the <code></code> tags. 62 * 63 * @access public 64 * 65 * @param array &$matches The array of matches from parse(). 66 * 67 * @return A delimited token number to be used as a placeholder in 68 * the source text. 69 * 70 */ 71 72 function process(&$matches) 73 { 74 $options = array('path' => $matches[2]); 75 return $this->addToken($options); 76 } 77 78 79 /** 80 * 81 * Renders a token into text matching the requested format. 82 * 83 * @access public 84 * 85 * @param array $options The "options" portion of the token (second 86 * element). 87 * 88 * @return string The text rendered from the token options. 89 * 90 */ 91 92 function renderXhtml($options) 93 { 94 $file = $this->_conf['base'] . $options['path']; 95 ob_start(); 96 include($file); 97 $output = ob_get_contents(); 98 ob_end_clean(); 99 return $output; 100 } 101 } 102 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Nov 24 09:00:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |