Changeset 5441 for trunk/src/includes/extend/akismet.php
- Timestamp:
- 07/10/2014 03:54:41 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/extend/akismet.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/extend/akismet.php
r5321 r5441 64 64 65 65 // Add the checks 66 foreach ( $checks as $type => $functions ) 67 foreach ( $functions as $function => $priority ) 66 foreach ( $checks as $type => $functions ) { 67 foreach ( $functions as $function => $priority ) { 68 68 add_filter( $function, array( $this, $type . '_post' ), $priority ); 69 } 70 } 69 71 70 72 // Update post meta … … 103 105 104 106 // Post is not published 105 if ( bbp_get_public_status_id() !== $post_data['post_status'] ) 107 if ( bbp_get_public_status_id() !== $post_data['post_status'] ) { 106 108 return $post_data; 109 } 107 110 108 111 // Cast the post_author to 0 if it's empty 109 if ( empty( $post_data['post_author'] ) ) 112 if ( empty( $post_data['post_author'] ) ) { 110 113 $post_data['post_author'] = 0; 114 } 111 115 112 116 /** Author ************************************************************/ … … 138 142 139 143 // Use post parent for permalink 140 if ( !empty( $post_data['post_parent'] ) ) 144 if ( !empty( $post_data['post_parent'] ) ) { 141 145 $post_permalink = get_permalink( $post_data['post_parent'] ); 146 } 142 147 143 148 // Put post_data back into usable array … … 256 261 257 262 // Bail if get_post() fails 258 if ( empty( $_post ) ) 263 if ( empty( $_post ) ) { 259 264 return; 265 } 260 266 261 267 // Bail if we're spamming, but the post_status isn't spam 262 if ( ( 'spam' === $request_type ) && ( bbp_get_spam_status_id() !== $_post->post_status ) ) 268 if ( ( 'spam' === $request_type ) && ( bbp_get_spam_status_id() !== $_post->post_status ) ) { 263 269 return; 270 } 264 271 265 272 // Set some default post_data … … 282 289 // Use the original version stored in post_meta if available 283 290 $as_submitted = get_post_meta( $post_id, '_bbp_akismet_as_submitted', true ); 284 if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) ) 291 if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) ) { 285 292 $post_data = array_merge( $post_data, $as_submitted ); 293 } 286 294 287 295 // Add the reporter IP address … … 289 297 290 298 // Add some reporter info 291 if ( is_object( $current_user ) ) 299 if ( is_object( $current_user ) ) { 292 300 $post_data['reporter'] = $current_user->user_login; 301 } 293 302 294 303 // Add the current site domain 295 if ( is_object( $current_site ) ) 304 if ( is_object( $current_site ) ) { 296 305 $post_data['site_domain'] = $current_site->domain; 306 } 297 307 298 308 // Place your slide beneath the microscope … … 434 444 435 445 // Ensure we have a post object 436 if ( empty( $_post ) ) 446 if ( empty( $_post ) ) { 437 447 $_post = get_post( $post_id ); 448 } 438 449 439 450 // Set up Akismet last post data 440 if ( !empty( $this->last_post ) ) 451 if ( !empty( $this->last_post ) ) { 441 452 $as_submitted = $this->last_post['bbp_post_as_submitted']; 453 } 442 454 443 455 // wp_insert_post() might be called in other contexts. Ensure this is … … 587 599 588 600 // Save the terms for later in case the reply gets hammed 589 if ( !empty( $terms ) ) 601 if ( !empty( $terms ) ) { 590 602 update_post_meta( $reply_id, '_bbp_akismet_spam_terms', $terms ); 603 } 591 604 592 605 // Keep the topic tags the same for now … … 626 639 627 640 // Use specific IP (if provided) 628 if ( !empty( $ip ) && long2ip( ip2long( $ip ) ) ) 641 if ( !empty( $ip ) && long2ip( ip2long( $ip ) ) ) { 629 642 $http_host = $ip; 643 } 630 644 631 645 // WP HTTP class is available … … 651 665 652 666 // Bail if the response is an error 653 if ( is_wp_error( $response ) ) 667 if ( is_wp_error( $response ) ) { 654 668 return ''; 669 } 655 670 656 671 // No errors so return response
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)