当前位置: 首页>>代码示例>>PHP>>正文


PHP CMS::component_exists方法代码示例

本文整理汇总了PHP中CMS::component_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::component_exists方法的具体用法?PHP CMS::component_exists怎么用?PHP CMS::component_exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMS的用法示例。


在下文中一共展示了CMS::component_exists方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: component_class

 protected function component_class($name)
 {
     $name = trim($name);
     $name = strtolower($name);
     if (isset(self::$components_classes[$name])) {
         return self::$components_classes[$name];
     }
     if (CMS::component_exists($name) || $name[0] == '_') {
         $lang = CMS::site_lang();
         $lang = ucfirst($lang);
         if ($m = Core_Regexps::match_with_results('{^_(.+)$}', $name)) {
             $name = trim($m[1]);
             $module = 'CMS.Lang.' . ucfirst($name) . '.' . $lang;
         } else {
             $module = CMS::$component_module_prefix[$name] . ".Lang.{$lang}";
         }
         $class = str_replace('.', '_', $module);
         try {
             @Core::load($module);
         } catch (Core_ModuleNotFoundException $e) {
             return false;
         }
         if (!class_exists($class)) {
             return false;
         }
         $object = new $class();
         self::$components_classes[$name] = $object;
         return $object;
     }
     return false;
 }
开发者ID:techart,项目名称:tao,代码行数:31,代码来源:Lang.php

示例2: load_from_component

 private function load_from_component($_component, $_parms)
 {
     if (CMS::component_exists($_component)) {
         $_class = CMS::$component_names[$_component];
         $_classref = Core_Types::reflection_for($_class);
         return $_classref->hasMethod('navigation_tree') ? $_classref->getMethod('navigation_tree')->invokeArgs(null, array($_parms, $this)) : false;
     }
     return false;
 }
开发者ID:techart,项目名称:tao,代码行数:9,代码来源:Navigation.php

示例3: route

 public function route($request)
 {
     $uri = $request->urn;
     if (preg_match('{^' . CMS::admin_path() . 'vars(?:-([^/]+))?/(.*)$}', $uri, $m)) {
         $component = false;
         if (trim($m[1]) != '') {
             $component = trim($m[1]);
             if (!CMS::component_exists($component)) {
                 return false;
             }
             self::$component = $component;
         }
         $path = trim($m[2]);
         $ctr = 'CMS.Controller.AdminVars';
         if ($path == '') {
             return array('controller' => $ctr, 'action' => 'index', 'id' => 0, 'component' => $component);
         }
         if (preg_match('{^(\\d+)$}', $path, $m)) {
             return array('controller' => $ctr, 'action' => 'index', 'id' => $m[1], 'component' => $component);
         }
         if ($path == 'loaddump') {
             return array('controller' => $ctr, 'action' => 'loaddump');
         }
         if ($path == 'dump') {
             return array('controller' => $ctr, 'action' => 'dump', 'component' => $component);
         }
         if (preg_match('{(dumpvar|add|del|parms|chparms|change|addfile|delfile|imagelist|attaches)/(\\d+)}', $path, $m)) {
             return array('controller' => $ctr, 'action' => $m[1], 'id' => $m[2], 'component' => $component);
         }
         return false;
     }
     return false;
 }
开发者ID:techart,项目名称:tao,代码行数:33,代码来源:AdminVars.php

示例4: process

 public function process($data)
 {
     foreach ($data as $title => $item) {
         if (is_string($item) && trim($item) == '' && ($m = Core_Regexps::match_with_results('{^\\%(.+)$}', trim($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) {
                     if (is_string($v)) {
                         $v = array('url' => $v);
                     }
                     $v["from-{$_component}"] = 1;
                     $links[$k] = $v;
                 }
                 $this->process($links);
             }
         } else {
             $this->add($title, $item);
         }
     }
 }
开发者ID:techart,项目名称:tao,代码行数:28,代码来源:Navigation2.php

示例5: create_form

 protected function create_form($uri)
 {
     $form = Forms::Form('mainform')->action($uri);
     $validator = Validation::Validator();
     $use_validator = false;
     foreach ($this->form_fields as $name => $parms) {
         if (isset($parms['if_component_exists'])) {
             if (!CMS::component_exists($parms['if_component_exists'])) {
                 continue;
             }
         }
         if (isset($parms['embedded_admin']) && $this->embedded_admin) {
             if (!$parms['embedded_admin']) {
                 continue;
             }
         }
         $type = isset($parms['type']) ? trim($parms['type']) : 'input';
         $method = 'create_form_field_' . $type;
         if (method_exists($this, $method)) {
             $this->{$method}($form, $name, $parms);
         } else {
             if (isset(self::$field_types[$type])) {
                 self::$field_types[$type]->form_field($form, $name, $parms);
                 if ($dir = self::$field_types[$type]->is_upload($parms)) {
                     $this->upload_fields[$name] = $dir;
                 }
             } else {
                 $form->input($name);
             }
         }
         if (isset($parms['match'])) {
             if ($parms['match'] == 'presence') {
                 $validator->validate_presence_of($name, $parms['error_message']);
             } else {
                 if ($parms['match'] == 'email') {
                     $validator->validate_email_for($name, $parms['error_message']);
                 } else {
                     if ($parms['match'] == 'email presence') {
                         $validator->validate_presence_of($name, $parms['error_message']);
                         $validator->validate_email_for($name, $parms['error_message']);
                     } else {
                         $validator->validate_format_of($name, $parms['match'], $parms['error_message']);
                     }
                 }
             }
             $use_validator = true;
         }
     }
     if ($use_validator) {
         $form->validate_with($validator);
     }
     return $form;
 }
开发者ID:techart,项目名称:tao,代码行数:53,代码来源:AdminTableBase.php

示例6: 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);
 }
开发者ID:techart,项目名称:tao,代码行数:26,代码来源:Navigation3.php

示例7: 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;
 }
开发者ID:techart,项目名称:tao,代码行数:78,代码来源:Navigation3.php

示例8: form_field_exists

 protected function form_field_exists($name, $parms, $action)
 {
     if (isset($parms['if_component_exists'])) {
         if (!CMS::component_exists($parms['if_component_exists'])) {
             return false;
         }
     }
     return true;
 }
开发者ID:techart,项目名称:tao,代码行数:9,代码来源:Fields.php


注:本文中的CMS::component_exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。