Plugin Directory

Changeset 1686878


Ignore:
Timestamp:
06/28/2017 11:06:29 AM (8 years ago)
Author:
wp.kytten
Message:

Improvement for the security check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extended-wp-reset/trunk/extended-wp-reset.php

    r1684893 r1686878  
    6767                require_once( ABSPATH . 'wp-includes/pluggable.php' );
    6868            }
    69             if( current_user_can( 'remove_users' ) ) {
    70 
    71                 $network = ( is_network_admin() ? 'network_' : '' );
    72                 add_action( "{$network}admin_menu", array( $this, 'addPluginPage' ), 0 );
    73                 add_action( 'admin_init', array( $this, 'resetWP' ), 0 );
    74                 add_action( 'init', array( $this, 'loadTextDomain' ) );
    75             }
     69
     70            $network = ( is_network_admin() ? 'network_' : '' );
     71            add_action( "{$network}admin_menu", array( $this, 'addPluginPage' ), 0 );
     72            add_action( 'admin_init', array( $this, 'resetWP' ), 0 );
     73            add_action( 'init', array( $this, 'loadTextDomain' ) );
    7674        }
    7775
     
    9088        public function addPluginPage()
    9189        {
    92             $name = esc_html( __('Extended WP Reset', 'extended-wp-reset' ) );
    93             $page = add_menu_page( $name, $name, $this->isWPMU() ? self::NETWORK_ADMIN_CAP : self::ADMIN_CAP, self::BASE_SLUG, array( $this, 'render_plugin_options_page' ), 'dashicons-admin-generic' );
    94             array_push( $this->_pages, $page );
     90            if( current_user_can( 'remove_users' ) ) {
     91                $name = esc_html( __('Extended WP Reset', 'extended-wp-reset' ) );
     92                $page = add_menu_page( $name, $name, $this->isWPMU() ? self::NETWORK_ADMIN_CAP : self::ADMIN_CAP, self::BASE_SLUG, array( $this, 'render_plugin_options_page' ), 'dashicons-admin-generic' );
     93                array_push( $this->_pages, $page );
     94            }
    9595        }
    9696
     
    100100        public function render_plugin_options_page()
    101101        {
    102             $filePath = plugin_dir_path( __FILE__ ) . 'inc/index.php';
    103             if ( is_file( $filePath ) && is_readable( $filePath ) ) {
    104                 wp_enqueue_script( 'jquery' );
    105                 wp_enqueue_script( 'wp-reset-js', plugin_dir_url( __FILE__ ) . 'res/admin.js', array( 'jquery' ) );
    106                 require( $filePath );
     102            if( current_user_can( 'remove_users' ) ) {
     103                $filePath = plugin_dir_path( __FILE__ ) . 'inc/index.php';
     104                if ( is_file( $filePath ) && is_readable( $filePath ) ) {
     105                    wp_enqueue_script( 'jquery' );
     106                    wp_enqueue_script( 'wp-reset-js', plugin_dir_url( __FILE__ ) . 'res/admin.js', array( 'jquery' ) );
     107                    require( $filePath );
     108                }
    107109            }
    108110        }
Note: See TracChangeset for help on using the changeset viewer.