2017 © Pedro Peláez
 

cakephp-plugin replacer

CakePHP output string replacement

image

asper/replacer

CakePHP output string replacement

  • Friday, December 27, 2013
  • by asper
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Replacer

Provides a simple graphical interface to replace strings in CakePHP's output using regular expressions., (*1)

Possible usages : - Format text (ex : m2 => m², mysql => MySQL, cAkePHp => CakePHP...) - Add code to every page (</body> => <script>analytics();</script></body>) - Add a CDN to remote assets (src="js/script.js" => src="http://cdn.example.com/js/script.js")... - ..., (*2)

Setup

1) Clone repository :, (*3)

$ cd /my/app/root && git clone git://github.com/asper/Replacer.git Plugin/Replacer

2) Load plugin in app/Config/bootstrap.php :, (*4)

CakePlugin::load(array(
    'Replacer' => array(
        'routes' => true
    )
));

3) Create schema :, (*5)

$ cd /my/app/root && cake schema create Replacer.replacer

4) Open app/webroot/index.php and search for (l. 96 for CakePHP 2.1) :, (*6)

$Dispatcher->dispatch(new CakeRequest(), new CakeResponse(array('charset' => Configure::read('App.encoding'))));

5) Replace this line with :, (*7)

App::import('Lib', 'Replacer.ReplacerResponse');
$Dispatcher->dispatch(new CakeRequest(), new ReplacerResponse(array('charset' => Configure::read('App.encoding'))));

6) Enable admin routing prefix by uncommenting Configure::write('Routing.prefixes', array('admin')); in app/Config/core.php, (*8)

7) Navigate to http://my-app/admin/replacer and start configuring the plugin, (*9)

Usage

Replacer Plugin is composed of 2 main sections Replacements and Scopes, (*10)

Replacements let you substitute strings in output using regular expressions, (*11)

Scopes let you choose where these substitutions should occur, (*12)

The Versions

27/12 2013

dev-master

9999999-dev

CakePHP output string replacement

  Sources   Download

MIT

cakephp