Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/18/2011 12:53:31 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Code normalization and whitespace clean-up. Introduce bp-core-deprecated.php. Introduce root_slug globals into components with directories, to help with WP page slugs. Fixes #2600. Optimus Props boonebgorges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/admin/bp-core-update.php

    r3721 r3728  
    1212
    1313/**
    14  * bp_core_activate_site_options()
    15  *
    1614 * When switching from single to multisite we need to copy blog options to
    1715 * site options.
     
    9189        global $wp_rewrite;
    9290
     91        // Setup wizard steps
    9392        if ( 'new' == $this->setup_type ) {
    94             // Setup wizard steps
    9593            $steps = array(
    9694                __( 'Components', 'buddypress' ),
    97                 __( 'Pages', 'buddypress' ),
     95                __( 'Pages',      'buddypress' ),
    9896                __( 'Permalinks', 'buddypress' ),
    99                 __( 'Theme', 'buddypress' ),
    100                 __( 'Finish', 'buddypress' )
     97                __( 'Theme',      'buddypress' ),
     98                __( 'Finish',     'buddypress' )
    10199            );
    102100
     
    108106                $steps = array_merge( array(), $steps );
    109107            }
     108
     109        // Update wizard steps
    110110        } else {
    111             // Update wizard steps
    112 
    113111            if ( $this->is_network_activate )
    114112                $steps[] = __( 'Multisite Update', 'buddypress' );
     
    167165            <div id="bp-admin-header">
    168166                <h3><?php _e( 'BuddyPress', 'buddypress' ) ?></h3>
    169                 <h2>
    170                     <?php if ( 'update' == $this->setup_type ) : ?>
    171 
    172                         <?php _e( 'Update', 'buddypress' ) ?>
    173 
    174                     <?php else : ?>
    175 
    176                         <?php _e( 'Setup', 'buddypress' ) ?>
    177 
    178                     <?php endif; ?>
    179                 </h2>
     167                <h2><?php ( 'update' == $this->setup_type ) ? _e( 'Update', 'buddypress' ) : _e( 'Setup', 'buddypress' ); ?></h2>
    180168            </div>
    181169
    182170            <?php
    183171                do_action( 'bp_admin_notices' );
     172
    184173                $step_count  = count( $this->steps ) - 1;
    185174                $wiz_or_set  = $this->current_step >= $step_count ? 'bp-general-settings' : 'bp-wizard';
     
    190179                <div id="bp-admin-nav">
    191180                    <ol>
     181
    192182                        <?php foreach( (array)$this->steps as $i => $name ) : ?>
     183
    193184                            <li<?php if ( $this->current_step == $i ) : ?> class="current"<?php endif; ?>>
    194185                                <?php if ( $this->current_step > $i ) : ?>
     186
    195187                                    <span class="complete">&nbsp;</span>
    196                                 <?php else : ?>
    197                                     <?php echo $i + 1 . '. ' ?>
    198                                 <?php endif; ?>
    199                                 <?php echo esc_attr( $name ) ?>
     188
     189                                <?php else :
     190
     191                                    echo $i + 1 . '. ';
     192
     193                                endif;
     194                                echo esc_attr( $name ) ?>
     195
    200196                            </li>
     197
    201198                        <?php endforeach; ?>
     199
    202200                    </ol>
    203201                    <div class="prev-next submit clear">
     
    207205
    208206                <div id="bp-admin-content">
     207
    209208                    <?php switch ( $this->steps[$this->current_step] ) {
    210209                        case __( 'Database Update', 'buddypress'):
     
    233232                            break;
    234233                    } ?>
     234
    235235                </div>
    236236            </form>
    237 
    238         </div>
     237        </div>
     238
    239239    <?php
    240240    }
    241241
    242     /* Setup Step HTML */
     242    // Setup Step HTML
    243243
    244244    function step_db_update() {
    245245        if ( !current_user_can( 'activate_plugins' ) )
    246             return false;
    247     ?>
     246            return false; ?>
     247
    248248        <div class="prev-next submit clear">
    249249            <p><input type="submit" value="<?php _e( 'Update &amp; Next &rarr;', 'buddypress' ) ?>" name="submit" /></p>
     
    257257            <input type="hidden" name="save" value="db_update" />
    258258            <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ) ?>" />
     259
    259260            <?php wp_nonce_field( 'bpwizard_db_update' ) ?>
    260         </div>
     261
     262        </div>
     263
    261264    <?php
    262265    }
     
    319322            <input type="hidden" name="save" value="ms_update" />
    320323            <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ) ?>" />
     324
    321325            <?php wp_nonce_field( 'bpwizard_ms_update' ) ?>
     326
    322327        </div>
    323328
     
    327332            });
    328333        </script>
     334
    329335    <?php
    330336    }
    331 
    332337
    333338    function step_components() {
     
    455460        $disabled_components = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) );
    456461
    457         /* Check for defined slugs */
     462        // Check for defined slugs
    458463        if ( defined( 'BP_MEMBERS_SLUG' ) )
    459464            $members_slug = constant( 'BP_MEMBERS_SLUG' );
     
    628633
    629634        if ( !got_mod_rewrite() && !iis7_supports_permalinks() )
    630             $prefix = '/index.php';
    631     ?>
     635            $prefix = '/index.php'; ?>
    632636
    633637        <p><?php _e( "To make sure the pages we created in the previous step work correctly, you will need to enable permalink support on your site.", 'buddypress' ) ?></p>
     
    654658            <input type="hidden" name="save" value="permalinks" />
    655659            <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ) ?>" />
     660
    656661            <?php wp_nonce_field( 'bpwizard_permalinks' ) ?>
     662
    657663        </div>
    658664    <?php
     
    665671        require_once( ABSPATH . WPINC . '/plugin.php' );
    666672        $installed_plugins = get_plugins();
    667         $installed_themes = get_themes();
     673        $installed_themes  = get_themes();
    668674
    669675        $template_pack_installed = false;
    670         $bp_autotheme_installed = false;
    671         $bp_theme_installed = false;
     676        $bp_autotheme_installed  = false;
     677        $bp_theme_installed      = false;
    672678
    673679        foreach ( (array)$installed_plugins as $plugin ) {
     
    700706                </td>
    701707            </tr>
     708
    702709            <?php /*
    703710            <tr>
     
    714721            </tr>
    715722            */ ?>
     723
    716724            <tr>
    717725                <th>
     
    732740                </td>
    733741            </tr>
     742
    734743            <tr>
    735744                <th>
     
    774783            });
    775784        </script>
     785
    776786    <?php
    777787    }
     
    811821    }
    812822
    813     /* Save Step Methods */
     823    // Save Step Methods
    814824
    815825    function step_db_update_save() {
     
    837847            // Transfer important settings from blog options to site options
    838848            $options = array(
    839                 'bp-db-version' => $this->current_version,
     849                'bp-db-version'             => $this->current_version,
    840850                'bp-deactivated-components' => $disabled,
    841                 'avatar-default' => get_option( 'avatar-default' )
     851                'avatar-default'            => get_option( 'avatar-default' )
    842852            );
    843853            bp_core_activate_site_options( $options );
     
    853863
    854864                $existing_pages = get_option( 'bp-pages' );
    855 
    856                 $bp_pages = $this->setup_pages( (array)$_POST['bp_pages'] );
    857 
    858                 $bp_pages = array_merge( (array)$existing_pages, (array)$bp_pages );
     865                $bp_pages       = $this->setup_pages( (array)$_POST['bp_pages'] );
     866                $bp_pages       = array_merge( (array)$existing_pages, (array)$bp_pages );
    859867
    860868                update_option( 'bp-pages', $bp_pages );
     
    942950                if ( !empty($permalink_structure) )
    943951                    $permalink_structure = preg_replace( '#/+#', '/', '/' . $_POST['permalink_structure'] );
     952
    944953                if ( ( defined( 'VHOST' ) && constant( 'VHOST' ) == 'no' ) && $permalink_structure != '' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path )
    945954                    $permalink_structure = '/blog' . $permalink_structure;
     
    965974            if ( $iis7_permalinks || ( !$usingpi && !$writable ) ) {
    966975                function _bp_core_wizard_step_permalinks_message() {
    967                     global $wp_rewrite;
    968 
    969                     ?><div id="message" class="updated fade"><p>
     976                    global $wp_rewrite; ?>
     977
     978                    <div id="message" class="updated fade"><p>
     979
    970980                    <?php
    971981                        _e( 'Oops, there was a problem creating a configuration file. ', 'buddypress' );
     
    982992                        }
    983993                    ?>
     994
    984995                    <br /><br />
     996
    985997                    <?php
    986998                        if ( empty( $iis7_permalinks ) )
    987999                            _e( 'Paste all these rules into a new <code>.htaccess</code> file in the root of your WordPress installation and save the file. Once you\'re done, please hit the "Save and Next" button to continue.', 'buddypress' );
    9881000                    ?>
    989                     </p></div><?php
     1001
     1002                    </p></div>
     1003
     1004                <?php
    9901005                }
    9911006                add_action( 'bp_admin_notices', '_bp_core_wizard_step_permalinks_message' );
     
    10781093    }
    10791094
    1080     /* Database update methods based on version numbers */
     1095    // Database update methods based on version numbers
    10811096    function update_1_3() {
    10821097        // Run the schema install to update tables
     
    10851100        // Delete old database version options
    10861101        delete_site_option( 'bp-activity-db-version' );
    1087         delete_site_option( 'bp-blogs-db-version' );
    1088         delete_site_option( 'bp-friends-db-version' );
    1089         delete_site_option( 'bp-groups-db-version' );
     1102        delete_site_option( 'bp-blogs-db-version'    );
     1103        delete_site_option( 'bp-friends-db-version'  );
     1104        delete_site_option( 'bp-groups-db-version'   );
    10901105        delete_site_option( 'bp-messages-db-version' );
    10911106        delete_site_option( 'bp-xprofile-db-version' );
     
    12161231        $message = __( 'Installation was successful. The available options have now been updated, please continue with your selection.', 'buddypress' );
    12171232    else
    1218         return false;
    1219 ?>
     1233        return false; ?>
     1234
    12201235    <div id="message" class="updated">
    12211236        <p><?php echo esc_attr( $message ) ?></p>
    12221237    </div>
     1238
    12231239<?php
    12241240}
    12251241add_action( 'bp_admin_notices', 'bp_core_wizard_message' );
    12261242
    1227 /* Alter thickbox screens so the entire plugin download and install interface is contained within. */
     1243// Alter thickbox screens so the entire plugin download and install
     1244// interface is contained within.
    12281245function bp_core_wizard_thickbox() {
    12291246    $form_action = is_multisite() ? network_admin_url( add_query_arg( array( 'page' => 'bp-wizard', 'updated' => '1' ), 'admin.php' ) ) : admin_url( add_query_arg( array( 'page' => 'bp-wizard', 'updated' => '1' ), 'admin.php' ) ); ?>
     
    12421259        }
    12431260    </script>
     1261
    12441262<?php
    12451263}
     
    12471265
    12481266/**
    1249  * bp_core_add_admin_menu()
    1250  *
    12511267 * Adds the "BuddyPress" admin submenu item to the Site Admin tab.
    12521268 *
     
    12911307
    12921308    wp_enqueue_script( 'thickbox' );
    1293     wp_enqueue_style( 'thickbox' );
    1294 ?>
     1309    wp_enqueue_style( 'thickbox' ); ?>
     1310
    12951311    <style type="text/css">
    12961312        /* Wizard Icon */
     
    13101326        }
    13111327    </style>
     1328
    13121329<?php
    13131330}
    13141331add_action( 'admin_head', 'bp_core_add_admin_menu_styles' );
     1332
    13151333?>
Note: See TracChangeset for help on using the changeset viewer.