-
-
Save b0r1sp/7668a787839d3f1287a5 to your computer and use it in GitHub Desktop.
TYPO3: Hook to remove the generator meta tag (TYPO3 CMS 6.2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Your\Extension\Namespace\Hooks; | |
/** | |
* Clean up source | |
*/ | |
class CleanSource extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin | |
{ | |
/** | |
* No cache | |
* | |
* @return void | |
*/ | |
public function contentPostProcOutput(&$params, &$that) | |
{ | |
if (!$GLOBALS['TSFE']->isINTincScript()) { | |
return; | |
} | |
$this->_removeGenerator($params['pObj']->content); | |
} | |
/** | |
* Cached | |
* | |
* @return void | |
*/ | |
public function contentPostProcAll(&$params, &$that) | |
{ | |
if ($GLOBALS['TSFE']->isINTincScript()) { | |
return; | |
} | |
$this->_removeGenerator($params['pObj']->content); | |
} | |
/** | |
* Remove generator meta tag | |
* <meta name="generator" content="TYPO3 6.2 CMS"> | |
* | |
* @return void | |
*/ | |
private function _removeGenerator(&$content) | |
{ | |
$content = preg_replace('/<meta name="?generator"?.+?>/is', '', $content); | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// hook is called after caching (for modification of pages with COA_/USER_INT objects) | |
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-output'][] = 'Your\\Extension\\Namespace\\Hooks\\CleanSource->contentPostProcOutput'; | |
// hook is called before caching (for modification of pages on their way in the cache) | |
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all'][] = 'Your\\Extension\\Namespace\\Hooks\\CleanSource->contentPostProcAll'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment