/** * * Gets the model class for a particular model name. * * @param string $name The model name. * * @return string The model class. * */ public function getClass($name) { $name = $this->_inflect->underToStudly($name); if (empty($this->_name_class[$name])) { $class = $this->_stack->load($name); $this->_name_class[$name] = $class; } return $this->_name_class[$name]; }
/** * * Creates a new standalone helper object. * * @param string $name The helper name. * * @param array $config Configuration value overrides, if any. * * @return object A new standalone helper object. * * @see Solar_Class_Stack::load() * */ public function newHelper($name, $config = null) { $name[0] = strtolower($name[0]); $class = $this->_helper_class->load($name); settype($config, 'array'); $config['_view'] = $this; $helper = new $class($config); return $helper; }
/** * * Finds the page-controller class name from a page name. * * @param string $page The page name. * * @return string The related page-controller class picked from * the routing, or from the list of available classes. If not found, * returns false. * */ protected function _getPageClass($page) { if (!empty($this->_routing[$page])) { // found an explicit route $this->_routing_key = $page; $class = $this->_routing[$page]; } else { // no explicit route $this->_routing_key = null; // try to find a matching class $page = str_replace('-', ' ', strtolower($page)); $page = str_replace(' ', '', ucwords(trim($page))); $class = $this->_stack->load($page, false); } return $class; }
/** * * Fixes the cache class name. * * @return void * */ protected function _fixCache() { // make sure we have a cache class if (empty($this->_cache_class)) { $class = $this->_stack->load('Cache', false); if (!$class) { $class = 'Solar_Sql_Model_Cache'; } $this->_cache_class = $class; } }
/** * * Creates a new filter object by method name. * * @param string $method The method name, e.g. 'sanitizeTrim'. * * @return Solar_Filter_Abstract The new filter object. * */ public function newFilter($method) { $method[0] = strtolower($method[0]); $class = $this->_stack->load($method); $obj = Solar::factory($class, array('filter' => $this)); return $obj; }