Procedural File: _category.funcs.php
Source Location: /blogs/inc/MODEL/collections/_category.funcs.php
Page Details
This file implements Category handling functions.
This file is part of the evoCore framework - http://evocore.net/ See also http://sourceforge.net/projects/evocms/.
| Author: | blueyed: Daniel HAHLER. |
| Author: | jwedgeco: Jason EDGECOMBE (for hire by UNC-Charlotte) |
| Author: | fplanque: Francois PLANQUE. |
| Author: | edgester: Jason EDGECOMBE (personal contributions, not for hire) |
| Version: | $Id: _category.funcs.php,v 1.6.2.4.2.1 2007/04/25 22:17:48 fplanque Exp $ |
| Copyright: | (c)2003-2007 by Francois PLANQUE - http://fplanque.net/ Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - http://thequod.de/contact. Parts of this file are copyright (c)2004 by The University of North Carolina at Charlotte as contributed by Jason Edgecombe http://tst.uncc.edu/team/members/jason_bio.php. |
| Todo: | implement CategoryCache based on LinkCache |
| Filesource: | Source Code for this file |
Functions
blog_copy_cats [line 801]
void blog_copy_cats(
$srcblog, $destblog
)
|
|
Copy the catagory structure from one blog to another
The four cat_copy_* functions after blog_copy_cats are required by blog_copy_cats()
Parameters:
boolean blog_has_cats(
integer $blog_ID
)
|
|
Does a given blog have categories?
Parameters:
|
integer |
$blog_ID: |
Blog ID |
string cat_children(
array $ccats, integer $blog_ID, integer $parent_ID, string|array $callback_before_first, string|array $callback_before_each, string|array $callback_after_each, string|array $callback_after_last, [integer $level = 0], [ $root_call = true]
)
|
|
Taking a recursive walk in the category park...
Parameters:
|
array |
$ccats: |
PHP requires this stupid cloning of the cache_categories array in order to be able to perform foreach on it |
|
integer |
$blog_ID: |
|
|
integer |
$parent_ID: |
|
|
string|array |
$callback_before_first: |
Callback for first category |
|
string|array |
$callback_before_each: |
Callback before each category |
|
string|array |
$callback_after_each: |
Callback after each category |
|
string|array |
$callback_after_last: |
Callback after last category |
|
integer |
$level: |
Caller nesting level, just to keep track of how far we go :) |
|
|
$root_call: |
|
cat_copy_after_each [line 840]
void cat_copy_after_each(
$cat_ID, $level
)
|
|
callback to display sublist element
Parameters:
cat_copy_after_last [line 848]
void cat_copy_after_last(
$parent_cat_ID, $level
)
|
|
callback to end sublist
Parameters:
cat_copy_before_each [line 828]
void cat_copy_before_each(
$cat_ID, $level
)
|
|
callback to display sublist element
Parameters:
cat_copy_before_first [line 821]
void cat_copy_before_first(
$parent_cat_ID, $level
)
|
|
callback to start sublist
Parameters:
void cat_create(
$cat_name, $cat_parent_ID, [ $cat_blog_ID = NULL]
)
|
|
Create a new category
This funtion has to handle all needed DB dependencies!
Parameters:
|
|
$cat_name: |
|
|
|
$cat_parent_ID: |
|
|
|
$cat_blog_ID: |
|
void cat_delete(
$cat_ID
)
|
|
Delete a category
This funtion has to handle all needed DB dependencies!
Parameters:
Information Tags:
| Todo: | BUG: it is possible to create loops and lose branch in some situations :( |
cat_load_cache [line 309]
void cat_load_cache(
[string $cat_load_postcounts = 'none'], [ $dbtable_items = 'T_posts'], [ $dbprefix_items = 'post_'], [ $dbIDname_items = 'post_ID']
)
|
|
Load cache for category definitions.
TODO: replace LEFT JOIN with UNION when switching to MySQL 4 This will prevent empty cats from displaying "(1)" as postcount.
Parameters:
|
string |
$cat_load_postcounts: |
'none'|'context'|'canonic' |
|
|
$dbtable_items: |
|
|
|
$dbprefix_items: |
|
|
|
$dbIDname_items: |
|
cat_load_postcats_cache [line 458]
void cat_load_postcats_cache(
)
|
|
Load cache for category associations with current posts
Information Tags:
| Todo: | put this into main post query when MySQL 4.0 commonly available |
cat_load_postcounts [line 369]
void cat_load_postcounts(
[string $cat_load_postcounts = 'canonic'], [ $dbtable = 'T_posts'], [ $dbprefix = 'post_'], [ $dbIDname = 'post_ID']
)
|
|
Load the post counts
Parameters:
|
string |
$cat_load_postcounts: |
'context'|'canonic' |
|
|
$dbtable: |
|
|
|
$dbprefix: |
|
|
|
$dbIDname: |
|
void cat_query(
[string $load_postcounts = 'none'], [ $dbtable_items = 'T_posts'], [ $dbprefix_items = 'post_'], [ $dbIDname_items = 'post_ID']
)
|
|
Query for the cats
Parameters:
|
string |
$load_postcounts: |
'none'|'context'|'canonic' |
|
|
$dbtable_items: |
|
|
|
$dbprefix_items: |
|
|
|
$dbIDname_items: |
|
void cat_req(
$parent_cat_ID, $level
)
|
|
Parameters:
void cat_update(
$cat_ID, $cat_name, [ $cat_parent_ID = 0], [ $cat_blog_ID = '']
)
|
|
Update a category
This funtion has to handle all needed DB dependencies!
Parameters:
|
|
$cat_ID: |
|
|
|
$cat_name: |
|
|
|
$cat_parent_ID: |
|
|
|
$cat_blog_ID: |
|
compile_cat_array [line 861]
void compile_cat_array(
string $cat, array $catsel, array &$cat_array, string &$cat_modifier, [integer $restrict_to_blog = 0]
)
|
|
Compiles the cat array from $cat (recursive + optional modifiers) and $catsel[] (non recursive)
Parameters:
|
string |
$cat: |
|
|
array |
$catsel: |
|
|
array |
&$cat_array: |
by ref, will be modified |
|
string |
&$cat_modifier: |
by ref, will be modified |
|
integer |
$restrict_to_blog: |
blog number to restrict to |
void get_catblog(
$cat_ID
)
|
|
Get blog for a given cat
Parameters:
void get_catname(
$cat_ID
)
|
|
Get name for a given cat
Parameters:
void get_catparent(
$cat_ID
)
|
|
Get parent category for a given cat
Parameters:
get_the_category [line 262]
get_the_category_by_ID [line 234]
void get_the_category_by_ID(
integer $cat_ID, [ $die = true], boolean die()
)
|
|
get_the_category_by_ID(-)
Get category name+blog_id for specified cat ID
fplanque: reused "R. U. Serious" optimization here fplanque: added blog ID stuff TODO: move. dis is not a template tag
Parameters:
|
boolean |
die(): |
if category does not exist? (default: true) |
|
integer |
$cat_ID: |
category ID |
|
|
$die: |
|
postcats_get_byID [line 501]
void postcats_get_byID(
$post_ID
)
|
|
Get category associations with given post
Parameters:
the_categories [line 673]
void the_categories(
[ $link_title = '#'], [ $before_main = '<strong>'], [ $after_main = '</strong>'], [ $before_other = ''], [ $after_other = ''], [ $before_external = '<em>'], [ $after_external = '</em>'], [ $separator = ', '], [ $format_each = 'raw'], [ $format_list = 'htmlbody']
)
|
|
the_categories(-)
lists all the category names
fplanque: created fplanque: 0.8.3: changed defaults
Parameters:
|
|
$link_title: |
|
|
|
$before_main: |
|
|
|
$after_main: |
|
|
|
$before_other: |
|
|
|
$after_other: |
|
|
|
$before_external: |
|
|
|
$after_external: |
|
|
|
$separator: |
|
|
|
$format_each: |
|
|
|
$format_list: |
|
API Tags:
the_categories_IDs [line 762]
void the_categories_IDs(
)
|
|
lists the category IDs for current post
fplanque: created
void the_category(
[ $format = 'htmlbody']
)
|
|
the_category(-)
echoes the main category name the name of the main category the post belongs to. you can as an admin add categories, and rename them if needed. default category is 'General', you can rename it too.
Parameters:
API Tags:
the_category_head [line 782]
void the_category_head(
[ $before = ''], [ $after = '']
)
|
|
Parameters:
the_category_ID [line 750]
Echoes the main category ID for current post
The ID (number) of the category the post belongs to. This is static data that you can use, for example to associate a category to an image, or a css style.