@define('PLUGIN_EVENT_CONTENTREWRITE_REWRITESTRINGDESC', 'The string used to rewrite. Place {from} and {to} anywhere you like to get a rewrite.' . "\n" . 'Example: <acronym title="{to}">{from}</acronym>');
@define('PLUGIN_EVENT_CONTENTREWRITE_REWRITECHAR', 'Rewrite char');
@define('PLUGIN_EVENT_CONTENTREWRITE_REWRITECHARDESC', 'If there is any char you append to force rewriting, enter it here. If you want to only replace \'serendipity*\' with what you entered for that word but want the \'*\' removed, enter that char here.');
-
+@define('PLUGIN_EVENT_CONTENTREWRITE_REWRITESTRING', 'The strings to perform replacements in your environment are %s and %s.');
?>
{
var $title = PLUGIN_EVENT_CONTENTREWRITE_NAME;
var $rewrite_from, $rewrite_to;
+ var $fromstring, $tostring;
function cleanup() {
// Cleanup. Remove all empty configs on SAVECONF-Submit.
if (!empty($_POST['SAVECONF'])) $this->cleanup();
$rows = serendipity_db_query("SELECT name, value FROM {$serendipity['dbPrefix']}config WHERE name LIKE '" . $this->instance . "/%' ORDER BY name");
+ $this->fromstring = $this->get_config('fromstring', null);
+ $this->tostring = $this->get_config('tostring', null);
+
+ if (empty($this->fromstring)) {
+ $this->fromstring = PLUGIN_EVENT_CONTENTREWRITE_FROM;
+ $this->set_config('fromstring', $this->fromstring);
+ }
+
+ if (empty($this->tostring)) {
+ $this->tostring = PLUGIN_EVENT_CONTENTREWRITE_TO;
+ $this->set_config('tostring', $this->tostring);
+ }
+
$counter = 0;
$values = array();
$values[] = 'title';
$this->counter = $counter;
}
+ function example() {
+ printf(PLUGIN_EVENT_CONTENTREWRITE_REWRITESTRING, $this->fromstring, $this->tostring);
+ }
+
function install() {
serendipity_plugin_api::hook_event('backend_cache_entries', $this->title);
}
$new =
str_replace(
array(
- '{' . PLUGIN_EVENT_CONTENTREWRITE_FROM . '}',
- '{' . PLUGIN_EVENT_CONTENTREWRITE_TO . '}'
+ '{' . $this->fromstring . '}',
+ '{' . $this->tostring . '}'
),
array(