public function enqueue_scripts($hook)
 {
     if ('post.php' !== $hook) {
         return;
     }
     if ('attachment' !== get_post_type()) {
         return;
     }
     $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_script('wp-gcs-offload-attachment-edit', App::get_url('assets/dist/js/attachment-edit' . $min . '.js'), array('jquery', 'wp-util'), App::get_info('version'), true);
     wp_enqueue_style('wp-gcs-offload-attachment-edit', App::get_url('assets/dist/css/attachment-edit' . $min . '.css'), array(), App::get_info('version'));
     wp_localize_script('wp-gcs-offload-attachment-edit', '_wpGCSOffloadAttachmentEdit', array('sync_attachment_upstream_nonce' => AjaxHandler::instance()->get_action_nonce('sync_attachment_upstream'), 'sync_attachment_downstream_nonce' => AjaxHandler::instance()->get_action_nonce('sync_attachment_downstream'), 'delete_attachment_upstream_nonce' => AjaxHandler::instance()->get_action_nonce('delete_attachment_upstream'), 'delete_attachment_downstream_nonce' => AjaxHandler::instance()->get_action_nonce('delete_attachment_downstream'), 'error_prefix' => __('Error:', 'wp-gcs-offload')));
 }
Example #2
0
 public function setup_ajax_handler()
 {
     $ajax_handler = AjaxHandler::instance();
     add_action('admin_init', array($ajax_handler, 'add_actions'));
 }