本文整理汇总了PHP中serendipity_rewriteURL函数的典型用法代码示例。如果您正苦于以下问题:PHP serendipity_rewriteURL函数的具体用法?PHP serendipity_rewriteURL怎么用?PHP serendipity_rewriteURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serendipity_rewriteURL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayUserList
function displayUserList()
{
global $serendipity;
$userlist = serendipity_fetchUsers();
$content = "";
foreach ($userlist as $user) {
if (function_exists('serendipity_authorURL')) {
$entryLink = serendipity_authorURL($user);
} else {
$entryLink = serendipity_rewriteURL(PATH_AUTHORS . '/' . serendipity_makePermalink(PERM_AUTHORS, array('id' => $user['authorid'], 'title' => $user['realname'])));
}
$content .= sprintf("<a href=\"%s\" title=\"%s\">%s</a><br />\n", $entryLink, function_exists('serendipity_specialchars') ? serendipity_specialchars($user['realname']) : htmlspecialchars($user['realname'], ENT_COMPAT, LANG_CHARSET), function_exists('serendipity_specialchars') ? serendipity_specialchars($user['realname']) : htmlspecialchars($user['realname'], ENT_COMPAT, LANG_CHARSET));
}
return $content;
}
示例2: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
$authors_query = "SELECT realname, username, authorid FROM {$serendipity['dbPrefix']}authors";
$row_authors = serendipity_db_query($authors_query);
echo '<ul class="plainList">';
foreach ($row_authors as $entry) {
if (function_exists('serendipity_authorURL')) {
$entryLink = serendipity_authorURL($entry);
} else {
$entryLink = serendipity_rewriteURL(PATH_AUTHORS . '/' . serendipity_makePermalink(PERM_AUTHORS, array('id' => $entry['authorid'], 'title' => $entry['realname'])));
}
echo '<li><a href="' . $entryLink . '">' . $entry['realname'] . '</a></li>';
}
echo '</ul>';
}
示例3: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title');
$icon = serendipity_getTemplateFile($this->get_config('iconURL', 'img/xml.gif'));
$custom_feed = trim($this->get_config('feed_name'));
$custom_comm = trim($this->get_config('comment_name'));
$custom_img = trim($this->get_config('big_img'));
if (empty($custom_feed) || $custom_feed == 'default' || $custom_feed == 'none' || $custom_feed == 'empty') {
$FEED = 'feed';
} else {
$FEED = $custom_feed;
}
if (empty($custom_comm) || $custom_comm == 'default' || $custom_comm == 'none' || $custom_comm == 'empty') {
$COMMENTS = COMMENTS;
} else {
$COMMENTS = $custom_comm;
}
if (!empty($custom_img) && $custom_img != 'default' && $custom_img != 'none' && $custom_img != 'empty') {
?>
<div style="padding-bottom: 2px;">
<a class="serendipity_xml_icon" href="<?php
echo serendipity_rewriteURL(PATH_FEEDS . '/index.rss2', 'serendipityHTTPPath');
?>
"><img src="<?php
echo $custom_img;
?>
" alt="XML" style="border: 0px" /></a>
</div>
<?php
}
?>
<ul class="plainList"><?php
if (serendipity_db_bool($this->get_config('show_0.91', true))) {
?>
<li>
<a class="serendipity_xml_icon" href="<?php
echo serendipity_rewriteURL(PATH_FEEDS . '/index.rss', 'serendipityHTTPPath');
?>
"><img src="<?php
echo $icon;
?>
" alt="XML" style="border: 0px" /></a>
<a href="<?php
echo serendipity_rewriteURL(PATH_FEEDS . '/index.rss', 'serendipityHTTPPath');
?>
">RSS 0.91 <?php
echo $FEED;
?>
</a>
</li>
<?php
}
if (serendipity_db_bool($this->get_config('show_1.0', true))) {
?>
<li>
<a class="serendipity_xml_icon" href="<?php
echo serendipity_rewriteURL(PATH_FEEDS . '/index.rss1', 'serendipityHTTPPath');
?>
"><img src="<?php
echo $icon;
?>
" alt="XML" style="border: 0px" /></a>
<a href="<?php
echo serendipity_rewriteURL(PATH_FEEDS . '/index.rss1', 'serendipityHTTPPath');
?>
">RSS 1.0 <?php
echo $FEED;
?>
</a>
</li>
<?php
}
if (serendipity_db_bool($this->get_config('show_2.0', true))) {
?>
<li>
<a class="serendipity_xml_icon" href="<?php
echo serendipity_rewriteURL(PATH_FEEDS . '/index.rss2', 'serendipityHTTPPath');
?>
"><img src="<?php
echo $icon;
?>
" alt="XML" style="border: 0px" /></a>
<a href="<?php
echo serendipity_rewriteURL(PATH_FEEDS . '/index.rss2', 'serendipityHTTPPath');
?>
">RSS 2.0 <?php
echo $FEED;
?>
</a>
</li>
<?php
}
if (serendipity_db_bool($this->get_config('show_atom0.3', true))) {
?>
<li>
<a class="serendipity_xml_icon" href="<?php
echo serendipity_rewriteURL(PATH_FEEDS . '/atom03.xml', 'serendipityHTTPPath');
?>
"><img src="<?php
//.........这里部分代码省略.........
示例4: serendipity_archiveDateUrl
/**
* Create a permalink for an archive date
*
* @access public
* @param string The archive's date
* @param boolean If true, only summary archive
* @param string The base URL/path key
* @return string The permalink
*/
function serendipity_archiveDateUrl($range, $summary = false, $key = 'baseURL')
{
return serendipity_rewriteURL(PATH_ARCHIVES . '/' . $range . ($summary ? '/summary' : '') . '.html', $key);
}
示例5: getArchiveURL
/**
* Smarty Function: Get the URL to the archives-path
*
* @access public
* @return string The archive-path
*/
function getArchiveURL()
{
global $serendipity;
return serendipity_rewriteURL(PATH_ARCHIVES);
}
示例6: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
$ts = mktime(0, 0, 0, date('m'), 1);
$add_query = '';
$category_set = isset($serendipity['GET']['category']);
if ($category_set) {
$base_query = 'C' . (int) $serendipity['GET']['category'];
$add_query = '/' . $base_query;
}
$max_x = $this->get_config('count', 3);
$show_count = serendipity_db_bool($this->get_config('show_count', false));
$hide_zero_count = serendipity_db_bool($this->get_config('hide_zero_count', false));
$freq = $this->get_config('frequency', 'months');
echo '<ul class="plainList">' . "\n";
if ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'sqlite3oo') {
$dist_sql = 'count(e.id) AS orderkey';
} else {
$dist_sql = 'count(DISTINCT e.id) AS orderkey';
}
for ($x = 0; $x < $max_x; $x++) {
$current_ts = $ts;
switch ($freq) {
case 'months':
switch ($serendipity['calendar']) {
default:
case 'gregorian':
$linkStamp = date('Y/m', $ts);
$ts_title = serendipity_formatTime("%B %Y", $ts, false);
$ts = mktime(0, 0, 0, date('m', $ts) - 1, 1, date('Y', $ts));
// Must be last in 'case' statement
break;
case 'persian-utf8':
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
$linkStamp = persian_date_utf('Y/m', $ts);
$ts_title = serendipity_formatTime("%B %Y", $ts, false);
$ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts) - 1, 1, persian_date_utf('Y', $ts));
// Must be last in 'case' statement
break;
}
break;
case 'weeks':
switch ($serendipity['calendar']) {
default:
case 'gregorian':
$linkStamp = date('Y/\\WW', $ts);
$ts_title = WEEK . ' ' . date('W, Y', $ts);
$ts = mktime(0, 0, 0, date('m', $ts), date('d', $ts) - 7, date('Y', $ts));
break;
case 'persian-utf8':
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
$linkStamp = persian_date_utf('Y/\\WW', $ts);
$ts_title = WEEK . ' ' . persian_date_utf('W، Y', $ts);
$ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts), persian_date_utf('d', $ts) - 7, persian_date_utf('Y', $ts));
break;
}
break;
case 'days':
switch ($serendipity['calendar']) {
default:
case 'gregorian':
$linkStamp = date('Y/m/d', $ts);
$ts_title = serendipity_formatTime("%B %e. %Y", $ts, false);
$ts = mktime(0, 0, 0, date('m', $ts), date('d', $ts) - 1, date('Y', $ts));
// Must be last in 'case' statement
break;
case 'persian-utf8':
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
$linkStamp = persian_date_utf('Y/m/d', $ts);
$ts_title = serendipity_formatTime("%e %B %Y", $ts, false);
$ts = persian_mktime(0, 0, 0, persian_date_utf('m', $ts), persian_date_utf('d', $ts) - 1, persian_date_utf('Y', $ts));
// Must be last in 'case' statement
break;
}
break;
}
$link = serendipity_rewriteURL(PATH_ARCHIVES . '/' . $linkStamp . $add_query . '.html', 'serendipityHTTPPath');
$html_count = '';
$hidden_by_zero_count = false;
if ($show_count) {
switch ($freq) {
case 'months':
$end_ts = $current_ts + date('t', $current_ts) * 24 * 60 * 60 - 1;
break;
case 'weeks':
$end_ts = $current_ts + 7 * 24 * 60 * 60 - 1;
break;
case 'days':
$end_ts = $current_ts + 24 * 60 * 60 - 1;
break;
}
$ec = serendipity_fetchEntries(array($current_ts, $end_ts), false, '', false, false, null, '', false, true, $dist_sql, '', 'single', false, $category_set);
if (is_array($ec)) {
if (empty($ec['orderkey'])) {
$ec['orderkey'] = '0';
}
$hidden_by_zero_count = $hide_zero_count && $ec['orderkey'] == '0';
$html_count .= ' (' . $ec['orderkey'] . ')';
}
//.........这里部分代码省略.........
示例7: event_hook
//.........这里部分代码省略.........
}
// Conditions
if (count($conds) > 0) {
$cond = implode(' AND ', $conds);
if (empty($eventData['and'])) {
$eventData['and'] = " WHERE {$cond} ";
} else {
$eventData['and'] .= " AND {$cond} ";
}
}
// Joins
if (count($joins) > 0) {
$cond = implode("\n", $joins);
if (empty($eventData['joins'])) {
$eventData['joins'] = $cond;
} else {
$eventData['joins'] .= $cond;
}
}
// Havings
if (count($havings) > 0) {
$cond = implode(' AND ', $havings);
if (empty($eventData['having'])) {
$eventData['having'] = "HAVING {$cond} ";
} else {
$eventData['having'] .= " AND {$cond} ";
}
}
return true;
break;
// Experimental code: fetch language for entry
// Experimental code: fetch language for entry
case 'frontend_configure':
// TODO: This does not work. The ID is not present! :-()
// $cid = $this->getID(true);
// $serendipity['lang'] = $this->fetchLang($cid, $serendipity['lang']);
return true;
break;
// When the HTML is generated, apply properties
// When the HTML is generated, apply properties
case 'genpage':
// Get the category in question
$cid = $this->getID();
$fc = $this->get_config('fixcat');
if ((string) $fc === 'hard') {
$fc = 'true';
}
if ($cid != 'default' && serendipity_db_bool($fc)) {
// Need this for category_name to be set. (?)
$serendipity['GET']['category'] = $cid;
header('X-FixEntry-Cat: true');
}
// Reset s9y to use the category's properties
$serendipity['fetchLimit'] = $this->fetchLimit($cid, $serendipity['fetchLimit']);
$serendipity['showFutureEntries'] = $this->fetchFuture($cid, $serendipity['showFutureEntries']);
$serendipity['template'] = $this->fetchTemplate($cid, $serendipity['template']);
$this->sort_order = $this->fetchSortOrder($cid, $this->get_config('sort_order'));
// Set the template options
if (!$this->usesDefaultTemplate) {
$serendipity['smarty_vars']['template_option'] = $serendipity['template'] . '_' . $cid;
}
// Check for password
if ($cid != 'default' && serendipity_db_bool($this->get_config('pass')) && $this->fetchProp($cid, 'pass') != '') {
if (!isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_PW'] != $this->fetchProp($cid, 'pass')) {
header('WWW-Authenticate: Basic realm="' . PLUGIN_CATEGORYTEMPLATES_PASS_USER . '"');
header("HTTP/1.0 401 Unauthorized");
header('Status: 401 Unauthorized');
echo PLUGIN_CATEGORYTEMPLATES_PASS_USER;
exit;
} else {
$this->current_pw = $_SERVER['PHP_AUTH_PW'];
}
}
// Set the template stylesheet
$serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('plugin/categorytemplate_' . $cid, 'baseURL', true);
return true;
break;
// When the back end is displayed, use the custom template, too
// When the back end is displayed, use the custom template, too
case 'backend_sidebar_entries_event_display_cattemplate':
if (empty($serendipity['GET']['cat_template'])) {
$serendipity['GET']['cat_template'] = $serendipity['POST']['cat_template'];
}
if (empty($serendipity['GET']['catid'])) {
$serendipity['GET']['catid'] = $serendipity['POST']['catid'];
}
$old = $serendipity['GET']['adminModule'];
$serendipity['GET']['adminModule'] = 'templates';
$this->template_options($serendipity['GET']['cat_template'], $serendipity['GET']['catid']);
$serendipity['GET']['adminModule'] = $old;
return true;
break;
default:
return true;
break;
}
} else {
return false;
}
}
示例8: generateSitemap
//.........这里部分代码省略.........
$path_quoted = preg_quote($serendipity['serendipityHTTPPath'], '#');
$url = $serendipity['baseURL'] . preg_replace("#{$path_quoted}#", '', $cur['value'], 1);
$cur_time = $cur['timestamp'] == 0 ? null : (int) $cur['timestamp'];
$this->addtoxml($sitemap_xml, $url, $cur_time, 0.8);
}
// check for the right order of plugins
$order = serendipity_db_query('SELECT name, sort_order
FROM ' . $serendipity['dbPrefix'] . 'plugins plugins
WHERE plugins.name LIKE \'%serendipity_event_mobile_output%\'
OR plugins.name LIKE \'%serendipity_event_custom_permalinks%\'
ORDER BY plugins.sort_order', false, 'assoc');
if (is_array($order)) {
if (strpos($order[0]['name'], 'serendipity_event_custom_permalinks') === FALSE) {
echo '<br/>' . PLUGIN_EVENT_MOBILE_OUTPUT_SITEMAP_PERMALINK_WARNING . '<br/>';
}
}
}
// fetch categories and their last entry date (tested with: mysql, sqlite, postgres)
$q = 'SELECT
category.categoryid AS id,
category_name,
category_description,
MAX(entries.last_modified) AS last_mod
FROM
' . $serendipity['dbPrefix'] . 'category category,
' . $serendipity['dbPrefix'] . 'entrycat entrycat,
' . $serendipity['dbPrefix'] . 'entries entries
WHERE
category.categoryid = entrycat.categoryid
AND
entrycat.entryid = entries.id
GROUP BY
category.categoryid,
category.category_name,
category.category_description
ORDER BY category.categoryid';
$categories = serendipity_db_query($q, false, 'assoc');
// add categories
if (is_array($categories)) {
foreach ($categories as $category) {
$max = 0 + $category['last_mod'];
/* v0.9 */
if (version_compare((double) $serendipity['version'], '0.9', '>=')) {
$data = array('categoryid' => $category['id'], 'category_name' => $category['category_name'], 'category_description' => $category['category_description']);
$url = serendipity_categoryURL($data);
} else {
$url = serendipity_rewriteURL(PATH_CATEGORIES . '/' . serendipity_makePermalink(PERM_CATEGORIES, array('id' => $category['id'], 'title' => $category['category_name'])));
}
$this->addtoxml($sitemap_xml, $url, $max, 0.4);
}
} else {
$categories = array();
}
// finish the xml
$sitemap_xml .= "</urlset>\n";
$do_gzip = serendipity_db_bool($this->get_config('gzip_sitemap', true));
// decide whether to use gzip-output or not
if ($do_gzip && function_exists('gzencode')) {
$filename = '/mobile_sitemap.xml.gz';
$temp = gzencode($sitemap_xml);
// only use the compressed data and filename if no error occured
if (!($temp === FALSE)) {
$sitemap_xml = $temp;
} else {
$filename = '/mobile_sitemap.xml';
}
} else {
$filename = '/mobile_sitemap.xml';
}
// write result to file
$outfile = fopen($serendipity['serendipityPath'] . $filename, 'w');
if ($outfile === false) {
echo '<strong>' . PLUGIN_EVENT_MOBILE_OUTPUT_SITEMAP_FAILEDOPEN . '</strong>';
return false;
}
flock($outfile, LOCK_EX);
fputs($outfile, $sitemap_xml);
flock($outfile, LOCK_UN);
fclose($outfile);
// Walk through the list of pingback-URLs
foreach (explode(';', $pingback_url) as $cur_pingback_url) {
$pingback_name = PLUGIN_EVENT_MOBILE_OUTPUT_SITEMAP_UNKNOWN_HOST;
$cur_url = sprintf($cur_pingback_url, rawurlencode($serendipity['baseURL'] . $filename));
// extract domain-portion from URL
if (preg_match('@^https?://([^/]+)@', $cur_pingback_url, $matches) > 0) {
$pingback_name = $matches[1];
}
if (!serendipity_db_bool($eventData['isdraft']) && $do_pingback && $cur_url) {
$answer = $this->send_ping($cur_url);
if ($answer) {
printf(PLUGIN_EVENT_MOBILE_OUTPUT_SITEMAP_REPORT_OK, $pingback_name);
} else {
printf(PLUGIN_EVENT_MOBILE_OUTPUT_SITEMAP_REPORT_ERROR, $pingback_name, $cur_url);
}
} else {
printf(PLUGIN_EVENT_MOBILE_OUTPUT_SITEMAP_REPORT_MANUAL, $pingback_name, $cur_url);
}
}
return true;
}
示例9: serendipity_smarty_init
/**
* Initialize the Smarty framework for use in Serendipity
*
* @access public
* @return null
*/
function serendipity_smarty_init($vars = array())
{
global $serendipity, $template_config, $template_global_config, $template_config_groups;
if (!isset($serendipity['smarty'])) {
$template_dir = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'];
if (!defined('IN_serendipity_admin') && file_exists($template_dir . '/template.inc.php')) {
// If this file exists, a custom template engine will be loaded.
// Beware: Smarty is used in the Admin backend, despite of this.
include_once $template_dir . '/template.inc.php';
} else {
// Backend template overwritten here (NOT earlier due to frontend specific check)
if (defined('IN_serendipity_admin')) {
$template_dir = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template_backend'];
}
// Set a session variable if Smarty fails:
$prev_smarty = $_SESSION['no_smarty'];
$_SESSION['no_smarty'] = true;
if (LANG_CHARSET != 'UTF-8') {
@define('SMARTY_MBSTRING', false);
@define('SMARTY_RESOURCE_CHAR_SET', LANG_CHARSET);
}
// define cache resources to load with smarty - see smarty cache readme - needs enabled cache!
#@define('APC_EXTENSION_LOADED', extension_loaded('apc') && ini_get('apc.enabled'));
#@define('MEMCACHE_EXTENSION_LOADED', (class_exists('Memcached',false) || class_exists('Memcache',false)) && (extension_loaded("memcached") || extension_loaded("memcache")));
// Default Smarty Engine will be used
@define('SMARTY_DIR', S9Y_PEAR_PATH . 'Smarty/libs/');
if (!class_exists('Smarty')) {
include_once SMARTY_DIR . 'Smarty.class.php';
}
if (!class_exists('Smarty')) {
return false;
}
// include the serendipity smarty constructor
if (!class_exists('Serendipity_Smarty')) {
include_once S9Y_INCLUDE_PATH . '/include/serendipity_smarty_class.inc.php';
}
if (!class_exists('Serendipity_Smarty')) {
return false;
}
// set smarty instance
#$serendipity['smarty'] = new Serendipity_Smarty;
// initialize smarty object by instance
$serendipity['smarty'] = Serendipity_Smarty::getInstance();
// debug moved to class
// Hooray for Smarty:
$_SESSION['no_smarty'] = $prev_smarty;
// enable security policy by instance of the Smarty_Security class
$serendipity['smarty']->enableSecurity('Serendipity_Smarty_Security_Policy');
// debugging...
#echo '<pre>';print_r($serendipity['smarty']);echo '</pre>';#exit;
#$serendipity['smarty']->testInstall();exit;
// extreme debugging with undocumented internal flag which enables a trace output from the parser during debugging
#$serendipity['smarty']->_parserdebug = true; // be careful!
/**
* ToDo: Check for possible API changes in Smarty 3.2 [smarty_modifier_foobar, --> [smarty_modifier_foobar, smarty_function_foobar, smarty_block_foobar] (in class)]
* smarty_modifier_foobar(Smarty $smarty, $string, ...) vs. smarty_modifier_foobar($string, ...)
**/
$serendipity['smarty']->registerPlugin('modifier', 'makeFilename', 'serendipity_makeFilename');
$serendipity['smarty']->registerPlugin('modifier', 'xhtml_target', 'serendipity_xhtml_target');
$serendipity['smarty']->registerPlugin('modifier', 'emptyPrefix', 'serendipity_emptyPrefix');
$serendipity['smarty']->registerPlugin('modifier', 'formatTime', 'serendipity_smarty_formatTime');
$serendipity['smarty']->registerPlugin('modifier', 'serendipity_utf8_encode', 'serendipity_utf8_encode');
$serendipity['smarty']->registerPlugin('modifier', 'ifRemember', 'serendipity_ifRemember');
$serendipity['smarty']->registerPlugin('modifier', 'checkPermission', 'serendipity_checkPermission');
$serendipity['smarty']->registerPlugin('modifier', 'serendipity_refhookPlugin', 'serendipity_smarty_refhookPlugin');
$serendipity['smarty']->registerPlugin('modifier', 'serendipity_html5time', 'serendipity_smarty_html5time');
$serendipity['smarty']->registerPlugin('modifier', 'rewriteURL', 'serendipity_rewriteURL');
$serendipity['smarty']->registerPlugin('function', 'serendipity_printSidebar', 'serendipity_smarty_printSidebar');
$serendipity['smarty']->registerPlugin('function', 'serendipity_hookPlugin', 'serendipity_smarty_hookPlugin');
$serendipity['smarty']->registerPlugin('function', 'serendipity_showPlugin', 'serendipity_smarty_showPlugin');
$serendipity['smarty']->registerPlugin('function', 'serendipity_getFile', 'serendipity_smarty_getFile');
$serendipity['smarty']->registerPlugin('function', 'serendipity_printComments', 'serendipity_smarty_printComments');
$serendipity['smarty']->registerPlugin('function', 'serendipity_printTrackbacks', 'serendipity_smarty_printTrackbacks');
$serendipity['smarty']->registerPlugin('function', 'serendipity_rss_getguid', 'serendipity_smarty_rss_getguid');
$serendipity['smarty']->registerPlugin('function', 'serendipity_fetchPrintEntries', 'serendipity_smarty_fetchPrintEntries');
$serendipity['smarty']->registerPlugin('function', 'serendipity_getTotalCount', 'serendipity_smarty_getTotalCount');
$serendipity['smarty']->registerPlugin('function', 'pickKey', 'serendipity_smarty_pickKey');
$serendipity['smarty']->registerPlugin('function', 'serendipity_showCommentForm', 'serendipity_smarty_showCommentForm');
$serendipity['smarty']->registerPlugin('function', 'serendipity_getImageSize', 'serendipity_smarty_getImageSize');
$serendipity['smarty']->registerPlugin('function', 'serendipity_getConfigVar', 'serendipity_smarty_getConfigVar');
$serendipity['smarty']->registerPlugin('function', 'serendipity_setFormToken', 'serendipity_smarty_setFormToken');
$serendipity['smarty']->registerFilter('pre', 'serendipity_replaceSmartyVars');
}
if (!isset($serendipity['smarty_file'])) {
$serendipity['smarty_file'] = 'index.tpl';
}
$category = false;
$category_info = array();
if (isset($serendipity['GET']['category'])) {
$category = (int) $serendipity['GET']['category'];
if (isset($GLOBALS['cInfo'])) {
$category_info = $GLOBALS['cInfo'];
} else {
$category_info = serendipity_fetchCategoryInfo($category);
//.........这里部分代码省略.........
示例10: generate_button
function generate_button($txtarea, $return_output)
{
global $serendipity;
if (!isset($txtarea)) {
$txtarea = 'body';
}
$link = serendipity_rewriteURL('plugin/amazonch') . ($serendipity['rewrite'] != 'none' ? '?' : '&') . 'txtarea=' . $txtarea;
$open = $serendipity['version'][0] > '1' ? 'serendipity.openPopup' : 'window.open';
if ($return_output) {
if ($serendipity['version'][0] > '1') {
$button = '<input type="button" class="input_button" name="insAmazonImage" value="' . PLUGIN_EVENT_AMAZONCHOOSER_MEDIA_BUTTON . '" style="" onclick="' . $open . '(\'' . $link . "&simple=1" . '\', \'AmazonImageSel\', \'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1\');">';
} else {
$button = '<input type="button" class="serendipityPrettyButton input_button" name="insAmazonImage" value="' . PLUGIN_EVENT_AMAZONCHOOSER_MEDIA_BUTTON . '" style="" onclick="' . $open . '(\'' . $link . "&simple=1" . '\', \'AmazonImageSel\', \'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1\');" />';
}
return $button;
} else {
if ($serendipity['version'][0] > '1') {
$button = '<input type="button" class="input_button" name="insAmazonImage" value="' . PLUGIN_EVENT_AMAZONCHOOSER_MEDIA_BUTTON . '" style="" onclick="' . $open . '(\'' . $link . '\', \'AmazonImageSel\', \'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1\');">';
} else {
$button = '<input type="button" class="serendipityPrettyButton input_button" name="insAmazonImage" value="' . PLUGIN_EVENT_AMAZONCHOOSER_MEDIA_BUTTON . '" style="" onclick="' . $open . '(\'' . $link . '\', \'AmazonImageSel\', \'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1\');" />';
}
echo $button;
}
}
示例11: generate_content
/**
* Creates a DHTML menu of serendipity categories.
*
* The menu is echoed out.
*
* @param string $title (Serves as the top level menu item if present)
* @return void
* @see http://pear.php.net/HTML_TreeMenu PEAR::HTML_TreeMenu
*/
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
// may want to put this in bundled_libs or a sub directory of this directory
$pear = false;
if (@(include_once 'HTML/TreeMenu.php')) {
$pear = true;
} elseif (@(include_once 'HTML_TreeMenu/TreeMenu.php')) {
$pear = true;
}
if ($pear) {
$which_category = $this->get_config('authorid');
// build an accessible array of categories
foreach (serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category) as $cat) {
if (!is_array($cat) || !isset($cat['categoryid'])) {
continue;
}
$categories[$cat['categoryid']] = $cat;
}
// create an array of numbers of entries per category
$cat_count = array();
if (serendipity_db_bool($this->get_config('show_count'))) {
$cat_sql = "SELECT c.categoryid, c.category_name, count(e.id) as postings\n FROM {$serendipity['dbPrefix']}entrycat ec,\n {$serendipity['dbPrefix']}category c,\n {$serendipity['dbPrefix']}entries e\n WHERE ec.categoryid = c.categoryid\n AND ec.entryid = e.id\n AND e.isdraft = 'false'\n " . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND e.timestamp <= " . serendipity_db_time() : '') . "\n GROUP BY c.categoryid, c.category_name\n ORDER BY postings DESC";
$category_rows = serendipity_db_query($cat_sql);
if (is_array($category_rows)) {
foreach ($category_rows as $cat) {
$cat_count[$cat['categoryid']] = $cat['postings'];
}
}
}
$image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
$image = $image == "'none'" || $image == 'none' ? '' : $image;
// create nodes
foreach ($categories as $cid => $cat) {
if (function_exists('serendipity_categoryURL')) {
$link = serendipity_categoryURL($cat, 'serendipityHTTPPath');
} else {
$link = serendipity_rewriteURL(PATH_CATEGORIES . '/' . serendipity_makePermalink(PERM_CATEGORIES, array('id' => $cat['categoryid'], 'title' => $cat['category_name'])), 'serendipityHTTPPath');
}
if (!empty($cat_count[$cat['categoryid']])) {
// $categories[$cid]['true_category_name'] = $cat['category_name'];
$cat['category_name'] .= ' (' . $cat_count[$cat['categoryid']] . ')';
// $categories[$cid]['article_count'] = $cat_count[$cat['categoryid']];
}
if (!empty($image)) {
$feedURL = serendipity_feedCategoryURL($cat, 'serendipityHTTPPath');
$feed = '<a class="serendipity_xml_icon" href="' . $feedURL . '"><img src="' . $image . '" alt="XML" style="border: 0px;vertical-align:middle"/></a> ';
$link = '<a href="' . $link . '" target="_self"><span>' . $cat['category_name'] . '</span></a>';
// work around a problem in HTML_TreeNode: when there is a href in 'text', 'link' is not converted to a link.
$cat_nodes[$cat['categoryid']] = new HTML_TreeNode(array('text' => $feed . $link));
} else {
$cat_nodes[$cat['categoryid']] = new HTML_TreeNode(array('text' => $feed . $cat['category_name'], 'link' => $link));
}
}
// create a top level for "all categories"
// this serves as the title
$cat_nodes[0] = new HTML_TreeNode(array('text' => ALL_CATEGORIES, 'link' => $serendipity['baseURL']));
// nest nodes (thanks to PHP references)
foreach ($categories as $category) {
$cat_nodes[$category['parentid']]->addItem($cat_nodes[$category['categoryid']]);
}
// nest the "all categories" category
$menu = new HTML_TreeMenu();
$menu->addItem($cat_nodes[0]);
$tree = new HTML_TreeMenu_DHTML($menu, array('images' => $serendipity['baseURL'] . $this->get_config('image_path')));
// Add heading for block
#$output = '<h2 class="serendipitySideBarTitle" style="font-weight: bold;">'.$title.'</h2><br />';
// Put inside a div with "overflow:hidden" to avoid items of the sidebar plugin running outside the blog
// Maybe we can put a config setting to choose if the block should be displayed with or without overflow setting.
$output .= '<div style="overflow: hidden;">';
$output .= $tree->toHTML();
$output .= '</div>';
echo '<script type="text/javascript" src="' . $serendipity['baseURL'] . $this->get_config('script_path') . '"></script>';
} else {
$output .= "Please install PEAR package HTML_TreeMenu to enable this plugin.";
}
echo $output;
}
示例12: write_sitemap
function write_sitemap($basefilename = 'sitemap.xml', &$eventData, $gnewsmode = false)
{
global $serendipity;
// start the xml
$sitemap_xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$sitemap_xml .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n";
$sitemap_xml .= "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
if ($gnewsmode) {
$sitemap_xml .= "\txmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\"\n";
}
$sitemap_xml .= "\txsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\n";
$sitemap_xml .= "\t\t\thttp://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\" ";
$sitemap_xml .= $this->get_config('custom2');
$sitemap_xml .= ">\n";
$this->gnewsmode = false;
// If this variable is enabled, each XML article will get its gnews:... counterpart.
// This is NOT desired in the usual sitemap!
if ($gnewsmode) {
$this->gnewsmode = true;
} elseif (serendipity_db_bool($this->get_config('gnews_single')) && serendipity_db_bool($this->get_config('gnews'))) {
$this->gnewsmode = true;
}
// add link to the main page
$this->addtoxml($sitemap_xml, $serendipity['baseURL'], time(), 0.6);
if (!$gnewsmode) {
$this->add_entries($sitemap_xml);
if ($this->should_add('sm_permalinks')) {
$this->add_permalinks($sitemap_xml);
}
if ($this->should_add('sm_categories')) {
$this->add_categories($sitemap_xml);
}
if ($this->should_add('sm_authors')) {
$this->add_authors($sitemap_xml);
}
if ($this->should_add('sm_archives')) {
$this->add_archives($sitemap_xml);
// add link to archive-mainpage
$this->addtoxml($sitemap_xml, serendipity_rewriteURL(PATH_ARCHIVE), time(), 0.5);
}
if ($this->should_add('sm_feeds')) {
$this->add_feeds($sitemap_xml);
}
if ($this->should_add('sm_static')) {
$this->add_static($sitemap_xml);
}
if ($this->should_add('sm_tags')) {
$this->add_tags($sitemap_xml);
}
} else {
$this->add_entries($sitemap_xml, 900);
}
$sitemap_xml .= $this->get_config('custom');
// finish the xml
$sitemap_xml .= "</urlset>\n";
$do_gzip = serendipity_db_bool($this->get_config('gzip_sitemap', true));
// decide whether to use gzip-output or not
if ($do_gzip && function_exists('gzencode')) {
$filename = '/' . $basefilename . '.gz';
$temp = gzencode($sitemap_xml);
// only use the compressed data and filename if no error occured
if (!($temp === FALSE)) {
$sitemap_xml = $temp;
} else {
$filename = '/' . $basefilename;
}
} else {
$filename = '/' . $basefilename;
}
// write result to file
$outfile = fopen($serendipity['serendipityPath'] . $filename, 'w');
if ($outfile === false) {
echo '<strong>' . PLUGIN_EVENT_SITEMAP_FAILEDOPEN . ' (' . $serendipity['serendipityPath'] . $filename . ')</strong>';
return false;
}
flock($outfile, LOCK_EX);
fputs($outfile, $sitemap_xml);
flock($outfile, LOCK_UN);
fclose($outfile);
$do_pingback = serendipity_db_bool($this->get_config('report', false));
$pingback_url = $this->get_config('url', false);
// Walk through the list of pingback-URLs
echo $basefilename . ':<br />';
foreach (explode(';', $pingback_url) as $cur_pingback_url) {
$pingback_name = PLUGIN_EVENT_SITEMAP_UNKNOWN_HOST;
$cur_url = sprintf($cur_pingback_url, rawurlencode($serendipity['baseURL'] . $filename));
// extract domain-portion from URL
if (preg_match('@^https?://([^/]+)@', $cur_pingback_url, $matches) > 0) {
$pingback_name = $matches[1];
}
if (!serendipity_db_bool($eventData['isdraft']) && $do_pingback && $cur_url) {
$answer = $this->send_ping($cur_url);
if ($answer) {
printf(PLUGIN_EVENT_SITEMAP_REPORT_OK, $pingback_name);
} else {
printf(PLUGIN_EVENT_SITEMAP_REPORT_ERROR, $pingback_name, $cur_url);
}
} else {
printf(PLUGIN_EVENT_SITEMAP_REPORT_MANUAL, $pingback_name, $cur_url);
}
//.........这里部分代码省略.........
示例13: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
if ($event == 'frontend_header') {
$start_url = $serendipity['baseURL'];
$start_title = $serendipity['blogTitle'];
echo '<link rel="start" href="' . $start_url . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($start_title) : htmlspecialchars($start_title, ENT_COMPAT, LANG_CHARSET)) . '" />' . "\n";
if ($serendipity['GET']['action'] == 'read' && !empty($serendipity['GET']['id'])) {
// Article detail view
echo '<link rel="up" href="' . $start_url . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($start_title) : htmlspecialchars($start_title, ENT_COMPAT, LANG_CHARSET)) . '" />' . "\n";
$this->backAndForth($this->showPaging($serendipity['GET']['id']));
// END article detail view
echo '<link rel="canonical" href="' . $this->getEntry($serendipity['GET']['id']) . '" />' . "\n";
} elseif ($serendipity['GET']['action'] == 'read' && is_array($serendipity['range'])) {
// Specific Date Archives view
echo '<link rel="up" href="' . serendipity_rewriteURL(PATH_ARCHIVE) . '" title="' . ARCHIVES . '" />' . "\n";
echo '<link rel="canonical" href="' . $this->getArchiveParameters() . '" />' . "\n";
$links = array();
$add_query = '';
$year = date('Y', $serendipity['range'][0]);
$month = date('m', $serendipity['range'][0]);
$day = date('d', $serendipity['range'][0]);
$pageMonthNext = array('day' => '1', 'month' => $month + 1, 'year' => $year);
$pageMonthPrev = array('day' => '1', 'month' => $month - 1, 'year' => $year);
$pageDayNext = array('day' => $day + 1, 'month' => $month, 'year' => $year);
$pageDayPrev = array('day' => $day - 1, 'month' => $month, 'year' => $year);
$diff = $serendipity['range'][1] - $serendipity['range'][0];
if (isset($serendipity['GET']['category'])) {
$categoryid = (int) serendipity_db_escape_string($serendipity['GET']['category']);
$add_query = '/C' . $categoryid;
}
if ($diff < 86400) {
// Paging day by day
$ts = mktime(0, 0, 0, $pageDayPrev['month'], $pageDayPrev['day'], $pageDayPrev['year']);
$links['prev'] = array('link' => serendipity_archiveDateUrl(sprintf('%4d/%02d/%02d', date('Y', $ts), date('m', $ts), date('d', $ts))), 'title' => sprintf(ENTRIES_FOR, serendipity_formatTime(DATE_FORMAT_ENTRY, $ts, false)));
$ts = mktime(0, 0, 0, $pageDayNext['month'], $pageDayNext['day'], $pageDayNext['year']);
$links['next'] = array('link' => serendipity_archiveDateUrl(sprintf('%4d/%02d/%02d', date('Y', $ts), date('m', $ts), date('d', $ts))), 'title' => sprintf(ENTRIES_FOR, serendipity_formatTime(DATE_FORMAT_ENTRY, $ts, false)));
} elseif ($diff < 86400 * 28) {
// Paging by week
// TODO - Don't know :-)
} else {
// Paging by month
$ts = mktime(0, 0, 0, $pageMonthPrev['month'], $pageMonthPrev['day'], $pageMonthPrev['year']);
$links['prev'] = array('link' => serendipity_archiveDateUrl(sprintf('%4d/%02d', date('Y', $ts), date('m', $ts))), 'title' => sprintf(ENTRIES_FOR, serendipity_formatTime('%B %Y', $ts, false)));
$ts = mktime(0, 0, 0, $pageMonthNext['month'], $pageMonthNext['day'], $pageMonthNext['year']);
$links['next'] = array('link' => serendipity_archiveDateUrl(sprintf('%4d/%02d', date('Y', $ts), date('m', $ts))), 'title' => sprintf(ENTRIES_FOR, serendipity_formatTime('%B %Y', $ts, false)));
}
$this->backAndForth($links);
// END Specific Date Archives view
} elseif ($serendipity['GET']['action'] == 'archives') {
// Full month/year archives overview
echo '<link rel="up" href="' . serendipity_rewriteURL(PATH_ARCHIVE) . '" title="' . ARCHIVES . '" />' . "\n";
// END Full month/year archives overview
echo '<link rel="canonical" href="' . $this->getArchiveParameters() . '" />' . "\n";
} elseif (!empty($serendipity['GET']['category'])) {
// Category based view
$cInfo = serendipity_fetchCategoryInfo($serendipity['GET']['category']);
if (function_exists('serendipity_categoryURL')) {
$categories_url = serendipity_categoryURL($cInfo, 'serendipityHTTPPath');
} else {
$categories_url = serendipity_rewriteURL(PATH_CATEGORIES . '/' . serendipity_makePermalink(PERM_CATEGORIES, array('id' => $cInfo['categoryid'], 'title' => $cInfo['category_name'])), 'serendipityHTTPPath');
}
echo '<link rel="up" href="' . $categories_url . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($cInfo['category_name']) : htmlspecialchars($cInfo['category_name'], ENT_COMPAT, LANG_CHARSET)) . '" />' . "\n";
echo '<link rel="canonical" href="' . $categories_url . '" />' . "\n";
$categories = serendipity_fetchCategories('all');
$links = array();
if (is_array($categories) && count($categories)) {
$categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
$capture_next = false;
foreach ($categories as $cat) {
if ($capture_next) {
$links['next'] = $this->getCat($cat);
break;
}
if (is_array($prev_cat) && $cat['categoryid'] == $serendipity['GET']['category']) {
$links['prev'] = $this->getCat($prev_cat);
$capture_next = true;
}
$prev_cat = $cat;
}
}
$this->backAndForth($links);
// END Category based view
} elseif (!empty($serendipity['GET']['viewAuthor'])) {
// User view
$uInfo = serendipity_fetchUsers();
$links = array();
if (is_array($uInfo)) {
$capture_next = false;
foreach ($uInfo as $user) {
if ($capture_next) {
$links['next'] = $this->getUser($user);
break;
}
if ($user['authorid'] == $serendipity['GET']['viewAuthor']) {
$authors_url = $this->getUser($user);
echo '<link rel="up" href="' . $authors_url['link'] . '" title="' . $authors_url['title'] . '" />' . "\n";
echo '<link rel="canonical" href="' . $authors_url['link'] . '" />' . "\n";
if (is_array($prev_user)) {
$links['prev'] = $this->getUser($prev_user);
//.........这里部分代码省略.........
示例14: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
$current_cat = $serendipity['GET']['category'];
$current_page = $serendipity['GET']['page'];
$current_auth = $serendipity['GET']['viewAuthor'];
$current_rng = $serendipity['range'];
$serendipity['GET']['page'] = 0;
unset($serendipity['GET']['viewAuthor']);
unset($serendipity['range']);
$c = $this->get_config('category');
if ($c > 0) {
$serendipity['GET']['category'] = (int) $c;
}
$showtitle = serendipity_db_bool($this->get_config('showtitle'));
$showext = serendipity_db_bool($this->get_config('showext'));
if (serendipity_db_bool($this->get_config('skip'))) {
$limit = serendipity_db_limit($serendipity['fetchLimit'], $this->get_config('number'));
} else {
$limit = serendipity_db_limit(0, $this->get_config('number'));
}
$entries = serendipity_fetchEntries(null, true, $limit, false, false, 'timestamp DESC', '', false, true);
if (is_array($entries)) {
foreach ($entries as $i => $entry) {
serendipity_plugin_api::hook_event('frontend_display', $entry);
/* Pulled from serendipity_printEntries */
$entry['link'] = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
$entry['commURL'] = serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', false, array('timestamp' => $entry['timestamp']));
$entry['rdf_ident'] = serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp']));
$entry['title'] = function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['title']) : htmlspecialchars($entry['title'], ENT_COMPAT, LANG_CHARSET);
$entry['link_allow_comments'] = $serendipity['baseURL'] . 'comment.php?serendipity[switch]=enable&serendipity[entry]=' . $entry['id'];
$entry['link_deny_comments'] = $serendipity['baseURL'] . 'comment.php?serendipity[switch]=disable&serendipity[entry]=' . $entry['id'];
$entry['allow_comments'] = serendipity_db_bool($entry['allow_comments']);
$entry['moderate_comments'] = serendipity_db_bool($entry['moderate_comments']);
$entry['link_popup_comments'] = $serendipity['serendipityHTTPPath'] . 'comment.php?serendipity[entry_id]=' . $entry['id'] . '&serendipity[type]=comments';
$entry['link_popup_trackbacks'] = $serendipity['serendipityHTTPPath'] . 'comment.php?serendipity[entry_id]=' . $entry['id'] . '&serendipity[type]=trackbacks';
$entry['link_edit'] = $serendipity['baseURL'] . 'serendipity_admin.php?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=edit&serendipity[id]=' . $entry['id'];
$entry['link_trackback'] = $serendipity['baseURL'] . 'comment.php?type=trackback&entry_id=' . $entry['id'];
$entry['link_rdf'] = serendipity_rewriteURL(PATH_FEEDS . '/ei_' . $entry['id'] . '.rdf');
$entry['link_viewmode_threaded'] = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?url=' . $entry['commURL'] . '&serendipity[cview]=' . VIEWMODE_THREADED;
$entry['link_viewmode_linear'] = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?url=' . $entry['commURL'] . '&serendipity[cview]=' . VIEWMODE_LINEAR;
if ($_SESSION['serendipityAuthedUser'] === true && ($_SESSION['serendipityAuthorid'] == $entry['authorid'] || serendipity_checkPermission('adminEntriesMaintainOthers'))) {
$entry['is_entry_owner'] = true;
}
if (is_array($entry['categories'])) {
foreach ($entry['categories'] as $k => $v) {
$entry['categories'][$k]['category_link'] = serendipity_categoryURL($entry['categories'][$k]);
}
}
$entries[$i] = $entry;
}
}
$serendipity['smarty']->assign(array('showtitle' => $showtitle, 'showext' => $showext, 'entries' => $entries));
$tfile = serendipity_getTemplateFile('plugin_showentries.tpl', 'serendipityPath');
if (!$tfile) {
$tfile = dirname(__FILE__) . '/plugin_showentries.tpl';
}
$inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY];
$serendipity['smarty']->security_settings[INCLUDE_ANY] = true;
$content = $serendipity['smarty']->fetch('file:' . $tfile);
$serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion;
echo $content;
$serendipity['GET']['category'] = $current_cat;
$serendipity['GET']['page'] = $current_page;
$serendipity['GET']['viewAuthor'] = $current_auth;
$serendipity['range'] = $current_rng;
}
示例15: showFeeds
//.........这里部分代码省略.........
<input type="hidden" name="serendipity[adminAction]" value="aggregator" />
</div>';
if ($serendipity['version'][0] == '1') {
echo '<table align="center" width="100%" cellpadding="5" cellspacing="0" border=0>';
} else {
echo '<table>';
}
echo '
<thead>
<tr>
<th>#</th>
<th>' . PLUGIN_AGGREGATOR_FEEDNAME . '</th>
<th>' . PLUGIN_AGGREGATOR_FEEDURI . ' / ' . PLUGIN_AGGREGATOR_HTMLURI . '</th>
<th>' . PLUGIN_AGGREGATOR_CATEGORIES . '</th>
<th>' . PLUGIN_AGGREGATOR_MATCH_EXPRESSION . '* / ' . PLUGIN_AGGREGATOR_FEEDICON . '</th>
</tr>
</thead>
<tbody>';
$evenidx = 0;
foreach ($feeds as $idx => $feed) {
$cat = $this->fetchCat("serendipity[feed][{$feed['feedid']}][categoryids][]", $feed['categoryids']);
$even = $evenidx++ % 2 ? 'even' : 'uneven';
echo '
<tr style="padding: 10px;" class="serendipity_admin_list_item serendipity_admin_list_item_' . $even . '">
<td valign="top"><em>' . $idx . '</em></td>
<td valign="top">
<input class="input_textbox" type="text" name="serendipity[feed][' . $feed['feedid'] . '][feedname]" value="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($feed['feedname']) : htmlspecialchars($feed['feedname'], ENT_COMPAT, LANG_CHARSET)) . '" /> ' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($feed['charset']) : htmlspecialchars($feed['charset'], ENT_COMPAT, LANG_CHARSET)) . '
</td>
<td width="100%" valign="top">
<input class="input_textbox" style="width: 100%" type="text" name="serendipity[feed][' . $feed['feedid'] . '][feedurl]" value="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($feed['feedurl']) : htmlspecialchars($feed['feedurl'], ENT_COMPAT, LANG_CHARSET)) . '" />
<input class="input_textbox" style="width: 65%; margin-top: 2px;" type="text" name="serendipity[feed][' . $feed['feedid'] . '][htmlurl]" value="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($feed['htmlurl']) : htmlspecialchars($feed['htmlurl'], ENT_COMPAT, LANG_CHARSET)) . '" />
</td>
<td valign="top" rowspan="2">' . $cat . '</td>
<td valign="top" rowspan="2"><textarea rows=6 cols=25 name="serendipity[feed][' . $feed['feedid'] . '][match_expression]">' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($feed['match_expression']) : htmlspecialchars($feed['match_expression'], ENT_COMPAT, LANG_CHARSET)) . '</textarea><br />
<input class="input_textbox" style="width: 65%; margin-top: 2px;" type="text" name="serendipity[feed][' . $feed['feedid'] . '][feedicon]" value="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($feed['feedicon']) : htmlspecialchars($feed['feedicon'], ENT_COMPAT, LANG_CHARSET)) . '" />
</tr>
<tr style="padding: 10px;" class="serendipity_admin_list_item serendipity_admin_list_item_' . $even . '">
<td></td>
<td colspan="2" valign="top">
<div style="font-size: 8pt;">' . PLUGIN_AGGREGATOR_FEEDUPDATE . ' ' . serendipity_formatTime(DATE_FORMAT_SHORT, $feed['last_update']) . '</div>
</td>
</tr>';
}
echo '
<tr>
<td colspan="4"><br />
<input type="submit" name="serendipity[aggregatorAction]" value="' . GO . '" class="serendipityPrettyButton input_button" />
</td>
</tr>
</tbody>
</table>
* ' . PLUGIN_AGGREGATOR_MATCH_EXPRESSION_DESC . '
</form>';
echo '
<form action="?" method="post">
<div>
<input type="hidden" name="serendipity[adminModule]" value="event_display" />
<input type="hidden" name="serendipity[adminAction]" value="aggregator" />
</div>';
if ($serendipity['version'][0] == '1') {
echo '
<div>
<hr /><strong>
' . PLUGIN_AGGREGATOR_IMPORTFEEDLIST . '</strong><br /><br />
' . PLUGIN_AGGREGATOR_IMPORTFEEDLIST_DESC . '<br /><br />
URL: <input class="input_textbox" type="text" name="serendipity[aggregatorOPML]" value="http://" /><br />
<input class="input_checkbox" type="checkbox" id="import_categories" name="serendipity[aggregatorOPMLCategories]" value="true" /><label for="import_categories">' . PLUGIN_AGGREGATOR_IMPORTCATEGORIES . '</label>
<input class="input_checkbox" type="checkbox" id="import_categories2" name="serendipity[aggregatorOPMLCategoriesNoNesting]" value="true" /><label for="import_categories2">' . PLUGIN_AGGREGATOR_IMPORTCATEGORIES2 . '</label>
<br /><br />
<input type="submit" name="serendipity[aggregatorOPMLImport]" value="' . PLUGIN_AGGREGATOR_IMPORTFEEDLIST_BUTTON . '" class="serendipityPrettyButton input_button" />
</div>';
} else {
echo '
<h3>' . PLUGIN_AGGREGATOR_IMPORTFEEDLIST . '</h3>
<span class="msg_hint"><span class="icon-help-circled"></span> ' . PLUGIN_AGGREGATOR_IMPORTFEEDLIST_DESC . '</span>
<div class="form_field">
<label for="serendipity_aggregator_opml">URL</label>
<input id="serendipity_aggregator_opml" type="text" name="serendipity[aggregatorOPML]" value="http://">
</div>
<div class="form_check">
<input type="checkbox" id="import_categories" name="serendipity[aggregatorOPMLCategories]" value="true"><label for="import_categories">' . PLUGIN_AGGREGATOR_IMPORTCATEGORIES . '</label>
<input type="checkbox" id="import_categories2" name="serendipity[aggregatorOPMLCategoriesNoNesting]" value="true"><label for="import_categories2">' . PLUGIN_AGGREGATOR_IMPORTCATEGORIES2 . '</label>
</div>';
}
if ($serendipity['version'][0] == '1') {
echo '
<div>
<hr /><strong>
' . PLUGIN_AGGREGATOR_EXPORTFEEDLIST . '</strong><br /><br />
<a href="' . serendipity_rewriteURL('plugin/opmlfeeds.xml') . '" class="serendipityPrettyButton">' . PLUGIN_AGGREGATOR_EXPORTFEEDLIST_BUTTON . '</a>
</div>
</form>';
} else {
echo '
<h3>' . PLUGIN_AGGREGATOR_EXPORTFEEDLIST . '</h3>
<a class="button_link" href="' . serendipity_rewriteURL('plugin/opmlfeeds.xml') . '"><span class="icon-rss"></span> ' . PLUGIN_AGGREGATOR_EXPORTFEEDLIST_BUTTON . '</a>
</form>';
}
}