Ticket #4231: 4231.diff
| File 4231.diff, 2.9 KB (added by Otto42, 6 years ago) |
|---|
-
wp-includes/default-filters.php
190 190 add_action('save_post', '_save_post_hook', 5, 2); 191 191 add_action('transition_post_status', '_transition_post_status', 5, 3); 192 192 193 ?> 194 No newline at end of file 193 // actions to schedule the update_links call 194 add_action('update_links','wp_update_links'); 195 add_action('update_option_use_linksupdate', 'links_update_change',10,2); 196 ?> -
wp-includes/pluggable.php
174 174 if ( empty( $headers ) ) { 175 175 $headers = array(); 176 176 } elseif ( !is_array( $headers ) ) { 177 // Explode the headers out, so this function can take both 177 // Explode the headers out, so this function can take both 178 178 // string headers and an array of headers. 179 179 $tempheaders = (array) explode( "\n", $headers ); 180 180 $headers = array(); … … 396 396 $location = apply_filters('wp_redirect', $location, $status); 397 397 398 398 if ( !$location ) // allows the wp_redirect filter to cancel a redirect 399 return false; 399 return false; 400 400 401 401 $location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location); 402 402 $location = wp_kses_no_null($location); … … 548 548 global $wpdb; 549 549 550 550 if( get_option( "moderation_notify" ) == 0 ) 551 return true; 551 return true; 552 552 553 553 $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 554 554 $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1"); … … 653 653 } 654 654 endif; 655 655 656 if ( !function_exists('wp_update_links') ) : 657 // the links update function 658 function wp_update_links() { 659 require_once( ABSPATH . 'wp-includes/rss.php'); 660 661 if ( !get_option('use_linksupdate') ) 662 wp_die(__('Feature disabled.')); 663 664 $link_rsses = $wpdb->get_col("SELECT link_rss FROM $wpdb->links"); 665 if ( !$link_rsses ) 666 wp_die(__('No links')); 667 668 foreach ($link_rsses as $rssurl) 669 { 670 $feed = fetch_rss($rssurl); 671 $mod = $feed->last_modified; 672 if ($mod != null) { 673 $modtime = strtotime($mod); 674 if ($modtime !== false && $modtime !== -1) { // php 5.1 and up returns false on failure, prev versions return -1 675 $wpdb->query("UPDATE $wpdb->links SET link_updated = FROM_UNIXTIME($modtime) WHERE link_rss = '$rssurl'"); 676 } 677 } 678 } 679 } 680 endif; 681 682 if ( !function_exists('wp_links_update_change') ) : 683 // the update_links scheduler function 684 function wp_links_update_change($oldvalue, $newvalue) { 685 686 if ($oldvalue == $newvalue) return; 687 688 if ($newvalue == 1) { 689 wp_schedule_event(time(), apply_filters('update_links_schedule','daily'), 'update_links'); 690 } 691 else { 692 wp_clear_scheduled_hook('update_links'); 693 } 694 } 695 endif; 696 656 697 ?>