public static function getDbPaths($which, $dbname, $full = false, $cmp = '') { $paths = array(); if (!$cmp) { $cmp = JApplicationHelper::getComponentName(); } switch ($which) { case 'u': $char1 = '@'; break; case 'g': $char1 = '_'; break; default: $char1 = ''; break; } $dpath = JPATH_SITE . '/' . self::getStorageBase() . '/'; if (is_dir($dpath) && ($dh = opendir($dpath))) { while (($file = readdir($dh)) !== false) { if ($file[0] == $char1) { $ptf = $dpath . $file . '/' . $cmp . '/' . $dbname . '.sql3'; if (file_exists($ptf)) { $paths[] = $full ? $ptf : $file; } $ptf = $dpath . $file . '/' . $cmp . '/' . $dbname . '.db3'; if (file_exists($ptf)) { $paths[] = $full ? $ptf : $file; } } } closedir($dh); } return $paths; }
/** * 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); } } } }
/** * Method to instantiate the view. * * @param JModel $model The model object. * @param SplPriorityQueue $paths The paths queue. * * @since 3.2 */ public function __construct(JModel $model, SplPriorityQueue $paths = null) { $app = JFactory::getApplication(); $component = JApplicationHelper::getComponentName(); $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component); if (isset($paths)) { $paths->insert(JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $this->getName(), 2); } parent::__construct($model, $paths); }
/** * Create an URL for a giving help file reference * * @param string The name of the popup file (excluding the file extension for an xml file) * @param boolean Use the help file in the component directory */ static function createURL($ref, $useComponent = false) { $component = JApplicationHelper::getComponentName(); $app =& JFactory::getApplication(); $user =& JFactory::getUser(); $userHelpUrl = $user->getParam('helpsite'); $globalHelpUrl = $app->getCfg('helpurl'); $lang =& JFactory::getLanguage(); if ($useComponent) { if (!preg_match('#\\.html$#i', $ref)) { $ref = $ref . '.html'; } $url = 'components/' . $component . '/help'; $tag = $lang->getTag(); // Check if the file exists within a different language! if ($lang->getTag() != 'en-GB') { $localeURL = JPATH_BASE . DS . $url . DS . $tag . DS . $ref; jimport('joomla.filesystem.file'); if (!JFile::exists($localeURL)) { $tag = 'en-GB'; } } return $url . '/' . $tag . '/' . $ref; } if ($userHelpUrl) { // Online help site as defined in GC $version = new JVersion(); $ref .= $version->getHelpVersion(); $url = $userHelpUrl . '/index2.php?option=com_content&task=findkey&tmpl=component&keyref=' . urlencode($ref); } else { if ($globalHelpUrl) { // Online help site as defined in GC $version = new JVersion(); $ref .= $version->getHelpVersion(); $url = $globalHelpUrl . '/index2.php?option=com_content&task=findkey&tmpl=component;1&keyref=' . urlencode($ref); } else { // Included html help files $helpURL = 'help/' . $lang->getTag() . '/'; if (!eregi('\\.html$', $ref)) { $ref = $ref . '.html'; } // Check if the file exists within a different language! if ($lang->getTag() != 'en-GB') { $localeURL = JPATH_BASE . $helpURL . $ref; jimport('joomla.filesystem.file'); if (!JFile::exists($localeURL)) { $helpURL = 'help/en-GB/'; } } $url = $helpURL . $ref; } } return $url; }
public function convertDb() { $sdp = UserNotesHelper::getStorageBase(); $cids = $this->input->get('cid', array(), 'array'); $view = $this->input->get('view'); $tc = $view == 'usernotes' ? '@' : '_'; foreach ($cids as $cid) { UserNotesHelperDb::convertDb(JPATH_ROOT . '/' . $sdp . '/' . $tc . $cid . '/' . JApplicationHelper::getComponentName()); } $this->setRedirect('index.php?option=com_usernotes&view=' . $view, JText::_('COM_USERSCHED_MSG_COMPLETE')); }
/** * Loads a snippet from the snippets folder. Name can contain a slash: * foo/bar will load component/views/snippets/tmpl/foo/bar.php * * @param string $tpl * * @return string the output of the template * @throws Exception */ public function loadSnippet($tpl) { // Clear prior output $this->_output = null; // create a hash of the template to avoid conflicts with the array key in the cache $cacheKey = md5($tpl); // if the cache is not filled for the current template try to get it. if (!isset(self::$templateCache[$cacheKey])) { $baseDir = $this->_basePath . '/views/snippets/tmpl'; $component = JApplicationHelper::getComponentName(); $app = JFactory::getApplication(); $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component); if ($this->_site_template != null) { $fallback = JPATH_SITE . '/templates/' . $this->_site_template . '/html/' . $component . '/' . 'snippets'; } else { $fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . 'snippets'; } $path = array($fallback, $baseDir); // Clean the file name $file = preg_replace('/[^A-Z0-9_\\.-\\/]/i', '', $tpl); $tpl = isset($tpl) ? preg_replace('/[^A-Z0-9_\\.-]/i', '', $tpl) : $tpl; // Load the template script jimport('joomla.filesystem.path'); $filetofind = $this->_createFileName('template', array('name' => $file)); self::$templateCache[$cacheKey] = JPath::find($path, $filetofind); } // get the template from the cache $template = self::$templateCache[$cacheKey]; // If alternate layout can't be found, fall back to default layout if ($template == false) { throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND', $file), 500); } // Unset so as not to introduce into template scope unset($tpl); unset($file); // Never allow a 'this' property if (isset($this->this)) { unset($this->this); } // Start capturing output into a buffer ob_start(); // Include the requested template filename in the local scope // (this will execute the view logic). include $template; // Done with the requested template; get the buffer and // clear it. $this->_output = ob_get_contents(); ob_end_clean(); return $this->_output; }
function getCategories($name, $active = NULL, $javascript = NULL, $order = 'lft', $size = 1, $sel_cat = 1) { $db = JFactory::getDBO(); $extension = JApplicationHelper::getComponentName(); $query = 'SELECT id AS value, title AS text' . ' FROM #__categories' . ' WHERE extension = ' . $db->Quote($extension) . ' AND published = 1' . ' ORDER BY ' . $order; $db->setQuery($query); if ($sel_cat and $name != 'catid') { $categories[] = JHtml::_('select.option', '0', '- ' . JText::_('Select a Category') . ' -'); $categories[] = JHtml::_('select.option', '-1', 'Template Overrides'); $categories = array_merge($categories, $db->loadObjectList()); } else { $categories = $db->loadObjectList(); } $category = JHtml::_('select.genericlist', $categories, $name, 'class="inputbox" size="' . $size . '" ' . $javascript, 'value', 'text', $active); return $category; }
function _displayForm($tpl) { $user =& JFactory::getUser(); $option = JApplicationHelper::getComponentName(); $model =& $this->getModel(); $document =& JFactory::getDocument(); $document->addStyleSheet('components/' . $option . '/assets/rokcandy.css'); $lists = array(); //get the rokcandymacro $rokcandymacro =& $this->get('data'); $isNew = $rokcandymacro->id < 1; // fail if checked out not by 'me' if ($model->isCheckedOut($user->get('id'))) { $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('ROKCANDY_MACRO'), $rokcandymacro->macro); $app = JFactory::getApplication(); $app->redirect('index.php?option=' . $option, $msg); } // Edit or Create? if (!$isNew) { $model->checkout($user->get('id')); } else { // initialise new record $rokcandymacro->published = 1; $rokcandymacro->order = 0; $rokcandymacro->catid = JRequest::getVar('catid', 0, 'post', 'int'); } // build the html select list for ordering $query = 'SELECT ordering AS value, macro AS text' . ' FROM #__rokcandy' . ' WHERE catid = ' . (int) $rokcandymacro->catid . ' ORDER BY ordering'; $lists['ordering'] = JHTML::_('list.specificordering', $rokcandymacro, $rokcandymacro->id, $query); // build list of categories //$lists['catid'] = JHTML::_('list.category', 'catid', $option, intval( $rokcandymacro->catid ) ); $lists['catid'] = JElementRokCandyList::getCategories('catid', intval($rokcandymacro->catid)); // build the html select list $publishList[] = JHTML::_('select.option', '1', JText::_('Published')); $publishList[] = JHTML::_('select.option', '0', JText::_('Unpublished')); $lists['published'] = JHTML::_('select.genericlist', $publishList, 'published', 'class="inputbox" size="1"', 'value', 'text', $rokcandymacro->published); //clean rokcandymacro data JFilterOutput::objectHTMLSafe($rokcandymacro, ENT_QUOTES, 'html'); $file = JPATH_COMPONENT . DS . 'models' . DS . 'candymacro.xml'; $params = new JParameter($rokcandymacro->params, $file); $this->assignRef('lists', $lists); $this->assignRef('rokcandymacro', $rokcandymacro); $this->assignRef('params', $params); parent::display($tpl); }
function display($tpl = null) { $app = JFactory::getApplication(); $option = JApplicationHelper::getComponentName(); $document =& JFactory::getDocument(); $document->addStyleSheet('components/' . $option . '/assets/rokcandy.css'); $filter_state = $app->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'word'); $filter_catid = $app->getUserStateFromRequest($option . 'filter_catid', 'filter_catid', 0, 'int'); $filter_catid = $app->getUserStateFromRequest($option . 'filter_catid', 'filter_catid', 0, 'int'); $filter_order = $app->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'a.ordering', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $app->getUserStateFromRequest($option . 'search', 'search', '', 'string'); $search = JString::strtolower($search); // Get data from the model if ($filter_catid != -1) { $items =& $this->get('Data'); } else { $items = array(); } $total =& $this->get('Total'); $pagination =& $this->get('Pagination'); if ($filter_catid == -1 or $filter_catid == 0) { $overrides =& $this->get('TemplateOverrides'); } else { $overrides = array(); } // build list of categories $javascript = 'onchange="document.adminForm.submit();"'; $lists['catid'] = JElementRokCandyList::getCategories('filter_catid', intval($filter_catid), $javascript); // state filter $lists['state'] = JHTML::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $this->assignRef('user', JFactory::getUser()); $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $this->assignRef('overrides', $overrides); parent::display($tpl); }
/** * Method to instantiate the view. * * @param JModel $model The model object. * @param SplPriorityQueue $paths The paths queue. * * @since 12.1 */ public function __construct(JModel $model, SplPriorityQueue $paths = null) { parent::__construct($model); // Setup dependencies. $this->paths = isset($paths) ? $paths : $this->loadPaths(); /* T3: Add T3 html path to the priority paths of component view */ // T3 html path $component = JApplicationHelper::getComponentName(); $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component); $t3Path = T3_PATH . '/html/' . $component . '/' . $this->getName(); // Setup the template path $this->paths->top(); $defaultPath = $this->paths->current(); $this->paths->next(); $templatePath = $this->paths->current(); // add t3 path $this->paths->insert($t3Path, 3); $this->_path['template'] = array($defaultPath, $t3Path, $templatePath); /* //T3 */ }
/** * Execute the controller. * * @return boolean True on success * * @since 2.0 * @throws \RuntimeException */ public function execute() { // Set up variables to build our classes $view = $this->getInput()->getCmd('view', $this->defaultView); $format = $this->getInput()->getCmd('format', 'html'); // Register the layout paths for the view $paths = new \SplPriorityQueue(); // Add the path for template overrides $paths->insert(JPATH_THEMES . '/' . $this->getApplication()->getTemplate() . '/html/' . \JApplicationHelper::getComponentName() . '/' . $view, 2); // Add the path for the default layouts $paths->insert(JPATH_BASE . '/components/' . \JApplicationHelper::getComponentName() . '/PatchTester/View/' . ucfirst($view) . '/tmpl', 1); // Build the class names for the model and view $viewClass = '\\PatchTester\\View\\' . ucfirst($view) . '\\' . ucfirst($view) . ucfirst($format) . 'View'; $modelClass = '\\PatchTester\\Model\\' . ucfirst($view) . 'Model'; // Sanity check - Ensure our classes exist if (!class_exists($viewClass)) { // Try to use a default view $viewClass = '\\PatchTester\\View\\Default' . ucfirst($format) . 'View'; if (!class_exists($viewClass)) { throw new \RuntimeException(sprintf('The view class for the %1$s view in the %2$s format was not found.', $view, $format), 500); } } if (!class_exists($modelClass)) { throw new \RuntimeException(sprintf('The model class for the %s view was not found.', $view), 500); } // Initialize the model class now; need to do it before setting the state to get required data from it $model = new $modelClass($this->context, null, \JFactory::getDbo()); // Initialize the state for the model $model->setState($this->initializeState($model)); // Initialize the view class now $view = new $viewClass($model, $paths); // Echo the rendered view for the application echo $view->render(); // Finished! return true; }
/** * Sets an entire array of search paths for templates or resources. * * @param string The type of path to set, typically 'template'. * @param string|array The new set of search paths. If null or false, resets to the current directory only. */ protected function _setPath($type, $path) { jimport('joomla.application.helper'); $component = JApplicationHelper::getComponentName(); $app = JFactory::getApplication(); // Clear out the prior search dirs $this->_path[$type] = array(); // Actually add the user-specified directories $this->_addPath($type, $path); // Always add the fallback directories as last resort switch (strtolower($type)) { case 'template': // Set the alternative template search dir if (isset($app)) { $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component); $fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $this->getName(); //if it is T3 template, update search path for template if (T3Common::detect()) { if (is_array($fallback1 = T3Path::getPath('html' . DS . $component . DS . $this->getName(), true))) { $fallback = array_reverse($fallback1); } } $this->_addPath('template', $fallback); } break; } }
/** * Create a URL for a given help key reference * * @param string $ref The name of the help screen (its key reference) * @param boolean $useComponent Use the help file in the component directory * @param string $override Use this URL instead of any other * @param string $component Name of component (or null for current component) * * @return string * * @since 11.1 */ public static function createURL($ref, $useComponent = false, $override = null, $component = null) { $local = false; $app = JFactory::getApplication(); if (is_null($component)) { $component = JApplicationHelper::getComponentName(); } // Determine the location of the help file. At this stage the URL // can contain substitution codes that will be replaced later. if ($override) { $url = $override; } else { // Get the user help URL. $user = JFactory::getUser(); $url = $user->getParam('helpsite'); // If user hasn't specified a help URL, then get the global one. if ($url == '') { $url = $app->getCfg('helpurl'); } // Component help URL overrides user and global. if ($useComponent) { // Look for help URL in component parameters. $params = JComponentHelper::getParams($component); $url = $params->get('helpURL'); if ($url == '') { $local = true; $url = 'components/{component}/help/{language}/{keyref}'; } } // Set up a local help URL. if (!$url) { $local = true; $url = 'help/{language}/{keyref}'; } } // If the URL is local then make sure we have a valid file extension on the URL. if ($local) { if (!preg_match('#\\.html$|\\.xml$#i', $ref)) { $url .= '.html'; } } /* * Replace substitution codes in the URL. */ $lang = JFactory::getLanguage(); $version = new JVersion(); $jver = explode('.', $version->getShortVersion()); $jlang = explode('-', $lang->getTag()); $debug = $lang->setDebug(false); $keyref = JText::_($ref); $lang->setDebug($debug); // Replace substitution codes in help URL. $search = array('{app}', '{component}', '{keyref}', '{language}', '{langcode}', '{langregion}', '{major}', '{minor}', '{maintenance}'); $replace = array($app->getName(), $component, $keyref, $lang->getTag(), $jlang[0], $jlang[1], $jver[0], $jver[1], $jver[2]); // If the help file is local then check it exists. // If it doesn't then fallback to English. if ($local) { $try = str_replace($search, $replace, $url); jimport('joomla.filesystem.file'); if (!JFile::exists(JPATH_BASE . '/' . $try)) { $replace[3] = 'en-GB'; $replace[4] = 'en'; $replace[5] = 'GB'; } } $url = str_replace($search, $replace, $url); return $url; }
public function getAdminComponentPath() { return JURI::base() . 'component' . DS . JApplicationHelper::getComponentName() . DS; }
/** * Sets an entire array of search paths for templates or resources. * * @param string $type The type of path to set, typically 'template'. * @param mixed $path The new search path, or an array of search paths. If null or false, resets to the current directory only. * * @return void * * @since 12.2 */ protected function _setPath($type, $path) { $component = JApplicationHelper::getComponentName(); $app = JFactory::getApplication(); // Clear out the prior search dirs $this->_path[$type] = array(); // Actually add the user-specified directories $this->_addPath($type, $path); // Always add the fallback directories as last resort switch (strtolower($type)) { case 'template': // Set the alternative template search dir if (isset($app)) { $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component); $fallback = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $this->getName(); $this->_addPath('template', $fallback); } break; } }
public function loadTemplate($tpl = null) { $this->_output = null; $app = JFactory::getApplication(); $template = JFactory::getApplication()->getTemplate(); if ($this->getName() == 'category' || $this->getName() == 'tree') { $layoutUrl = $app->input->getString('layout', ''); if (isset($layoutUrl) && $layoutUrl != '') { $layout = $layoutUrl; } else { $layout = null; } $catId = $app->input->getInt('id', 1); $layout = JUDirectoryFrontHelperCategory::getCategoryViewLayout($layout, $catId); $this->setLayout($layout); } elseif ($this->getName() == 'listing') { $layoutUrl = $app->input->getString('layout', ''); if (isset($layoutUrl) && $layoutUrl != '') { $layout = $layoutUrl; } else { $layout = null; } $listingId = $app->input->getInt('id', 0); if ($listingId > 0) { $layout = JUDirectoryFrontHelperListing::getListingViewLayout($layout, $listingId); $this->setLayout($layout); } } $layout = $this->getLayout(); $layoutTemplate = $this->getLayoutTemplate(); $file = isset($tpl) ? $layout . '_' . $tpl : $layout; $file = preg_replace('/[^A-Z0-9_\\.-]/i', '', $file); $tpl = isset($tpl) ? preg_replace('/[^A-Z0-9_\\.-]/i', '', $tpl) : $tpl; $lang = JFactory::getLanguage(); $lang->load('tpl_' . $template, JPATH_BASE, null, false, false) || $lang->load('tpl_' . $template, JPATH_THEMES . "/{$template}", null, false, false); $component = JApplicationHelper::getComponentName(); $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component); $app = JFactory::getApplication(); $id = $app->input->getInt('id', 0); $user = JFactory::getUser(); if ($previewStyle = (int) $app->input->getInt('tplStyle', 0)) { if ($user->id == 0) { $uri = JUri::getInstance(); $loginUrl = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode($uri), false); $app->enqueueMessage(JText::_("COM_JUDIRECTORY_YOU_MUST_LOGIN_AS_SUPER_ADMIN_TO_PREVIEW_TEMPLATE_STYLE"), 'Notice'); $app->redirect($loginUrl); return false; } else { if (!$user->authorise('core.admin', 'com_judirectory')) { $app->enqueueMessage(JText::_("COM_JUDIRECTORY_YOU_MUST_LOGIN_AS_SUPER_ADMIN_TO_PREVIEW_TEMPLATE_STYLE"), 'Notice'); } } } if ($user->authorise('core.admin', 'com_judirectory') && ($previewStyle = (int) $app->input->getInt('tplStyle', 0))) { $currentTemplateStyleObject = JUDirectoryFrontHelperTemplate::getTemplateStyleObject($previewStyle); } else { $currentTemplateStyleObject = JUDirectoryFrontHelperTemplate::getCurrentTemplateStyle($this->getName(), $id); } $JUTemplate = trim($currentTemplateStyleObject->folder); $JUTemplate = strtolower($JUTemplate); $this->template_params = $currentTemplateStyleObject->params; if (!$JUTemplate) { $JUTemplate = 'default'; } $this->template = $JUTemplate; $JUTemplatePath = JUDirectoryFrontHelperTemplate::getTemplatePathWithoutRoot($currentTemplateStyleObject->template_id); $topLevelTemplate = $JUTemplatePath[0]->folder ? $JUTemplatePath[0]->folder : 'default'; $asset_file = JPATH_SITE . '/components/com_judirectory/templates/' . $topLevelTemplate . '/load_assets.php'; if (JFile::exists($asset_file)) { include_once $asset_file; } $JUTemplatePathFull = array(); $JUTemplatePathFull[] = $this->_basePath . '/templates/default/' . $this->getName(); $JUTemplatePathFull[] = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . 'default' . '/' . $this->getName(); $JUTemplatePath = array_reverse($JUTemplatePath); foreach ($JUTemplatePath as $JUTemplatePathItem) { $JUTemplatePathFull[] = $this->_basePath . '/templates/' . $JUTemplatePathItem->folder . '/' . $this->getName(); $JUTemplatePathFull[] = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . $JUTemplatePathItem->folder . '/' . $this->getName(); } foreach ($JUTemplatePathFull as $item) { $this->_addPath('template', $item); } if (isset($layoutTemplate) && $layoutTemplate != '_' && $layoutTemplate != $template) { $this->_path['template'] = str_replace($template, $layoutTemplate, $this->_path['template']); } $jversion_arr = explode(".", JVERSION); $priVersion = $jversion_arr[0]; $subVersion = $jversion_arr[1]; $fileToFind = $this->_createFileName('template', array('name' => $file . '.j' . $priVersion . $subVersion)); $this->_template = JPath::find($this->_path['template'], $fileToFind); if ($this->_template == false) { $fileToFind = $this->_createFileName('template', array('name' => $file . '.j' . $priVersion . 'x')); $this->_template = JPath::find($this->_path['template'], $fileToFind); } if ($this->_template == false) { $fileToFind = $this->_createFileName('template', array('name' => $file)); $this->_template = JPath::find($this->_path['template'], $fileToFind); } if ($this->_template == false) { $fallbackPaths = array(); $fallbackPaths[] = $this->_basePath . '/templates/default/' . $this->getName(); $fallbackPaths[] = JPATH_THEMES . '/' . $app->getTemplate() . '/html/' . $component . '/' . 'default' . '/' . $this->getName(); foreach ($fallbackPaths as $fallbackPath) { $fallbackPath = trim($fallbackPath); if (substr($fallbackPath, -1) != DIRECTORY_SEPARATOR) { $fallbackPath .= DIRECTORY_SEPARATOR; } array_unshift($fallbackPaths, $fallbackPath); } $fileToFind = $this->_createFileName('', array('name' => 'default.j' . $priVersion . $subVersion . (isset($tpl) ? '_' . $tpl : $tpl))); $this->_template = JPath::find($fallbackPaths, $fileToFind); if ($this->_template == false) { $fileToFind = $this->_createFileName('', array('name' => 'default.j' . $priVersion . 'x' . (isset($tpl) ? '_' . $tpl : $tpl))); $this->_template = JPath::find($fallbackPaths, $fileToFind); } if ($this->_template == false) { $fileToFind = $this->_createFileName('', array('name' => 'default' . (isset($tpl) ? '_' . $tpl : $tpl))); $this->_template = JPath::find($fallbackPaths, $fileToFind); } } if ($this->_template != false) { unset($tpl); unset($file); if (isset($this->this)) { unset($this->this); } ob_start(); include $this->_template; $this->_output = ob_get_contents(); ob_end_clean(); return $this->_output; } else { return JError::raiseError(500, JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND', $file)); } }
/** * 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) { jimport('joomla.application.helper'); $component = JApplicationHelper::getComponentName(); $app =& JFactory::getApplication(); // clear out the prior search dirs $this->_path[$type] = array(); // actually add the user-specified directories $this->_addPath($type, $path); // always add the fallback directories as last resort switch (strtolower($type)) { case 'template': // Set the alternative template search dir if (isset($app)) { $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component); $fallback = JPATH_BASE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . $component . DS . $this->getName(); $this->_addPath('template', $fallback); } break; } }
/** * Method to change the component where search for layouts * * @param string $option URL Option of the component. Example: com_content * * @return mixed Component option string | null for none * * @since 3.2 */ public function setComponent($option) { $component = null; switch ((string) $option) { case 'none': $component = null; break; case 'auto': $component = JApplicationHelper::getComponentName(); break; default: $component = $option; break; } // Extra checks if (!$this->validComponent($component)) { $component = null; } $this->options->set('component', $component); // Refresh include paths $this->refreshIncludePaths(); }
public static function getDbasePath($uid, $isgrp) { $cmp = JApplicationHelper::getComponentName(); $dispatcher = JDispatcher::getInstance(); $results = $dispatcher->trigger('onRjuserDatapath', null); $sdp = isset($results[0]) ? trim($results[0]) : ''; if (!$sdp) { $sdp = 'userstor'; } $pfx = $isgrp ? '_' : '@'; return $sdp . '/' . $pfx . $uid . '/' . $cmp; }