HM\BackUpWordPress\Plugin::scripts PHP Метод

scripts() публичный Метод

Load the Javascript in the admin.
public scripts ( $hook )
$hook The name of the admin page hook.
    public function scripts($hook)
    {
        if (HMBKP_ADMIN_PAGE !== $hook) {
            return;
        }
        $js_file = HMBKP_PLUGIN_URL . 'assets/hmbkp.min.js';
        // TODO shuold this also support WP_SCRIPT_DEBUG
        if (defined('WP_DEBUG') && WP_DEBUG) {
            $js_file = HMBKP_PLUGIN_URL . 'assets/hmbkp.js';
        }
        wp_enqueue_script('hmbkp', $js_file, array('heartbeat'), sanitize_key(self::PLUGIN_VERSION));
        wp_localize_script('hmbkp', 'hmbkp', array('page_slug' => HMBKP_PLUGIN_SLUG, 'nonce' => wp_create_nonce('hmbkp_nonce'), 'hmbkp_run_schedule_nonce' => wp_create_nonce('hmbkp_run_schedule'), 'update' => __('Update', 'backupwordpress'), 'cancel' => __('Cancel', 'backupwordpress'), 'delete_schedule' => __('Are you sure you want to delete this schedule? All of its backups will also be deleted.', 'backupwordpress') . "\n\n" . __('\'Cancel\' to go back, \'OK\' to delete.', 'backupwordpress') . "\n", 'delete_backup' => __('Are you sure you want to delete this backup?', 'backupwordpress') . "\n\n" . __('\'Cancel\' to go back, \'OK\' to delete.', 'backupwordpress') . "\n", 'remove_exclude_rule' => __('Are you sure you want to remove this exclude rule?', 'backupwordpress') . "\n\n" . __('\'Cancel\' to go back, \'OK\' to delete.', 'backupwordpress') . "\n", 'remove_old_backups' => __('Reducing the number of backups that are stored on this server will cause some of your existing backups to be deleted. Are you sure that\'s what you want?', 'backupwordpress') . "\n\n" . __('\'Cancel\' to go back, \'OK\' to delete.', 'backupwordpress') . "\n"));
    }