本文整理汇总了PHP中wpml_get_setting_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP wpml_get_setting_filter函数的具体用法?PHP wpml_get_setting_filter怎么用?PHP wpml_get_setting_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpml_get_setting_filter函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _wpml_get_redirect_helper
/**
*
* @return WPML_Redirection
*
*/
function _wpml_get_redirect_helper()
{
global $wpml_url_converter, $wpml_request_handler, $wpml_language_resolution, $sitepress;
$lang_neg_type = wpml_get_setting_filter(false, 'language_negotiation_type');
switch ($lang_neg_type) {
case 1:
global $wpml_url_filters;
if ($wpml_url_filters->frontend_uses_root() !== false) {
require_once ICL_PLUGIN_PATH . '/inc/request-handling/redirection/wpml-rootpage-redirect-by-subdir.class.php';
$redirect_helper = new WPML_RootPage_Redirect_By_Subdir(wpml_get_setting_filter(array(), 'urls'), $wpml_request_handler, $wpml_url_converter, $wpml_language_resolution);
} else {
require_once ICL_PLUGIN_PATH . '/inc/request-handling/redirection/wpml-redirect-by-subdir.class.php';
$redirect_helper = new WPML_Redirect_By_Subdir($wpml_url_converter, $wpml_request_handler, $wpml_language_resolution);
}
break;
case 2:
require_once ICL_PLUGIN_PATH . '/inc/request-handling/redirection/wpml-redirect-by-domain.class.php';
$wp_api = new WPML_WP_API();
$redirect_helper = new WPML_Redirect_By_Domain(icl_get_setting('language_domains'), $wp_api, $wpml_request_handler, $wpml_url_converter, $wpml_language_resolution);
break;
case 3:
default:
$redirect_helper = new WPML_Redirect_By_Param(icl_get_setting('taxonomies_sync_option', array()), $wpml_url_converter, $wpml_request_handler, $wpml_language_resolution, $sitepress);
$redirect_helper->init_hooks();
}
return $redirect_helper;
}
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:32,代码来源:wpml-frontend-redirection.php
示例2: pre_update_option_settings_filter
public function pre_update_option_settings_filter($old_value, $new_value)
{
// This is special handling for Blog Title and Tagline.
global $switched;
if (!$switched || $switched && wpml_get_setting_filter(false, 'setup_complete')) {
$current_language = $this->st_instance->get_current_string_language($this->option_name);
WPML_Config::load_config_run();
$result = $this->update_translation($this->option_name, $current_language, $new_value, ICL_TM_COMPLETE);
if ($result) {
return $old_value;
}
}
return $new_value;
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:14,代码来源:class-wpml-st-admin-option.php
示例3: __construct
/**
* @param Array $settings
* @param WPML_Post_Translation $post_translations
*/
public function __construct(&$settings, &$post_translations)
{
$this->post_translations = $post_translations;
$this->sync_delete = isset($settings['sync_delete']) ? $settings['sync_delete'] : false;
$this->sync_parent = isset($settings['sync_page_parent']) ? $settings['sync_page_parent'] : false;
$this->sync_ping_status = isset($settings['sync_ping_status']) ? $settings['sync_ping_status'] : false;
$this->sync_post_date = isset($settings['sync_post_date']) ? $settings['sync_post_date'] : false;
$this->sync_post_format = isset($settings['sync_post_format']) ? $settings['sync_post_format'] : false;
$this->sync_sticky_flag = isset($settings['sync_sticky_flag']) ? $settings['sync_sticky_flag'] : false;
$this->sync_comment_status = isset($settings['sync_comment_status']) ? $settings['sync_comment_status'] : false;
$this->sync_page_template = isset($settings['sync_page_template']) ? $settings['sync_page_template'] : false;
$this->sync_private_flag = isset($settings['sync_private_flag']) ? $settings['sync_private_flag'] : false;
$this->language_order = isset($settings['languages_order']) && $settings['languages_order'] ? $settings['languages_order'] : wpml_get_setting_filter(false, 'active_languages');
$this->sync_menu_order = isset($settings['sync_page_ordering']) ? $settings['sync_page_ordering'] : array();
}
开发者ID:pcuervo,项目名称:odc,代码行数:19,代码来源:wpml-post-synchronization.class.php
示例4: create_translation_package
/**
* create translation package
*
* @param object|int $post
*
* @return array
*/
function create_translation_package($post)
{
global $sitepress, $iclTranslationManagement;
if (empty($iclTranslationManagement->settings)) {
$iclTranslationManagement->init();
}
$package = array();
if (is_numeric($post)) {
$post = get_post($post);
}
$post_type = $post->post_type;
if (apply_filters('wpml_is_external', false, $post)) {
foreach ($post->string_data as $key => $value) {
$package['contents'][$key] = array('translate' => 1, 'data' => $iclTranslationManagement->encode_field_data($value, 'base64'), 'format' => 'base64');
}
$package['contents']['original_id'] = array('translate' => 0, 'data' => $post->post_id);
} else {
$home_url = get_home_url();
if ($post_type == 'page') {
$package['url'] = htmlentities($home_url . '?page_id=' . $post->ID);
} else {
$package['url'] = htmlentities($home_url . '?p=' . $post->ID);
}
$package['contents']['title'] = array('translate' => 1, 'data' => $iclTranslationManagement->encode_field_data($post->post_title, 'base64'), 'format' => 'base64');
if (wpml_get_setting_filter(false, 'translated_document_page_url') === 'translate') {
$package['contents']['URL'] = array('translate' => 1, 'data' => $iclTranslationManagement->encode_field_data($post->post_name, 'base64'), 'format' => 'base64');
}
$package['contents']['body'] = array('translate' => 1, 'data' => $iclTranslationManagement->encode_field_data($post->post_content, 'base64'), 'format' => 'base64');
if (!empty($post->post_excerpt)) {
$package['contents']['excerpt'] = array('translate' => 1, 'data' => base64_encode($post->post_excerpt), 'format' => 'base64');
}
$package['contents']['original_id'] = array('translate' => 0, 'data' => $post->ID);
if (!empty($iclTranslationManagement->settings['custom_fields_translation'])) {
$package = $this->add_custom_field_contents($package, $post, $iclTranslationManagement->settings['custom_fields_translation']);
}
foreach ((array) $sitepress->get_translatable_taxonomies(true, $post_type) as $taxonomy) {
$terms = get_the_terms($post->ID, $taxonomy);
if (!empty($terms)) {
foreach ($terms as $term) {
$package['contents']['t_' . $term->term_taxonomy_id] = array('translate' => 1, 'data' => $iclTranslationManagement->encode_field_data($term->name, 'csv_base64'), 'format' => 'csv_base64');
}
}
}
}
return $package;
}
开发者ID:edgarter,项目名称:wecare,代码行数:53,代码来源:wpml-element-translation-package.class.php
示例5: filter_include_url
public function filter_include_url($result)
{
$domains = wpml_get_setting_filter(array(), 'language_domains');
$domains = preg_replace('#^(http(?:s?))://#', '', array_map('untrailingslashit', $domains));
if ((bool) $domains === true) {
$php_host_in_domain = parse_url($result, PHP_URL_HOST);
$domains[] = parse_url($this->get_unfiltered_home(), PHP_URL_HOST);
foreach ($domains as $dom) {
if (strpos(trailingslashit($php_host_in_domain), trailingslashit($dom)) === 0) {
$http_host_parts = explode(':', $this->requested_host);
unset($http_host_parts[1]);
$http_host_without_port = implode($http_host_parts);
$result = str_replace($php_host_in_domain, $http_host_without_port, $result);
break;
}
}
}
return $result;
}
开发者ID:nhainam,项目名称:wordpress4,代码行数:19,代码来源:class-wpml-include-url.php
示例6: create_translation_package
/**
* create translation package
*
* @param object|int $post
*
* @return array
*/
public function create_translation_package($post)
{
global $sitepress;
$package = array();
$post = is_numeric($post) ? get_post($post) : $post;
$post_type = $post->post_type;
if (apply_filters('wpml_is_external', false, $post)) {
/** @var stdClass $post */
$post_contents = (array) $post->string_data;
$original_id = $post->post_id;
$type = 'external';
} else {
$home_url = get_home_url();
$package['url'] = htmlentities($home_url . '?' . ($post_type === 'page' ? 'page_id' : 'p') . '=' . $post->ID);
$post_contents = array('title' => $post->post_title, 'body' => $post->post_content, 'excerpt' => $post->post_excerpt);
if (wpml_get_setting_filter(false, 'translated_document_page_url') === 'translate') {
$post_contents['URL'] = $post->post_name;
}
$original_id = $post->ID;
$cf_translation_settings = $this->get_tm_setting(array('custom_fields_translation'));
if (!empty($cf_translation_settings)) {
$package = $this->add_custom_field_contents($package, $post, $cf_translation_settings);
}
foreach ((array) $sitepress->get_translatable_taxonomies(true, $post_type) as $taxonomy) {
$terms = get_the_terms($post->ID, $taxonomy);
if (is_array($terms)) {
foreach ($terms as $term) {
$post_contents['t_' . $term->term_taxonomy_id] = $term->name;
}
}
}
$type = 'post';
}
$package['contents']['original_id'] = array('translate' => 0, 'data' => $original_id);
$package['type'] = $type;
foreach ($post_contents as $key => $entry) {
$package['contents'][$key] = array('translate' => 1, 'data' => base64_encode($entry), 'format' => 'base64');
}
return apply_filters('wpml_tm_translation_job_data', $package, $post);
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:47,代码来源:wpml-element-translation-package.class.php
示例7: wpml_set_plugin_as_inactive
require_once 'embedded/wpml/commons/autoloader.php';
$wpml_auto_loader_instance = WPML_Auto_Loader::get_instance();
$wpml_auto_loader_instance->register(ICL_PLUGIN_PATH . '/');
require ICL_PLUGIN_PATH . '/inc/wpml-dependencies-check/wpml-bundle-check.class.php';
require ICL_PLUGIN_PATH . '/inc/wpml-private-actions.php';
require ICL_PLUGIN_PATH . '/inc/functions.php';
require ICL_PLUGIN_PATH . '/inc/functions-security.php';
require ICL_PLUGIN_PATH . '/inc/wpml-post-comments.class.php';
require ICL_PLUGIN_PATH . '/inc/icl-admin-notifier.php';
if (!function_exists('filter_input')) {
wpml_set_plugin_as_inactive();
add_action('admin_notices', 'wpml_missing_filter_input_notice');
return;
}
$icl_plugin_url = untrailingslashit(plugin_dir_url(__FILE__));
if ((bool) wpml_get_setting_filter(array(), 'language_domains') === true && isset($_SERVER['HTTP_HOST'])) {
global $wpdb, $wpml_include_url_filter;
$wpml_include_url_filter = new WPML_Include_Url($wpdb, $_SERVER['HTTP_HOST']);
$icl_plugin_url = $wpml_include_url_filter->filter_include_url($icl_plugin_url);
}
define('ICL_PLUGIN_URL', $icl_plugin_url);
if ((!defined('WPML_BYPASS_ICL_CHECK') || !WPML_BYPASS_ICL_CHECK) && wpml_version_is('3.2', '>=') && wpml_site_uses_icl()) {
wpml_set_plugin_as_inactive();
add_action('admin_notices', 'wpml_site_uses_icl_message_notice');
if (is_admin()) {
activate_installer();
}
return;
}
require ICL_PLUGIN_PATH . '/inc/template-functions.php';
require ICL_PLUGIN_PATH . '/inc/lang-data.php';
开发者ID:breakthroughdesign,项目名称:qaulitrol,代码行数:31,代码来源:sitepress.php
示例8: wpml_get_sub_setting_filter
/**
* Get a WPML sub setting value
* @uses \wpml_get_setting_filter
*
* @param mixed|false $default Required. The value to return if the settings key does not exist.
* (typically it's false, but you may want to use something else)
* @param string $key The settings name key the sub key belongs to
* @param string $sub_key The sub key to return the value of
* @param mixed $deprecated Deprecated param
*
* @todo [WPML 3.3] Remove deprecated argument
*
* @return mixed The value of the requested setting, or $default
* @since 3.2
* @use \SitePress::api_hooks
*/
function wpml_get_sub_setting_filter($default, $key, $sub_key, $deprecated = null)
{
$default = $deprecated !== null && !$default ? $deprecated : $default;
$parent = wpml_get_setting_filter($key, array());
return isset($parent[$sub_key]) ? $parent[$sub_key] : $default;
}
开发者ID:pcuervo,项目名称:odc,代码行数:22,代码来源:functions.php
示例9: updated_active_languages
private function updated_active_languages()
{
global $sitepress;
wp_cache_init();
icl_cache_clear();
$this->refresh_active_lang_cache(wpml_get_setting_filter(false, 'default_language'));
wpml_reload_active_languages_setting(true);
$active_langs = $sitepress->get_active_languages(true);
$this->maybe_move_setup(3);
if (count($active_langs) > 1) {
icl_set_setting('dont_show_help_admin_notice', true);
}
}
开发者ID:pcuervo,项目名称:odc,代码行数:13,代码来源:wpml-installation.class.php
示例10: maybe_reload
private function maybe_reload()
{
$this->default_lang = $this->default_lang ? $this->default_lang : wpml_get_setting_filter(false, 'default_language');
$this->active_language_codes = (bool) $this->active_language_codes === true ? $this->active_language_codes : array_fill_keys(wpml_reload_active_languages_setting(true), 1);
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:5,代码来源:wpml-language-resolution.class.php
示例11: pre_update_option_settings
function pre_update_option_settings($option, $value, $old_value)
{
global $sitepress, $sitepress_settings, $switched;
if (!$switched || $switched && wpml_get_setting_filter(false, 'setup_complete')) {
$current_language = $sitepress->get_current_language();
$strings_language = $sitepress_settings['st']['strings_language'];
if ($current_language == $strings_language) {
return $value;
}
WPML_Config::load_config_run();
$result = icl_update_string_translation($option, $current_language, $value, ICL_TM_COMPLETE);
if ($result) {
// returning old_value in place of value will stop update_option() processing.
// do not remove it!
return $old_value;
}
}
return $value;
}
开发者ID:crazyyy,项目名称:octagram,代码行数:19,代码来源:wpml-string-translation.class.php
示例12: pre_option_page
private function pre_option_page($type)
{
global $wpdb, $switched;
static $results = array();
if (!isset($results[$type]) && !$switched || $switched && wpml_get_setting_filter(false, 'setup_complete')) {
$results[$type] = array();
// Fetch for all languages and cache them.
$values = $wpdb->get_results($wpdb->prepare("\tSELECT element_id, language_code\r\r\n\t\t\t\t\t\tFROM {$wpdb->prefix}icl_translations\r\r\n\t\t\t\t\t\tWHERE trid =\r\r\n\t\t\t\t\t\t\t(SELECT trid\r\r\n\t\t\t\t\t\t\t FROM {$wpdb->prefix}icl_translations\r\r\n\t\t\t\t\t\t\t WHERE element_type = 'post_page'\r\r\n\t\t\t\t\t\t\t AND element_id = (SELECT option_value\r\r\n\t\t\t\t\t\t\t\t\t\t\t FROM {$wpdb->options}\r\r\n\t\t\t\t\t\t\t\t\t\t\t WHERE option_name=%s\r\r\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 1))\r\r\n\t\t\t\t\t\t", $type));
foreach ($values as $lang_result) {
$results[$type][$lang_result->language_code] = $lang_result->element_id;
}
}
return isset($results[$type][$this->this_lang]) ? $results[$type][$this->this_lang] : '';
}
开发者ID:sonvq,项目名称:passioninvestment,代码行数:14,代码来源:sitepress.class.php
示例13: post_md5
/**
* calculate post md5
*
* @param object|int $post
*
* @return string
* @todo full support for custom posts and custom taxonomies
*/
public function post_md5($post)
{
global $iclTranslationManagement, $wpdb, $sitepress_settings;
//TODO: [WPML 3.2] Make it work with PackageTranslation: this is not the right way anymore
if (isset($post->external_type) && $post->external_type) {
$md5str = '';
foreach ($post->string_data as $key => $value) {
$md5str .= $key . $value;
}
} else {
$post_tags = $post_categories = $custom_fields_values = array();
if (is_numeric($post)) {
$post = get_post($post);
}
foreach (wp_get_object_terms($post->ID, 'post_tag') as $tag) {
$post_tags[] = $tag->name;
}
if (is_array($post_tags)) {
sort($post_tags, SORT_STRING);
}
foreach (wp_get_object_terms($post->ID, 'category') as $cat) {
$post_categories[] = $cat->name;
}
if (is_array($post_categories)) {
sort($post_categories, SORT_STRING);
}
// get custom taxonomies
$taxonomies = $wpdb->get_col($wpdb->prepare("\n\t\t\t\tSELECT DISTINCT tx.taxonomy\n\t\t\t\tFROM {$wpdb->term_taxonomy} tx JOIN {$wpdb->term_relationships} tr ON tx.term_taxonomy_id = tr.term_taxonomy_id\n\t\t\t\tWHERE tr.object_id =%d ", $post->ID));
sort($taxonomies, SORT_STRING);
if (isset($sitepress_settings['taxonomies_sync_option'])) {
foreach ($taxonomies as $t) {
if (taxonomy_exists($t) && isset($sitepress_settings['taxonomies_sync_option'][$t]) && $sitepress_settings['taxonomies_sync_option'][$t] == 1) {
$taxs = array();
foreach (wp_get_object_terms($post->ID, $t) as $trm) {
$taxs[] = $trm->name;
}
if ($taxs) {
sort($taxs, SORT_STRING);
$all_taxs[] = '[' . $t . ']:' . join(',', $taxs);
}
}
}
}
$custom_fields_values = array();
if (isset($iclTranslationManagement->settings['custom_fields_translation']) && is_array($iclTranslationManagement->settings['custom_fields_translation'])) {
foreach ($iclTranslationManagement->settings['custom_fields_translation'] as $cf => $op) {
if ($op == 2 || $op == 1) {
$value = get_post_meta($post->ID, $cf, true);
if (!is_array($value) && !is_object($value)) {
$custom_fields_values[] = $value;
}
}
}
}
$md5str = $post->post_title . ';' . $post->post_content . ';' . join(',', $post_tags) . ';' . join(',', $post_categories) . ';' . join(',', $custom_fields_values);
if (!empty($all_taxs)) {
$md5str .= ';' . join(';', $all_taxs);
}
if (wpml_get_setting_filter(false, 'translated_document_page_url') === 'translate') {
$md5str .= $post->post_name . ';';
}
}
$md5 = md5($md5str);
return $md5;
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:73,代码来源:wpml-tm-action-helper.class.php
示例14: wpml_reload_active_languages_setting
function wpml_reload_active_languages_setting($override = false)
{
global $wpdb, $sitepress_settings;
if ((bool) $sitepress_settings === true && ($override || wpml_get_setting_filter(false, 'setup_complete'))) {
$active_languages = $wpdb->get_col("\tSELECT code\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->prefix}icl_languages\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE active = 1");
$sitepress_settings['active_languages'] = $active_languages;
icl_set_setting('active_languages', $active_languages, true);
} else {
$active_languages = array();
}
return (array) $active_languages;
}
开发者ID:gencagushi,项目名称:tema,代码行数:12,代码来源:functions-load.php
示例15: get_ls_languages
//.........这里部分代码省略.........
}
} else {
if (!empty($translations[$lang['code']]) && isset($translations[$lang['code']]->post_title)) {
$lang['translated_url'] = get_permalink($translations[$lang['code']]->element_id);
$lang['missing'] = 0;
} else {
if ($icl_lso_link_empty) {
if (!empty($template_args['link_empty_to'])) {
$lang['translated_url'] = str_replace('{%lang}', $lang['code'], $template_args['link_empty_to']);
} else {
$lang['translated_url'] = $this->language_url($lang['code']);
}
} else {
$skip_lang = true;
}
$lang['missing'] = 1;
}
}
$this->this_lang = $this_lang_tmp;
} elseif (is_category() || is_tax() || is_tag()) {
global $icl_adjust_id_url_filter_off;
$icl_adjust_id_url_filter_off = true;
list($lang, $skip_lang) = $languages_helper->add_tax_url_to_ls_lang($lang, $translations, $icl_lso_link_empty, $skip_lang);
$icl_adjust_id_url_filter_off = false;
} elseif (is_author()) {
global $authordata;
if (empty($authordata)) {
$authordata = get_userdata(get_query_var('author'));
}
remove_filter('home_url', array($this, 'home_url'), 1, 4);
remove_filter('author_link', array($this, 'author_link'));
list($lang, $skip_lang) = $languages_helper->add_author_url_to_ls_lang($lang, $authordata, $icl_lso_link_empty, $skip_lang);
add_filter('home_url', array($this, 'home_url'), 1, 4);
add_filter('author_link', array($this, 'author_link'));
} elseif (is_archive() && !is_tag()) {
global $icl_archive_url_filter_off;
$icl_archive_url_filter_off = true;
remove_filter('post_type_archive_link', array($this, 'post_type_archive_link_filter'), 10);
list($lang, $skip_lang) = $languages_helper->add_date_or_cpt_url_to_ls_lang($lang, $this->wp_query, $icl_lso_link_empty, $skip_lang);
add_filter('post_type_archive_link', array($this, 'post_type_archive_link_filter'), 10, 2);
$icl_archive_url_filter_off = false;
} elseif (is_search()) {
$url_glue = strpos($this->language_url($lang['code']), '?') === false ? '?' : '&';
$lang['translated_url'] = $this->language_url($lang['code']) . $url_glue . 's=' . urlencode($wp_query->query['s']);
} else {
global $icl_language_switcher_preview;
if ($icl_lso_link_empty || is_home() || is_404() || 'page' === get_option('show_on_front') && ($this->wp_query->queried_object_id == get_option('page_on_front') || $this->wp_query->queried_object_id == get_option('page_for_posts')) || $icl_language_switcher_preview || WPML_Root_Page::is_current_request_root()) {
$lang['translated_url'] = $this->language_url($lang['code']);
$skip_lang = false;
} else {
$skip_lang = true;
unset($w_active_languages[$k]);
}
}
if (!$skip_lang) {
$w_active_languages[$k] = $lang;
} else {
unset($w_active_languages[$k]);
}
}
// 3.
foreach ($w_active_languages as $k => $v) {
$w_active_languages[$k] = $languages_helper->get_ls_language($k, $current_language, $w_active_languages[$k]);
}
// 4. pass GET parameters
$parameters_copied = apply_filters('icl_lang_sel_copy_parameters', array_map('trim', explode(',', wpml_get_setting_filter('', 'icl_lang_sel_copy_parameters'))));
if ($parameters_copied) {
foreach ($_GET as $k => $v) {
if (in_array($k, $parameters_copied)) {
$gets_passed[$k] = $v;
}
}
}
if (!empty($gets_passed)) {
$gets_passed = http_build_query($gets_passed);
foreach ($w_active_languages as $code => $al) {
if (empty($al['missing'])) {
$glue = false !== strpos($w_active_languages[$code]['url'], '?') ? '&' : '?';
$w_active_languages[$code]['url'] .= $glue . $gets_passed;
}
}
}
// restore current $wp_query
unset($wp_query);
global $wp_query;
// make it global again after unset
$wp_query = clone $_wp_query_back;
unset($_wp_query_back);
$w_active_languages = apply_filters('icl_ls_languages', $w_active_languages);
$w_active_languages = $languages_helper->sort_ls_languages($w_active_languages, $template_args);
// Change the url, in case languages in subdomains are set.
if ($this->settings['language_negotiation_type'] == 2) {
foreach ($w_active_languages as $lang => $element) {
$w_active_languages[$lang]['url'] = $this->convert_url($element['url'], $lang);
}
}
wp_reset_query();
wp_cache_set($cache_key, $w_active_languages, $cache_group);
return $w_active_languages;
}
开发者ID:phucanh92,项目名称:vietlong,代码行数:101,代码来源:sitepress.class.php
示例16: init_comments_synchronization
private function init_comments_synchronization()
{
if (wpml_get_setting_filter(null, '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);
}
}
开发者ID:gencagushi,项目名称:tema,代码行数:9,代码来源:translation-management.class.php
示例17: enqueue_migration_in_tp
public function enqueue_migration_in_tp()
{
global $sitepress;
remove_filter('otgs_translation_get_services', 'filter_tp_services');
$site_id = $sitepress->get_setting('site_id');
$access_key = $sitepress->get_setting('access_key');
$delivery = wpml_get_setting_filter(false, 'translation_pickup_method');
$delivery = $delivery === 'polling' ? 'polling' : 'xmlrpc';
$service = TranslationProxy_Service::get_service($this->get_icl_service_id());
$params = array('project' => array('ts_accesskey' => $access_key, 'external_id' => $site_id, 'delivery_method' => $delivery, 'url' => get_option('siteurl'), 'name' => get_option('blogname'), 'description' => get_option('blogdescription'), 'suid' => isset($service->suid) ? $service->suid : ""));
$project = false;
$error_data = false;
try {
$response = TranslationProxy_Api::proxy_request('/projects/migrate.json', $params, 'POST');
if (isset($response->project)) {
$project = (array) $response->project;
$project_index = $this->icl_project_hash_key();
$projects = TranslationProxy::get_translation_projects();
$projects[$project_index] = $project;
icl_set_setting('icl_translation_projects', $projects, true);
icl_set_setting('translation_service', TranslationProxy_Service::get_service($this->get_icl_service_id()), true);
}
} catch (Exception $e) {
$error_data = $params;
}
if (!$error_data) {
$this->move_finished_jobs_to_batch();
if (defined('ICL_DEBUG_MODE') && ICL_DEBUG_MODE) {
$this->regenerate_wrong_service_data();
}
}
return array($project, $error_data);
}
开发者ID:Alexg10,项目名称:Egzobeatbox,代码行数:33,代码来源:wpml-icl-migration.class.php
注:本文中的wpml_get_setting_filter函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论