Update of /cvsroot/php-blog/serendipity/plugins/serendipity_plugin_recententries
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26522/plugins/serendipity_plugin_recententries
Modified Files:
Tag: branch-smarty
serendipity_plugin_recententries.php
Log Message:
new config option to recent entries plugin, thanks to sebastian raible
Index: serendipity_plugin_recententries.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_plugin_recententries/serendipity_plugin_recententries.php,v
retrieving revision 1.9.2.3
retrieving revision 1.9.2.4
diff -u -d -r1.9.2.3 -r1.9.2.4
--- serendipity_plugin_recententries.php 12 Nov 2004 15:43:30 -0000 1.9.2.3
+++ serendipity_plugin_recententries.php 15 Nov 2004 10:33:46 -0000 1.9.2.4
@@ -8,6 +8,10 @@
@define('PLUGIN_RECENTENTRIES_BLAHBLAH', 'Zeigt die Titel der aktuellsten Einträge mit Datum');
@define('PLUGIN_RECENTENTRIES_NUMBER', 'Anzahl der Einträge');
@define('PLUGIN_RECENTENTRIES_NUMBER_BLAHBLAH', 'Wieviele Einträge sollen angezeigt werden? (Standard: 10)');
+ @define('PLUGIN_RECENTENTRIES_NUMBER_FROM', 'Angezeigte Einträge überspringen');
+ @define('PLUGIN_RECENTENTRIES_NUMBER_FROM_DESC', 'Nur die neuesten Einträge, die nicht schon auf der Hauptseite zu sehen sind, werden angezeigt. (Default: die neuesten ' . $serendipity['fetchLimit'] . ' werden übersprungen)');
+ @define('PLUGIN_RECENTENTRIES_NUMBER_FROM_RADIO_ALL', 'Alle anzeigen');
+ @define('PLUGIN_RECENTENTRIES_NUMBER_FROM_RADIO_RECENT', 'Einträge auf der Hauptseite überspringen');
break;
case 'en':
@@ -17,7 +21,10 @@
@define('PLUGIN_RECENTENTRIES_BLAHBLAH', 'Shows the titles and dates of the most recent entries');
@define('PLUGIN_RECENTENTRIES_NUMBER', 'Number of entries');
@define('PLUGIN_RECENTENTRIES_NUMBER_BLAHBLAH', 'How many entries should be displayed? (Default: 10)');
-
+ @define('PLUGIN_RECENTENTRIES_NUMBER_FROM', 'Skip front page entries');
+ @define('PLUGIN_RECENTENTRIES_NUMBER_FROM_DESC', 'Only recent entries that are not on the front page will be shown. (Default: latest ' . $serendipity['fetchLimit'] . ' will be skipped)');
+ @define('PLUGIN_RECENTENTRIES_NUMBER_FROM_RADIO_ALL', 'Show all');
+ @define('PLUGIN_RECENTENTRIES_NUMBER_FROM_RADIO_RECENT', 'Skip front page items');
break;
}
@@ -28,8 +35,8 @@
$propbag->add('description', PLUGIN_RECENTENTRIES_BLAHBLAH);
$propbag->add('stackable', true);
$propbag->add('author', 'Christian Machmeier');
- $propbag->add('version', '1.1');
- $propbag->add('configuration', array('title', 'number', 'dateformat', 'category'));
+ $propbag->add('version', '1.2');
+ $propbag->add('configuration', array('title', 'number', 'number_from', 'dateformat', 'category'));
}
function introspect_config_item($name, &$propbag) {
@@ -48,6 +55,17 @@
$propbag->add('default', 10);
break;
+ case 'number_from':
+ $propbag->add('type', 'radio');
+ $propbag->add('name', PLUGIN_RECENTENTRIES_NUMBER_FROM);
+ $propbag->add('description', PLUGIN_RECENTENTRIES_NUMBER_FROM_DESC);
+ $propbag->add('radio', array(
+ 'value' => array('all', 'skip'),
+ 'desc' => array(PLUGIN_RECENTENTRIES_NUMBER_FROM_RADIO_ALL, PLUGIN_RECENTENTRIES_NUMBER_FROM_RADIO_RECENT)
+ ));
+ $propbag->add('default', 'all');
+ break;
+
case 'dateformat':
$propbag->add('type', 'string');
$propbag->add('name', GENERAL_PLUGIN_DATEFORMAT);
@@ -93,10 +111,11 @@
function generate_content(&$title) {
global $serendipity;
- $number = $this->get_config('number');
- $dateformat = $this->get_config('dateformat');
- $category = $this->get_config('category', 'none');
- $title = $this->get_config('title', $title);
+ $number = $this->get_config('number');
+ $dateformat = $this->get_config('dateformat');
+ $category = $this->get_config('category', 'none');
+ $title = $this->get_config('title', $title);
+ $number_from_sw = $this->get_config('number_from');
$sql_join = '';
$sql_where = '';
@@ -110,10 +129,19 @@
$number = 10;
}
+ $sql_number = $number;
+
+ switch($number_from_switch) {
+ case 'skip':
+ $sql_number = serendipity_db_limit_sql(serendipity_db_limit($serendipity['fetchLimit'], $sql_number));
+ break;
+ }
+
if (!$dateformat || strlen($dateformat) < 1) {
$dateformat = '%A, %B %e %Y';
}
+ if ($number_from > 0)
$entries_query = "SELECT id,
title,
timestamp
@@ -122,7 +150,7 @@
WHERE isdraft = 'false' AND timestamp <= " . serendipity_serverOffsetHour(time(), true) . "
$sql_where
ORDER BY timestamp DESC
- LIMIT $number";
+ LIMIT $sql_number";
$entries = serendipity_db_query($entries_query);
if (isset($entries) && is_array($entries)) {
|