Make WordPress Core

Changeset 12826


Ignore:
Timestamp:
01/25/2010 10:01:43 PM (15 years ago)
Author:
ryan
Message:

phpdoc and cleanup. see #11644

Location:
trunk
Files:
2 edited

Legend:

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

    r12825 r12826  
    11<?php
     2
     3/**
     4 * Determine if uploaded file exceeds space quota.
     5 *
     6 * @since 3.0
     7 *
     8 * @param array $file $_FILES array for a given file.
     9 * @return array $_FILES array with 'error' key set if file exceeds quota. 'error' is empty otherwise.
     10 */
    211function check_upload_size( $file ) {
    3     if ( get_site_option( 'upload_space_check_disabled' ) ) {
     12    if ( get_site_option( 'upload_space_check_disabled' ) )
    413        return $file;
    5     }
     14
    615    if ( $file['error'] != '0' ) // there's already an error
    716        return $file;
     
    2837add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' );
    2938
     39/**
     40 * Delete a blog
     41 *
     42 * @since 3.0
     43 *
     44 * @param int $blog_id Blog ID
     45 * @param bool $drop True if blog's table should be dropped.  Default is false.
     46 * @return void
     47 */
    3048function wpmu_delete_blog($blog_id, $drop = false) {
    3149    global $wpdb;
     
    4159
    4260    // Remove users from this blog.
    43     if ( !empty($users) ) foreach ($users as $user) {
    44         remove_user_from_blog($user->user_id, $blog_id);
     61    if ( !empty($users) ) {
     62        foreach ($users as $user) {
     63            remove_user_from_blog($user->user_id, $blog_id);
     64        }
    4565    }
    4666
     
    6282        $index = 0;
    6383
    64         while ($index < count($stack)) {
     84        while ( $index < count($stack) ) {
    6585            # Get indexed directory from stack
    6686            $dir = $stack[$index];
    6787
    6888            $dh = @ opendir($dir);
    69             if ($dh) {
    70                 while (($file = @ readdir($dh)) !== false) {
     89            if ( $dh ) {
     90                while ( ($file = @ readdir($dh)) !== false ) {
    7191                    if ($file == '.' or $file == '..')
    7292                        continue;
     
    82102
    83103        $stack = array_reverse($stack);  // Last added dirs are deepest
    84         foreach( (array) $stack as $dir) {
     104        foreach( (array) $stack as $dir ) {
    85105            if ( $dir != $top_dir)
    86106            @rmdir($dir);
     
    90110    $blogs = get_site_option( "blog_list" );
    91111    if ( is_array( $blogs ) ) {
    92         foreach( $blogs as $n => $blog ) {
    93             if ( $blog[ 'blog_id' ] == $blog_id ) {
     112        foreach ( $blogs as $n => $blog ) {
     113            if ( $blog[ 'blog_id' ] == $blog_id )
    94114                unset( $blogs[ $n ] );
    95             }
    96115        }
    97116        update_site_option( 'blog_list', $blogs );
     
    153172        if ( $val != '' && $val != '0' ) {
    154173            $user = new WP_User( $val );
    155             if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) ) {
     174            if ( in_array( $user->user_login, get_site_option( 'site_admins', array( 'admin' ) ) ) )
    156175                wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a site admnistrator.' ), $user->user_login ) );
    157             }
    158176            echo "<input type='hidden' name='user[]' value='{$val}'/>\n";
    159177            $blogs = get_blogs_of_user( $val, true );
     
    165183                        echo "<select name='blog[$val][{$key}]'>";
    166184                        $out = '';
    167                         foreach( $blog_users as $user ) {
     185                        foreach ( $blog_users as $user ) {
    168186                            if ( $user->user_id != $val )
    169187                                $out .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
     
    265283            $user->ID = $current_user->ID;
    266284            $user->user_email = wp_specialchars( trim( $new_email[ 'newemail' ] ) );
    267             if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) {
     285            if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) )
    268286                $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
    269             }
    270287            wp_update_user( get_object_vars( $user ) );
    271288            delete_option( $current_user->ID . '_new_email' );
  • trunk/wp-includes/ms-functions.php

    r12807 r12826  
    16091609    $user_id = 0;
    16101610    if ( is_email( $string ) ) {
    1611         $user = get_user_by_email($string);
     1611        $user = get_user_by('email', $string);
    16121612        if ( $user )
    16131613            $user_id = $user->ID;
     
    16151615        $user_id = $string;
    16161616    } else {
    1617         $user = get_userdatabylogin($string);
     1617        $user = get_user_by('login', $string);
    16181618        if ( $user )
    16191619            $user_id = $user->ID;
Note: See TracChangeset for help on using the changeset viewer.