includes/wikiengine/Render/Xhtml/Font.php
changeset 1027 98c052fc3337
parent 1026 f0431eb8161e
child 1028 dde4416dea00
equal deleted inserted replaced
1026:f0431eb8161e 1027:98c052fc3337
     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 ?>