Revision [10326]
This is an old revision of UncamelAction made by DennyShimkoski on 2005-07-31 20:01:44.
Uncamel the Horses!
The following code is designed to be used with the OnPageLoadWithGlobalActions OnPageLoadAction. Just save the code below as "uncamel.php" in the actions directory and your ready to go!
<?php if (!function_exists('uncamel')) { function uncamel($matches) { $text = preg_match_all('/([A-Z][^A-Z]*)/', $matches[2], $words) ? join(' ', $words[1]) : $matches[2]; return "<a$matches[1]>$text</a>"; } } $this->page['body'] = preg_replace_callback('|<a([^>]+)>(.*)</a>|smU', 'uncamel', $this->page['body']); ?>
If you'd like to apply it across the site, create a page called GlobalActions and drop the following line of code in...
{{onpageload uncamel=""}}
Authors
DennyShimkoski
CategoryUserContributions