📄 serendipity_plugin_recententries.php
字号:
<?php # $Id: serendipity_plugin_recententries.php,v 1.4.4.1 2004/04/07 12:38:19 garvinhicking Exp $
// Contributed by Christian Machmeier <cm@redsplash.de>
/*******************************************************汉化作者:youngong(http://youngong.blogbus.com) **官方主页:http://www.s9y.corg **我的信箱:youngong@163.com **如果有问题,欢迎和作者及汉化作者联系。 ********************************************************/
switch ($serendipity['lang']) {
case 'de':
@define('PLUGIN_RECENTENTRIES_TITLE', 'Aktuelle Eintr鋑e');
@define('PLUGIN_RECENTENTRIES_BLAHBLAH', 'Zeigt die Titel der aktuellsten Eintr鋑e mit Datum');
@define('PLUGIN_RECENTENTRIES_NUMBER', 'Anzahl der Eintr鋑e');
@define('PLUGIN_RECENTENTRIES_NUMBER_BLAHBLAH', 'Wieviele Eintr鋑e sollen angezeigt werden? (Standard: 10)');
break;
case 'cn':
@define('PLUGIN_RECENTENTRIES_TITLE', '最近更新');
@define('PLUGIN_RECENTENTRIES_BLAHBLAH', '显示最近网志的标题和日期');
@define('PLUGIN_RECENTENTRIES_NUMBER', '网志数');
@define('PLUGIN_RECENTENTRIES_NUMBER_BLAHBLAH', '显示多少篇网志? (Default: 10)');
break;
case 'en':
case 'es':
default:
@define('PLUGIN_RECENTENTRIES_TITLE', 'Recent Entries');
@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)');
break;
}
class serendipity_plugin_recententries extends serendipity_plugin {
function introspect(&$propbag) {
$propbag->add('name', PLUGIN_RECENTENTRIES_TITLE);
$propbag->add('description', PLUGIN_RECENTENTRIES_BLAHBLAH);
$propbag->add('configuration', array('number', 'dateformat'));
}
function introspect_config_item($name, &$propbag) {
switch($name) {
case 'number':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_RECENTENTRIES_NUMBER);
$propbag->add('description', PLUGIN_RECENTENTRIES_NUMBER_BLAHBLAH);
break;
case 'dateformat':
$propbag->add('type', 'string');
$propbag->add('name', GENERAL_PLUGIN_DATEFORMAT);
$propbag->add('description', sprintf(GENERAL_PLUGIN_DATEFORMAT_BLAHBLAH, '%A, %B %e %Y'));
break;
default:
return false;
}
return true;
}
function generate_content(&$title) {
global $serendipity;
$number = $this->get_config('number');
$dateformat = $this->get_config('dateformat');
if (!$number || !is_numeric($number) || $number < 1) {
$number = 10;
}
if (!$dateformat || strlen($dateformat) < 1) {
$dateformat = '%A, %B %e %Y';
}
$title = PLUGIN_RECENTENTRIES_TITLE;
$entries = serendipity_db_query("SELECT id,
title,
timestamp
FROM {$serendipity['dbPrefix']}entries
WHERE isdraft = 'false'
ORDER BY timestamp DESC
LIMIT $number");
if (is_array($entries)) {
foreach ($entries as $k => $entry) {
$entryLink = serendipity_archiveURL(
$entry['id'],
$entry['title'],
'serendipityHTTPPath'
);
echo '<a href="' . $entryLink . '" title="' . htmlspecialchars($entry['title']) . '">' . $entry['title'] . '</a><br />'
. '<div class="serendipitySideBarDate">'
. htmlspecialchars(strftime($dateformat, $entry['timestamp']))
. '</div><br />';
}
}
}
}
/* vim: set sts=4 ts=4 expandtab : */
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -