public function replaceContent(&$parameters, TypoScriptFrontendController $parentObject)
    {
        if (TYPO3_MODE === 'FE') {

            // Fetch configuration
            $configuration = $parentObject->config['config']['tx_replacecontent.'];

            // Quit if no search/replace configuration is found
            if (!is_array($configuration['search.']) || !is_array($configuration['replace.'])) {
                return;
            }

            // Replace Content
            $parameters['pObj']->content = preg_replace(
                $configuration['search.'],
                $configuration['replace.'],
                $parameters['pObj']->content
            );
        }
    }
public function replaceContent(&$parameters, TypoScriptFrontendController $parentObject)
    {
        if (TYPO3_MODE === 'FE') {

            // Fetch configuration
            $configuration = $parentObject->config['config']['tx_replacecontent.'];

            // Quit if no search/replace configuration is found
            if (!is_array($configuration['search.']) || !is_array($configuration['replace.'])) {
                return;
            }

            // Replace Content
            $parameters['pObj']->content = preg_replace(
                $configuration['search.'],
                $configuration['replace.'],
                $parameters['pObj']->content
            );
        }
    }
public function replaceContent ( & $ parameters , TypoScriptFrontendController $ parentObject ) { if ( TYPO3_MODE === 'FE' ) { // Fetch configuration $ configuration = $ parentObject -> config [ 'config' ] [ 'tx_replacecontent.' ] ; // Quit if no search/replace configuration is found if ( ! is_array ( $ configuration [ 'search.' ] ) || ! is_array ( $ configuration [ 'replace.' ] ) ) { return ; } // Replace Content $ parameters [ 'pObj' ] -> content = preg_replace ( $ configuration [ 'search.' ] , $ configuration [ 'replace.' ] , $ parameters [ 'pObj' ] -> content ) ; } }
Search for a string and replace it with something else.

You must set the Search and Replace patterns via TypoScript.

TypoScript setup usage:
config.tx_replacecontent {
search {
1 = #(src|href)=("|')(/?)(typo3temp|fileadmin|uploads)/#
2 = lala
}
replace {
1 = $1=$2{$config.tx_replacecontent.schema}{$config.tx_replacecontent.host}/$4/
2 = Smörgåsbord
}
}

@param array $parameters Parameters delivered by the caller (tslib_fe)
@param TypoScriptFrontendController $parentObject The parent object (tslib_fe)
@return void
Search for a string and replace it with something else .