Ticket #25596: 25596.diff
File 25596.diff, 7.9 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 $blog_id Blog ID. 26 */ 21 27 do_action( 'wpmu_blog_updated', $wpdb->blogid ); 22 28 } 23 29 … … 207 213 $details->post_count = get_option( 'post_count' ); 208 214 restore_current_blog(); 209 215 216 /** 217 * Filter a blog's details. 218 * 219 * @since MU 220 * 221 * @param object $details The blog details. 222 */ 210 223 $details = apply_filters( 'blog_details', $details ); 211 224 212 225 wp_cache_set( $blog_id . $all, $details, 'blog-details' ); … … 240 253 241 254 clean_blog_cache( $details ); 242 255 256 /** 257 * Fires after the blog details cache is cleared. 258 * 259 * @since MU 260 * 261 * @param integer $blog_id Blog ID. 262 */ 243 263 do_action( 'refresh_blog_details', $blog_id ); 244 264 } 245 265 … … 281 301 return false; 282 302 283 303 // If spam status changed, issue actions. 284 if ( $details[ 'spam' ] != $current_details[ 'spam' ] ) { 285 if ( $details[ 'spam' ] == 1 ) 304 if ( $details['spam'] != $current_details['spam'] ) { 305 if ( $details['spam'] == 1 ) { 306 /** 307 * Fires when the blog status is changed to 'spam'. 308 * 309 * @since MU 310 * 311 * @param integer $blog_id Blog ID. 312 */ 286 313 do_action( 'make_spam_blog', $blog_id ); 287 else 314 } else { 315 /** 316 * Fires when the blog status is changed to 'ham'. 317 * 318 * @since MU 319 * 320 * @param integer $blog_id Blog ID. 321 */ 288 322 do_action( 'make_ham_blog', $blog_id ); 323 } 289 324 } 290 325 291 326 // If mature status changed, issue actions. 292 if ( $details[ 'mature' ] != $current_details[ 'mature' ] ) { 293 if ( $details[ 'mature' ] == 1 ) 327 if ( $details['mature'] != $current_details['mature'] ) { 328 if ( $details['mature'] == 1 ) { 329 /** 330 * Fires when the blog status is changed to 'mature'. 331 * 332 * @since MU 333 * 334 * @param integer $blog_id Blog ID. 335 */ 294 336 do_action( 'mature_blog', $blog_id ); 295 else 337 } else { 338 /** 339 * Fires when the blog status is changed to 'unmature'. 340 * 341 * @since MU 342 * 343 * @param integer $blog_id Blog ID. 344 */ 296 345 do_action( 'unmature_blog', $blog_id ); 346 } 297 347 } 298 348 299 349 // If archived status changed, issue actions. 300 if ( $details[ 'archived' ] != $current_details[ 'archived' ] ) { 301 if ( $details[ 'archived' ] == 1 ) 350 if ( $details['archived'] != $current_details['archived'] ) { 351 if ( $details['archived'] == 1 ) { 352 /** 353 * Fires when the blog status is changed to 'archived'. 354 * 355 * @since MU 356 * 357 * @param integer $blog_id Blog ID. 358 */ 302 359 do_action( 'archive_blog', $blog_id ); 303 else 360 } else { 361 /** 362 * Fires when the blog status is changed to 'unarchived'. 363 * 364 * @since MU 365 * 366 * @param integer $blog_id Blog ID. 367 */ 304 368 do_action( 'unarchive_blog', $blog_id ); 369 } 305 370 } 306 371 307 372 // If deleted status changed, issue actions. 308 if ( $details[ 'deleted' ] != $current_details[ 'deleted' ] ) { 309 if ( $details[ 'deleted' ] == 1 ) 373 if ( $details['deleted'] != $current_details['deleted'] ) { 374 if ( $details['deleted'] == 1 ) { 375 /** 376 * Fires when the blog status is changed to 'deleted'. 377 * 378 * @since MU 379 * 380 * @param integer $blog_id Blog ID. 381 */ 310 382 do_action( 'make_delete_blog', $blog_id ); 311 else 383 } else { 384 /** 385 * Fires when the blog status is changed to 'undeleted'. 386 * 387 * @since MU 388 * 389 * @param integer $blog_id Blog ID. 390 */ 312 391 do_action( 'make_undelete_blog', $blog_id ); 392 } 313 393 } 314 394 315 if ( isset( $details[ 'public'] ) ) {395 if ( isset( $details['public'] ) ) { 316 396 switch_to_blog( $blog_id ); 317 update_option( 'blog_public', $details[ 'public'] );397 update_option( 'blog_public', $details['public'] ); 318 398 restore_current_blog(); 319 399 } 320 400 … … 373 453 $value = get_option( $option, $default ); 374 454 restore_current_blog(); 375 455 376 return apply_filters( 'blog_option_' . $option, $value, $id ); 456 /** 457 * Filter a blog option value. 458 * 459 * @since MU 460 * 461 * @param string $value The option value. 462 * @param integer $id Blog ID. 463 */ 464 return apply_filters( "blog_option_{$option}", $value, $id ); 377 465 } 378 466 379 467 /** … … 489 577 490 578 $GLOBALS['_wp_switched_stack'][] = $GLOBALS['blog_id']; 491 579 492 /* If we're switching to the same blog id that we're on, 493 * set the right vars, do the associated actions, but skip 494 * the extra unnecessary work */ 580 /* 581 * If we're switching to the same blog id that we're on, 582 * set the right vars, do the associated actions, but skip 583 * the extra unnecessary work 584 */ 495 585 if ( $new_blog == $GLOBALS['blog_id'] ) { 586 /** 587 * Fires when the blog is switched. 588 * 589 * @since MU 590 * 591 * @param integer $new_blog New blog ID. 592 * @param integer $new_blog Blog ID. 593 */ 496 594 do_action( 'switch_blog', $new_blog, $new_blog ); 497 595 $GLOBALS['switched'] = true; 498 596 return true; … … 530 628 $current_user->for_blog( $new_blog ); 531 629 } 532 630 631 /** This filter is documented in wp-includes/ms-blogs.php */ 533 632 do_action( 'switch_blog', $new_blog, $prev_blog_id ); 534 633 $GLOBALS['switched'] = true; 535 634 … … 553 652 $blog = array_pop( $GLOBALS['_wp_switched_stack'] ); 554 653 555 654 if ( $GLOBALS['blog_id'] == $blog ) { 655 /** This filter is documented in wp-includes/ms-blogs.php */ 556 656 do_action( 'switch_blog', $blog, $blog ); 557 657 // If we still have items in the switched stack, consider ourselves still 'switched' 558 658 $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] ); … … 591 691 $current_user->for_blog( $blog ); 592 692 } 593 693 694 /** This filter is documented in wp-includes/ms-blogs.php */ 594 695 do_action( 'switch_blog', $blog, $prev_blog_id ); 595 696 596 697 // If we still have items in the switched stack, consider ourselves still 'switched' … … 662 763 663 764 refresh_blog_details( $blog_id ); 664 765 665 if ( 'spam' == $pref ) 666 ( $value == 1 ) ? do_action( 'make_spam_blog', $blog_id ) : do_action( 'make_ham_blog', $blog_id ); 667 elseif ( 'mature' == $pref ) 668 ( $value == 1 ) ? do_action( 'mature_blog', $blog_id ) : do_action( 'unmature_blog', $blog_id ); 669 elseif ( 'archived' == $pref ) 670 ( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id ); 671 elseif ( 'deleted' == $pref ) 672 ( $value == 1 ) ? do_action( 'make_delete_blog', $blog_id ) : do_action( 'make_undelete_blog', $blog_id ); 673 elseif ( 'public' == $pref ) 766 if ( 'spam' == $pref ) { 767 if ( $value == 1 ) { 768 /** This filter is documented in wp-includes/ms-blogs.php */ 769 do_action( 'make_spam_blog', $blog_id ); 770 } else { 771 /** This filter is documented in wp-includes/ms-blogs.php */ 772 do_action( 'make_ham_blog', $blog_id ); 773 } 774 } elseif ( 'mature' == $pref ) { 775 if ( $value == 1 ) { 776 /** This filter is documented in wp-includes/ms-blogs.php */ 777 do_action( 'mature_blog', $blog_id ); 778 } else { 779 /** This filter is documented in wp-includes/ms-blogs.php */ 780 do_action( 'unmature_blog', $blog_id ); 781 } 782 } elseif ( 'archived' == $pref ) { 783 if ( $value == 1 ) { 784 /** This filter is documented in wp-includes/ms-blogs.php */ 785 do_action( 'archive_blog', $blog_id ); 786 } else { 787 /** This filter is documented in wp-includes/ms-blogs.php */ 788 do_action( 'unarchive_blog', $blog_id ); 789 } 790 } elseif ( 'deleted' == $pref ) { 791 if ( $value == 1 ) { 792 /** This filter is documented in wp-includes/ms-blogs.php */ 793 do_action( 'make_delete_blog', $blog_id ); 794 } else { 795 /** This filter is documented in wp-includes/ms-blogs.php */ 796 do_action( 'make_undelete_blog', $blog_id ); 797 } 798 } elseif ( 'public' == $pref ) { 799 /** 800 * Fires after the current blog's 'public' setting is updated. 801 * 802 * @since MU 803 * 804 * @param integer $blog_id BLog ID 805 * @param string $value The value of blog status. 806 */ 674 807 do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public(). 808 } 675 809 676 810 return $value; 677 811 }