Update of /cvsroot/php-blog/serendipity/plugins/serendipity_plugin_history
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8394/plugins/serendipity_plugin_history
Modified Files:
serendipity_plugin_history.php
Log Message:
Leapyear-enabled!
Index: serendipity_plugin_history.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_plugin_history/serendipity_plugin_history.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- serendipity_plugin_history.php 5 Jul 2004 09:59:56 -0000 1.3
+++ serendipity_plugin_history.php 7 Jul 2004 21:34:37 -0000 1.4
@@ -17,6 +17,8 @@
@define('PLUGIN_HISTORY_INTRO_DESC', 'Text, der vor den Einträgen angezeigt werden soll');
@define('PLUGIN_HISTORY_DISPLAYDATE', 'Datum anzeigen');
@define('PLUGIN_HISTORY_DISPLAYDATE_DESC', 'Vor jedem Eintrag das Datum anzeigen?');
+ @define('PLUGIN_HISTORY_SPECIALAGE_DESC', 'Display items of a ready-made age?');
+ @define('PLUGIN_HISTORY_SPECIALAGE_YEAR', 'Display items of exactly one year ago');
break;
default:
@define('PLUGIN_HISTORY_NAME', 'History');
@@ -35,6 +37,10 @@
@define('PLUGIN_HISTORY_INTRO_DESC', 'A short intro like \'One year ago I said:\'.');
@define('PLUGIN_HISTORY_DISPLAYDATE', 'Display date');
@define('PLUGIN_HISTORY_DISPLAYDATE_DESC', 'Display the date of each entry?');
+ @define('PLUGIN_HISTORY_SPECIALAGE', 'Ready-made age?');
+ @define('PLUGIN_HISTORY_SPECIALAGE_DESC', 'If you want to define your own timerange instead of a ready-made, select custom here and adjust the two settings below.');
+ @define('PLUGIN_HISTORY_SPECIALAGE_YEAR', 'Display items of exactly one year ago');
+ @define('PLUGIN_HISTORY_CUSTOMAGE', 'Let me define the age');
break;
}
@@ -49,6 +55,7 @@
$propbag->add('configuration', array('title',
'intro',
+ 'specialage',
'min_age',
'max_age',
'max_entries',
@@ -73,6 +80,13 @@
$propbag->add('description', PLUGIN_HISTORY_INTRO_DESC);
$propbag->add('default', '');
break;
+ case 'specialage':
+ $propbag->add('type', 'select');
+ $propbag->add('name', PLUGIN_HISTORY_SPECIALAGE);
+ $propbag->add('description', PLUGIN_HISTORY_SPECIALAGE_DESC);
+ $propbag->add('default', 'year');
+ $propbag->add('select_values', array('year'=>'One year ago','custom'=>'I\'ll make it up'));
+ break;
case 'min_age':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_HISTORY_MIN_AGE);
@@ -125,6 +139,7 @@
$max_entries = $this->get_config('max_entries');
$min_age = $this->get_config('min_age');
$max_age = $this->get_config('max_age');
+ $specialage = $this->get_config('specialage');
$displaydate = $this->get_config('displaydate', 'true');
$dateformat = $this->get_config('dateformat');
$full = ($this->get_config('full', 'false') != 'true') ? false : true;
@@ -133,10 +148,14 @@
$min_age = 365;
}
- if (!$max_age || !is_numeric($max_age) || $max_age < 1) {
+ if (!$max_age || !is_numeric($max_age) || $max_age < 1 || $max_age<$min_age) {
$max_age = 365;
}
+ if ($specialage == 'year') {
+ $min_age = $max_age = 365 + date('L');
+ }
+
if (!$max_entries || !is_numeric($max_entries) || $max_entries < 1) {
$max_entries = 5;
}
|