Changeset 13436 for trunk/src/bp-activity/classes/class-bp-akismet.php
- Timestamp:
- 03/15/2023 08:16:46 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-akismet.php
r12694 r13436 192 192 */ 193 193 public function add_activity_spam_button() { 194 if ( !bp_activity_user_can_mark_spam() ) 195 return; 194 if ( ! bp_activity_user_can_mark_spam() ) { 195 return; 196 } 196 197 197 198 // By default, only handle activity updates and activity comments. 198 if ( !in_array( bp_get_activity_type(), BP_Akismet::get_activity_types() ) ) 199 return; 199 if ( ! in_array( bp_get_activity_type(), BP_Akismet::get_activity_types(), true ) ) { 200 return; 201 } 202 203 $spam_link = bp_rewrites_get_url( 204 array( 205 'component_id' => 'activity', 206 'single_item_action' => 'spam', 207 'single_item_action_variables' => array( bp_get_activity_id() ), 208 ) 209 ); 200 210 201 211 bp_button( … … 205 215 'id' => 'activity_make_spam_' . bp_get_activity_id(), 206 216 'link_class' => 'bp-secondary-action spam-activity confirm button item-button', 207 'link_href' => wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/spam/' . bp_get_activity_id() . '/', 'bp_activity_akismet_spam_' . bp_get_activity_id() ),217 'link_href' => wp_nonce_url( $spam_link, 'bp_activity_akismet_spam_' . bp_get_activity_id() ), 208 218 'link_text' => __( 'Spam', 'buddypress' ), 209 219 'wrapper' => false, … … 220 230 */ 221 231 public function add_activity_comment_spam_button() { 222 if ( !bp_activity_user_can_mark_spam() ) 223 return; 232 if ( ! bp_activity_user_can_mark_spam() ) { 233 return; 234 } 224 235 225 236 // By default, only handle activity updates and activity comments. 226 237 $current_comment = bp_activity_current_comment(); 227 if ( empty( $current_comment ) || !in_array( $current_comment->type, BP_Akismet::get_activity_types() ) ) 228 return; 238 if ( empty( $current_comment ) || ! in_array( $current_comment->type, BP_Akismet::get_activity_types(), true ) ) { 239 return; 240 } 241 242 $spam_link = add_query_arg( 243 'cid', 244 bp_get_activity_comment_id(), 245 bp_rewrites_get_url( 246 array( 247 'component_id' => 'activity', 248 'single_item_action' => 'spam', 249 'single_item_action_variables' => array( bp_get_activity_comment_id() ), 250 ) 251 ) 252 ); 229 253 230 254 bp_button( … … 234 258 'id' => 'activity_make_spam_' . bp_get_activity_comment_id(), 235 259 'link_class' => 'bp-secondary-action spam-activity-comment confirm', 236 'link_href' => wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/spam/' . bp_get_activity_comment_id() . '/?cid=' . bp_get_activity_comment_id(), 'bp_activity_akismet_spam_' . bp_get_activity_comment_id() ),260 'link_href' => wp_nonce_url( $spam_link, 'bp_activity_akismet_spam_' . bp_get_activity_comment_id() ), 237 261 'link_text' => __( 'Spam', 'buddypress' ), 238 262 'wrapper' => false,
Note: See TracChangeset
for help on using the changeset viewer.