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. /**
  4.  *
  5.  * Parse for images in the source text.
  6.  *
  7.  * @category Text
  8.  *
  9.  * @package Text_Wiki
  10.  *
  11.  * @author Tomaiuolo Michele <tomamic@yahoo.it>
  12.  *
  13.  * @license LGPL
  14.  *
  15.  * @version $Id: Image.php 243106 2007-09-28 22:02:50Z mic $
  16.  *
  17.  */
  18.  
  19.  
  20. class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
  21.  
  22.     /**
  23.      *
  24.      * Constructor.  Overrides the Text_Wiki_Parse constructor so that we
  25.      * can set the $regex property dynamically (we need to include the
  26.      * Text_Wiki $delim character).
  27.      *
  28.      * @param object &$obj The calling "parent" Text_Wiki object.
  29.      *
  30.      * @param string $name The token name to use for this rule.
  31.      *
  32.      */
  33.  
  34.     function Text_Wiki_Parse_Image(&$obj)
  35.     {
  36.         parent::Text_Wiki_Parse($obj);
  37.         $this->regex '/{{([^' $this->wiki->delim . ']*)(\|([^' $this->wiki->delim . ']*))?}}/U';
  38.     }
  39.  
  40.  
  41.     /**
  42.      *
  43.      * Generates a replacement token for the matched text.
  44.      *
  45.      * @access public
  46.      *
  47.      * @param array &$matches The array of matches from parse().
  48.      *
  49.      * @return string A token marking the horizontal rule.
  50.      *
  51.      */
  52.  
  53.     function process(&$matches)
  54.     {
  55.         $src trim($matches[1]);
  56.         $src ltrim($src'/');
  57.         $alt = isset($matches[3]trim($matches[3]$src;
  58.  
  59.         return $this->wiki->addToken(
  60.             $this->rule,
  61.             array(
  62.                 'src' => $src,
  63.                 'attr' => array('alt' => $alt'title' => $alt)
  64.             )
  65.         );
  66.     }
  67.  
  68. }
  69. ?>

Documentation generated on Mon, 11 Mar 2019 15:40:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.