Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28229
Modified Files:
serendipity_functions.inc.php serendipity_sidebar_items.php
Log Message:
Tuned the category-display-plugin to change/disable the xml
button that is displayed before every category. If generateCategoryList()
is used in another place, it will not display the links to
the xml feeds, as a param has been added.
Index: serendipity_sidebar_items.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_sidebar_items.php,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- serendipity_sidebar_items.php 15 Jun 2004 20:38:45 -0000 1.62
+++ serendipity_sidebar_items.php 16 Jun 2004 16:41:49 -0000 1.63
@@ -536,7 +536,7 @@
$propbag->add('name', CATEGORIES);
$propbag->add('description', CATEGORY_PLUGIN_DESC);
- $propbag->add('configuration', array('authorid'));
+ $propbag->add('configuration', array('authorid', 'image'));
$row_authors = serendipity_db_query("SELECT username, authorid FROM {$serendipity['dbPrefix']}authors");
$authors = array('all' => ALL_AUTHORS);
@@ -556,7 +556,12 @@
$propbag->add('description', CATEGORIES_TO_FETCH_DESC);
$propbag->add('select_values', $this->author_select_values);
break;
-
+ case 'image':
+ $propbag->add('type', 'string');
+ $propbag->add('name', XML_IMAGE_TO_DISPLAY);
+ $propbag->add('description', XML_IMAGE_TO_DISPLAY_DESC);
+
+ break;
default:
return false;
}
@@ -570,9 +575,12 @@
$categories = serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category);
$title = CATEGORIES;
$html = '';
-
+ $image = $this->get_config('image', $image);
+ if (empty($image))
+ $image = serendipity_getTemplateFile('img/xml.gif');
+ $image = (($image == "'none'" || $image == 'none') ? '' : $image);
if (is_array($categories) && count($categories)) {
- $html .= serendipity_generateCategoryList($categories, array(0), 3, 0);
+ $html .= serendipity_generateCategoryList($categories, array(0), 3, 0, 0, $image);
}
$html .= sprintf(
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.291
retrieving revision 1.292
diff -u -d -r1.291 -r1.292
--- serendipity_functions.inc.php 14 Jun 2004 18:22:57 -0000 1.291
+++ serendipity_functions.inc.php 16 Jun 2004 16:41:49 -0000 1.292
@@ -2353,7 +2353,21 @@
return array($f, $suf);
}
-function serendipity_generateCategoryList($cats, $select = array(0), $type = 0, $id = 0, $level = 0) {
+/**
+* Print a list of categories
+*
+* Prints a list of categories for use in forms, the sidebar, or whereever...
+* @param array An array of categories, typically gathered by serendipity_fetchCategories()
+* @param array Select
+* @param int Type
+* @param int ID
+* @param int Level
+* @param string Tells the function, whether or not to display the XML button for each category.
+* If empty, no links to the xml feeds will be displayed; If you want to, you can
+* pass an image here (this setting is only used, when type==3).
+* @see serendipity_fetchCategories()
+*/
+function serendipity_generateCategoryList($cats, $select = array(0), $type = 0, $id = 0, $level = 0, $xmlImg = '') {
global $serendipity;
if ( !is_array($cats) || !count($cats) )
@@ -2374,21 +2388,28 @@
break;
case 3:
$category_id = serendipity_makeFilename($cat['category_name']);
+ if (!empty($xmlImg))
$ret .= sprintf(
'<a href="%s" title="%s"><img alt="xml" %s src="%s" /></a> %s' .
'<a href="%s" title="%s">%s</a><br />',
-
$serendipity['serendipityHTTPPath'] . 'rss.php?category=' . $cat['categoryid'] . '_' . $category_id,
htmlspecialchars($cat['category_description']),
($serendipity['XHTML11'] ? 'style="display: inline; border: 0px"' : 'border="0"'),
- serendipity_getTemplateFile('img/xml.gif'),
+ $xmlImg,
str_repeat(' ', $level * 3),
$serendipity['serendipityHTTPPath'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_CATEGORIES . '/' . $cat['categoryid'] . '_' . $category_id,
htmlspecialchars($cat['category_description']),
htmlspecialchars($cat['category_name']));
- break;
+ else
+ $ret .= sprintf(
+ '%s<a href="%s" title="%s">%s</a><br />',
+ str_repeat(' ', $level * 3),
+ $serendipity['serendipityHTTPPath'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . PATH_CATEGORIES . '/' . $cat['categoryid'] . '_' . $category_id,
+ htmlspecialchars($cat['category_description']),
+ htmlspecialchars($cat['category_name']));
+ break;
}
- $ret .= serendipity_generateCategoryList($cats, $select, $type, $cat['categoryid'], $level + 1);
+ $ret .= serendipity_generateCategoryList($cats, $select, $type, $cat['categoryid'], $level + 1, $xmlImg);
}
}
return $ret;
|