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


PHP ClassRegistry::isKeySet方法代码示例

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


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

示例1: loadRoleOptions

 private function loadRoleOptions()
 {
     if (!ClassRegistry::isKeySet('SelectOptions')) {
         $this->loadModel('SelectOptions');
     }
     $this->set('roleOptions', $this->Roles->find('list', array('fields' => array('Roles.role_name', 'Roles.role_name'))));
 }
开发者ID:rajankz,项目名称:webspace,代码行数:7,代码来源:WorksheetsController.php

示例2: add

 /**
  * Add for problem.
  *
  * @param string $foreignKey, Book id 
  */
 public function add($objectType, $foreignKey)
 {
     try {
         $model = Inflector::classify($objectType);
         if (!ClassRegistry::isKeySet($model)) {
             $this->{$model} = ClassRegistry::init(Configure::read('Problems.Models.' . $model));
         } else {
             $this->{$model} = ClassRegistry::getObject($model);
         }
         if (get_class($this->{$model}) === 'AppModel') {
             throw new Exception(__d('problems', 'Could not save the Problem of unallowed type.'));
         }
         $result = $this->{$model}->report($foreignKey, $this->Auth->user('id'), $this->request->data);
         if ($result === true) {
             $this->_setFlash(__d('problems', 'The problem has been saved'), 'success');
             $this->Referer->redirect('/');
         }
     } catch (OutOfBoundsException $e) {
         $this->_setFlash($e->getMessage(), 'error');
     } catch (LogicException $e) {
         $this->_setFlash($e->getMessage(), 'error');
         $this->Referer->redirect('/');
     } catch (Exception $e) {
         $this->_setFlash($e->getMessage(), 'error');
         $this->redirect('/');
     }
     $types = $this->{$model}->Problem->types;
     $this->set(compact('foreignKey', 'types', 'objectType'));
 }
开发者ID:CakeDC,项目名称:problems,代码行数:34,代码来源:ProblemsController.php

示例3: __construct

 /**
  * コンストラクタ
  *
  * @return void
  * @access public
  */
 function __construct()
 {
     $this->_view =& ClassRegistry::getObject('view');
     if (isInstalled()) {
         if (ClassRegistry::isKeySet('Permission')) {
             $this->Permission = ClassRegistry::getObject('Permission');
         } else {
             $this->Permission = ClassRegistry::init('Permission');
         }
         if (ClassRegistry::isKeySet('Page')) {
             $this->Page = ClassRegistry::getObject('Page');
         } else {
             $this->Page = ClassRegistry::init('Page');
         }
         if (ClassRegistry::isKeySet('PageCategory')) {
             $this->PageCategory = ClassRegistry::getObject('PageCategory');
         } else {
             $this->PageCategory = ClassRegistry::init('PageCategory');
         }
         if (isset($this->_view->viewVars['siteConfig'])) {
             $this->siteConfig = $this->_view->viewVars['siteConfig'];
         }
         // プラグインのBaserヘルパを初期化
         $this->_initPluginBasers();
     }
 }
开发者ID:nazo,项目名称:phpcondo,代码行数:32,代码来源:baser.php

示例4: input

 function input($fieldName, $options = array())
 {
     if (ClassRegistry::isKeySet($this->model())) {
         $model =& ClassRegistry::getObject($this->model());
         if ($model->isOrigamiColumn($fieldName)) {
             $type = $model->getOrigamiColumnType($fieldName);
             if (method_exists($this, $type)) {
                 unset($options['type']);
                 // We are specifying the type, so we need to remove any user specified types
                 $out = $this->{$type}($fieldName, $options);
                 // The code is this section is mostly copied from the cake php
                 // FormHelper input method
                 $div = true;
                 $divOptions = array();
                 if (array_key_exists('div', $options)) {
                     $div = $options['div'];
                     unset($options['div']);
                 }
                 if (!empty($div)) {
                     $divOptions['class'] = 'input';
                     $divOptions = $this->addClass($divOptions, $type);
                     if (is_string($div)) {
                         $divOptions['class'] = $div;
                     } elseif (is_array($div)) {
                         $divOptions = array_merge($divOptions, $div);
                     }
                     if (in_array($this->field(), $this->fieldset['validates'])) {
                         $divOptions = $this->addClass($divOptions, 'required');
                     }
                     if (!isset($divOptions['tag'])) {
                         $divOptions['tag'] = 'div';
                     }
                 }
                 if ($type != 'hidden') {
                     $error = null;
                     if (isset($options['error'])) {
                         $error = $options['error'];
                         unset($options['error']);
                     }
                     if ($error !== false) {
                         $errMsg = $this->error($fieldName, $error);
                         if ($errMsg) {
                             $out .= $errMsg;
                             $divOptions = $this->addClass($divOptions, 'error');
                         }
                     }
                 }
                 if (isset($divOptions) && isset($divOptions['tag'])) {
                     $tag = $divOptions['tag'];
                     unset($divOptions['tag']);
                     $out = $this->Html->tag($tag, $out, $divOptions);
                 }
                 // end cake php inputs copy
                 return $out;
             }
         }
     }
     return parent::input($fieldName, $options);
 }
开发者ID:busytoby,项目名称:gitrbug,代码行数:59,代码来源:origami_form.php

示例5: setUpModel

 /**
  * KeywordConfig モデルを準備する
  * 
  */
 private function setUpModel()
 {
     if (ClassRegistry::isKeySet($this->plugin . '.KeywordConfig')) {
         $this->KeywordConfigModel = ClassRegistry::getObject($this->plugin . '.KeywordConfig');
     } else {
         $this->KeywordConfigModel = ClassRegistry::init($this->plugin . '.KeywordConfig');
     }
 }
开发者ID:ichi280,项目名称:keyword,代码行数:12,代码来源:KeywordViewEventListener.php

示例6: __construct

 /**
  * construct
  *
  * @param View $View
  */
 public function __construct(View $View)
 {
     parent::__construct($View);
     if (ClassRegistry::isKeySet('Page')) {
         $this->Page = ClassRegistry::getObject('Page');
     } else {
         $this->Page = ClassRegistry::init('Page', 'Model');
     }
 }
开发者ID:baserproject,项目名称:basercms,代码行数:14,代码来源:BcPageHelper.php

示例7: setup

 /**
  * Setup the behaviour and merge in the settings. Check that the model has the
  * required fields
  * 
  * @param Model $model
  * @param array $config
  */
 public function setup(Model $model, $config = array())
 {
     parent::setup($model, $config);
     $this->settings[$model->alias] = array_merge($this->defaults, $config);
     $this->modelAlias = $model->alias;
     $this->hasField($model);
     $this->checkPrefix($model);
     if (!ClassRegistry::isKeySet($this->settings[$model->alias]['statusModel'])) {
         $this->Status = ClassRegistry::init($this->settings[$model->alias]['statusModel']);
     }
 }
开发者ID:Adnan0703,项目名称:CakePHP-Statusable,代码行数:18,代码来源:StatusableBehavior.php

示例8: beforeRender

 function beforeRender()
 {
     $models = ClassRegistry::keys();
     foreach ($models as $currentModel) {
         if (ClassRegistry::isKeySet($currentModel)) {
             $currentObject =& ClassRegistry::getObject($currentModel);
             if (is_a($currentObject, 'Model') && !empty($currentObject->validationErrors)) {
                 $this->validationErrors[Inflector::camelize($currentModel)] =& $currentObject->validationErrors;
             }
         }
     }
 }
开发者ID:gildonei,项目名称:candycane,代码行数:12,代码来源:CustomFieldHelper.php

示例9: getLog

 /**
  * Get log instance.
  *
  * @param [type] $className [description]
  * @return CakeLog instance.
  */
 public static function getLog($className = null)
 {
     if (empty($className)) {
         $className = Common::read('Log.classname', 'CakeLog');
     }
     list($plugin, $className) = pluginSplit($className, true);
     $key = 'CommonLog';
     if (!ClassRegistry::isKeySet('CommonLog')) {
         App::uses($className, $plugin . 'Log');
         ClassRegistry::addObject('CommonLog', new $className());
     }
     $Log = ClassRegistry::getObject('CommonLog');
     return $Log;
 }
开发者ID:gourmet,项目名称:common,代码行数:20,代码来源:Common.php

示例10: getEnumValues

 function getEnumValues($ModelField)
 {
     // split input into Model and Fieldname
     $m = explode('.', $ModelField);
     if ($m[0] == $ModelField) {
         return false;
     } else {
         !ClassRegistry::isKeySet($m[0]) ? $this->loadModel($m[0]) : false;
         $type = $this->{$m}[0]->getColumnType($m[1]);
         preg_match_all("/'(.*?)'/", $type, $enums);
         foreach ($enums[1] as $value) {
             $enumList[$value] = $value;
         }
         return $enumList;
     }
 }
开发者ID:troneras,项目名称:bodega,代码行数:16,代码来源:AppController.php

示例11: setup

 /**
  * Sets up the configuation for the model, and loads ACL models if they haven't been already
  *
  * @param mixed $config
  */
 function setup(&$model, $config = array())
 {
     if (is_string($config)) {
         $config = array('type' => $config);
     }
     $this->settings[$model->alias] = array_merge(array('type' => 'requester'), (array) $config);
     $type = $this->__typeMaps[$this->settings[$model->alias]['type']];
     if (!ClassRegistry::isKeySet($type)) {
         uses('model' . DS . 'db_acl');
         $object =& new $type();
     } else {
         $object =& ClassRegistry::getObject($type);
     }
     $model->{$type} =& $object;
     if (!method_exists($model, 'parentNode')) {
         trigger_error("Callback parentNode() not defined in {$model->alias}", E_USER_WARNING);
     }
 }
开发者ID:kaz0636,项目名称:openflp,代码行数:23,代码来源:acl.php

示例12: __debug

 function __debug()
 {
     $argc = func_num_args();
     $args = func_get_args();
     if ($argc == 0) {
         return false;
     }
     global $__session;
     if (Configure::read() == 0) {
         return false;
     }
     $class = 'CakeSession';
     if ($__session === null) {
         if (ClassRegistry::isKeySet($class)) {
             $__session =& ClassRegistry::getObject($class);
         } else {
             if (!class_exists($class)) {
                 App::import('Core', $class);
             }
             $__session =& new $class();
             ClassRegistry::addObject($class, $__session);
         }
     }
     $session =& $__session;
     if (!$session->started()) {
         $session->start();
     }
     $debugs = array();
     if ($session->check('debug.printable')) {
         $debugs = $session->read('debug.printable');
     }
     $debugger =& Debugger::getInstance();
     $trace = $debugger->trace(aa('start', 2, 'format', 'array'));
     while ($trace[0]['function'] === __FUNCTION__ || false !== strpos($trace[0]['function'], 'call_user_func')) {
         array_shift($trace);
     }
     $debug = compact('args', 'trace');
     $debugs = array_merge($debugs, array($debug));
     // debug(compact('prints','args'));
     $session->write('debug.printable', $debugs);
     return true;
 }
开发者ID:hiromi2424,项目名称:cake_base,代码行数:42,代码来源:bootstrap.php

示例13: Controller

 /**
  * undocumented
  *
  * @access public
  */
 function &getComponent($component)
 {
     $componentKey = 'Component.' . $component;
     if (ClassRegistry::isKeySet($componentKey)) {
         $Component =& ClassRegistry::getObject($componentKey);
     } else {
         Assert::true(App::import('Component', $component));
         $class = $component . 'Component';
         $Component = new $class();
         $Controller = new Controller();
         if (method_exists($Component, 'initialize')) {
             $Component->initialize($Controller, array());
         }
         if (method_exists($Component, 'startup')) {
             $Component->startup($Controller);
         }
     }
     Assert::isObject($Component);
     return $Component;
 }
开发者ID:stripthis,项目名称:donate,代码行数:25,代码来源:common.php

示例14: setup

 /**
  * Sets up the configuation for the model, and loads ACL models if they haven't been already
  *
  * @param mixed $config
  */
 function setup(&$model, $config = array())
 {
     if (empty($config)) {
         $config = array('Aro');
     } elseif (is_string($config)) {
         $config = array($config);
     }
     $this->settings[$model->name]['types'] = $config;
     foreach ($this->settings[$model->name]['types'] as $type) {
         if (!ClassRegistry::isKeySet($type)) {
             uses('model' . DS . 'db_acl');
             $object =& new $type();
         } else {
             $object =& ClassRegistry::getObject($type);
         }
         $model->{$type} =& $object;
     }
     if (!method_exists($model, 'parentNode')) {
         trigger_error("Callback parentNode() not defined in {$model->name}", E_USER_WARNING);
     }
 }
开发者ID:roae,项目名称:hello-world,代码行数:26,代码来源:aclx.php

示例15: __construct

 function __construct(&$controller)
 {
     if (is_object($controller)) {
         $this->viewVars = $controller->viewVars;
         if (isset($controller->compress)) {
             $this->compress = $controller->compress;
         }
         if ($this->compress === true) {
             $this->compress = 30100;
         }
         $dispatcher = AmfDispatcher::getInstance();
         $vars = array('binaryType', 'binaryLength', 'bigEndian', 'references', 'stored', 'types', 'requests', 'request', 'header', 'body', 'encoding');
         foreach ($vars as $var) {
             $this->{$var} = $dispatcher->{$var};
         }
     }
     if (ClassRegistry::isKeySet('amfview')) {
         $amf = ClassRegistry::getObject('amfview');
         $this->stream = $amf->stream;
         $this->__hasRendered = $amf->__hasRendered;
     }
     ClassRegistry::addObject('amfview', $this);
 }
开发者ID:BGCX067,项目名称:fake-as3-svn-to-git,代码行数:23,代码来源:amf.php


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