當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TranslationProxy類代碼示例

本文整理匯總了PHP中TranslationProxy的典型用法代碼示例。如果您正苦於以下問題:PHP TranslationProxy類的具體用法?PHP TranslationProxy怎麽用?PHP TranslationProxy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TranslationProxy類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: render_ui

 public function render_ui()
 {
     if (TranslationProxy::get_tp_default_suid()) {
         $clear_ts = new WPML_TM_Troubleshooting_Clear_TS_UI();
         $clear_ts->show();
     }
 }
開發者ID:aarongillett,項目名稱:B22-151217,代碼行數:7,代碼來源:class-wpml-tm-troubleshooting-clear-ts.php

示例2: icl_populate_translations_pickup_box

function icl_populate_translations_pickup_box()
{
    if (!wpml_is_action_authenticated('icl_populate_translations_pickup_box')) {
        die('Wrong Nonce');
    }
    global $sitepress;
    $last_picked_up = $sitepress->get_setting('last_picked_up');
    $translation_offset = strtotime(current_time('mysql')) - @intval($last_picked_up) - 5 * 60;
    if (WP_DEBUG == false && $translation_offset < 0) {
        $time_left = floor(abs($translation_offset) / 60);
        if ($time_left == 0) {
            $time_left = abs($translation_offset);
            $wait_text = '<p><i>' . sprintf(__('You can check again in %s seconds.', 'sitepress'), '<span id="icl_sec_tic">' . $time_left . '</span>') . '</i></p>';
        } else {
            $wait_text = sprintf(__('You can check again in %s minutes.', 'sitepress'), '<span id="icl_sec_tic">' . $time_left . '</span>') . '</i></p>';
        }
        $result = array('wait_text' => $wait_text);
    } else {
        $project = TranslationProxy::get_current_project();
        $cms_id_helper = new WPML_TM_CMS_ID();
        $polling_status = new WPML_TP_Polling_Status($project, $sitepress, $cms_id_helper);
        $result = $polling_status->get_status_array();
    }
    wp_send_json_success($result);
}
開發者ID:aarongillett,項目名稱:B22-151217,代碼行數:25,代碼來源:ajax.php

示例3: get_wpml_translator_id

 /**
  * Returns a WPML readable string that allows to tell translation service and translator id
  * (typically used for translators dropdowns)
  *
  * @param int|bool $translation_service_id
  * @param int|bool $translator_id
  *
  * @return string
  */
 public static function get_wpml_translator_id($translation_service_id = false, $translator_id = false)
 {
     if ($translation_service_id === false) {
         $translation_service_id = TranslationProxy::get_current_service_id();
     }
     $result = 'ts-' . $translation_service_id;
     if ($translator_id !== false) {
         $result .= '-' . $translator_id;
     }
     return $result;
 }
開發者ID:aarongillett,項目名稱:B22-151217,代碼行數:20,代碼來源:translationproxy-service.class.php

示例4: icl_pickup_translations

function icl_pickup_translations()
{
    if (!wpml_is_action_authenticated('icl_pickup_translations')) {
        die('Wrong Nonce');
    }
    global $ICL_Pro_Translation, $wpdb;
    $job_factory = wpml_tm_load_job_factory();
    $wpml_tm_records = new WPML_TM_Records($wpdb);
    $cms_id_helper = new WPML_TM_CMS_ID($wpml_tm_records, $job_factory);
    $project = TranslationProxy::get_current_project();
    $remote_sync_factory = new WPML_TP_Remote_Sync_Factory($project, $ICL_Pro_Translation, $cms_id_helper);
    $pickup = new WPML_TP_Polling_Pickup($ICL_Pro_Translation, $remote_sync_factory);
    wp_send_json_success($pickup->poll_job($_POST));
}
開發者ID:agiper,項目名稱:wordpress,代碼行數:14,代碼來源:ajax.php

示例5: __construct

 /**
  * @param TranslationProxy_Service $service
  * @param string                    $delivery
  */
 public function __construct($service, $delivery = 'xmlrpc')
 {
     $this->service = $service;
     $this->errors = array();
     $icl_translation_projects = TranslationProxy::get_translation_projects();
     $project_index = self::generate_service_index($service);
     if ($project_index && $icl_translation_projects && isset($icl_translation_projects[$project_index])) {
         $project = $icl_translation_projects[$project_index];
         $this->id = $project['id'];
         $this->access_key = $project['access_key'];
         $this->ts_id = $project['ts_id'];
         $this->ts_access_key = $project['ts_access_key'];
         $this->service->delivery_method = $delivery;
     }
 }
開發者ID:ryuqing,項目名稱:cake,代碼行數:19,代碼來源:translationproxy-project.class.php

示例6: refresh_language_pairs

 function refresh_language_pairs()
 {
     $project = TranslationProxy::get_current_project();
     $nonce_is_valid = false;
     if (array_key_exists('nonce', $_POST)) {
         $nonce = $_POST['nonce'];
         $nonce_is_valid = wp_verify_nonce($nonce, 'wpml-tp-refresh-language-pairs');
     }
     if ($nonce_is_valid) {
         try {
             $this->wpml_tp_api->refresh_language_pairs($project);
             wp_send_json_success(esc_attr__('Language pairs refreshed.', 'wpml-translation-management'));
         } catch (Exception $e) {
             wp_send_json_error($e);
         }
     }
 }
開發者ID:studiopengpeng,項目名稱:ASCOMETAL,代碼行數:17,代碼來源:class-wpml-tp-api-ajax.php

示例7: get_model

 public function get_model()
 {
     $translation_service_name = TranslationProxy::get_current_service_name();
     $alert_1 = 'Use this feature when you want to reset your translation process. All your existing translations will remain unchanged. Any translation work that is currently in progress will be stopped.';
     $alert_2 = '';
     if (!$translation_service_name) {
         $translation_service_name = 'PRO';
         $alert_2 = 'Only select this option if you have no pending jobs or you are sure of what you are doing.';
     } else {
         if (!TranslationProxy::has_preferred_translation_service()) {
             $alert_2 = 'If you have sent content to %1$s, you should cancel the projects in %1$s system.';
         }
         $alert_2 .= 'Any work that completes after you do this reset cannot be received by your site.';
     }
     $model = array('strings' => array('title' => __('Reset professional translation state', 'wpml-translation-management'), 'alert1' => sprintf(__($alert_1, 'wpml-translation-management'), $translation_service_name), 'alert2' => sprintf(__($alert_2, 'wpml-translation-management'), $translation_service_name), 'checkBoxLabel' => sprintf(__('I am about to stop any ongoing work done by %1$s.', 'wpml-translation-management'), $translation_service_name), 'button' => __('Reset professional translation state', 'wpml-translation-management')), 'placeHolder' => 'icl_reset_pro');
     return $model;
 }
開發者ID:aarongillett,項目名稱:B22-151217,代碼行數:17,代碼來源:class-wpml-tm-troubleshooting-reset-pro-trans-config-ui.php

示例8: translation_service_details

function translation_service_details($service, $show_project = false)
{
    $service_details = '';
    if (defined('OTG_SANDBOX_DEBUG') && OTG_SANDBOX_DEBUG) {
        $service_details .= '<h3>Service details:</h3>' . PHP_EOL;
        $service_details .= '<pre>' . PHP_EOL;
        $service_details .= print_r($service, true);
        $service_details .= '</pre>' . PHP_EOL;
        if ($show_project) {
            $project = TranslationProxy::get_current_project();
            echo '<pre>$project' . PHP_EOL;
            echo print_r($project, true);
            echo '</pre>';
        }
    }
    return $service_details;
}
開發者ID:agiper,項目名稱:wordpress,代碼行數:17,代碼來源:functions.php

示例9: menu

    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"/>
//.........這裏部分代碼省略.........
開發者ID:Junaid-Farid,項目名稱:gocnex,代碼行數:101,代碼來源:wpml_tm_troubleshooting.class.php

示例10: process_translated_string

 private function process_translated_string($translation_proxy_job_id, $language)
 {
     $project = TranslationProxy::get_current_project();
     $translation = $project->fetch_translation($translation_proxy_job_id);
     $translation = apply_filters('icl_data_from_pro_translation', $translation);
     $ret = false;
     $translation = $this->xliff_reader_factory->string_xliff_reader()->get_data($translation);
     if ($translation) {
         $ret = icl_translation_add_string_translation($translation_proxy_job_id, $translation, $language);
         if ($ret) {
             $project->update_job($translation_proxy_job_id);
         }
     }
     return $ret;
 }
開發者ID:studiopengpeng,項目名稱:ASCOMETAL,代碼行數:15,代碼來源:wpml-pro-translation.class.php

示例11: get_translator_name

 public static function get_translator_name($translator_id)
 {
     if (TranslationProxy::translator_selection_available()) {
         $lang_status = self::get_language_pairs();
         if ($lang_status) {
             foreach ($lang_status as $lp) {
                 $lp_trans = !empty($lp['translators']) ? $lp['translators'] : array();
                 foreach ($lp_trans as $tr) {
                     $translators[$tr['id']] = $tr['nickname'];
                 }
             }
         }
     }
     return isset($translators[$translator_id]) ? $translators[$translator_id] : false;
 }
開發者ID:sajjadalisiddiqui,項目名稱:cms,代碼行數:15,代碼來源:translationproxy-translator.class.php

示例12: get_extra_fields_local

 /**
  * @return bool|array
  */
 public static function get_extra_fields_local()
 {
     global $sitepress;
     $service = TranslationProxy::get_current_service();
     $icl_translation_projects = $sitepress->get_setting('icl_translation_projects');
     if (isset($icl_translation_projects[TranslationProxy_Project::generate_service_index($service)]['extra_fields']) && !empty($icl_translation_projects[TranslationProxy_Project::generate_service_index($service)]['extra_fields'])) {
         return $icl_translation_projects[TranslationProxy_Project::generate_service_index($service)]['extra_fields'];
     } else {
         return false;
     }
 }
開發者ID:Junaid-Farid,項目名稱:gocnex,代碼行數:14,代碼來源:translationproxy.class.php

示例13: build_content_dashboard_remote_translations_controls

    private function build_content_dashboard_remote_translations_controls()
    {
        // shows only when translation polling is on and there are translations in progress
        $this->build_content_dashboard_fetch_translations_box();
        $active_service = icl_do_not_promote() ? false : TranslationProxy::get_current_service();
        $service_dashboard_info = TranslationProxy::get_service_dashboard_info();
        if ($active_service && $service_dashboard_info) {
            ?>
            <div class="icl_cyan_box">
                <h3><?php 
            echo $active_service->name . ' ' . __('account status', 'wpml-translation-management');
            ?>
</h3>
                <?php 
            echo $service_dashboard_info;
            ?>
            </div>
            <?php 
        }
    }
開發者ID:tlandn,項目名稱:akvo-sites-zz-template,代碼行數:20,代碼來源:wpml-tm-menus.class.php

示例14: define

<?php

define('ICL_LANGUAGE_NOT_SUPPORTED', 3);
global $wpdb, $sitepress;
$target = filter_input(INPUT_GET, 'target', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$auto_resize = filter_input(INPUT_GET, 'auto_resize', FILTER_VALIDATE_BOOLEAN | FILTER_NULL_ON_FAILURE);
$unload_cb = filter_input(INPUT_GET, 'unload_cb', FILTER_SANITIZE_FULL_SPECIAL_CHARS | FILTER_NULL_ON_FAILURE);
// Adding a translator
if (preg_match('|^@select-translators;([^;]+);([^;]+)@|', $target, $matches)) {
    $source_language = $matches[1];
    $target_language = $matches[2];
    $project = TranslationProxy::get_current_project();
    try {
        $lp_setting_index = 'language_pairs';
        $language_pairs = $sitepress->get_setting($lp_setting_index, array());
        if (!isset($language_pairs[$source_language][$target_language]) || $language_pairs[$source_language][$target_language] == 0) {
            $language_pairs[$source_language][$target_language] = 1;
            TranslationProxy_Translator::update_language_pairs($project, $language_pairs);
            $sitepress->set_setting($lp_setting_index, $language_pairs, true);
        }
        $target = $project->select_translator_iframe_url($source_language, $target_language);
    } catch (Exception $e) {
        if ($e->getCode() == ICL_LANGUAGE_NOT_SUPPORTED) {
            printf(__('<p>Requested languages are not supported by the translation service (%s). Please <a%s>contact us</a> for support. </p>', 'sitepress'), $e->getMessage(), ' target="_blank" href="http://wpml.org/?page_id=5255"');
        } else {
            printf(__('<p>Could not add the requested languages. Please <a%s>contact us</a> for support. </p><p>Show <a%s>debug information</a>.</p>', 'sitepress'), ' target="_blank" href="http://wpml.org/?page_id=5255"', ' a href="admin.php?page=' . ICL_PLUGIN_FOLDER . '/menu/troubleshooting.php&icl_action=icl-connection-test' . '#icl-connection-test"');
        }
        exit;
    }
}
$target .= strpos($target, '?') === false ? '?' : '&';
開發者ID:aarongillett,項目名稱:B22-151217,代碼行數:31,代碼來源:translationproxy-popup.php

示例15: has_preferred_translation_service

 public function has_preferred_translation_service()
 {
     return TranslationProxy::has_preferred_translation_service();
 }
開發者ID:aarongillett,項目名稱:B22-151217,代碼行數:4,代碼來源:class-wpml-translation-proxy-api.php


注:本文中的TranslationProxy類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。