- refactoring page['category'] before 1.7 release

page['category'] is not an id anymore, but an associative array of category info
all of page['cat_xxx'] or page['uppercats'] merged into one
simplifies calls to make_index_url
give plugins a clean start for page variables for version 1.7

git-svn-id: http://piwigo.org/svn/trunk@1861 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices
2007-02-27 01:56:16 +00:00
parent bfb4b15d2f
commit 47512ce6a6
20 changed files with 128 additions and 172 deletions
+18 -16
View File
@@ -3,7 +3,6 @@
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
@@ -133,9 +132,11 @@ function make_index_url($params = array())
* build an index URL with current page parameters, but with redefinitions
* and removes.
*
* duplicate_index_url(array('category' => 12), array('start')) will create
* an index URL on the current section (categories), but on a redefined
* category and without the start URL parameter.
* duplicate_index_url( array(
* 'category' => array('id'=>12, 'name'=>'toto'),
* array('start')
* ) will create an index URL on the current section (categories), but on
* a redefined category and without the start URL parameter.
*
* @param array redefined keys
* @param array removed keys
@@ -325,19 +326,20 @@ function make_section_in_url($params)
}
else
{
$section_string.= '/category/'.$params['category'];
if ($conf['category_url_style']=='id-name' and isset($params['cat_name']) )
is_array($params['category']) or trigger_error(
'make_section_in_url wrong type for category', E_USER_WARNING
);
is_numeric($params['category']['id']) or trigger_error(
'make_section_in_url category id not numeric', E_USER_WARNING
);
isset($params['category']['name']) or trigger_error(
'make_section_in_url category name not set', E_USER_WARNING
);
$section_string.= '/category/'.$params['category']['id'];
if ( $conf['category_url_style']=='id-name' )
{
if ( is_string($params['cat_name']) )
{
$section_string.= '-'.str2url($params['cat_name']);
}
elseif ( is_array( $params['cat_name'] ) and
isset( $params['cat_name'][$params['category']] ) )
{
$section_string.= '-'
.str2url($params['cat_name'][$params['category']]);
}
$section_string.= '-'.str2url($params['category']['name']);
}
}