Ignore:
Timestamp:
Feb 27, 2007, 2:56:16 AM (17 years ago)
Author:
rvelices
Message:
  • refactoring pagecategory before 1.7 release

pagecategory is not an id anymore, but an associative array of category info
all of pagecat_xxx or pageuppercats merged into one
simplifies calls to make_index_url
give plugins a clean start for page variables for version 1.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_url.inc.php

    r1800 r1861  
    44// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    55// +-----------------------------------------------------------------------+
    6 // | branch        : BSF (Best So Far)
    76// | file          : $Id$
    87// | last update   : $Date$
     
    134133 * and removes.
    135134 *
    136  * duplicate_index_url(array('category' => 12), array('start')) will create
    137  * an index URL on the current section (categories), but on a redefined
    138  * category and without the start URL parameter.
     135 * duplicate_index_url( array(
     136 *   'category' => array('id'=>12, 'name'=>'toto'),
     137 *   array('start')
     138 * ) will create an index URL on the current section (categories), but on
     139 * a redefined category and without the start URL parameter.
    139140 *
    140141 * @param array redefined keys
     
    326327      else
    327328      {
    328         $section_string.= '/category/'.$params['category'];
    329         if ($conf['category_url_style']=='id-name' and isset($params['cat_name']) )
     329        is_array($params['category']) or trigger_error(
     330            'make_section_in_url wrong type for category', E_USER_WARNING
     331            );
     332        is_numeric($params['category']['id']) or trigger_error(
     333            'make_section_in_url category id not numeric', E_USER_WARNING
     334            );
     335        isset($params['category']['name']) or trigger_error(
     336            'make_section_in_url category name not set', E_USER_WARNING
     337            );
     338
     339        $section_string.= '/category/'.$params['category']['id'];
     340        if ( $conf['category_url_style']=='id-name' )
    330341        {
    331           if ( is_string($params['cat_name']) )
    332           {
    333             $section_string.= '-'.str2url($params['cat_name']);
    334           }
    335           elseif ( is_array( $params['cat_name'] ) and
    336                 isset( $params['cat_name'][$params['category']] ) )
    337           {
    338             $section_string.= '-'
    339                 .str2url($params['cat_name'][$params['category']]);
    340           }
     342          $section_string.= '-'.str2url($params['category']['name']);
    341343        }
    342344      }
Note: See TracChangeset for help on using the changeset viewer.