[ Index ]

PHP Cross Reference of Zikula Core 1.3.2

title

Body

[close]

/themes/Printer/plugins/ -> function.footnotes.php (source)

   1  <?php
   2  /**
   3   * Copyright Zikula Foundation 2009 - Zikula Application Framework
   4   *
   5   * This work is contributed to the Zikula Foundation under one or more
   6   * Contributor Agreements and licensed to You under the following license:
   7   *
   8   * @license GNU/LGPLv3 (or at your option, any later version).
   9   * @package Zikula
  10   *
  11   * Please see the NOTICE file distributed with this source code for further
  12   * information regarding copyright and licensing.
  13   */
  14  
  15  /**
  16   * Smarty function to display footnotes caculated by earlier modifier
  17   *
  18   * Example
  19   *   {footnotes}
  20   *
  21   * @param       array       $params      All attributes passed to this function from the template
  22   * @param       object      $smarty     Reference to the Smarty object
  23   */
  24  function smarty_function_footnotes($params, $smarty)
  25  {
  26      // globalise the links array
  27      global $link_arr;
  28  
  29      $text = '';
  30  
  31      if (is_array($link_arr) && !empty($link_arr)) {
  32          $text .= '<ol>';
  33          $link_arr = array_unique($link_arr);
  34          foreach ($link_arr as $key => $link) {
  35              // check for an e-mail address
  36              if (preg_match("/^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$/i", $link)) {
  37                  $linktext = $link;
  38                  $link = 'mailto:' . $link;
  39              // append base URL for local links (not web links)
  40              } elseif (!preg_match("/^http:\/\//i",$link))    {
  41                  $link = System::getBaseUrl().$link;
  42                  $linktext = $link;
  43              } else {
  44                  $linktext = $link;
  45              }
  46              $linktext = DataUtil::formatForDisplay($linktext);
  47              $link = DataUtil::formatForDisplay($link);
  48              // output link
  49              $text .= '<li><a class="print-normal" href="'.$link.'">'.$linktext.'</a></li>'."\n";
  50          }
  51          $text .= '</ol>';
  52      }
  53  
  54      if (isset($params['assign'])) {
  55          $smarty->assign($params['assign'], $text);
  56      } else {
  57          return $text;
  58      }
  59  }


Generated: Mon Feb 20 12:35:30 2012 Cross-referenced by PHPXref 0.7.1