-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d8114df
Showing
10 changed files
with
273 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
namespace JWeiland\Replacer\Hooks; | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
/** | ||
* Class TypoScriptFrontendController | ||
* Used for Hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-output'] | ||
* | ||
* @package JWeiland\Replacer\Hooks | ||
*/ | ||
class TypoScriptFrontendController | ||
{ | ||
/** | ||
* Search and replace text from TypoScriptFrontendController->content | ||
* You must set the Search and Replace patterns via TypoScript. | ||
* usage from TypoScript: | ||
* config.tx_replacer { | ||
* search { | ||
* 1="/typo3temp/pics/ | ||
* 2="/fileadmin/ | ||
* } | ||
* replace { | ||
* 1="http://mycdn.com/i/ | ||
* 2="http://mycdn.com/f/ | ||
* } | ||
* } | ||
* | ||
* @param array $params | ||
* @param \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $ref | ||
* @return void | ||
*/ | ||
public function contentPostProcOutput( | ||
array &$params, | ||
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $ref | ||
) { | ||
if ( | ||
!empty($ref->config['config']['tx_replacer.']['search.']) | ||
&& !empty($ref->config['config']['tx_replacer.']['replace.']) | ||
) { | ||
$ref->content = str_replace( | ||
$ref->config['config']['tx_replacer.']['search.'], | ||
$ref->config['config']['tx_replacer.']['replace.'], | ||
$ref->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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.. ================================================== | ||
.. FOR YOUR INFORMATION | ||
.. -------------------------------------------------- | ||
.. -*- coding: utf-8 -*- with BOM. | ||
.. include:: ../Includes.txt | ||
|
||
|
||
.. _configuration: | ||
|
||
Configuration | ||
======================= | ||
|
||
The configuration of ext:replacer is that easy. The whole configuration will be made inside your TypoScript Setup. | ||
|
||
**Example:** :: | ||
|
||
config.tx_replacer { | ||
search { | ||
1="/typo3temp/pics/ | ||
2="/fileadmin/ | ||
} | ||
replace { | ||
1="http://cd/i/ | ||
2="http://mycdn.com/f/ | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.. ================================================== | ||
.. FOR YOUR INFORMATION | ||
.. -------------------------------------------------- | ||
.. -*- coding: utf-8 -*- with BOM. | ||
|
||
.. This is 'Includes.txt'. It is included at the very top of each and | ||
every ReST source file in this documentation project (= manual). | ||
|
||
|
||
.. ================================================== | ||
.. DEFINE SOME TEXT ROLES | ||
.. -------------------------------------------------- | ||
|
||
.. role:: typoscript(code) | ||
|
||
.. role:: ts(typoscript) | ||
:class: typoscript | ||
|
||
.. role:: php(code) | ||
|
||
.. highlight:: php |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.. ================================================== | ||
.. FOR YOUR INFORMATION | ||
.. -------------------------------------------------- | ||
.. -*- coding: utf-8 -*- with BOM. | ||
.. include:: Includes.txt | ||
|
||
.. _start: | ||
|
||
============================================================= | ||
replacer | ||
============================================================= | ||
|
||
.. only:: html | ||
|
||
:Classification: | ||
replacer | ||
|
||
:Version: | ||
|release| | ||
|
||
:Language: | ||
en | ||
|
||
:Description: | ||
Replaces string patterns from the page. You can use it to replace URLs for Content Delivery Network (CDN). | ||
|
||
:Keywords: | ||
replacer,replacement,ja_replacer | ||
|
||
:Copyright: | ||
2018 | ||
|
||
:Author: | ||
Pascal Rinker | ||
|
||
:Email: | ||
[email protected] | ||
|
||
:License: | ||
This document is published under the Open Content License | ||
available from http://www.opencontent.org/opl.shtml | ||
|
||
:Rendered: | ||
|today| | ||
|
||
The content of this document is related to TYPO3, | ||
a GNU/GPL CMS/Framework available from `www.typo3.org <http://www.typo3.org/>`_. | ||
|
||
This extension is a fork of ja_replacer | ||
|
||
**Table of Contents** | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
:titlesonly: | ||
|
||
Configuration/Index |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.. ================================================== | ||
.. FOR YOUR INFORMATION | ||
.. -------------------------------------------------- | ||
.. -*- coding: utf-8 -*- with BOM. | ||
.. include:: Includes.txt | ||
|
||
|
||
.. _links: | ||
|
||
Links | ||
----- | ||
|
||
:TER: | ||
https://typo3.org/extensions/repository/view/replacer | ||
|
||
:Bug Tracker: | ||
https://github.com/jweiland-net/replacer/issues | ||
|
||
:Git Repository: | ||
https://github.com/jweiland-net/replacer |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This is the project specific Settings.yml file. | ||
# Place Sphinx specific build information here. | ||
# Settings given here will replace the settings of 'conf.py'. | ||
|
||
# Below is an example of intersphinx mapping declaration | ||
# Add more mappings depending on what manual you want to link to | ||
# Remove entirely if you don't need cross-linking | ||
|
||
--- | ||
conf.py: | ||
copyright: 2018 | ||
project: replacer | ||
version: 1.0.0 | ||
release: 1.0.0 | ||
intersphinx_mapping: | ||
t3tsref: | ||
- http://docs.typo3.org/typo3cms/TyposcriptReference/ | ||
- null | ||
latex_documents: | ||
- - Index | ||
- replacer.tex | ||
- replacer | ||
- | ||
- manual | ||
latex_elements: | ||
papersize: a4paper | ||
pointsize: 10pt | ||
preamble: \usepackage | ||
html_theme_options: | ||
github_repository: TYPO3-Documentation/TYPO3CMS-Example-ExtensionManual | ||
github_branch: latest | ||
... |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "jweiland/replacer", | ||
"type": "typo3-cms-extension", | ||
"description": "Replaces string patterns from the page. You can use it to replace URLs for Content Delivery Network (CDN).", | ||
"license": "GPL-2.0-or-later", | ||
"keywords": ["typo3", "TYPO3 CMS", "jw", "replacer"], | ||
"homepage": "http://www.jweiland.net", | ||
"authors": [ | ||
{ | ||
"name": "Pascal Rinker", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
} | ||
], | ||
"support": { | ||
"email": "[email protected]", | ||
"issues": "https://github.com/jweiland-net/replacer/issues", | ||
"source": "https://github.com/jweiland-net/replacer" | ||
}, | ||
"require": { | ||
"typo3/cms-core": ">=7.6.0,<9.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"JWeiland\\Replacer\\": "Classes" | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
$EM_CONF[$_EXTKEY] = [ | ||
'title' => 'Content Replacer', | ||
'description' => 'Replaces string patterns from the page. You can use it to replace URLs for Content Delivery Network (CDN).', | ||
'category' => 'fe', | ||
'author' => 'Pascal Rinker', | ||
'author_email' => '[email protected]', | ||
'author_company' => 'jweiland.net', | ||
'state' => 'stable', | ||
'uploadfolder' => 0, | ||
'createDirs' => '', | ||
'clearCacheOnLoad' => 0, | ||
'version' => '1.0.0', | ||
'constraints' => [ | ||
'depends' => [ | ||
'typo3' => '7.6.0-8.7.99', | ||
], | ||
'conflicts' => [], | ||
'suggests' => [], | ||
], | ||
]; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
defined('TYPO3_MODE') or die(); | ||
|
||
// Register hook | ||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-output'][] = | ||
\JWeiland\Replacer\Hooks\TypoScriptFrontendController::class . '->contentPostProcOutput'; |