mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-11 11:13:02 +02:00
- 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:
@@ -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']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user