XOOPS  2.6.0
decorator.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  */
11 
22 {
23  function hasAccess($menu, &$hasAccess)
24  {
25  }
26 
27  function accessFilter(&$accessFilter)
28  {
29  }
30 
31  function start()
32  {
33  }
34 
35  function end(&$menus)
36  {
37  }
38 
39  function decorateMenu(&$menu)
40  {
41  $decorations = array('link', 'image', 'title', 'alt_title');
42  foreach ($decorations as $decoration) {
43  $menu[$decoration] = self::_doDecoration($menu[$decoration]);
44  }
45  }
46 
47  function _doDecoration($string)
48  {
50  if (!preg_match('/{(.*\|.*)}/i', $string, $reg)) {
51  return $string;
52  }
53 
54  $expression = $reg[0];
55  list($validator, $value) = array_map('strtolower', explode('|', $reg[1]));
56 
57  if ($validator == 'smarty') {
58  if (isset($xoops->tpl()->_tpl_vars[$value])) {
59  $string = str_replace($expression, $xoops->tpl()->_tpl_vars[$value], $string);
60  }
61  }
62 
63  return $string;
64  }
65 
66 }
static getInstance()
Definition: Xoops.php:160
_doDecoration($string)
Definition: decorator.php:47
accessFilter(&$accessFilter)
Definition: decorator.php:27
$xoops
Definition: admin.php:25
hasAccess($menu, &$hasAccess)
Definition: decorator.php:23
$menu