Skip to:
Content

bbPress.org

Changeset 3194


Ignore:
Timestamp:
05/21/2011 11:20:39 AM (13 years ago)
Author:
johnjamesjacoby
Message:

First pass at a stand-alone to plugin converter. Props GautamGupta and Nightgunner5. See #1523.

Location:
branches/plugin/bbp-admin
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-admin/bbp-admin.php

    r3193 r3194  
    9999        //add_action( 'admin_init',    array( $this, 'register_admin_style'    ) );
    100100
     101        // Add the importers
     102        add_action( 'admin_init',    array( $this, 'register_importers'      ) );
     103
    101104        // Add the settings
    102105        add_action( 'admin_init',    array( $this, 'register_admin_settings' ) );
     
    162165
    163166        // Recounts
    164         if ( !empty( $this->enable_recounts ) )
     167        if ( is_super_admin() || !empty( $this->enable_recounts ) )
    165168            add_management_page( __( 'Recount', 'bbpress' ), __( 'Recount', 'bbpress' ), 'manage_options', 'bbp-recount', 'bbp_admin_tools' );
    166169
     
    282285        do_action( 'bbp_register_admin_settings' );
    283286    }
     287        /**
     288         * Register the importers
     289         *
     290         * @todo Make this better
     291         *
     292         * @since bbPress (r2737)
     293         *
     294         * @uses do_action() Calls 'bbp_register_importers'
     295         */
     296        function register_importers() {
     297
     298            // Leave if we're not in the import section
     299            if ( !defined( 'WP_LOAD_IMPORTERS' ) )
     300                return;
     301
     302            global $bbp;
     303
     304            // Load Importer API
     305            require_once( ABSPATH . 'wp-admin/includes/import.php' );
     306
     307            // Load our importers
     308            // The logic here needs to be improved upon
     309            $importers = apply_filters( 'bbp_importers', array( 'bbpress' ) );
     310
     311            // Loop through included importers
     312            foreach ( $importers as $importer ) {
     313
     314                // Compile the importer path
     315                $import_file = $bbp->plugin_dir . 'bbp-admin/importers/' . $importer . '.php';
     316
     317                // If the file exists, include it
     318                if ( file_exists( $import_file ) )
     319                    require( $import_file );
     320            }
     321
     322            // Don't do anything we wouldn't do
     323            do_action( 'bbp_register_importers' );
     324        }
    284325
    285326    /**
Note: See TracChangeset for help on using the changeset viewer.