public function init()
 {
     $this->init_comments_synchronization();
     $this->init_default_settings();
     WPML_Config::load_config();
     if (is_admin()) {
         if ($GLOBALS['pagenow'] === 'edit.php') {
             // use standard WP admin notices
             add_action('admin_notices', array($this, 'show_messages'));
         } else {
             // use custom WP admin notices
             add_action('icl_tm_messages', array($this, 'show_messages'));
         }
         // Add duplicate identifier actions.
         $this->wpml_add_duplicate_check_actions();
         // default settings
         if (empty($this->settings['doc_translation_method']) || !defined('WPML_TM_VERSION')) {
             $this->settings['doc_translation_method'] = ICL_TM_TMETHOD_MANUAL;
         }
     }
 }
 function init()
 {
     global $wpdb, $current_user, $sitepress_settings, $sitepress;
     $this->settings =& $sitepress_settings['translation-management'];
     //logic for syncing comments
     if ($sitepress->get_option('sync_comments_on_duplicates')) {
         add_action('delete_comment', array($this, 'duplication_delete_comment'));
         add_action('edit_comment', array($this, 'duplication_edit_comment'));
         add_action('wp_set_comment_status', array($this, 'duplication_status_comment'), 10, 2);
         add_action('wp_insert_comment', array($this, 'duplication_insert_comment'), 100);
     }
     $this->initial_custom_field_translate_states();
     // defaults
     if (!isset($this->settings['notification']['new-job'])) {
         $this->settings['notification']['new-job'] = ICL_TM_NOTIFICATION_IMMEDIATELY;
     }
     if (!isset($this->settings['notification']['completed'])) {
         $this->settings['notification']['completed'] = ICL_TM_NOTIFICATION_IMMEDIATELY;
     }
     if (!isset($this->settings['notification']['resigned'])) {
         $this->settings['notification']['resigned'] = ICL_TM_NOTIFICATION_IMMEDIATELY;
     }
     if (!isset($this->settings['notification']['dashboard'])) {
         $this->settings['notification']['dashboard'] = true;
     }
     if (!isset($this->settings['notification']['purge-old'])) {
         $this->settings['notification']['purge-old'] = 7;
     }
     if (!isset($this->settings['custom_fields_translation'])) {
         $this->settings['custom_fields_translation'] = array();
     }
     if (!isset($this->settings['doc_translation_method'])) {
         $this->settings['doc_translation_method'] = ICL_TM_TMETHOD_MANUAL;
     }
     get_currentuserinfo();
     $user = false;
     if (isset($current_user->ID)) {
         $user = new WP_User($current_user->ID);
     }
     if (!$user || empty($user->data)) {
         return;
     }
     $ct['translator_id'] = $current_user->ID;
     $ct['display_name'] = isset($user->data->display_name) ? $user->data->display_name : $user->data->user_login;
     $ct['user_login'] = $user->data->user_login;
     $ct['language_pairs'] = get_user_meta($current_user->ID, $wpdb->prefix . 'language_pairs', true);
     if (empty($ct['language_pairs'])) {
         $ct['language_pairs'] = array();
     }
     $this->current_translator = (object) $ct;
     WPML_Config::load_config();
     if (isset($_POST['icl_tm_action'])) {
         $this->process_request($_POST['icl_tm_action'], $_POST);
     } elseif (isset($_GET['icl_tm_action'])) {
         $this->process_request($_GET['icl_tm_action'], $_GET);
     }
     if ($GLOBALS['pagenow'] == 'edit.php') {
         // use standard WP admin notices
         add_action('admin_notices', array($this, 'show_messages'));
     } else {
         // use custom WP admin notices
         add_action('icl_tm_messages', array($this, 'show_messages'));
     }
     if (isset($_GET['page']) && basename($_GET['page']) == 'translations-queue.php' && isset($_GET['job_id'])) {
         add_filter('admin_head', array($this, '_show_tinyMCE'));
     }
     //if(!isset($this->settings['doc_translation_method'])){
     if (isset($this->settings['doc_translation_method']) && $this->settings['doc_translation_method'] < 0) {
         if (isset($_GET['sm']) && $_GET['sm'] == 'mcsetup' && isset($_GET['src']) && $_GET['src'] == 'notice') {
             $this->settings['doc_translation_method'] = ICL_TM_TMETHOD_MANUAL;
             $this->save_settings();
         } else {
             add_action('admin_notices', array($this, '_translation_method_notice'));
         }
     }
     if (defined('WPML_TM_VERSION') && isset($_GET['page']) && $_GET['page'] == WPML_TM_FOLDER . '/menu/main.php' && isset($_GET['sm']) && $_GET['sm'] == 'translators') {
         $iclsettings =& $sitepress_settings;
         $sitepress->get_icl_translator_status($iclsettings);
         $sitepress->save_settings($iclsettings);
     }
     // default settings
     if (empty($this->settings['doc_translation_method']) || !defined('WPML_TM_VERSION')) {
         $this->settings['doc_translation_method'] = ICL_TM_TMETHOD_MANUAL;
     }
 }
 function init()
 {
     $this->init_comments_synchronization();
     $this->init_default_settings();
     WPML_Config::load_config();
     if (is_admin()) {
         if ($GLOBALS['pagenow'] == 'edit.php') {
             // use standard WP admin notices
             add_action('admin_notices', array($this, 'show_messages'));
         } else {
             // use custom WP admin notices
             add_action('icl_tm_messages', array($this, 'show_messages'));
         }
         if ($this->current_page_is('translations-queue.php') && isset($_GET['job_id'])) {
             add_filter('admin_head', array($this, '_show_tinyMCE'));
         }
         if (isset($this->settings['doc_translation_method']) && $this->settings['doc_translation_method'] < 0) {
             if ($this->current_subpage_is('mcsetup') && isset($_GET['src']) && $_GET['src'] == 'notice') {
                 $this->settings['doc_translation_method'] = ICL_TM_TMETHOD_MANUAL;
                 $this->save_settings();
             } else {
                 add_action('admin_notices', array($this, '_translation_method_notice'));
             }
         }
         // default settings
         if (empty($this->settings['doc_translation_method']) || !defined('WPML_TM_VERSION')) {
             $this->settings['doc_translation_method'] = ICL_TM_TMETHOD_MANUAL;
         }
     }
 }
 function init()
 {
     global $sitepress;
     $this->init_comments_synchronization();
     $this->init_default_settings();
     $this->init_current_translator();
     if (!$this->current_translator) {
         return;
     }
     WPML_Config::load_config();
     if (isset($_POST['icl_tm_action'])) {
         $this->process_request($_POST);
     } elseif (isset($_GET['icl_tm_action'])) {
         $this->process_request($_GET);
     }
     if (is_admin()) {
         if ($GLOBALS['pagenow'] == 'edit.php') {
             // use standard WP admin notices
             add_action('admin_notices', array($this, 'show_messages'));
         } else {
             // use custom WP admin notices
             add_action('icl_tm_messages', array($this, 'show_messages'));
         }
         if ($this->current_page_is('translations-queue.php') && isset($_GET['job_id'])) {
             add_filter('admin_head', array($this, '_show_tinyMCE'));
         }
         if (isset($this->settings['doc_translation_method']) && $this->settings['doc_translation_method'] < 0) {
             if ($this->current_subpage_is('mcsetup') && isset($_GET['src']) && $_GET['src'] == 'notice') {
                 $this->settings['doc_translation_method'] = ICL_TM_TMETHOD_MANUAL;
                 $this->save_settings();
             } else {
                 add_action('admin_notices', array($this, '_translation_method_notice'));
             }
         }
         if (defined('WPML_TM_VERSION') && $this->current_page_is(WPML_TM_FOLDER . '/menu/main.php', 'translators')) {
             $lang_status = TranslationProxy_Translator::get_icl_translator_status();
             if (!empty($lang_status)) {
                 $sitepress->save_settings($lang_status);
             }
         }
         // default settings
         if (empty($this->settings['doc_translation_method']) || !defined('WPML_TM_VERSION')) {
             $this->settings['doc_translation_method'] = ICL_TM_TMETHOD_MANUAL;
         }
     }
 }