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

Source for file outputfilter.admintitle.php

Documentation is available at outputfilter.admintitle.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  *
  5.  * @copyright (c) 2004, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: outputfilter.pagevars.php 20883 2006-12-22 10:24:16Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @package Zikula_Template_Plugins
  10.  * @subpackage Filters
  11.  */
  12.  
  13. /**
  14.  * Smarty outputfilter to add a title to all admin pages
  15.  *
  16.  * This plugin works only for API compliant modules and those that
  17.  * follow .8x's template design standards
  18.  *
  19.  * @author    Mark West
  20.  * @param     string 
  21.  * @param     Smarty 
  22.  */
  23. function smarty_outputfilter_admintitle($source&$smarty)
  24. {
  25.     // get all the matching H1 tags
  26.     $regex "/<h1>[^<]*<\/h1>/";
  27.     preg_match_all($regex$source$h1);
  28.     $regex "/<h2>[^<]*<\/h2>/";
  29.     preg_match_all($regex$source$h2);
  30.     $regex "/<h3>[^<]*<\/h3>/";
  31.     preg_match_all($regex$source$h3);
  32.  
  33.     // init vars
  34.     $titleargs array();
  35.     $header1 $header2 $header3 '';
  36.  
  37.     // set the title
  38.     // header level 1
  39.     if (isset($h1[0]&& isset($h1[0][1])) {
  40.         $header1 $h1[0][1];
  41.     }
  42.     if (isset($header1&& !empty($header1)) {
  43.         $titleargs[$header1;
  44.     }        
  45.     // header level 2
  46.     if (defined('_ADMIN_PNSECURITYANALYZER'&& isset($h2[0][0]&& $h2[0][0== '<h2>'._ADMIN_PNSECURITYANALYZER.'</h2>' && isset($h2[0][1])) {
  47.         $header2 $h2[0][1];
  48.     else if (isset($h2[0][0])) {
  49.         $header2 $h2[0][0];
  50.     }
  51.     if (isset($header2&& !empty($header2)) {
  52.         $titleargs[$header2;
  53.     }        
  54.     // header level 3
  55.     if (isset($h3[0]&& isset($h3[0][1])) {
  56.         $header3 $h3[0][1];
  57.     }
  58.     if (isset($header3&& !empty($header3)) {
  59.         $titleargs[$header3;
  60.     }        
  61.     PageUtil::setVar('title'implode(' / '$titleargs));
  62.  
  63.     // return the modified source
  64.     return $source;
  65. }

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