[geeklog-cvs] geeklog: Moved implementation detail about how the feed format n...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Feb 14 15:16:34 EST 2010
changeset 7721:1bb30e1994fa
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/1bb30e1994fa
user: Dirk Haun <dirk at haun-online.de>
date: Sun Feb 14 19:37:36 2010 +0100
description:
Moved implementation detail about how the feed format name is derived to lib-syndication.php (and use already existing SYND_getMimeType function)
diffstat:
public_html/lib-common.php | 16 ++++++++--------
system/lib-syndication.php | 14 ++++++++++++++
2 files changed, 22 insertions(+), 8 deletions(-)
diffs (50 lines):
diff -r 3139bebcb54b -r 1bb30e1994fa public_html/lib-common.php
--- a/public_html/lib-common.php Sun Feb 14 19:14:37 2010 +0100
+++ b/public_html/lib-common.php Sun Feb 14 19:37:36 2010 +0100
@@ -948,14 +948,14 @@
$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" hreflang="' . $A['language']
- . '" href="' . $baseurl . $A['filename'] . '" title="'
- . $format_name . ' Feed: ' . $A['title'] . '"' . XHTML . '>';
+ $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 . '>';
}
}
}
diff -r 3139bebcb54b -r 1bb30e1994fa system/lib-syndication.php
--- a/system/lib-syndication.php Sun Feb 14 19:14:37 2010 +0100
+++ b/system/lib-syndication.php Sun Feb 14 19:37:36 2010 +0100
@@ -700,6 +700,20 @@
}
/**
+* Helper function: Derive printable feed format name
+*
+* @param string $format internal name of the feed format, e.g. Atom-1.0
+* @return string MIME type, e.g. application/atom+xml
+*
+*/
+function SYND_getFeedType($format)
+{
+ $fmt = explode('-', $format);
+
+ return ucwords($fmt[0]);
+}
+
+/**
* Helper function: Get default feed URL
*
* This is mostly for backward compatibility: Back in the dark ages, Geeklog
More information about the geeklog-cvs
mailing list