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 formLinkDescription($registry)
32  {
33  }
34 
35  function start()
36  {
37  }
38 
39  function end(&$menus)
40  {
41  }
42 
43  function decorateMenu(&$menu)
44  {
45  $decorations = array('link', 'image', 'title', 'alt_title');
46  foreach ($decorations as $decoration) {
47  $menu[$decoration] = self::_doDecoration($menu[$decoration]);
48  }
49  }
50 
51  function _doDecoration($string)
52  {
53  if (!preg_match('/{(.*\|.*)}/i', $string, $reg)) {
54  return $string;
55  }
56 
57  $expression = $reg[0];
58  list($validator, $value) = array_map('strtoupper', explode('|', $reg[1]));
59 
60  if ($validator == 'CONSTANT') {
61  if (defined($value)) {
62  $string = str_replace($expression, constant($value), $string);
63  }
64  }
65 
66  return $string;
67  }
68 }
hasAccess($menu, &$hasAccess)
Definition: decorator.php:23
formLinkDescription($registry)
Definition: decorator.php:31
$menu
accessFilter(&$accessFilter)
Definition: decorator.php:27