From 4f2ec68f6b63d21e88620a5d93bf2c57705ccc2f Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Wed, 20 Nov 2013 09:21:48 +0100 Subject: [PATCH] allow debugging for plugin --- serendipity_event_popfetcher/ChangeLog | 4 ++++ .../UTF-8/lang_en.inc.php | 1 + serendipity_event_popfetcher/lang_en.inc.php | 1 + .../serendipity_event_popfetcher.php | 15 +++++++++++++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/serendipity_event_popfetcher/ChangeLog b/serendipity_event_popfetcher/ChangeLog index dd81e4a3..edb37435 100644 --- a/serendipity_event_popfetcher/ChangeLog +++ b/serendipity_event_popfetcher/ChangeLog @@ -1,3 +1,7 @@ +1.44: +----- +* Added debug_file option as new config string + 1.42: ---- diff --git a/serendipity_event_popfetcher/UTF-8/lang_en.inc.php b/serendipity_event_popfetcher/UTF-8/lang_en.inc.php index 7fe0b902..61a49a53 100644 --- a/serendipity_event_popfetcher/UTF-8/lang_en.inc.php +++ b/serendipity_event_popfetcher/UTF-8/lang_en.inc.php @@ -94,4 +94,5 @@ @define('PLUGIN_MF_SPLITTEXT', 'Define a string which separates body/extended parts'); @define('PLUGIN_MF_SPLITTEXT_DESC', 'If you want to use a special string which separates the body and the extended body text in your emails, enter that string here. Serendipity will look for the occurence of that string, and put everything before that string in the body part, and everything after the string in the extended section. Be sure to use a unique string that does not occur as usual text, like "xxx-SPLIT-xxx". If you leave this option empty, the email will be computed as usual - but if you configure a magic string here, some of the other options will be overridden!'); +@define('PLUGIN_MF_DEBUGMAIL', 'For developers: You can enter a filename (including path) here to a EML file to debug popfetcher with such file'); ?> diff --git a/serendipity_event_popfetcher/lang_en.inc.php b/serendipity_event_popfetcher/lang_en.inc.php index d90dce3c..d5d3abf7 100644 --- a/serendipity_event_popfetcher/lang_en.inc.php +++ b/serendipity_event_popfetcher/lang_en.inc.php @@ -123,4 +123,5 @@ @define('THUMBNAIL_VIEW', 'View Thumbnail in Entry Body'); @define('THUMBNAIL_VIEW_DESC', 'If you want to have a thumbnail view of your attached pictures in the entries body. If set to "no", the full picture will be displayed.'); +@define('PLUGIN_MF_DEBUGMAIL', 'For developers: You can enter a filename (including path) here to a EML file to debug popfetcher with such file'); diff --git a/serendipity_event_popfetcher/serendipity_event_popfetcher.php b/serendipity_event_popfetcher/serendipity_event_popfetcher.php index 46a4419e..929055e7 100644 --- a/serendipity_event_popfetcher/serendipity_event_popfetcher.php +++ b/serendipity_event_popfetcher/serendipity_event_popfetcher.php @@ -12,7 +12,7 @@ require_once('tmobile.php'); require_once('o2.php'); // Default values -define('POPFETCHER_VERSION', '1.43'); // This version of Popfetcher +define('POPFETCHER_VERSION', '1.44'); // This version of Popfetcher define('DEFAULT_ADMINMENU', 'true'); // True if run as sidebar plugin. False if external plugin. define('DEFAULT_HIDENAME', 'popfetcher'); // User should set this to something unguessable define('DEFAULT_MAILSERVER', ''); @@ -66,7 +66,7 @@ class serendipity_event_popfetcher extends serendipity_event $propbag->add('groups', array('BACKEND_FEATURES')); $propbag->add('configuration', array('cronjob', 'adminmenu', 'hidename', 'author', 'mailserver', 'mailuser', 'mailpass', 'onlyfrom', 'category', 'maildir', 'subfolder', 'blogflag', 'plaintext_is_body', 'plaintext_use_extended', 'textpref', 'adflag', 'striptext', 'striptagsflag', 'splittext', 'usetext', 'publishflag', 'default_moderate', 'default_comments', 'thumbnail_view', 'usedate', - 'deleteflag', 'apopflag', 'mailport', 'timeout', 'debug')); + 'deleteflag', 'apopflag', 'mailport', 'timeout', 'debug', 'debug_mail')); } function introspect_config_item($name, &$propbag) { @@ -93,6 +93,13 @@ class serendipity_event_popfetcher extends serendipity_event $propbag->add('default', false); break; + case 'debug_mail': + $propbag->add('type', 'string'); + $propbag->add('name', PLUGIN_MF_DEBUGFILE); + $propbag->add('description', ''); + $propbag->add('default', ''); + break; + case 'author': $propbag->add('type', 'select'); $propbag->add('name', AUTHOR); @@ -891,6 +898,10 @@ class serendipity_event_popfetcher extends serendipity_event $this->out('

' . PLUGIN_MF_NAME . ' v' . POPFETCHER_VERSION . ' @ ' . date("D M j G:i:s T Y") . '

'); $debug_file = null; // DEVELOPERS: If set to a filename, you can bypass fetching POP and use a file instead. + $debug_mail = $this->get_config('debug_mail'); + if (strlen($debug_mail) != '' && file_exists($debug_mail)) { + $debug_file = $debug_mail; + } if ($debug_file != null) { $this->debug = true; }