public function load_action() { $page = filter_input(INPUT_GET, 'page', FILTER_SANITIZE_STRING); $should_proceed = SitePress_Setup::setup_complete() && !$this->wpml_wp_api->is_heartbeat() && !$this->wpml_wp_api->is_ajax() && !$this->wpml_wp_api->is_cron_job() && strpos($page, 'sitepress-multilingual-cms/menu/troubleshooting.php') === 0; if ($should_proceed) { $this->add_hooks(); } }
<input disabled="disabled" id="icl_fix_languages" type="button" class="button-secondary" value="<?php _e('Clear language information and repopulate languages', 'sitepress'); ?> "/><br/><br /> <small style="margin-left:10px;"><?php _e("This operation will remove WPML's language table and recreate it. You should use it if you just installed WPML and you're not seeing a complete list of available languages.", 'sitepress'); ?> </small> <br /><br /> </p> <?php } ?> <?php if (SitePress_Setup::setup_complete()) { ?> <?php do_action('wpml_troubleshooting_after_setup_complete_cleanup_begin'); ?> <?php do_action('before_setup_complete_troubleshooting_functions'); ?> <p> <input id="icl_remove_ghost" type="button" class="button-secondary" value="<?php _e('Remove ghost entries from the translation tables', 'sitepress'); ?> "/><br/> <small style="margin-left:10px;"><?php _e('Removes entries from the WPML tables that are not linked properly. Cleans the table off entries left over upgrades, bug fixes or undetermined factors.', 'sitepress'); ?>
function administration_menu() { if (!SitePress::check_settings_integrity()) { return; } ICL_AdminNotifier::removeMessage('setup-incomplete'); $main_page = apply_filters('icl_menu_main_page', basename(ICL_PLUGIN_PATH) . '/menu/languages.php'); if (SitePress_Setup::setup_complete()) { add_menu_page(__('WPML', 'sitepress'), __('WPML', 'sitepress'), 'wpml_manage_languages', $main_page, null, ICL_PLUGIN_URL . '/res/img/icon16.png'); add_submenu_page($main_page, __('Languages', 'sitepress'), __('Languages', 'sitepress'), 'wpml_manage_languages', basename(ICL_PLUGIN_PATH) . '/menu/languages.php'); //By Gen, moved Translation management after language, because problems with permissions do_action('icl_wpml_top_menu_added'); add_submenu_page($main_page, __('Theme and plugins localization', 'sitepress'), __('Theme and plugins localization', 'sitepress'), 'wpml_manage_theme_and_plugin_localization', basename(ICL_PLUGIN_PATH) . '/menu/theme-localization.php'); if (!defined('WPML_TM_VERSION')) { add_submenu_page($main_page, __('Translation options', 'sitepress'), __('Translation options', 'sitepress'), 'wpml_manage_translation_options', basename(ICL_PLUGIN_PATH) . '/menu/translation-options.php'); } } else { $main_page = basename(ICL_PLUGIN_PATH) . '/menu/languages.php'; add_menu_page(__('WPML', 'sitepress'), __('WPML', 'sitepress'), 'manage_options', $main_page, null, ICL_PLUGIN_URL . '/res/img/icon16.png'); add_submenu_page($main_page, __('Languages', 'sitepress'), __('Languages', 'sitepress'), 'wpml_manage_languages', $main_page); if ((!isset($_REQUEST['page']) || $_REQUEST['page'] != ICL_PLUGIN_FOLDER . '/menu/troubleshooting.php') && !SitePress_Setup::languages_table_is_complete()) { $troubleshooting_url = admin_url('admin.php?page=' . ICL_PLUGIN_FOLDER . '/menu/troubleshooting.php'); $troubleshooting_link = '<a href="' . $troubleshooting_url . '" title="' . esc_attr(__('Troubleshooting', 'sitepress')) . '">' . __('Troubleshooting', 'sitepress') . '</a>'; $message = ''; $message .= __('WPML is missing some records in the languages tables and it cannot fully work until this issue is fixed.', 'sitepress'); $message .= '<br />'; $message .= sprintf(__('Please go to the %s page and click on %s to fix this problem.', 'sitepress'), $troubleshooting_link, __('Fix languages tables', 'sitepress')); $message .= '<br />'; $message .= '<br />'; $message .= __('This warning will disappear once this issue is fixed.', 'sitepress'); ICL_AdminNotifier::removeMessage('setup-incomplete'); ICL_AdminNotifier::addMessage('setup-incomplete', $message, 'error', false, false, false, 'setup', true); ICL_AdminNotifier::displayMessages('setup'); } } add_submenu_page($main_page, __('Support', 'sitepress'), __('Support', 'sitepress'), 'wpml_manage_support', ICL_PLUGIN_FOLDER . '/menu/support.php'); $this->troubleshooting_menu(ICL_PLUGIN_FOLDER . '/menu/support.php'); $this->debug_information_menu(ICL_PLUGIN_FOLDER . '/menu/support.php'); }
static function menu() { global $wpdb, $sitepress; if (!class_exists('TranslationManagement')) { return; } $site_id = $sitepress->get_setting('site_id'); $access_key = $sitepress->get_setting('access_key'); ?> <h4><?php _e('Translation Management', 'sitepress'); ?> </h4> <?php $current_service_name = TranslationProxy::get_current_service_name(); if ($site_id && $access_key) { ?> <p> <input id="icl_sync_jobs" type="button" class="button-secondary" value="<?php echo sprintf(__('Synchronize translation jobs with %s', 'sitepress'), $current_service_name); ?> "/><br/> <small style="margin-left:10px;"><?php echo sprintf(__('Fixes links between translation entries in the database and %s.', 'sitepress'), $current_service_name); ?> </small> </p> <p> <input id="icl_cms_id_fix" type="button" class="button-secondary" value="<?php _e('CMS ID fix', 'sitepress'); ?> "/> <span id="icl_cms_id_fix_prgs" style="display: none;"><?php $fixing_count_sql = "\n\t\t\t\t\t\tSELECT COUNT(*)\n\t\t\t\t\t\tFROM {$wpdb->prefix}icl_translations t\n\t\t\t\t\t\tJOIN {$wpdb->prefix}icl_translation_status s\n\t\t\t\t\t\t\tON t.translation_id=s.translation_id\n\t\t\t\t\t\tWHERE t.element_type LIKE 'post\\_%'\n\t\t\t\t\t\t\tAND t.source_language_code IS NOT NULL\n\t\t\t\t\t\t\tAND s.translation_service=%s\n\t\t\t\t\t\t"; $fixing_count_prepared = $wpdb->prepare($fixing_count_sql, array($current_service_name)); $fixing_count = $wpdb->get_var($fixing_count_prepared); printf(__('fixing %s/%d', 'sitepress'), '<span id="icl_cms_id_fix_prgs_cnt">0</span>', $fixing_count); ?> </span><br/> <small style="margin-left:10px;"><?php _e("Updates translation in progress with new style identifiers for documents. The new identifiers depend on the document being translated and the languages so it's not possible to get out of sync when translations are being deleted locally.", 'sitepress'); ?> </small> </p> <p> <input id="icl_sync_cancelled" type="button" class="button-secondary" value="<?php echo sprintf(__('Check cancelled jobs on %s', 'sitepress'), $current_service_name); ?> "/><br/> <small style="margin-left:10px;"><?php echo sprintf(__('When using the translation pickup mode cancelled jobs on %s need to be synced manually.', 'sitepress'), $current_service_name); ?> </small> </p> <div id="icl_sync_cancelled_resp" class="clear"></div> <input type="hidden" id="icl_ts_t2c" value=""/> <?php } ?> <br clear="all"/> <?php if (SitePress_Setup::setup_complete()) { $translation_service_name = $current_service_name; //Todo: [WPML 3.3] Move JS to an external resource $translation_service_checkbox_js_code = "if(jQuery(this).attr('checked')) "; $translation_service_checkbox_js_code .= "jQuery('#icl_reset_pro_but').removeClass('button-primary-disabled'); "; $translation_service_checkbox_js_code .= "else jQuery('#icl_reset_pro_but').addClass('button-primary-disabled');"; $translation_service_button_js_code = "if(!jQuery('#icl_reset_pro_check').attr('checked') || !confirm('"; $translation_service_button_js_code .= esc_js(__('Are you sure you want to reset the PRO translation configuration?', 'sitepress')); $translation_service_button_js_code .= "')) return false;"; ?> <br/> <div class="icl_cyan_box"> <h3><?php _e('Reset PRO translation configuration', 'sitepress'); ?> </h3> <div class="icl_form_errors"> <?php echo sprintf(__("Resetting your %s account will interrupt any translation jobs that you have in progress.", 'wpml-translation-management'), $translation_service_name); ?> <br/> <?php echo sprintf(__("Only use this function if your current %s account doesn't include any jobs, or if the account was deleted.", 'wpml-translation-management'), $translation_service_name); ?> </div> <p style="padding:6px;"> <label> <input onchange="<?php echo $translation_service_checkbox_js_code; ?> " id="icl_reset_pro_check" type="checkbox" value="1"/> <?php echo sprintf(__('I am about to reset the %s project settings.', 'sitepress'), $translation_service_name); ?> </label> </p> <a id="icl_reset_pro_but" onclick="<?php echo $translation_service_button_js_code; ?> " href="admin.php?page=<?php echo basename(ICL_PLUGIN_PATH); ?> /menu/troubleshooting.php&debug_action=reset_pro_translation_configuration&nonce=<?php echo wp_create_nonce('reset_pro_translation_configuration'); ?> " class="button-primary button-primary-disabled"> <?php _e('Reset PRO translation configuration', 'sitepress'); ?> </a> </div> <br clear="all"/> <?php } //Todo: [WPML 3.2.1] implement this if (1 == 2 && !icl_do_not_promote()) { ?> <div class="icl_cyan_box"> <a name="icl-connection-test"></a> <h3><?php _e('Translation Proxy connection test', 'sitepress'); ?> </h3> <?php if (isset($_GET['icl_action']) && $_GET['icl_action'] == 'icl-connection-test') { ?> <?php //TODO: [WPML 3.2.1] Handle with TP ?> <?php } ?> <a class="button" href="admin.php?page=<?php echo ICL_PLUGIN_FOLDER; ?> /menu/troubleshooting.php&ts=<?php echo time(); ?> &icl_action=icl-connection-test#icl-connection-test"><?php _e('Connect', 'sitepress'); ?> </a> </div> <br clear="all"/> <?php } }
?> </p> <?php do_action('after_setup_complete_troubleshooting_functions'); ?> <?php } ?> </div> <br clear="all"/> <?php if (SitePress_Setup::setup_complete() && (!defined('ICL_DONT_PROMOTE') || !ICL_DONT_PROMOTE)) { ?> <br/> <div class="icl_cyan_box"> <h3><?php _e('Reset PRO translation configuration', 'sitepress'); ?> </h3> <div class="icl_form_errors"><?php _e("Resetting your ICanLocalize account will interrupt any translation jobs that you have in progress. Only use this function if your ICanLocalize account doesn't include any jobs, or if the account was deleted.", 'sitepress'); ?> </div> <p style="padding:6px;"><label><input onchange="if(jQuery(this).attr('checked')) jQuery('#icl_reset_pro_but').removeClass('button-primary-disabled'); else jQuery('#icl_reset_pro_but').addClass('button-primary-disabled');" id="icl_reset_pro_check" type="checkbox" value="1"/> <?php