home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Text / Wiki / Render / Xhtml / Blockquote.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.8 KB  |  73 lines

  1. <?php
  2. // vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
  3. /**
  4.  * Blockquote rule end renderer for Xhtml
  5.  *
  6.  * PHP versions 4 and 5
  7.  *
  8.  * @category   Text
  9.  * @package    Text_Wiki
  10.  * @author     Paul M. Jones <pmjones@php.net>
  11.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  12.  * @version    CVS: $Id: Blockquote.php,v 1.9 2007/05/26 18:25:23 mic Exp $
  13.  * @link       http://pear.php.net/package/Text_Wiki
  14.  */
  15.  
  16. /**
  17.  * This class renders a blockquote in XHTML.
  18.  *
  19.  * @category   Text
  20.  * @package    Text_Wiki
  21.  * @author     Paul M. Jones <pmjones@php.net>
  22.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  23.  * @version    Release: @package_version@
  24.  * @link       http://pear.php.net/package/Text_Wiki
  25.  */
  26. class Text_Wiki_Render_Xhtml_Blockquote extends Text_Wiki_Render {
  27.  
  28.     var $conf = array(
  29.         'css' => null
  30.     );
  31.  
  32.     /**
  33.     *
  34.     * Renders a token into text matching the requested format.
  35.     *
  36.     * @access public
  37.     *
  38.     * @param array $options The "options" portion of the token (second
  39.     * element).
  40.     *
  41.     * @return string The text rendered from the token options.
  42.     *
  43.     */
  44.  
  45.     function token($options)
  46.     {
  47.         $type = $options['type'];
  48.         $level = $options['level'];
  49.  
  50.         // set up indenting so that the results look nice; we do this
  51.         // in two steps to avoid str_pad mathematics.  ;-)
  52.         $pad = str_pad('', $level, "\t");
  53.         $pad = str_replace("\t", '    ', $pad);
  54.  
  55.         // pick the css type
  56.         $css = $this->formatConf(' class="%s"', 'css');
  57.  
  58.         if (isset($options['css'])) {
  59.             $css = ' class="' . $options['css']. '"';
  60.         }
  61.         // starting
  62.         if ($type == 'start') {
  63.             return "$pad<blockquote$css>";
  64.         }
  65.  
  66.         // ending
  67.         if ($type == 'end') {
  68.             return $pad . "</blockquote>\n";
  69.         }
  70.     }
  71. }
  72. ?>
  73.