allow debugging for plugin

This commit is contained in:
Garvin Hicking 2013-11-20 09:21:48 +01:00
parent 69fcbffc73
commit 4f2ec68f6b
4 changed files with 19 additions and 2 deletions

View file

@ -1,3 +1,7 @@
1.44:
-----
* Added debug_file option as new config string
1.42:
----

View file

@ -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');
?>

View file

@ -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');

View file

@ -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('<h3>' . PLUGIN_MF_NAME . ' v' . POPFETCHER_VERSION . ' @ ' . date("D M j G:i:s T Y") . '</h3>');
$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;
}