function verify_wpml()
 {
     if (is_admin()) {
         $dependencies = new WPML_Media_Dependencies();
         $dependencies->check();
     }
 }
 function init()
 {
     $this->plugin_localization();
     if (is_admin()) {
         $dependencies = new WPML_Media_Dependencies();
         if (!$dependencies->check()) {
             return false;
         }
         WPML_Media_Upgrade::run();
     }
     self::init_settings();
     $this->overrides();
     global $wpdb, $sitepress, $sitepress_settings, $pagenow;
     if (!isset($sitepress)) {
         return null;
     }
     $active_languages = $sitepress->get_active_languages();
     if (!self::get_setting('starting_help') && (empty($_GET['page']) || $_GET['page'] != 'wpml-media')) {
         $total_attachments_prepared = $wpdb->prepare("\n                SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_type = %s AND ID NOT IN\n                (SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = %s)", array('attachment', 'wpml_media_processed'));
         $total_attachments = $wpdb->get_var($total_attachments_prepared);
         if ($total_attachments) {
             if (count($active_languages) > 1) {
                 add_action('admin_notices', array($this, 'first_time_notice'));
             }
         } else {
             self::update_setting('starting_help', 1);
         }
     }
     $this->languages = null;
     if (is_admin() && !$this->is_uploading_plugin_or_theme()) {
         add_action('admin_head', array($this, 'js_scripts'));
         if (1 < count($active_languages)) {
             add_action('admin_menu', array($this, 'menu'));
             add_filter('manage_media_columns', array($this, 'manage_media_columns'), 10, 1);
             add_action('manage_media_custom_column', array($this, 'manage_media_custom_column'), 10, 2);
             add_action('parse_query', array($this, 'parse_query'));
             add_filter('views_upload', array($this, 'views_upload'));
             add_action('icl_post_languages_options_after', array($this, 'language_options'));
             // Post/page save actions
             add_action('save_post', array($this, 'save_post_actions'), 10, 2);
             add_action('icl_make_duplicate', array($this, 'make_duplicate'), 10, 4);
             add_action('added_post_meta', array($this, 'added_post_meta'), 10, 4);
             add_action('updated_postmeta', array($this, 'updated_postmeta'), 10, 4);
             add_action('add_attachment', array($this, 'save_attachment_actions'));
             add_action('add_attachment', array($this, 'save_translated_attachments'));
             add_action('edit_attachment', array($this, 'save_attachment_actions'));
             // Attachment metadata hooks
             add_filter('wp_generate_attachment_metadata', array($this, 'wp_generate_attachment_metadata'), 10, 2);
             //wp_delete_file file filter
             add_filter('wp_delete_file', array($this, 'delete_file'));
             if ($pagenow == 'media-upload.php') {
                 //Add the language filter to the media library
                 add_action('media_upload_library', array($this, 'language_filter'), 99);
             }
             if ($pagenow == 'media.php') {
                 add_action('admin_footer', array($this, 'media_language_options'));
             }
             if ($pagenow == 'upload.php') {
                 //Add the language filter to the media library (language_filter): /wp-admin/upload.php
                 add_action('admin_footer', array($this, 'language_filter_upload_page'));
             }
             add_action('wp_ajax_wpml_media_dismiss_starting_help', array($this, 'dismiss_wpml_media_starting_help'));
             add_action('wp_ajax_wpml_media_set_initial_language', array($this, 'batch_set_initial_language'));
             add_action('wp_ajax_wpml_media_translate_media', array($this, 'batch_translate_media'));
             add_action('wp_ajax_wpml_media_duplicate_media', array($this, 'batch_duplicate_media'));
             add_action('wp_ajax_wpml_media_duplicate_featured_images', array($this, 'batch_duplicate_featured_images'));
             add_action('wp_ajax_wpml_media_mark_processed', array($this, 'batch_mark_processed'));
             add_action('wp_ajax_wpml_media_scan_prepare', array($this, 'batch_scan_prepare'));
             add_action('wp_ajax_wpml_media_set_content_prepare', array($this, 'set_content_defaults_prepare'));
             add_action('wp_ajax_wpml_media_set_content_defaults', array($this, 'set_content_defaults'));
             add_action('wp_ajax_set-post-thumbnail', array($this, 'ajax_set_post_thumbnail'), 0);
             add_action('wp_ajax_find_posts', array($this, 'find_posts_filter'), 0);
         }
         add_action('icl_pro_translation_saved', array($this, 'icl_pro_translation_saved'), 10, 1);
     } else {
         if ($sitepress_settings['language_negotiation_type'] == 2) {
             // Translate media url when in front-end and only when using custom domain
             add_filter('wp_get_attachment_url', array($this, 'wp_get_attachment_url'), 10, 2);
         }
     }
     add_filter('WPML_filter_link', array($this, 'filter_link'), 10, 2);
     add_filter('icl_ls_languages', array($this, 'icl_ls_languages'), 10, 1);
     return null;
 }