本文整理汇总了PHP中CMS::check_globals_or方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::check_globals_or方法的具体用法?PHP CMS::check_globals_or怎么用?PHP CMS::check_globals_or使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS
的用法示例。
在下文中一共展示了CMS::check_globals_or方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_access
protected function check_access()
{
if (CMS::$globals['full']) {
return true;
}
$acc = trim($this->access);
if ($acc != '' && !CMS::check_globals_or($acc)) {
return false;
}
return true;
}
示例2: add
public function add($title, $item)
{
if (!Core_Types::is_iterable($item)) {
$item = array('uri' => $item, 'url' => $item);
}
if (isset($item['title'])) {
$title = $item['title'];
}
$title = CMS::lang($title);
//Events::dispatch('cms.navigation.add', $ev = Events::Event(array('title' => $title, 'data' => $item, 'url' => $item['url'])));
//$title = $ev['title'];
//$item = $ev['data'];
//$item['url'] = $ev['url'];
$url = $item['url'];
Events::call('cms.navigation.add', $title, $item, $url);
$item['url'] = $url;
$access = isset($item['access']) ? trim($item['access']) : '';
if ($access != '' && !CMS::check_globals_or($access)) {
return $this;
}
if (isset($item['disabled'])) {
if (CMS::check_yes($item['disabled'])) {
return $this;
}
}
$uri = '';
if (isset($item['uri'])) {
$uri = $item['uri'];
}
if (isset($item['url'])) {
$uri = $item['url'];
}
$id = isset($item['id']) ? $item['id'] : md5($title . $uri);
if (isset($item['navigation_id'])) {
$id = trim($item['navigation_id']);
}
$selected = false;
$disabled = false;
if (isset($item['match'])) {
if (preg_match($item['match'], CMS_Navigation3::$uri)) {
$selected = true;
}
}
if (isset($item['flag'])) {
if (CMS::$navigation->is_flag($item['flag'])) {
$selected = true;
}
}
if ($uri == CMS_Navigation3::$uri) {
$selected = true;
}
$item['selected'] = $selected;
$item['disabled'] = $disabled;
$sub = isset($item['sub']) ? $item['sub'] : null;
if (is_string($sub)) {
$sub = trim($sub);
$_component = $sub;
$_parms = $uri;
if ($m = Core_Regexps::match_with_results('{^([^\\s]+)\\s+(.+)$}', $sub)) {
$_component = trim($m[1]);
$_parms = trim($m[2]);
}
if (CMS::component_exists($_component)) {
$_class = CMS::$component_names[$_component];
$_classref = Core_Types::reflection_for($_class);
$sub = $_classref->hasMethod('navigation_tree') ? $_classref->getMethod('navigation_tree')->invokeArgs(NULL, array($_parms, $item)) : false;
}
}
if (Core_Types::is_iterable($sub)) {
$set = new CMS_Navigation3_LinkSet();
$set->level_num = $this->level_num + 1;
$set->process($sub);
$this->link($id, $uri, $title, $item, $set);
} else {
$this->link($id, $uri, $title, $item);
}
return $this;
}
示例3: add_item
public function add_item($link, $level, $parent = null)
{
$access = isset($link->access) ? trim($link->access) : '';
if ($access != '' && !CMS::check_globals_or($access)) {
return $this;
}
if (empty($link->url) && empty($link->id) && ($m = Core_Regexps::match_with_results('{^\\%(.+)$}', trim($link->title)))) {
$_component = trim($m[1]);
$_parms = false;
if ($m = Core_Regexps::match_with_results('{^([^\\s]+)\\s+(.+)$}', $_component)) {
$_component = $m[1];
$_parms = trim($m[2]);
}
if (CMS::component_exists($_component)) {
$_class = CMS::$component_names[$_component];
$_classref = Core_Types::reflection_for($_class);
$links = $_classref->hasMethod('navigation_tree') ? $_classref->getMethod('navigation_tree')->invokeArgs(NULL, array($_parms)) : array();
foreach ($links as $k => &$v) {
$v["from-{$_component}"] = 1;
}
return $this->load_data($links, $level, $parent);
}
return $this;
}
return parent::add_item($link, $level, $parent);
}
示例4: add_item
public function add_item($link, $level, $parent = null)
{
$access = isset($link->access) ? trim($link->access) : '';
if ($access != '' && !CMS::check_globals_or($access)) {
return $this;
}
if (empty($link->url) && empty($link->id) && ($m = Core_Regexps::match_with_results('{^\\%(.+)$}', trim($link->title)))) {
$_component = trim($m[1]);
$links = $this->load_from_component_by_string($_component);
if (!empty($links)) {
return $this->load_data($links, $level, $parent);
}
return $this;
}
return parent::add_item($link, $level, $parent);
}