WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/07/2010 04:27:46 AM (12 years ago)
Author:
ryan
Message:

Strip trailing whites from ms files. see #11644

File:
1 edited

Legend:

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

    r12625 r12632  
    4848
    4949    if ( $drop ) {
    50         $drop_tables = $wpdb->get_results("show tables LIKE '". $wpdb->base_prefix . $blog_id . "\_%'", ARRAY_A); 
    51         $drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables ); 
     50        $drop_tables = $wpdb->get_results("show tables LIKE '". $wpdb->base_prefix . $blog_id . "\_%'", ARRAY_A);
     51        $drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables );
    5252
    5353        reset( $drop_tables );
     
    220220    );
    221221    update_option( 'adminhash', $new_admin_email );
    222    
     222
    223223    $content = apply_filters( 'new_admin_email_content', __("Dear user,
    224224
    225 You recently requested to have the administration email address on 
     225You recently requested to have the administration email address on
    226226your blog changed.
    227227If this is correct, please click on the following link to change it:
     
    236236All at ###SITENAME###
    237237###SITEURL###"), $new_admin_email );
    238    
     238
    239239    $content = str_replace('###ADMIN_URL###', clean_url(get_option( "siteurl" ).'/wp-admin/options.php?adminhash='.$hash), $content);
    240240    $content = str_replace('###EMAIL###', $value, $content);
    241241    $content = str_replace('###SITENAME###', get_site_option( 'site_name' ), $content);
    242242    $content = str_replace('###SITEURL###', 'http://' . $current_site->domain . $current_site->path, $content);
    243    
     243
    244244    wp_mail( $value, sprintf(__('[%s] New Admin Email Address'), get_option('blogname')), $content );
    245245}
     
    355355function get_space_allowed() {
    356356    $spaceAllowed = get_option("blog_upload_space");
    357     if( $spaceAllowed == false ) 
     357    if( $spaceAllowed == false )
    358358        $spaceAllowed = get_site_option("blog_upload_space");
    359359    if( empty($spaceAllowed) || !is_numeric($spaceAllowed) )
     
    377377    }
    378378    ?>
    379     <strong><?php printf(__('Used: %1s%% of %2s'), number_format($percentused), $space );?></strong> 
     379    <strong><?php printf(__('Used: %1s%% of %2s'), number_format($percentused), $space );?></strong>
    380380    <?php
    381381}
    382382
    383383// Display File upload quota on dashboard
    384 function dashboard_quota() {   
     384function dashboard_quota() {
    385385    if ( get_site_option( 'upload_space_check_disabled' ) ) {
    386386        return true;
     
    413413// Edit blog upload space setting on Edit Blog page
    414414function upload_space_setting( $id ) {
    415     $quota = get_blog_option($id, "blog_upload_space"); 
     415    $quota = get_blog_option($id, "blog_upload_space");
    416416    if( !$quota )
    417417        $quota = '';
    418    
     418
    419419    ?>
    420420    <tr>
     
    433433    if( $refresh == 1 )
    434434        refresh_user_details($id);
    435    
     435
    436436    if( $pref == 'spam' ) {
    437         if( $value == 1 ) 
     437        if( $value == 1 )
    438438            do_action( "make_spam_user", $id );
    439439        else
     
    446446function refresh_user_details($id) {
    447447    $id = (int) $id;
    448    
     448
    449449    if ( !$user = get_userdata( $id ) )
    450450        return false;
     
    465465
    466466    $dirName = trailingslashit( BLOGUPLOADDIR );
    467     if (!(is_dir($dirName) && is_readable($dirName))) 
    468         return; 
     467    if (!(is_dir($dirName) && is_readable($dirName)))
     468        return;
    469469
    470470    $dir = dir($dirName);
     
    513513    if ( isset( $_GET[ 'c' ] ) )
    514514        $c = (int)$_GET[ 'c' ];
    515    
     515
    516516    if ( $c >= 5 ) {
    517517        wp_die( __( "You don&#8217;t have permission to view this blog. Please contact the system administrator." ) );
     
    522522    $dashboard_blog = get_dashboard_blog();
    523523    if( is_object( $blog ) ) {
    524         $protocol = ( is_ssl() ? 'https://' : 'http://' ); 
     524        $protocol = ( is_ssl() ? 'https://' : 'http://' );
    525525        wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case"
    526526        exit;
    527527    }
    528528
    529     /* 
    530        If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog, 
     529    /*
     530       If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog,
    531531       then update the primary_blog record to match the user's blog
    532532     */
     
    541541        }
    542542        $blog = get_blog_details( get_usermeta( $current_user->ID , 'primary_blog' ) );
    543         $protocol = ( is_ssl() ? 'https://' : 'http://' ); 
     543        $protocol = ( is_ssl() ? 'https://' : 'http://' );
    544544        wp_redirect( $protocol . $blog->domain . $blog->path . 'wp-admin/?c=' . $c ); // redirect and count to 5, "just in case"
    545545        exit;
     
    559559        $writing = array( 'ping_sites', 'mailserver_login', 'mailserver_pass', 'default_email_category', 'mailserver_port', 'mailserver_url' );
    560560    }
    561     $removed = array( 
     561    $removed = array(
    562562        'general' => array( 'siteurl', 'home', 'admin_email', 'users_can_register', 'default_role' ),
    563563        'reading' => array( 'gzipcompression' ),
     
    585585
    586586function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
    587     $flag = false; 
     587    $flag = false;
    588588    $output = array();
    589                    
     589
    590590    foreach ( (array) $lang_files as $val ) {
    591591        $code_lang = basename( $val, '.mo' );
    592        
     592
    593593        if ( $code_lang == 'en_US' ) { // American English
    594594            $flag = true;
     
    603603            $output[$translated] =  '<option value="'.$code_lang.'"'.(($current == $code_lang) ? ' selected="selected"' : '').'> '.$translated.'</option>';
    604604        }
    605        
    606     }                       
    607    
     605
     606    }
     607
    608608    if ( $flag === false ) { // WordPress english
    609609        $output[] = '<option value=""'.((empty($current)) ? ' selected="selected"' : '').'>'.__('English')."</option>";
    610610    }
    611    
     611
    612612    // Order by name
    613613    uksort($output, 'strnatcasecmp');
    614    
    615     $output = apply_filters('mu_dropdown_languages', $output, $lang_files, $current);   
    616     echo implode("\n\t", $output); 
     614
     615    $output = apply_filters('mu_dropdown_languages', $output, $lang_files, $current);
     616    echo implode("\n\t", $output);
    617617}
    618618
     
    763763    if ( !isset( $_GET['sitewide'] ) )
    764764        return false;
    765        
     765
    766766    /* Add the plugin to the list of sitewide active plugins */
    767767    $active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) );
    768    
     768
    769769    /* Add the activated plugin to the list */
    770770    $active_sitewide_plugins[ $_GET['plugin'] ] = time();
     
    776776    return true;
    777777}
    778 add_action( 'activate_' . $_GET['plugin'], 'activate_sitewide_plugin' ); 
     778add_action( 'activate_' . $_GET['plugin'], 'activate_sitewide_plugin' );
    779779
    780780/**
     
    786786    if ( !$plugin )
    787787        $plugin = $_GET['plugin'];
    788        
     788
    789789    /* Get the active sitewide plugins */
    790790    $active_sitewide_plugins = (array) maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) );
     
    798798    if ( !update_site_option( 'active_sitewide_plugins', $active_sitewide_plugins ) )
    799799        wp_redirect( 'plugins.php?error=true' );
    800    
     800
    801801    return true;
    802802}
    803 add_action( 'deactivate_' . $_GET['plugin'], 'deactivate_sitewide_plugin' ); 
    804 add_action( 'deactivate_invalid_plugin', 'deactivate_sitewide_plugin' ); 
     803add_action( 'deactivate_' . $_GET['plugin'], 'deactivate_sitewide_plugin' );
     804add_action( 'deactivate_invalid_plugin', 'deactivate_sitewide_plugin' );
    805805
    806806/**
     
    812812    if ( !is_site_admin() )
    813813        return false;
    814    
     814
    815815    if ( 'sitewide-active' == $context )
    816816        return false;
    817    
     817
    818818    if ( is_plugin_active( $file ) )
    819819        return false;
    820        
     820
    821821    echo '<tr><td colspan="5" style="background: #f5f5f5; text-align: right;">';
    822822
     
    835835    /* Open the plugin file for reading to check if this is a ms-plugin. */
    836836    $fp = @fopen( WP_PLUGIN_DIR . '/' . $file, 'r' );
    837    
     837
    838838    /* Pull only the first 8kiB of the file in. */
    839839    $plugin_data = @fread( $fp, 8192 );
    840    
     840
    841841    /* PHP will close file handle, but we are good citizens. */
    842842    @fclose($fp);
    843    
     843
    844844    if ( preg_match( '|Site Wide Only:(.*)true$|mi', $plugin_data ) )
    845845        return true;
     
    859859    if ( !is_site_admin() )
    860860        return false;
    861        
     861
    862862    $active_sitewide_plugins = maybe_unserialize( get_site_option( 'active_sitewide_plugins') );
    863863    $context = 'sitewide-active';
    864864
    865     if ( $active_sitewide_plugins ) { 
     865    if ( $active_sitewide_plugins ) {
    866866?>
    867867        <h3><?php _e( 'Currently Active Site Wide Plugins' ) ?></h3>
    868    
     868
    869869        <p><?php _e( 'Plugins that appear in the list below are activate for all blogs across this installation.' ) ?></p>
    870870
     
    899899
    900900                $plugin_data = $all_plugins[$plugin_file];
    901                
     901
    902902                echo "
    903903            <tr class='$context' style='background: #eef2ff;'>
     
    932932                echo "</td>
    933933            </tr>\n";
    934            
     934
    935935                do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
    936936                do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context );
     
    939939            </tbody>
    940940        </table>
    941        
     941
    942942        <p><?php _e( 'Plugins that are enabled site wide can only be disabled by a site administrator.' ) ?></p>
    943        
     943
    944944<?php
    945945    }
     
    960960    }
    961961
    962     /* Now unset any sitewide only plugins if the user is not a site admin */   
     962    /* Now unset any sitewide only plugins if the user is not a site admin */
    963963    if ( !is_site_admin() ) {
    964964        foreach ( $inactive_plugins as $plugin_name => $activated_time ) {
     
    967967        }
    968968    }
    969    
     969
    970970    return $inactive_plugins;
    971971}
     
    984984        unset( $active_plugins[ $sitewide_plugin ] );
    985985    }
    986    
     986
    987987    return $active_plugins;
    988988}
     
    997997function check_is_wpmu_plugin_on_activate() {
    998998    /***
    999      * On plugin activation on a blog level, check to see if this is actually a 
     999     * On plugin activation on a blog level, check to see if this is actually a
    10001000     * site wide MU plugin. If so, deactivate and activate it site wide.
    10011001     */
    10021002    if ( is_wpmu_sitewide_plugin( $_GET['plugin'] ) || isset( $_GET['sitewide'] ) ) {
    10031003        deactivate_plugins( $_GET['plugin'], true );
    1004        
     1004
    10051005        /* Silently activate because the activate_* hook has already run. */
    10061006        if ( is_site_admin() ) {
     
    10231023                if ( is_site_admin() )
    10241024                    activate_sitewide_plugin( $plugin );
    1025             }           
     1025            }
    10261026        }
    10271027    }
     
    10511051            ?>
    10521052            <select name="primary_blog">
    1053                 <?php foreach( (array) $all_blogs as $blog ) { 
     1053                <?php foreach( (array) $all_blogs as $blog ) {
    10541054                    if( $primary_blog == $blog->userblog_id )
    10551055                        $found = true;
    1056                     ?><option value='<?php echo $blog->userblog_id ?>'<?php if( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>>http://<?php echo $blog->domain.$blog->path ?></option><?php 
     1056                    ?><option value='<?php echo $blog->userblog_id ?>'<?php if( $primary_blog == $blog->userblog_id ) echo ' selected="selected"' ?>>http://<?php echo $blog->domain.$blog->path ?></option><?php
    10571057                } ?>
    10581058            </select>
     
    10741074    </tr>
    10751075    </table>
    1076     <?php   
     1076    <?php
    10771077}
    10781078add_action ( 'myblogs_allblogs_options', 'choose_primary_blog' );
     
    11451145    <?php
    11461146    do_action( 'myblogs_allblogs_options' );
    1147     ?><table class='widefat'> <?php 
     1147    ?><table class='widefat'> <?php
    11481148    $settings_html = apply_filters( 'myblogs_options', '', 'global' );
    11491149    if ( $settings_html != '' ) {
     
    11661166        $split = $split + $cols;
    11671167    }
    1168  
     1168
    11691169    foreach( $rows as $row ) {
    11701170        $c = $c == "alternate" ? "" : "alternate";
     
    12171217            foreach( $rows as $row ) {
    12181218                $value = $row->meta_value;
    1219                 if ( !@unserialize( $value ) ) 
    1220                     $value = stripslashes( $value ); 
     1219                if ( !@unserialize( $value ) )
     1220                    $value = stripslashes( $value );
    12211221                if ( $value !== $row->meta_value ) {
    12221222                    update_site_option( $row->meta_key, $value );
     
    12311231        foreach( $rows as $row ) {
    12321232            $value = $row->option_value;
    1233             if ( !@unserialize( $value ) ) 
    1234                 $value = stripslashes( $value ); 
     1233            if ( !@unserialize( $value ) )
     1234                $value = stripslashes( $value );
    12351235            if ( $value !== $row->option_value ) {
    12361236                update_blog_option( $blog_id, $row->option_name, $value );
Note: See TracChangeset for help on using the changeset viewer.