/** * Méthode qui affiche le type de compression http * * @return stdout * @scope global * @author Stephane F **/ public function httpEncoding() { $encoding = plxUtils::httpEncoding(); if ($this->plxMotor->aConf['gzip'] and $encoding) { printf(L_HTTPENCODING, strtoupper($encoding)); } }
/** * Méthode qui applique la compression gzip avant affichage * * @param rel2bas conversion des urls relatives en url absolues. Si conversion contient la racine du site * @return stout * @return stout **/ public static function ob_gzipped_page($rel2abs = false) { if ($encoding = plxUtils::httpEncoding()) { $contents = ob_get_clean(); if ($rel2abs) { $contents = plxUtils::rel2abs($rel2abs, $contents); } header('Content-Encoding: ' . $encoding); echo "�"; $size = strlen($contents); $contents = gzcompress($contents, 9); $contents = substr($contents, 0, $size); } else { $contents = ob_get_clean(); if ($rel2abs) { $contents = plxUtils::rel2abs($rel2abs, $contents); } } echo $contents; exit; }
# Insertion du template include PLX_ROOT . $plxMotor->aConf['racine_themes'] . $plxMotor->style . '/' . $plxMotor->template; } else { header('Content-Type: text/plain; charset=' . PLX_CHARSET); echo L_ERR_FILE_NOTFOUND . ' (' . PLX_ROOT . $plxMotor->aConf['racine_themes'] . $plxMotor->style . '/' . $plxMotor->template . ') !'; } # Récuperation de la bufférisation $output = ob_get_clean(); # Hooks spécifiques au thème ob_start(); eval($plxMotor->plxPlugins->callHook('ThemeEndHead')); $output = str_replace('</head>', ob_get_clean() . '</head>', $output); ob_start(); eval($plxMotor->plxPlugins->callHook('ThemeEndBody')); $output = str_replace('</body>', ob_get_clean() . '</body>', $output); # Hook Plugins eval($plxMotor->plxPlugins->callHook('IndexEnd')); # On applique la réécriture d'url si nécessaire if ($plxMotor->aConf['urlrewriting']) { $output = plxUtils::rel2abs($plxMotor->aConf['racine'], $output); } # On applique la compression gzip si nécessaire et disponible if ($plxMotor->aConf['gzip']) { if ($encoding = plxUtils::httpEncoding()) { header('Content-Encoding: ' . $encoding); $output = gzencode($output, -1, FORCE_GZIP); } } # Restitution écran echo $output; exit;
/** * M�thode qui affiche le type de compression http * * @return stdout * @scope global * @author Stephane F **/ public function httpEncoding() { if ($this->plxMotor->aConf['gzip'] and $encoding = plxUtils::httpEncoding()) { echo 'Compression ' . strtoupper($encoding) . ' activée'; } }