Source for file a.php

Documentation is available at a.php

  1. <?php
  2.  
  3. /**
  4.  * Outputs a html &lt;a&gt; tag
  5.  * <pre>
  6.  *  * href : the target URI where the link must point
  7.  *  * rest : any other attributes you want to add to the tag can be added as named parameters
  8.  * </pre>
  9.  *
  10.  * Example :
  11.  *
  12.  * <code>
  13.  * {* Create a simple link out of an url variable and add a special class attribute: *}
  14.  *
  15.  * {a $url class="external" /}
  16.  *
  17.  * {* Mark a link as active depending on some other variable : *}
  18.  *
  19.  * {a $link.url class=tif($link.active "active"); $link.title /}
  20.  *
  21.  * {* This is similar to: <a href="{$link.url}" class="{if $link.active}active{/if}">{$link.title}</a> *}
  22.  * </code>
  23.  *
  24.  * This software is provided 'as-is', without any express or implied warranty.
  25.  * In no event will the authors be held liable for any damages arising from the use of this software.
  26.  *
  27.  * @author     Jordi Boggiano <j.boggiano@seld.be>
  28.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  29.  * @license    http://dwoo.org/LICENSE   Modified BSD License
  30.  * @link       http://dwoo.org/
  31.  * @version    1.0.0
  32.  * @date       2008-10-23
  33.  * @package    Dwoo
  34.  */
  35. {
  36.     public function init($hrefarray $rest=array())
  37.     {
  38.     }
  39.  
  40.     public static function preProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$type)
  41.     {
  42.         $p $compiler->getCompiledParams($params);
  43.  
  44.         $out Dwoo_Compiler::PHP_OPEN 'echo \'<a '.self::paramsToAttributes($p);
  45.  
  46.         return $out.'>\';' Dwoo_Compiler::PHP_CLOSE;
  47.     }
  48.  
  49.     public static function postProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$content)
  50.     {
  51.         $p $compiler->getCompiledParams($params);
  52.  
  53.         // no content was provided so use the url as display text
  54.         if ($content == ""{
  55.             // merge </a> into the href if href is a string
  56.             if (substr($p['href']-1=== '"' || substr($p['href']-1=== '\''{
  57.                 return Dwoo_Compiler::PHP_OPEN 'echo '.substr($p['href']0-1).'</a>'.substr($p['href']-1).';'.Dwoo_Compiler::PHP_CLOSE;
  58.             }
  59.             // otherwise append
  60.             return Dwoo_Compiler::PHP_OPEN 'echo '.$p['href'].'.\'</a>\';'.Dwoo_Compiler::PHP_CLOSE;
  61.         }
  62.  
  63.         // return content
  64.         return $content '</a>';
  65.     }
  66. }

Documentation generated on Sun, 07 Feb 2010 17:53:06 +0000 by phpDocumentor 1.4.0