Changeset 6400 for trunk/src/includes/users/functions.php
- Timestamp:
- 04/19/2017 08:58:52 PM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/users/functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/users/functions.php
r6399 r6400 89 89 */ 90 90 function bbp_get_current_anonymous_user_data( $key = '' ) { 91 92 // Array of allowed cookie names 91 93 $cookie_names = array( 92 94 'name' => 'comment_author', … … 100 102 ); 101 103 104 // Sanitize core cookies 102 105 sanitize_comment_cookies(); 103 106 107 // Get the current poster's info from the cookies 104 108 $bbp_current_poster = wp_get_current_commenter(); 105 109 106 if ( ! empty( $key ) && in_array( $key, array_keys( $cookie_names ) ) ) { 110 // Sanitize the cookie key being retrieved 111 $key = sanitize_key( $key ); 112 113 // Maybe return a specific key 114 if ( ! empty( $key ) && in_array( $key, array_keys( $cookie_names ), true ) ) { 107 115 return $bbp_current_poster[ $cookie_names[ $key ] ]; 108 116 } 109 117 118 // Return all keys 110 119 return $bbp_current_poster; 111 120 } … … 116 125 * @since 2.0.0 bbPress (r2734) 117 126 * 118 * @param array $anonymous_data With keys 'bbp_anonymous_name', 119 * 'bbp_anonymous_email', 'bbp_anonymous_website'. 120 * Should be sanitized (see 121 * {@link bbp_filter_anonymous_post_data()} for 122 * sanitization) 127 * @param array $anonymous_data Optional - if it's an anonymous post. Do not 128 * supply if supplying $author_id. Should be 129 * sanitized (see {@link bbp_filter_anonymous_post_data()} 123 130 * @uses apply_filters() Calls 'comment_cookie_lifetime' for cookie lifetime. 124 131 * Defaults to 30000000. … … 126 133 function bbp_set_current_anonymous_user_data( $anonymous_data = array() ) { 127 134 128 // Bail if empty or not an array135 // Bail if empty or not an array 129 136 if ( empty( $anonymous_data ) || ! is_array( $anonymous_data ) ) { 130 137 return;
Note: See TracChangeset
for help on using the changeset viewer.