Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/04/2012 02:17:31 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Admin:

  • Add nonce checks and additional sanity checks to converter, to prevent it being loaded or accessed outside of the converter screen.
  • Use 'load-' actions to conditionally load admin components on their respective screens.
  • Remove post_type checks that are no longer needed as a result of conditionally loading each component.
  • Use get_current_screen() to fill in any extra post_type checks.
  • Sweep through converter, make output more clean, add output method, and store last query in the DB in case of failure.
File:
1 edited

Legend:

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

    r4052 r4053  
    7777
    7878    /**
    79      * Setup the admin hooks, actions and filters
     79     * Admin globals
    8080     *
    8181     * @since bbPress (r2646)
    8282     * @access private
    83      *
    84      * @uses add_action() To add various actions
    85      * @uses add_filter() To add various filters
    86      */
    87     private function setup_actions() {
    88 
    89         /** General Actions ***************************************************/
    90 
    91         // Add menu item to settings menu
    92         add_action( 'bbp_admin_menu',              array( $this, 'admin_menus'             ) );
    93 
    94         // Add some general styling to the admin area
    95         add_action( 'bbp_admin_head',              array( $this, 'admin_head'              ) );
    96 
    97         // Add notice if not using a bbPress theme
    98         add_action( 'bbp_admin_notices',           array( $this, 'activation_notice'       ) );
    99 
    100         // Add green admin style
    101         add_action( 'bbp_register_admin_style',    array( $this, 'register_admin_style'    ) );
    102 
    103         // Add settings
    104         add_action( 'bbp_register_admin_settings', array( $this, 'register_admin_settings' ) );
    105 
    106         // Add menu item to settings menu
    107         add_action( 'bbp_activation',              array( $this, 'new_install'             ) );
    108 
    109         // Forums 'Right now' Dashboard widget
    110         add_action( 'wp_dashboard_setup',  array( $this, 'dashboard_widget_right_now' ) );
    111 
    112         /** Filters ***********************************************************/
    113 
    114         // Add link to settings page
    115         add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
    116 
    117         /** Network Admin *****************************************************/
    118 
    119         // Add menu item to settings menu
    120         add_action( 'network_admin_menu',  array( $this, 'network_admin_menus' ) );
    121 
    122         /** Dependencies ******************************************************/
    123 
    124         // Allow plugins to modify these actions
    125         do_action_ref_array( 'bbp_admin_loaded', array( &$this ) );
     83     */
     84    private function setup_globals() {
     85        $bbp = bbpress();
     86        $this->admin_dir  = trailingslashit( $bbp->plugin_dir . 'bbp-admin' ); // Admin path
     87        $this->admin_url  = trailingslashit( $bbp->plugin_url . 'bbp-admin' ); // Admin url
     88        $this->images_url = trailingslashit( $this->admin_url . 'images'    ); // Admin images URL
     89        $this->styles_url = trailingslashit( $this->admin_url . 'styles'    ); // Admin styles URL
    12690    }
    12791
     
    144108
    145109    /**
    146      * Admin globals
     110     * Setup the admin hooks, actions and filters
    147111     *
    148112     * @since bbPress (r2646)
    149113     * @access private
    150      */
    151     private function setup_globals() {
    152         $bbp = bbpress();
    153         $this->admin_dir  = trailingslashit( $bbp->plugin_dir . 'bbp-admin' ); // Admin url
    154         $this->admin_url  = trailingslashit( $bbp->plugin_url . 'bbp-admin' ); // Admin url
    155         $this->images_url = trailingslashit( $this->admin_url . 'images'    ); // Admin images URL
    156         $this->styles_url = trailingslashit( $this->admin_url . 'styles'    ); // Admin styles URL
     114     *
     115     * @uses add_action() To add various actions
     116     * @uses add_filter() To add various filters
     117     */
     118    private function setup_actions() {
     119
     120        /** General Actions ***************************************************/
     121
     122        add_action( 'bbp_admin_menu',              array( $this, 'admin_menus'                ) ); // Add menu item to settings menu
     123        add_action( 'bbp_admin_head',              array( $this, 'admin_head'                 ) ); // Add some general styling to the admin area
     124        add_action( 'bbp_admin_notices',           array( $this, 'activation_notice'          ) ); // Add notice if not using a bbPress theme
     125        add_action( 'bbp_register_admin_style',    array( $this, 'register_admin_style'       ) ); // Add green admin style
     126        add_action( 'bbp_register_admin_settings', array( $this, 'register_admin_settings'    ) ); // Add settings
     127        add_action( 'bbp_activation',              array( $this, 'new_install'                ) ); // Add menu item to settings menu
     128        add_action( 'wp_dashboard_setup',          array( $this, 'dashboard_widget_right_now' ) ); // Forums 'Right now' Dashboard widget
     129
     130        /** Filters ***********************************************************/
     131
     132        // Add link to settings page
     133        add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
     134
     135        /** Network Admin *****************************************************/
     136
     137        // Add menu item to settings menu
     138        add_action( 'network_admin_menu',  array( $this, 'network_admin_menus' ) );
     139
     140        /** Dependencies ******************************************************/
     141
     142        // Allow plugins to modify these actions
     143        do_action_ref_array( 'bbp_admin_loaded', array( &$this ) );
    157144    }
    158145
     
    660647        wp_admin_css_color( 'bbpress', __( 'Green', 'bbpress' ), $css_file, array( '#222222', '#006600', '#deece1', '#6eb469' ) );
    661648    }
     649
     650    /** Updaters **************************************************************/
    662651
    663652    /**
Note: See TracChangeset for help on using the changeset viewer.