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 / Font.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.0 KB  |  84 lines

  1. <?php
  2. // vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
  3. /**
  4.  * BBCode: extra Font rules renderer to size the text
  5.  *
  6.  * PHP versions 4 and 5
  7.  *
  8.  * @category   Text
  9.  * @package    Text_Wiki
  10.  * @author     Bertrand Gugger <bertrand@toggg.com>
  11.  * @copyright  2005 bertrand Gugger
  12.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  13.  * @version    CVS: $Id: Font.php,v 1.1 2005/08/06 11:36:45 toggg Exp $
  14.  * @link       http://pear.php.net/package/Text_Wiki
  15.  */
  16.  
  17. /**
  18.  * Font rule render class (used for BBCode)
  19.  * 
  20.  * @category   Text
  21.  * @package    Text_Wiki
  22.  * @author     Bertrand Gugger <bertrand@toggg.com>
  23.  * @copyright  2005 bertrand Gugger
  24.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  25.  * @version    Release: @package_version@
  26.  * @link       http://pear.php.net/package/Text_Wiki
  27.  * @see        Text_Wiki::Text_Wiki_Render()
  28.  */
  29. class Text_Wiki_Render_Xhtml_Font extends Text_Wiki_Render {
  30.     
  31. /*    var $size = array(
  32.         'xx-small',
  33.         'x-small',
  34.         'small',
  35.         'medium',
  36.         'large',
  37.         'x-large',
  38.         'xx-large',
  39.         'larger',
  40.         'smaller'
  41.     );
  42.     var $units = array(
  43.         'em',
  44.         'ex',
  45.         'px',
  46.         'in',
  47.         'cm',
  48.         'mm',
  49.         'pt',
  50.         'pc'
  51.     );
  52. */    
  53.     
  54.     /**
  55.       * Renders a token into text matching the requested format.
  56.       * process the font size option 
  57.       *
  58.       * @access public
  59.       * @param array $options The "options" portion of the token (second element).
  60.       * @return string The text rendered from the token options.
  61.       */
  62.     function token($options)
  63.     {
  64.         if ($options['type'] == 'end') {
  65.             return '</span>';
  66.         }
  67.         if ($options['type'] != 'start') {
  68.             return '';
  69.         }
  70.  
  71.         $ret = '<span style="';
  72.         if (isset($options['size'])) {
  73.             $size = trim($options['size']);
  74.             if (is_numeric($size)) {
  75.                 $size .= 'px';
  76.             }
  77.             $ret .= "font-size: $size;";
  78.         }
  79.         
  80.         return $ret.'">';
  81.     }
  82. }
  83. ?>
  84.