Make WordPress Core

Changeset 25481


Ignore:
Timestamp:
09/18/2013 06:21:46 PM (11 years ago)
Author:
SergeyBiryukov
Message:

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

props enej, DrewAPicture.
see #25229.

File:
1 edited

Legend:

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

    r24875 r25481  
    6262
    6363    $blog = get_blog_details( $blog_id );
    64 
     64    /**
     65     * Fires before a blog is deleted.
     66     *
     67     * @since MU
     68     *
     69     * @param int  $blog_id The blog ID.
     70     * @param bool $drop    True if blog's table should be dropped. Default is false.
     71     */
    6572    do_action( 'delete_blog', $blog_id, $drop );
    6673
     
    8188
    8289    if ( $drop ) {
    83         $drop_tables = apply_filters( 'wpmu_drop_tables', $wpdb->tables( 'blog' ), $blog_id );
     90        $tables = $wpdb->tables( 'blog' );
     91        /**
     92         * Filter the tables to drop when the blog is deleted.
     93         *
     94         * @since MU
     95         *
     96         * @param array $tables  The blog tables to be dropped.
     97         * @param int   $blog_id The ID of the blog to drop tables for.
     98         */
     99        $drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $blog_id );
    84100
    85101        foreach ( (array) $drop_tables as $table ) {
     
    90106
    91107        $uploads = wp_upload_dir();
     108        /**
     109         * Filter the upload base directory to delete when the blog is deleted.
     110         *
     111         * @since MU
     112         *
     113         * @param string $uploads['basedir'] Uploads path without subdirectory. @see wp_upload_dir()
     114         * @param int    $blog_id            The blog ID.
     115         */
    92116        $dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id );
    93117        $dir = rtrim( $dir, DIRECTORY_SEPARATOR );
     
    138162    if ( !$user->exists() )
    139163        return false;
    140 
     164    /**
     165     * Fires when a user is deleted from the network.
     166     *
     167     * @since MU
     168     *
     169     * @param int $id User ID of the user about to be deleted from the network.
     170     */
    141171    do_action( 'wpmu_delete_user', $id );
    142172
     
    173203    clean_user_cache( $user );
    174204
    175     // allow for commit transaction
     205    /**
     206     * Fires after the user is deleted from the network.
     207     *
     208     * @since 2.8.0
     209     *
     210     * @param int $id User ID of the user about to be deleted from the network.
     211     */
    176212    do_action( 'deleted_user', $id );
    177213
     
    191227    update_option( 'adminhash', $new_admin_email );
    192228
    193     $content = apply_filters( 'new_admin_email_content', __( "Dear user,
     229    $email_text = __( 'Dear user,
    194230
    195231You recently requested to have the administration email address on
     
    205241Regards,
    206242All at ###SITENAME###
    207 ###SITEURL### "), $new_admin_email );
     243###SITEURL###' );
     244
     245    /**
     246     * Filter the email text sent when the site admin email is changed.
     247     *
     248     * The following strings have a special meaning and will get replaced dynamically:
     249     * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functunalty is will break.
     250     * ###EMAIL###     The new email.
     251     * ###SITENAME###  The name of the site.
     252     * ###SITEURL###   The URL to the site.
     253     *
     254     * @since MU
     255     *
     256     * @param string $email_text      Text in the email.
     257     * @param string $new_admin_email New admin email that the current administration email was changed to.
     258     */
     259    $content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email );
    208260
    209261    $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'options.php?adminhash='.$hash ) ), $content );
     
    244296                );
    245297        update_option( $current_user->ID . '_new_email', $new_user_email );
    246 
    247         $content = apply_filters( 'new_user_email_content', __( "Dear user,
     298       
     299        $email_text = __( 'Dear user,
    248300
    249301You recently requested to have the email address on your account changed.
     
    258310Regards,
    259311All at ###SITENAME###
    260 ###SITEURL###" ), $new_user_email );
     312###SITEURL###' );
     313
     314        /**
     315         * Filter the email text sent when a user changes emails.
     316         *
     317         * The following strings have a special meaning and will get replaced dynamically:
     318         * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functunalty is will break.
     319         * ###EMAIL### The new email.
     320         * ###SITENAME### The name of the site.
     321         * ###SITEURL### The URL to the site.
     322         *
     323         * @since MU
     324         *
     325         * @param string $email_text     Text in the email.
     326         * @param string $new_user_email New user email that the current user has changed to.
     327         */
     328        $content = apply_filters( 'new_user_email_content', $email_text, $new_user_email );
    261329
    262330        $content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content );
     
    378446
    379447    if ( $pref == 'spam' ) {
    380         if ( $value == 1 )
     448        if ( $value == 1 ) {
     449            /**
     450             * Fires when the user is marked as a SPAM user.
     451             *
     452             * @since 3.0.0
     453             *
     454             * @param int $id User ID of the user marked as SPAM.
     455             */
    381456            do_action( 'make_spam_user', $id );
    382         else
     457        } else {
     458            /**
     459             * Fires when the user is marked as a HAM user. Opposite of SPAM.
     460             *
     461             * @since 3.0.0
     462             *
     463             * @param int $id User ID of the user marked as HAM.
     464             */
    383465            do_action( 'make_ham_user', $id );
     466        }
    384467    }
    385468
     
    412495        'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek',
    413496        've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );
     497   
     498    /**
     499     * Filter the language codes.
     500     *
     501     * @since MU
     502     *
     503     * @param array  $lang_codes Key/value pair of language codes where key is the short version.
     504     * @param string $code       A two-letter designation of the language.
     505     */
    414506    $lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
    415507    return strtr( $code, $lang_codes );
     
    499591    // Order by name
    500592    uksort( $output, 'strnatcasecmp' );
    501 
     593    /**
     594     * Filter the languages available in the dropdown.
     595     *
     596     * @since MU
     597     *
     598     * @param array $output     HTML output of the dropdown.
     599     * @param array $lang_files Available language files.
     600     * @param string $current   The current language code.
     601     */
    502602    $output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
    503603    echo implode( "\n\t", $output );
     
    576676        <tr>
    577677            <th scope="row" colspan="2" class="th-full">
    578                 <a href="<?php echo apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); ?>"><?php _e( 'Create a New Site' ); ?></a>
     678                <?php
     679                $signup_url = network_site_url( 'wp-signup.php' );
     680                /**
     681                 * Filter the site signup URL.
     682                 *
     683                 * @since MU
     684                 *
     685                 * @param string $signup_url The site signup URL.
     686                 */
     687                ?>
     688                <a href="<?php echo apply_filters( 'wp_signup_location', $signup_url ); ?>"><?php _e( 'Create a New Site' ); ?></a>
    579689            </th>
    580690        </tr>
     
    596706    if ( isset($super_admins) )
    597707        return false;
    598 
     708   
     709    /**
     710     * Fires before the user is granted Super Admin privileges.
     711     *
     712     * @since 3.0.0
     713     *
     714     * @param int $user_id User ID of the user is granted Super Admin privileges.
     715     */
    599716    do_action( 'grant_super_admin', $user_id );
    600717
     
    606723        $super_admins[] = $user->user_login;
    607724        update_site_option( 'site_admins' , $super_admins );
     725       
     726        /**
     727         * Fires after the user is granted Super Admin privileges.
     728         *
     729         * @since 3.0.0
     730         *
     731         * @param int $user_id User ID of the user is granted Super Admin privileges.
     732         */
    608733        do_action( 'granted_super_admin', $user_id );
    609734        return true;
     
    624749    if ( isset($super_admins) )
    625750        return false;
    626 
     751    /**
     752     * Fires before the user's Super Admin privileges are revoked.
     753     *
     754     * @since 3.0.0
     755     *
     756     * @param int $user_id User ID of the user Super Admin privileges are being revoked from.
     757     */
    627758    do_action( 'revoke_super_admin', $user_id );
    628759
     
    635766            unset( $super_admins[$key] );
    636767            update_site_option( 'site_admins', $super_admins );
     768           
     769            /**
     770             * Fires after the user's Super Admin privileges are revoked.
     771             *
     772             * @since 3.0.0
     773             *
     774             * @param int $user_id User ID of the user Super Admin privileges were revoked from.
     775             */
    637776            do_action( 'revoked_super_admin', $user_id );
    638777            return true;
     
    648787 *
    649788 * @since 3.1.0
    650  * @param integer $site_id The network/site id to check.
     789 * @param integer $site_id The network/site ID to check.
    651790 */
    652791function can_edit_network( $site_id ) {
     
    657796    else
    658797        $result = false;
    659 
     798    /**
     799     * Filter whether this network can be edited from this page.
     800     *
     801     * @since 3.1.0
     802     *
     803     * @param bool $result  Whether the network can be edited from this page.
     804     * @param int  $site_id The network/site ID to check.
     805     */
    660806    return apply_filters( 'can_edit_network', $result, $site_id );
    661807}
Note: See TracChangeset for help on using the changeset viewer.