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.  * This file is released under the LGPL
  28.  * "GNU Lesser General Public License"
  29.  * More information can be found here:
  30.  * {@link http://www.gnu.org/copyleft/lesser.html}
  31.  *
  32.  * @author     Jordi Boggiano <[email protected]>
  33.  * @copyright  Copyright (c) 2008, Jordi Boggiano
  34.  * @license    http://www.gnu.org/copyleft/lesser.html  GNU Lesser General Public License
  35.  * @link       http://dwoo.org/
  36.  * @version    0.9.1
  37.  * @date       2008-05-30
  38.  * @package    Dwoo
  39.  */
  40. {
  41.     public function init($hrefarray $rest=array())
  42.     {
  43.     }
  44.  
  45.     public static function preProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$type)
  46.     {
  47.         $p $compiler->getCompiledParams($params);
  48.  
  49.         $out Dwoo_Compiler::PHP_OPEN 'echo \'<a '.self::paramsToAttributes($p);
  50.  
  51.         return $out.'>\';' Dwoo_Compiler::PHP_CLOSE;
  52.     }
  53.  
  54.     public static function postProcessing(Dwoo_Compiler $compilerarray $params$prepend$append$content)
  55.     {
  56.         $p $compiler->getCompiledParams($params);
  57.  
  58.         // no content was provided so use the url as display text
  59.         if ($content == ""{
  60.             // merge </a> into the href if href is a string
  61.             if (substr($p['href']-1=== '"' || substr($p['href']-1=== '\''{
  62.                 return Dwoo_Compiler::PHP_OPEN 'echo '.substr($p['href']0-1).'</a>'.substr($p['href']-1).';'.Dwoo_Compiler::PHP_CLOSE;
  63.             }
  64.             // otherwise append
  65.             return Dwoo_Compiler::PHP_OPEN 'echo '.$p['href'].'.\'</a>\';'.Dwoo_Compiler::PHP_CLOSE;
  66.         }
  67.  
  68.         // return content
  69.         return $content '</a>';
  70.     }
  71. }

Documentation generated on Sun, 03 Aug 2008 15:12:15 +0200 by phpDocumentor 1.4.0