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


PHP Configure::listObjects方法代码示例

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


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

示例1: buildAcl

 function buildAcl()
 {
     $log = array();
     $aco = $this->MyAcl->Myaco;
     $aco->recursive = 0;
     $root = $aco->find(array('alias' => '/everything'));
     if (!$root) {
         $aco->create(array('parent_id' => null, 'model' => null, 'alias' => '/everything'));
         $root = $aco->save();
         $root['id'] = $aco->id;
         $log[] = 'Created Aco node for /everything';
     } else {
         $root = $root['Myaco'];
     }
     App::import('Core', 'File');
     $Controllers = Configure::listObjects('controller');
     $appIndex = array_search('App', $Controllers);
     if ($appIndex !== false) {
         unset($Controllers[$appIndex]);
     }
     $baseMethods = get_class_methods('Controller');
     $baseMethods[] = 'buildAcl';
     // look at each controller in app/controllers
     foreach ($Controllers as $ctrlName) {
         App::import('Controller', $ctrlName);
         $ctrlclass = $ctrlName . 'Controller';
         $methods = get_class_methods($ctrlclass);
         // find / make controller node
         $controllerNode = $aco->find(array('alias' => '/everything/' . $ctrlName));
         if (!$controllerNode) {
             $aco->create(array('parent_id' => $root['id'], 'alias' => "/everything/{$ctrlName}"));
             $controllerNode = $aco->save();
             $controllerNode['id'] = $aco->id;
             $log[] = "Created Aco node for /everything/{$ctrlName}";
         } else {
             $controllerNode = $controllerNode['Myaco'];
         }
         //clean the methods. to remove those in Controller and private actions.
         foreach ($methods as $k => $method) {
             if (strpos($method, '_', 0) === 0) {
                 unset($methods[$k]);
                 continue;
             }
             if (in_array($method, $baseMethods)) {
                 unset($methods[$k]);
                 continue;
             }
         }
         foreach ($methods as $method) {
             $methodNode = $aco->find(array('alias' => '/everything/' . $ctrlName . '/' . $method));
             if (!$methodNode) {
                 $aco->create(array('parent_id' => $controllerNode['id'], 'alias' => "/everything/{$ctrlName}/{$method}"));
                 $methodNode = $aco->save();
                 $log[] = "Created Aco node for /everything/{$ctrlName}/{$method}";
             }
         }
     }
     $this->set('log', $log);
 }
开发者ID:erlendfh,项目名称:Bromine,代码行数:59,代码来源:manage_acl_controller.php

示例2: shouldNotMatchController

 public function shouldNotMatchController($field)
 {
     $controllers = Configure::listObjects('controller');
     if (in_array(current($field), $controllers)) {
         return current($field) . ' is an illegal username';
     }
     return true;
 }
开发者ID:predominant,项目名称:CakeFest-Berlin-2009-Workshop,代码行数:8,代码来源:user.php

示例3: startup

 function startup()
 {
     $appPaths = array_diff(Configure::read('modelPaths'), Configure::corePaths('model'));
     $this->models = Configure::listObjects('model', $appPaths, false);
     if (empty($this->params['src'])) {
         $this->params['src'] = ROOT . DS . 'src';
     }
 }
开发者ID:BGCX067,项目名称:fake-as3-svn-to-git,代码行数:8,代码来源:fake.php

示例4: buildAcl

 function buildAcl()
 {
     $log = array();
     $aco =& $this->Acl->Aco;
     $root = $aco->node('controllers');
     if (!$root) {
         $aco->create(array('parent_id' => null, 'model' => null, 'alias' => 'controllers'));
         $root = $aco->save();
         $root['Aco']['id'] = $aco->id;
         $log[] = 'Created Aco node for controllers';
     } else {
         $root = $root[0];
     }
     App::import('Core', 'File');
     $Controllers = Configure::listObjects('controller');
     $appIndex = array_search('App', $Controllers);
     if ($appIndex !== false) {
         unset($Controllers[$appIndex]);
     }
     $baseMethods = get_class_methods('Controller');
     $baseMethods[] = 'buildAcl';
     // look at each controller in app/controllers
     foreach ($Controllers as $ctrlName) {
         App::import('Controller', $ctrlName);
         $ctrlclass = $ctrlName . 'Controller';
         $methods = get_class_methods($ctrlclass);
         // find / make controller node
         $controllerNode = $aco->node('controllers/' . $ctrlName);
         if (!$controllerNode) {
             $aco->create(array('parent_id' => $root['Aco']['id'], 'model' => null, 'alias' => $ctrlName));
             $controllerNode = $aco->save();
             $controllerNode['Aco']['id'] = $aco->id;
             $log[] = 'Created Aco node for ' . $ctrlName;
         } else {
             $controllerNode = $controllerNode[0];
         }
         // clean the methods. to remove those in Controller and private actions.
         foreach ($methods as $k => $method) {
             if (strpos($method, '_', 0) === 0) {
                 unset($methods[$k]);
                 continue;
             }
             if (in_array($method, $baseMethods)) {
                 unset($methods[$k]);
                 continue;
             }
             $methodNode = $aco->node('controllers/' . $ctrlName . '/' . $method);
             if (!$methodNode) {
                 $aco->create(array('parent_id' => $controllerNode['Aco']['id'], 'model' => null, 'alias' => $method));
                 $methodNode = $aco->save();
                 $log[] = 'Created Aco node for ' . $method;
             }
         }
     }
     debug($log);
     $this->Session->setFlash('Database succesfully initialised');
     $this->redirect(array('controller' => '/'));
 }
开发者ID:kenners,项目名称:uamuzi-bora,代码行数:58,代码来源:users_controller.php

示例5: testGetPlugins

 function testGetPlugins()
 {
     $_allPlugins = Configure::listObjects('plugin');
     $allPlugins = array() + array('' => 'None');
     foreach ($_allPlugins as $k => $v) {
         $allPlugins[Inflector::underscore($v)] = $v;
     }
     // need to see how to do this
     //$this->assertEqual(count($this->Infinitas->getPlugins($this->AppModel, true)), count($allPlugins));
 }
开发者ID:rchavik,项目名称:infinitas,代码行数:10,代码来源:infinitas.test.php

示例6: getDBDrivers

 function getDBDrivers()
 {
     $drivers = array();
     $dbo_path = APP . LIBS . "model" . DS . "datasources" . DS . "dbo";
     $files = Configure::listObjects('file', $dbo_path, false);
     foreach ($files as $fname) {
         $name = substr(substr($fname, strpos($fname, "_") + 1), 0, -4);
         $drivers[$name] = $name;
     }
     return $drivers;
 }
开发者ID:maverick2041,项目名称:wpkgexpress,代码行数:11,代码来源:installer.php

示例7: _getControllers

 function _getControllers()
 {
     $controllerList = Configure::listObjects('controller');
     $controllers = array();
     foreach ($controllerList as $controller) {
         if ($controller == 'App') {
             continue;
         }
         $controllers[$controller] = $this->_getControllerMethods($controller);
     }
     return $controllers;
 }
开发者ID:kouak,项目名称:ircube,代码行数:12,代码来源:controller_list.php

示例8: __getClass

 function __getClass($className)
 {
     $this->type = null;
     $classType = false;
     $className = $this->__fixClassName($className);
     if ($this->type) {
         $types = array($this->type);
     } else {
         $types = array('model', 'helper');
     }
     $class = $className;
     if (strpos($className, '.') !== false) {
         list($plugin, $className) = explode('.', $className);
         $this->objectPath = App::pluginPath($plugin);
     }
     foreach ($types as $type) {
         $objects = Configure::listObjects($type, $this->objectPath ? $this->objectPath . Inflector::pluralize($type) . DS : null, $this->objectCache);
         if (in_array($className, $objects)) {
             $classType = $type;
             break;
         }
     }
     switch ($classType) {
         case 'model':
             return ClassRegistry::init($class);
         case 'controller':
             App::import('Controller', $class);
             $className = $className . 'Controller';
             return new $className();
         case 'component':
             App::import('Controller', 'Controller');
             $Controller = new Controller();
             $Controller->params['action'] = '';
             App::import('Component', $class);
             $className = $className . 'Component';
             $Class = new $className();
             $Class->initialize($Controller);
             $Class->startup($Controller);
             return $Class;
         case 'helper':
             $this->raw = true;
             App::import('Controller', 'Controller');
             $Controller = new Controller();
             $Controller->helpers[] = $class;
             App::import('View', 'View');
             $View =& new View($Controller);
             $loaded = array();
             $helpers = $View->_loadHelpers($loaded, $Controller->helpers);
             return $helpers[$className];
     }
     return false;
 }
开发者ID:sandulungu,项目名称:StarLight,代码行数:52,代码来源:interactive.php

示例9: beforeRender

 /**
  * beforeRender
  *
  * Application hook which runs after each action but, before the view file is
  * rendered
  *
  * @access public
  */
 function beforeRender()
 {
     //If we have an authorised user logged then pass over an array of controllers
     //to which they have index action permission
     if ($this->Auth->user()) {
         $controllerList = Configure::listObjects('controller');
         $permittedControllers = array();
         foreach ($controllerList as $controllerItem) {
             if ($controllerItem != 'App') {
                 if ($this->__permitted($controllerItem, 'index')) {
                     $permittedControllers[] = $controllerItem;
                 }
             }
         }
     }
     $this->set(compact('permittedControllers'));
 }
开发者ID:johnulist,项目名称:CakePHP-Classifieds,代码行数:25,代码来源:app_controller.php

示例10: initialize

 /**
  * Override intialize of the Shell
  *
  * @access public
  */
 function initialize()
 {
     require_once CAKE . 'dispatcher.php';
     $this->Dispatcher = new Dispatcher();
     $this->models = Configure::listObjects('model');
     App::import('Model', $this->models);
     foreach ($this->models as $model) {
         $class = Inflector::camelize(r('.php', '', $model));
         $this->models[$model] = $class;
         $this->{$class} =& new $class();
     }
     $this->out('Model classes:');
     $this->out('--------------');
     foreach ($this->models as $model) {
         $this->out(" - {$model}");
     }
 }
开发者ID:subh,项目名称:raleigh-workshop-08,代码行数:22,代码来源:console.php

示例11: afterFind

 /**
  * afterFind method
  *
  * @param mixed $Model
  * @param mixed $results
  * @param bool $primary
  * @access public
  * @return void
  */
 function afterFind(&$Model, $results, $primary = false)
 {
     extract($this->settings[$Model->alias]);
     if (App::import('Vendor', 'Mi.MiCache')) {
         $models = MiCache::mi('models');
     } else {
         $models = Configure::listObjects('model');
     }
     if ($primary && isset($results[0][$Model->alias][$modelField]) && isset($results[0][$Model->alias][$foreignKey]) && $Model->recursive > 0) {
         foreach ($results as $key => $result) {
             $associated = array();
             $model = Inflector::classify($result[$Model->alias][$modelField]);
             $foreignId = $result[$Model->alias][$foreignKey];
             if ($model && $foreignId && in_array($model, $models)) {
                 $result = $result[$Model->alias];
                 if (!isset($Model->{$model})) {
                     $Model->bindModel(array('belongsTo' => array($model => array('conditions' => array($Model->alias . '.' . $modelField => $model), 'foreignKey' => $foreignKey))));
                 }
                 $conditions = array($model . '.' . $Model->{$model}->primaryKey => $result[$foreignKey]);
                 $recursive = -1;
                 $associated = $Model->{$model}->find('first', compact('conditions', 'recursive'));
                 $name = $Model->{$model}->display($result[$foreignKey]);
                 $associated[$model]['display_field'] = $name ? $name : '*missing*';
                 $results[$key][$model] = $associated[$model];
             }
         }
     } elseif (isset($results[$Model->alias][$modelField])) {
         $associated = array();
         $model = Inflector::classify($result[$Model->alias][$modelField]);
         $foreignId = $results[$Model->alias][$foreignKey];
         if ($model && $foreignId) {
             $result = $results[$Model->alias];
             if (!isset($Model->{$model})) {
                 $Model->bindModel(array('belongsTo' => array($model => array('conditions' => array($Model->alias . '.' . $modelField => $model), 'foreignKey' => $foreignKey))));
             }
             $conditions = array($model . '.' . $Model->{$model}->primaryKey => $result[$foreignKey]);
             $recursive = -1;
             $associated = $Model->{$model}->find('first', compact('conditions', 'recursive'));
             $name = $Model->{$model}->display($result[$foreignKey]);
             $associated[$model]['display_field'] = $name ? $name : '*missing*';
             $results[$model] = $associated[$model];
         }
     }
     return $results;
 }
开发者ID:hiromi2424,项目名称:mi,代码行数:54,代码来源:polymorphic.php

示例12: setPrivileges

 function setPrivileges()
 {
     // get controllers
     $controllers = Configure::listObjects('controller');
     $this->filter['methods'] = get_class_methods('Controller');
     $this->filter['controller'] = array('App', 'Pages');
     $list = array();
     foreach ($controllers as $c) {
         if (in_array($c, $this->filter['controller'])) {
             continue;
         }
         if (!App::import('Controller', $c)) {
             foreach ($plugins as $p) {
                 if (strpos($p, $c) === 0 && App::import('Controller', $p . '.' . $c)) {
                     break;
                 }
             }
         }
         // get controller methods
         $list[$c] = $this->_getMethods($c . 'Controller', 'methods');
     }
     $i = '';
     foreach ($list as $key => $value) {
         foreach ($value as $k => $v) {
             $methods[$i] = array('controller' => $key, 'action' => $v);
             $i++;
         }
     }
     $groups = ClassRegistry::init('Group')->find('list', array('fields' => array('Group.id', 'Group.name'), 'recursive' => -1));
     $i = 0;
     foreach ($groups as $k => $v) {
         foreach ($methods as $key => $value) {
             $method[$i] = array('id' => $i, 'group_id' => $k, 'controller' => $value['controller'], 'action' => $value['action']);
             $i++;
         }
     }
     $this->Privilege = ClassRegistry::init('Privilege');
     foreach ($method as $key => $value) {
         $this->Privilege->create();
         $this->Privilege->save($value);
     }
 }
开发者ID:studdr,项目名称:cakephp-extras,代码行数:42,代码来源:permission.php

示例13: startup

 /**
  * Start up And load Acl Component / Aco model
  *
  * @return void
  **/
 function startup()
 {
     $this->Acl =& new AclComponent();
     $controller = null;
     $this->Acl->startup($controller);
     $this->Aro =& $this->Acl->Aro;
     $plugins = Configure::listObjects('plugin');
     $plugins[] = 'App';
     // include the non-plugin task if it exists
     foreach ($plugins as $plugin) {
         foreach ($this->Dispatch->shellPaths as $path) {
             $taskPath = $path . 'tasks' . DS . Inflector::underscore($plugin) . '_permissions.php';
             if (file_exists($taskPath)) {
                 $this->tasks[] = $plugin . 'Permissions';
                 break;
             }
         }
     }
     $this->loadTasks();
 }
开发者ID:jamiemill,项目名称:missioncontrol_core,代码行数:25,代码来源:permissions.php

示例14: admin_index

 function admin_index()
 {
     $this->UserGroup->recursive = 0;
     $data = $this->UserGroup->findAll();
     $Controllers = Configure::listObjects('controller');
     $controllerList = $this->ControllerList->get();
     // we loop on all action for all roles
     foreach ($controllerList as $controller => $actions) {
         foreach ($actions as $key => $action) {
             $controllerList[$controller][$action] = array();
             unset($controllerList[$controller][$key]);
             foreach ($data as $p) {
                 $controllerList[$controller][$action][$p['UserGroup']['id']] = $this->Acl->check($p, $controller . '/' . $action, '*');
             }
         }
     }
     //debug($controllerList);
     $this->set('ctlist', $controllerList);
     $this->set('data', $data);
 }
开发者ID:kouak,项目名称:ircube,代码行数:20,代码来源:user_groups_controller.php

示例15: get

 function get()
 {
     $controllerClasses = Configure::listObjects('controller');
     foreach ($controllerClasses as $controller) {
         if ($controller != 'App') {
             $filenName = strtolower($controller) . '_controller.php';
             $file = CONTROLLERS . $fileName;
             require_once $file;
             $className = $controller . 'Controller';
             $action = get_class_methods($className);
             foreach ($actions as $k => $v) {
                 if ($v[0] == '_') {
                     unset($actions[$k]);
                 }
             }
             $parentActions = get_class_methods('AppController');
             $controllers[$controller] = array_diff($actions, $parentActions);
         }
     }
     return $controllers;
 }
开发者ID:BGCX262,项目名称:ztrackerengine-svn-to-git,代码行数:21,代码来源:controller_list.php


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