/**
  * Abstract class constructor
  *
  * @param string $plugin_file_path
  */
 function init($plugin_file_path)
 {
     self::$plugin_page = $this->plugin_slug;
     $this->plugin_title = __('Offload S3', 'amazon-s3-and-cloudfront');
     $this->plugin_menu_title = __('S3 and CloudFront', 'amazon-s3-and-cloudfront');
     new AS3CF_Upgrade_Region_Meta($this);
     new AS3CF_Upgrade_File_Sizes($this);
     new AS3CF_Upgrade_Meta_WP_Error($this);
     add_action('aws_admin_menu', array($this, 'admin_menu'));
     add_action('wp_ajax_as3cf-get-buckets', array($this, 'ajax_get_buckets'));
     add_action('wp_ajax_as3cf-save-bucket', array($this, 'ajax_save_bucket'));
     add_action('wp_ajax_as3cf-create-bucket', array($this, 'ajax_create_bucket'));
     add_action('wp_ajax_as3cf-manual-save-bucket', array($this, 'ajax_save_bucket'));
     add_action('wp_ajax_as3cf-get-url-preview', array($this, 'ajax_get_url_preview'));
     // Admin notices
     add_action('admin_notices', array($this, 'maybe_show_admin_notices'));
     add_action('network_admin_notices', array($this, 'maybe_show_admin_notices'));
     add_action('shutdown', array($this, 'save_admin_notices'));
     add_filter('wp_get_attachment_url', array($this, 'wp_get_attachment_url'), 99, 2);
     add_filter('wp_handle_upload_prefilter', array($this, 'wp_handle_upload_prefilter'), 1);
     add_filter('wp_update_attachment_metadata', array($this, 'wp_update_attachment_metadata'), 110, 2);
     add_filter('wp_get_attachment_metadata', array($this, 'wp_get_attachment_metadata'), 10, 2);
     add_filter('delete_attachment', array($this, 'delete_attachment'), 20);
     add_filter('update_attached_file', array($this, 'update_attached_file'), 100, 2);
     add_filter('get_attached_file', array($this, 'get_attached_file'), 10, 2);
     add_filter('plugin_action_links', array($this, 'plugin_actions_settings_link'), 10, 2);
     add_filter('pre_get_space_used', array($this, 'multisite_get_spaced_used'));
     // include compatibility code for other plugins
     new AS3CF_Plugin_Compatibility($this);
     load_plugin_textdomain('amazon-s3-and-cloudfront', false, dirname(plugin_basename($plugin_file_path)) . '/languages/');
     // Register modal scripts and styles
     $this->register_modal_assets();
 }
Пример #2
0
 /**
  * Abstract class constructor
  *
  * @param string $plugin_file_path
  */
 function init($plugin_file_path)
 {
     self::$plugin_page = $this->plugin_slug;
     $this->plugin_title = __('Offload S3', 'amazon-s3-and-cloudfront');
     $this->plugin_menu_title = __('S3 and CloudFront', 'amazon-s3-and-cloudfront');
     new AS3CF_Upgrade_Region_Meta($this);
     new AS3CF_Upgrade_File_Sizes($this);
     new AS3CF_Upgrade_Meta_WP_Error($this);
     // Plugin setup
     add_action('aws_admin_menu', array($this, 'admin_menu'));
     add_filter('plugin_action_links', array($this, 'plugin_actions_settings_link'), 10, 2);
     add_filter('pre_get_space_used', array($this, 'multisite_get_spaced_used'));
     // UI AJAX
     add_action('wp_ajax_as3cf-get-buckets', array($this, 'ajax_get_buckets'));
     add_action('wp_ajax_as3cf-save-bucket', array($this, 'ajax_save_bucket'));
     add_action('wp_ajax_as3cf-create-bucket', array($this, 'ajax_create_bucket'));
     add_action('wp_ajax_as3cf-manual-save-bucket', array($this, 'ajax_save_bucket'));
     add_action('wp_ajax_as3cf-get-url-preview', array($this, 'ajax_get_url_preview'));
     // Rewriting URLs, doesn't depend on plugin being setup
     add_filter('wp_get_attachment_url', array($this, 'wp_get_attachment_url'), 99, 2);
     add_filter('get_image_tag', array($this, 'maybe_encode_get_image_tag'), 99, 6);
     add_filter('wp_get_attachment_image_src', array($this, 'maybe_encode_wp_get_attachment_image_src'), 99, 4);
     add_filter('wp_prepare_attachment_for_js', array($this, 'maybe_encode_wp_prepare_attachment_for_js'), 99, 3);
     add_filter('get_attached_file', array($this, 'get_attached_file'), 10, 2);
     // Communication with S3, plugin needs to be setup
     add_filter('wp_handle_upload_prefilter', array($this, 'wp_handle_upload_prefilter'), 1);
     add_filter('wp_update_attachment_metadata', array($this, 'wp_update_attachment_metadata'), 110, 2);
     add_filter('delete_attachment', array($this, 'delete_attachment'), 20);
     add_filter('update_attached_file', array($this, 'update_attached_file'), 100, 2);
     // include compatibility code for other plugins
     $this->plugin_compat = new AS3CF_Plugin_Compatibility($this);
     load_plugin_textdomain('amazon-s3-and-cloudfront', false, dirname(plugin_basename($plugin_file_path)) . '/languages/');
     // Register modal scripts and styles
     $this->register_modal_assets();
 }
 /**
  * Abstract class constructor
  *
  * @param string $plugin_file_path
  */
 function init($plugin_file_path)
 {
     self::$plugin_page = $this->plugin_slug;
     $this->plugin_title = __('Offload S3 Lite', 'amazon-s3-and-cloudfront');
     $this->plugin_menu_title = __('S3 and CloudFront', 'amazon-s3-and-cloudfront');
     new AS3CF_Upgrade_Region_Meta($this);
     new AS3CF_Upgrade_File_Sizes($this);
     new AS3CF_Upgrade_Meta_WP_Error($this);
     new AS3CF_Upgrade_Content_Replace_URLs($this);
     new AS3CF_Upgrade_EDD_Replace_URLs($this);
     new AS3CF_Upgrade_Filter_Post_Excerpt($this);
     // Plugin setup
     add_action('aws_admin_menu', array($this, 'admin_menu'));
     add_filter('plugin_action_links', array($this, 'plugin_actions_settings_link'), 10, 2);
     add_filter('pre_get_space_used', array($this, 'multisite_get_spaced_used'));
     // display a notice when either lite or pro is automatically deactivated
     add_action('pre_current_active_plugins', array($this, 'plugin_deactivated_notice'));
     // Attachment screens/modals
     add_action('load-upload.php', array($this, 'load_media_assets'), 11);
     add_action('admin_enqueue_scripts', array($this, 'load_attachment_assets'), 11);
     add_action('add_meta_boxes', array($this, 'attachment_s3_meta_box'));
     // UI AJAX
     add_action('wp_ajax_as3cf-get-buckets', array($this, 'ajax_get_buckets'));
     add_action('wp_ajax_as3cf-save-bucket', array($this, 'ajax_save_bucket'));
     add_action('wp_ajax_as3cf-create-bucket', array($this, 'ajax_create_bucket'));
     add_action('wp_ajax_as3cf-manual-save-bucket', array($this, 'ajax_save_bucket'));
     add_action('wp_ajax_as3cf-get-url-preview', array($this, 'ajax_get_url_preview'));
     add_action('wp_ajax_as3cf_get_attachment_s3_details', array($this, 'ajax_get_attachment_s3_details'));
     add_action('wp_ajax_as3cf-get-diagnostic-info', array($this, 'ajax_get_diagnostic_info'));
     // Rewriting URLs, doesn't depend on plugin being setup
     add_filter('wp_get_attachment_url', array($this, 'wp_get_attachment_url'), 99, 2);
     add_filter('get_image_tag', array($this, 'maybe_encode_get_image_tag'), 99, 6);
     add_filter('wp_get_attachment_image_src', array($this, 'maybe_encode_wp_get_attachment_image_src'), 99, 4);
     add_filter('wp_prepare_attachment_for_js', array($this, 'maybe_encode_wp_prepare_attachment_for_js'), 99, 3);
     add_filter('image_get_intermediate_size', array($this, 'maybe_encode_image_get_intermediate_size'), 99, 3);
     add_filter('get_attached_file', array($this, 'get_attached_file'), 10, 2);
     // Communication with S3, plugin needs to be setup
     add_filter('wp_handle_upload_prefilter', array($this, 'wp_handle_upload_prefilter'), 1);
     add_filter('wp_update_attachment_metadata', array($this, 'wp_update_attachment_metadata'), 110, 2);
     add_filter('delete_attachment', array($this, 'delete_attachment'), 20);
     add_filter('update_attached_file', array($this, 'update_attached_file'), 100, 2);
     // Content filtering
     $this->filter_local = new AS3CF_Local_To_S3($this);
     $this->filter_s3 = new AS3CF_S3_To_Local($this);
     // include compatibility code for other plugins
     $this->plugin_compat = new AS3CF_Plugin_Compatibility($this);
     load_plugin_textdomain('amazon-s3-and-cloudfront', false, dirname(plugin_basename($plugin_file_path)) . '/languages/');
     // Register modal scripts and styles
     $this->register_modal_assets();
 }