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.  
  3.     var $conf = array(
  4.         'base' => '/'
  5.     );
  6.     
  7.     
  8.     /**
  9.     * 
  10.     * Renders a token into text matching the requested format.
  11.     * 
  12.     * @access public
  13.     * 
  14.     * @param array $options The "options" portion of the token (second
  15.     *  element).
  16.     * 
  17.     * @return string The text rendered from the token options.
  18.     * 
  19.     */
  20.     
  21.     function token($options)
  22.     {
  23.         return 'Image: NI';
  24.         
  25.         $src '"' .
  26.             $this->getConf('base''/'.
  27.             $options['src''"';
  28.         
  29.         if (isset($options['attr']['link'])) {
  30.         
  31.             // this image has a link
  32.             if (strpos($options['attr']['link']'://')) {
  33.                 // it's a URL
  34.                 $href $options['attr']['link'];
  35.             else {
  36.                 $href $this->wiki->getRenderConf('xhtml''wikilink''view_url'.
  37.                     $options['attr']['link'];
  38.             }
  39.             
  40.         else {
  41.             // image is not linked
  42.             $href = null;
  43.         }
  44.         
  45.         // unset these so they don't show up as attributes
  46.         unset($options['attr']['link']);
  47.         
  48.         $attr '';
  49.         $alt = false;
  50.         foreach ($options['attr'as $key => $val{
  51.             if (strtolower($key== 'alt'{
  52.                 $alt = true;
  53.             }
  54.             $attr .= " $key=\"$val\"";
  55.         }
  56.         
  57.         // always add an "alt" attribute per Stephane Solliec
  58.         if ($alt{
  59.             $attr .= ' alt="' basename($options['src']'"';
  60.         }
  61.         
  62.         if ($href{
  63.             return "<a href=\"$href\"><img src=$src$attr/></a>";
  64.         else {
  65.             return "<img src=$src$attr/>";
  66.         }
  67.     }
  68. }
  69. ?>

Documentation generated on Tue, 12 Mar 2019 21:49:19 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.