Changeset 6092 for trunk/wp-includes/taxonomy.php
- Timestamp:
- 09/12/2007 02:56:44 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r6087 r6092 14 14 15 15 /** 16 * get_object_taxonomies() - Appears to return all of thenames that are of $object_type16 * get_object_taxonomies() - Return all of the taxonomy names that are of $object_type 17 17 * 18 18 * It appears that this function can be used to find all of the names inside of … … 32 32 * 33 33 * @internal 34 * This won't appear but just a note to say that this is all conjecture and parts or whole 35 * might be inaccurate or wrong. 34 * This is all conjecture and might be partially or completely inaccurate. 36 35 */ 37 36 function get_object_taxonomies($object_type) { … … 56 55 * @global array $wp_taxonomies 57 56 * @param string $taxonomy Name of taxonomy object to return 58 * @return object The Taxonomy Object57 * @return object|bool The Taxonomy Object or false if taxonomy doesn't exist 59 58 * 60 59 * @internal 61 * This won't appear but just a note to say that this is all conjecture and parts or whole 62 * might be inaccurate or wrong. 60 * This is all conjecture and might be partially or completely inaccurate. 63 61 */ 64 62 function get_taxonomy( $taxonomy ) { … … 80 78 * 81 79 * @internal 82 * This won't appear but just a note to say that this is all conjecture and parts or whole 83 * might be inaccurate or wrong. 80 * This is all conjecture and might be partially or completely inaccurate. 84 81 */ 85 82 function is_taxonomy( $taxonomy ) { … … 94 91 * Checks to make sure that the taxonomy is an object first. Then Gets the object, and finally 95 92 * returns the hierarchical value in the object. 93 * 94 * A false return value, might also mean that the taxonomy does not exist. 96 95 * 97 96 * @package Taxonomy … … 101 100 * 102 101 * @internal 103 * This won't appear but just a note to say that this is all conjecture and parts or whole 104 * might be inaccurate or wrong. 102 * This is all conjecture and might be partially or completely inaccurate. 105 103 */ 106 104 function is_taxonomy_hierarchical($taxonomy) { … … 123 121 * keys: hierarchical and update_count_callback. 124 122 * 125 * hierarachical has some defined purpose at other parts of the API , but is boolvalue.123 * hierarachical has some defined purpose at other parts of the API and is a boolean value. 126 124 * 127 125 * update_count_callback works much like a hook, in that it will be called (or something from … … 132 130 * @param string $taxonomy Name of taxonomy object 133 131 * @param string $object_type Name of the object type for the taxonomy object. 134 * @param array $args See above description for the two keys values.132 * @param array|string $args See above description for the two keys values. 135 133 * @return null Nothing is returned, so expect error maybe or use is_taxonomy() to check. 136 134 * 137 135 * @internal 138 * This won't appear but just a note to say that this is all conjecture and parts or whole 139 * might be inaccurate or wrong. 136 * This is all conjecture and might be partially or completely inaccurate. 140 137 */ 141 138 function register_taxonomy( $taxonomy, $object_type, $args = array() ) { … … 173 170 * @param string|array $terms String of term or array of string values of terms that will be used 174 171 * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names 175 * @param array $args Change the order of the object_ids, either ASC or DESC172 * @param array|string $args Change the order of the object_ids, either ASC or DESC 176 173 * @return object WP_Error - A PHP 4 compatible Exception class prototype 177 174 * @return array Empty array if there are no $object_ids … … 179 176 * 180 177 * @internal 181 * This won't appear but just a note to say that this is all conjecture and parts or whole 182 * might be inaccurate or wrong. 178 * This is all conjecture and might be partially or completely inaccurate. 183 179 */ 184 180 function get_objects_in_term( $terms, $taxonomies, $args = array() ) { … … 249 245 } 250 246 } 251 247 248 /** 249 * @internal 250 * Filter tag is basically: filter 'type' 'hook_name' 'description' 251 * 252 * Takes two parameters the term Object and the taxonomy name. Must return term object. 253 * @filter object get_term Used in @see get_term() as a catch-all filter for every $term 254 */ 252 255 $_term = apply_filters('get_term', $_term, $taxonomy); 256 /** 257 * @internal 258 * Filter tag is basically: filter 'type' 'hook_name' 'description' 259 * 260 * Takes two parameters the term Object and the taxonomy name. Must return term object. 261 * $taxonomy will be the taxonomy name, so for example, if 'category', it would be 'get_category' 262 * as the filter name. 263 * Useful for custom taxonomies or plugging into default taxonomies. 264 * @filter object get_$taxonomy Used in @see get_term() as specific filter for each $taxonomy. 265 */ 253 266 $_term = apply_filters("get_$taxonomy", $_term, $taxonomy); 254 267 $_term = sanitize_term($_term, $taxonomy, $filter); … … 321 334 } 322 335 336 /** 337 * get_term_children() - Merge all term children into a single array. 338 * 339 * This recursive function will merge all of the children of $term into 340 * the same array. 341 * 342 * Only useful for taxonomies which are hierarchical. 343 * 344 * @package Taxonomy 345 * @subpackage Term 346 * @global object $wpdb Database Query 347 * @param string $term Name of Term to get children 348 * @param string $taxonomy Taxonomy Name 349 * @return array List of Term Objects 350 * 351 * @internal 352 * This is all conjecture and might be partially or completely inaccurate. 353 */ 323 354 function get_term_children( $term, $taxonomy ) { 324 355 if ( ! is_taxonomy($taxonomy) ) … … 340 371 } 341 372 373 /** 374 * get_term_field() - Get sanitized Term field 375 * 376 * Does checks for $term, based on the $taxonomy. The function is for 377 * contextual reasons and for simplicity of usage. @see sanitize_term_field() for 378 * more information. 379 * 380 * @package Taxonomy 381 * @subpackage Term 382 * @param string $field Term field to fetch 383 * @param int $term Term ID 384 * @param string $taxonomy Taxonomy Name 385 * @param string $context ?? 386 * @return mixed @see sanitize_term_field() 387 * 388 * @internal 389 * This is all conjecture and might be partially or completely inaccurate. 390 */ 342 391 function get_term_field( $field, $term, $taxonomy, $context = 'display' ) { 343 392 $term = (int) $term; … … 356 405 } 357 406 407 /** 408 * get_term_to_edit() - Sanitizes Term for editing 409 * 410 * Return value is @see sanitize_term() and usage is for sanitizing the term 411 * for editing. Function is for contextual and simplicity. 412 * 413 * @package Taxonomy 414 * @subpackage Term 415 * @param int|object $id Term ID or Object 416 * @param string $taxonomy Taxonomy Name 417 * @return mixed @see sanitize_term() 418 * 419 * @internal 420 * This is all conjecture and might be partially or completely inaccurate. 421 */ 358 422 function get_term_to_edit( $id, $taxonomy ) { 359 423 $term = get_term( $id, $taxonomy ); … … 368 432 } 369 433 434 /** 435 * get_terms() - 436 * 437 * 438 * 439 * @package Taxonomy 440 * @subpackage Term 441 * @param string|array Taxonomy name or list of Taxonomy names 442 * @param string|array $args ?? 443 * @return array List of Term Objects and their children. 444 * 445 * @internal 446 * This is all conjecture and might be partially or completely inaccurate. 447 */ 370 448 function &get_terms($taxonomies, $args = '') { 371 449 global $wpdb; … … 542 620 543 621 /** 622 * is_term() - Check if Term exists 623 * 544 624 * Returns the index of a defined term, or 0 (false) if the term doesn't exist. 625 * 626 * @global $wpdb Database Object 627 * @param int|string $term The term to check 628 * @param string $taxonomy The taxonomy name to use 629 * @return mixed Get the term id or Term Object, if exists. 545 630 */ 546 631 function is_term($term, $taxonomy = '') { … … 565 650 } 566 651 652 /** 653 * sanitize_term() - Sanitize Term all fields 654 * 655 * Relys on @see sanitize_term_field() to sanitize the term. The difference 656 * is that this function will sanitize <strong>all</strong> fields. The context 657 * is based on @see sanitize_term_field(). 658 * 659 * The $term is expected to be either an array or an object. 660 * 661 * @param array|object $term The term to check 662 * @param string $taxonomy The taxonomy name to use 663 * @param string $context Default is display 664 * @return array|object Term with all fields sanitized 665 */ 567 666 function sanitize_term($term, $taxonomy, $context = 'display') { 568 667 $fields = array('term_id', 'name', 'description', 'slug', 'count', 'parent', 'term_group'); … … 582 681 } 583 682 683 /** 684 * sanitize_term_field() - 685 * 686 * 687 * 688 * @global object $wpdb Database Object 689 * @param string $field Term field to sanitize 690 * @param string $value Search for this term value 691 * @param int $term_id Term ID 692 * @param string $taxonomy Taxonomy Name 693 * @param string $context Either edit, db, display, attribute, or js. 694 * @return mixed sanitized field 695 */ 584 696 function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) { 585 697 if ( 'parent' == $field || 'term_id' == $field || 'count' == $field … … 614 726 } 615 727 728 /** 729 * wp_count_terms() - Count how many terms are in Taxonomy 730 * 731 * Default $args is 'ignore_empty' which can be @example 'ignore_empty=true' or 732 * @example array('ignore_empty' => true); See @see wp_parse_args() for more 733 * information on parsing $args. 734 * 735 * @global object $wpdb Database Object 736 * @param string $taxonomy Taxonomy name 737 * @param array|string $args Overwrite defaults 738 * @return int How many terms are in $taxonomy 739 */ 616 740 function wp_count_terms( $taxonomy, $args = array() ) { 617 741 global $wpdb; … … 628 752 } 629 753 754 /** 755 * wp_delete_object_term_relationships() - 756 * 757 * 758 * 759 * @global object $wpdb Database Object 760 * @param int $object_id ?? 761 * @param string|array $taxonomy List of Taxonomy Names or single Taxonomy name. 762 */ 630 763 function wp_delete_object_term_relationships( $object_id, $taxonomies ) { 631 764 global $wpdb; … … 757 890 758 891 /** 759 * Adds a new term to the database. Optionally marks it as an alias of an existing term. 892 * wp_insert_term() - Adds a new term to the database. Optionally marks it as an alias of an existing term. 893 * 894 * 895 * 896 * @global $wpdb Database Object 760 897 * @param int|string $term The term to add or update. 761 898 * @param string $taxonomy The taxonomy to which to add the term 762 * @param int|string $alias_of The id or slug of the new term's alias. 899 * @param array|string $args Change the values of the inserted term 900 * @return array The Term ID and Term Taxonomy ID 763 901 */ 764 902 function wp_insert_term( $term, $taxonomy, $args = array() ) { … … 825 963 826 964 /** 965 * wp_set_object_terms() - 966 * 827 967 * Relates an object (post, link etc) to a term and taxonomy type. Creates the term and taxonomy 828 968 * relationship if it doesn't already exist. Creates a term if it doesn't exist (using the slug). 969 * 970 * @global $wpdb Database Object 829 971 * @param int $object_id The object to relate to. 830 972 * @param array|int|string $term The slug or id of the term. 831 973 * @param array|string $taxonomy The context in which to relate the term to the object. 974 * @param bool $append If false will delete difference of terms. 832 975 */ 833 976 function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
Note: See TracChangeset
for help on using the changeset viewer.