Make WordPress Core

Ticket #25596: 25596.diff

File 25596.diff, 7.9 KB (added by DrewAPicture, 11 years ago)

4th pass

  • src/wp-includes/ms-blogs.php

     
    1717        global $wpdb;
    1818
    1919        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         */
    2127        do_action( 'wpmu_blog_updated', $wpdb->blogid );
    2228}
    2329
     
    207213        $details->post_count    = get_option( 'post_count' );
    208214        restore_current_blog();
    209215
     216        /**
     217         * Filter a blog's details.
     218         *
     219         * @since MU
     220         *
     221         * @param object $details The blog details.
     222         */
    210223        $details = apply_filters( 'blog_details', $details );
    211224
    212225        wp_cache_set( $blog_id . $all, $details, 'blog-details' );
     
    240253
    241254        clean_blog_cache( $details );
    242255
     256        /**
     257         * Fires after the blog details cache is cleared.
     258         *
     259         * @since MU
     260         *
     261         * @param integer $blog_id Blog ID.
     262         */
    243263        do_action( 'refresh_blog_details', $blog_id );
    244264}
    245265
     
    281301                return false;
    282302
    283303        // 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                         */
    286313                        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                         */
    288322                        do_action( 'make_ham_blog', $blog_id );
     323                }
    289324        }
    290325
    291326        // 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                         */
    294336                        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                         */
    296345                        do_action( 'unmature_blog', $blog_id );
     346                }
    297347        }
    298348
    299349        // 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                         */
    302359                        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                         */
    304368                        do_action( 'unarchive_blog', $blog_id );
     369                }
    305370        }
    306371
    307372        // 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                         */
    310382                        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                         */
    312391                        do_action( 'make_undelete_blog', $blog_id );
     392                }
    313393        }
    314394
    315         if ( isset( $details[ 'public' ] ) ) {
     395        if ( isset( $details['public'] ) ) {
    316396                switch_to_blog( $blog_id );
    317                 update_option( 'blog_public', $details[ 'public' ] );
     397                update_option( 'blog_public', $details['public'] );
    318398                restore_current_blog();
    319399        }
    320400
     
    373453        $value = get_option( $option, $default );
    374454        restore_current_blog();
    375455
    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 );
    377465}
    378466
    379467/**
     
    489577
    490578        $GLOBALS['_wp_switched_stack'][] = $GLOBALS['blog_id'];
    491579
    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         */
    495585        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                 */
    496594                do_action( 'switch_blog', $new_blog, $new_blog );
    497595                $GLOBALS['switched'] = true;
    498596                return true;
     
    530628                $current_user->for_blog( $new_blog );
    531629        }
    532630
     631        /** This filter is documented in wp-includes/ms-blogs.php */
    533632        do_action( 'switch_blog', $new_blog, $prev_blog_id );
    534633        $GLOBALS['switched'] = true;
    535634
     
    553652        $blog = array_pop( $GLOBALS['_wp_switched_stack'] );
    554653
    555654        if ( $GLOBALS['blog_id'] == $blog ) {
     655                /** This filter is documented in wp-includes/ms-blogs.php */
    556656                do_action( 'switch_blog', $blog, $blog );
    557657                // If we still have items in the switched stack, consider ourselves still 'switched'
    558658                $GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
     
    591691                $current_user->for_blog( $blog );
    592692        }
    593693
     694        /** This filter is documented in wp-includes/ms-blogs.php */
    594695        do_action( 'switch_blog', $blog, $prev_blog_id );
    595696
    596697        // If we still have items in the switched stack, consider ourselves still 'switched'
     
    662763
    663764        refresh_blog_details( $blog_id );
    664765
    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                 */
    674807                do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public().
     808        }
    675809
    676810        return $value;
    677811}