overload(get_class($class)); } elseif (is_string($class)) { overload($class); } } } else { overload(get_class($this)); } } } function __call($method, $params, &$return) { if (!method_exists($this, 'call__')) { trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR); } $return = $this->call__($method, $params); return true; } function __get($name, &$value) { $value = $this->get__($name); return true; } function __set($name, $value) { $this->set__($name, $value); return true; } } Overloadable::overload('Overloadable2');
{ //trigger_error(__('(Model::findCount) Deprecated, use Model::find("count")', true), E_USER_WARNING); return $this->find('count', compact('conditions', 'recursive')); } /** * @deprecated * @see Model::find('threaded') */ function findAllThreaded($conditions = null, $fields = null, $order = null) { //trigger_error(__('(Model::findAllThreaded) Deprecated, use Model::find("threaded")', true), E_USER_WARNING); return $this->find('threaded', compact('conditions', 'fields', 'order')); } /** * @deprecated * @see Model::find('neighbors') */ function findNeighbours($conditions = null, $field, $value) { //trigger_error(__('(Model::findNeighbours) Deprecated, use Model::find("neighbors")', true), E_USER_WARNING); $query = compact('conditions', 'field', 'value'); $query['fields'] = $field; if (is_array($field)) { $query['field'] = $field[0]; } return $this->find('neighbors', $query); } } if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { Overloadable::overload('Model'); }
/** * Used to overload objects as needed. * * @param string $type Model or Helper * @param string $name Class name to overload * @access private */ function __overload($type, $name) { if (($type === 'Model' || $type === 'Helper') && strtolower($name) != 'schema') { Overloadable::overload($name); } }
/** * Used to overload objects as needed. * * @param string $type Model or Helper * @param string $name Class name to overload * @access private */ function __overload($type, $name, $parent) { if (($type === 'Model' || $type === 'Helper') && $parent !== false) { Overloadable::overload($name); } }
/** * @deprecated * @see App::import('Model', 'PluginName.PluginModel'); */ function loadPluginModels($plugin) { if (!class_exists('AppModel')) { loadModel(); } $plugin = Inflector::underscore($plugin); $pluginAppModel = Inflector::camelize($plugin . '_app_model'); $pluginAppModelFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_model.php'; if (!class_exists($pluginAppModel)) { if (file_exists($pluginAppModelFile)) { require $pluginAppModelFile; Overloadable::overload($pluginAppModel); } } $pluginModelDir = APP . 'plugins' . DS . $plugin . DS . 'models' . DS; if (is_dir($pluginModelDir)) { foreach (listClasses($pluginModelDir) as $modelFileName) { list($name) = explode('.', $modelFileName); $className = Inflector::camelize($name); if (!class_exists($className)) { require $pluginModelDir . $modelFileName; Overloadable::overload($className); } } } trigger_error('loadPluginModels is deprecated see App::import(\'Model\', \'PluginName.PluginModel\');', E_USER_WARNING); }
/** * Used to overload Objects as needed * * @param string $type Model or Helper * @param string $name Class name to overload * @access private */ function __overload($type, $name) { $overload = array('Model', 'Helper'); if (in_array($type, $overload)) { Overloadable::overload($name); } }
/** * Loads a helper * * @param string $name Name of helper * @return boolean Success */ function loadHelper($name) { if (!class_exists('AppHelper')) { if (file_exists(APP . 'app_helper.php')) { require APP . 'app_helper.php'; } else { require CAKE . 'app_helper.php'; } Overloadable::overload('AppHelper'); } if ($name === null) { return true; } if (strpos($name, '.') !== false) { list($plugin, $name) = explode('.', $name); } $className = $name . 'Helper'; if (!class_exists($className)) { $name = Inflector::underscore($name); $helpers = Configure::read('Helpers'); if (is_array($helpers)) { if (array_key_exists($className, $helpers)) { require $helpers[$className]['path']; return true; } elseif (isset($helpers['Core']) && array_key_exists($className, $helpers['Core'])) { require $helpers['Core'][$className]['path']; return true; } } $paths = Configure::getInstance(); foreach ($paths->helperPaths as $path) { if (file_exists($path . $name . '.php')) { Configure::store('Helpers', 'class.paths', array($className => array('path' => $path . $name . '.php'))); require $path . $name . '.php'; return true; } } if ($helperFilename = fileExistsInPath(LIBS . 'view' . DS . 'helpers' . DS . $name . '.php')) { if (file_exists($helperFilename)) { Configure::store('Helpers\'][\'Core', 'class.paths', array($className => array('path' => $helperFilename))); require $helperFilename; return true; } else { return false; } } return false; } return true; }