Changeset 3840
- Timestamp:
- 04/15/2012 01:49:07 AM (12 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-common-functions.php
r3839 r3840 469 469 'count_empty_tags' => true 470 470 ); 471 472 $r = wp_parse_args( $args, $defaults ); 471 $r = bbp_parse_args( $args, $defaults, 'get_statistics' ); 473 472 extract( $r ); 474 473 … … 619 618 return false; 620 619 621 $query_args = wp_parse_args( $query_args);620 $query_args = bbp_parse_args( $query_args, '', 'register_view' ); 622 621 623 622 // Set exclude_stickies to true if it wasn't supplied … … 675 674 676 675 if ( !empty( $new_args ) ) { 677 $new_args = wp_parse_args( $new_args);676 $new_args = bbp_parse_args( $new_args, '', 'view_query' ); 678 677 $query_args = array_merge( $query_args, $new_args ); 679 678 } … … 732 731 'bbp_anonymous_website' => !empty( $_POST['bbp_anonymous_website'] ) ? $_POST['bbp_anonymous_website'] : false, 733 732 ); 734 735 $r = wp_parse_args( $args, $defaults ); 733 $r = bbp_parse_args( $args, $defaults, 'filter_anonymous_post_data' ); 736 734 extract( $r ); 737 735 … … 1239 1237 1240 1238 /** 1239 * Merge user defined arguments into defaults array. 1240 * 1241 * This function is used throughout bbPress to allow for either a string or array 1242 * to be merged into another array. It is identical to wp_parse_args() except 1243 * it allows for arguments to be passively or aggressively filtered using the 1244 * optional $filter_key parameter. 1245 * 1246 * @since bbPress (r3839) 1247 * 1248 * @param string|array $args Value to merge with $defaults 1249 * @param array $defaults Array that serves as the defaults. 1250 * @param string $filter_key String to key the filters from 1251 * @return array Merged user defined values with defaults. 1252 */ 1253 function bbp_parse_args( $args, $defaults = '', $filter_key = '' ) { 1254 1255 // Setup a temporary array from $args 1256 if ( is_object( $args ) ) 1257 $r = get_object_vars( $args ); 1258 elseif ( is_array( $args ) ) 1259 $r =& $args; 1260 else 1261 wp_parse_str( $args, $r ); 1262 1263 // Passively filter the args before the parse 1264 if ( !empty( $filter_key ) ) 1265 $r = apply_filters( 'bbp_before_' . $filter_key . '_parse_args', $r ); 1266 1267 // Parse 1268 if ( is_array( $defaults ) ) 1269 $r = array_merge( $defaults, $r ); 1270 1271 // Aggressively filter the args after the parse 1272 if ( !empty( $filter_key ) ) 1273 $r = apply_filters( 'bbp_after_' . $filter_key . '_parse_args', $r ); 1274 1275 // Return the parsed results 1276 return $r; 1277 } 1278 1279 /** 1241 1280 * Adds ability to include or exclude specific post_parent ID's 1242 1281 * -
branches/plugin/bbp-includes/bbp-common-template.php
r3797 r3840 840 840 'context' => '' 841 841 ); 842 $r = wp_parse_args( $args, $defaults);842 $r = bbp_parse_args( $args, $defaults, 'login_action' ); 843 843 extract( $r ); 844 844 … … 1062 1062 'disable_categories' => true 1063 1063 ); 1064 1065 $r = wp_parse_args( $args, $defaults ); 1064 $r = bbp_parse_args( $args, $defaults, 'get_dropdown' ); 1066 1065 1067 1066 if ( empty( $r['walker'] ) ) { … … 1390 1389 'quicktags' => true 1391 1390 ); 1392 $r = apply_filters( 'bbp_pre_the_content', wp_parse_args( $args, $defaults ));1391 $r = bbp_parse_args( $args, $defaults, 'get_the_content' ); 1393 1392 extract( $r ); 1394 1393 … … 1794 1793 'current_text' => $pre_current_text 1795 1794 ); 1796 $r = apply_filters( 'bbp_get_breadcrumb_pre', wp_parse_args( $args, $defaults ));1795 $r = bbp_parse_args( $args, $defaults, 'get_breadcrumb' ); 1797 1796 extract( $r ); 1798 1797 -
branches/plugin/bbp-includes/bbp-core-update.php
r3798 r3840 170 170 'reply_content' => __( 'Oh, and this is what a reply looks like.', 'bbpress' ), 171 171 ); 172 $r = wp_parse_args( apply_filters( 'bbp_pre_create_initial_content', $args ), $defaults);172 $r = bbp_parse_args( $args, $defaults, 'create_initial_content' ); 173 173 extract( $r ); 174 174 -
branches/plugin/bbp-includes/bbp-extend-buddypress.php
r3804 r3840 293 293 * @uses bbp_get_current_user_id() 294 294 * @uses bp_core_current_time() 295 * @uses wp_parse_args()295 * @uses bbp_parse_args() 296 296 * @uses aplly_filters() 297 297 * @uses bp_activity_add() … … 317 317 'hide_sitewide' => false 318 318 ); 319 320 // Parse the difference 321 $activity = wp_parse_args( $args, $defaults ); 322 323 // Just in-time filtering of activity stream contents 324 $activity = apply_filters( 'bbp_record_activity', $activity ); 319 $activity = bbp_parse_args( $args, $defaults, 'record_activity' ); 325 320 326 321 // Add the activity … … 335 330 * @uses bbp_get_current_user_id() 336 331 * @uses bp_core_current_time() 337 * @uses wp_parse_args()332 * @uses bbp_parse_args() 338 333 * @uses aplly_filters() 339 334 * @uses bp_activity_add() … … 354 349 'secondary_item_id' => false 355 350 ); 356 357 // Parse the differenc 358 $activity = wp_parse_args( $args, $defaults ); 359 360 // Just in-time filtering of activity stream contents 361 $activity = apply_filters( 'bbp_delete_activity', $activity ); 351 $activity = bbp_parse_args( $args, $defaults, 'delete_activity' ); 362 352 363 353 // Delete the activity -
branches/plugin/bbp-includes/bbp-forum-functions.php
r3826 r3840 19 19 * @since bbPress (r3349) 20 20 * 21 * @uses wp_parse_args()21 * @uses bbp_parse_args() 22 22 * @uses bbp_get_forum_post_type() 23 23 * @uses wp_insert_post() … … 41 41 'comment_status' => 'closed' 42 42 ); 43 44 // Parse args 45 $forum_data = wp_parse_args( $forum_data, $default_forum ); 43 $forum_data = bbp_parse_args( $forum_data, $default_forum, 'insert_forum' ); 46 44 47 45 // Insert forum … … 65 63 'forum_subforum_count' => 0, 66 64 ); 67 68 // Parse args 69 $forum_meta = wp_parse_args( $forum_meta, $default_meta ); 65 $forum_meta = bbp_parse_args( $forum_meta, $default_meta, 'insert_forum_meta' ); 70 66 71 67 // Insert forum meta … … 1498 1494 'last_active_status' => bbp_get_public_status_id() 1499 1495 ); 1500 1501 $r = wp_parse_args( $args, $defaults ); 1496 $r = bbp_parse_args( $args, $defaults, 'update_forum' ); 1502 1497 extract( $r ); 1503 1498 -
branches/plugin/bbp-includes/bbp-forum-template.php
r3836 r3840 79 79 80 80 // The default forum query for most circumstances 81 $default = array (81 $defaults = array ( 82 82 'post_type' => bbp_get_forum_post_type(), 83 83 'post_parent' => bbp_is_forum_archive() ? 0 : bbp_get_forum_id() , … … 87 87 'order' => 'ASC' 88 88 ); 89 90 // Filter the default arguments 91 $args = apply_filters( 'bbp_pre_has_forums_query', $args ); 92 93 // Parse the default against what is requested 94 $bbp_f = wp_parse_args( $args, $default ); 95 96 // Filter the forums query to allow just-in-time modifications 97 $bbp_f = apply_filters( 'bbp_has_forums_query', $bbp_f ); 89 $bbp_f = bbp_parse_args( $args, $defaults, 'has_forums' ); 98 90 99 91 // Run the query … … 639 631 640 632 // Check if user can read private forums 641 if ( current_user_can( 'read_private_forums' ) ) 633 if ( current_user_can( 'read_private_forums' ) ) { 642 634 $post_stati[] = bbp_get_private_status_id(); 635 } 643 636 644 637 // Check if user can read hidden forums 645 if ( current_user_can( 'read_hidden_forums' ) ) 638 if ( current_user_can( 'read_hidden_forums' ) ) { 646 639 $post_stati[] = bbp_get_hidden_status_id(); 647 } 648 649 $default = array( 640 } 641 } 642 643 $defaults = array( 650 644 'post_parent' => 0, 651 645 'post_type' => bbp_get_forum_post_type(), … … 655 649 'order' => 'ASC' 656 650 ); 657 658 $r = wp_parse_args( $args, $default ); 651 $r = bbp_parse_args( $args, $defaults, 'forum_get_subforums' ); 659 652 $r['post_parent'] = bbp_get_forum_id( $r['post_parent'] ); 660 653 … … 705 698 'show_reply_count' => true, 706 699 ); 707 $r = wp_parse_args( $args, $defaults);700 $r = bbp_parse_args( $args, $defaults, 'list_forums' ); 708 701 extract( $r, EXTR_SKIP ); 709 702 … … 1827 1820 'feed' => true 1828 1821 ); 1829 $r = wp_parse_args( $args, $defaults);1822 $r = bbp_parse_args( $args, $defaults, 'get_single_forum_description' ); 1830 1823 extract( $r ); 1831 1824 -
branches/plugin/bbp-includes/bbp-reply-functions.php
r3808 r3840 19 19 * @since bbPress (r3349) 20 20 * 21 * @uses wp_parse_args()21 * @uses bbp_parse_args() 22 22 * @uses bbp_get_reply_post_type() 23 23 * @uses wp_insert_post() … … 41 41 'comment_status' => 'closed' 42 42 ); 43 44 // Parse args 45 $reply_data = wp_parse_args( $reply_data, $default_reply ); 43 $reply_data = bbp_parse_args( $reply_data, $default_reply, 'insert_reply' ); 46 44 47 45 // Insert reply … … 58 56 'topic_id' => 0, 59 57 ); 60 61 // Parse args 62 $reply_meta = wp_parse_args( $reply_meta, $default_meta ); 58 $reply_meta = bbp_parse_args( $reply_meta, $default_meta, 'insert_reply_meta' ); 63 59 64 60 // Insert reply meta … … 641 637 'bbp_anonymous_website' => '', 642 638 ); 643 $r = wp_parse_args( $anonymous_data, $defaults);639 $r = bbp_parse_args( $anonymous_data, $defaults, 'update_reply' ); 644 640 645 641 // Update all anonymous metas … … 933 929 ); 934 930 935 $r = wp_parse_args( $args, $defaults);931 $r = bbp_parse_args( $args, $defaults, 'update_reply_revision_log' ); 936 932 extract( $r ); 937 933 -
branches/plugin/bbp-includes/bbp-reply-template.php
r3824 r3840 117 117 $default = array_merge( $parent_args, $default ); 118 118 119 // Filter the default arguments120 $args = apply_filters( 'bbp_pre_has_replies_query', $args );121 122 119 // Set up topic variables 123 $bbp_r = wp_parse_args( $args, $default ); 124 125 // Filter the replies query to allow just-in-time modifications 126 $bbp_r = apply_filters( 'bbp_has_replies_query', $bbp_r ); 120 $bbp_r = bbp_parse_args( $args, $default, 'has_replies' ); 127 121 128 122 // Extract the query variables … … 984 978 'sep' => ' ' 985 979 ); 986 $r = wp_parse_args( $args, $defaults);980 $r = bbp_parse_args( $args, $defaults, 'get_reply_author_link' ); 987 981 extract( $r ); 988 982 … … 1363 1357 'links' => array() 1364 1358 ); 1365 $r = wp_parse_args( $args, $defaults);1359 $r = bbp_parse_args( $args, $defaults, 'get_reply_admin_links' ); 1366 1360 1367 1361 $r['id'] = bbp_get_reply_id( (int) $r['id'] ); … … 1456 1450 'edit_text' => __( 'Edit', 'bbpress' ) 1457 1451 ); 1458 $r = wp_parse_args( $args, $defaults);1452 $r = bbp_parse_args( $args, $defaults, 'get_reply_edit_link' ); 1459 1453 extract( $r ); 1460 1454 … … 1578 1572 'delete_text' => __( 'Delete', 'bbpress' ) 1579 1573 ); 1580 $r = wp_parse_args( $args, $defaults);1574 $r = bbp_parse_args( $args, $defaults, 'get_reply_trash_link' ); 1581 1575 extract( $r ); 1582 1576 … … 1648 1642 'unspam_text' => __( 'Unspam', 'bbpress' ) 1649 1643 ); 1650 $r = wp_parse_args( $args, $defaults);1644 $r = bbp_parse_args( $args, $defaults, 'get_reply_spam_link' ); 1651 1645 extract( $r ); 1652 1646 … … 1712 1706 'split_title' => __( 'Split the topic from this reply', 'bbpress' ) 1713 1707 ); 1714 $r = wp_parse_args( $args, $defaults);1708 $r = bbp_parse_args( $args, $defaults, 'get_topic_split_link' ); 1715 1709 extract( $r ); 1716 1710 -
branches/plugin/bbp-includes/bbp-theme-compatibility.php
r3830 r3840 278 278 ); 279 279 } 280 $dummy = wp_parse_args( $args, $defaults);280 $dummy = bbp_parse_args( $args, $defaults, 'theme_compat_reset_post' ); 281 281 282 282 // Clear out the post related globals -
branches/plugin/bbp-includes/bbp-topic-functions.php
r3826 r3840 19 19 * @since bbPress (r3349) 20 20 * 21 * @uses wp_parse_args()21 * @uses bbp_parse_args() 22 22 * @uses bbp_get_topic_post_type() 23 23 * @uses wp_insert_post() … … 43 43 44 44 // Parse args 45 $topic_data = wp_parse_args( $topic_data, $default_topic);45 $topic_data = bbp_parse_args( $topic_data, $default_topic, 'insert_topic' ); 46 46 47 47 // Insert topic … … 66 66 67 67 // Parse args 68 $topic_meta = wp_parse_args( $topic_meta, $default_meta);68 $topic_meta = bbp_parse_args( $topic_meta, $default_meta, 'insert_topic_meta' ); 69 69 70 70 // Insert topic meta … … 740 740 'bbp_anonymous_website' => '', 741 741 ); 742 $r = wp_parse_args( $anonymous_data, $defaults);742 $r = bbp_parse_args( $anonymous_data, $defaults, 'update_topic' ); 743 743 744 744 // Update all anonymous metas … … 2444 2444 'revision_id' => 0 2445 2445 ); 2446 2447 $r = wp_parse_args( $args, $defaults ); 2446 $r = bbp_parse_args( $args, $defaults, 'update_topic_revision_log' ); 2448 2447 extract( $r ); 2449 2448 -
branches/plugin/bbp-includes/bbp-topic-template.php
r3836 r3840 115 115 $default['taxonomy'] = bbp_get_topic_tag_tax_id(); 116 116 } 117 118 // Filter the default arguments 119 $args = apply_filters( 'bbp_pre_has_topics_query', $args ); 120 121 // Set up topic variables 122 $bbp_t = wp_parse_args( $args, $default ); 123 124 // Filter the topics query to allow just-in-time modifications 125 $bbp_t = apply_filters( 'bbp_has_topics_query', $bbp_t ); 117 $bbp_t = bbp_parse_args( $args, $default, 'has_topics' ); 126 118 127 119 // Extract the query variables … … 677 669 'after' => '</span>', 678 670 ); 679 680 $r = wp_parse_args( $args, $defaults ); 671 $r = bbp_parse_args( $args, $defaults, 'get_topic_pagination' ); 681 672 extract( $r ); 682 673 … … 1258 1249 'sep' => ' ' 1259 1250 ); 1260 1261 $r = wp_parse_args( $args, $defaults ); 1251 $r = bbp_parse_args( $args, $defaults, 'get_topic_author_link' ); 1262 1252 extract( $r ); 1263 1253 … … 1938 1928 'after' => '</p></div>' 1939 1929 ); 1940 1941 $r = wp_parse_args( $args, $defaults ); 1930 $r = bbp_parse_args( $args, $defaults, 'get_topic_tag_list' ); 1942 1931 extract( $r ); 1943 1932 … … 2058 2047 'links' => array() 2059 2048 ); 2060 2061 $r = wp_parse_args( $args, $defaults ); 2049 $r = bbp_parse_args( $args, $defaults, 'get_topic_admin_links' ); 2062 2050 2063 2051 if ( !current_user_can( 'edit_topic', $r['id'] ) ) … … 2139 2127 'edit_text' => __( 'Edit', 'bbpress' ) 2140 2128 ); 2141 2142 $r = wp_parse_args( $args, $defaults ); 2129 $r = bbp_parse_args( $args, $defaults, 'get_topic_edit_link' ); 2143 2130 extract( $r ); 2144 2131 … … 2263 2250 'delete_text' => __( 'Delete', 'bbpress' ) 2264 2251 ); 2265 $r = wp_parse_args( $args, $defaults);2252 $r = bbp_parse_args( $args, $defaults, 'get_topic_trash_link' ); 2266 2253 extract( $r ); 2267 2254 … … 2332 2319 'open_text' => _x( 'Open', 'Topic Status', 'bbpress' ) 2333 2320 ); 2334 2335 $r = wp_parse_args( $args, $defaults ); 2321 $r = bbp_parse_args( $args, $defaults, 'get_topic_close_link' ); 2336 2322 extract( $r ); 2337 2323 … … 2394 2380 'super_text' => __( 'to front', 'bbpress' ), 2395 2381 ); 2396 2397 $r = wp_parse_args( $args, $defaults ); 2382 $r = bbp_parse_args( $args, $defaults, 'get_topic_stick_link' ); 2398 2383 extract( $r ); 2399 2384 … … 2464 2449 'merge_text' => __( 'Merge', 'bbpress' ), 2465 2450 ); 2466 2467 $r = wp_parse_args( $args, $defaults ); 2451 $r = bbp_parse_args( $args, $defaults, 'get_topic_merge_link' ); 2468 2452 extract( $r ); 2469 2453 … … 2522 2506 'unspam_text' => __( 'Unspam', 'bbpress' ) 2523 2507 ); 2524 $r = wp_parse_args( $args, $defaults);2508 $r = bbp_parse_args( $args, $defaults, 'get_topic_spam_link' ); 2525 2509 extract( $r ); 2526 2510 … … 2689 2673 'topic_id' => 0 2690 2674 ); 2691 2692 $r = wp_parse_args( $args, $defaults ); 2675 $r = bbp_parse_args( $args, $defaults, 'topic_type_select' ); 2693 2676 extract( $r ); 2694 2677 … … 2791 2774 'size' => 14 2792 2775 ); 2793 $r = wp_parse_args( $args, $defaults);2776 $r = bbp_parse_args( $args, $defaults, 'get_single_topic_description' ); 2794 2777 extract( $r ); 2795 2778 … … 3087 3070 'tag' => '' 3088 3071 ); 3089 $r = wp_parse_args( $args, $defaults);3072 $r = bbp_parse_args( $args, $defaults, 'get_topic_tag_description' ); 3090 3073 extract( $r ); 3091 3074 -
branches/plugin/bbp-includes/bbp-user-template.php
r3838 r3840 439 439 'after' => '' 440 440 ); 441 $args = wp_parse_args( $args, $defaults);441 $args = bbp_parse_args( $args, $defaults, 'get_admin_link' ); 442 442 extract( $args, EXTR_SKIP ); 443 443 … … 479 479 ); 480 480 481 $r = wp_parse_args( $args, $defaults);481 $r = bbp_parse_args( $args, $defaults, 'get_author_ip' ); 482 482 extract( $r ); 483 483 … … 700 700 'after' => '' 701 701 ); 702 703 $args = wp_parse_args( $args, $defaults ); 702 $args = bbp_parse_args( $args, $defaults, 'get_user_subscribe_link' ); 704 703 extract( $args ); 705 704 … … 1075 1074 'size' => 80 1076 1075 ); 1077 $r = wp_parse_args( $args, $defaults);1076 $r = bbp_parse_args( $args, $defaults, 'get_author_link' ); 1078 1077 extract( $r ); 1079 1078 … … 1147 1146 * @uses bbp_get_forum_id() 1148 1147 * @uses bbp_allow_anonymous() 1149 * @uses wp_parse_args()1148 * @uses bbp_parse_args() 1150 1149 * @uses bbp_get_user_id() 1151 1150 * @uses current_user_can() … … 1167 1166 'check_ancestors' => false 1168 1167 ); 1169 $r = wp_parse_args( $args, $defaults);1168 $r = bbp_parse_args( $args, $defaults, 'user_can_view_forum' ); 1170 1169 extract( $r ); 1171 1170 … … 1296 1295 1297 1296 /** 1297 * Get the forums the current user has the ability to see and post to 1298 1298 * 1299 1299 * @since bbPress (r3127) … … 1331 1331 'exclude' => $post__not_in 1332 1332 ); 1333 $r = wp_parse_args( $args, $defaults);1333 $r = bbp_parse_args( $args, $defaults, 'get_forums_for_current_user' ); 1334 1334 1335 1335 // Get the forums
Note: See TracChangeset
for help on using the changeset viewer.