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,v 1.3 2007/07/30 14:22:05 mic Exp $
  16.  *
  17.  */
  18.  
  19.  
  20. class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
  21.  
  22.     /**
  23.      *
  24.      * The regular expression used to parse the source text and find
  25.      * matches conforming to this rule.  Used by the parse() method.
  26.      *
  27.      * @access public
  28.      *
  29.      * @var string 
  30.      *
  31.      * @see parse()
  32.      *
  33.      */
  34.  
  35.     var $regex = '/{{(.*)(\|(.*))?}}/U';
  36.  
  37.  
  38.     /**
  39.      *
  40.      * Generates a replacement token for the matched text.
  41.      *
  42.      * @access public
  43.      *
  44.      * @param array &$matches The array of matches from parse().
  45.      *
  46.      * @return string A token marking the horizontal rule.
  47.      *
  48.      */
  49.  
  50.     function process(&$matches)
  51.     {
  52.         $src trim($matches[1]);
  53.         $src ltrim($src'/');
  54.         $alt trim($matches[3]);
  55.         if ($alt$alt $src;
  56.  
  57.         return $this->wiki->addToken(
  58.             $this->rule,
  59.             array(
  60.                 'src' => $src,
  61.                 'attr' => array('alt' => $alt'title' => $alt)
  62.             )
  63.         );
  64.     }
  65.  
  66. }
  67. ?>

Documentation generated on Mon, 11 Mar 2019 14:44:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.