WordPress.org

Make WordPress Core

Changeset 26502


Ignore:
Timestamp:
12/01/2013 05:31:49 PM (8 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-includes/ms-blogs.php.

Props miyauchi, kpdesign.
Fixes #25596.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-blogs.php

    r26120 r26502  
    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 int $blog_id Blog ID.
     26     */
    2127    do_action( 'wpmu_blog_updated', $wpdb->blogid );
    2228}
     
    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
     
    241254    clean_blog_cache( $details );
    242255
     256    /**
     257     * Fires after the blog details cache is cleared.
     258     *
     259     * @since 3.4.0
     260     *
     261     * @param int $blog_id Blog ID.
     262     */
    243263    do_action( 'refresh_blog_details', $blog_id );
    244264}
     
    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 int $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 int $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 3.1.0
     333             *
     334             * @param int $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 3.1.0
     342             *
     343             * @param int $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 int $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 int $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 3.5.0
     379             *
     380             * @param int $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 3.5.0
     388             *
     389             * @param int $blog_id Blog ID.
     390             */
    312391            do_action( 'make_undelete_blog', $blog_id );
    313     }
    314 
    315     if ( isset( $details[ 'public' ] ) ) {
     392        }
     393    }
     394
     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    }
     
    374454    restore_current_blog();
    375455
    376     return apply_filters( 'blog_option_' . $option, $value, $id );
     456    /**
     457     * Filter a blog option value.
     458     *
     459     * The dynamic portion of the hook name, $option, refers to the blog option name.
     460     *
     461     * @since 3.5.0
     462     *
     463     * @param string  $value The option value.
     464     * @param int     $id    Blog ID.
     465     */
     466    return apply_filters( "blog_option_{$option}", $value, $id );
    377467}
    378468
     
    490580    $GLOBALS['_wp_switched_stack'][] = $GLOBALS['blog_id'];
    491581
    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 */
     582    /*
     583     * If we're switching to the same blog id that we're on,
     584     * set the right vars, do the associated actions, but skip
     585     * the extra unnecessary work
     586     */
    495587    if ( $new_blog == $GLOBALS['blog_id'] ) {
     588        /**
     589         * Fires when the blog is switched.
     590         *
     591         * @since MU
     592         *
     593         * @param int $new_blog New blog ID.
     594         * @param int $new_blog Blog ID.
     595         */
    496596        do_action( 'switch_blog', $new_blog, $new_blog );
    497597        $GLOBALS['switched'] = true;
     
    531631    }
    532632
     633    /** This filter is documented in wp-includes/ms-blogs.php */
    533634    do_action( 'switch_blog', $new_blog, $prev_blog_id );
    534635    $GLOBALS['switched'] = true;
     
    554655
    555656    if ( $GLOBALS['blog_id'] == $blog ) {
     657        /** This filter is documented in wp-includes/ms-blogs.php */
    556658        do_action( 'switch_blog', $blog, $blog );
    557659        // If we still have items in the switched stack, consider ourselves still 'switched'
     
    592694    }
    593695
     696    /** This filter is documented in wp-includes/ms-blogs.php */
    594697    do_action( 'switch_blog', $blog, $prev_blog_id );
    595698
     
    663766    refresh_blog_details( $blog_id );
    664767
    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 )
     768    if ( 'spam' == $pref ) {
     769        if ( $value == 1 ) {
     770            /** This filter is documented in wp-includes/ms-blogs.php */
     771            do_action( 'make_spam_blog', $blog_id );
     772        } else {
     773            /** This filter is documented in wp-includes/ms-blogs.php */
     774            do_action( 'make_ham_blog', $blog_id );
     775        }
     776    } elseif ( 'mature' == $pref ) {
     777        if ( $value == 1 ) {
     778            /** This filter is documented in wp-includes/ms-blogs.php */
     779            do_action( 'mature_blog', $blog_id );
     780        } else {
     781            /** This filter is documented in wp-includes/ms-blogs.php */
     782            do_action( 'unmature_blog', $blog_id );
     783        }
     784    } elseif ( 'archived' == $pref ) {
     785        if ( $value == 1 ) {
     786            /** This filter is documented in wp-includes/ms-blogs.php */
     787            do_action( 'archive_blog', $blog_id );
     788        } else {
     789            /** This filter is documented in wp-includes/ms-blogs.php */
     790            do_action( 'unarchive_blog', $blog_id );
     791        }
     792    } elseif ( 'deleted' == $pref ) {
     793        if ( $value == 1 ) {
     794            /** This filter is documented in wp-includes/ms-blogs.php */
     795            do_action( 'make_delete_blog', $blog_id );
     796        } else {
     797            /** This filter is documented in wp-includes/ms-blogs.php */
     798            do_action( 'make_undelete_blog', $blog_id );
     799        }
     800    } elseif ( 'public' == $pref ) {
     801        /**
     802         * Fires after the current blog's 'public' setting is updated.
     803         *
     804         * @since MU
     805         *
     806         * @param int    $blog_id Blog ID.
     807         * @param string $value   The value of blog status.
     808         */
    674809        do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public().
     810    }
    675811
    676812    return $value;
Note: See TracChangeset for help on using the changeset viewer.