* Change mail entry plugin to be able to send mails without

hyperlinks and images. (garvinhicking)
This commit is contained in:
Garvin Hicking 2009-05-29 13:23:31 +00:00
parent be0bdd9cf6
commit cd3cee1e1b
5 changed files with 26 additions and 3 deletions

View File

@ -3,6 +3,9 @@
Version 1.5 ()
------------------------------------------------------------------------
* Change mail entry plugin to be able to send mails without
hyperlinks and images. (garvinhicking)
* Change uriArgument parsing routine to allow "!" in URLs.
Now we can have absolute serocracy.

View File

@ -15,3 +15,6 @@
@define('PLUGIN_EVENT_MAILER_SENDING', 'Versende');
@define('PLUGIN_EVENT_MAILER_ISTOSENDIT', 'Diesen Eintrag per E-Mail versenden');
@define('PLUGIN_EVENT_MAILER_SENDTOALL', 'An alle Redakteure schicken');
@define('PLUGIN_EVENT_MAILER_STRIPTAGS', 'Bilder und Hyperlinks beibehalten, wenn HTML entfernt wird?');
@define('PLUGIN_EVENT_MAILER_STRIPTAGSDESC', 'Gilt nur, wenn HTML entfernt wird. Falls aktiviert, werden Bilder und Hyperlinks in der Mail enthalten bleiben (in eckigen Klammern). Falls deaktiviert, werden alle Bilder und Hyperlinks auch entfernt.');

View File

@ -15,3 +15,6 @@
@define('PLUGIN_EVENT_MAILER_SENDING', 'Versende');
@define('PLUGIN_EVENT_MAILER_ISTOSENDIT', 'Diesen Eintrag per E-Mail versenden');
@define('PLUGIN_EVENT_MAILER_SENDTOALL', 'An alle Redakteure schicken');
@define('PLUGIN_EVENT_MAILER_STRIPTAGS', 'Bilder und Hyperlinks beibehalten, wenn HTML entfernt wird?');
@define('PLUGIN_EVENT_MAILER_STRIPTAGSDESC', 'Gilt nur, wenn HTML entfernt wird. Falls aktiviert, werden Bilder und Hyperlinks in der Mail enthalten bleiben (in eckigen Klammern). Falls deaktiviert, werden alle Bilder und Hyperlinks auch entfernt.');

View File

@ -21,3 +21,5 @@
@define('PLUGIN_EVENT_MAILER_SENDING', 'Sending');
@define('PLUGIN_EVENT_MAILER_ISTOSENDIT', 'Send this entry via E-Mail');
@define('PLUGIN_EVENT_MAILER_SENDTOALL', 'Send to all authors');
@define('PLUGIN_EVENT_MAILER_STRIPTAGS', 'Keep images and hyperlinks when removing html?');
@define('PLUGIN_EVENT_MAILER_STRIPTAGSDESC', 'Only applies when removing HTML-tags from the mail. If enabled, images and hyperlinks will be put inside the text, when disabled those placeholders will also be removed.');

View File

@ -26,7 +26,7 @@ class serendipity_event_mailer extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_MAILER_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Sebastian Nohn, Kristian Koehntopp, Garvin Hicking');
$propbag->add('version', '1.51');
$propbag->add('version', '1.52');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@ -120,6 +120,13 @@ class serendipity_event_mailer extends serendipity_event
$propbag->add('default', 'false');
break;
case 'keepstriptags':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_MAILER_KEEPSTRIPTAGS);
$propbag->add('description', PLUGIN_EVENT_MAILER_KEEPSTRIPTAGSDESC);
$propbag->add('default', 'true');
break;
case 'convertp':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_MAILER_CONVERTP);
@ -249,8 +256,13 @@ class serendipity_event_mailer extends serendipity_event
}
if (serendipity_db_bool($this->get_config('striptags', false)) == true) {
$mail['body'] = preg_replace('§<a[^>]+href=["\']([^"\']*)["\'][^>]*>([^<]*)</a>§i', "$2 [$1]", $mail['body']);
$mail['body'] = preg_replace('§<img[^>]+src=["\']([^"\']*)["\'][^>]*>§i', "[" . IMAGE . ": $1]", $mail['body']);
if (serendipity_db_bool($this->get_config('keepstriptags', true))) {
$mail['body'] = preg_replace('§<a[^>]+href=["\']([^"\']*)["\'][^>]*>([^<]*)</a>§i', "$2 [$1]", $mail['body']);
$mail['body'] = preg_replace('§<img[^>]+src=["\']([^"\']*)["\'][^>]*>§i', "[" . IMAGE . ": $1]", $mail['body']);
} else {
$mail['body'] = preg_replace('§<a[^>]+href=["\']([^"\']*)["\'][^>]*>([^<]*)</a>§i', "", $mail['body']);
$mail['body'] = preg_replace('§<img[^>]+src=["\']([^"\']*)["\'][^>]*>§i', "", $mail['body']);
}
$mail['body'] = strip_tags($mail['body']);
}