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

Source for file Image.php

Documentation is available at Image.php

  1. <?php
  2. class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render {
  3.  
  4.     var $conf = array(
  5.         'base' => '/'
  6.     );
  7.     
  8.     
  9.     /**
  10.     * 
  11.     * Renders a token into text matching the requested format.
  12.     * 
  13.     * @access public
  14.     * 
  15.     * @param array $options The "options" portion of the token (second
  16.     *  element).
  17.     * 
  18.     * @return string The text rendered from the token options.
  19.     * 
  20.     */
  21.     
  22.     function token($options)
  23.     {
  24.         $src '"' .
  25.             $this->getConf('base''/'.
  26.             $options['src''"';
  27.         
  28.         if (isset($options['attr']['link'])) {
  29.             // this image has a wikilink
  30.             $href $this->_wiki->getRuleConf('wikilink''view_url'.
  31.                 $options['attr']['link'];
  32.         else {
  33.             // image is not linked
  34.             $href = null;
  35.         }
  36.         
  37.         // unset these so they don't show up as attributes
  38.         unset($options['attr']['link']);
  39.         
  40.         $attr '';
  41.         foreach ($options['attr'as $key => $val{
  42.             $attr .= "$key=\"$val\" ";
  43.         }
  44.         
  45.         if ($href{
  46.             return "<a href=\"$href\"><img src=$src$attr/></a>";
  47.         else {
  48.             return "<img src=$src$attr/>";
  49.         }
  50.     }
  51. }
  52. ?>

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