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 {
28  static function getDecorators($dirname)
29  {
30  $available = self::getAvailableDecorators();
31  if (!in_array($dirname, array_keys($available))) {
32  return false;
33  }
34  return $available[$dirname];
35  }
36 
40  static function getAvailableDecorators()
41  {
42  static $decorators = false;
43  if (!is_array($decorators)) {
44  $decorators = array();
46 
47  $dirnames = XoopsLists::getDirListAsArray($helper->path('decorators/'), '');
48  foreach ($dirnames as $dirname) {
49  if (XoopsLoad::loadFile($helper->path("decorators/{$dirname}/decorator.php"))) {
50  $className = 'Menus' . ucfirst($dirname) . 'Decorator';
51  $class = new $className($dirname);
52  if ($class instanceof MenusDecoratorAbstract && $class instanceof MenusDecoratorInterface) {
53  $decorators[$dirname] = $class;
54  }
55  }
56  }
57  }
58  return $decorators;
59  }
60 }
61 
63 {
67  public function __construct($dirname)
68  {
69  $this->loadLanguage($dirname);
70  }
71 
75  public function loadLanguage($name)
76  {
78 
80  $path = $helper->path("decorators/{$name}/language");
81  if (!$ret = XoopsLoad::loadFile("{$path}/{$language}/decorator.php")) {
82  $ret = XoopsLoad::loadFile("{$path}/english/decorator.php");
83  }
84  return $ret;
85  }
86 }
87 
89 
93  function start();
94 
98  function end(&$menus);
99 
103  function decorateMenu(&$menu);
104 
108  function hasAccess($menu, &$hasAccess);
109 
113  function accessFilter(&$accessFilter);
114 }
static getLegacyLanguage()
Definition: Abstract.php:76
$path
Definition: execute.php:31
static getDecorators($dirname)
Definition: decorator.php:28
accessFilter(&$accessFilter)
static getInstance()
Definition: helper.php:34
$menu
$helper
static getAvailableDecorators()
Definition: decorator.php:40
$dirname
Definition: backend.php:38
static loadFile($file, $once=true)
Definition: xoopsload.php:454
hasAccess($menu, &$hasAccess)
$language