Make WordPress Core


Ignore:
Timestamp:
07/02/2008 11:07:56 PM (17 years ago)
Author:
mdawaffe
Message:

crazyhorse: merge with log:trunk@8151:8240

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/crazyhorse/wp-includes/taxonomy.php

    r7952 r8242  
    2121
    2222/**
    23  * get_object_taxonomies() - Return all of the taxonomy names that are of $object_type
     23 * Return all of the taxonomy names that are of $object_type.
    2424 *
    2525 * It appears that this function can be used to find all of the names inside of
    2626 * $wp_taxonomies global variable.
    2727 *
    28  * <code><?php $taxonomies = get_object_taxonomies('post'); ?></code>
    29  * Should result in <code>Array('category', 'post_tag')</code>
     28 * <code><?php $taxonomies = get_object_taxonomies('post'); ?></code> Should
     29 * result in <code>Array('category', 'post_tag')</code>
    3030 *
    3131 * @package WordPress
     
    5959
    6060/**
    61  * get_taxonomy() - Returns the taxonomy object of $taxonomy.
     61 * Retrieves the taxonomy object of $taxonomy.
    6262 *
    6363 * The get_taxonomy function will first check that the parameter string given
     
    8484
    8585/**
    86  * is_taxonomy() - Checks that the taxonomy name exists
     86 * Checks that the taxonomy name exists.
    8787 *
    8888 * @package WordPress
     
    102102
    103103/**
    104  * is_taxonomy_hierarchical() - Whether the taxonomy object is hierarchical
    105  *
    106  * Checks to make sure that the taxonomy is an object first. Then Gets the object, and finally
    107  * returns the hierarchical value in the object.
     104 * Whether the taxonomy object is hierarchical.
     105 *
     106 * Checks to make sure that the taxonomy is an object first. Then Gets the
     107 * object, and finally returns the hierarchical value in the object.
    108108 *
    109109 * A false return value might also mean that the taxonomy does not exist.
     
    128128
    129129/**
    130  * register_taxonomy() - Create or modify a taxonomy object. Do not use before init.
    131  *
    132  * A simple function for creating or modifying a taxonomy object based on the parameters given.
    133  * The function will accept an array (third optional parameter), along with strings for the
    134  * taxonomy name and another string for the object type.
    135  *
    136  * Nothing is returned, so expect error maybe or use is_taxonomy() to check whether taxonomy exists.
     130 * Create or modify a taxonomy object. Do not use before init.
     131 *
     132 * A simple function for creating or modifying a taxonomy object based on the
     133 * parameters given. The function will accept an array (third optional
     134 * parameter), along with strings for the taxonomy name and another string for
     135 * the object type.
     136 *
     137 * Nothing is returned, so expect error maybe or use is_taxonomy() to check
     138 * whether taxonomy exists.
    137139 *
    138140 * Optional $args contents:
    139  * hierarachical - has some defined purpose at other parts of the API and is a boolean value.
    140  * update_count_callback - works much like a hook, in that it will be called when the count is updated.
    141  * rewrite - false to prevent rewrite, or array('slug'=>$slug) to customize permastruct; default will use $taxonomy as slug
    142  * query_var - false to prevent queries, or string to customize query var (?$query_var=$term); default will use $taxonomy as query var
     141 *
     142 * hierarachical - has some defined purpose at other parts of the API and is a
     143 * boolean value.
     144 *
     145 * update_count_callback - works much like a hook, in that it will be called
     146 * when the count is updated.
     147 *
     148 * rewrite - false to prevent rewrite, or array('slug'=>$slug) to customize
     149 * permastruct; default will use $taxonomy as slug.
     150 *
     151 * query_var - false to prevent queries, or string to customize query var
     152 * (?$query_var=$term); default will use $taxonomy as query var.
    143153 *
    144154 * @package WordPress
     
    185195
    186196/**
    187  * get_objects_in_term() - Return object_ids of valid taxonomy and term
    188  *
    189  * The strings of $taxonomies must exist before this function will continue. On failure of finding
    190  * a valid taxonomy, it will return an WP_Error class, kind of like Exceptions in PHP 5, except you
    191  * can't catch them. Even so, you can still test for the WP_Error class and get the error message.
    192  *
    193  * The $terms aren't checked the same as $taxonomies, but still need to exist for $object_ids to
    194  * be returned.
    195  *
    196  * It is possible to change the order that object_ids is returned by either using PHP sort family
    197  * functions or using the database by using $args with either ASC or DESC array. The value should
    198  * be in the key named 'order'.
     197 * Retrieve object_ids of valid taxonomy and term.
     198 *
     199 * The strings of $taxonomies must exist before this function will continue. On
     200 * failure of finding a valid taxonomy, it will return an WP_Error class, kind
     201 * of like Exceptions in PHP 5, except you can't catch them. Even so, you can
     202 * still test for the WP_Error class and get the error message.
     203 *
     204 * The $terms aren't checked the same as $taxonomies, but still need to exist
     205 * for $object_ids to be returned.
     206 *
     207 * It is possible to change the order that object_ids is returned by either
     208 * using PHP sort family functions or using the database by using $args with
     209 * either ASC or DESC array. The value should be in the key named 'order'.
    199210 *
    200211 * @package WordPress
     
    245256
    246257/**
    247  * get_term() - Get all Term data from database by Term ID.
    248  *
    249  * The usage of the get_term function is to apply filters to a term object.
    250  * It is possible to get a term object from the database before applying the
     258 * Get all Term data from database by Term ID.
     259 *
     260 * The usage of the get_term function is to apply filters to a term object. It
     261 * is possible to get a term object from the database before applying the
    251262 * filters.
    252263 *
    253  * $term ID must be part of $taxonomy, to get from the database. Failure, might be
    254  * able to be captured by the hooks. Failure would be the same value as $wpdb returns for the
    255  * get_row method.
    256  *
    257  * There are two hooks, one is specifically for each term, named 'get_term', and the second is
    258  * for the taxonomy name, 'term_$taxonomy'. Both hooks gets the term object, and the taxonomy
    259  * name as parameters. Both hooks are expected to return a Term object.
    260  *
    261  * 'get_term' hook - Takes two parameters the term Object and the taxonomy name. Must return
    262  * term object. Used in get_term() as a catch-all filter for every $term.
    263  *
    264  * 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy name. Must return
    265  * term object. $taxonomy will be the taxonomy name, so for example, if 'category', it would be
    266  * 'get_category' as the filter name. Useful for custom taxonomies or plugging into default taxonomies.
     264 * $term ID must be part of $taxonomy, to get from the database. Failure, might
     265 * be able to be captured by the hooks. Failure would be the same value as $wpdb
     266 * returns for the get_row method.
     267 *
     268 * There are two hooks, one is specifically for each term, named 'get_term', and
     269 * the second is for the taxonomy name, 'term_$taxonomy'. Both hooks gets the
     270 * term object, and the taxonomy name as parameters. Both hooks are expected to
     271 * return a Term object.
     272 *
     273 * 'get_term' hook - Takes two parameters the term Object and the taxonomy name.
     274 * Must return term object. Used in get_term() as a catch-all filter for every
     275 * $term.
     276 *
     277 * 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy
     278 * name. Must return term object. $taxonomy will be the taxonomy name, so for
     279 * example, if 'category', it would be 'get_category' as the filter name. Useful
     280 * for custom taxonomies or plugging into default taxonomies.
    267281 *
    268282 * @package WordPress
     
    317331
    318332/**
    319  * get_term_by() - Get all Term data from database by Term field and data.
    320  *
    321  * Warning: $value is not escaped for 'name' $field. You must do it yourself, if required.
    322  *
    323  * The default $field is 'id', therefore it is possible to also use null for field, but not
    324  * recommended that you do so.
    325  *
    326  * If $value does not exist, the return value will be false. If $taxonomy exists and $field
    327  * and $value combinations exist, the Term will be returned.
     333 * Get all Term data from database by Term field and data.
     334 *
     335 * Warning: $value is not escaped for 'name' $field. You must do it yourself, if
     336 * required.
     337 *
     338 * The default $field is 'id', therefore it is possible to also use null for
     339 * field, but not recommended that you do so.
     340 *
     341 * If $value does not exist, the return value will be false. If $taxonomy exists
     342 * and $field and $value combinations exist, the Term will be returned.
    328343 *
    329344 * @package WordPress
     
    381396
    382397/**
    383  * get_term_children() - Merge all term children into a single array.
    384  *
    385  * This recursive function will merge all of the children of $term into
    386  * the same array. Only useful for taxonomies which are hierarchical.
     398 * Merge all term children into a single array.
     399 *
     400 * This recursive function will merge all of the children of $term into the same
     401 * array. Only useful for taxonomies which are hierarchical.
    387402 *
    388403 * Will return an empty array if $term does not exist in $taxonomy.
     
    420435
    421436/**
    422  * get_term_field() - Get sanitized Term field
    423  *
    424  * Does checks for $term, based on the $taxonomy. The function is for
    425  * contextual reasons and for simplicity of usage. See sanitize_term_field() for
    426  * more information.
     437 * Get sanitized Term field.
     438 *
     439 * Does checks for $term, based on the $taxonomy. The function is for contextual
     440 * reasons and for simplicity of usage. See sanitize_term_field() for more
     441 * information.
    427442 *
    428443 * @package WordPress
     
    454469
    455470/**
    456  * get_term_to_edit() - Sanitizes Term for editing
    457  *
    458  * Return value is sanitize_term() and usage is for sanitizing the term
    459  * for editing. Function is for contextual and simplicity.
     471 * Sanitizes Term for editing.
     472 *
     473 * Return value is sanitize_term() and usage is for sanitizing the term for
     474 * editing. Function is for contextual and simplicity.
    460475 *
    461476 * @package WordPress
     
    482497
    483498/**
    484  * get_terms() - Retrieve the terms in taxonomy or list of taxonomies.
    485  *
    486  * You can fully inject any customizations to the query before it is sent, as well as control
    487  * the output with a filter.
    488  *
    489  * The 'get_terms' filter will be called when the cache has the term and will pass the found
    490  * term along with the array of $taxonomies and array of $args. This filter is also called
    491  * before the array of terms is passed and will pass the array of terms, along with the $taxonomies
    492  * and $args.
    493  *
    494  * The 'list_terms_exclusions' filter passes the compiled exclusions along with the $args.
     499 * Retrieve the terms in taxonomy or list of taxonomies.
     500 *
     501 * You can fully inject any customizations to the query before it is sent, as
     502 * well as control the output with a filter.
     503 *
     504 * The 'get_terms' filter will be called when the cache has the term and will
     505 * pass the found term along with the array of $taxonomies and array of $args.
     506 * This filter is also called before the array of terms is passed and will pass
     507 * the array of terms, along with the $taxonomies and $args.
     508 *
     509 * The 'list_terms_exclusions' filter passes the compiled exclusions along with
     510 * the $args.
    495511 *
    496512 * The list that $args can contain, which will overwrite the defaults.
    497  * orderby - Default is 'name'. Can be name, count, or nothing (will use term_id).
     513 *
     514 * orderby - Default is 'name'. Can be name, count, or nothing (will use
     515 * term_id).
     516 *
    498517 * order - Default is ASC. Can use DESC.
    499518 * hide_empty - Default is true. Will not return empty $terms.
     
    503522 * name__like - Default is empty string.
    504523 *
    505  * The argument 'pad_counts' will count all of the children along with the $terms.
    506  *
    507  * The 'get' argument allows for overwriting 'hide_empty' and 'child_of', which can be done by
    508  * setting the value to 'all', instead of its default empty string value.
    509  *
    510  * The 'child_of' argument will be used if you use multiple taxonomy or the first $taxonomy
    511  * isn't hierarchical or 'parent' isn't used. The default is 0, which will be translated to
    512  * a false value. If 'child_of' is set, then 'child_of' value will be tested against
    513  * $taxonomy to see if 'child_of' is contained within. Will return an empty array if test
    514  * fails.
    515  *
    516  * If 'parent' is set, then it will be used to test against the first taxonomy. Much like
    517  * 'child_of'. Will return an empty array if the test fails.
     524 * The argument 'pad_counts' will count all of the children along with the
     525 * $terms.
     526 *
     527 * The 'get' argument allows for overwriting 'hide_empty' and 'child_of', which
     528 * can be done by setting the value to 'all', instead of its default empty
     529 * string value.
     530 *
     531 * The 'child_of' argument will be used if you use multiple taxonomy or the
     532 * first $taxonomy isn't hierarchical or 'parent' isn't used. The default is 0,
     533 * which will be translated to a false value. If 'child_of' is set, then
     534 * 'child_of' value will be tested against $taxonomy to see if 'child_of' is
     535 * contained within. Will return an empty array if test fails.
     536 *
     537 * If 'parent' is set, then it will be used to test against the first taxonomy.
     538 * Much like 'child_of'. Will return an empty array if the test fails.
    518539 *
    519540 * @package WordPress
     
    523544 * @uses $wpdb
    524545 * @uses wp_parse_args() Merges the defaults with those defined by $args and allows for strings.
    525  *
    526546 *
    527547 * @param string|array Taxonomy name or list of Taxonomy names
     
    582602
    583603    // $args can be whatever, only use the args defined in defaults to compute the key
    584     $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) );
     604    $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
     605    $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key );
    585606
    586607    if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) {
     
    724745
    725746/**
    726  * is_term() - Check if Term exists
     747 * Check if Term exists.
    727748 *
    728749 * Returns the index of a defined term, or 0 (false) if the term doesn't exist.
     
    758779
    759780/**
    760  * sanitize_term() - Sanitize Term all fields
    761  *
    762  * Relys on sanitize_term_field() to sanitize the term. The difference
    763  * is that this function will sanitize <strong>all</strong> fields. The context
    764  * is based on sanitize_term_field().
     781 * Sanitize Term all fields.
     782 *
     783 * Relys on sanitize_term_field() to sanitize the term. The difference is that
     784 * this function will sanitize <strong>all</strong> fields. The context is based
     785 * on sanitize_term_field().
    765786 *
    766787 * The $term is expected to be either an array or an object.
     
    799820
    800821/**
    801  * sanitize_term_field() - Cleanse the field value in the term based on the context
    802  *
    803  * Passing a term field value through the function should be assumed to have cleansed
    804  * the value for whatever context the term field is going to be used.
    805  *
    806  * If no context or an unsupported context is given, then default filters will be applied.
    807  *
    808  * There are enough filters for each context to support a custom filtering without creating
    809  * your own filter function. Simply create a function that hooks into the filter you need.
     822 * Cleanse the field value in the term based on the context.
     823 *
     824 * Passing a term field value through the function should be assumed to have
     825 * cleansed the value for whatever context the term field is going to be used.
     826 *
     827 * If no context or an unsupported context is given, then default filters will
     828 * be applied.
     829 *
     830 * There are enough filters for each context to support a custom filtering
     831 * without creating your own filter function. Simply create a function that
     832 * hooks into the filter you need.
    810833 *
    811834 * @package WordPress
     
    864887
    865888/**
    866  * wp_count_terms() - Count how many terms are in Taxonomy
    867  *
    868  * Default $args is 'ignore_empty' which can be <code>'ignore_empty=true'</code> or
    869  * <code>array('ignore_empty' => true);</code>.
     889 * Count how many terms are in Taxonomy.
     890 *
     891 * Default $args is 'ignore_empty' which can be <code>'ignore_empty=true'</code>
     892 * or <code>array('ignore_empty' => true);</code>.
    870893 *
    871894 * @package WordPress
     
    895918
    896919/**
    897  * wp_delete_object_term_relationships() - Will unlink the term from the taxonomy
    898  *
    899  * Will remove the term's relationship to the taxonomy, not the term or taxonomy itself.
    900  * The term and taxonomy will still exist. Will require the term's object ID to perform
    901  * the operation.
     920 * Will unlink the term from the taxonomy.
     921 *
     922 * Will remove the term's relationship to the taxonomy, not the term or taxonomy
     923 * itself. The term and taxonomy will still exist. Will require the term's
     924 * object ID to perform the operation.
    902925 *
    903926 * @package WordPress
     
    926949
    927950/**
    928  * wp_delete_term() - Removes a term from the database.
    929  *
    930  * If the term is a parent of other terms, then the children will be updated
    931  * to that term's parent.
     951 * Removes a term from the database.
     952 *
     953 * If the term is a parent of other terms, then the children will be updated to
     954 * that term's parent.
    932955 *
    933956 * The $args 'default' will only override the terms found, if there is only one
     
    939962 *
    940963 * @uses $wpdb
    941  * @uses do_action() Calls both 'delete_term' and 'delete_$taxonomy' action hooks,
    942  *  passing term object, term id. 'delete_term' gets an additional parameter with
    943  *  the $taxonomy parameter.
     964 * @uses do_action() Calls both 'delete_term' and 'delete_$taxonomy' action
     965 *  hooks, passing term object, term id. 'delete_term' gets an additional
     966 *  parameter with the $taxonomy parameter.
    944967 *
    945968 * @param int $term Term ID
     
    10071030
    10081031/**
    1009  * wp_get_object_terms() - Retrieves the terms associated with the given object(s), in the supplied taxonomies.
    1010  *
    1011  * The following information has to do the $args parameter and for what can be contained in the string
    1012  * or array of that parameter, if it exists.
    1013  *
    1014  * The first argument is called, 'orderby' and has the default value of 'name'. The other value that is
    1015  * supported is 'count'.
    1016  *
    1017  * The second argument is called, 'order' and has the default value of 'ASC'. The only other value that
    1018  * will be acceptable is 'DESC'.
    1019  *
    1020  * The final argument supported is called, 'fields' and has the default value of 'all'. There are
    1021  * multiple other options that can be used instead. Supported values are as follows: 'all', 'ids',
    1022  * 'names', and finally 'all_with_object_id'.
    1023  *
    1024  * The fields argument also decides what will be returned. If 'all' or 'all_with_object_id' is choosen or
    1025  * the default kept intact, then all matching terms objects will be returned. If either 'ids' or 'names'
    1026  * is used, then an array of all matching term ids or term names will be returned respectively.
     1032 * Retrieves the terms associated with the given object(s), in the supplied taxonomies.
     1033 *
     1034 * The following information has to do the $args parameter and for what can be
     1035 * contained in the string or array of that parameter, if it exists.
     1036 *
     1037 * The first argument is called, 'orderby' and has the default value of 'name'.
     1038 * The other value that is supported is 'count'.
     1039 *
     1040 * The second argument is called, 'order' and has the default value of 'ASC'.
     1041 * The only other value that will be acceptable is 'DESC'.
     1042 *
     1043 * The final argument supported is called, 'fields' and has the default value of
     1044 * 'all'. There are multiple other options that can be used instead. Supported
     1045 * values are as follows: 'all', 'ids', 'names', and finally
     1046 * 'all_with_object_id'.
     1047 *
     1048 * The fields argument also decides what will be returned. If 'all' or
     1049 * 'all_with_object_id' is choosen or the default kept intact, then all matching
     1050 * terms objects will be returned. If either 'ids' or 'names' is used, then an
     1051 * array of all matching term ids or term names will be returned respectively.
    10271052 *
    10281053 * @package WordPress
     
    11151140
    11161141/**
    1117  * wp_insert_term() - Adds a new term to the database. Optionally marks it as an alias of an existing term.
    1118  *
    1119  * Error handling is assigned for the nonexistance of the $taxonomy and $term parameters before inserting.
    1120  * If both the term id and taxonomy exist previously, then an array will be returned that contains the term
    1121  * id and the contents of what is returned. The keys of the array are 'term_id' and 'term_taxonomy_id' containing
    1122  * numeric values.
    1123  *
    1124  * It is assumed that the term does not yet exist or the above will apply. The term will be first added to the term
    1125  * table and then related to the taxonomy if everything is well. If everything is correct, then several actions
    1126  * will be run prior to a filter and then several actions will be run after the filter is run.
    1127  *
    1128  * The arguments decide how the term is handled based on the $args parameter. The following
    1129  * is a list of the available overrides and the defaults.
    1130  *
    1131  * 'alias_of'. There is no default, but if added, expected is the slug that the term will be an alias of.
    1132  * Expected to be a string.
    1133  *
    1134  * 'description'. There is no default. If exists, will be added to the database along with the term. Expected
    1135  * to be a string.
    1136  *
    1137  * 'parent'. Expected to be numeric and default is 0 (zero). Will assign value of 'parent' to the term.
     1142 * Adds a new term to the database. Optionally marks it as an alias of an existing term.
     1143 *
     1144 * Error handling is assigned for the nonexistance of the $taxonomy and $term
     1145 * parameters before inserting. If both the term id and taxonomy exist
     1146 * previously, then an array will be returned that contains the term id and the
     1147 * contents of what is returned. The keys of the array are 'term_id' and
     1148 * 'term_taxonomy_id' containing numeric values.
     1149 *
     1150 * It is assumed that the term does not yet exist or the above will apply. The
     1151 * term will be first added to the term table and then related to the taxonomy
     1152 * if everything is well. If everything is correct, then several actions will be
     1153 * run prior to a filter and then several actions will be run after the filter
     1154 * is run.
     1155 *
     1156 * The arguments decide how the term is handled based on the $args parameter.
     1157 * The following is a list of the available overrides and the defaults.
     1158 *
     1159 * 'alias_of'. There is no default, but if added, expected is the slug that the
     1160 * term will be an alias of. Expected to be a string.
     1161 *
     1162 * 'description'. There is no default. If exists, will be added to the database
     1163 * along with the term. Expected to be a string.
     1164 *
     1165 * 'parent'. Expected to be numeric and default is 0 (zero). Will assign value
     1166 * of 'parent' to the term.
    11381167 *
    11391168 * 'slug'. Expected to be a string. There is no default.
    11401169 *
    1141  * If 'slug' argument exists then the slug will be checked to see if it is not a valid term. If that check
    1142  * succeeds (it is not a valid term), then it is added and the term id is given. If it fails, then a check
    1143  * is made to whether the taxonomy is hierarchical and the parent argument is not empty. If the second check
    1144  * succeeds, the term will be inserted and the term id will be given.
     1170 * If 'slug' argument exists then the slug will be checked to see if it is not
     1171 * a valid term. If that check succeeds (it is not a valid term), then it is
     1172 * added and the term id is given. If it fails, then a check is made to whether
     1173 * the taxonomy is hierarchical and the parent argument is not empty. If the
     1174 * second check succeeds, the term will be inserted and the term id will be
     1175 * given.
    11451176 *
    11461177 * @package WordPress
     
    12361267
    12371268/**
    1238  * wp_set_object_terms() - Create Term and Taxonomy Relationships
    1239  *
    1240  * Relates an object (post, link etc) to a term and taxonomy type. Creates the term and taxonomy
    1241  * relationship if it doesn't already exist. Creates a term if it doesn't exist (using the slug).
    1242  *
    1243  * A relationship means that the term is grouped in or belongs to the taxonomy. A term has no
    1244  * meaning until it is given context by defining which taxonomy it exists under.
     1269 * Create Term and Taxonomy Relationships.
     1270 *
     1271 * Relates an object (post, link etc) to a term and taxonomy type. Creates the
     1272 * term and taxonomy relationship if it doesn't already exist. Creates a term if
     1273 * it doesn't exist (using the slug).
     1274 *
     1275 * A relationship means that the term is grouped in or belongs to the taxonomy.
     1276 * A term has no meaning until it is given context by defining which taxonomy it
     1277 * exists under.
    12451278 *
    12461279 * @package WordPress
     
    13161349
    13171350/**
    1318  * wp_unique_term_slug() - Will make slug unique, if it isn't already
    1319  *
    1320  * The $slug has to be unique global to every taxonomy, meaning that one taxonomy
    1321  * term can't have a matching slug with another taxonomy term. Each slug has to be
    1322  * globally unique for every taxonomy.
    1323  *
    1324  * The way this works is that if the taxonomy that the term belongs to is heirarchical
    1325  * and has a parent, it will append that parent to the $slug.
    1326  *
    1327  * If that still doesn't return an unique slug, then it try to append a number until
    1328  * it finds a number that is truely unique.
     1351 * Will make slug unique, if it isn't already.
     1352 *
     1353 * The $slug has to be unique global to every taxonomy, meaning that one
     1354 * taxonomy term can't have a matching slug with another taxonomy term. Each
     1355 * slug has to be globally unique for every taxonomy.
     1356 *
     1357 * The way this works is that if the taxonomy that the term belongs to is
     1358 * heirarchical and has a parent, it will append that parent to the $slug.
     1359 *
     1360 * If that still doesn't return an unique slug, then it try to append a number
     1361 * until it finds a number that is truely unique.
    13291362 *
    13301363 * The only purpose for $term is for appending a parent, if one exists.
     
    13771410
    13781411/**
    1379  * wp_update_term() - Update term based on arguments provided
    1380  *
    1381  * The $args will indiscriminately override all values with the same field name. Care
    1382  * must be taken to not override important information need to update or update will
    1383  * fail (or perhaps create a new term, neither would be acceptable).
    1384  *
    1385  * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not defined
    1386  * in $args already.
    1387  *
    1388  * 'alias_of' will create a term group, if it doesn't already exist, and update it for
    1389  * the $term.
    1390  *
    1391  * If the 'slug' argument in $args is missing, then the 'name' in $args will be used.
    1392  * It should also be noted that if you set 'slug' and it isn't unique then a WP_Error
    1393  * will be passed back. If you don't pass any slug, then a unique one will be created
    1394  * for you.
    1395  *
    1396  * For what can be overrode in $args, check the term scheme can contain and stay away
    1397  * from the term keys.
     1412 * Update term based on arguments provided.
     1413 *
     1414 * The $args will indiscriminately override all values with the same field name.
     1415 * Care must be taken to not override important information need to update or
     1416 * update will fail (or perhaps create a new term, neither would be acceptable).
     1417 *
     1418 * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not
     1419 * defined in $args already.
     1420 *
     1421 * 'alias_of' will create a term group, if it doesn't already exist, and update
     1422 * it for the $term.
     1423 *
     1424 * If the 'slug' argument in $args is missing, then the 'name' in $args will be
     1425 * used. It should also be noted that if you set 'slug' and it isn't unique then
     1426 * a WP_Error will be passed back. If you don't pass any slug, then a unique one
     1427 * will be created for you.
     1428 *
     1429 * For what can be overrode in $args, check the term scheme can contain and stay
     1430 * away from the term keys.
    13981431 *
    13991432 * @package WordPress
     
    14031436 * @uses $wpdb
    14041437 * @uses do_action() Will call both 'edit_term' and 'edit_$taxonomy' twice.
    1405  * @uses apply_filters() Will call the 'term_id_filter' filter and pass the term id and
    1406  *  taxonomy id.
     1438 * @uses apply_filters() Will call the 'term_id_filter' filter and pass the term
     1439 *  id and taxonomy id.
    14071440 *
    14081441 * @param int $term The ID of the term
     
    14901523}
    14911524
    1492 // enable or disable term count deferring
    1493 // if no value is supplied, the current value of the defer setting is returned
     1525/**
     1526 * Enable or disable term counting.
     1527 *
     1528 * @since 2.6
     1529 *
     1530 * @param bool $defer Optional.
     1531 * @return bool
     1532 */
    14941533function wp_defer_term_counting($defer=NULL) {
    14951534    static $_defer = false;
     
    15061545
    15071546/**
    1508  * wp_update_term_count() - Updates the amount of terms in taxonomy
    1509  *
    1510  * If there is a taxonomy callback applyed, then it will be called for updating the count.
    1511  *
    1512  * The default action is to count what the amount of terms have the relationship of term ID.
    1513  * Once that is done, then update the database.
     1547 * Updates the amount of terms in taxonomy.
     1548 *
     1549 * If there is a taxonomy callback applyed, then it will be called for updating
     1550 * the count.
     1551 *
     1552 * The default action is to count what the amount of terms have the relationship
     1553 * of term ID. Once that is done, then update the database.
    15141554 *
    15151555 * @package WordPress
     
    15481588}
    15491589
     1590/**
     1591 * Perform term count update immediately.
     1592 *
     1593 * @since 2.6
     1594 *
     1595 * @param array $terms IDs of Terms to update.
     1596 * @param string $taxonomy The context of the term.
     1597 * @return bool Always true when complete.
     1598 */
    15501599function wp_update_term_count_now( $terms, $taxonomy ) {
    15511600    global $wpdb;
     
    15741623//
    15751624
    1576 /**
    1577  * clean_object_term_cache() - Removes the taxonomy relationship to terms from the cache.
    1578  *
    1579  * Will remove the entire taxonomy relationship containing term $object_id. The term IDs
    1580  * have to exist within the taxonomy $object_type for the deletion to take place.
     1625
     1626/**
     1627 * Removes the taxonomy relationship to terms from the cache.
     1628 *
     1629 * Will remove the entire taxonomy relationship containing term $object_id. The
     1630 * term IDs have to exist within the taxonomy $object_type for the deletion to
     1631 * take place.
    15811632 *
    15821633 * @package WordPress
     
    16021653}
    16031654
    1604 /**
    1605  * clean_term_cache() - Will remove all of the term ids from the cache
     1655
     1656/**
     1657 * Will remove all of the term ids from the cache.
    16061658 *
    16071659 * @package WordPress
     
    16471699}
    16481700
    1649 /**
    1650  * get_object_term_cache() - Retrieves the taxonomy relationship to the term object id.
     1701
     1702/**
     1703 * Retrieves the taxonomy relationship to the term object id.
    16511704 *
    16521705 * @package WordPress
     
    16651718}
    16661719
    1667 /**
    1668  * update_object_term_cache() - Updates the cache for Term ID(s)
     1720
     1721/**
     1722 * Updates the cache for Term ID(s).
    16691723 *
    16701724 * Will only update the cache for terms not already cached.
    16711725 *
    1672  * The $object_ids expects that the ids be separated by commas, if it is
    1673  * a string.
    1674  *
    1675  * It should be noted that update_object_term_cache() is very time extensive.
    1676  * It is advised that the function is not called very often or at least not
    1677  * for a lot of terms that exist in a lot of taxonomies. The amount of time
    1678  * increases for each term and it also increases for each taxonomy the term
    1679  * belongs to.
     1726 * The $object_ids expects that the ids be separated by commas, if it is a
     1727 * string.
     1728 *
     1729 * It should be noted that update_object_term_cache() is very time extensive. It
     1730 * is advised that the function is not called very often or at least not for a
     1731 * lot of terms that exist in a lot of taxonomies. The amount of time increases
     1732 * for each term and it also increases for each taxonomy the term belongs to.
    16801733 *
    16811734 * @package WordPress
     
    17351788}
    17361789
    1737 /**
    1738  * update_term_cache() - Updates Terms to Taxonomy in cache.
     1790
     1791/**
     1792 * Updates Terms to Taxonomy in cache.
    17391793 *
    17401794 * @package WordPress
     
    17591813//
    17601814
    1761 /**
    1762  * _get_term_hierarchy() - Retrieves children of taxonomy
     1815
     1816/**
     1817 * Retrieves children of taxonomy.
    17631818 *
    17641819 * @package WordPress
     
    17671822 * @since 2.3
    17681823 *
    1769  * @uses update_option() Stores all of the children in "$taxonomy_children" option.
    1770  *  That is the name of the taxonomy, immediately followed by '_children'.
     1824 * @uses update_option() Stores all of the children in "$taxonomy_children"
     1825 *   option. That is the name of the taxonomy, immediately followed by '_children'.
    17711826 *
    17721827 * @param string $taxonomy Taxonomy Name
     
    17911846}
    17921847
    1793 /**
    1794  * _get_term_children() - Get array of child terms
    1795  *
    1796  * If $terms is an array of objects, then objects will returned from the function.
    1797  * If $terms is an array of IDs, then an array of ids of children will be returned.
     1848
     1849/**
     1850 * Get array of child terms.
     1851 *
     1852 * If $terms is an array of objects, then objects will returned from the
     1853 * function. If $terms is an array of IDs, then an array of ids of children will
     1854 * be returned.
    17981855 *
    17991856 * @package WordPress
     
    18471904}
    18481905
    1849 /**
    1850  * _pad_term_counts() - Add count of children to parent count
    1851  *
    1852  * Recalculates term counts by including items from child terms.
    1853  * Assumes all relevant children are already in the $terms argument
     1906
     1907/**
     1908 * Add count of children to parent count.
     1909 *
     1910 * Recalculates term counts by including items from child terms. Assumes all
     1911 * relevant children are already in the $terms argument.
    18541912 *
    18551913 * @package WordPress
     
    19111969
    19121970/**
    1913  * _update_post_term_count() - Will update term count based on posts
    1914  *
    1915  * Private function for the default callback for post_tag and category taxonomies.
     1971 * Will update term count based on posts.
     1972 *
     1973 * Private function for the default callback for post_tag and category
     1974 * taxonomies.
    19161975 *
    19171976 * @package WordPress
     
    19321991}
    19331992
    1934 /**
    1935  * get_term_link() - Generates a permalink for a taxonomy term archive
     1993
     1994/**
     1995 * Generates a permalink for a taxonomy term archive.
     1996 *
     1997 * @since 2.6
    19361998 *
    19371999 * @param object|int|string $term
     
    19762038}
    19772039
     2040/**
     2041 * Display the taxonomies of a post with available options.
     2042 *
     2043 * This function can be used within the loop to display the taxonomies for a
     2044 * post without specifying the Post ID. You can also use it outside the Loop to
     2045 * display the taxonomies for a specific post.
     2046 *
     2047 * The available defaults are:
     2048 * 'post' : default is 0. The post ID to get taxonomies of.
     2049 * 'before' : default is empty string. Display before taxonomies list.
     2050 * 'sep' : default is empty string. Separate every taxonomy with value in this.
     2051 * 'after' : default is empty string. Display this after the taxonomies list.
     2052 *
     2053 * @since 2.6
     2054 * @uses get_the_taxonomies()
     2055 *
     2056 * @param array $args Override the defaults.
     2057 */
    19782058function the_taxonomies($args = array()) {
    19792059    $defaults = array(
     
    19902070}
    19912071
     2072/**
     2073 * Retrieve all taxonomies associated with a post.
     2074 *
     2075 * This function can be used within the loop. It will also return an array of
     2076 * the taxonomies with links to the taxonomy and name.
     2077 *
     2078 * @since 2.6
     2079 *
     2080 * @param int $post Optional. Post ID or will use Global Post ID (in loop).
     2081 * @return array
     2082 */
    19922083function get_the_taxonomies($post = 0) {
    19932084    if ( is_int($post) )
     
    20272118}
    20282119
     2120/**
     2121 * Retrieve all taxonomies of a post with just the names.
     2122 *
     2123 * @since 2.6
     2124 * @uses get_object_taxonomies()
     2125 *
     2126 * @param int $post Optional. Post ID
     2127 * @return array
     2128 */
    20292129function get_post_taxonomies($post = 0) {
    20302130    $post =& get_post($post);
Note: See TracChangeset for help on using the changeset viewer.