Xanthia_Templating_Environment
[ class tree: Xanthia_Templating_Environment ] [ index: Xanthia_Templating_Environment ] [ all elements ]

Source for file modifier.footnotes.php

Documentation is available at modifier.footnotes.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  *
  5.  * @copyright (c) 2001, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: modifier.footnotes.php 24350 2008-06-06 15:59:07Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  *
  10.  *  Xanthia plugin
  11.  *
  12.  *  This file is a plugin for Xanthia, the Zikula implementation of Smarty
  13.  *
  14.  * @package      Xanthia_Templating_Environment
  15.  * @subpackage   Xanthia
  16.  */
  17.  
  18.  
  19. /**
  20.  * Smarty modifier to convert urls into footnote references for printable page
  21.  *
  22.  * File:         modifier.footnotes.php
  23.  * Type:         modifier
  24.  * Name:         footnotes
  25.  * Date:         Feb 23, 2005
  26.  * Purpose:      Generate footnotes for printable page
  27.  * @author        Jochen Roemling
  28.  * @author      Mark West
  29.  * @version      1.3
  30.  * @param         string 
  31.  * @param         Smarty 
  32.  */
  33. function smarty_modifier_footnotes($string)
  34. {
  35.     // globalise the links array
  36.     global $link_arr;
  37.  
  38.     $link_arr array();
  39.     // replace the links
  40.     $text preg_replace_callback('/<a [^>]*href\s*=\s*\"?([^>\"]*)\"?[^>]*>(.*?)<\/a.*?>/i','_smarty_modifier_footnotes_callback',$string);
  41.  
  42.     return $text;
  43. }
  44.  
  45.  
  46. {
  47.     // globalise the links array
  48.     global $link_arr;
  49.  
  50.     // remember the link
  51.     // TODO - work out why some links need decoding twice (&amp;amp;....)
  52.     $link_arr[html_entity_decode(html_entity_decode($arr[1]));
  53.  
  54.     // return the replaced link
  55.     return '<strong><em>'.$arr[2].'</em></strong> <small>['.count($link_arr).']</small>';
  56. }

Documentation generated on Fri, 18 Jul 2008 21:47:48 +0200 by phpDocumentor 1.4.1