static function run()
 {
     global $wpdb;
     //Workaround, as for some reasons, get_option() doesn't work only in this case
     $wpml_media_settings_prepared = $wpdb->prepare("select option_value from {$wpdb->prefix}options where option_name = %s", '_wpml_media');
     $wpml_media_settings = $wpdb->get_col($wpml_media_settings_prepared);
     //Do not run upgrades if this is a new install (i.e.: plugin has no settings)
     if ($wpml_media_settings || get_option('_wpml_media_starting_help')) {
         //echo 'OK';
         //Read the version stored in plugin settings and defaults to '1.6' (the last version before introducing the upgrade logic) if not found
         $current_version = WPML_Media::get_setting('version', '1.6');
         //			echo '<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
         //					OK: $current_version = ' . $current_version;
         //			exit(0);
         $migration_ran = false;
         if (version_compare($current_version, WPML_MEDIA_VERSION, '<')) {
             foreach (self::$versions as $version) {
                 if (version_compare($version, WPML_MEDIA_VERSION, '<=') && version_compare($version, $current_version, '>')) {
                     $upgrade_method = 'upgrade_' . str_replace('.', '_', $version);
                     if (method_exists(__CLASS__, $upgrade_method)) {
                         self::$upgrade_method();
                         $migration_ran = true;
                     }
                 }
             }
         }
     } else {
         //Nothing to update, setting migration as ran
         $migration_ran = true;
     }
     //If any upgrade method has been completed, or there is nothing to update, update the version stored in plugin settings
     if ($migration_ran) {
         WPML_Media::update_setting('version', WPML_MEDIA_VERSION);
     }
 }
 /**
  * Modify and extend the substitution values used for the Bulk Edit on Upload form.
  *
  * @since 2.20
  *
  * @param	array	$page_values [ parameter_name => parameter_value ] pairs
  */
 public static function mla_upload_bulk_edit_form_values($page_values)
 {
     /*
      * Add markup to the $page_values ['custom_fields'] element for the "Always translate" checkbox
      */
     if (class_exists('WPML_Media')) {
         $content_defaults = WPML_Media::get_setting('new_content_settings');
         if (isset($content_defaults['always_translate_media']) && $content_defaults['always_translate_media']) {
             $true_selected = 'selected="selected"';
             $false_selected = '';
         } else {
             $true_selected = '';
             $false_selected = 'selected="selected"';
         }
         $page_values['custom_fields'] .= '      <label class="inline-edit-c_0 clear"><span class="title">WPML</span><span class="input-text-wrap">' . "\n";
         $page_values['custom_fields'] .= '      <select name="mla_always_translate_media">' . "\n";
         $page_values['custom_fields'] .= '        <option ' . $true_selected . ' value="true">' . __('Yes', 'media-library-assistant') . '&nbsp;</option>' . "\n";
         $page_values['custom_fields'] .= '        <option ' . $false_selected . ' value="false">' . __('No', 'media-library-assistant') . '&nbsp;</option>' . "\n";
         $page_values['custom_fields'] .= '      </select><span>&nbsp;' . __('Make media available in all languages', 'media-library-assistant') . '</span>' . "\n";
         $page_values['custom_fields'] .= '      </span></label>' . "\n";
     }
     return $page_values;
 }