Summary: Function ReplaceOnSave
Created: 2004-11-16 05:18
Status: Closed - already exists
Version: 2.0 devel25
Description: Function ReplaceOnSave is intended to replace some strings with other strings when saving a page.
But in the array
Does not work:
SomeFunction should convert $1 as result of the pattern to some different string and return it for replacement.
Would be great if it could be changed somehow to make it work. This would give most flexibility for future additions or additional cookbook scripts.
The only other solution is to change $EditFunction and replace ReplaceOnSave with some own routine and afterwards calling ReplaceOnSave, which is IMHO not a really good idea. Imagine just some cookbook authors that try it the same way, but only the first script will run.
My english is not too good, I hope you know what I mean Klonk
Found a workaround (for writers of additional modules):
array_splice ($EditFunctions, array_search('ReplaceOnSave',$EditFunctions), 1, array('myFunction','ReplaceOnSave'));
With this statement 'myFunction' is called before 'ReplaceOnSave'. There you can perform all stuff you desire. Klonk
Actually, you can get ReplaceOnSave to call functions -- just be sure to add '/e' to the pattern to be replaced: