Proper use of the example() method of the plugin API

This commit is contained in:
Garvin Hicking 2014-03-05 13:48:15 +01:00
parent 31113486d4
commit 19192b289d
24 changed files with 68 additions and 49 deletions

View file

@ -1,3 +1,4 @@
3.3.1: Properly use the example() API method by returning, not echo'ing. Unimportant update.
3.3.0:
-----
* Upgrade to CKEDITOR 4.3 Series update 3 (http://ckeditor.com/node/134732)

View file

@ -145,7 +145,7 @@ class serendipity_event_ckeditor extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_CKEDITOR_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Rustam Abdullaev, Ian');
$propbag->add('version', '3.3.0'); // is CKEDITOR Series 4 (hidden) - revision .3.3 - and appended plugin revision .0
$propbag->add('version', '3.3.1'); // is CKEDITOR Series 4 (hidden) - revision .3.3 - and appended plugin revision .0
$propbag->add('copyright', 'GPL or LGPL License');
$propbag->add('requirements', array(
'serendipity' => '1.7',
@ -239,7 +239,7 @@ class serendipity_event_ckeditor extends serendipity_event
}
function example() {
$s = '';
if (serendipity_db_bool($this->get_config('force_install'))) {
$this->forceZipInstall = true;
$this->install();
@ -247,43 +247,44 @@ class serendipity_event_ckeditor extends serendipity_event
$this->set_config('force_install', 'false');
// forceZipInstall forces to surround the checkUpdate function, thus we set config database table to keep track
$this->updateTableZip();
echo '<p class="msg_success"><span class="icon-ok"></span><strong>Force deflate done:</strong> Please reload this page <a href="'.$serendipity['baseURL'] . 'serendipity_admin.php?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]='.urlencode($this->instance).'" target="_self">here</a>!</p>';
$s .= '<p class="msg_success"><span class="icon-ok"></span><strong>Force deflate done:</strong> Please reload this page <a href="'.$serendipity['baseURL'] . 'serendipity_admin.php?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]='.urlencode($this->instance).'" target="_self">here</a>!</p>';
}
$installer = $this->get_config('installer'); // Can't use method return value in write context in '' with substr(), get_config() and isset()
$parts = explode(':', $this->checkUpdateVersion[0]); // this is ckeditor only
echo PLUGIN_EVENT_CKEDITOR_REVISION_TITLE;
echo "\n<ul>\n";
$s .= PLUGIN_EVENT_CKEDITOR_REVISION_TITLE;
$s .= "\n<ul>\n";
// hook this as a scalar value into this plugins lang files (would be needed by adding this to a constant)
foreach( $this->revisionPackage AS $revision ) {
echo ' <li>' . $revision . "</li>\n";
$s .= ' <li>' . $revision . "</li>\n";
}
echo "</ul>\n\n";
$s .= "</ul>\n\n";
if( isset($installer) && !empty($installer) ) {
switch ($installer[0]) {
case '4': // this won't happen, since case 2 is true - just a fake
echo '<p class="msg_notice"><span class="icon-attention"></span> <strong>Check Plugin Update Message:</strong> NO CONFIG SET OR NO MATCH -> config_set: "last_'.$parts[0].'_version:'. $parts[1].'"</p>';
$s .= '<p class="msg_notice"><span class="icon-attention"></span> <strong>Check Plugin Update Message:</strong> NO CONFIG SET OR NO MATCH -> config_set: "last_'.$parts[0].'_version:'. $parts[1].'"</p>';
break;
case '3':
echo '<p class="msg_success"><span class="icon-ok"></span> <strong>Installer Update Message:</strong> Check Update found false, no unpack needed. Plugin upgrade successfully done <strong>or</strong> has been triggered to be checked by an other Spartacus Plugin update!</p>';
$s .= '<p class="msg_success"><span class="icon-ok"></span> <strong>Installer Update Message:</strong> Check Update found false, no unpack needed. Plugin upgrade successfully done <strong>or</strong> has been triggered to be checked by an other Spartacus Plugin update!</p>';
break;
case '2':
echo '<p class="msg_success"><span class="icon-ok"></span> <strong>Installer Message:</strong> Extracting the zip to ' . $this->cke_path . ' directory done!</p>';
$s .= '<p class="msg_success"><span class="icon-ok"></span> <strong>Installer Message:</strong> Extracting the zip to ' . $this->cke_path . ' directory done!</p>';
break;
case '1':
echo '<p class="msg_error"><span class="icon-error"></span> <strong>Installer Error[1]:</strong> Extracting the zip to ' . $this->cke_path . ' directory failed!<br>Please extract ' . $this->cke_zipfile . ' by hand.</p>';
$s .= '<p class="msg_error"><span class="icon-error"></span> <strong>Installer Error[1]:</strong> Extracting the zip to ' . $this->cke_path . ' directory failed!<br>Please extract ' . $this->cke_zipfile . ' by hand.</p>';
break;
case '0':
echo '<p class="msg_error"><span class="icon-error"></span> <strong>Installer Error[0]:</strong> Due to a writing permission error, extracting the zip to ' . $this->cke_path . ' directory failed!<br>Please set "/plugins" or "/plugins/serendipity_event_ckeditor" directory and files correct writing permissions and extract ' . $this->cke_zipfile . ' by hand or try again and <u>remove(!)</u> this plugin from your plugin list and install it again.</p>';
$s .= '<p class="msg_error"><span class="icon-error"></span> <strong>Installer Error[0]:</strong> Due to a writing permission error, extracting the zip to ' . $this->cke_path . ' directory failed!<br>Please set "/plugins" or "/plugins/serendipity_event_ckeditor" directory and files correct writing permissions and extract ' . $this->cke_zipfile . ' by hand or try again and <u>remove(!)</u> this plugin from your plugin list and install it again.</p>';
break;
}
$this->set_config('installer', ''); // can't use serendipity_plugin_api::remove_plugin_value($this->instance, array('installer')); here, since it delivers the wrong instance
}
#echo $installer[0] . ' - ' . $this->instance; // this debug message on the other hand will do well, if all went through w/o install() returning false
echo PLUGIN_EVENT_CKEDITOR_INSTALL;
echo PLUGIN_EVENT_CKEDITOR_CONFIG;
$s .= PLUGIN_EVENT_CKEDITOR_INSTALL;
$s .= PLUGIN_EVENT_CKEDITOR_CONFIG;
return $s;
}
/**

View file

@ -1,3 +1,4 @@
0.9: Properly use the example() API method by returning, not echo'ing. Unimportant update.
0.8:
----

View file

@ -22,7 +22,7 @@ class serendipity_event_cronjob extends serendipity_event {
$propbag->add('description', PLUGIN_EVENT_CRONJOB_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('version', '0.8');
$propbag->add('version', '0.9');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'php' => '4.1.0'
@ -65,16 +65,18 @@ class serendipity_event_cronjob extends serendipity_event {
function example() {
global $serendipity;
echo '<br /><div style="border: 1px solid red; padding: 5px;">' . PLUGIN_EVENT_CRONJOB_DETAILS . '</div>';
echo '<br /><fieldset><legend>' . PLUGIN_EVENT_CRONJOB_LOG . '</legend><table cellspacing=1 cellpadding=2>';
echo '<tr><th>' . DATE . '</th><th>' . TYPE . '</th><th>' . DESCRIPTION . '</th></tr>';
$s = '';
$s .= '<br /><div style="border: 1px solid red; padding: 5px;">' . PLUGIN_EVENT_CRONJOB_DETAILS . '</div>';
$s .= '<br /><fieldset><legend>' . PLUGIN_EVENT_CRONJOB_LOG . '</legend><table cellspacing=1 cellpadding=2>';
$s .= '<tr><th>' . DATE . '</th><th>' . TYPE . '</th><th>' . DESCRIPTION . '</th></tr>';
$res = serendipity_db_query("SELECT timestamp, type, reason FROM {$serendipity['dbPrefix']}cronjoblog ORDER BY timestamp DESC");
if (is_array($res)) {
foreach($res AS $row) {
echo '<tr><td>' . date('d.m.Y H:i', $row['timestamp']) . '</td><td>' . htmlspecialchars($row['type']) . '</td><td>' . htmlspecialchars($row['reason']) . '</td></tr>' . "\n";
$s .= '<tr><td>' . date('d.m.Y H:i', $row['timestamp']) . '</td><td>' . htmlspecialchars($row['type']) . '</td><td>' . htmlspecialchars($row['reason']) . '</td></tr>' . "\n";
}
}
echo '</table></fieldset>';
$s .= '</table></fieldset>';
return $s;
}
function introspect_config_item($name, &$propbag) {

View file

@ -1,3 +1,4 @@
0.3: Properly use the example() API method by returning, not echo'ing. Unimportant update.
Version 0.2
* Made it work with articles not having an extended part.
* Made trackbacks visible again (for templates supporting it), css class to be hidden configurable now.

View file

@ -27,7 +27,7 @@ class serendipity_event_disqus extends serendipity_event {
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('version', '0.2');
$propbag->add('version', '0.3');
$propbag->add('groups', array('FRONTEND_VIEWS'));
$propbag->add('event_hooks', array(
'frontend_display:html:per_entry' => true,
@ -78,7 +78,7 @@ class serendipity_event_disqus extends serendipity_event {
}
function example() {
echo nl2br(PLUGIN_DISQUS_DESC2);
return nl2br(PLUGIN_DISQUS_DESC2);
}
function event_hook($event, &$bag, &$eventData, $addData = null) {

View file

@ -1,3 +1,4 @@
0.4: Properly use the example() API method by returning, not echo'ing. Unimportant update.
0.3:
----

View file

@ -33,7 +33,7 @@ class serendipity_event_facebook extends serendipity_event {
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('version', '0.4');
$propbag->add('version', '0.5');
$propbag->add('groups', array('FRONTEND_VIEWS'));
$propbag->add('event_hooks', array(
'frontend_display' => true,
@ -130,7 +130,7 @@ class serendipity_event_facebook extends serendipity_event {
}
function example() {
echo '<br />' . PLUGIN_EVENT_FACEBOOK_HOWTO;
return '<br />' . PLUGIN_EVENT_FACEBOOK_HOWTO;
}
function addcomment($entry_id, $user, $post_id, &$comment) {

View file

@ -1,3 +1,4 @@
0.9: Properly use the example() API method by returning, not echo'ing. Unimportant update.
0.8:
- Changed download URL to sourceforge.net, since fckeditor.com is now ckeditor.com
and has no available downloads for this (old) FCKeditor plugin.

View file

@ -18,9 +18,7 @@ class serendipity_event_fckeditor extends serendipity_event
var $is_init = false;
function example() {
echo PLUGIN_EVENT_FCKEDITOR_UPDATE;
echo PLUGIN_EVENT_FCKEDITOR_INSTALL;
echo PLUGIN_EVENT_FCKEDITOR_CONFIG;
return PLUGIN_EVENT_FCKEDITOR_UPDATE . PLUGIN_EVENT_FCKEDITOR_INSTALL . PLUGIN_EVENT_FCKEDITOR_CONFIG;
}
function introspect(&$propbag)
@ -31,7 +29,7 @@ class serendipity_event_fckeditor extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_FCKEDITOR_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Ziyad Saeed, Garvin Hicking, Ian');
$propbag->add('version', '0.8');
$propbag->add('version', '0.9');
$propbag->add('requirements', array(
'serendipity' => '0.9',
'smarty' => '2.6.7',

View file

@ -0,0 +1 @@
Properly use the example() API method by returning, not echo'ing. Unimportant update.

View file

@ -17,7 +17,7 @@ class serendipity_event_flickr extends serendipity_event
{
// called just after installation, to display post install notes
function example() {
echo PLUGIN_EVENT_FLICKR_INSTALL;
return PLUGIN_EVENT_FLICKR_INSTALL;
}
// should describe the plugin: author, version, requirements, ...
@ -31,7 +31,7 @@ class serendipity_event_flickr extends serendipity_event
$propbag->add('stackable', false);
$propbag->add('license', 'GPL');
$propbag->add('author', 'Jay Bertrand');
$propbag->add('version', '0.4');
$propbag->add('version', '0.5');
$propbag->add('requirements', array(
'serendipity' => '0.9',
'smarty' => '2.6.7',

View file

@ -1,3 +1,5 @@
3.43: Properly use the example() API method by returning, not echo'ing. Unimportant update.
3.42:
-----
* fixed db table guestbook, ip column to IPv6 length

View file

@ -66,7 +66,7 @@ class serendipity_event_guestbook extends serendipity_event {
'dateformat'
));
$propbag->add('author', 'Ian');
$propbag->add('version', '3.42');
$propbag->add('version', '3.43');
$propbag->add('requirements', array(
'serendipity' => '1.3',
'smarty' => '2.6.7',
@ -84,9 +84,10 @@ class serendipity_event_guestbook extends serendipity_event {
*
*/
function example() {
echo "\n<ul>\n";
echo " <li><strong>Note to v. 3.40:</strong> If have, please update copied guestbook tpl files in your template!</li>\n";
echo "</ul>\n\n";
return
"\n<ul>\n" .
" <li><strong>Note to v. 3.40:</strong> If you want to customize the template of this guestbook, please copy those guestbook tpl files to your template directory!</li>\n" .
"</ul>\n\n";
}

View file

@ -1,5 +1,7 @@
#
1.04: Properly use the example() API method by returning, not echo'ing. Unimportant update.
1.03:
-----
- fixed deinstall in case of empty plugin_mobile_output/ dir

View file

@ -14,7 +14,7 @@ TODO:
if (IN_serendipity !== true) {
die ("Don't hack!");
}
@define('PLUGIN_EVENT_MOBILE_VERSION','1.03');
@define('PLUGIN_EVENT_MOBILE_VERSION','1.04');
@define('PLUGIN_EVENT_MOBILE_AUTHORS','Pelle Boese, Grischa Brockhaus');
@define('PLUGIN_EVENT_MOBILE_TPL_IPHONE','iphone.app');
@ -151,22 +151,25 @@ class serendipity_event_mobile_output extends serendipity_event
function example() {
$template = $this->get_config('iphone_template');
$template_meta = new serendipity_template_meta($template);
$s = '';
if (!@file_exists($template_meta->getTemplateDir())) {
echo "Template " . $template . " not installed. You will find one for each type in the plugin directory.";
echo "<br/>";
$s .= "Template " . $template . " not installed. You will find one for each type in the plugin directory.";
$s .= "<br/>";
}
$template = $this->get_config('android_template');
$template_meta = new serendipity_template_meta($template);
if (!@file_exists($template_meta->getTemplateDir())) {
echo "Template " . $template . " not installed. You will find one for each type in the plugin directory.";
echo "<br/>";
$s .= "Template " . $template . " not installed. You will find one for each type in the plugin directory.";
$s .= "<br/>";
}
$template = $this->get_config('mobile_template');
$template_meta = new serendipity_template_meta($template);
if (!@file_exists($template_meta->getTemplateDir())) {
echo "Template " . $template . " not installed. You will find one for each type in the plugin directory.";
echo "<br/>";
$s .= "Template " . $template . " not installed. You will find one for each type in the plugin directory.";
$s .= "<br/>";
}
return $s;
}
function event_hook($event, &$bag, &$eventData, $addData = null) {

View file

@ -0,0 +1 @@
Properly use the example() API method by returning, not echo'ing. Unimportant update.

View file

@ -30,7 +30,7 @@ class serendipity_event_textlinkads extends serendipity_event
'php' => '4.1.0'
));
$propbag->add('groups', array('FRONTEND_EXTERNAL_SERVICES'));
$propbag->add('version', '0.11');
$propbag->add('version', '0.12');
$propbag->add('configuration', array('htmlid', 'xmlfilename'));
$propbag->add('event_hooks', array(
'css' => true,
@ -40,7 +40,7 @@ class serendipity_event_textlinkads extends serendipity_event
}
function example() {
echo PLUGIN_EVENT_TEXTLINKADS_INFO;
return PLUGIN_EVENT_TEXTLINKADS_INFO;
}
function introspect_config_item($name, &$propbag) {

View file

@ -1,5 +1,6 @@
#
1.11: Properly use the example() API method by returning, not echo'ing. Unimportant update.
1.10: Added ?js=1 parameter to gzip loader to properly load TinyMCE
------------------------------------------------------------------------

View file

@ -19,7 +19,7 @@ class serendipity_event_tinymce extends serendipity_event
function example() {
if (!file_exists(dirname(__FILE__) . '/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php'))
echo PLUGIN_EVENT_TINYMCE_INSTALL;
return PLUGIN_EVENT_TINYMCE_INSTALL;
}
function introspect(&$propbag)
@ -30,7 +30,7 @@ class serendipity_event_tinymce extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_TINYMCE_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking, Grischa Brockhaus');
$propbag->add('version', '1.12');
$propbag->add('version', '1.13');
$propbag->add('requirements', array(
'serendipity' => '0.9',
'smarty' => '2.6.7',

View file

@ -0,0 +1 @@
Properly use the example() API method by returning, not echo'ing. Unimportant update.

View file

@ -18,7 +18,7 @@ class serendipity_event_xinha extends serendipity_event
var $title = PLUGIN_EVENT_XINHA_NAME;
function example() {
echo PLUGIN_EVENT_XINHA_INSTALL;
return PLUGIN_EVENT_XINHA_INSTALL;
}
function introspect(&$propbag)
@ -29,7 +29,7 @@ class serendipity_event_xinha extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_XINHA_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Ziyad Saeed, Garvin Hicking');
$propbag->add('version', '0.8');
$propbag->add('version', '0.9');
$propbag->add('requirements', array(
'serendipity' => '0.9',
'smarty' => '2.6.7',

View file

@ -0,0 +1 @@
Properly use the example() API method by returning, not echo'ing. Unimportant update.

View file

@ -25,7 +25,7 @@ class serendipity_plugin_smiletag extends serendipity_plugin
$propbag->add('description', PLUGIN_SMILETAG_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('version', '1.03');
$propbag->add('version', '1.04');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
@ -55,7 +55,7 @@ class serendipity_plugin_smiletag extends serendipity_plugin
}
function example() {
echo '<p>' . PLUGIN_SMILETAG_INSTALL . '</p>';
return '<p>' . PLUGIN_SMILETAG_INSTALL . '</p>';
}
function generate_content(&$title)