Ticket #25596: ms-blogs.diff
File ms-blogs.diff, 7.0 KB (added by , 11 years ago) |
---|
-
src/wp-includes/ms-blogs.php
17 17 global $wpdb; 18 18 19 19 update_blog_details( $wpdb->blogid, array('last_updated' => current_time('mysql', true)) ); 20 20 /** 21 * Fires after the blog details are updated. 22 * 23 * @since MU 24 * 25 * @param integer $wpdb->blogid The ID of the blog. 26 */ 21 27 do_action( 'wpmu_blog_updated', $wpdb->blogid ); 22 28 } 23 29 … … 26 32 * 27 33 * @since MU 28 34 * 29 * @param int $blog_id Blog ID35 * @param integer $blog_id The ID of the blog. 30 36 * @return string 31 37 */ 32 38 function get_blogaddress_by_id( $blog_id ) { … … 206 212 $details->post_count = get_option( 'post_count' ); 207 213 restore_current_blog(); 208 214 215 /** 216 * Filter the blog's detail. 217 * 218 * @since MU 219 * 220 * @param object $detail The details of the blog. 221 */ 209 222 $details = apply_filters( 'blog_details', $details ); 210 223 211 224 wp_cache_set( $blog_id . $all, $details, 'blog-details' ); … … 239 252 240 253 clean_blog_cache( $details ); 241 254 255 /** 256 * Fires after the blog details cache is cleared. 257 * 258 * @since MU 259 * 260 * @param integer $blog_id The ID of the blog. 261 */ 242 262 do_action( 'refresh_blog_details', $blog_id ); 243 263 } 244 264 … … 281 301 282 302 // If spam status changed, issue actions. 283 303 if ( $details[ 'spam' ] != $current_details[ 'spam' ] ) { 284 if ( $details[ 'spam' ] == 1 ) 304 if ( $details[ 'spam' ] == 1 ) { 305 /** 306 * Fires when the blog status is changed to spam. 307 * 308 * @since MU 309 * 310 * @param integer $blog_id The ID of the blog. 311 */ 285 312 do_action( 'make_spam_blog', $blog_id ); 286 else 313 } else { 314 /** 315 * Fires when the blog status is changed to ham. 316 * 317 * @since MU 318 * 319 * @param integer $blog_id The ID of the blog. 320 */ 287 321 do_action( 'make_ham_blog', $blog_id ); 322 } 288 323 } 289 324 290 325 // If mature status changed, issue actions. 291 326 if ( $details[ 'mature' ] != $current_details[ 'mature' ] ) { 292 if ( $details[ 'mature' ] == 1 ) 327 if ( $details[ 'mature' ] == 1 ) { 328 /** 329 * Fires when the blog status is changed to mature. 330 * 331 * @since MU 332 * 333 * @param integer $blog_id The ID of the blog. 334 */ 293 335 do_action( 'mature_blog', $blog_id ); 294 else 336 } else { 337 /** 338 * Fires when the blog status is changed to unmature. 339 * 340 * @since MU 341 * 342 * @param integer $blog_id The ID of the blog. 343 */ 295 344 do_action( 'unmature_blog', $blog_id ); 345 } 296 346 } 297 347 298 348 // If archived status changed, issue actions. 299 349 if ( $details[ 'archived' ] != $current_details[ 'archived' ] ) { 300 if ( $details[ 'archived' ] == 1 ) 350 if ( $details[ 'archived' ] == 1 ) { 351 /** 352 * Fires when the blog status is changed to archived. 353 * 354 * @since MU 355 * 356 * @param integer $blog_id The ID of the blog. 357 */ 301 358 do_action( 'archive_blog', $blog_id ); 302 else 359 } else { 360 /** 361 * Fires when the blog status is changed to unarchived. 362 * 363 * @since MU 364 * 365 * @param integer $blog_id The ID of the blog. 366 */ 303 367 do_action( 'unarchive_blog', $blog_id ); 368 } 304 369 } 305 370 306 371 // If deleted status changed, issue actions. 307 372 if ( $details[ 'deleted' ] != $current_details[ 'deleted' ] ) { 308 if ( $details[ 'deleted' ] == 1 ) 373 if ( $details[ 'deleted' ] == 1 ) { 374 /** 375 * Fires when the blog status is changed to deleted. 376 * 377 * @since MU 378 * 379 * @param integer $blog_id The ID of the blog. 380 */ 309 381 do_action( 'make_delete_blog', $blog_id ); 310 else 382 } else { 383 /** 384 * Fires when the blog status is changed to undeleted. 385 * 386 * @since MU 387 * 388 * @param integer $blog_id The ID of the blog. 389 */ 311 390 do_action( 'make_undelete_blog', $blog_id ); 391 } 312 392 } 313 393 314 394 if ( isset( $details[ 'public' ] ) ) { … … 372 452 $value = get_option( $option, $default ); 373 453 restore_current_blog(); 374 454 455 /** 456 * Filter the option of blog depending on the $option. 457 * 458 * @since MU 459 * 460 * @param string $value The value of option. 461 * @param integer $id Blog ID 462 */ 375 463 return apply_filters( 'blog_option_' . $option, $value, $id ); 376 464 } 377 465 … … 492 580 * set the right vars, do the associated actions, but skip 493 581 * the extra unnecessary work */ 494 582 if ( $new_blog == $GLOBALS['blog_id'] ) { 583 /** 584 * Fires when the blog is switched.. 585 * 586 * @since MU 587 * 588 * @param integer $new_blog The ID of the new blog. 589 * @param integer $new_blog The ID of the new blog. 590 */ 495 591 do_action( 'switch_blog', $new_blog, $new_blog ); 496 592 $GLOBALS['switched'] = true; 497 593 return true; … … 529 625 $current_user->for_blog( $new_blog ); 530 626 } 531 627 628 //duplicate 532 629 do_action( 'switch_blog', $new_blog, $prev_blog_id ); 533 630 $GLOBALS['switched'] = true; 534 631 … … 552 649 $blog = array_pop( $GLOBALS['_wp_switched_stack'] ); 553 650 554 651 if ( $GLOBALS['blog_id'] == $blog ) { 652 //duplicate 555 653 do_action( 'switch_blog', $blog, $blog ); 556 654 // If we still have items in the switched stack, consider ourselves still 'switched' 557 655 $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); … … 590 688 $current_user->for_blog( $blog ); 591 689 } 592 690 691 //duplicate 593 692 do_action( 'switch_blog', $blog, $prev_blog_id ); 594 693 595 694 // If we still have items in the switched stack, consider ourselves still 'switched' … … 661 760 662 761 refresh_blog_details( $blog_id ); 663 762 664 if ( 'spam' == $pref ) 665 ( $value == 1 ) ? do_action( 'make_spam_blog', $blog_id ) : do_action( 'make_ham_blog', $blog_id ); 666 elseif ( 'mature' == $pref ) 667 ( $value == 1 ) ? do_action( 'mature_blog', $blog_id ) : do_action( 'unmature_blog', $blog_id ); 668 elseif ( 'archived' == $pref ) 669 ( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id ); 670 elseif ( 'deleted' == $pref ) 671 ( $value == 1 ) ? do_action( 'make_delete_blog', $blog_id ) : do_action( 'make_undelete_blog', $blog_id ); 672 elseif ( 'public' == $pref ) 763 if ( 'spam' == $pref ) { 764 if ( $value == 1 ) { 765 //duplicate 766 do_action( 'make_spam_blog', $blog_id ); 767 } else { 768 //duplicate 769 do_action( 'make_ham_blog', $blog_id ); 770 } 771 } elseif ( 'mature' == $pref ) { 772 if ( $value == 1 ) { 773 //duplicate 774 do_action( 'mature_blog', $blog_id ); 775 } else { 776 //duplicate 777 do_action( 'unmature_blog', $blog_id ); 778 } 779 } elseif ( 'archived' == $pref ) { 780 if ( $value == 1 ) { 781 //duplicate 782 do_action( 'archive_blog', $blog_id ); 783 } else { 784 //duplicate 785 do_action( 'unarchive_blog', $blog_id ); 786 } 787 } elseif ( 'deleted' == $pref ) { 788 if ( $value == 1 ) { 789 //duplicate 790 do_action( 'make_delete_blog', $blog_id ); 791 } else { 792 //duplicate 793 do_action( 'make_undelete_blog', $blog_id ); 794 } 795 } elseif ( 'public' == $pref ) { 796 /** 797 * Fires after the current blog's 'public' setting is changed. 798 * 799 * @since MU 800 * 801 * @param integer $blog_id BLog ID 802 * @param string $value The value of blog status. 803 */ 673 804 do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public(). 805 } 674 806 675 807 return $value; 676 808 }