From a294db076e24256b3349f6d8df2a9c78fe710fe0 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Mon, 3 Apr 2006 16:18:35 +0000 Subject: [PATCH] Make plugin only send specific entry portion --- .../serendipity_event_mailer.php | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/plugins/serendipity_event_mailer/serendipity_event_mailer.php b/plugins/serendipity_event_mailer/serendipity_event_mailer.php index 6cb9cbf..98026ed 100644 --- a/plugins/serendipity_event_mailer/serendipity_event_mailer.php +++ b/plugins/serendipity_event_mailer/serendipity_event_mailer.php @@ -21,7 +21,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.43'); + $propbag->add('version', '1.44'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -33,7 +33,7 @@ class serendipity_event_mailer extends serendipity_event )); $propbag->add('groups', array('FRONTEND_ENTRY_RELATED')); - $config = array('mailto', 'includelink', 'striptags', 'convertp'); + $config = array('what', 'mailto', 'includelink', 'striptags', 'convertp'); $propbag->add('configuration', $config); } @@ -46,12 +46,12 @@ class serendipity_event_mailer extends serendipity_event if (!is_array($this->data['categories'])) { return false; } - + foreach($this->data['categories'] AS $cat) { $conf[] = 'category_' . $cat['categoryid']; $this->data['cat'][$cat['categoryid']] = $cat; } - + if (is_object($bag)) { $bag->add('configuration', $conf); } @@ -68,6 +68,20 @@ class serendipity_event_mailer extends serendipity_event } switch($name) { + case 'what': + $propbag->add('type', 'select'); + $propbag->add('name', CONTENT); + $propbag->add('description', ''); + $propbag->add('select_values', + array( + 'all' => ENTRY_BODY . ' + ' . EXTENDED_BODY, + 'body' => ENTRY_BODY, + 'extended' => EXTENDED_BODY + ) + ); + $propbag->add('default', 'all'); + break; + case 'mailto': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_EVENT_MAILER_RECIPIENT); @@ -144,7 +158,7 @@ class serendipity_event_mailer extends serendipity_event $to[] = $mailto; } } - + $this->performConfig($to); if (is_array($this->data['cat'])) { $selected = array(); @@ -156,7 +170,7 @@ class serendipity_event_mailer extends serendipity_event foreach($this->data['cat'] AS $cid => $cat) { $mailto = trim($this->get_config('category_' . $cid)); - + if (!empty($mailto) && isset($selected[$cid])) { $to[] = $mailto; } @@ -171,6 +185,15 @@ class serendipity_event_mailer extends serendipity_event 'from' => $serendipity['serendipityEmail'] ); + switch($this->get_config('what')) { + case 'body': + $mail['body'] = $eventData['body']; + break; + case 'extended': + $mail['extended'] = $eventData['extended']; + break; + } + if (isset($serendipity['POST']['properties']['mailto'])) { $mails = explode(' ', $serendipity['POST']['properties']['mailto']); foreach($mails as $mailto) { -- 2.39.5