/** * Displays the admin notice informing about terms in the old format, using the language suffix. * The notice is displayed until it is either dismissed or the update button is pressed. */ public static function display_terms_with_suffix_admin_notice() { global $sitepress; if (!$sitepress->get_setting('taxonomy_names_checked')) { $suffix_count = count(WPML_Terms_Translations::get_all_terms_with_language_suffix()); if ($suffix_count > 0) { $message = '<p>'; $message .= sprintf(__("This version of WPML allows the use of taxonomy terms with the same name across multiple languages. Your site currently has %d taxonomy terms that require an update, so they will not be displayed with language suffixes.", "sitepress"), $suffix_count); $message .= '</p>'; if (defined('ICL_PLUGIN_URL')) { $message .= '<p><a href="' . admin_url('admin.php?page=' . ICL_PLUGIN_FOLDER . '/menu/troubleshooting.php#termsuffixupdate') . '"><button class="button-primary">Open terms update page</button></a>'; } ICL_AdminNotifier::addMessage("termssuffixnotice", $message, 'error', true, false, false, 'terms-suffix', true); } $sitepress->set_setting('taxonomy_names_checked', true, true); } //TODO: [WPML 3.3] the ICL_AdminNotifier class got improved and we should not call \ICL_AdminNotifier::displayMessages to display an admin notice ICL_AdminNotifier::displayMessages('terms-suffix'); }
public static function check_settings_integrity() { if (wpml_is_ajax()) { return true; } if (isset($_GET['debug_action']) && $_GET['nonce'] == wp_create_nonce($_GET['debug_action'])) { if ($_GET['debug_action'] == 'reset_wpml_settings') { $referrer = isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : get_admin_url(); $current_settings = get_option('icl_sitepress_settings'); unset($current_settings['setup_complete']); unset($current_settings['setup_wizard_step']); unset($current_settings['existing_content_language_verified']); unset($current_settings['dont_show_help_admin_notice']); global $wpdb; $wpdb->query('TRUNCATE TABLE ' . $wpdb->prefix . 'icl_translations'); update_option('icl_sitepress_settings', $current_settings); wp_redirect($referrer); exit; } } global $wpdb; static $result; if (isset($result)) { return $result; } $current_settings = get_option('icl_sitepress_settings'); if (!$current_settings) { return true; } $setup_wizard_step = false; if (isset($current_settings['setup_wizard_step'])) { $setup_wizard_step = $current_settings['setup_wizard_step']; } $setup_complete = false; $setup_complete_missing = true; if (isset($current_settings['setup_complete'])) { $setup_complete = $current_settings['setup_complete']; $setup_complete_missing = false; } //Skip checks during first setup wizard if ($setup_wizard_step !== false && $setup_wizard_step < 4 || !$setup_complete_missing && $setup_complete === false && $setup_wizard_step == 4) { return true; } $default_language = false; $default_language_missing = true; if (isset($current_settings['default_language'])) { $default_language = $current_settings['default_language']; $default_language_missing = false; } $active_languages_sql = "SELECT * FROM " . $wpdb->prefix . 'icl_languages WHERE active=%d'; $active_languages_prepared = $wpdb->prepare($active_languages_sql, array(1)); $active_languages = $wpdb->get_results($active_languages_prepared); $existing_translations_sql = "SELECT count(*) FROM " . $wpdb->prefix . 'icl_translations'; $existing_translations = $wpdb->get_var($existing_translations_sql); $show_notice = false; $message = ''; if ((!$setup_complete || !$default_language) && $existing_translations) { $message .= '<p>'; $message .= __('Your WPML settings seem to be corrupted. To avoid corrupting your existing data, we have hidden WPML from this site.', 'sitepress'); $message .= '</p>'; $message .= '<p>'; $message .= __('If this is the first time you install WPML on this site, you may have faced a database or script connection drop, that caused settings to be not completely store.', 'sitepress'); $message .= __('In this case, you can click on the <strong>Reset Settings</strong> button: this will reset WPML settings and any language translation information, allowing you to restart the wizard.', 'sitepress'); $message .= '</p>'; $message .= '<p>'; $message .= sprintf(__('If you have just upgraded WPML or after starting over you keep getting this message, please contact the <a href="%s">support forum</a> as soon as possible, in order to provide you with a fix to this issue.', 'sitepress'), 'https://wpml.org/forums/'); $message .= '</p>'; $message .= '<p>'; $confirm_message = _x('Are you sure you want to reset WPML Settings?', 'Reset WPML settings', 'sitepress'); $confirm_message .= ' '; $confirm_message .= _x('This will also empty translation information (if any).', 'Reset WPML settings', 'sitepress'); $message .= '<a href="?icl_reset_settings=1&debug_action=reset_wpml_settings&nonce=' . wp_create_nonce('reset_wpml_settings') . '" class="button" onclick="return window.confirm(\'' . $confirm_message . '\');" >' . __('Reset Settings', 'sitepress') . '</a>'; $message .= ' '; $message .= ' '; $message .= ' '; $message .= '<a href="https://wpml.org/forums/" class="button">' . __('Contact Support', 'sitepress') . '</a>'; $message .= '</p>'; $message .= '<p>'; $message .= __('Additional details for the support team (there is no need to copy it, as the support team will be able to see it once logged in):', 'sitepress'); $message .= '</p>'; $message .= '<p><textarea rows="10" style="width:100%;display:block;" onclick="this.focus();this.select();" readonly="readonly">'; $message .= str_repeat('=', 50); $wpml_plugins_list = SitePress::get_installed_plugins(); foreach ($wpml_plugins_list as $name => $plugin_data) { $plugin_name = $name; $file = $plugin_data['file']; $message .= PHP_EOL . $plugin_name; $message .= ' ' . (isset($plugin_data['plugin']['Version']) ? $plugin_data['plugin']['Version'] : __('Version n/a', 'sitepress')); $message .= ' => '; if (empty($plugin_data['plugin'])) { $message .= 'Not installed'; } else { $message .= 'Installed'; } $message .= '/'; $message .= isset($file) && is_plugin_active($file) ? 'Active' : 'Not Active'; } $message .= PHP_EOL . str_repeat('-', 50); $message .= PHP_EOL . 'icl_translations count: ' . ($existing_translations ? $existing_translations : '0'); $message .= PHP_EOL . 'setup_complete: ' . ($setup_complete ? 'true' : 'false'); $message .= PHP_EOL . 'setup_complete missing: ' . ($setup_complete_missing ? 'true' : 'false'); $message .= PHP_EOL . 'default_language: ' . ($default_language ? $default_language : '""'); $message .= PHP_EOL . 'default_language_missing: ' . ($default_language_missing ? 'true' : 'false'); $message .= PHP_EOL . PHP_EOL . 'active_languages: ' . PHP_EOL . print_r($active_languages, true); $message .= PHP_EOL . PHP_EOL . 'icl_sitepress_settings (serialized): ' . PHP_EOL . serialize($current_settings); $message .= PHP_EOL . PHP_EOL . 'icl_sitepress_settings (unserialized): ' . PHP_EOL . print_r($current_settings, true); $message .= PHP_EOL . str_repeat('=', 50); $message .= '</textarea></p>'; $show_notice = true; } // ICL_AdminNotifier::removeMessage( 'check_settings_integrity' ); ICL_AdminNotifier::removeMessage('check_settings_integrity_corrupted'); if ($show_notice) { ICL_AdminNotifier::addMessage('check_settings_integrity_corrupted', $message, 'error', false, false, false, 'check_settings_integrity', true); ICL_AdminNotifier::displayMessages('check_settings_integrity'); } $result = !$show_notice; return $result; }
function wpcf_wpml_warning() { if (!defined('WPML_ST_PATH') || !class_exists('ICL_AdminNotifier')) { return; } ICL_AdminNotifier::displayMessages('wp-types'); }
} else { echo ' dir="ltr" style="text-align:left;direction:ltr;width:100%"'; } } ?> <div class="wrap"> <div id="icon-wpml" class="icon32"><br /></div> <h2><?php echo __('String translation', 'wpml-string-translation'); ?> </h2> <?php if (class_exists('ICL_AdminNotifier')) { ICL_AdminNotifier::displayMessages('string-translation'); } ?> <?php if (isset($icl_st_po_strings) && !empty($icl_st_po_strings)) { ?> <p><?php printf(__("These are the strings that we found in your .po file. Please carefully review them. Then, click on the 'add' or 'cancel' buttons at the %sbottom of this screen%s. You can exclude individual strings by clearing the check boxes next to them.", 'wpml-string-translation'), '<a href="#add_po_strings_confirm">', '</a>'); ?> </p> <form method="post" action="<?php echo admin_url("admin.php?page=" . WPML_ST_FOLDER . "/menu/string-translation.php"); ?>
function administration_menu() { ICL_AdminNotifier::removeMessage('setup-incomplete'); $main_page = apply_filters('icl_menu_main_page', basename(ICL_PLUGIN_PATH) . '/menu/languages.php'); $wpml_setup_is_complete = SitePress_Setup::setup_complete(); if ($wpml_setup_is_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'); $wpml_setup_is_complete = $this->get_setting('existing_content_language_verified') && 2 <= count($this->get_active_languages()); if ($wpml_setup_is_complete) { 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'); } } $wpml_admin_menus_args = array('existing_content_language_verified' => $this->get_setting('existing_content_language_verified'), 'active_languages_count' => count($this->get_active_languages()), 'wpml_setup_is_ok' => $wpml_setup_is_complete); do_action('wpml_admin_menus', $wpml_admin_menus_args); } 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 (!$this->is_troubleshooting_page() && !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'); }
<div class="wpml-section-header"> <h3><?php _e('Custom posts', 'sitepress'); ?> </h3> </div> <div class="wpml-section-content"> <?php if (isset($notice)) { echo $notice; } cpt_warnings(); ICL_AdminNotifier::displayMessages('cpt-translation'); ?> <form id="icl_custom_posts_sync_options" name="icl_custom_posts_sync_options" action=""> <?php wp_nonce_field('icl_custom_posts_sync_options_nonce', '_icl_nonce'); ?> <table class="widefat"> <thead> <tr> <th colspan="3"> <?php _e('Custom post types', 'sitepress'); ?> </th>