Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv20500
Modified Files:
rss.php serendipity_admin_plugins.inc.php
serendipity_lang_de.inc.php serendipity_lang_en.inc.php
serendipity_sidebar_items.php NEWS
Log Message:
* Added radio-button ('boolean') and spacer ('separator') configuration
$type-directives for the plugins
* RSS-feeds and fields can now be customized within the plugin configuration
(fields: image, webmaster, managingEditor, ttl can be controlled)
* minor code intenting
* Language updates
Plugin modifications are backwards compatible. If you haven't configured
your Syndication plugin yet, defaults are used.
Index: rss.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/rss.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- rss.php 19 Aug 2003 03:19:04 -0000 1.11
+++ rss.php 25 Aug 2003 16:43:27 -0000 1.12
@@ -30,29 +30,75 @@
$title = utf8_encode($title);
$description = utf8_encode($description);
-if (file_exists($serendipity['serendipityPath'] . 'pixel/rss_banner.png')) {
+include_once('serendipity_plugin_api.php');
+$plugins = serendipity_plugin_api::enum_plugins();
+$plugin = false;
+
+if (is_array($plugins)) {
+ // load each plugin to make some introspection
+ foreach ($plugins as $plugin_data) {
+ if (preg_match('|@serendipity_syndication_plugin|', $plugin_data['name'])) {
+ $plugin =& serendipity_plugin_api::load_plugin($plugin_data['name']);
+ $bag = new serendipity_property_bag;
+ $plugin->introspect($bag);
+ break;
+ }
+ }
+}
+
+// Check for a logo to use for an RSS feed. Can either be set by configuring the
+// syndication plugin OR by just placing a rss_banner.png file in the pixel directory.
+// If both is not set, we will display our happy own branding. :-)
+
+if ($plugin && is_object($plugin) && $plugin->get_config('bannerURL') != '') {
+ $img = $plugin->get_config('bannerURL');
+ $w = $plugin->get_config('bannerWidth');
+ $h = $plugin->get_config('bannerHeight');
+ $image = <<<IMAGE
+<image>
+ <url>$img</url>
+ <title>RSS: $title - $description</title>
+ <link>{$serendipity['baseURL']}</link>
+ <width>$w</width>
+ <height>$h</height>
+ </image>
+IMAGE;
+} elseif (file_exists($serendipity['serendipityPath'] . 'pixel/rss_banner.png')) {
$i = getimagesize($serendipity['serendipityPath'] . 'pixel/rss_banner.png');
$image = <<<IMAGE
<image>
- <url>{$serendipity['baseURL']}pixel/rss_banner.png</url>
- <title>RSS: $title - $description</title>
- <link>{$serendipity['baseURL']}</link>
- <width>{$i[0]}</width>
- <height>{$i[1]}</height>
-</image>
+ <url>{$serendipity['baseURL']}pixel/rss_banner.png</url>
+ <title>RSS: $title - $description</title>
+ <link>{$serendipity['baseURL']}</link>
+ <width>{$i[0]}</width>
+ <height>{$i[1]}</height>
+ </image>
IMAGE;
} else {
$image = <<<IMAGE
<image>
- <url>{$serendipity['baseURL']}pixel/s9y_banner_tiny.png</url>
- <title>RSS: $title - $description</title>
- <link>{$serendipity['baseURL']}</link>
- <width>100</width>
- <height>21</height>
-</image>
+ <url>{$serendipity['baseURL']}pixel/s9y_banner_tiny.png</url>
+ <title>RSS: $title - $description</title>
+ <link>{$serendipity['baseURL']}</link>
+ <width>100</width>
+ <height>21</height>
+ </image>
IMAGE;
}
+// Now, if set, stitch together any fields that have been configured in the syndication plugin.
+// First, do some sanity checks
+if ($plugin && $bag && is_object($plugin) && is_object($bag)) {
+ $additional_fields = '';
+ foreach($bag->get('configuration') AS $bag_index => $bag_value) {
+ if (preg_match('|^field_(.*)$|', $bag_value, $match)) {
+ if ($plugin->get_config($bag_value) != '') {
+ $additional_fields.= '<' . $match[1] . '>' . $plugin->get_config($bag_value) . '</' . $match[1] . '>' . "\n";
+ }
+ }
+ }
+}
+
echo '<?xml version="1.0" encoding="utf-8" ?>';
echo "\n";
switch ($version) {
@@ -85,8 +131,9 @@
<dc:language>{$serendipity['lang']}</dc:language>
<admin:errorReportsTo rdf:resource="mailto:{$serendipity['CONFIG']['email']}" />
<generator>Serendipity - http://www.s9y.org/</generator>
-
+ $additional_fields
$image
+
HEAD;
break;
default:
Index: serendipity_admin_plugins.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_plugins.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- serendipity_admin_plugins.inc.php 20 Aug 2003 16:08:33 -0000 1.9
+++ serendipity_admin_plugins.inc.php 25 Aug 2003 16:43:27 -0000 1.10
@@ -104,8 +104,70 @@
$cdesc = htmlentities($cbag->get('description'));
$value = $plugin->get_config($config_item);
$hvalue = (isset($_POST['serendipity']['plugin'][$config_item]) ? htmlentities($_POST['serendipity']['plugin'][$config_item]) : htmlentities($value));
-
+ $radio = array();
+
switch ($cbag->get('type')) {
+ case 'seperator':
+?>
+ <tr>
+ <td colspan="2"><hr noshade="noshade" size="1" /></td>
+ </tr>
+<?php
+ break;
+
+ case 'boolean':
+ $radio['value'][] = 'true';
+ $radio['desc'][] = YES;
+
+ $radio['value'][] = 'false';
+ $radio['desc'][] = NO;
+
+ case 'radio':
+ if (!count($radio) > 0) {
+ $radio = $cbag->get('radio');
+ }
+
+ $per_row = $cbag->get('radio_per_row');
+ if (empty($per_row)) {
+ $per_row = 2;
+ }
+?>
+ <tr>
+ <td style="vertical-align: top"><?php echo $cname; ?></td>
+ <td style="vertical-align: top">
+<?php
+ $counter = 0;
+ foreach($radio['value'] AS $radio_index => $radio_value) {
+ $id = htmlspecialchars($config_item . $radio_value);
+ $counter++;
+ if ($counter == 1) {
+?>
+ <div>
+<?php
+ }
+?>
+ <input type="radio" id="serendipity_plugin_<?php echo $id; ?>" name="serendipity[plugin][<?php echo $config_item; ?>]" value="<?php echo $radio_value; ?>" <?php echo ($radio_value == $hvalue ? 'checked="checked"' : ''); ?> title="<?php echo htmlentities($radio['desc'][$radio_index]); ?>" />
+ <label for="serendipity_plugin_<?php echo $id; ?>"><?php echo htmlentities($radio['desc'][$radio_index]); ?></label>
+<?php
+ if ($counter == $per_row) {
+ $counter = 0;
+?>
+ </div>
+<?php
+ }
+ }
+
+ if ($cdesc != '') {
+?>
+ <br /><span style="color: #bbbbbb">// <?php echo $cdesc; ?></span>
+<?php
+ }
+?>
+ </td>
+ </tr>
+<?php
+ break;
+
case 'string':
?>
<tr>
Index: serendipity_lang_de.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_lang_de.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- serendipity_lang_de.inc.php 17 Aug 2003 18:06:03 -0000 1.24
+++ serendipity_lang_de.inc.php 25 Aug 2003 16:43:27 -0000 1.25
@@ -129,7 +129,7 @@
define('TOP_EXITS', 'Top Exits');
define('SHOWS_TOP_EXIT', 'Zeigt die Top-Exit-Links Ihres Blogs');
define('SYNDICATION', 'Syndication');
-define('SHOWS_RSS_BLAHBLAH', 'Zeigt die RSS Syndication links');
+define('SHOWS_RSS_BLAHBLAH', 'Zeigt die RSS Syndication-Links');
define('SUPERUSER', 'Eigentümer');
define('ALLOWS_YOU_BLAHBLAH', 'Link zum Konfigurieren von Serendipity und zum Schreiben von Einträgen - WICHTIG');
define('PLUG', 'Plug');
@@ -245,13 +245,28 @@
define('RUNNING', 'Sie benutzen serendipity v.');
define('TOGGLE_ALL', 'Alle Optionen ein-/ausblenden');
define('TOGGLE_OPTION', 'Option ein-/ausblenden');
-
define('SUBSCRIBE_TO_THIS_ENTRY', 'Bei Aktualisierung dieser Kommentare benachrichtigen');
define('UNSUBSCRIBE_OK', 'TRANSLATE_ME');
define('NEW_COMMENT_TO_SUBSCRIBED_ENTRY', 'Benachrichtigung zu neuem Kommentar des Eintrags "%s"');
define('SUBSCRIPTION_MAIL', "Hallo %s,\n\nEin neues Kommentar wurde dem Eintrag hinzugefügt, den Sie auf \"%s\" namens \"%s\" finden.\nDer Name des Autoren ist: %s\n\nSie können den Eintrag hier finden: %s\n\nSie können diese Benachrichtung mit folgender URL kündigen: %s\n");
define('SIGNATURE', "\n-- \n%s wird betrieben mit Serendipity.\nDas allerbeste blog, Sie können es auch nutzen.\nWie das geht, sehen Sie auf <http://s9y.org>.");
define('DATABASE_ALREADY_INSTALLED', 'ÜBERSPRUNGEN: Datenbank besteht bereits');
+define('SYNDICATION_PLUGIN_091', 'RSS 0.91 feed');
+define('SYNDICATION_PLUGIN_20', 'RSS 2.0 feed');
+define('SYNDICATION_PLUGIN_20c', 'RSS 2.0 Kommentar');
+define('SYNDICATION_PLUGIN_MANAGINGEDITOR', 'Feld "managingEditor"');
+define('SYNDICATION_PLUGIN_WEBMASTER', 'Feld "webMaster"');
+define('SYNDICATION_PLUGIN_BANNERURL', 'Bild für den RSS feed');
+define('SYNDICATION_PLUGIN_BANNERWIDTH', 'Breite des Bildes');
+define('SYNDICATION_PLUGIN_BANNERHEIGHT', 'Höhe des Bildes');
+define('SYNDICATION_PLUGIN_WEBMASTER_DESC', 'E-Mail Adresse des Webmasters, falls vorhanden. (leer: nicht verwenden) [RSS 2.0]');
+define('SYNDICATION_PLUGIN_MANAGINGEDITOR_DESC', 'E-Mail Adresse des verantwortlichen Editors, falls vorhanden. (leer: nicht verwenden) [RSS 2.0]');
+define('SYNDICATION_PLUGIN_BANNERURL_DESC', 'URL für ein Bild im GIF/JPEG/PNG Format, falls vorhanden. (leer: serendipity-Logo)');
+define('SYNDICATION_PLUGIN_BANNERWIDTH_DESC', 'in Pixeln, max. 144');
+define('SYNDICATION_PLUGIN_BANNERHEIGHT_DESC', 'in Pixeln, max. 400');
+define('SYNDICATION_PLUGIN_TTL', 'Feld "ttl" (time-to-live)');
+define('SYNDICATION_PLUGIN_TTL_DESC', 'Anzahl von Minuten, nachdem Ihr Blog von fremden Seiten nicht mehr gecached werden sollte (leer: nicht verwenden) [RSS 2.0]');
+define('CONTENT', 'Inhalt');
define('serendipity_LANG_LOADED', true);
/* vim: set sts=4 ts=4 expandtab : */
Index: serendipity_lang_en.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_lang_en.inc.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- serendipity_lang_en.inc.php 19 Aug 2003 16:20:25 -0000 1.34
+++ serendipity_lang_en.inc.php 25 Aug 2003 16:43:27 -0000 1.35
@@ -251,6 +251,22 @@
define('SUBSCRIPTION_MAIL', "Hello %s,\n\nA new comment was made to the entry you are monitoring on \"%s\", entitled \"%s\"\nThe name of the poster is: %s\n\nYou can find the entry here: %s\n\nYou can unsubscribe by clicking on this link: %s\n");
define('SIGNATURE', "\n-- \n%s is powered by Serendipity.\nThe best blog around, you can use it too.\nCheck out <http://s9y.org> to find out how.");
define('DATABASE_ALREADY_INSTALLED', 'SKIPPED: Database already installed');
+define('SYNDICATION_PLUGIN_091', 'RSS 0.91 feed');
+define('SYNDICATION_PLUGIN_20', 'RSS 2.0 feed');
+define('SYNDICATION_PLUGIN_20c', 'RSS 2.0 comments');
+define('SYNDICATION_PLUGIN_MANAGINGEDITOR', 'Field "managingEditor"');
+define('SYNDICATION_PLUGIN_WEBMASTER', 'Field "webMaster"');
+define('SYNDICATION_PLUGIN_BANNERURL', 'Image for the RSS feed');
+define('SYNDICATION_PLUGIN_BANNERWIDTH', 'Image width');
+define('SYNDICATION_PLUGIN_BANNERHEIGHT', 'Image height');
+define('SYNDICATION_PLUGIN_WEBMASTER_DESC', 'E-Mail address of the webmaster, if available. (empty: hidden) [RSS 2.0]');
+define('SYNDICATION_PLUGIN_MANAGINGEDITOR_DESC', 'E-Mail address of the managing editor, if available. (empty: hidden) [RSS 2.0]');
+define('SYNDICATION_PLUGIN_BANNERURL_DESC', 'URL of an image in GIF/JPEG/PNG format, if available. (empty: serendipity-logo)');
+define('SYNDICATION_PLUGIN_BANNERWIDTH_DESC', 'in pixels, max. 144');
+define('SYNDICATION_PLUGIN_BANNERHEIGHT_DESC', 'in pixels, max. 400');
+define('SYNDICATION_PLUGIN_TTL', 'Field "ttl" (time-to-live)');
+define('SYNDICATION_PLUGIN_TTL_DESC', 'Amount of minutes after which your blog should not be cached any more by foreign sites/applications (empty: hidden) [RSS 2.0]');
+define('CONTENT', 'Content');
define('serendipity_LANG_LOADED', true);
/* vim: set sts=4 ts=4 expandtab : */
Index: serendipity_sidebar_items.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_sidebar_items.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- serendipity_sidebar_items.php 22 Aug 2003 01:41:09 -0000 1.25
+++ serendipity_sidebar_items.php 25 Aug 2003 16:43:27 -0000 1.26
@@ -132,23 +132,117 @@
{
$propbag->add('name', SYNDICATION);
$propbag->add('description', SHOWS_RSS_BLAHBLAH);
+ $propbag->add('configuration', array(
+ 'show_0.91',
+ 'show_2.0',
+ 'show_2.0c',
+ 'seperator',
+ 'field_managingEditor',
+ 'field_webMaster',
+ 'field_ttl',
+ 'seperator',
+ 'bannerURL',
+ 'bannerWidth',
+ 'bannerHeight',
+ )
+ );
}
+ function introspect_config_item($name, &$propbag)
+ {
+ switch($name) {
+ case 'show_0.91':
+ $propbag->add('type', 'boolean');
+ $propbag->add('name', SYNDICATION_PLUGIN_091);
+ $propbag->add('description', '');
+ break;
+
+ case 'show_2.0':
+ $propbag->add('type', 'boolean');
+ $propbag->add('name', SYNDICATION_PLUGIN_20);
+ $propbag->add('description', '');
+ break;
+
+ case 'show_2.0c':
+ $propbag->add('type', 'boolean');
+ $propbag->add('name', SYNDICATION_PLUGIN_20c);
+ $propbag->add('description', '');
+ break;
+
+ case 'seperator':
+ $propbag->add('type', 'seperator');
+ break;
+
+ case 'field_managingEditor':
+ $propbag->add('type', 'string');
+ $propbag->add('name', SYNDICATION_PLUGIN_MANAGINGEDITOR);
+ $propbag->add('description', SYNDICATION_PLUGIN_MANAGINGEDITOR_DESC);
+ break;
+
+ case 'field_webMaster':
+ $propbag->add('type', 'string');
+ $propbag->add('name', SYNDICATION_PLUGIN_WEBMASTER);
+ $propbag->add('description', SYNDICATION_PLUGIN_WEBMASTER_DESC);
+ break;
+
+ case 'field_ttl':
+ $propbag->add('type', 'string');
+ $propbag->add('name', SYNDICATION_PLUGIN_TTL);
+ $propbag->add('description', SYNDICATION_PLUGIN_TTL_DESC);
+ break;
+
+ case 'bannerURL':
+ $propbag->add('type', 'string');
+ $propbag->add('name', SYNDICATION_PLUGIN_BANNERURL);
+ $propbag->add('description', SYNDICATION_PLUGIN_BANNERURL_DESC);
+ break;
+
+ case 'bannerWidth':
+ $propbag->add('type', 'string');
+ $propbag->add('name', SYNDICATION_PLUGIN_BANNERWIDTH);
+ $propbag->add('description', SYNDICATION_PLUGIN_BANNERWIDTH_DESC);
+ break;
+
+ case 'bannerHeight':
+ $propbag->add('type', 'string');
+ $propbag->add('name', SYNDICATION_PLUGIN_BANNERHEIGHT);
+ $propbag->add('description', SYNDICATION_PLUGIN_BANNERHEIGHT_DESC);
+ break;
+
+ default:
+ return false;
+ }
+ return true;
+ }
+
function generate_content(&$title)
{
global $serendipity;
-
+
$title = SYNDICATE_THIS_BLOG;
+
+ if ($this->get_config('show_0.91') != 'false') {
?>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=0.91"><img src="<?php echo $serendipity['serendipityHTTPPath']; ?>xml.gif" border="0" alt="XML" /></a>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=0.91">RSS 0.91 feed</a>
<br />
+<?php
+ }
+
+ if ($this->get_config('show_2.0') != 'false') {
+?>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=2.0"><img src="<?php echo $serendipity['serendipityHTTPPath']; ?>xml.gif" border="0" alt="XML" /></a>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=2.0">RSS 2.0 feed</a>
<br />
+<?php
+ }
+
+ if ($this->get_config('show_2.0c') != 'false') {
+?>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=2.0&type=comments"><img src="<?php echo $serendipity['serendipityHTTPPath']; ?>xml.gif" border="0" alt="XML" /></a>
<a href="<?php echo $serendipity['serendipityHTTPPath']; ?>rss.php?version=2.0&type=comments">RSS 2.0 <?php echo COMMENTS; ?></a>
<?php
+ }
}
}
@@ -205,13 +299,13 @@
switch($name) {
case 'title':
$propbag->add('type', 'string');
- $propbag->add('name', 'Title');
+ $propbag->add('name', TITLE);
$propbag->add('description', TITLE_FOR_NUGGET);
break;
case 'content':
$propbag->add('type', 'html');
- $propbag->add('name', 'Content');
+ $propbag->add('name', CONTENT);
$propbag->add('description', THE_NUGGET);
break;
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- NEWS 25 Aug 2003 13:11:06 -0000 1.16
+++ NEWS 25 Aug 2003 16:43:27 -0000 1.17
@@ -2,6 +2,8 @@
Version 0.3 ()
------------------------------------
+ * Added radio-button and "spacer" configuration directives for the plugins (garvinhicking)
+ * RSS-feeds and fields can now be customized within the plugin configuration (garvinhicking)
* Trackback pings where only accepted on a POST method. Moveable Type uses GET, so we now accept both. (garvinhicking)
* Fixed issue where trackbackpings were only sent to links in extended entry, if one existed, discarding the standard body (garvinhicking)
* Fixed issue where two users sharing same username & password would not be able to log in correctly, causing errors on the admin pages (tomsommer)
|