[geeklog-cvs] geeklog: Moved implementation detail about how the URL for {rdf_...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Feb 14 15:16:34 EST 2010
changeset 7720:3139bebcb54b
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/3139bebcb54b
user: Dirk Haun <dirk at haun-online.de>
date: Sun Feb 14 19:14:37 2010 +0100
description:
Moved implementation detail about how the URL for {rdf_file} / {rss_url} is derived to lib-syndication.php
diffstat:
public_html/lib-common.php | 17 +++++++++--------
system/lib-syndication.php | 26 +++++++++++++++++++++++++-
2 files changed, 34 insertions(+), 9 deletions(-)
diffs (82 lines):
diff -r ebc12aefb879 -r 3139bebcb54b public_html/lib-common.php
--- a/public_html/lib-common.php Tue Feb 09 15:30:58 2010 -0500
+++ b/public_html/lib-common.php Sun Feb 14 19:14:37 2010 +0100
@@ -961,6 +961,11 @@
}
$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="'
@@ -1048,10 +1053,6 @@
$header->set_var( 'site_mail', "mailto:{$_CONF['site_mail']}" );
$header->set_var( 'site_name', $_CONF['site_name'] );
$header->set_var( 'site_slogan', $_CONF['site_slogan'] );
- $rdf = substr_replace( $_CONF['rdf_file'], $_CONF['site_url'], 0,
- strlen( $_CONF['path_html'] ) - 1 );
- $header->set_var( 'rdf_file', $rdf );
- $header->set_var( 'rss_url', $rdf );
$msg = rtrim($LANG01[67]) . ' ' . $_CONF['site_name'];
@@ -1354,10 +1355,10 @@
$footer->set_var( 'site_mail', "mailto:{$_CONF['site_mail']}" );
$footer->set_var( 'site_name', $_CONF['site_name'] );
$footer->set_var( 'site_slogan', $_CONF['site_slogan'] );
- $rdf = substr_replace( $_CONF['rdf_file'], $_CONF['site_url'], 0,
- strlen( $_CONF['path_html'] ) - 1 );
- $footer->set_var( 'rdf_file', $rdf );
- $footer->set_var( 'rss_url', $rdf );
+
+ $feed = SYND_getDefaultFeedUrl();
+ $footer->set_var('rdf_file', $feed);
+ $footer->set_var('rss_url', $feed);
$year = date( 'Y' );
$copyrightyear = $year;
diff -r ebc12aefb879 -r 3139bebcb54b system/lib-syndication.php
--- a/system/lib-syndication.php Tue Feb 09 15:30:58 2010 -0500
+++ b/system/lib-syndication.php Sun Feb 14 19:14:37 2010 +0100
@@ -8,7 +8,7 @@
// | |
// | Geeklog syndication library. |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2003-2009 by the following authors: |
+// | Copyright (C) 2003-2010 by the following authors: |
// | |
// | Authors: Dirk Haun - dirk AT haun-online DOT de |
// | Michael Jervis - mike AT fuckingbrit DOT com |
@@ -699,4 +699,28 @@
return 'application/' . $type . '+xml';
}
+/**
+* Helper function: Get default feed URL
+*
+* This is mostly for backward compatibility: Back in the dark ages, Geeklog
+* only had one RSS feed and its URL was available as a template variable.
+* Moved that code here from COM_siteHeader/Footer for better encapsulation.
+*
+* @return string URL of the feed
+*
+*/
+function SYND_getDefaultFeedUrl()
+{
+ global $_CONF;
+
+ $feed = '';
+
+ if ($_CONF['backend'] > 0) {
+ $feed = substr_replace($_CONF['rdf_file'], $_CONF['site_url'], 0,
+ strlen($_CONF['path_html']) - 1);
+ }
+
+ return $feed;
+}
+
?>
More information about the geeklog-cvs
mailing list