### Eclipse Workspace Patch 1.0
#P wordpress-trunk
|
|
|
1191 | 1191 | * The second argument is called, 'order' and has the default value of 'ASC'. |
1192 | 1192 | * The only other value that will be acceptable is 'DESC'. |
1193 | 1193 | * |
1194 | | * The final argument supported is called, 'fields' and has the default value of |
| 1194 | * The third argument supported is called, 'fields' and has the default value of |
1195 | 1195 | * 'all'. There are multiple other options that can be used instead. Supported |
1196 | | * values are as follows: 'all', 'ids', 'names', and finally |
| 1196 | * values are as follows: 'all', 'ids', 'tt_ids', 'names', and finally |
1197 | 1197 | * 'all_with_object_id'. |
1198 | | * |
| 1198 | * |
1199 | 1199 | * The fields argument also decides what will be returned. If 'all' or |
1200 | 1200 | * 'all_with_object_id' is choosen or the default kept intact, then all matching |
1201 | | * terms objects will be returned. If either 'ids' or 'names' is used, then an |
1202 | | * array of all matching term ids or term names will be returned respectively. |
| 1201 | * terms objects will be returned. If either 'ids', 'tt_ids' or 'names' is used, then |
| 1202 | * an array of all matching term ids, undocumented (tt_ids) or term names will be |
| 1203 | * returned respectively. |
| 1204 | * |
| 1205 | * The fourth argument is called, 'select' and has the default value of 'all'. |
| 1206 | * The other value that is supported is 'distinct', which will ensure no duplicate |
| 1207 | * terms are returned (compare to SELECT ALL / SELECT DISTINCT in MySQL). |
1203 | 1208 | * |
1204 | 1209 | * @package WordPress |
1205 | 1210 | * @subpackage Taxonomy |
… |
… |
|
1226 | 1231 | $object_ids = array($object_ids); |
1227 | 1232 | $object_ids = array_map('intval', $object_ids); |
1228 | 1233 | |
1229 | | $defaults = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all'); |
| 1234 | $defaults = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all', 'select' => 'all'); |
1230 | 1235 | $args = wp_parse_args( $args, $defaults ); |
1231 | 1236 | |
1232 | 1237 | $terms = array(); |
… |
… |
|
1296 | 1301 | |
1297 | 1302 | if ( ! $terms ) |
1298 | 1303 | $terms = array(); |
| 1304 | |
| 1305 | if ( 'distinct' == $select ) { |
| 1306 | if ( in_array( $fields, array('ids', 'names', 'tt_ids') ) ) { |
| 1307 | $terms = array_unique( $terms ); |
| 1308 | } else { |
| 1309 | $_terms = array(); |
| 1310 | foreach( $terms as $key => $term ) |
| 1311 | $_terms[$term->term_id] =& $terms[$key]; |
| 1312 | $terms = $_terms; |
| 1313 | } |
| 1314 | } |
1299 | 1315 | |
1300 | 1316 | return apply_filters('wp_get_object_terms', $terms, $object_ids, $taxonomies, $args); |
1301 | 1317 | } |