/** * Sets an entire array of search paths for templates or resources. * * @access protected * @param string $type The type of path to set, typically 'template'. * @param string|array $path The new set of search paths. If null or * false, resets to the current directory only. */ function _setPath($type, $path) { $option = JApplicationHelper::getComponentName(); $app = JFactory::getApplication(); $extensions = JoomleagueHelper::getExtensions(JRequest::getInt('p')); if (!count($extensions)) { return parent::_setPath($type, $path); } // clear out the prior search dirs $this->_path[$type] = array(); // actually add the user-specified directories $this->_addPath($type, $path); // add extensions paths if (strtolower($type) == 'template') { foreach ($extensions as $e => $extension) { $JLGPATH_EXTENSION = JPATH_COMPONENT_SITE . '/extensions/' . $extension; // set the alternative template search dir if (isset($app)) { if ($app->isAdmin()) { $this->_addPath('template', $JLGPATH_EXTENSION . '/admin/views/' . $this->getName() . '/tmpl'); } else { $this->_addPath('template', $JLGPATH_EXTENSION . '/views/' . $this->getName() . '/tmpl'); } // always add the fallback directories as last resort $option = preg_replace('/[^A-Z0-9_\\.-]/i', '', $option); $fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $option . '/' . $extension . '/' . $this->getName(); $this->_addPath('template', $fallback); } } } }