/** * Constructor. Will return an instance of the correct ACL class. * */ function __construct() { $name = Configure::read('Acl.classname'); if (!class_exists($name)) { if (loadComponent($name)) { if (strpos($name, '.') !== false) { list($plugin, $name) = explode('.', $name); } $name .= 'Component'; } else { trigger_error(sprintf(__('Could not find %s.', true), $name), E_USER_WARNING); } } $this->_Instance =& new $name(); $this->_Instance->initialize($this); }
<?php // Selenium Helpers // - - - - - - - - - - - - - - - - - - - // loadRequiredComponents loadComponent("selenium/selenium/selenium.php");
/** * Load dependencies for given element (controller/component/helper) * * @param string $element Element to load dependency for * @access private */ function __loadDependencies($element) { switch (low($element)) { case 'behavior': loadModel(null); loadBehavior(null); break; case 'controller': loadController(null); break; case 'component': loadComponent(null); break; case 'helper': uses('view' . DS . 'helper'); loadHelper(null); break; case 'model': loadModel(null); break; } }
/** * Enter description here... * * @param array $loaded * @param array $components * @return loaded components * @access private */ function &__loadComponents(&$loaded, $components) { foreach ($components as $component) { $parts = preg_split('/\\/|\\./', $component); if (count($parts) === 1) { $plugin = $this->__controller->plugin; } else { $plugin = Inflector::underscore($parts['0']); $component = $parts[count($parts) - 1]; } $componentCn = $component . 'Component'; if (in_array($component, array_keys($loaded)) !== true) { if (!class_exists($componentCn)) { if (is_null($plugin) || !loadPluginComponent($plugin, $component)) { if (!loadComponent($component)) { $this->cakeError('missingComponentFile', array(array('className' => $this->__controller->name, 'component' => $component, 'file' => Inflector::underscore($component) . '.php', 'base' => $this->__controller->base))); exit; } } if (!class_exists($componentCn)) { $this->cakeError('missingComponentClass', array(array('className' => $this->__controller->name, 'component' => $component, 'file' => Inflector::underscore($component) . '.php', 'base' => $this->__controller->base))); exit; } } if ($componentCn == 'SessionComponent') { $param = strip_plugin($this->__controller->base, $this->__controller->plugin) . '/'; } else { $param = null; } $this->__controller->{$component} =& new $componentCn($param); $loaded[$component] =& $this->__controller->{$component}; if (isset($this->__controller->{$component}->components) && is_array($this->__controller->{$component}->components)) { $loaded =& $this->__loadComponents($loaded, $this->__controller->{$component}->components); } } } return $loaded; }
/** * Smarty plugin * * @package Smarty * @subpackage PluginsFunction * @author Bismay Kumar Mohaptra */ function smarty_function_content($params) { loadComponent($params['src']); }
<?php // Enabled only if in Developer Mode if (developer_mode != false) { if (developer_mode == "all") { $select = array("selenium", "phpunit", "firephp"); } else { $select = split(",", developer_mode); } if ($select == "selenium" || $select == "all") { loadComponent("selenium_helpers.php"); } if ($select == "firephp" || $select == "all") { loadComponent("firephp_helpers.php"); } if ($select == "phpunit" || $select == "all") { loadComponent("phpunit_helpers.php"); } loadComponent("FirePHP/FirePHP.class.php"); }