/** * Wrapper for \tm_after_load() */ public function tm_after_load() { tm_after_load(); }
function load() { global $pagenow, $wpml_translation_job_factory; tm_after_load(); $wpml_wp_api = new WPML_WP_API(); $this->service_activation_ajax = new WPML_TM_Service_Activation_AJAX($wpml_wp_api, $wpml_translation_job_factory); self::ensure_includes(); $this->activate_embedded_modules(); global $sitepress; $this->plugin_localization(); add_action('wp_ajax_basket_extra_fields_refresh', array($this, 'basket_extra_fields_refresh')); // Check if WPML is active. If not display warning message and not load Sticky links if (!defined('ICL_SITEPRESS_VERSION') || ICL_PLUGIN_INACTIVE) { if (!function_exists('is_multisite') || !is_multisite()) { add_action('admin_notices', array($this, '_no_wpml_warning')); } return false; } elseif (!$sitepress->get_setting('setup_complete')) { add_action('admin_notices', array($this, '_wpml_not_installed_warning')); return false; } elseif (version_compare(ICL_SITEPRESS_VERSION, '2.0.5', '<')) { add_action('admin_notices', array($this, '_old_wpml_warning')); return false; } if (isset($_GET['icl_action'])) { if ($_GET['icl_action'] === 'reminder_popup' && isset($_GET['_icl_nonce']) && wp_verify_nonce($_GET['_icl_nonce'], 'reminder_popup_nonce') === 1) { add_action('init', array('TranslationProxy_Popup', 'display')); } elseif ($_GET['icl_action'] === 'dismiss_help') { $sitepress->set_setting('dont_show_help_admin_notice', true, true); } } if (is_admin() || defined('XMLRPC_REQUEST')) { global $ICL_Pro_Translation; $ICL_Pro_Translation = new WPML_Pro_Translation(); } if (is_admin()) { $this->automatic_service_selection(); add_action('translation_service_authentication', array($this, 'translation_service_authentication')); add_filter('translation_service_js_data', array($this, 'translation_service_js_data')); add_filter('wpml_string_status_text', array('WPML_Remote_String_Translation', 'string_status_text_filter'), 10, 3); add_action('wp_ajax_translation_service_authentication', array($this, 'translation_service_authentication_ajax')); add_action('wp_ajax_translation_service_toggle', array($this, 'translation_service_toggle_ajax')); add_action('trashed_post', array($this, 'trashed_post_actions'), 10, 2); add_action('wp_ajax_icl_get_jobs_table', 'icl_get_jobs_table'); add_action('wp_ajax_icl_cancel_translation_jobs', 'icl_cancel_translation_jobs'); add_action('wp_ajax_icl_populate_translations_pickup_box', 'icl_populate_translations_pickup_box'); add_action('wp_ajax_icl_pickup_translations', 'icl_pickup_translations'); add_action('wp_ajax_icl_get_job_original_field_content', 'icl_get_job_original_field_content'); add_action('wp_ajax_icl_get_blog_users_not_translators', 'icl_get_blog_users_not_translators'); add_action('wp_ajax_get_translator_status', array('TranslationProxy_Translator', 'get_translator_status_ajax')); add_action('wpml_updated_translation_status', array('TranslationProxy_Batch', 'maybe_assign_generic_batch'), 10, 2); if (!defined('DOING_AJAX')) { $this->service_incomplete_local_jobs_notice(); $this->service_authentication_notice(); if ($pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page'] == WPML_TM_FOLDER . '/menu/main.php' && (!isset($_GET['sm']) || $_GET['sm'] === 'dashboard')) { $this->show_3_2_upgrade_notice(); } } do_action('wpml_tm_init'); if ($pagenow != 'customize.php') { // stop TM scripts from messing up theme customizer add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); add_action('admin_print_styles', array($this, 'admin_print_styles')); } add_action('icl_wpml_top_menu_added', array($this, '_icl_hook_top_menu')); add_action('admin_menu', array($this, 'menu')); add_action('admin_menu', array($this, 'menu_fix_order'), 999); // force 'Translations' at the end add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2); add_action('icl_dashboard_widget_content_top', array($this, 'icl_dashboard_widget_content')); // Add a nice warning message if the user tries to edit a post manually and it's actually in the process of being translated global $pagenow; $request_get_trid = filter_input(INPUT_GET, 'trid', FILTER_SANITIZE_NUMBER_INT, FILTER_NULL_ON_FAILURE); $request_get_post = filter_input(INPUT_GET, 'post', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_NULL_ON_FAILURE); $request_get_lang = filter_input(INPUT_GET, 'lang', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_NULL_ON_FAILURE); if (($pagenow == 'post-new.php' || $pagenow == 'post.php') && ($request_get_trid || $request_get_post) && $request_get_lang) { add_action('admin_notices', array($this, '_warn_editing_icl_translation')); } add_action('wp_ajax_dismiss_icl_side_by_site', array($this, 'dismiss_icl_side_by_site')); add_action('wp_ajax_icl_tm_parent_filter', array($this, '_icl_tm_parent_filter')); add_action('wp_ajax_icl_tm_toggle_promo', array($this, '_icl_tm_toggle_promo')); if (defined('WPML_ST_VERSION')) { require WPML_TM_PATH . '/menu/string-translation/wpml-remote-string-translation.class.php'; add_action('wpml_st_below_menu', array('WPML_Remote_String_Translation', 'display_string_menu')); //Todo: [WPML 3.3] this needs to be moved to ST plugin add_action('wpml_tm_send_string_jobs', array('WPML_Remote_String_Translation', 'send_strings_jobs'), 10, 5); } add_action('wpml_support_page_after', array($this, 'add_com_log_link')); add_action('wpml_translation_basket_page_after', array($this, 'add_com_log_link')); WPML_TM_Troubleshooting::init(); } do_action('wpml_tm_loaded'); return true; }