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


PHP Component::isActive方法代码示例

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


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

示例1: shouldAdd

 private static function shouldAdd($one, $two = false, $three = false, $four = false, $five = false)
 {
     //Controller not initiated yet.
     if (!Controller::getInit()) {
         return false;
     }
     //Some low level utilities only checks if the class exists, not if it is active
     if (!Component::isActive('BackendError')) {
         return false;
     }
     //Busy with something?
     if (self::$adding) {
         if (Controller::$debug) {
             var_dump($one, $two, $three, $four, $five);
             print_stacktrace();
             die('Recursive Backend Errors');
         }
         return false;
     }
     //Probably addBE
     if (!is_string($three) || !file_exists($three)) {
         return true;
     }
     if (Controller::$mode == Controller::MODE_EXECUTE) {
         //Check if the error originated in our realm
         if (stripos(BACKEND_FOLDER, $three) === false && stripos(APP_FOLDER, $three) === false && stripos(WEB_FOLDER, $three) === false && (!defined('SITE_FOLDER') || stripos(SITE_FOLDER, $three) === false)) {
             return false;
         }
     }
     return true;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:31,代码来源:BackendError.obj.php

示例2: action_check_defines

 public function action_check_defines()
 {
     if (!Component::isActive('BackendError')) {
         return false;
     }
     $query = new SelectQuery('BackendError');
     $query->distinct()->field('query')->filter("`string` LIKE 'Undefined index: %'")->filter("`file` LIKE '%\\\\Render.obj.php(%) : eval()\\'d code'")->filter("`query` LIKE 'a_p_i/define/%'");
     return $query->fetchAll(array(), array('column' => 0));
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:9,代码来源:API.obj.php

示例3: loadRelation

 private function loadRelation($class, $options, $load_mode)
 {
     $class_name = array_key_exists('model', $options) ? $options['model'] . 'Obj' : $class . 'Obj';
     if (!Component::isActive($class_name)) {
         return null;
     }
     $conds = array();
     $params = array();
     $relation = new $class_name(array('name' => $options['name']));
     $conditions = array_key_exists('conditions', $options) ? $options['conditions'] : false;
     $type = array_key_exists('type', $options) ? $options['type'] : 'single';
     $order = array_key_exists('order', $options) ? $options['order'] : $relation->getMeta('order');
     if ($conditions) {
         foreach ($conditions as $field => $name) {
             if (is_array($name)) {
                 $operator = key($name);
                 $name = current($name);
             } else {
                 $operator = '=';
             }
             if ($this->array) {
                 $value = array_key_exists($name, $this->array) ? $this->array[$name] : $name;
             } else {
                 if ($this->object) {
                     $value = array_key_exists($name, $this->object) ? $this->object->{$name} : $name;
                 } else {
                     continue;
                 }
             }
             switch ($operator) {
                 case '=':
                     $conds[] = '`' . $field . '` = :' . $name;
                     break;
                 case 'FIND_IN_SET':
                 case 'in_set':
                     $conds[] = 'FIND_IN_SET(:' . $name . ', `' . $field . '`)';
                     break;
                 case 'IN':
                     $conds[] = '`' . $field . '` IN (' . $value . ')';
                     break;
             }
             $params[':' . $name] = $value;
         }
     }
     if ($type == 'multiple') {
         $mode = 'list';
     } else {
         $mode = $load_mode;
     }
     if (Controller::$debug >= 2) {
         var_dump(get_class($relation), $mode, $conds, $params, $order);
     }
     $relation->read(array('mode' => $mode, 'conditions' => $conds, 'parameters' => $params, 'order' => $order));
     return $relation;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:55,代码来源:DBObject.obj.php

示例4: get

 public function get($name = false, $type = BackendLock::LOCK_CUSTOM, $expire = null, $password = null)
 {
     if (empty($password)) {
         if (Component::isActive('BackendError')) {
             BackendError::add('Missing BackendSystemLock Password', 'No password was supplied for the system lock named ' . $name);
         }
         return null;
     }
     $result = parent::get($name, $type, $expire);
     if ($result) {
         ConfigValue::set('LockPassword_' . $this->array['name'], $password);
     }
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:13,代码来源:BackendSystemLockObj.obj.php

示例5: set

 public static function set($name, $value)
 {
     self::$cache[$name] = $value;
     if (Component::isActive('Value')) {
         return Value::set($name, $value);
     }
     $name = explode('.', $name);
     if (count($name) == 1) {
         array_unshift($name, 'application');
     }
     //Update the config file
     return Backend::setConfig($name, $value);
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:13,代码来源:ConfigValue.obj.php

示例6: hook_output

 public static function hook_output($to_print)
 {
     Backend::add('BackendErrors', Backend::getError());
     Backend::add('BackendSuccess', Backend::getSuccess());
     Backend::add('BackendNotices', Backend::getNotice());
     Backend::add('BackendInfo', Backend::getInfo());
     Backend::setError();
     Backend::setSuccess();
     Backend::setNotice();
     Backend::setInfo();
     $content = Backend::getContent();
     if (empty($content)) {
         ob_start();
         var_dump($to_print);
         $content = ob_get_clean();
         if (substr($content, 0, 4) != '<pre') {
             $content = '<pre>' . $content . '</pre>';
         }
         Backend::addContent($content);
     }
     $layout = Backend::get('HTMLLayout', 'index');
     if (!Render::checkTemplateFile($layout . '.tpl.php')) {
         if (SITE_STATE != 'production') {
             Backend::addError('Missing Layout ' . $layout);
         }
         $layout = 'index';
     }
     $to_print = Render::file($layout . '.tpl.php');
     $to_print = self::addLastContent($to_print);
     $to_print = self::replace($to_print);
     $to_print = self::rewriteLinks($to_print);
     $to_print = self::addLinks($to_print);
     $to_print = self::formsAcceptCharset($to_print);
     //TODO fix this
     if (Component::isActive('BackendFilter')) {
         $BEFilter = new BEFilterObj();
         $BEFilter->read();
         $filters = $BEFilter->list ? $BEFilter->list : array();
         foreach ($filters as $row) {
             if (class_exists($row['class'], true) && is_callable(array($row['class'], $row['function']))) {
                 $to_print = call_user_func(array($row['class'], $row['function']), $to_print);
             }
         }
     }
     //TODO Make this configurable
     if (ConfigValue::get('html_view.TidyHTML') && function_exists('tidy_repair_string')) {
         $to_print = tidy_repair_string($to_print);
     }
     return $to_print;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:50,代码来源:HtmlView.obj.php

示例7: html_display

 public function html_display($result)
 {
     $result = parent::html_display($result);
     if (Value::get(get_class($this) . '_commented', true) && Component::isActive('Comment')) {
         if ($result instanceof DBObject) {
             $comments = Comment::getComments($result->getMeta('table'), $result->getMeta('id'));
             Backend::addContent(Render::renderFile('comments.tpl.php', array('comment_list' => $comments)));
             if (Permission::check('create', 'comment')) {
                 $values = array('foreign_table' => $result->getMeta('table'), 'foreign_id' => $result->getMeta('id'));
                 Backend::addContent(Render::renderFile('comment.add.tpl.php', $values));
             }
         }
     }
     return $result;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:15,代码来源:CommentedController.obj.php

示例8: hook_view_name

 public static function hook_view_name($view_name)
 {
     //TODO Check for a Theme here
     //Check for a Mobile version of the View
     $mobile = false;
     if (Component::isActive('Wurfl')) {
         $device = Wurfl::getDevice();
         if ($device && $device->getCapability('mobile_browser') != '' || array_key_exists('mobile', $_REQUEST)) {
             $mobile = true;
         }
     }
     if ($mobile && Component::isActive('Mobile' . $view_name)) {
         $view_name = 'Mobile' . $view_name;
     }
     return $view_name;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:16,代码来源:Theme.obj.php

示例9: run

 public static function run($hookName, $type, array $parameters = array(), array $options = array())
 {
     //Specify what should be returned if the result of the hook is NULL
     //This ensures that hooks return what they should, even if the hook doesn't run
     $result = null;
     if (count($parameters)) {
         $returnIndex = array_key_exists('return_index', $options) ? $options['return_index'] : null;
         if (is_null($returnIndex)) {
             //Default to the first parameter passed
             $result = reset($parameters);
         } else {
             $result = $parameters[$returnIndex];
         }
     }
     //If the result was specified, return that
     $result = array_key_exists('toret', $options) ? $options['toret'] : $result;
     if ($hooks = self::get($hookName, $type)) {
         foreach ($hooks as $hook) {
             //Check if the hook is active and callable
             if (Component::isActive($hook['class'])) {
                 if (is_callable(array($hook['class'], $hook['method']))) {
                     if (Controller::$debug >= 2) {
                         $notice = 'Running ' . $hook['class'] . '::' . $hook['method'] . ' for hook ' . $hookName . '-' . $type;
                         Backend::addNotice($notice);
                     }
                     //Run it
                     $toret = call_user_func_array(array($hook['class'], $hook['method']), $parameters);
                     if (!is_null($toret)) {
                         $result = $toret;
                         if (count($parameters) && !is_null($returnIndex)) {
                             $parameters[$returnIndex] = $toret;
                         }
                     }
                 } else {
                     if (Controller::$debug) {
                         Backend::addNotice('Undefined Hook: ' . $hook['class'] . '::' . $hook['method']);
                     }
                 }
             }
         }
     }
     return $result;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:43,代码来源:Hook.obj.php

示例10: hook_output

 public static function hook_output($to_print)
 {
     Backend::add('BackendErrors', Backend::getError());
     Backend::add('BackendSuccess', Backend::getSuccess());
     Backend::add('BackendNotices', Backend::getNotice());
     Backend::add('BackendInfo', Backend::getInfo());
     Backend::setError();
     Backend::setSuccess();
     Backend::setNotice();
     Backend::setInfo();
     $content = Backend::getContent();
     if (empty($content)) {
         ob_start();
         var_dump($to_print);
         $content = ob_get_clean();
         if (substr($content, 0, 4) != '<pre') {
             $content = '<pre>' . $content . '</pre>';
         }
         Backend::addContent($content);
     }
     $to_print = Render::renderFile('styles.area.tpl.php');
     $to_print .= Render::renderFile('maincontent.tpl.php');
     $to_print .= Render::renderFile('scripts.tpl.php');
     $to_print = HtmlView::addLastContent($to_print);
     $to_print = HtmlView::replace($to_print);
     $to_print = HtmlView::rewriteLinks($to_print);
     $to_print = HtmlView::addLinks($to_print);
     $to_print = HtmlView::formsAcceptCharset($to_print);
     if (Component::isActive('BackendFilter')) {
         $BEFilter = new BEFilterObj();
         $BEFilter->read();
         $filters = $BEFilter->list ? $BEFilter->list : array();
         foreach ($filters as $row) {
             if (class_exists($row['class'], true) && is_callable(array($row['class'], $row['function']))) {
                 $to_print = call_user_func(array($row['class'], $row['function']), $to_print);
             }
         }
     }
     return $to_print;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:40,代码来源:ChunkView.obj.php

示例11: __exception_handler

 public static function __exception_handler($exception)
 {
     if (Controller::$debug) {
         $trace = array_reverse($exception->getTrace());
         echo '<ol>';
         foreach ($trace as $item) {
             echo '<li>';
             if (isset($item['file'])) {
                 echo $item['file'];
             }
             if (isset($item['line'])) {
                 echo '(' . $item['line'] . ') called ';
             }
             if (isset($item['class'])) {
                 echo '<strong>' . $item['class'] . '</strong>->';
             }
             if (isset($item['function'])) {
                 echo '<i>' . $item['function'] . '</i>';
             }
             echo '</li>';
         }
         echo '</ol>';
     }
     echo "Uncaught exception: ", $exception->getMessage(), ' in ', $exception->getFile(), ' line ', $exception->getLine(), "\n";
     if (Component::isActive('BackendError')) {
         BackendError::add($exception->getCode(), "Uncaught exception: " . $exception->getMessage(), $exception->getFile(), $exception->getLine());
     }
     //Execution ends here
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:29,代码来源:Backend.obj.php

示例12: check

 public static function check($action = '*', $subject = '*', $subject_id = 0)
 {
     if (!BACKEND_WITH_DATABASE) {
         return true;
     }
     static $cache = array();
     if (is_object($subject)) {
         $subject = get_class($subject);
     }
     $key = serialize(array($action, $subject, $subject_id));
     if (array_key_exists($key, $cache)) {
         //return $cache[$key];
     }
     $roles = GateKeeper::permittedRoles($action, class_for_url($subject), $subject_id);
     $user = BackendUser::check();
     $user = !$user && !empty($_SESSION['BackendUser']) ? $_SESSION['BackendUser'] : $user;
     if (!$user && !in_array('anonymous', $roles)) {
         if (Controller::$debug) {
             Backend::addNotice('Anonymous User');
         }
         $cache[$key] = true;
         return true;
     }
     if ($subject != '*' && !Component::isActive(class_name($subject))) {
         if (Controller::$debug) {
             Backend::addNotice('Invalid Component: ' . class_name($subject));
         }
         $cache[$key] = false;
         return false;
     }
     if (empty($user->roles)) {
         if (Controller::$debug) {
             Backend::addNotice('No User Roles');
         }
         $cache[$key] = false;
         return false;
     }
     $intersect = is_array($roles) ? array_intersect($user->roles, $roles) : $user->roles;
     if (Controller::$debug >= 2) {
         Backend::addNotice('Valid roles found: ' . json_encode($intersect));
     }
     $result = count($intersect) ? true : false;
     $cache[$key] = $result;
     return $result;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:45,代码来源:Permission.obj.php

示例13: daily

 public function daily($options)
 {
     if (Component::isActive('BackendSearch')) {
         BackendSearch::doIndex($this, array('name', 'title', 'markdown'));
     }
     return true;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:7,代码来源:Content.obj.php

示例14: getViewName

 private static function getViewName()
 {
     //Check the mode parameter
     $query_vars = Controller::getQueryVars();
     if (array_key_exists('mode', $query_vars)) {
         $view_name = ucwords($query_vars['mode']) . 'View';
         return $view_name;
     }
     //No View found, check the accept header
     $default_precedence = array('text/html' => (double) 1, 'application/xhtml+xml' => 0.9, 'application/xml' => 0);
     $mime_ranges = Parser::accept_header(false, $default_precedence);
     if (!$mime_ranges) {
         return ConfigValue::get('DefaultView', 'HtmlView');
     }
     $types = array();
     $main_types = array();
     $view_name = false;
     foreach ($mime_ranges as $mime_type) {
         $types[] = $mime_type['main_type'] . '/' . $mime_type['sub_type'];
         $main_types[] = $mime_type['main_type'];
         if (!$view_name) {
             $name = class_name(str_replace('+', ' ', $mime_type['main_type']) . ' ' . str_replace('+', ' ', $mime_type['sub_type'])) . 'View';
             if (Component::isActive($name)) {
                 $view_name = $name;
             } else {
                 $name = class_name(str_replace('+', ' ', $mime_type['main_type'])) . 'View';
                 if (Component::isActive($name)) {
                     $view_name = $name;
                 } else {
                     $name = class_name(str_replace('+', ' ', $mime_type['sub_type'])) . 'View';
                     if (Component::isActive($name)) {
                         $view_name = $name;
                     }
                 }
             }
         }
     }
     if (in_array('image', $main_types) && in_array('application', $main_types)) {
         //Probably IE
         $view_name = 'HtmlView';
     } else {
         if (in_array('application/xml', $types) && in_array('application/xhtml+xml', $types) && in_array('text/html', $types)) {
             //Maybe another confused browser that asks for XML and HTML
             $view_name = 'HtmlView';
         } else {
             if (count($mime_ranges) == 1 && $mime_ranges[0]['main_type'] == '*' && $mime_ranges[0]['sub_type'] == '*') {
                 $view_name = ConfigValue::get('DefaultView', 'HtmlView');
             }
         }
     }
     return $view_name;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:52,代码来源:View.obj.php

示例15: post_change_password

 /**
  * @todo Refactor this so that an admin user can do backend_user/change_password/$username/$new_password
  */
 public function post_change_password()
 {
     $current = Controller::getVar('current_password');
     $password = Controller::getVar('password');
     $confirm = Controller::getVar('confirm_password');
     if ($confirm != $password) {
         Backend::addError('New password doesn\'t match');
         return false;
     }
     if (!($user = self::check())) {
         Backend::addError('Invalid User (Anonymous)');
         return false;
     }
     $userObj = self::getObject(get_class($this), $user->id);
     if (!$userObj->array) {
         Backend::addError('Invalid User');
         return false;
     }
     list($query, $params) = self::authenticate($user->username, $current, true);
     if (!$query->fetchAssoc($params)) {
         Backend::addError('Incorrect current password provided');
         return false;
     }
     if (!$userObj->update(array('password' => $password))) {
         Backend::addError('Could not update password');
         return false;
     }
     //Reread the user
     $userObj->read(array('query' => $query, 'parameters' => $params, 'mode' => 'object'));
     if ($userObj->object) {
         session_regenerate_id();
         $_SESSION['BackendUser'] = $userObj->object;
         if (Component::isActive('PersistUser')) {
             PersistUser::remember($userObj->object);
         }
     }
     return true;
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:41,代码来源:BackendUser.obj.php


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