/** * Initialization function, similar to __construct() * * @since 0.60 * * @return void */ public static function initialize() { MLATest::$wp_3dot5 = version_compare(get_bloginfo('version'), '3.5.0', '>=') && version_compare(get_bloginfo('version'), '3.5.99', '<='); MLATest::$wp_4dot3_plus = version_compare(get_bloginfo('version'), '4.2.99', '>='); /* * This is the earliest effective place to change error_reporting */ //error_reporting( E_ALL | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED | E_USER_ERROR | E_USER_WARNING ); //error_reporting( E_ALL | E_STRICT ); MLA::$original_php_reporting = sprintf('0x%1$04X', error_reporting()); $php_reporting = trim(MLAOptions::mla_get_option(MLAOptions::MLA_DEBUG_REPLACE_PHP_REPORTING)); if (!empty($php_reporting)) { @error_reporting(0 + $php_reporting); } /* * This is the earliest effective place to localize values in other plugin components */ MLAOptions::mla_localize_option_definitions_array(); MLASettings::mla_localize_tablist(); MLA_List_Table::mla_localize_default_columns_array(); MLA_Upload_List_Table::mla_localize_default_columns_array(); MLA_Upload_Optional_List_Table::mla_localize_default_columns_array(); MLA_View_List_Table::mla_localize_default_columns_array(); }
/** * Load a plugin text domain and alternate debug file * * The "add_action" for this function is in mla-plugin-loader.php, because the "initialize" * function above doesn't run in time. * Defined as public because it's an action. * * @since 1.60 * * @return void */ public static function mla_plugins_loaded_action() { $text_domain = 'media-library-assistant'; $locale = apply_filters('mla_plugin_locale', get_locale(), $text_domain); /* * To override the plugin's translation files for one, some or all strings, * create a sub-directory named 'media-library-assistant' in the WordPress * WP_LANG_DIR (e.g., /wp-content/languages) directory. */ load_textdomain($text_domain, trailingslashit(WP_LANG_DIR) . $text_domain . '/' . $text_domain . '-' . $locale . '.mo'); load_plugin_textdomain($text_domain, false, MLA_PLUGIN_BASENAME . '/languages/'); /* * This must/will be repeated in class-mla-tests.php to reflect translations */ MLAOptions::mla_localize_option_definitions_array(); /* * Do not process debug options unless MLA_DEBUG_LEVEL is set in wp-config.php */ if (MLA_DEBUG_LEVEL & 1) { /* * Set up alternate MLA debug log file */ self::$original_php_log = ini_get('error_log'); $error_log_name = MLAOptions::mla_get_option(MLAOptions::MLA_DEBUG_FILE); if (!empty($error_log_name)) { self::mla_debug_file($error_log_name); /* * Override PHP error_log file */ if ('checked' === MLAOptions::mla_get_option(MLAOptions::MLA_DEBUG_REPLACE_PHP_LOG)) { $result = ini_set('error_log', WP_CONTENT_DIR . self::$mla_debug_file); } } /* * PHP error_reporting must be done later in class-mla-tests.php * Override MLA debug levels */ self::$mla_debug_level = MLA_DEBUG_LEVEL; $mla_reporting = trim(MLAOptions::mla_get_option(MLAOptions::MLA_DEBUG_REPLACE_LEVEL)); if (!empty($mla_reporting)) { self::$mla_debug_level = 0 + $mla_reporting | 1; } } // MLA_DEBUG_LEVEL & 1 }
/** * Load a plugin text domain * * The "add_action" for this function is in mla-plugin-loader.php, because the "initialize" * function above doesn't run in time. * Defined as public because it's an action. * * @since 1.60 * * @return void */ public static function mla_plugins_loaded_action() { $text_domain = 'media-library-assistant'; $locale = apply_filters('mla_plugin_locale', get_locale(), $text_domain); /* * To override the plugin's translation files for one, some or all strings, * create a sub-directory named 'media-library-assistant' in the WordPress * WP_LANG_DIR (e.g., /wp-content/languages) directory. */ load_textdomain($text_domain, trailingslashit(WP_LANG_DIR) . $text_domain . '/' . $text_domain . '-' . $locale . '.mo'); load_plugin_textdomain($text_domain, false, MLA_PLUGIN_BASENAME . '/languages/'); /* * Now we can localize values in other plugin components */ MLAOptions::mla_localize_option_definitions_array(); MLASettings::mla_localize_tablist(); MLA_List_Table::mla_localize_default_columns_array(); MLA_Upload_List_Table::mla_localize_default_columns_array(); MLA_Upload_Optional_List_Table::mla_localize_default_columns_array(); MLA_View_List_Table::mla_localize_default_columns_array(); }