Plugin Directory

Changeset 1115938


Ignore:
Timestamp:
03/19/2015 10:15:30 AM (11 years ago)
Author:
AZdv
Message:

Updating admin class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-plugin-packer/trunk/admin/class-wp-plugin-packer-admin.php

    r1115926 r1115938  
    5050        wp_register_script( $this->wp_plugin_packer, plugin_dir_url( __FILE__ ) . 'js/wp-plugin-packer-admin.js', array( 'jquery', 'jquery-ui-sortable', 'media' ), $this->version, false );
    5151       
    52         wp_localize_script( $this->wp_plugin_packer, 'translationStrings', [
     52        wp_localize_script( $this->wp_plugin_packer, 'translationStrings', array(
    5353            'wp_plugin_packer' => $this->wp_plugin_packer,
    5454            'nonce' => wp_create_nonce( $this->wp_plugin_packer ),
     
    5858            'deactivate_url' => admin_url( 'plugins.php?deactivate=true' ),
    5959            'nonce_plugins' => wp_create_nonce( 'bulk-plugins' ),
    60         ] );
     60        ) );
    6161       
    6262        wp_enqueue_script( $this->wp_plugin_packer );
     
    137137    public function get_plugin_packs() {
    138138        $plugin_packs = get_option( $this->wp_plugin_packer . '_plugin_packs' );
    139         $missing_plugins = [];
     139        $missing_plugins = array();
    140140        if ( false === $plugin_packs ) {
    141141            $plugin_packs = $this->init_plugin_packs();
     
    207207    public function handle_generate_export_file() {
    208208        if ( ! wp_verify_nonce( $_GET['nonce'], $this->wp_plugin_packer ) ) {
    209             wp_send_json_error( [ 'error' => __( 'Bad Request' ) ] );
     209            wp_send_json_error( array( 'error' => __( 'Bad Request' ) ) );
    210210        }
    211211        if ( isset( $_GET['plugin_files'] ) && count( $_GET['plugin_files'] ) ) {
     
    257257    public function import_file() {
    258258        if ( ! wp_verify_nonce( $_POST['nonce'], $this->wp_plugin_packer ) || ! is_numeric( $_POST['attachment_id'] ) ) {
    259             wp_send_json_error( [ 'error' => __( 'Bad Request' ) ] );
     259            wp_send_json_error( array( 'error' => __( 'Bad Request' ) ) );
    260260        }
    261261        $file = get_attached_file( $_POST['attachment_id'] );
     
    265265            $existing_plugins_array = get_plugins();
    266266            $existing_plugin_packs = $this->get_plugin_packs();
    267             $none_existing_plugins = [];
     267            $none_existing_plugins = array();
    268268
    269269            //TODO: Add an option to overwrite OR merge the imported plugin packs
     
    288288                    }
    289289                    if ( ! $plugin_exists ) {
    290                         $none_existing_plugins[] = [
     290                        $none_existing_plugins[] = array(
    291291                            'name' => $plugin->name,
    292292                            'wp_api_slug' => $plugin->wp_api_slug,
    293293                            'required' => true,
    294                         ];
     294                        );
    295295                    }
    296296                    $existing_plugin_packs[ $key ][ 'plugins' ][ $plugin->file ] = $plugin;
     
    309309            $this->set_plugin_packs( $existing_plugin_packs );
    310310
    311             wp_send_json_success( [ 'message' => __( 'Import Successful' ) ] );
     311            wp_send_json_success( array( 'message' => __( 'Import Successful' ) ) );
    312312        }
    313313    }
     
    335335        //Adding plugin to First Pack
    336336        if ( $add_plugin ) {
    337             $plugin_packs[ $this->default_pack_slug ]['plugins'][] = [
     337            $plugin_packs[ $this->default_pack_slug ]['plugins'][] = array(
    338338                'name' => $args->skin->api->name,
    339339                'version' => $args->skin->api->version,
    340340                'file' => $file,
    341341                'wp_api_slug' => $args->skin->api->slug,
    342             ];
     342            );
    343343        }
    344344
     
    392392    public function handle_sanitize_title() {
    393393        if ( isset( $_POST['sanitize_title'] ) ) {
    394             wp_send_json_success( [ 'message' => sanitize_title( $_POST['sanitize_title'] ) ] );
     394            wp_send_json_success( array( 'message' => sanitize_title( $_POST['sanitize_title'] ) ) );
    395395        }
    396396    }
Note: See TracChangeset for help on using the changeset viewer.