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'); }
function insert_one($data) { global $sitepress, $wpdb; $data = stripslashes_deep(stripslashes_deep($data)); // Insert main table. if (!$this->insert_main_table($data['code'], $data['english_name'], $data['default_locale'], 0, 1, $data['encode_url'], $data['tag'])) { $this->error(__('Adding language failed.', 'sitepress')); return false; } // add locale map $locale_exists = $wpdb->get_var($wpdb->prepare("SELECT code\n FROM {$wpdb->prefix}icl_locale_map\n WHERE code=%s", $data['code'])); if ($locale_exists) { $wpdb->update($wpdb->prefix . 'icl_locale_map', array('locale' => $data['default_locale']), array('code' => $data['code'])); } else { $wpdb->insert($wpdb->prefix . 'icl_locale_map', array('code' => $data['code'], 'locale' => $data['default_locale'])); } // Insert translations. $all_languages = $sitepress->get_languages(); foreach ($all_languages as $key => $lang) { // If submitted. if (array_key_exists($lang['code'], $data['translations'])) { if (empty($data['translations'][$lang['code']])) { $data['translations'][$lang['code']] = $data['english_name']; } if (!$this->insert_translation($data['translations'][$lang['code']], $data['code'], $lang['code'])) { $this->error(sprintf(__('Error adding translation %s for %s.', 'sitepress'), $data['code'], $lang['code'])); } } else { if (!$this->insert_translation($data['english_name'], $data['code'], $lang['code'])) { $this->error(sprintf(__('Error adding translation %s for %s.', 'sitepress'), $data['code'], $lang['code'])); } } } // Insert native name. if (!isset($data['translations']['add']) || empty($data['translations']['add'])) { $data['translations']['add'] = $data['english_name']; } if (!$this->insert_translation($data['translations']['add'], $data['code'], $data['code'])) { $this->error(__('Error adding native name.', 'sitepress')); } // Handle flag. if ($data['flag_upload'] == 'true' && !empty($_FILES['icl_edit_languages']['name']['add']['flag_file'])) { if ($filename = $this->upload_flag('add')) { $data['flag'] = $filename; $from_template = 1; } else { $data['flag'] = $data['code'] . '.png'; $from_template = 0; } } else { if (empty($data['flag'])) { $data['flag'] = $data['code'] . '.png'; } $from_template = 0; } // Insert flag table. if (!$this->insert_flag($data['code'], $data['flag'], $from_template)) { $this->error(__('Error adding flag.', 'sitepress')); } SitePress_Setup::insert_default_category($data['code']); }
break; } } $default_language_details = $sitepress->get_language_details($default_language); $inactive_content = $sitepress->get_inactive_content(); } global $language_switcher_defaults, $language_switcher_defaults_alt; if (!class_exists('WPML_Config')) { require ICL_PLUGIN_PATH . '/inc/wpml-config/wpml-config.class.php'; } $theme_wpml_config_file = WPML_Config::get_theme_wpml_config_file(); $sitepress->noscript_notice(); ?> <?php if ($setup_complete || SitePress_Setup::languages_table_is_complete()) { ?> <div class="wrap <?php if (empty($setup_complete)) { ?> wpml-wizard<?php } ?> "> <div id="icon-wpml" class="icon32" ><br /></div> <h2><?php _e('Setup WPML', 'sitepress'); ?> </h2> <?php
function reset_language_data() { global $wpdb, $sitepress; $active = $wpdb->get_col("SELECT code FROM {$wpdb->prefix}icl_languages WHERE active = 1"); $wpdb->query("TRUNCATE TABLE `{$wpdb->prefix}icl_languages`"); SitePress_Setup::fill_languages(); $wpdb->query("TRUNCATE TABLE `{$wpdb->prefix}icl_languages_translations`"); SitePress_Setup::fill_languages_translations(); $wpdb->query("TRUNCATE TABLE `{$wpdb->prefix}icl_flags`"); SitePress_Setup::fill_flags(); //restore active $wpdb->query("UPDATE {$wpdb->prefix}icl_languages SET active=1 WHERE code IN(" . wpml_prepare_in($active) . ")"); $wpdb->update($wpdb->prefix . 'icl_flags', array('from_template' => 0), null); $codes = $wpdb->get_col("SELECT code FROM {$wpdb->prefix}icl_languages"); foreach ($codes as $code) { if (!$code || $wpdb->get_var($wpdb->prepare("SELECT lang_code FROM {$wpdb->prefix}icl_flags WHERE lang_code = %s", $code))) { continue; } if (!file_exists(ICL_PLUGIN_PATH . '/res/flags/' . $code . '.png')) { $file = 'nil.png'; } else { $file = $code . '.png'; } $wpdb->insert($wpdb->prefix . 'icl_flags', array('lang_code' => $code, 'flag' => $file, 'from_template' => 0)); } $last_default_language = $sitepress !== null ? $sitepress->get_default_language() : 'en'; if (!in_array($last_default_language, $codes)) { $last_active_languages = $sitepress->get_active_languages(); foreach ($last_active_languages as $code => $last_active_language) { if (in_array($code, $codes)) { $sitepress->set_default_language($code); break; } } } icl_cache_clear(); }
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 } }
function icl_sitepress_activate() { global $wpdb; $charset_collate = ''; if (method_exists($wpdb, 'has_cap') && $wpdb->has_cap('collation')) { if (!empty($wpdb->charset)) { $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}"; } if (!empty($wpdb->collate)) { $charset_collate .= " COLLATE {$wpdb->collate}"; } } try { SitePress_Setup::fill_languages(); SitePress_Setup::fill_languages_translations(); SitePress_Setup::fill_flags(); // translations $table_name = $wpdb->prefix . 'icl_translations'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n `translation_id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r\n `element_type` VARCHAR( 36 ) NOT NULL DEFAULT 'post_post',\r\n `element_id` BIGINT NULL DEFAULT NULL ,\r\n `trid` BIGINT NOT NULL ,\r\n `language_code` VARCHAR( 7 ) NOT NULL,\r\n `source_language_code` VARCHAR( 7 ),\r\n UNIQUE KEY `el_type_id` (`element_type`,`element_id`),\r\n UNIQUE KEY `trid_lang` (`trid`,`language_code`),\r\n KEY `trid` (`trid`),\r\n KEY `id_type_language` (`element_id`, `element_type`, `language_code`)\r\n ) {$charset_collate}"; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } // translation_status table $table_name = $wpdb->prefix . 'icl_translation_status'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n `rid` bigint(20) NOT NULL AUTO_INCREMENT,\r\n `translation_id` bigint(20) NOT NULL,\r\n `status` tinyint(4) NOT NULL,\r\n `translator_id` bigint(20) NOT NULL,\r\n `needs_update` tinyint(4) NOT NULL,\r\n `md5` varchar(32) NOT NULL,\r\n `translation_service` varchar(16) NOT NULL,\r\n `batch_id` int DEFAULT 0 NOT NULL,\r\n `translation_package` text NOT NULL,\r\n `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n `links_fixed` tinyint(4) NOT NULL DEFAULT 0,\r\n `_prevstate` longtext,\r\n PRIMARY KEY (`rid`),\r\n UNIQUE KEY `translation_id` (`translation_id`)\r\n ) {$charset_collate} \r\n "; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } // translation jobs $table_name = $wpdb->prefix . 'icl_translate_job'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n `job_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r\n `rid` BIGINT UNSIGNED NOT NULL ,\r\n `translator_id` INT UNSIGNED NOT NULL ,\r\n `translated` TINYINT UNSIGNED NOT NULL DEFAULT 0,\r\n `manager_id` INT UNSIGNED NOT NULL ,\r\n `revision` INT UNSIGNED NULL,\r\n INDEX ( `rid` , `translator_id` )\r\n ) {$charset_collate} \r\n "; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } // translate table $table_name = $wpdb->prefix . 'icl_translate'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n `tid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r\n `job_id` BIGINT UNSIGNED NOT NULL ,\r\n `content_id` BIGINT UNSIGNED NOT NULL ,\r\n `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,\r\n `field_type` VARCHAR( 160 ) NOT NULL ,\r\n `field_format` VARCHAR( 16 ) NOT NULL ,\r\n `field_translate` TINYINT NOT NULL ,\r\n `field_data` longtext NOT NULL ,\r\n `field_data_translated` longtext NOT NULL ,\r\n `field_finished` TINYINT NOT NULL DEFAULT 0,\r\n INDEX ( `job_id` )\r\n ) {$charset_collate}\r\n "; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } // batches table $table_name = $wpdb->prefix . 'icl_translation_batches'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS {$wpdb->prefix}icl_translation_batches (\r\n `id` int(11) NOT NULL AUTO_INCREMENT,\r\n `batch_name` text NOT NULL,\r\n `tp_id` int NULL,\r\n `ts_url` text NULL,\r\n `last_update` DATETIME NULL,\r\n PRIMARY KEY (`id`)\r\n ) {$charset_collate}\r\n "; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } // languages locale file names $table_name = $wpdb->prefix . 'icl_locale_map'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n `code` VARCHAR( 7 ) NOT NULL ,\r\n `locale` VARCHAR( 8 ) NOT NULL ,\r\n UNIQUE (`code` ,`locale`)\r\n ) {$charset_collate}"; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } /* general string translation */ $table_name = $wpdb->prefix . 'icl_strings'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n `id` bigint(20) unsigned NOT NULL auto_increment,\r\n `language` varchar(7) NOT NULL,\r\n `context` varchar(" . WPML_STRING_TABLE_NAME_CONTEXT_LENGTH . ") CHARACTER SET UTF8 NOT NULL,\r\n `name` varchar(" . WPML_STRING_TABLE_NAME_CONTEXT_LENGTH . ") CHARACTER SET UTF8 NOT NULL,\r\n `value` text NOT NULL,\r\n `string_package_id` BIGINT unsigned NULL,\r\n `type` VARCHAR(40) NOT NULL DEFAULT 'LINE',\r\n `title` VARCHAR(160) NULL,\r\n `status` TINYINT NOT NULL,\r\n PRIMARY KEY (`id`),\r\n UNIQUE KEY `context_name` (`context`,`name`),\r\n KEY `language_context` (`language`, `context`)\r\n ) {$charset_collate}"; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } $table_name = $wpdb->prefix . 'icl_string_translations'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n `id` bigint(20) unsigned NOT NULL auto_increment,\r\n `string_id` bigint(20) unsigned NOT NULL,\r\n `language` varchar(10) NOT NULL,\r\n `status` tinyint(4) NOT NULL,\r\n `value` text NULL DEFAULT NULL, \r\n `translator_id` bigint(20) unsigned DEFAULT NULL, \r\n `translation_service` varchar(16) DEFAULT '' NOT NULL,\r\n `batch_id` int DEFAULT 0 NOT NULL,\r\n `translation_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n PRIMARY KEY (`id`),\r\n UNIQUE KEY `string_language` (`string_id`,`language`)\r\n ) {$charset_collate}"; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } $table_name = $wpdb->prefix . 'icl_string_status'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r\n `rid` BIGINT NOT NULL ,\r\n `string_translation_id` BIGINT NOT NULL ,\r\n `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,\r\n `md5` VARCHAR( 32 ) NOT NULL,\r\n INDEX ( `string_translation_id` )\r\n ) {$charset_collate}"; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } $table_name = $wpdb->prefix . 'icl_string_positions'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,\r\n `string_id` BIGINT NOT NULL ,\r\n `kind` TINYINT,\r\n `position_in_page` VARCHAR( 255 ) NOT NULL,\r\n INDEX ( `string_id` )\r\n ) {$charset_collate}"; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } // message status table $table_name = $wpdb->prefix . 'icl_message_status'; if (0 !== strcasecmp($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'"), $table_name)) { $sql = "\r\n CREATE TABLE IF NOT EXISTS `{$table_name}` (\r\n `id` bigint(20) unsigned NOT NULL auto_increment,\r\n `rid` bigint(20) unsigned NOT NULL,\r\n `object_id` bigint(20) unsigned NOT NULL,\r\n `from_language` varchar(10) NOT NULL,\r\n `to_language` varchar(10) NOT NULL,\r\n `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,\r\n `md5` varchar(32) NOT NULL,\r\n `object_type` varchar(64) NOT NULL,\r\n `status` smallint(6) NOT NULL,\r\n PRIMARY KEY (`id`),\r\n UNIQUE KEY `rid` (`rid`),\r\n KEY `object_id` (`object_id`)\r\n ) {$charset_collate}"; if ($wpdb->query($sql) === false) { throw new Exception($wpdb->last_error); } } /* string translation - start */ $icl_translation_sql = "\r\n CREATE TABLE IF NOT EXISTS {$wpdb->prefix}icl_core_status (\r\n `id` BIGINT NOT NULL auto_increment,\r\n `rid` BIGINT NOT NULL,\r\n `module` VARCHAR( 16 ) NOT NULL ,\r\n `origin` VARCHAR( 64 ) NOT NULL ,\r\n `target` VARCHAR( 64 ) NOT NULL ,\r\n `status` SMALLINT NOT NULL,\r\n PRIMARY KEY ( `id` ) ,\r\n INDEX ( `rid` )\r\n ) {$charset_collate}\r\n "; if ($wpdb->query($icl_translation_sql) === false) { throw new Exception($wpdb->last_error); } $icl_translation_sql = "\r\n CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}icl_content_status` (\r\n `rid` BIGINT NOT NULL ,\r\n `nid` BIGINT NOT NULL ,\r\n `timestamp` DATETIME NOT NULL ,\r\n `md5` VARCHAR( 32 ) NOT NULL ,\r\n PRIMARY KEY ( `rid` ) ,\r\n INDEX ( `nid` )\r\n ) {$charset_collate} \r\n "; if ($wpdb->query($icl_translation_sql) === false) { throw new Exception($wpdb->last_error); } $icl_translation_sql = "\r\n CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}icl_node` (\r\n `nid` BIGINT NOT NULL ,\r\n `md5` VARCHAR( 32 ) NOT NULL ,\r\n `links_fixed` TINYINT NOT NULL DEFAULT 0,\r\n PRIMARY KEY ( `nid` )\r\n ) {$charset_collate} \r\n "; if ($wpdb->query($icl_translation_sql) === false) { throw new Exception($wpdb->last_error); } $icl_translation_sql = "\r\n CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}icl_reminders` (\r\n `id` BIGINT NOT NULL ,\r\n `message` TEXT NOT NULL ,\r\n `url` TEXT NOT NULL ,\r\n `can_delete` TINYINT NOT NULL ,\r\n `show` TINYINT NOT NULL ,\r\n PRIMARY KEY ( `id` )\r\n ) {$charset_collate} \r\n "; if ($wpdb->query($icl_translation_sql) === false) { throw new Exception($wpdb->last_error); } } catch (Exception $e) { trigger_error($e->getMessage(), E_USER_ERROR); exit; } // don't set the new version if a multi-step upgrade is in progress if (!defined('ICL_MULTI_STEP_UPGRADE')) { delete_option('icl_sitepress_version'); add_option('icl_sitepress_version', ICL_SITEPRESS_VERSION, '', true); } $iclsettings = get_option('icl_sitepress_settings'); if ($iclsettings === false) { $short_v = implode('.', array_slice(explode('.', ICL_SITEPRESS_VERSION), 0, 3)); $settings = array('hide_upgrade_notice' => $short_v); add_option('icl_sitepress_settings', $settings, '', true); } else { // reset ajx_health_flag $iclsettings['ajx_health_checked'] = 0; $iclsettings['just_reactivated'] = 1; update_option('icl_sitepress_settings', $iclsettings); } //Set new caps for all administrator role icl_enable_capabilities(); //Set cron job to update WPML config index file from CDN wp_schedule_event(time(), 'daily', 'update_wpml_config_index'); do_action('wpml_activated'); }
?> </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