|
Cookbook /
ROEPatternsSummary: Replace On Edit
Version: 1.1
Prerequisites: none
Status: Working
Maintainer:JB
Categories: Markup
Downloads: ReplaceOnEdit.phpΔ
NOTE: This recipe (below the examples) is not needed if you are using pmwiki-2.2.0-beta45 or later versions. Instead use Questions answered by this recipe
DescriptionROEPatterns (Replace On Edit) works just like ROSPatterns except that it is executed before a page is edited. Can this page be refactored as an example page for ROEPatterns, similar to ROSPatterns? HansB May 06, 2007, at 05:24 AM The Example:
$ROEPatterns ["text to search for"] = "text to replace with";
The "text to search for" is searched and replaced using the PHP preg_replace function, thus the pattern has to use the preg_replace syntax. Recipe Example: A config/php or recipe could setup a new action, then setup
<?php
if ($action == 'convert') {
global $ROEPatterns;
$ROEPatterns ['/\\|\\|/'] = '(:cell:)';
# ... MORE $ROEPatterns could go here
$action='edit';
}
InstallationCopy ReplaceOnEdit.phpΔ to your cookbook directory. In your config.php enter: include_once("cookbook/ReplaceOnEdit.php");
or in your farmconfig.php enter: include_once(" $FarmD/cookbook/ReplaceOnEdit.php");
NotesThis recipe is intended for wiki administrators. It could be useful for a recipe that might want to modify text on a page just before displaying it in the editor. Release NotesThis program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation http://www.fsf.org either version 2 of the License, or (at your option) any later version. Copyright 2007 by GNUZoo (guru@gnuzoo.org) Please donate to the author at url: http://gnuzoo.org/GNUZooPayPal
Comments Usage of
|