static function getTemplates($lang_files = 'all') { static $tmpls = null; if ($tmpls !== null) { return $tmpls; } $flexiparams = JComponentHelper::getParams('com_flexicontent'); $print_logging_info = $flexiparams->get('print_logging_info'); $debug = JDEBUG || $print_logging_info; // Log content plugin and other performance information if ($print_logging_info) { global $fc_run_times; $start_microtime = microtime(true); } $apply_cache = FLEXI_CACHE; if ($apply_cache) { // Get templates from cache $tmplcache = JFactory::getCache('com_flexicontent_tmpl'); // Get Joomla Cache of '...tmpl' Caching Group $tmplcache->setCaching(1); // Force cache ON $tmplcache->setLifeTime(FLEXI_CACHE_TIME); // Set expire time (default is 1 hour) $tmpls = $tmplcache->call(array('flexicontent_tmpl', 'parseTemplates')); // Check, clean, update cache if needed $xml_modified = flexicontent_tmpl::checkXmlModified($tmpls); if (!empty($xml_modified)) { if ($debug) { JFactory::getApplication()->enqueueMessage("Re-reading XMLs, XML file modified: " . print_r($xml_modified, true), 'message'); } $tmplcache->clean(); $tmplcache->gc(); $tmpls = $tmplcache->call(array('flexicontent_tmpl', 'parseTemplates')); } } else { $tmpls = flexicontent_tmpl::parseTemplates(); } // Compile LESS to CSS, if files have been modified flexicontent_tmpl::checkCompileLess($tmpls); // Load Template-Specific language file(s) to override or add new language strings if ($lang_files == 'all') { foreach ($tmpls->category as $tmpl => $d) { FLEXIUtilities::loadTemplateLanguageFile($tmpl); } } else { if (is_array($lang_files)) { foreach ($lang_files as $tmpl) { FLEXIUtilities::loadTemplateLanguageFile($tmpl); } } else { if (is_string($lang_files)) { FLEXIUtilities::loadTemplateLanguageFile($lang_files); } } } if ($print_logging_info) { $fc_run_times[$apply_cache ? 'templates_parsing_cached' : 'templates_parsing_noncached'] = round(1000000 * 10 * (microtime(true) - $start_microtime)) / 10; } return $tmpls; }