Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Introduce bbp_parse_args() and pass filter keys into its usages.

* Parsed args to be passively or aggressively filtered
* Allows functions that normally require passing parsed $args to instead filter or override results

git-svn-id: http://bbpress.svn.wordpress.org/branches/plugin@3840 9866e705-20ec-0310-96e7-cbb4277adcfb
  • Loading branch information...
commit fe5bb01b626f813dfa4452c13e6369e99dce67a0 1 parent 9f200f9
johnjamesjacoby authored
View
51 bbp-includes/bbp-common-functions.php
@@ -468,8 +468,7 @@ function bbp_get_statistics( $args = '' ) {
'count_tags' => true,
'count_empty_tags' => true
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_statistics' );
extract( $r );
// Users
@@ -618,7 +617,7 @@ function bbp_register_view( $view, $title, $query_args = '', $feed = true ) {
if ( empty( $view ) || empty( $title ) )
return false;
- $query_args = wp_parse_args( $query_args );
+ $query_args = bbp_parse_args( $query_args, '', 'register_view' );
// Set exclude_stickies to true if it wasn't supplied
if ( !isset( $query_args['show_stickies'] ) )
@@ -674,7 +673,7 @@ function bbp_view_query( $view = '', $new_args = '' ) {
$query_args = bbp_get_view_query_args( $view );
if ( !empty( $new_args ) ) {
- $new_args = wp_parse_args( $new_args );
+ $new_args = bbp_parse_args( $new_args, '', 'view_query' );
$query_args = array_merge( $query_args, $new_args );
}
@@ -731,8 +730,7 @@ function bbp_filter_anonymous_post_data( $args = '' ) {
'bbp_anonymous_email' => !empty( $_POST['bbp_anonymous_email'] ) ? $_POST['bbp_anonymous_email'] : false,
'bbp_anonymous_website' => !empty( $_POST['bbp_anonymous_website'] ) ? $_POST['bbp_anonymous_website'] : false,
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'filter_anonymous_post_data' );
extract( $r );
// Filter variables and add errors if necessary
@@ -1238,6 +1236,47 @@ function bbp_logout_url( $url = '', $redirect_to = '' ) {
/** Queries *******************************************************************/
/**
+ * Merge user defined arguments into defaults array.
+ *
+ * This function is used throughout bbPress to allow for either a string or array
+ * to be merged into another array. It is identical to wp_parse_args() except
+ * it allows for arguments to be passively or aggressively filtered using the
+ * optional $filter_key parameter.
+ *
+ * @since bbPress (r3839)
+ *
+ * @param string|array $args Value to merge with $defaults
+ * @param array $defaults Array that serves as the defaults.
+ * @param string $filter_key String to key the filters from
+ * @return array Merged user defined values with defaults.
+ */
+function bbp_parse_args( $args, $defaults = '', $filter_key = '' ) {
+
+ // Setup a temporary array from $args
+ if ( is_object( $args ) )
+ $r = get_object_vars( $args );
+ elseif ( is_array( $args ) )
+ $r =& $args;
+ else
+ wp_parse_str( $args, $r );
+
+ // Passively filter the args before the parse
+ if ( !empty( $filter_key ) )
+ $r = apply_filters( 'bbp_before_' . $filter_key . '_parse_args', $r );
+
+ // Parse
+ if ( is_array( $defaults ) )
+ $r = array_merge( $defaults, $r );
+
+ // Aggressively filter the args after the parse
+ if ( !empty( $filter_key ) )
+ $r = apply_filters( 'bbp_after_' . $filter_key . '_parse_args', $r );
+
+ // Return the parsed results
+ return $r;
+}
+
+/**
* Adds ability to include or exclude specific post_parent ID's
*
* @since bbPress (r2996)
View
9 bbp-includes/bbp-common-template.php
@@ -839,7 +839,7 @@ function bbp_wp_login_action( $args = '' ) {
'action' => '',
'context' => ''
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'login_action' );
extract( $r );
if ( !empty( $action ) )
@@ -1061,8 +1061,7 @@ function bbp_get_dropdown( $args = '' ) {
'none_found' => false,
'disable_categories' => true
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_dropdown' );
if ( empty( $r['walker'] ) ) {
$r['walker'] = new BBP_Walker_Dropdown();
@@ -1389,7 +1388,7 @@ function bbp_get_the_content( $args = array() ) {
'tinymce' => true,
'quicktags' => true
);
- $r = apply_filters( 'bbp_pre_the_content', wp_parse_args( $args, $defaults ) );
+ $r = bbp_parse_args( $args, $defaults, 'get_the_content' );
extract( $r );
// Assume we are not editing
@@ -1793,7 +1792,7 @@ function bbp_get_breadcrumb( $args = array() ) {
'include_current' => $pre_include_current,
'current_text' => $pre_current_text
);
- $r = apply_filters( 'bbp_get_breadcrumb_pre', wp_parse_args( $args, $defaults ) );
+ $r = bbp_parse_args( $args, $defaults, 'get_breadcrumb' );
extract( $r );
/** Ancestors *********************************************************/
View
2  bbp-includes/bbp-core-update.php
@@ -169,7 +169,7 @@ function bbp_create_initial_content( $args = array() ) {
'reply_title' => __( 'Re: Hello World!', 'bbpress' ),
'reply_content' => __( 'Oh, and this is what a reply looks like.', 'bbpress' ),
);
- $r = wp_parse_args( apply_filters( 'bbp_pre_create_initial_content', $args ), $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'create_initial_content' );
extract( $r );
// Create the initial forum
View
18 bbp-includes/bbp-extend-buddypress.php
@@ -292,7 +292,7 @@ public function register_activity_actions() {
* @param type $args Array of arguments for bp_activity_add()
* @uses bbp_get_current_user_id()
* @uses bp_core_current_time()
- * @uses wp_parse_args()
+ * @uses bbp_parse_args()
* @uses aplly_filters()
* @uses bp_activity_add()
* @return type Activity ID if successful, false if not
@@ -316,12 +316,7 @@ private function record_activity( $args = '' ) {
'recorded_time' => bp_core_current_time(),
'hide_sitewide' => false
);
-
- // Parse the difference
- $activity = wp_parse_args( $args, $defaults );
-
- // Just in-time filtering of activity stream contents
- $activity = apply_filters( 'bbp_record_activity', $activity );
+ $activity = bbp_parse_args( $args, $defaults, 'record_activity' );
// Add the activity
return bp_activity_add( $activity );
@@ -334,7 +329,7 @@ private function record_activity( $args = '' ) {
* @param type $args Array of arguments for bp_activity_add()
* @uses bbp_get_current_user_id()
* @uses bp_core_current_time()
- * @uses wp_parse_args()
+ * @uses bbp_parse_args()
* @uses aplly_filters()
* @uses bp_activity_add()
* @return type Activity ID if successful, false if not
@@ -353,12 +348,7 @@ public function delete_activity( $args = '' ) {
'user_id' => false,
'secondary_item_id' => false
);
-
- // Parse the differenc
- $activity = wp_parse_args( $args, $defaults );
-
- // Just in-time filtering of activity stream contents
- $activity = apply_filters( 'bbp_delete_activity', $activity );
+ $activity = bbp_parse_args( $args, $defaults, 'delete_activity' );
// Delete the activity
bp_activity_delete_by_item_id( $activity );
View
13 bbp-includes/bbp-forum-functions.php
@@ -18,7 +18,7 @@
*
* @since bbPress (r3349)
*
- * @uses wp_parse_args()
+ * @uses bbp_parse_args()
* @uses bbp_get_forum_post_type()
* @uses wp_insert_post()
* @uses update_post_meta()
@@ -40,9 +40,7 @@ function bbp_insert_forum( $forum_data = array(), $forum_meta = array() ) {
'menu_order' => 0,
'comment_status' => 'closed'
);
-
- // Parse args
- $forum_data = wp_parse_args( $forum_data, $default_forum );
+ $forum_data = bbp_parse_args( $forum_data, $default_forum, 'insert_forum' );
// Insert forum
$forum_id = wp_insert_post( $forum_data );
@@ -64,9 +62,7 @@ function bbp_insert_forum( $forum_data = array(), $forum_meta = array() ) {
'last_active_time' => 0,
'forum_subforum_count' => 0,
);
-
- // Parse args
- $forum_meta = wp_parse_args( $forum_meta, $default_meta );
+ $forum_meta = bbp_parse_args( $forum_meta, $default_meta, 'insert_forum_meta' );
// Insert forum meta
foreach ( $forum_meta as $meta_key => $meta_value )
@@ -1497,8 +1493,7 @@ function bbp_update_forum( $args = '' ) {
'last_active_time' => 0,
'last_active_status' => bbp_get_public_status_id()
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'update_forum' );
extract( $r );
// Last topic and reply ID's
View
27 bbp-includes/bbp-forum-template.php
@@ -78,7 +78,7 @@ function bbp_has_forums( $args = '' ) {
}
// The default forum query for most circumstances
- $default = array (
+ $defaults = array (
'post_type' => bbp_get_forum_post_type(),
'post_parent' => bbp_is_forum_archive() ? 0 : bbp_get_forum_id() ,
'post_status' => implode( ',', $post_stati ),
@@ -86,15 +86,7 @@ function bbp_has_forums( $args = '' ) {
'orderby' => 'menu_order',
'order' => 'ASC'
);
-
- // Filter the default arguments
- $args = apply_filters( 'bbp_pre_has_forums_query', $args );
-
- // Parse the default against what is requested
- $bbp_f = wp_parse_args( $args, $default );
-
- // Filter the forums query to allow just-in-time modifications
- $bbp_f = apply_filters( 'bbp_has_forums_query', $bbp_f );
+ $bbp_f = bbp_parse_args( $args, $defaults, 'has_forums' );
// Run the query
$bbp->forum_query = new WP_Query( $bbp_f );
@@ -638,15 +630,17 @@ function bbp_forum_get_subforums( $args = '' ) {
} else {
// Check if user can read private forums
- if ( current_user_can( 'read_private_forums' ) )
+ if ( current_user_can( 'read_private_forums' ) ) {
$post_stati[] = bbp_get_private_status_id();
+ }
// Check if user can read hidden forums
- if ( current_user_can( 'read_hidden_forums' ) )
+ if ( current_user_can( 'read_hidden_forums' ) ) {
$post_stati[] = bbp_get_hidden_status_id();
+ }
}
- $default = array(
+ $defaults = array(
'post_parent' => 0,
'post_type' => bbp_get_forum_post_type(),
'post_status' => implode( ',', $post_stati ),
@@ -654,8 +648,7 @@ function bbp_forum_get_subforums( $args = '' ) {
'orderby' => 'menu_order',
'order' => 'ASC'
);
-
- $r = wp_parse_args( $args, $default );
+ $r = bbp_parse_args( $args, $defaults, 'forum_get_subforums' );
$r['post_parent'] = bbp_get_forum_id( $r['post_parent'] );
// No forum passed
@@ -704,7 +697,7 @@ function bbp_list_forums( $args = '' ) {
'show_topic_count' => true,
'show_reply_count' => true,
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'list_forums' );
extract( $r, EXTR_SKIP );
// Bail if there are no subforums
@@ -1826,7 +1819,7 @@ function bbp_get_single_forum_description( $args = '' ) {
'size' => 14,
'feed' => true
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_single_forum_description' );
extract( $r );
// Validate forum_id
View
14 bbp-includes/bbp-reply-functions.php
@@ -18,7 +18,7 @@
*
* @since bbPress (r3349)
*
- * @uses wp_parse_args()
+ * @uses bbp_parse_args()
* @uses bbp_get_reply_post_type()
* @uses wp_insert_post()
* @uses update_post_meta()
@@ -40,9 +40,7 @@ function bbp_insert_reply( $reply_data = array(), $reply_meta = array() ) {
'menu_order' => 0,
'comment_status' => 'closed'
);
-
- // Parse args
- $reply_data = wp_parse_args( $reply_data, $default_reply );
+ $reply_data = bbp_parse_args( $reply_data, $default_reply, 'insert_reply' );
// Insert reply
$reply_id = wp_insert_post( $reply_data );
@@ -57,9 +55,7 @@ function bbp_insert_reply( $reply_data = array(), $reply_meta = array() ) {
'forum_id' => 0,
'topic_id' => 0,
);
-
- // Parse args
- $reply_meta = wp_parse_args( $reply_meta, $default_meta );
+ $reply_meta = bbp_parse_args( $reply_meta, $default_meta, 'insert_reply_meta' );
// Insert reply meta
foreach ( $reply_meta as $meta_key => $meta_value )
@@ -640,7 +636,7 @@ function bbp_update_reply( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymo
'bbp_anonymous_email' => '',
'bbp_anonymous_website' => '',
);
- $r = wp_parse_args( $anonymous_data, $defaults );
+ $r = bbp_parse_args( $anonymous_data, $defaults, 'update_reply' );
// Update all anonymous metas
foreach( $r as $anon_key => $anon_value ) {
@@ -932,7 +928,7 @@ function bbp_update_reply_revision_log( $args = '' ) {
'revision_id' => 0
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'update_reply_revision_log' );
extract( $r );
// Populate the variables
View
20 bbp-includes/bbp-reply-template.php
@@ -116,14 +116,8 @@ function bbp_has_replies( $args = '' ) {
if ( !empty( $parent_args ) )
$default = array_merge( $parent_args, $default );
- // Filter the default arguments
- $args = apply_filters( 'bbp_pre_has_replies_query', $args );
-
// Set up topic variables
- $bbp_r = wp_parse_args( $args, $default );
-
- // Filter the replies query to allow just-in-time modifications
- $bbp_r = apply_filters( 'bbp_has_replies_query', $bbp_r );
+ $bbp_r = bbp_parse_args( $args, $default, 'has_replies' );
// Extract the query variables
extract( $bbp_r );
@@ -983,7 +977,7 @@ function bbp_get_reply_author_link( $args = '' ) {
'size' => 80,
'sep' => ' '
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_reply_author_link' );
extract( $r );
// Used as reply_id
@@ -1362,7 +1356,7 @@ function bbp_get_reply_admin_links( $args = '' ) {
'sep' => ' | ',
'links' => array()
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_reply_admin_links' );
$r['id'] = bbp_get_reply_id( (int) $r['id'] );
@@ -1455,7 +1449,7 @@ function bbp_get_reply_edit_link( $args = '' ) {
'link_after' => '',
'edit_text' => __( 'Edit', 'bbpress' )
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_reply_edit_link' );
extract( $r );
$reply = bbp_get_reply( bbp_get_reply_id( (int) $id ) );
@@ -1577,7 +1571,7 @@ function bbp_get_reply_trash_link( $args = '' ) {
'restore_text' => __( 'Restore', 'bbpress' ),
'delete_text' => __( 'Delete', 'bbpress' )
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_reply_trash_link' );
extract( $r );
$actions = array();
@@ -1647,7 +1641,7 @@ function bbp_get_reply_spam_link( $args = '' ) {
'spam_text' => __( 'Spam', 'bbpress' ),
'unspam_text' => __( 'Unspam', 'bbpress' )
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_reply_spam_link' );
extract( $r );
$reply = bbp_get_reply( bbp_get_reply_id( (int) $id ) );
@@ -1711,7 +1705,7 @@ function bbp_get_topic_split_link( $args = '' ) {
'split_text' => __( 'Split', 'bbpress' ),
'split_title' => __( 'Split the topic from this reply', 'bbpress' )
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_split_link' );
extract( $r );
$reply_id = bbp_get_reply_id( $id );
View
2  bbp-includes/bbp-theme-compatibility.php
@@ -277,7 +277,7 @@ function bbp_theme_compat_reset_post( $args = array() ) {
'is_tax' => false,
);
}
- $dummy = wp_parse_args( $args, $defaults );
+ $dummy = bbp_parse_args( $args, $defaults, 'theme_compat_reset_post' );
// Clear out the post related globals
unset( $wp_query->posts );
View
11 bbp-includes/bbp-topic-functions.php
@@ -18,7 +18,7 @@
*
* @since bbPress (r3349)
*
- * @uses wp_parse_args()
+ * @uses bbp_parse_args()
* @uses bbp_get_topic_post_type()
* @uses wp_insert_post()
* @uses update_post_meta()
@@ -42,7 +42,7 @@ function bbp_insert_topic( $topic_data = array(), $topic_meta = array() ) {
);
// Parse args
- $topic_data = wp_parse_args( $topic_data, $default_topic );
+ $topic_data = bbp_parse_args( $topic_data, $default_topic, 'insert_topic' );
// Insert topic
$topic_id = wp_insert_post( $topic_data );
@@ -65,7 +65,7 @@ function bbp_insert_topic( $topic_data = array(), $topic_meta = array() ) {
);
// Parse args
- $topic_meta = wp_parse_args( $topic_meta, $default_meta );
+ $topic_meta = bbp_parse_args( $topic_meta, $default_meta, 'insert_topic_meta' );
// Insert topic meta
foreach ( $topic_meta as $meta_key => $meta_value )
@@ -739,7 +739,7 @@ function bbp_update_topic( $topic_id = 0, $forum_id = 0, $anonymous_data = false
'bbp_anonymous_email' => '',
'bbp_anonymous_website' => '',
);
- $r = wp_parse_args( $anonymous_data, $defaults );
+ $r = bbp_parse_args( $anonymous_data, $defaults, 'update_topic' );
// Update all anonymous metas
foreach( $r as $anon_key => $anon_value ) {
@@ -2443,8 +2443,7 @@ function bbp_update_topic_revision_log( $args = '' ) {
'author_id' => 0,
'revision_id' => 0
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'update_topic_revision_log' );
extract( $r );
// Populate the variables
View
45 bbp-includes/bbp-topic-template.php
@@ -114,15 +114,7 @@ function bbp_has_topics( $args = '' ) {
$default['term'] = bbp_get_topic_tag_slug();
$default['taxonomy'] = bbp_get_topic_tag_tax_id();
}
-
- // Filter the default arguments
- $args = apply_filters( 'bbp_pre_has_topics_query', $args );
-
- // Set up topic variables
- $bbp_t = wp_parse_args( $args, $default );
-
- // Filter the topics query to allow just-in-time modifications
- $bbp_t = apply_filters( 'bbp_has_topics_query', $bbp_t );
+ $bbp_t = bbp_parse_args( $args, $default, 'has_topics' );
// Extract the query variables
extract( $bbp_t );
@@ -676,8 +668,7 @@ function bbp_get_topic_pagination( $args = '' ) {
'before' => '<span class="bbp-topic-pagination">',
'after' => '</span>',
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_pagination' );
extract( $r );
// If pretty permalinks are enabled, make our pagination pretty
@@ -1257,8 +1248,7 @@ function bbp_get_topic_author_link( $args = '' ) {
'size' => 80,
'sep' => '&nbsp;'
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_author_link' );
extract( $r );
// Used as topic_id
@@ -1937,8 +1927,7 @@ function bbp_get_topic_tag_list( $topic_id = 0, $args = '' ) {
'sep' => ', ',
'after' => '</p></div>'
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_tag_list' );
extract( $r );
$topic_id = bbp_get_topic_id( $topic_id );
@@ -2057,8 +2046,7 @@ function bbp_get_topic_admin_links( $args = '' ) {
'sep' => ' | ',
'links' => array()
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_admin_links' );
if ( !current_user_can( 'edit_topic', $r['id'] ) )
return;
@@ -2138,8 +2126,7 @@ function bbp_get_topic_edit_link( $args = '' ) {
'link_after' => '',
'edit_text' => __( 'Edit', 'bbpress' )
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_edit_link' );
extract( $r );
$topic = bbp_get_topic( bbp_get_topic_id( (int) $id ) );
@@ -2262,7 +2249,7 @@ function bbp_get_topic_trash_link( $args = '' ) {
'restore_text' => __( 'Restore', 'bbpress' ),
'delete_text' => __( 'Delete', 'bbpress' )
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_trash_link' );
extract( $r );
$actions = array();
@@ -2331,8 +2318,7 @@ function bbp_get_topic_close_link( $args = '' ) {
'close_text' => _x( 'Close', 'Topic Status', 'bbpress' ),
'open_text' => _x( 'Open', 'Topic Status', 'bbpress' )
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_close_link' );
extract( $r );
$topic = bbp_get_topic( bbp_get_topic_id( (int) $id ) );
@@ -2393,8 +2379,7 @@ function bbp_get_topic_stick_link( $args = '' ) {
'unstick_text' => __( 'Unstick', 'bbpress' ),
'super_text' => __( 'to front', 'bbpress' ),
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_stick_link' );
extract( $r );
$topic = bbp_get_topic( bbp_get_topic_id( (int) $id ) );
@@ -2463,8 +2448,7 @@ function bbp_get_topic_merge_link( $args = '' ) {
'link_after' => '',
'merge_text' => __( 'Merge', 'bbpress' ),
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_merge_link' );
extract( $r );
$topic = bbp_get_topic( bbp_get_topic_id( (int) $id ) );
@@ -2521,7 +2505,7 @@ function bbp_get_topic_spam_link( $args = '' ) {
'spam_text' => __( 'Spam', 'bbpress' ),
'unspam_text' => __( 'Unspam', 'bbpress' )
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_spam_link' );
extract( $r );
$topic = bbp_get_topic( bbp_get_topic_id( (int) $id ) );
@@ -2688,8 +2672,7 @@ function bbp_topic_type_select( $args = '' ) {
'tab' => bbp_get_tab_index(),
'topic_id' => 0
);
-
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'topic_type_select' );
extract( $r );
// Edit topic
@@ -2790,7 +2773,7 @@ function bbp_get_single_topic_description( $args = '' ) {
'after' => '</p></div>',
'size' => 14
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_single_topic_description' );
extract( $r );
// Validate topic_id
@@ -3086,7 +3069,7 @@ function bbp_get_topic_tag_description( $args = array() ) {
'after' => '</p></div>',
'tag' => ''
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_topic_tag_description' );
extract( $r );
// Get the term
View
16 bbp-includes/bbp-user-template.php
@@ -438,7 +438,7 @@ function bbp_get_admin_link( $args = '' ) {
'before' => '',
'after' => ''
);
- $args = wp_parse_args( $args, $defaults );
+ $args = bbp_parse_args( $args, $defaults, 'get_admin_link' );
extract( $args, EXTR_SKIP );
$uri = admin_url();
@@ -478,7 +478,7 @@ function bbp_get_author_ip( $args = '' ) {
'after' => ')</span>'
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_author_ip' );
extract( $r );
// Used as post id
@@ -699,8 +699,7 @@ function bbp_get_user_subscribe_link( $args = '', $user_id = 0 ) {
'before' => '&nbsp;|&nbsp;',
'after' => ''
);
-
- $args = wp_parse_args( $args, $defaults );
+ $args = bbp_parse_args( $args, $defaults, 'get_user_subscribe_link' );
extract( $args );
// Validate user and topic ID's
@@ -1074,7 +1073,7 @@ function bbp_get_author_link( $args = '' ) {
'type' => 'both',
'size' => 80
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_author_link' );
extract( $r );
// Used as reply_id
@@ -1146,7 +1145,7 @@ function bbp_get_author_link( $args = '' ) {
* @uses bbp_get_current_user_id()
* @uses bbp_get_forum_id()
* @uses bbp_allow_anonymous()
- * @uses wp_parse_args()
+ * @uses bbp_parse_args()
* @uses bbp_get_user_id()
* @uses current_user_can()
* @uses is_super_admin()
@@ -1166,7 +1165,7 @@ function bbp_user_can_view_forum( $args = '' ) {
'forum_id' => bbp_get_forum_id(),
'check_ancestors' => false
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'user_can_view_forum' );
extract( $r );
// Validate parsed values
@@ -1295,6 +1294,7 @@ function bbp_current_user_can_publish_replies() {
/** Forms *********************************************************************/
/**
+ * Get the forums the current user has the ability to see and post to
*
* @since bbPress (r3127)
*
@@ -1330,7 +1330,7 @@ function bbp_get_forums_for_current_user( $args = array() ) {
'numberposts' => -1,
'exclude' => $post__not_in
);
- $r = wp_parse_args( $args, $defaults );
+ $r = bbp_parse_args( $args, $defaults, 'get_forums_for_current_user' );
// Get the forums
$forums = get_posts( $r );
Please sign in to comment.
Something went wrong with that request. Please try again.