本文整理汇总了PHP中SYND_getFeedUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP SYND_getFeedUrl函数的具体用法?PHP SYND_getFeedUrl怎么用?PHP SYND_getFeedUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SYND_getFeedUrl函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _ff_getImage
$subscribelinkimg = '<img src="' . _ff_getImage('forumnotify_off') . '" alt="' . $LANG_GF01['FORUMUNSUBSCRIBE'] . '" title="' . $LANG_GF01['FORUMUNSUBSCRIBE'] . '" style="vertical-align:middle;"/>';
$subscribelink = $_CONF['site_url'] . '/forum/notify.php?filter=2';
$subcribelanguage = $LANG_GF01['FORUMUNSUBSCRIBE'];
$sub_option = 'unsubscribe_forum';
$formsubscribed = TRUE;
}
$token = SEC_createToken();
$topiclisting->set_var(array('subscribelink' => $subscribelink, 'subscribelinkimg' => $subscribelinkimg, 'forumsubscribed' => $forumsubscribed, 'LANG_subscribe' => $subcribelanguage, 'forum' => $forum, 'suboption' => $sub_option, 'token' => $token, 'token_name' => CSRF_TOKEN));
}
if (!COM_isAnonUser()) {
$link = '<a href="' . $_CONF['site_url'] . '/forum/index.php?op=markallread&cat_id=' . $category['id'] . '&forum_id=' . (int) $forum . '">';
$topiclisting->set_var(array('markreadurl' => $_CONF['site_url'] . '/forum/index.php?op=markallread&cat_id=' . $category['id'] . '&forum_id=' . (int) $forum, 'markreadlink' => $link, 'LANG_markread' => $LANG_GF02['msg84']));
}
$rssFeed = DB_getItem($_TABLES['syndication'], 'filename', 'type="forum" AND topic=' . (int) $forum . ' AND is_enabled=1');
if (($rssFeed != '' || $rssFeed != NULL) && $skipForum == false) {
$baseurl = SYND_getFeedUrl();
$imgurl = '<img src="' . _ff_getImage('rss_feed') . '" alt="' . $LANG_GF01['rss_link'] . '" title="' . $LANG_GF01['rss_link'] . '" style="vertical-align:middle;"/>';
$topiclisting->set_var('rssfeed', '<a href="' . $baseurl . $rssFeed . '">' . $imgurl . '</a>');
$topiclisting->set_var('rssfeed_url', $baseurl . $rssFeed);
} else {
$topiclisting->set_var('rssfeed', '');
}
$topiclisting->set_var(array('cat_name' => $category['cat_name'], 'cat_id' => $category['id'], 'forum_name' => $category['forum_name'], 'forum_id' => $forum, 'LANG_TOPIC' => $LANG_GF01['TOPICSUBJECT'], 'LANG_STARTEDBY' => $LANG_GF01['STARTEDBY'], 'LANG_REPLIES' => $LANG_GF01['REPLIES'], 'LANG_VIEWS' => $LANG_GF01['VIEWS'], 'LANG_LASTPOST' => $LANG_GF01['LASTPOST'], 'LANG_AUTHOR' => $LANG_GF01['AUTHOR'], 'LANG_MSG05' => $LANG_GF01['LASTPOST'], 'LANG_newforumposts' => $LANG_GF02['msg113']));
if ($canPost && $skipForum == false) {
$topiclisting->set_var(array('LANG_newtopic' => $LANG_GF01['NEWTOPIC'], 'newtopiclinkimg' => '<img src="' . _ff_getImage('post_newtopic') . '" style="vertical-align:middle;" alt="' . $LANG_GF01['NEWTOPIC'] . '" title="' . $LANG_GF01['NEWTOPIC'] . '"/>', 'newtopiclink' => $_CONF['site_url'] . '/forum/createtopic.php?mode=newtopic&forum=' . $forum));
}
$bmArray = array();
if (!COM_isAnonUser() && $skipForum == false) {
$sql = "SELECT * FROM {$_TABLES['ff_bookmarks']} WHERE uid=" . (int) $uid;
$result = DB_query($sql);
while (($bm = DB_fetchArray($result)) != NULL) {
示例2: plugin_getiteminfo_story
//.........这里部分代码省略.........
$fields = array_unique($fields);
if (count($fields) == 0) {
$retval = array();
return $retval;
}
// prepare SQL request
if ($sid == '*') {
$where = ' WHERE';
} else {
$where = " WHERE (sid = '" . DB_escapeString($sid) . "') AND";
}
$where .= ' (draft_flag = 0) AND (date <= NOW())';
if ($uid > 0) {
$permSql = COM_getPermSql('AND', $uid) . " AND ta.type = 'article' AND ta.id = sid AND ta.tdefault = 1 " . COM_getTopicSql('AND', $uid, 'ta');
} else {
$permSql = COM_getPermSql('AND') . " AND ta.type = 'article' AND ta.id = sid AND ta.tdefault = 1 " . COM_getTopicSql('AND', 0, 'ta');
}
$sql = "SELECT " . implode(',', $fields) . " FROM {$_TABLES['stories']}, {$_TABLES['topic_assignments']} ta" . $where . $permSql;
if ($sid != '*') {
$sql .= ' LIMIT 1';
}
$result = DB_query($sql);
$numRows = DB_numRows($result);
$retval = array();
for ($i = 0; $i < $numRows; $i++) {
$A = DB_fetchArray($result);
$props = array();
foreach ($properties as $p) {
switch ($p) {
case 'date-created':
$props['date-created'] = $A['unixdate'];
break;
case 'date-modified':
$props['date-modified'] = $A['unixdate'];
break;
case 'description':
$props['description'] = trim(PLG_replaceTags(stripslashes($A['introtext']) . ' ' . stripslashes($A['bodytext'])));
break;
case 'excerpt':
$excerpt = stripslashes($A['introtext']);
if (!empty($A['bodytext'])) {
$excerpt .= "\n\n" . stripslashes($A['bodytext']);
}
$props['excerpt'] = trim(PLG_replaceTags($excerpt));
break;
case 'feed':
$feedfile = DB_getItem($_TABLES['syndication'], 'filename', "topic = '::all'");
if (empty($feedfile)) {
$feedfile = DB_getItem($_TABLES['syndication'], 'filename', "topic = '::frontpage'");
}
if (empty($feedfile)) {
$feedfile = DB_getItem($_TABLES['syndication'], 'filename', "topic = '{$A['tid']}'");
}
if (empty($feedfile)) {
$props['feed'] = '';
} else {
$props['feed'] = SYND_getFeedUrl($feedfile);
}
break;
case 'id':
$props['id'] = $A['sid'];
break;
case 'title':
$props['title'] = stripslashes($A['title']);
break;
case 'url':
if (empty($A['sid'])) {
$props['url'] = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
} else {
$props['url'] = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']);
}
break;
default:
// return empty string for unknown properties
$props[$p] = '';
break;
}
}
$mapped = array();
foreach ($props as $key => $value) {
if ($sid == '*') {
if ($value != '') {
$mapped[$key] = $value;
}
} else {
$mapped[] = $value;
}
}
if ($sid == '*') {
$retval[] = $mapped;
} else {
$retval = $mapped;
break;
}
}
if ($sid != '*' && count($retval) == 1) {
$retval = $retval[0];
}
return $retval;
}
示例3: EVLIST_getFeedIcons
/**
* Get the feed subscription urls & icons.
* This returns a ready-to-display set of icons for visitors
* to subscribe to RSS feeds
*
* @return string HTML for icons
*/
function EVLIST_getFeedIcons()
{
global $_CONF, $_EV_CONF, $_TABLES;
$retval = '';
// Anon access required for feed access anyway
if ($_EV_CONF['allow_anon_view'] != 1) {
return $retval;
}
// Get the feed info for configured feeds
$result = DB_query("SELECT title, filename \n FROM {$_TABLES['syndication']}\n WHERE type='" . DB_escapeString($_EV_CONF['pi_name']) . "'");
if (DB_numRows($result) > 0) {
$T = new Template(EVLIST_PI_PATH . '/templates/');
$T->set_file('feed', 'rss_icon.thtml');
$feed_url = SYND_getFeedUrl();
while ($A = DB_fetchArray($result, false)) {
$T->set_var(array('feed_title' => $A['title'], 'feed_url' => $feed_url . $A['filename']));
$T->parse('output', 'feed', true);
}
$retval = $T->finish($T->get_var('output'));
}
return $retval;
}
示例4: COM_siteHeader
//.........这里部分代码省略.........
if (!empty($_CONF['frame_options'])) {
header('X-FRAME-OPTIONS: ' . $_CONF['frame_options']);
}
$header = COM_newTemplate($_CONF['path_layout']);
$header->set_file(array('header' => 'header.thtml', 'menuitem' => 'menuitem.thtml', 'menuitem_last' => 'menuitem_last.thtml', 'menuitem_none' => 'menuitem_none.thtml', 'leftblocks' => 'leftblocks.thtml', 'rightblocks' => 'rightblocks.thtml'));
$header->postprocess_fn = 'PLG_replaceTags';
$header->set_var('doctype', $doctype);
if (XHTML == '') {
$header->set_var('xmlns', '');
} else {
$header->set_var('xmlns', ' xmlns="http://www.w3.org/1999/xhtml"');
}
// get topic if not on home page
if (!isset($_GET['topic'])) {
if (isset($_GET['story'])) {
$sid = COM_applyFilter($_GET['story']);
} elseif (isset($_GET['sid'])) {
$sid = COM_applyFilter($_GET['sid']);
} elseif (isset($_POST['story'])) {
$sid = COM_applyFilter($_POST['story']);
}
if (empty($sid) && $_CONF['url_rewrite'] && strpos($_SERVER['PHP_SELF'], 'article.php') !== false) {
COM_setArgNames(array('story', 'mode'));
$sid = COM_applyFilter(COM_getArgument('story'));
}
if (!empty($sid)) {
$topic = DB_getItem($_TABLES['stories'], 'tid', "sid='{$sid}'");
}
} else {
$topic = COM_applyFilter($_GET['topic']);
}
$feed_url = array();
if ($_CONF['backend'] == 1) {
$baseurl = SYND_getFeedUrl();
$sql = 'SELECT format, filename, title, language FROM ' . $_TABLES['syndication'] . " WHERE (header_tid = 'all')";
if (!empty($topic)) {
$sql .= " OR (header_tid = '" . addslashes($topic) . "')";
}
$result = DB_query($sql);
$numRows = DB_numRows($result);
for ($i = 0; $i < $numRows; $i++) {
$A = DB_fetchArray($result);
if (!empty($A['filename'])) {
$format_type = SYND_getMimeType($A['format']);
$format_name = SYND_getFeedType($A['format']);
$feed_title = $format_name . ' Feed: ' . $A['title'];
$feed_url[] = '<link rel="alternate" type="' . $format_type . '" hreflang="' . $A['language'] . '" href="' . $baseurl . $A['filename'] . '" title="' . htmlspecialchars($feed_title) . '"' . XHTML . '>';
}
}
}
$header->set_var('feed_url', implode(LB, $feed_url));
// for backward compatibility only - use {feed_url} instead
$feed = SYND_getDefaultFeedUrl();
$header->set_var('rdf_file', $feed);
$header->set_var('rss_url', $feed);
$relLinks = array();
if (COM_onFrontpage()) {
$relLinks['canonical'] = '<link rel="canonical" href="' . $_CONF['site_url'] . '/"' . XHTML . '>';
} else {
$relLinks['home'] = '<link rel="home" href="' . $_CONF['site_url'] . '/" title="' . $LANG01[90] . '"' . XHTML . '>';
}
$loggedInUser = !COM_isAnonUser();
if ($loggedInUser || $_CONF['loginrequired'] == 0 && $_CONF['searchloginrequired'] == 0) {
if (substr($_SERVER['PHP_SELF'], -strlen('/search.php')) != '/search.php' || isset($_GET['mode'])) {
$relLinks['search'] = '<link rel="search" href="' . $_CONF['site_url'] . '/search.php" title="' . $LANG01[75] . '"' . XHTML . '>';
}
示例5: ADMIN_getListField_syndication
/**
* used for the list of feeds in admin/syndication.php
*
* @param string $fieldName
* @param string $fieldValue
* @param array $A
* @param array $icon_arr
* @param string $token
* @return string
*/
function ADMIN_getListField_syndication($fieldName, $fieldValue, $A, $icon_arr, $token)
{
global $_CONF, $_TABLES, $LANG_ADMIN, $LANG33;
switch ($fieldName) {
case 'edit':
$retval = COM_createLink($icon_arr['edit'], "{$_CONF['site_admin_url']}/syndication.php?mode=edit&fid={$A['fid']}");
break;
case 'type':
if ($A['type'] === 'article') {
$retval = $LANG33[55];
} else {
$retval = ucwords($A['type']);
}
break;
case 'format':
$retval = str_replace('-', ' ', ucwords($A['format']));
break;
case 'updated':
if ($A['is_enabled'] == 1) {
$retval = strftime($_CONF['daytime'], $A['date']);
} else {
$retval = $LANG_ADMIN['na'];
}
break;
case 'is_enabled':
if ($A['is_enabled'] == 1) {
$switch = ' checked="checked"';
} else {
$switch = '';
}
$retval = '<input type="checkbox" name="enabledfeeds[]" onclick="submit()" value="' . $A['fid'] . '"' . $switch . XHTML . '>' . '<input type="hidden" name="visiblefeeds[]" value="' . $A['fid'] . '"' . XHTML . '>';
break;
case 'header_tid':
if ($A['header_tid'] === 'all') {
$retval = $LANG33[43];
} elseif ($A['header_tid'] === 'none') {
$retval = $LANG33[44];
} else {
$retval = DB_getItem($_TABLES['topics'], 'topic', "tid = '{$A['header_tid']}'");
}
break;
case 'filename':
$url = SYND_getFeedUrl();
$retval = COM_createLink($A['filename'], $url . $A['filename']);
break;
default:
$retval = $fieldValue;
break;
}
return $retval;
}
示例6: COM_createHTMLDocument
//.........这里部分代码省略.........
break;
case 'xhtml10strict':
$doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
break;
case 'html5':
case 'xhtml5':
$doctype = '<!DOCTYPE html>';
break;
default:
// fallback: HTML 4.01 Transitional w/o system identifier
$doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
break;
}
// send out the charset header
header('Content-Type: text/html; charset=' . COM_getCharset());
if (!empty($_CONF['frame_options'])) {
header('X-FRAME-OPTIONS: ' . $_CONF['frame_options']);
}
$header = COM_newTemplate($_CONF['path_layout']);
$header->set_file(array('header' => 'header.thtml', 'menunavigation' => 'menunavigation.thtml', 'leftblocks' => 'leftblocks.thtml', 'rightblocks' => 'rightblocks.thtml'));
$blocks = array('menuitem', 'menuitem_last', 'menuitem_none');
foreach ($blocks as $block) {
$header->set_block('menunavigation', $block);
}
$header->parse('menu_elements', 'menunavigation', true);
$header->set_var('doctype', $doctype . LB);
if (XHTML == '') {
$header->set_var('xmlns', '');
} else {
$header->set_var('xmlns', ' xmlns="http://www.w3.org/1999/xhtml"');
}
$feed_url = array();
if ($_CONF['backend'] == 1) {
$baseurl = SYND_getFeedUrl();
$sql = 'SELECT format, filename, title, language FROM ' . $_TABLES['syndication'] . " WHERE (header_tid = 'all')";
if (!empty($topic)) {
$sql .= " OR (header_tid = '" . DB_escapeString($topic) . "')";
}
$result = DB_query($sql);
$numRows = DB_numRows($result);
for ($i = 0; $i < $numRows; $i++) {
$A = DB_fetchArray($result);
if (!empty($A['filename'])) {
$format_type = SYND_getMimeType($A['format']);
$format_name = SYND_getFeedType($A['format']);
$feed_title = $format_name . ' Feed: ' . $A['title'];
$feed_url[] = '<link rel="alternate" type="' . $format_type . '" hreflang="' . $A['language'] . '" href="' . $baseurl . $A['filename'] . '" title="' . htmlspecialchars($feed_title) . '"' . XHTML . '>';
}
}
}
$header->set_var('feed_url', implode(LB, $feed_url));
// for backward compatibility only - use {feed_url} instead
$feed = SYND_getDefaultFeedUrl();
if (COM_onFrontpage()) {
$relLinks['canonical'] = '<link rel="canonical" href="' . $_CONF['site_url'] . '/"' . XHTML . '>';
} else {
$relLinks['home'] = '<link rel="home" href="' . $_CONF['site_url'] . '/" title="' . $LANG01[90] . '"' . XHTML . '>';
}
$loggedInUser = !COM_isAnonUser();
if ($loggedInUser || $_CONF['loginrequired'] == 0 && $_CONF['searchloginrequired'] == 0) {
if (substr($_SERVER['PHP_SELF'], -strlen('/search.php')) != '/search.php' || isset($_GET['mode'])) {
$relLinks['search'] = '<link rel="search" href="' . $_CONF['site_url'] . '/search.php" title="' . $LANG01[75] . '"' . XHTML . '>';
}
}
if ($loggedInUser || $_CONF['loginrequired'] == 0 && $_CONF['directoryloginrequired'] == 0) {
if (strpos($_SERVER['PHP_SELF'], '/article.php') !== false) {
示例7: COM_buildUrl
$story_template->set_var('lang_email_story_alt', $LANG01[64]);
}
$printUrl = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $story->getSid() . '&mode=print');
if ($_CONF['hideprintericon'] == 0) {
$story_options[] = COM_createLink($LANG11[3], $printUrl, array('rel' => 'nofollow'));
$story_template->set_var('print_story_url', $printUrl);
$story_template->set_var('lang_print_story', $LANG11[3]);
$story_template->set_var('lang_print_story_alt', $LANG01[65]);
}
if ($_CONF['backend'] == 1) {
$tid = $story->displayElements('tid');
$result = DB_query("SELECT filename, title, format FROM {$_TABLES['syndication']} WHERE type = 'article' AND topic = '{$tid}' AND is_enabled = 1");
$feeds = DB_numRows($result);
for ($i = 0; $i < $feeds; $i++) {
list($filename, $title, $format) = DB_fetchArray($result);
$feedUrl = SYND_getFeedUrl($filename);
$feedTitle = sprintf($LANG11[6], $title);
$feedType = SYND_getMimeType($format);
$feedClass = 'feed-link';
if (!empty($LANG_DIRECTION) && $LANG_DIRECTION == 'rtl') {
$feedClass .= '-rtl';
}
$story_options[] = COM_createLink($feedTitle, $feedUrl, array('type' => $feedType, 'class' => $feedClass));
}
}
if (($_CONF['trackback_enabled'] || $_CONF['pingback_enabled'] || $_CONF['ping_enabled']) && SEC_hasRights('story.ping') && $story->displayElements('draft_flag') == 0 && $story->displayElements('day') < time() && $story->displayElements('perm_anon') != 0) {
// also check permissions for the topic
$topic_anon = DB_getItem($_TABLES['topics'], 'perm_anon', "tid = '" . addslashes($story->displayElements('tid')) . "'");
// check special case: no link when Trackbacks are disabled for this
// story AND pinging weblog directories is disabled
if ($topic_anon != 0 && ($story->displayElements('trackbackcode') >= 0 || $_CONF['ping_enabled'])) {
示例8: MG_buildFullRSS
function MG_buildFullRSS()
{
global $LANG_CHARSET, $MG_albums, $_MG_CONF, $_CONF, $_TABLES;
$feedpath = MG_getFeedPath();
if ($_MG_CONF['rss_full_enabled'] != 1) {
@unlink($feedpath . '/' . $_MG_CONF['rss_feed_name'] . '.rss');
return;
}
$rss = new UniversalFeedCreator();
$rss->title = $_CONF['site_name'] . ' Media Gallery RSS Feed';
$rss->description = $_CONF['site_slogan'];
$rss->descriptionTruncSize = 500;
$rss->descriptionHtmlSyndicated = true;
$rss->encoding = strtoupper($_CONF['default_charset']);
$rss->link = $_CONF['site_url'];
$feedurl = SYND_getFeedUrl();
$rss->syndicationURL = $feedurl . $_MG_CONF['rss_feed_name'] . '.rss';
MG_parseAlbumsRSS($rss, 0);
$rss->saveFeed($_MG_CONF['rss_feed_type'], $feedpath . "/" . $_MG_CONF['rss_feed_name'] . '.rss', 0);
@chmod($feedpath . '/' . $_MG_CONF['rss_feed_name'] . '.rss', 0664);
return;
}
示例9: FEED_getListField
/**
* get field data for the feed list administration
*
*/
function FEED_getListField($fieldname, $fieldvalue, $A, $icon_arr, $token)
{
global $_CONF, $_USER, $_TABLES, $LANG_ADMIN, $LANG33, $_IMAGE_TYPE;
$retval = '';
$enabled = $A['is_enabled'] == 1 ? true : false;
$dt = new Date('now', $_USER['tzid']);
switch ($fieldname) {
case 'edit':
$attr['title'] = $LANG_ADMIN['edit'];
$retval = COM_createLink($icon_arr['edit'], $_CONF['site_admin_url'] . '/syndication.php?edit=x&fid=' . $A['fid'], $attr);
break;
case 'delete':
$attr['title'] = $LANG_ADMIN['delete'];
$attr['onclick'] = 'return confirm(\'' . $LANG33[56] . '\');"';
$retval = COM_createLink($icon_arr['delete'], $_CONF['site_admin_url'] . '/syndication.php?delete=x&fid=' . $A['fid'] . '&' . CSRF_TOKEN . '=' . $token, $attr);
break;
case 'type':
if ($A['type'] == 'article') {
$type = $LANG33[55];
} else {
$type = ucwords($A['type']);
}
$retval = $enabled ? $type : '<span class="disabledfield">' . $type . '</span>';
break;
case 'format':
$format = str_replace('-', ' ', ucwords($A['format']));
$retval = $enabled ? $format : '<span class="disabledfield">' . $format . '</span>';
break;
case 'updated':
$dt->setTimeStamp($A['date']);
$datetime = $dt->format($_CONF['daytime'], true);
$retval = $enabled ? $datetime : '<span class="disabledfield">' . $datetime . '</span>';
break;
case 'is_enabled':
if ($enabled) {
$switch = ' checked="checked"';
$title = 'title="' . $LANG_ADMIN['disable'] . '" ';
} else {
$title = 'title="' . $LANG_ADMIN['enable'] . '" ';
$switch = '';
}
$switch = $enabled ? ' checked="checked"' : '';
$retval = '<input type="checkbox" name="enabledfeeds[' . $A['fid'] . ']" ' . $title . 'onclick="submit()" value="' . $A['fid'] . '"' . $switch . '/>';
$retval .= '<input type="hidden" name="feedarray[' . $A['fid'] . ']" value="1" ' . '/>';
break;
case 'header_tid':
if ($A['header_tid'] == 'all') {
$tid = $LANG33[43];
} elseif ($A['header_tid'] == 'none') {
$tid = $LANG33[44];
} else {
$tid = DB_getItem($_TABLES['topics'], 'topic', "tid = '" . DB_escapeString($A['header_tid']) . "'");
}
$retval = $enabled ? $tid : '<span class="disabledfield">' . $tid . '</span>';
break;
case 'filename':
if ($enabled) {
$url = SYND_getFeedUrl();
$attr['title'] = $A['description'];
$retval = COM_createLink($A['filename'], $url . $A['filename'], $attr);
} else {
$retval = '<span class="disabledfield">' . $A['filename'] . '</span>';
}
break;
default:
$retval = $enabled ? $fieldvalue : '<span class="disabledfield">' . $fieldvalue . '</span>';
break;
}
return $retval;
}
示例10: SYND_updateFeed
/**
* Update a feed.
* Re-written by Michael Jervis (mike AT fuckingbrit DOT com)
* to use the new architecture
*
* @param int $fid feed id
*
*/
function SYND_updateFeed($fid)
{
global $_CONF, $_TABLES, $_SYND_DEBUG;
SYND_fixCharset($fid);
$result = DB_query("SELECT * FROM {$_TABLES['syndication']} WHERE fid = {$fid}");
$A = DB_fetchArray($result);
if ($A['is_enabled'] == 1) {
// Import the feed handling classes:
require_once $_CONF['path_system'] . '/classes/syndication/parserfactory.class.php';
require_once $_CONF['path_system'] . '/classes/syndication/feedparserbase.class.php';
// Load the actual feed handlers:
$factory = new FeedParserFactory($_CONF['path_system'] . '/classes/syndication/');
$format = explode('-', $A['format']);
$feed = $factory->writer($format[0], $format[1]);
if ($feed) {
$feed->encoding = $A['charset'];
$feed->lang = $A['language'];
if ($A['type'] == 'article') {
if ($A['topic'] == '::all') {
$content = SYND_getFeedContentAll(false, $A['limits'], $link, $data, $A['content_length'], $format[0], $format[1], $fid);
} elseif ($A['topic'] == '::frontpage') {
$content = SYND_getFeedContentAll(true, $A['limits'], $link, $data, $A['content_length'], $format[0], $format[1], $fid);
} else {
// feed for a single topic only
$content = SYND_getFeedContentPerTopic($A['topic'], $A['limits'], $link, $data, $A['content_length'], $format[0], $format[1], $fid);
}
} else {
$content = PLG_getFeedContent($A['type'], $fid, $link, $data, $format[0], $format[1]);
// can't randomly change the api to send a max length, so
// fix it here:
if ($A['content_length'] != 1) {
$count = count($content);
for ($i = 0; $i < $count; $i++) {
$content[$i]['summary'] = $A['content_length'] == 1 ? $content[$i]['text'] : COM_truncateHTML($content[$i]['text'], $A['content_length'], ' ...');
}
}
}
if (empty($link)) {
$link = $_CONF['site_url'];
}
$feed->title = $A['title'];
$feed->description = $A['description'];
if (empty($A['feedlogo'])) {
$feed->feedlogo = '';
} else {
$feed->feedlogo = $_CONF['site_url'] . $A['feedlogo'];
}
$feed->sitelink = $link;
$feed->copyright = 'Copyright ' . strftime('%Y') . ' ' . $_CONF['site_name'];
$feed->sitecontact = $_CONF['site_mail'];
$feed->system = 'Geeklog';
/* Gather any other stuff */
$feed->namespaces = array_merge($feed->namespaces, PLG_getFeedNSExtensions($A['type'], $format[0], $format[1], $A['topic'], $fid));
/* If the feed is RSS, and trackback is enabled */
if ($_CONF['trackback_enabled'] && $format[0] == 'RSS') {
/* Check to see if an article has trackbacks enabled, and if
* at least one does, then include the trackback namespace:
*/
$trackbackenabled = false;
foreach ($content as $item) {
if (array_key_exists('extensions', $item) && array_key_exists('trackbacktag', $item['extensions'])) {
// Found at least one article, with a trackbacktag
// in it's extensions tag.
$trackbackenabled = true;
break;
}
}
if ($trackbackenabled) {
$feed->namespaces[] = 'xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"';
}
}
/* Inject the namespace for Atom into RSS feeds. Illogical?
* Well apparantly not:
* http://feedvalidator.org/docs/warning/MissingAtomSelfLink.html
*/
if ($format[0] == 'RSS') {
$feed->namespaces[] = 'xmlns:atom="http://www.w3.org/2005/Atom"';
}
if (!empty($A['filename'])) {
$filename = $A['filename'];
} else {
$pos = strrpos($_CONF['rdf_file'], '/');
$filename = substr($_CONF['rdf_file'], $pos + 1);
}
$feed->url = SYND_getFeedUrl($filename);
$feed->extensions = PLG_getFeedExtensionTags($A['type'], $format[0], $format[1], $A['topic'], $fid, $feed);
/* Inject the self reference for Atom into RSS feeds. Illogical?
* Well apparantly not:
* http://feedvalidator.org/docs/warning/MissingAtomSelfLink.html
*/
if ($format[0] == 'RSS') {
$feed->extensions[] = '<atom:link href="' . $feed->url . '" rel="self" type="application/rss+xml" />';
//.........这里部分代码省略.........
示例11: ADMIN_getListField_syndication
/**
* used for the list of feeds in admin/syndication.php
*
*/
function ADMIN_getListField_syndication($fieldname, $fieldvalue, $A, $icon_arr, $token)
{
global $_CONF, $_TABLES, $LANG_ADMIN, $LANG33, $_IMAGE_TYPE;
static $added_token;
$retval = '';
switch ($fieldname) {
case 'edit':
$retval = COM_createLink($icon_arr['edit'], "{$_CONF['site_admin_url']}/syndication.php?mode=edit&fid={$A['fid']}");
break;
case 'type':
if ($A['type'] == 'article') {
$retval = $LANG33[55];
} else {
$retval = ucwords($A['type']);
}
break;
case 'format':
$retval = str_replace('-', ' ', ucwords($A['format']));
break;
case 'updated':
$retval = strftime($_CONF['daytime'], $A['date']);
break;
case 'is_enabled':
if ($A['is_enabled'] == 1) {
$switch = ' checked="checked"';
} else {
$switch = '';
}
$retval = "<input type=\"checkbox\" name=\"enabledfeeds[]\" " . "onclick=\"submit()\" value=\"{$A['fid']}\"{$switch}" . XHTML . ">";
if (!isset($added_token)) {
$retval .= "<input type=\"hidden\" name=\"" . CSRF_TOKEN . "\" value=\"{$token}\"" . XHTML . ">";
$added_token = true;
}
break;
case 'header_tid':
if ($A['header_tid'] == 'all') {
$retval = $LANG33[43];
} elseif ($A['header_tid'] == 'none') {
$retval = $LANG33[44];
} else {
$retval = DB_getItem($_TABLES['topics'], 'topic', "tid = '{$A['header_tid']}'");
}
break;
case 'filename':
$url = SYND_getFeedUrl();
$retval = COM_createLink($A['filename'], $url . $A['filename']);
break;
default:
$retval = $fieldvalue;
break;
}
return $retval;
}
示例12: COM_siteHeader
//.........这里部分代码省略.........
}
SESS_setVar('cacheID', $cacheID);
}
// give the theme a chance to load stuff....
$function = $_USER['theme'] . '_headerVars';
if (function_exists($function)) {
$function($header);
}
// get topic if not on home page
if (!isset($_GET['topic'])) {
if (isset($_GET['story'])) {
$sid = COM_applyFilter($_GET['story']);
} elseif (isset($_GET['sid'])) {
$sid = COM_applyFilter($_GET['sid']);
} elseif (isset($_POST['story'])) {
$sid = COM_applyFilter($_POST['story']);
}
if (empty($sid) && $_CONF['url_rewrite'] && strpos($_SERVER['PHP_SELF'], 'article.php') !== false) {
COM_setArgNames(array('story', 'mode'));
$sid = COM_applyFilter(COM_getArgument('story'));
}
if (!empty($sid)) {
$topic = DB_getItem($_TABLES['stories'], 'tid', "sid='" . DB_escapeString($sid) . "'");
}
} else {
$topic = COM_applyFilter($_GET['topic']);
}
$feed_url = array();
if ($_CONF['backend'] == 1) {
// add feed-link to header if applicable
if (SESS_isSet('feedurl')) {
$feed_url = unserialize(SESS_getVar('feedurl'));
} else {
$baseurl = SYND_getFeedUrl();
$sql = 'SELECT format, filename, title, language FROM ' . $_TABLES['syndication'] . " WHERE (header_tid = 'all')";
if (!empty($topic)) {
$sql .= " OR (header_tid = '" . DB_escapeString($topic) . "')";
}
$result = DB_query($sql);
$numRows = DB_numRows($result);
for ($i = 0; $i < $numRows; $i++) {
$A = DB_fetchArray($result);
if (!empty($A['filename'])) {
$format = explode('-', $A['format']);
$format_type = strtolower($format[0]);
$format_name = ucwords($format[0]);
$feed_url[] = '<link rel="alternate" type="application/' . $format_type . '+xml"' . ' href="' . $baseurl . $A['filename'] . '" title="' . $format_name . ' Feed: ' . $A['title'] . '"/>';
}
}
SESS_setVar('feedurl', serialize($feed_url));
}
}
$header->set_var('feed_url', implode(LB, $feed_url));
$relLinks = array();
if (!COM_onFrontpage()) {
$relLinks['home'] = '<link rel="home" href="' . $_CONF['site_url'] . '/" title="' . $LANG01[90] . '"/>';
} else {
CMT_updateCommentcodes();
}
$loggedInUser = !COM_isAnonUser();
if ($loggedInUser || $_CONF['loginrequired'] == 0 && $_CONF['searchloginrequired'] == 0) {
if (substr($_SERVER['PHP_SELF'], -strlen('/search.php')) != '/search.php' || isset($_GET['mode'])) {
$relLinks['search'] = '<link rel="search" href="' . $_CONF['site_url'] . '/search.php" title="' . $LANG01[75] . '"/>';
}
}
if ($loggedInUser || $_CONF['loginrequired'] == 0 && $_CONF['directoryloginrequired'] == 0) {
示例13: STORY_getItemInfo
//.........这里部分代码省略.........
}
$where .= ' (date <= NOW())';
if ($uid > 0) {
$permSql = COM_getPermSql('AND', $uid) . COM_getTopicSql('AND', $uid);
} else {
$permSql = COM_getPermSql('AND') . COM_getTopicSql('AND');
}
$sql = "SELECT " . implode(',', $fields) . " FROM {$_TABLES['stories']}" . $where . $permSql;
if ($sid != '*') {
$sql .= ' LIMIT 1';
}
$result = DB_query($sql);
$numRows = DB_numRows($result);
$retval = array();
for ($i = 0; $i < $numRows; $i++) {
$A = DB_fetchArray($result);
$props = array();
foreach ($properties as $p) {
switch ($p) {
case 'date-created':
$props['date-created'] = $A['unixdate'];
break;
case 'description':
$props['description'] = trim(PLG_replaceTags($A['introtext'] . ' ' . $A['bodytext'], 'glfusion', 'story'));
break;
case 'raw-description':
$props['raw-description'] = trim($A['introtext'] . ' ' . $A['bodytext']);
break;
case 'excerpt':
$excerpt = $A['introtext'];
$props['excerpt'] = trim(PLG_replaceTags($excerpt, 'glfusion', 'story'));
break;
case 'feed':
$feedfile = DB_getItem($_TABLES['syndication'], 'filename', "topic = '::all'");
if (empty($feedfile)) {
$feedfile = DB_getItem($_TABLES['syndication'], 'filename', "topic = '::frontpage'");
}
if (empty($feedfile)) {
$feedfile = DB_getItem($_TABLES['syndication'], 'filename', "topic = '{$A['tid']}'");
}
if (empty($feedfile)) {
$props['feed'] = '';
} else {
$props['feed'] = SYND_getFeedUrl($feedfile);
}
break;
case 'id':
$props['id'] = $A['sid'];
break;
case 'title':
$props['title'] = $A['title'];
break;
case 'url':
if (empty($A['sid'])) {
$props['url'] = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $sid);
} else {
$props['url'] = COM_buildUrl($_CONF['site_url'] . '/article.php?story=' . $A['sid']);
}
break;
case 'label':
$props['label'] = $LANG09[65];
break;
case 'status':
if ($A['draft_flag'] == 0) {
$props['status'] = 1;
} else {
$props['status'] = 0;
}
break;
case 'author':
$props['author'] = $A['uid'];
break;
default:
$props[$p] = '';
break;
}
}
$mapped = array();
foreach ($props as $key => $value) {
if ($sid == '*') {
if ($value != '') {
$mapped[$key] = $value;
}
} else {
$mapped[$key] = $value;
}
}
if ($sid == '*') {
$retval[] = $mapped;
} else {
$retval = $mapped;
break;
}
}
if ($sid != '*' && count($retval) == 1) {
$tRet = array_values($retval);
$retval = $tRet[0];
}
return $retval;
}
示例14: SYND_updateFeed
/**
* Update a feed.
*
* @param int $fid feed id
*
*/
function SYND_updateFeed($fid)
{
global $_CONF, $_TABLES, $_SYND_DEBUG;
require_once $_CONF['path'] . '/lib/feedcreator/feedcreator.class.php';
$result = DB_query("SELECT * FROM {$_TABLES['syndication']} WHERE fid = '" . DB_escapeString($fid) . "'");
$A = DB_fetchArray($result);
if ($A['is_enabled'] == 1) {
$format = explode('-', $A['format']);
$rss = new UniversalFeedCreator();
if ($A['content_length'] > 1) {
$rss->descriptionTruncSize = $A['content_length'];
}
$rss->descriptionHtmlSyndicated = false;
$rss->encoding = $A['charset'];
$rss->language = $A['language'];
$rss->title = $A['title'];
$rss->description = $A['description'];
$imgurl = '';
if ($A['feedlogo'] != '') {
$image = new FeedImage();
$image->title = $A['title'];
$image->url = $_CONF['site_url'] . $A['feedlogo'];
$image->link = $_CONF['site_url'];
$rss->image = $image;
}
$rss->link = $_CONF['site_url'];
if (!empty($A['filename'])) {
$filename = $A['filename'];
} else {
$pos = strrpos($_CONF['rdf_file'], '/');
$filename = substr($_CONF['rdf_file'], $pos + 1);
}
$rss->syndicationURL = SYND_getFeedUrl($filename);
$rss->copyright = 'Copyright ' . strftime('%Y') . ' ' . $_CONF['site_name'];
if ($A['type'] == 'article') {
if ($A['topic'] == '::all') {
$content = SYND_getFeedContentAll(false, $A['limits'], $link, $data, $A['content_length'], $format[0], $format[1], $fid);
} elseif ($A['topic'] == '::frontpage') {
$content = SYND_getFeedContentAll(true, $A['limits'], $link, $data, $A['content_length'], $format[0], $format[1], $fid);
} else {
// feed for a single topic only
$content = SYND_getFeedContentPerTopic($A['topic'], $A['limits'], $link, $data, $A['content_length'], $format[0], $format[1], $fid);
}
} else {
$content = PLG_getFeedContent($A['type'], $fid, $link, $data, $format[0], $format[1]);
}
if (is_array($content)) {
foreach ($content as $feedItem) {
$item = new FeedItem();
foreach ($feedItem as $var => $value) {
if ($var == 'date') {
$dt = new Date($value, $_CONF['timezone']);
$item->date = $dt->toISO8601(true);
} else {
if ($var == 'summary') {
$item->description = $value;
} else {
if ($var == 'link') {
$item->guid = $value;
$item->{$var} = $value;
} else {
$item->{$var} = $value;
}
}
}
}
$rss->addItem($item);
}
}
if (empty($link)) {
$link = $_CONF['site_url'];
}
$rss->editor = $_CONF['site_mail'];
$rc = $rss->saveFeed($format[0] . '-' . $format[1], SYND_getFeedPath($filename), 0);
if (empty($data)) {
$data = 'NULL';
} else {
$data = "'" . $data . "'";
}
if ($_SYND_DEBUG) {
COM_errorLog("update_info for feed {$fid} is {$data}", 1);
}
DB_query("UPDATE {$_TABLES['syndication']} SET updated = NOW(), update_info = {$data} WHERE fid = '" . DB_escapeString($fid) . "'");
}
}