예제 #1
0
 function admin_initialize()
 {
     $is_plugins_page = strpos($_SERVER['REQUEST_URI'], 'plugins.php') !== false;
     // We need the BNCAPI for checking for plugin updates and all the wptouch-pro admin functions
     if ($this->admin_is_wptouch_page() || $is_plugins_page) {
         $this->setup_bncapi();
     }
     // Only check for updates explicitly on plugins page
     if ($is_plugins_page) {
         $can_check_for_update = true;
         if ($can_check_for_update) {
             WPTOUCH_DEBUG(WPTOUCH_INFO, 'Checking for product update');
             $this->check_for_update(true);
         }
     }
     // load the core AJAX on all pages
     $theme_broken = wptouch_migration_is_theme_broken() && !wptouch_can_repair_active_theme();
     if ($this->admin_is_wptouch_page() || $theme_broken) {
         $ajax_params = array('admin_ajax_nonce' => wp_create_nonce('wptouch_admin_ajax'));
         wp_enqueue_script('wptouch-pro-ajax', WPTOUCH_URL . '/admin/js/wptouch-ajax.js', array('jquery'));
         wp_localize_script('wptouch-pro-ajax', 'WPtouchAjax', $ajax_params);
         if ($theme_broken) {
             wp_enqueue_script('wptouch-cloud-migrate', WPTOUCH_URL . '/admin/js/wptouch-admin-migrate.js', array('wptouch-pro-ajax'), false, WPTOUCH_VERSION);
         }
     }
     // Check for broken plugins
     wptouch_migration_check_for_broken_extensions();
     //  load the rest of the admin scripts when we're looking at the WPtouch Pro page
     if ($this->admin_is_wptouch_page()) {
         $localize_params = array('admin_url' => get_bloginfo('wpurl') . '/wp-admin', 'plugin_admin_image_url' => WPTOUCH_ADMIN_URL . '/images', 'admin_nonce' => wp_create_nonce('wptouch_admin'), 'plugin_url' => admin_url('admin.php?page=' . $_GET['page']), 'text_preview_title' => __('Unsupported Browser', 'wptouch-pro'), 'text_preview_content' => __('Theme Preview requires Chrome or Safari.', 'wptouch-pro'), 'reset_settings' => __("This will reset all WPtouch Pro settings.\nAre you sure?", 'wptouch-pro'), 'reset_menus' => __("This will reset all WPtouch Pro menu and icon settings.\nAre you sure?", 'wptouch-pro'), 'cloud_offline' => __("Offline", 'wptouch-pro'), 'cloud_offline_message' => __("You appear to be offline. Connect to the internet to see available BraveNewCloud items.", 'wptouch-pro'), 'cloud_download_fail' => __('The item failed to download for this reason: %reason%', 'wptouch-pro'));
         wp_enqueue_script('jquery-plugins', WPTOUCH_URL . '/admin/js/wptouch-admin-plugins.js', 'jquery', md5(WPTOUCH_VERSION));
         wp_enqueue_script('jquery-ui-draggable');
         wp_enqueue_script('jquery-ui-droppable');
         wp_enqueue_script('wptouch-pro-admin', WPTOUCH_URL . '/admin/js/wptouch-admin-3.js', array('jquery-plugins', 'wptouch-pro-ajax', 'jquery', 'jquery-ui-draggable', 'jquery-ui-droppable'));
         // Set up AJAX requests here
         wp_localize_script('jquery-plugins', 'WPtouchCustom', $localize_params);
     }
     $this->setup_wptouch_admin_ajax();
 }
예제 #2
0
 function admin_initialize()
 {
     $is_plugins_page = strpos($_SERVER['REQUEST_URI'], 'plugins.php') !== false;
     $is_wizard_page = strpos($_SERVER['REQUEST_URI'], '?page=wptouch-admin-wizard') !== false;
     // We need the BNCAPI for checking for plugin updates and all the wptouch-pro admin functions
     if ($this->admin_is_wptouch_page() || $is_plugins_page) {
         $this->setup_bncapi();
     }
     // Only check for updates explicitly on plugins page
     if ($is_plugins_page) {
         $can_check_for_update = true;
         if ($can_check_for_update) {
             WPTOUCH_DEBUG(WPTOUCH_INFO, 'Checking for product update');
             $this->check_for_update(true);
         }
     }
     // Remodal, load everywhere except wizard
     if (!$is_wizard_page) {
         wp_enqueue_script('wptouch-remodal', WPTOUCH_URL . '/admin/js/wptouch-admin-remodal.js', array('wptouch-pro-ajax'), md5(WPTOUCH_VERSION), true);
         wp_enqueue_style('wptouch-remodal', WPTOUCH_URL . '/admin/css/wptouch-admin-remodal.css', false, md5(WPTOUCH_VERSION));
     }
     // load the core AJAX on all pages
     $theme_broken = wptouch_migration_is_theme_broken() && !wptouch_can_repair_active_theme();
     if ($this->admin_is_wptouch_page() || $theme_broken) {
         $ajax_params = array('admin_ajax_nonce' => wp_create_nonce('wptouch_admin_ajax'));
         wp_enqueue_script('wptouch-pro-ajax', WPTOUCH_URL . '/admin/js/wptouch-ajax.js', array('jquery'), md5(WPTOUCH_VERSION), true);
         wp_localize_script('wptouch-pro-ajax', 'WPtouchAjax', $ajax_params);
         if ($theme_broken && !defined('WPTOUCH_IS_FREE')) {
             wp_enqueue_script('wptouch-cloud-migrate', WPTOUCH_URL . '/admin/js/wptouch-admin-migrate.js', array('wptouch-pro-ajax'), md5(WPTOUCH_VERSION));
         }
     }
     // Check for broken plugins
     wptouch_migration_check_for_broken_extensions();
     //  load the rest of the admin scripts when we're looking at the WPtouch Pro page
     if ($this->admin_is_wptouch_page()) {
         $localize_params = array('admin_url' => get_bloginfo('wpurl') . '/wp-admin', 'plugin_admin_image_url' => WPTOUCH_ADMIN_URL . '/images', 'admin_nonce' => wp_create_nonce('wptouch_admin'), 'plugin_url' => admin_url('admin.php?page=' . $_GET['page']), 'reset_settings' => wptouchize_it(__("This will reset all WPtouch Pro settings.\nAre you sure?", 'wptouch-pro')), 'reset_delete' => __("This will reset all WPtouch Pro settings and delete the wptouch-data folder.\nAre you sure?", 'wptouch-pro'), 'reset_delete_deactivate' => __("This will reset all WPtouch Pro settings, delete the wptouch-data folder, and deactivate the plugin. Are you sure?", 'wptouch-pro'), 'cloud_download_fail' => __('The item failed to download for this reason: %reason%', 'wptouch-pro'), 'remove_license' => __('You are about to reset your license information. Proceed?', 'wptouch-pro'), 'upload_complete' => __('Upload Complete!', 'wptouch-pro'), 'upload_invalid' => __('Upload Failed: Not a valid image.', 'wptouch-pro'), 'saving_settings' => __('WPtouch is saving settings. Please do not refresh the page while saving.', 'wptouch-pro'), 'install_themes' => __('Install Themes', 'wptouch-pro'), 'install_extensions' => __('Install Extensions', 'wptouch-pro'), 'install' => __('Install', 'wptouch-pro'), 'installing' => __('Installing', 'wptouch-pro'), 'installed' => __('Installed', 'wptouch-pro'), 'download' => __('Download', 'wptouch-pro'), 'is_network_admin' => is_network_admin());
         // 4.0 Adding some easing :)
         wp_enqueue_script('jquery-easing', '//cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js', array('jquery'), md5(WPTOUCH_VERSION), false);
         if (strpos($_SERVER['REQUEST_URI'], 'wptouch-admin-wizard') == true) {
             // 4.0 Wizard Script
             wp_enqueue_script('wptouch-wizard', WPTOUCH_URL . '/admin/js/wptouch-admin-wizard.js', array('jquery', 'wptouch-admin-plugins'), md5(WPTOUCH_VERSION), false);
         }
         wp_enqueue_script('wptouch-admin-plugins', WPTOUCH_URL . '/admin/js/wptouch-admin-plugins.js', array('jquery'), md5(WPTOUCH_VERSION), false);
         wp_localize_script('wptouch-admin-plugins', 'WPtouchCustom', $localize_params);
         if (strpos($_SERVER['REQUEST_URI'], 'wptouch-admin-wizard') == false) {
             wp_enqueue_script('wptouch-pro-admin', WPTOUCH_URL . '/admin/js/wptouch-admin-4.js', array('wptouch-admin-plugins', 'wptouch-pro-ajax', 'jquery', 'jquery-easing'), md5(WPTOUCH_VERSION), false);
             if (defined('WPTOUCH_IS_FREE')) {
                 wp_enqueue_style('wp-color-picker');
                 wp_enqueue_script('wptouch-pro-admin-color', WPTOUCH_URL . '/admin/js/wptouch-admin-color.js', array('wptouch-pro-admin', 'wp-color-picker'), md5(WPTOUCH_VERSION), false);
             }
         }
     } else {
         // Not a WPtouch admin page
         $localize_params = array('admin_url' => get_bloginfo('wpurl') . '/wp-admin', 'admin_nonce' => wp_create_nonce('wptouch_admin'));
         wp_enqueue_script('wptouch-pro-ajax', WPTOUCH_URL . '/admin/js/wptouch-ajax.js', array('jquery'), md5(WPTOUCH_VERSION), false);
         $ajax_params = array('admin_ajax_nonce' => wp_create_nonce('wptouch_admin_ajax'));
         wp_localize_script('wptouch-pro-ajax', 'WPtouchAjax', $ajax_params);
     }
     $this->setup_wptouch_admin_ajax();
 }