From 062703dafc4f96bd0e8f4550798f004c47cf1af3 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Fri, 23 Jun 2006 13:01:26 +0000 Subject: [PATCH] delocalize --- .../lang_en.inc.php | 2 +- .../serendipity_event_contentrewrite.php | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/plugins/serendipity_event_contentrewrite/lang_en.inc.php b/plugins/serendipity_event_contentrewrite/lang_en.inc.php index 2b6978f..312745b 100644 --- a/plugins/serendipity_event_contentrewrite/lang_en.inc.php +++ b/plugins/serendipity_event_contentrewrite/lang_en.inc.php @@ -24,5 +24,5 @@ @define('PLUGIN_EVENT_CONTENTREWRITE_REWRITESTRINGDESC', 'The string used to rewrite. Place {from} and {to} anywhere you like to get a rewrite.' . "\n" . 'Example: {from}'); @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.'); ?> diff --git a/plugins/serendipity_event_contentrewrite/serendipity_event_contentrewrite.php b/plugins/serendipity_event_contentrewrite/serendipity_event_contentrewrite.php index 6467a93..10f5db3 100644 --- a/plugins/serendipity_event_contentrewrite/serendipity_event_contentrewrite.php +++ b/plugins/serendipity_event_contentrewrite/serendipity_event_contentrewrite.php @@ -12,6 +12,7 @@ class serendipity_event_contentrewrite extends serendipity_event { var $title = PLUGIN_EVENT_CONTENTREWRITE_NAME; var $rewrite_from, $rewrite_to; + var $fromstring, $tostring; function cleanup() { // Cleanup. Remove all empty configs on SAVECONF-Submit. @@ -45,6 +46,19 @@ class serendipity_event_contentrewrite extends serendipity_event 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'; @@ -117,6 +131,10 @@ class serendipity_event_contentrewrite extends serendipity_event $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); } @@ -231,8 +249,8 @@ class serendipity_event_contentrewrite extends serendipity_event $new = str_replace( array( - '{' . PLUGIN_EVENT_CONTENTREWRITE_FROM . '}', - '{' . PLUGIN_EVENT_CONTENTREWRITE_TO . '}' + '{' . $this->fromstring . '}', + '{' . $this->tostring . '}' ), array( -- 2.39.5