help_search)) { $this->help_search = JFactory::getApplication()->input->getString('helpsearch'); } return $this->help_search; } /** * Method to get the page * * @return string The page * * @since 1.6 */ public function &getPage() { if (is_null($this->page)) { $this->page = JHelp::createUrl(JFactory::getApplication()->input->get('page', 'JHELP_START_HERE')); } return $this->page; } /** * Method to get the lang tag * * @return string lang iso tag * * @since 1.6 */ public function getLangTag() { if (is_null($this->lang_tag)) { $this->lang_tag = JFactory::getLanguage()->getTag(); if (!is_dir(JPATH_BASE . '/help/' . $this->lang_tag)) { // Use English as fallback $this->lang_tag = 'en-GB'; } } return $this->lang_tag; } /** * Method to get the table of contents * * @return array Table of contents */ public function &getToc() { if (!is_null($this->toc)) { return $this->toc; } // Get vars $lang_tag = $this->getLangTag(); $help_search = $this->getHelpSearch(); // New style - Check for a TOC JSON file if (file_exists(JPATH_BASE . '/help/' . $lang_tag . '/toc.json')) { $data = json_decode(file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/toc.json')); // Loop through the data array foreach ($data as $key => $value) { $this->toc[$key] = JText::_('COM_ADMIN_HELP_' . $value); } // Sort the Table of Contents asort($this->toc); return $this->toc; } // Get Help files jimport('joomla.filesystem.folder'); $files = JFolder::files(JPATH_BASE . '/help/' . $lang_tag, '\.xml$|\.html$'); $this->toc = array(); foreach ($files as $file) { $buffer = file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/' . $file); if (!preg_match('#