/** * * @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); }
/** * * @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; }
/** * * @return type */ public static function extensions() { return JchPlatformPaths::rewriteBase(); }
/** * Returns url of aggregated file * * @param string $sFile Aggregated file name * @param string $sType css or js * @param mixed $bGz True (or 1) if gzip set and enabled * @param number $sTime Expire header time * @return string Url of aggregated file */ protected function buildUrl($sId, $sType) { $iTime = (int) $this->params->get('cache_lifetime', '1'); $bGz = $this->isGZ(); $htaccess = $this->params->get('htaccess', 0); if ($htaccess == 1 || $htaccess == 3) { $sPath = $this->cookieLessDomain($sType); $sPath = $htaccess == 3 ? $sPath . '3' : $sPath; $sUrl = $sPath . JchPlatformPaths::rewriteBase() . ($bGz ? 'gz/' : 'nz/') . $iTime . '/JCHI/' . $sId . '.' . $sType; } else { $oUri = clone JchPlatformUri::getInstance(JchPlatformPaths::assetPath()); $oUri->setPath($oUri->getPath() . '2/jscss.php'); $aVar = array(); $aVar['f'] = $sId; $aVar['type'] = $sType; $aVar['gz'] = $bGz ? 'gz' : 'nz'; $aVar['d'] = $iTime; $aVar['i'] = 'JCHI'; $oUri->setQuery($aVar); $sUrl = htmlentities($oUri->toString()); } return $sUrl; }
/** * Returns url of aggregated file * * @param string $sFile Aggregated file name * @param string $sType css or js * @param mixed $bGz True (or 1) if gzip set and enabled * @param number $sTime Expire header time * @return string Url of aggregated file */ protected function buildUrl($sId, $sType) { $sPath = JchPlatformPaths::assetPath(); $iTime = (int) $this->params->get('lifetime', '30'); $bGz = $this->isGZ(); if ($this->params->get('htaccess', 0) == 1) { $sUrl = JchOptimizeHelper::cookieLessDomain($this->params) . $sPath . JchPlatformPaths::rewriteBase() . ($bGz ? 'gz/' : 'nz/') . $iTime . '/JCHI/' . $sId . '.' . $sType; } else { $oUri = clone JchPlatformUri::getInstance(); $oUri->setPath($sPath . '2/jscss.php'); $aVar = array(); $aVar['f'] = $sId; $aVar['type'] = $sType; $aVar['gz'] = $bGz ? 'gz' : 'nz'; $aVar['d'] = $iTime; $aVar['i'] = 'JCHI'; $oUri->setQuery($aVar); $sUrl = htmlentities($oUri->toString(array('path', 'query'))); } return $sUrl; }