本文整理汇总了PHP中SitePress::save_settings方法的典型用法代码示例。如果您正苦于以下问题:PHP SitePress::save_settings方法的具体用法?PHP SitePress::save_settings怎么用?PHP SitePress::save_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SitePress
的用法示例。
在下文中一共展示了SitePress::save_settings方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IN
function reset_pro_translation_configuration()
{
$translation_service_name = $this->TranslationProxy->get_current_service_name();
$this->sitepress->set_setting('content_translation_languages_setup', false);
$this->sitepress->set_setting('content_translation_setup_complete', false);
$this->sitepress->set_setting('content_translation_setup_wizard_step', false);
$this->sitepress->set_setting('translator_choice', false);
$this->sitepress->set_setting('icl_lang_status', false);
$this->sitepress->set_setting('icl_balance', false);
$this->sitepress->set_setting('icl_support_ticket_id', false);
$this->sitepress->set_setting('icl_current_session', false);
$this->sitepress->set_setting('last_get_translator_status_call', false);
$this->sitepress->set_setting('last_icl_reminder_fetch', false);
$this->sitepress->set_setting('icl_account_email', false);
$this->sitepress->set_setting('translators_management_info', false);
$this->sitepress->set_setting('site_id', false);
$this->sitepress->set_setting('access_key', false);
$this->sitepress->set_setting('ts_site_id', false);
$this->sitepress->set_setting('ts_access_key', false);
if (class_exists('TranslationProxy_Basket')) {
//Cleaning the basket
TranslationProxy_Basket::delete_all_items_from_basket();
}
$sql_for_remote_rids = $this->wpdb->prepare("FROM {$this->wpdb->prefix}icl_translation_status\n\t\t\t\t\t\t\t\t \t\t\t\tWHERE translation_service != 'local'\n\t\t\t\t\t\t\t\t \t\t\t\t\tAND translation_service != 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND status IN ( %d, %d )", ICL_TM_WAITING_FOR_TRANSLATOR, ICL_TM_IN_PROGRESS);
//Delete all translation service jobs with status "waiting for translator" or "in progress"
$this->wpdb->query("DELETE FROM {$this->wpdb->prefix}icl_translate_job WHERE rid IN (SELECT rid {$sql_for_remote_rids})");
//Delete all translation statuses with status "waiting for translator" or "in progress"
$this->wpdb->query("DELETE {$sql_for_remote_rids}");
//Cleaning up Translation Proxy settings
$this->sitepress->set_setting('icl_html_status', false);
$this->sitepress->set_setting('language_pairs', false);
if (!$this->TranslationProxy->has_preferred_translation_service()) {
$this->sitepress->set_setting('translation_service', false);
$this->sitepress->set_setting('icl_translation_projects', false);
}
$this->sitepress->save_settings();
$this->wpdb->query("TRUNCATE TABLE {$this->wpdb->prefix}icl_core_status");
$this->wpdb->query("TRUNCATE TABLE {$this->wpdb->prefix}icl_content_status");
$this->wpdb->query("TRUNCATE TABLE {$this->wpdb->prefix}icl_string_status");
$this->wpdb->query("TRUNCATE TABLE {$this->wpdb->prefix}icl_node");
$this->wpdb->query("TRUNCATE TABLE {$this->wpdb->prefix}icl_reminders");
if ($this->TranslationProxy->has_preferred_translation_service() && $translation_service_name) {
$confirm_message = 'The translation process with %1$s was reset.';
} elseif ($translation_service_name) {
$confirm_message = 'Your site was successfully disconnected from %1$s. Go to the translators tab to connect a new %1$s account or use a different translation service.';
} else {
$confirm_message = 'PRO translation has been reset.';
}
$response = sprintf(__($confirm_message, 'wpml-translation-management'), $translation_service_name);
return $response;
}
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:51,代码来源:class-wpml-tm-troubleshooting-reset-pro-trans-config.php
示例2: init
/**
* @return bool
*/
function init()
{
$this->attachments = array();
$this->error = null;
if (is_admin()) {
add_action('admin_head', array($this, 'js_scripts'));
add_action('wp_ajax_set_xliff_options', array($this, 'ajax_set_xliff_options'), 10, 2);
if (!$this->sitepress->get_setting('xliff_newlines')) {
$this->sitepress->set_setting('xliff_newlines', WPML_XLIFF_TM_NEWLINES_REPLACE, true);
}
if (!$this->sitepress->get_setting('tm_xliff_version')) {
$this->sitepress->set_setting('tm_xliff_version', '12', true);
}
if (1 < count($this->sitepress->get_active_languages())) {
add_filter('WPML_translation_queue_actions', array($this, 'translation_queue_add_actions'));
add_action('WPML_xliff_select_actions', array($this, 'translation_queue_xliff_select_actions'), 10, 2);
add_action('WPML_translation_queue_do_actions_export_xliff', array($this, 'translation_queue_do_actions_export_xliff'), 10, 2);
add_action('WPML_translator_notification', array($this, 'translator_notification'), 10, 0);
add_filter('WPML_new_job_notification', array($this, 'new_job_notification'), 10, 2);
add_filter('WPML_new_job_notification_attachments', array($this, 'new_job_notification_attachments'));
}
if (isset($_GET['wpml_xliff_action']) && $_GET['wpml_xliff_action'] === 'download' && wp_verify_nonce($_GET['nonce'], 'xliff-export')) {
$this->export_xliff($_GET["xliff_version"]);
}
if (isset($_POST['xliff_upload'])) {
$this->error = $this->import_xliff($_FILES['import']);
if (is_wp_error($this->error)) {
add_action('admin_notices', array($this, '_error'));
}
}
if (isset($_POST['icl_tm_action']) && $_POST['icl_tm_action'] === 'save_notification_settings') {
$this->sitepress->save_settings(array('include_xliff_in_notification' => isset($_POST['include_xliff']) && $_POST['include_xliff']));
}
}
return true;
}
示例3: icl_upgrade_2_0_0_steps
//.........这里部分代码省略.........
$res = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}icl_translations\n WHERE element_type IN(" . wpml_prepare_in($types) . " )\n AND source_language_code IS NULL LIMIT %d OFFSET %d", array($limit, $offset)));
foreach ($res as $row) {
$processing = TRUE;
// grab translations
$translations = $sitepress->get_element_translations($row->trid, $row->element_type);
$md5 = 0;
$table_name = $wpdb->prefix . 'icl_node';
if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") == $table_name) {
list($md5, $links_fixed) = $wpdb->get_row($wpdb->prepare("\n\t\t\t\t\t\t\tSELECT md5, links_fixed FROM {$wpdb->prefix}icl_node\n\t\t\t\t\t\t\tWHERE nid = %d\n\t\t\t\t\t\t", $row->element_id), ARRAY_N);
}
if (!$md5) {
$md5 = $TranslationManagement->post_md5($row->element_id);
}
$translation_package = $TranslationManagement->create_translation_package($row->element_id);
foreach ($translations as $lang => $t) {
if (!$t->original) {
// determine service and status
$service = 'local';
$needs_update = 0;
list($rid, $status, $current_md5) = $wpdb->get_row($wpdb->prepare("\n\t\t\t\t\t\t\t\tSELECT c.rid, n.status , c.md5\n\t\t\t\t\t\t\t\tFROM {$wpdb->prefix}icl_content_status c\n\t\t\t\t\t\t\t\t\tJOIN {$wpdb->prefix}icl_core_status n ON c.rid = n.rid\n\t\t\t\t\t\t\t\tWHERE c.nid = %d AND target = %s\n\t\t\t\t\t\t\t\tORDER BY rid DESC\n\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t", $row->element_id, $lang), ARRAY_N);
$translator_id = false;
if ($rid) {
if ($current_md5 != $md5) {
$needs_update = 1;
}
if ($status == 3) {
$status = 10;
} else {
$status = 2;
}
$service = 'icanlocalize';
foreach ($sitepress_settings['icl_lang_status'] as $lpair) {
if ($lpair['from'] == $row->language_code && $lpair['to'] == $lang && isset($lpair['translators'][0]['id'])) {
$translator_id = $lpair['translators'][0]['id'];
break;
}
}
} else {
$status = 10;
$translator_id = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM {$wpdb->posts} WHERE ID=%d", $t->element_id));
$tlp = get_user_meta($translator_id, $wpdb->prefix . 'language_pairs', true);
$tlp[$row->language_code][$lang] = 1;
$TranslationManagement->edit_translator($translator_id, $tlp);
}
// add translation_status record
list($newrid) = $TranslationManagement->update_translation_status(array('translation_id' => $t->translation_id, 'status' => $status, 'translator_id' => $translator_id, 'needs_update' => $needs_update, 'md5' => $md5, 'translation_service' => $service, 'translation_package' => serialize($translation_package), 'links_fixed' => intval(isset($links_fixed) ? $links_fixed : 0)));
$job_id = $TranslationManagement->add_translation_job($newrid, $translator_id, $translation_package);
if ($job_id && $status == 10) {
$post = get_post($t->element_id);
$TranslationManagement->save_job_fields_from_post($job_id, $post);
}
}
}
}
}
if ($processing) {
update_option('icl_temp_upgrade_data', array('step' => 2, 'offset' => intval($offset + 100)));
$stepper->setNextStep(2);
} else {
update_option('icl_temp_upgrade_data', array('step' => 3, 'offset' => 1.0E+20));
}
$message = $processing ? __('Processing translations...', 'sitepress') : __('Finalizing upgrade...', 'sitepress');
return array('message' => $message);
break;
case 3:
// removing the plugins text table; importing data into a Sitepress setting
$results = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}icl_plugins_texts");
if (!empty($results)) {
foreach ($results as $row) {
$cft[$row->attribute_name] = $row->translate + 1;
}
if (isset($cft)) {
$iclsettings['translation-management']['custom_fields_translation'] = $cft;
$sitepress->save_settings($iclsettings);
}
$wpdb->query("DROP TABLE {$wpdb->prefix}icl_plugins_texts");
}
$iclsettings['language_selector_initialized'] = 1;
if (get_option('_force_mp_post_http')) {
$iclsettings['troubleshooting_options']['http_communication'] = intval(get_option('_force_mp_post_http'));
delete_option('_force_mp_post_http');
}
// set default translators
if (isset($sitepress_settings['icl_lang_status'])) {
foreach ($sitepress_settings['icl_lang_status'] as $lpair) {
if (!empty($lpair['translators'])) {
$iclsettings['default_translators'][$lpair['from']][$lpair['to']] = array('id' => $lpair['translators'][0]['id'], 'type' => 'icanlocalize');
}
}
}
$sitepress->save_settings($iclsettings);
$iclsettings['migrated_2_0_0'] = 1;
$sitepress->save_settings($iclsettings);
delete_option('icl_temp_upgrade_data');
return array('message' => __('Done', 'sitepress'), 'completed' => 1);
break;
default:
return array('error' => __('Missing step', 'sitepress'), 'stop' => 1);
}
}
示例4: basename
}
if( !isset($_REQUEST['action']) || ($_REQUEST['action']!='activate' && $_REQUEST['action']!='activate-selected')
|| (($_REQUEST['plugin'] != basename(ICL_PLUGIN_PATH).'/'.basename(__FILE__))
&& !in_array(basename(ICL_PLUGIN_PATH).'/'.basename(__FILE__), (array)$_REQUEST['checked']))){
$sitepress = new SitePress();
$sitepress_settings = $sitepress->get_settings();
// modules load
// CMS Navigation
if(isset($_GET['enable-cms-navigation'])){
$sitepress_settings['modules']['cms-navigation']['enabled'] = intval($_GET['enable-cms-navigation']);
$sitepress->save_settings($sitepress_settings);
}
if($sitepress_settings['modules']['cms-navigation']['enabled']){
require ICL_PLUGIN_PATH . '/modules/cms-navigation/cms-navigation.php';
$iclCMSNavigation = new CMSNavigation();
}
// Sticky Links
if(isset($_REQUEST['icl_enable_alp'])){
$sitepress_settings['modules']['absolute-links']['enabled'] = intval($_REQUEST['icl_enable_alp']);
$sitepress->save_settings($sitepress_settings);
}
if($sitepress_settings['modules']['absolute-links']['enabled']){
require ICL_PLUGIN_PATH . '/modules/absolute-links/absolute-links-plugin.php';
$iclAbsoluteLinks = new AbsoluteLinksPlugin();
}