当前位置: 首页>>代码示例>>PHP>>正文


PHP TranslationProxy::deselect_active_service方法代码示例

本文整理汇总了PHP中TranslationProxy::deselect_active_service方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslationProxy::deselect_active_service方法的具体用法?PHP TranslationProxy::deselect_active_service怎么用?PHP TranslationProxy::deselect_active_service使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TranslationProxy的用法示例。


在下文中一共展示了TranslationProxy::deselect_active_service方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: automatic_service_selection

 protected function automatic_service_selection()
 {
     if (defined('DOING_AJAX') || !$this->automatic_service_selection_pages()) {
         return;
     }
     $done = wp_cache_get('done', 'automatic_service_selection');
     ICL_AdminNotifier::remove_message('automatic_service_selection');
     if (!$done && defined('WPML_TP_DEFAULT_SUID')) {
         $selected_service = TranslationProxy::get_current_service();
         if (isset($selected_service->suid) && $selected_service->suid == WPML_TP_DEFAULT_SUID) {
             return;
         }
         try {
             $service_by_suid = TranslationProxy_Service::get_service_by_suid(WPML_TP_DEFAULT_SUID);
         } catch (Exception $ex) {
             $service_by_suid = false;
         }
         if (isset($service_by_suid->id)) {
             $selected_service_id = isset($selected_service->id) ? $selected_service->id : false;
             if (!$selected_service_id || $selected_service_id != $service_by_suid->id) {
                 if ($selected_service_id) {
                     TranslationProxy::deselect_active_service();
                 }
                 $result = TranslationProxy::select_service($service_by_suid->id);
                 if (is_wp_error($result)) {
                     $error_data = $result->get_error_data();
                     $error_data_string = false;
                     foreach ($error_data as $key => $error_data_message) {
                         $error_data_string .= $result->get_error_message() . '<br/>';
                         $error_data_string .= $key . ': <pre>' . print_r($error_data_message, true) . '</pre>';
                         $error_data_string .= $result->get_error_message() . $error_data_string;
                     }
                 }
                 if (defined('WPML_TP_SERVICE_CUSTOM_FIELDS')) {
                     TranslationProxy::authenticate_service($service_by_suid->id, WPML_TP_SERVICE_CUSTOM_FIELDS);
                 }
             }
         } else {
             $error_data_string = __("WPML can't find the translation service specified in WPML_TP_DEFAULT_SUID constant. Please remove the constant or set the correct value.", 'wpml-translation-management');
         }
     }
     if (isset($error_data_string)) {
         $automatic_service_selection_args = array('id' => 'automatic_service_selection', 'group' => 'automatic_service_selection', 'msg' => $error_data_string, 'type' => 'error', 'admin_notice' => true, 'hide' => false);
         ICL_AdminNotifier::add_message($automatic_service_selection_args);
     }
     wp_cache_set('done', true, 'automatic_service_selection');
 }
开发者ID:ryuqing,项目名称:cake,代码行数:47,代码来源:wpml-translation-management.class.php

示例2: automatic_service_selection

 private function automatic_service_selection()
 {
     if (defined('DOING_AJAX') || !$this->automatic_service_selection_pages()) {
         return;
     }
     $done = wp_cache_get('done', 'automatic_service_selection');
     ICL_AdminNotifier::remove_message('automatic_service_selection');
     $tp_default_suid = TranslationProxy::get_tp_default_suid();
     if (!$done && $tp_default_suid) {
         $selected_service = TranslationProxy::get_current_service();
         if (isset($selected_service->suid) && $selected_service->suid == $tp_default_suid) {
             return;
         }
         try {
             $service_by_suid = TranslationProxy_Service::get_service_by_suid($tp_default_suid);
         } catch (Exception $ex) {
             $service_by_suid = false;
         }
         if (isset($service_by_suid->id)) {
             $selected_service_id = isset($selected_service->id) ? $selected_service->id : false;
             if (!$selected_service_id || $selected_service_id != $service_by_suid->id) {
                 if ($selected_service_id) {
                     TranslationProxy::deselect_active_service();
                 }
                 $result = TranslationProxy::select_service($service_by_suid->id);
                 if (is_wp_error($result)) {
                     $error_data = $result->get_error_data();
                     $error_data_string = false;
                     foreach ($error_data as $key => $error_data_message) {
                         $error_data_string .= $result->get_error_message() . '<br/>';
                         $error_data_string .= $key . ': <pre>' . print_r($error_data_message, true) . '</pre>';
                         $error_data_string .= $result->get_error_message() . $error_data_string;
                     }
                 }
             }
         } else {
             $error_data_string = __("WPML can't find the translation service. Please contact WPML Support or your translation service provider.", 'wpml-translation-management');
         }
     }
     if (isset($error_data_string)) {
         $automatic_service_selection_args = array('id' => 'automatic_service_selection', 'group' => 'automatic_service_selection', 'msg' => $error_data_string, 'type' => 'error', 'admin_notice' => true, 'hide' => false);
         ICL_AdminNotifier::add_message($automatic_service_selection_args);
     }
     wp_cache_set('done', true, 'automatic_service_selection');
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:45,代码来源:class-wpml-translation-management.php


注:本文中的TranslationProxy::deselect_active_service方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。