• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ICanLocalizeQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ICanLocalizeQuery的典型用法代码示例。如果您正苦于以下问题:PHP ICanLocalizeQuery类的具体用法?PHP ICanLocalizeQuery怎么用?PHP ICanLocalizeQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: poll_for_translations

 function poll_for_translations($force = false)
 {
     global $sitepress_settings, $sitepress, $wpdb;
     if (!$force) {
         // Limit to once per hour
         $toffset = strtotime(current_time('mysql')) - @intval($sitepress_settings['last_picked_up']) - 3600;
         if ($toffset < 0 || $force) {
             return 0;
         }
     }
     $iclq = new ICanLocalizeQuery($sitepress_settings['site_id'], $sitepress_settings['access_key']);
     $pending = $iclq->cms_requests();
     $fetched = 0;
     if (!empty($pending)) {
         foreach ($pending as $doc) {
             if (empty($doc['cms_id'])) {
                 // it's a string
                 $target = $wpdb->get_var($wpdb->prepare("SELECT target FROM {$wpdb->prefix}icl_core_status WHERE rid=%d", $doc['id']));
                 $__ld = $sitepress->get_language_details($target);
                 $language = $this->server_languages_map($__ld['english_name']);
                 $ret = $this->process_translated_string($doc['id'], $language);
                 if ($ret) {
                     $fetched++;
                 }
             } else {
                 // decode cms_id
                 $int = preg_match('#(.+)_([0-9]+)_([^_]+)_([^_]+)#', $doc['cms_id'], $matches);
                 $_element_type = $matches[1];
                 $_element_id = $matches[2];
                 $_original_lang = $matches[3];
                 $_lang = $matches[4];
                 $trid = $sitepress->get_element_trid($_element_id, 'post_' . $_element_type);
                 $translation = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND language_code=%s", $trid, $_lang));
                 $ret = $this->add_translated_document($translation->translation_id, $doc['id']);
                 if ($ret) {
                     $fetched++;
                 }
             }
         }
     }
     $iclsettings['last_picked_up'] = strtotime(current_time('mysql'));
     $sitepress->save_settings($iclsettings);
     return $fetched;
 }
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:44,代码来源:pro-translation.class.php


示例2: update_language_pairs

 /**
  * Synchronizes language pairs with ICL
  *
  * @global object $sitepress
  *
  * @param $project
  * @param $language_pairs
  *
  */
 public static function update_language_pairs($project, $language_pairs)
 {
     /** @var WPML_Pro_Translation $ICL_Pro_Translation */
     global $sitepress, $ICL_Pro_Translation;
     $params = array('site_id' => $project->ts_id, 'accesskey' => $project->ts_access_key, 'create_account' => 0);
     $lang_server = array();
     foreach ($sitepress->get_active_languages() as $lang) {
         $lang_server[$lang['code']] = $ICL_Pro_Translation->server_languages_map($lang['english_name']);
     }
     // update account - add language pair
     $incr = 0;
     foreach ($language_pairs as $k => $v) {
         if (!array_key_exists($k, $lang_server)) {
             unset($language_pairs[$k]);
             continue;
         }
         foreach ($v as $k2 => $v2) {
             if (!array_key_exists($k2, $lang_server)) {
                 unset($language_pairs[$k][$k2]);
                 if ((bool) $language_pairs[$k] === false) {
                     unset($language_pairs[$k]);
                 }
                 continue;
             }
             $incr++;
             $params['from_language' . $incr] = $lang_server[$k];
             $params['to_language' . $incr] = $lang_server[$k2];
         }
     }
     require_once ICL_PLUGIN_PATH . '/lib/Snoopy.class.php';
     require_once ICL_PLUGIN_PATH . '/lib/xml2array.php';
     require_once ICL_PLUGIN_PATH . '/lib/icl_api.php';
     $icl_query = new ICanLocalizeQuery();
     $icl_query->updateAccount($params);
 }
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:44,代码来源:translationproxy-translator.class.php


示例3: process_forms

 function process_forms()
 {
     global $wpdb;
     require_once ICL_PLUGIN_PATH . '/lib/Snoopy.class.php';
     require_once ICL_PLUGIN_PATH . '/lib/xml2array.php';
     require_once ICL_PLUGIN_PATH . '/lib/icl_api.php';
     if (isset($_POST['icl_post_action'])) {
         switch ($_POST['icl_post_action']) {
             case 'save_theme_localization':
                 $locales = array();
                 foreach ($_POST as $k => $v) {
                     if (0 !== strpos($k, 'locale_file_name_') || !trim($v)) {
                         continue;
                     }
                     $locales[str_replace('locale_file_name_', '', $k)] = $v;
                 }
                 if (!empty($locales)) {
                     $this->set_locale_file_names($locales);
                 }
                 break;
         }
         return;
     }
     $create_account = isset($_POST['icl_create_account_nonce']) && $_POST['icl_create_account_nonce'] == wp_create_nonce('icl_create_account');
     $create_account_and_transfer = isset($_POST['icl_create_account_and_transfer_nonce']) && $_POST['icl_create_account_and_transfer_nonce'] == wp_create_nonce('icl_create_account_and_transfer');
     $config_account = isset($_POST['icl_configure_account_nonce']) && $_POST['icl_configure_account_nonce'] == wp_create_nonce('icl_configure_account');
     $create_support_account = isset($_POST['icl_create_support_account_nonce']) && $_POST['icl_create_support_account_nonce'] == wp_create_nonce('icl_create_support_account');
     $config_support_account = isset($_POST['icl_configure_support_account_nonce']) && $_POST['icl_configure_support_account_nonce'] == wp_create_nonce('icl_configure_support_account');
     $use_existing_account = isset($_POST['icl_use_account_nonce']) && $_POST['icl_use_account_nonce'] == wp_create_nonce('icl_use_account');
     $transfer_to_account = isset($_POST['icl_transfer_account_nonce']) && $_POST['icl_transfer_account_nonce'] == wp_create_nonce('icl_transfer_account');
     if ($create_account || $config_account || $create_support_account || $config_support_account) {
         if (isset($_POST['icl_content_trans_setup_back_2'])) {
             // back button in wizard mode.
             $this->settings['content_translation_setup_wizard_step'] = 2;
             $this->save_settings();
         } else {
             $user = $_POST['user'];
             $user['create_account'] = isset($_POST['icl_create_account_nonce']) || isset($_POST['icl_create_support_account_nonce']) ? 1 : 0;
             $user['platform_kind'] = 2;
             $user['cms_kind'] = 1;
             $user['blogid'] = $wpdb->blogid ? $wpdb->blogid : 1;
             $user['url'] = get_home_url();
             $user['title'] = get_option('blogname');
             $user['description'] = $this->settings['icl_site_description'];
             $user['is_verified'] = 1;
             if ($user['create_account'] && defined('ICL_AFFILIATE_ID') && defined('ICL_AFFILIATE_KEY')) {
                 $user['affiliate_id'] = ICL_AFFILIATE_ID;
                 $user['affiliate_key'] = ICL_AFFILIATE_KEY;
             }
             $user['interview_translators'] = $this->settings['interview_translators'];
             $user['project_kind'] = $this->settings['website_kind'];
             /*
              if(is_null($user['project_kind']) || $user['project_kind']==''){
             	$_POST['icl_form_errors'] = __('Please select the kind of website','sitepress');
             	return;
             }
             */
             $user['pickup_type'] = intval($this->settings['translation_pickup_method']);
             $notifications = 0;
             if ($this->settings['icl_notify_complete']) {
                 $notifications += 1;
             }
             if ($this->settings['alert_delay']) {
                 $notifications += 2;
             }
             $user['notifications'] = $notifications;
             // prepare language pairs
             $pay_per_use = $this->settings['translator_choice'] == 1;
             $language_pairs = $this->settings['language_pairs'];
             $lang_pairs = array();
             if (isset($language_pairs)) {
                 foreach ($language_pairs as $k => $v) {
                     $english_fr = $wpdb->get_var("SELECT english_name FROM {$wpdb->prefix}icl_languages WHERE code='{$k}' ");
                     $pay_per_use_increment = 0;
                     foreach ($v as $k => $v) {
                         $pay_per_use_increment++;
                         $english_to = $wpdb->get_var("SELECT english_name FROM {$wpdb->prefix}icl_languages WHERE code='{$k}' ");
                         $lang_pairs['from_language' . $pay_per_use_increment] = ICL_Pro_Translation::server_languages_map($english_fr);
                         $lang_pairs['to_language' . $pay_per_use_increment] = ICL_Pro_Translation::server_languages_map($english_to);
                         if ($pay_per_use) {
                             $lang_pairs['pay_per_use' . $pay_per_use_increment] = 1;
                         }
                     }
                 }
             }
             $icl_query = new ICanLocalizeQuery();
             list($site_id, $access_key) = $icl_query->createAccount(array_merge($user, $lang_pairs));
             if (!$site_id) {
                 $user['pickup_type'] = ICL_PRO_TRANSLATION_PICKUP_POLLING;
                 list($site_id, $access_key) = $icl_query->createAccount(array_merge($user, $lang_pairs));
             }
             if (!$site_id) {
                 if ($access_key) {
                     $_POST['icl_form_errors'] = $access_key;
                 } else {
                     $_POST['icl_form_errors'] = __('An unknown error has occurred when communicating with the ICanLocalize server. Please try again.', 'sitepress');
                     // We will force the next try to be http.
                     update_option('_force_mp_post_http', 1);
                 }
             } else {
//.........这里部分代码省略.........
开发者ID:pablomarsan,项目名称:iftheme-docs,代码行数:101,代码来源:sitepress.class.php


示例4: _icl_translation_send_strings_icanlocalize

function _icl_translation_send_strings_icanlocalize($string_ids, $target)
{
    global $wpdb, $sitepress, $sitepress_settings;
    if (!$sitepress_settings['st']['strings_language']) {
        $sitepress_settings['st']['strings_language'] = $sitepress->get_default_language();
    }
    $target_details = $sitepress->get_language_details($target);
    // get all the untranslated strings
    $untranslated = array();
    foreach ($string_ids as $st_id) {
        $status = $wpdb->get_var($wpdb->prepare("SELECT status FROM {$wpdb->prefix}icl_string_translations WHERE string_id=%d and language=%s", $st_id, $target));
        if ($status != ICL_STRING_TRANSLATION_COMPLETE) {
            $untranslated[] = $st_id;
        }
    }
    if (sizeof($untranslated) > 0) {
        // Something to translate.
        $target_for_server = array(ICL_Pro_Translation::server_languages_map($target_details['english_name']));
        //filter some language names to match the names on the server
        $data = array('url' => '', 'target_languages' => $target_for_server);
        $string_values = array();
        foreach ($untranslated as $st_id) {
            $string = $wpdb->get_row($wpdb->prepare("SELECT context, name, value FROM {$wpdb->prefix}icl_strings WHERE id=%d", $st_id));
            $string_values[$st_id] = $string->value;
            $data['contents']['string-' . $st_id . '-context'] = array('translate' => 0, 'data' => base64_encode(htmlspecialchars($string->context)), 'format' => 'base64');
            $data['contents']['string-' . $st_id . '-name'] = array('translate' => 0, 'data' => base64_encode(htmlspecialchars($string->name)), 'format' => 'base64');
            $data['contents']['string-' . $st_id . '-value'] = array('translate' => 1, 'data' => base64_encode(htmlspecialchars($string->value)), 'format' => 'base64');
        }
        $iclq = new ICanLocalizeQuery($sitepress_settings['site_id'], $sitepress_settings['access_key']);
        $orig_lang = $sitepress->get_language_details($sitepress_settings['st']['strings_language']);
        $orig_lang_for_server = ICL_Pro_Translation::server_languages_map($orig_lang['english_name']);
        $timestamp = date('Y-m-d H:i:s');
        $xml = $iclq->build_cms_request_xml($data, $orig_lang_for_server);
        $args = array('xml' => $xml, 'title' => "String translations", 'to_languages' => $target_for_server, 'orig_language' => $orig_lang_for_server);
        $res = $iclq->send_request($args);
        if ($res > 0) {
            foreach ($string_values as $st_id => $value) {
                $wpdb->insert($wpdb->prefix . 'icl_string_status', array('rid' => $res, 'string_translation_id' => $st_id, 'timestamp' => $timestamp, 'md5' => md5($value)));
                //insert rid
            }
            $wpdb->insert($wpdb->prefix . 'icl_core_status', array('rid' => $res, 'origin' => $orig_lang['code'], 'target' => $target, 'status' => CMS_REQUEST_WAITING_FOR_PROJECT_CREATION));
            return $res;
        } else {
            return 0;
        }
    }
}
开发者ID:besimhu,项目名称:LDF-site,代码行数:47,代码来源:functions.php


示例5: array_keys

     $iclsettings['st']['translated-users'] = !empty($_POST['users']) ? array_keys($_POST['users']) : array();
     $this->save_settings($iclsettings);
     if (!empty($iclsettings['st']['translated-users'])) {
         $sitepress_settings['st']['translated-users'] = $iclsettings['st']['translated-users'];
         icl_st_register_user_strings_all();
     }
     echo 1;
     break;
 case 'icl_st_ar_form':
     // Auto register string settings.
     $iclsettings['st']['icl_st_auto_reg'] = $_POST['icl_auto_reg_type'];
     $this->save_settings($iclsettings);
     echo 1;
     break;
 case 'affiliate_info_check':
     if ($this->icl_account_configured() && ($iclq = new ICanLocalizeQuery($this->get_setting('site_id'), $this->get_setting('access_key'))) && $iclq->test_affiliate_info($_POST['icl_affiliate_id'], $_POST['icl_affiliate_key'])) {
         $error = array('error' => 0);
     } else {
         $error = array('error' => 1);
     }
     echo json_encode($error);
     break;
 case 'icl_hide_languages':
     $iclsettings['hidden_languages'] = empty($_POST['icl_hidden_languages']) ? array() : $_POST['icl_hidden_languages'];
     $this->set_setting('hidden_languages', array());
     //reset current value
     $active_languages = $this->get_active_languages();
     if (!empty($iclsettings['hidden_languages'])) {
         if (1 == count($iclsettings['hidden_languages'])) {
             $out = sprintf(__('%s is currently hidden to visitors.', 'sitepress'), $active_languages[$iclsettings['hidden_languages'][0]]['display_name']);
         } else {
开发者ID:PHQ-Design,项目名称:souza-lima,代码行数:31,代码来源:ajax.php


示例6: wpml_send_content_to_translation

/**
 *  Sends piece of content (string) to professional translation @ ICanLocalize
 *
 * @since 1.3
 * @package WPML
 * @subpackage WPML API
 *
 * @param string $string String
 * @param string $from_language Language to translate from
 * @param int $content_id Content ID
 * @param string $content_type Content Type
 * @param string $to_language Language to translate into
 *
 * @return int request id
 *  */
function wpml_send_content_to_translation($string, $content_id, $content_type, $from_language, $to_language)
{
    global $sitepress, $sitepress_settings, $wpdb;
    if (!_wpml_api_allowed_content_type($content_type)) {
        return 0;
        //WPML_API_INVALID_CONTENT_TYPE
    }
    if (!$sitepress->get_language_details($from_language) || !$sitepress->get_language_details($to_language)) {
        return 0;
        // WPML_API_INVALID_LANGUAGE_CODE
    }
    $from_lang = $sitepress->get_language_details($from_language);
    $to_lang = $sitepress->get_language_details($to_language);
    $from_lang_server = apply_filters('icl_server_languages_map', $from_lang['english_name']);
    $to_lang_server = apply_filters('icl_server_languages_map', $to_lang['english_name']);
    $iclq = new ICanLocalizeQuery($sitepress_settings['site_id'], $sitepress_settings['access_key']);
    $rid = $iclq->cms_create_message($string, $from_lang_server, $to_lang_server);
    if ($rid > 0) {
        // does this comment already exist in the messages status queue?
        $msid = $wpdb->get_var($wpdb->prepare(" SELECT id\n                                                FROM {$wpdb->prefix}icl_message_status\n                                                WHERE object_type = %s\n                                                  AND object_id = %d", $content_type, $content_id));
        if ($msid) {
            $wpdb->update($wpdb->prefix . 'icl_message_status', array('rid' => $rid, 'md5' => md5($string), 'status' => MESSAGE_TRANSLATION_IN_PROGRESS), array('id' => $msid));
        } else {
            $wpdb->insert($wpdb->prefix . 'icl_message_status', array('rid' => $rid, 'object_id' => $content_id, 'from_language' => $from_language, 'to_language' => $to_language, 'md5' => md5($string), 'object_type' => $content_type, 'status' => MESSAGE_TRANSLATION_IN_PROGRESS));
        }
    }
    return $rid;
}
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:43,代码来源:wpml-api.php


示例7: send_comment_to_translation

 function send_comment_to_translation($comment_id, $to_language)
 {
     global $wpdb, $sitepress_settings, $sitepress;
     $iclq = new ICanLocalizeQuery($sitepress_settings['site_id'], $sitepress_settings['access_key']);
     $from_lang = $sitepress->get_language_details($this->user_language);
     $to_lang = $sitepress->get_language_details($to_language);
     $from_lang_server = ICL_Pro_Translation::server_languages_map($from_lang['english_name']);
     $to_lang_server = ICL_Pro_Translation::server_languages_map($to_lang['english_name']);
     $body = $wpdb->get_var("SELECT comment_content FROM {$wpdb->comments} WHERE comment_ID={$comment_id}");
     $rid = $iclq->cms_create_message($body, $from_lang_server, $to_lang_server);
     if ($rid > 0) {
         // does this comment already exist in the messages status queue?
         $msid = $wpdb->get_var("SELECT id FROM {$wpdb->prefix}icl_message_status WHERE object_type='comment' AND object_id={$comment_id}");
         if ($msid) {
             $wpdb->update($wpdb->prefix . 'icl_message_status', array('rid' => $rid, 'md5' => md5($body), 'status' => MESSAGE_TRANSLATION_IN_PROGRESS), array('id' => $msid));
         } else {
             $wpdb->insert($wpdb->prefix . 'icl_message_status', array('rid' => $rid, 'object_id' => $comment_id, 'from_language' => $this->user_language, 'to_language' => $to_language, 'md5' => md5($body), 'object_type' => 'comment', 'status' => MESSAGE_TRANSLATION_IN_PROGRESS));
         }
     }
 }
开发者ID:batruji,项目名称:metareading,代码行数:20,代码来源:functions.php


示例8: isset

            $lang_pair_id = $lpair['attr']['id'];
        }
    }
    $target = ICL_API_ENDPOINT . '/websites/' . $this->settings['site_id'] . '/website_translation_offers/' . $lang_pair_id . '?accesskey=' . $this->settings['access_key'] . '&compact=1';
}
$support_mode = isset($_GET['support']) ? $_GET['support'] : '';
/*
if ($support_mode == '1') {
    $iclq = new ICanLocalizeQuery($this->settings['support_site_id'], $this->settings['support_access_key']);
} else {
    $iclq = new ICanLocalizeQuery($this->settings['site_id'], $this->settings['access_key']);
}
$session_id = $iclq->get_current_session(true, $support_mode == '1');
*/
if (isset($this->settings['site_id']) && isset($this->settings['access_key'])) {
    $iclq = new ICanLocalizeQuery($this->settings['site_id'], $this->settings['access_key']);
    $session_id = $iclq->get_current_session(true, $support_mode == '1');
} else {
    $session_id = '';
}
$admin_lang = $this->get_admin_language();
if (isset($_GET['code'])) {
    $add = '&code=' . urlencode($_GET['code']);
} else {
    $add = '';
}
if (strpos($target, '?') === false) {
    $target .= '?';
} else {
    $target .= '&';
}
开发者ID:besimhu,项目名称:LDF-site,代码行数:31,代码来源:icl-reminder-popup.php


示例9: _e

<?php 
if (!defined('ICL_DONT_PROMOTE') || !ICL_DONT_PROMOTE) {
    ?>
	<br/>
	<div class="icl_cyan_box">
		<a name="icl-connection-test"></a>

		<h3><?php 
    _e('ICanLocalize connection test', 'sitepress');
    ?>
</h3>
		<?php 
    if (isset($_GET['icl_action']) && $_GET['icl_action'] == 'icl-connection-test') {
        ?>
			<?php 
        $icl_query = new ICanLocalizeQuery();
        if (isset($_GET['data'])) {
            $user = unserialize(base64_decode($_GET['data']));
        } else {
            $user['create_account'] = 1;
            $user['anon'] = 1;
            $user['platform_kind'] = 2;
            $user['cms_kind'] = 1;
            $user['blogid'] = $wpdb->blogid ? $wpdb->blogid : 1;
            $user['url'] = get_option('siteurl');
            $user['title'] = get_option('blogname');
            $user['description'] = isset($sitepress_settings['icl_site_description']) ? $sitepress_settings['icl_site_description'] : '';
            $user['is_verified'] = 1;
            if (defined('ICL_AFFILIATE_ID') && defined('ICL_AFFILIATE_KEY')) {
                $user['affiliate_id'] = ICL_AFFILIATE_ID;
                $user['affiliate_key'] = ICL_AFFILIATE_KEY;
开发者ID:GaryJones,项目名称:TPWP,代码行数:31,代码来源:troubleshooting.php


示例10: create_icl_account

 function create_icl_account()
 {
     global $sitepress;
     $site_id = false;
     $access_key = false;
     $user = $this->create_user_account();
     require_once ICL_PLUGIN_PATH . '/lib/icl_api.php';
     $icl_query = new ICanLocalizeQuery();
     list($site_id, $access_key) = $icl_query->createAccount($user, TA_URL_ENDPOINT);
     if (!$site_id) {
         $user['pickup_type'] = ICL_PRO_TRANSLATION_PICKUP_POLLING;
         list($site_id, $access_key) = $icl_query->createAccount($user, TA_URL_ENDPOINT);
     }
     if ($site_id) {
         if ($user['pickup_type'] == ICL_PRO_TRANSLATION_PICKUP_POLLING) {
             $sitepress->set_setting('translation_pickup_method', ICL_PRO_TRANSLATION_PICKUP_POLLING);
         }
         $icl_query = new ICanLocalizeQuery($site_id, $access_key);
         $website_details = $icl_query->get_website_details(TA_URL_ENDPOINT);
         TranslationProxy_Translator::get_icl_translator_status($website_details);
     }
     return array($site_id, $access_key);
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:23,代码来源:wpml-translation-analytics.class.php


示例11: update_language_pairs

 /**
  * Synchronizes language pairs with ICL
  *
  * @global object $sitepress
  *
  * @param $project
  * @param $language_pairs
  *
  */
 public static function update_language_pairs($project, $language_pairs)
 {
     global $sitepress;
     $params = array('site_id' => $project->ts_id, 'accesskey' => $project->ts_access_key, 'create_account' => 0);
     $lang_server = array();
     foreach ($sitepress->get_active_languages() as $lang) {
         $lang_server[$lang['code']] = WPML_Pro_Translation::server_languages_map($lang['english_name']);
     }
     // update account - add language pair
     $incr = 0;
     foreach ($language_pairs as $k => $v) {
         foreach ($v as $k2 => $v2) {
             $incr++;
             $params['from_language' . $incr] = $lang_server[$k];
             $params['to_language' . $incr] = $lang_server[$k2];
         }
     }
     require_once ICL_PLUGIN_PATH . '/lib/Snoopy.class.php';
     require_once ICL_PLUGIN_PATH . '/lib/xml2array.php';
     require_once ICL_PLUGIN_PATH . '/lib/icl_api.php';
     $icl_query = new ICanLocalizeQuery();
     $icl_query->updateAccount($params);
 }
开发者ID:sonvq,项目名称:passioninvestment,代码行数:32,代码来源:translationproxy-translator.class.php


示例12: send_translation_snapshot_to_icl

 /**
  * Sends the translation snapshot to ICanLocalize.
  * 
  * @param $array $params The parameters to be added when sending the snapshot
  */
 function send_translation_snapshot_to_icl($params)
 {
     global $sitepress, $sitepress_settings;
     $params['accesskey'] = $sitepress_settings['access_key'];
     $params['website_id'] = $sitepress_settings['site_id'];
     require_once ICL_PLUGIN_PATH . '/lib/Snoopy.class.php';
     require_once ICL_PLUGIN_PATH . '/lib/xml2array.php';
     require_once ICL_PLUGIN_PATH . '/lib/icl_api.php';
     $icl_query = new ICanLocalizeQuery();
     $request = ICL_API_ENDPOINT . "/translation_snapshots/create_by_cms.xml";
     $response = $icl_query->_request($request, 'POST', $params);
     if (!$response) {
         error_log('Translation Analytics: Could not send translation snapshot:\\n' . $icl_query->error());
     }
 }
开发者ID:ascarius,项目名称:wordpress-bootstrap,代码行数:20,代码来源:translation-analytics.class.php


示例13: array

         $iclsettings['icl_account_email'] = $user['email'];
         $sitepress->get_icl_translator_status($iclsettings);
         $sitepress->save_settings($iclsettings);
     }
     /**
      * Update account
      */
 } else {
     $data = array();
     $data['word_count'] = $word_count;
     $data['wc_description'] = $wc_description;
     $data['site_id'] = $site_id = $sitepress_settings['site_id'];
     $data['accesskey'] = $access_key = $sitepress_settings['access_key'];
     $data['ignore_languages'] = 1;
     require_once ICL_PLUGIN_PATH . '/lib/icl_api.php';
     $icl_query = new ICanLocalizeQuery();
     if ($icl_query->updateAccount($data) !== 0) {
         $saved = $sitepress_settings['quote-get'];
         $saved['step'] = 3;
         $sitepress->save_settings(array('quote-get' => $saved));
         echo __('An unknown error has occurred when communicating with the ICanLocalize server. Please try again.', 'sitepress') . '<br /><br />';
         require_once ICL_PLUGIN_PATH . '/inc/quote/quote-get.php';
         exit;
     }
 }
 /**
  * Set URL query
  */
 $language_pairs = array($saved['from'] => $saved['to']);
 $lang_pairs = array();
 $incr = 1;
开发者ID:santikrass,项目名称:apache,代码行数:31,代码来源:quote-get-submit.php


示例14: update_post_meta

 case 'icl_promote':
     $iclsettings['promote_wpml'] = $_POST['icl_promote'] == 'true' ? 1 : 0;
     $this->save_settings($iclsettings);
     break;
 case 'save_translator_note':
     update_post_meta($_POST['post_id'], '_icl_translator_note', $_POST['note']);
     break;
 case 'icl_st_more_options':
     foreach ($_POST['icl_st'] as $k => $v) {
         $iclsettings['st'][$k] = $v;
     }
     $this->save_settings($iclsettings);
     echo 1;
     break;
 case 'affiliate_info_check':
     $iclq = new ICanLocalizeQuery($this->settings['site_id'], $this->settings['access_key']);
     if ($iclq->test_affiliate_info($_POST['icl_affiliate_id'], $_POST['icl_affiliate_key'])) {
         $error = array('error' => 0);
     } else {
         $error = array('error' => 1);
     }
     echo json_encode($error);
     break;
 case 'icl_hide_languages':
     $iclsettings['hidden_languages'] = $_POST['icl_hidden_languages'];
     $this->settings['hidden_languages'] = array();
     //reset current value
     $active_languages = $this->get_active_languages();
     if (!empty($iclsettings['hidden_languages'])) {
         if (1 == count($iclsettings['hidden_languages'])) {
             $out = sprintf(__('%s is currently hidden to visitors.', 'sitepress'), $active_languages[$iclsettings['hidden_languages'][0]]['display_name']);
开发者ID:winyatasenjaya,项目名称:sitepress-multilingual-cms,代码行数:31,代码来源:ajax.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP IContextSource类代码示例发布时间:2022-05-23
下一篇:
PHP ICModel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap