/** * * @staticvar string $sContents * @return boolean */ public static function checkModRewriteEnabled($params) { $oFileRetriever = JchOptimizeFileRetriever::getInstance(); if (!$oFileRetriever->isHttpAdapterAvailable()) { $params->set('htaccess', '0'); } else { $oUri = JchPlatformUri::getInstance(); $sUrl = $oUri->toString(array('scheme', 'user', 'pass', 'host', 'port')) . JchPlatformPaths::assetPath() . JchPlatformPaths::rewriteBase() . 'test_mod_rewrite'; $sContents = $oFileRetriever->getFileContents($sUrl); if ($sContents == 'TRUE') { $params->set('htaccess', '1'); } else { $params->set('htaccess', '0'); } } JchPlatformPlugin::saveSettings($params); }
/** * * @param JchPlatformSettings $params */ public static function clearHiddenValues(JchPlatformSettings $params) { $params->set('hidden_containsgf', ''); JchPlatformPlugin::saveSettings($params); }
/** * * @param type $type * @param type $parent */ public function postflight($type, $parent) { require_once JPATH_ROOT . '/plugins/system/jch_optimize/jchoptimize/loader.php'; require_once JPATH_ROOT . '/plugins/system/jch_optimize/fields/autoorder.php'; if ($type == 'install') { JFormFieldAutoorder::fixFilePermissions(true); } if ($type == 'update') { JFormFieldAutoorder::cleanCache(true); $params = JchPlatformPlugin::getPluginParams(); if (($exludeAllExtensions = $params->get('excludeAllExtensions', '')) !== '') { $params->set('includeAllExtensions', !$exludeAllExtensions); $params->set('excludeAllExtensions', ''); JchPlatformPlugin::saveSettings($params); } } JFormFieldAutoorder::orderPlugins(true); }
/** * * @staticvar string $sContents * @return boolean */ public static function checkModRewriteEnabled($params) { JCH_DEBUG ? JchPlatformProfiler::start('CheckModRewriteEnabled') : null; $oFileRetriever = JchOptimizeFileRetriever::getInstance(); if (!$oFileRetriever->isHttpAdapterAvailable()) { $params->set('htaccess', 0); } else { $oUri = JchPlatformUri::getInstance(); $sUrl = $oUri->toString(array('scheme', 'user', 'pass', 'host', 'port')) . JchPlatformPaths::assetPath(TRUE); $sUrl2 = JchPlatformPaths::rewriteBase() . 'test_mod_rewrite'; try { $sContents = $oFileRetriever->getFileContents($sUrl . $sUrl2); if ($sContents == 'TRUE') { $params->set('htaccess', 1); } else { $sContents2 = $oFileRetriever->getFileContents($sUrl . '3' . $sUrl2); if ($sContents2 == 'TRUE') { $params->set('htaccess', 3); } else { $params->set('htaccess', 0); } } } catch (Exception $e) { $params->set('htaccess', 0); } } JchPlatformPlugin::saveSettings($params); JCH_DEBUG ? JchPlatformProfiler::stop('CheckModRewriteEnabled', TRUE) : null; }
/** * Fetches the contents of files declared with @import * * @param array $aMatches Array of regex matches * @return string file contents */ protected function getImportFileContents($aMatches) { if (!isset($aMatches[1]) || $aMatches[1] == '' || preg_match('#^(?>\\(|/(?>/|\\*))#', $aMatches[0]) || $this->oParser->isHttpAdapterAvailable($aMatches[1]) || preg_match('#^https#', $aMatches[1]) && !extension_loaded('openssl') || preg_match('#://#', $aMatches[1]) && !preg_match('#^http#', $aMatches[1])) { return $aMatches[0]; } if ($this->oParser->isDuplicated($aMatches[1])) { return ''; } if (strpos($aMatches[1], 'fonts.googleapis.com') !== FALSE) { $containsgf = JchOptimizeHelper::getArray($this->params->get('hidden_containsgf', array())); if (!in_array($this->current_file, $containsgf)) { $containsgf[] = $this->current_file; $this->params->set('hidden_containsgf', implode(',', $containsgf)); JchPlatformPlugin::saveSettings($this->params); } } $aUrlArray = array(); $aUrlArray[0]['url'] = $aMatches[1]; $aUrlArray[0]['media'] = $aMatches[2]; //$aUrlArray[0]['id'] = md5($aUrlArray[0]['url'] . $this->oParser->sFileHash); $oCssParser = $this->oCssParser; $sFileContents = $this->combineFiles($aUrlArray, 'css', $oCssParser); if ($sFileContents === FALSE) { return $aMatches[0]; } return $sFileContents; }