本文整理汇总了PHP中ICanLocalizeQuery::updateAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP ICanLocalizeQuery::updateAccount方法的具体用法?PHP ICanLocalizeQuery::updateAccount怎么用?PHP ICanLocalizeQuery::updateAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICanLocalizeQuery
的用法示例。
在下文中一共展示了ICanLocalizeQuery::updateAccount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
function ajax_calls($call, $data)
{
global $sitepress_settings, $sitepress;
switch ($call) {
case 'set_pickup_mode':
$method = intval($data['icl_translation_pickup_method']);
$iclsettings['translation_pickup_method'] = $method;
$sitepress->save_settings($iclsettings);
if (!empty($sitepress_settings)) {
$data['site_id'] = $sitepress_settings['site_id'];
$data['accesskey'] = $sitepress_settings['access_key'];
$data['create_account'] = 0;
$data['pickup_type'] = $method;
$icl_query = new ICanLocalizeQuery();
$res = $icl_query->updateAccount($data);
}
if ($method == ICL_PRO_TRANSLATION_PICKUP_XMLRPC) {
wp_clear_scheduled_hook('icl_hourly_translation_pickup');
} else {
wp_schedule_event(time(), 'hourly', 'icl_hourly_translation_pickup');
}
echo json_encode(array('message' => 'OK'));
break;
case 'pickup_translations':
if ($sitepress_settings['translation_pickup_method'] == ICL_PRO_TRANSLATION_PICKUP_POLLING) {
$fetched = $this->poll_for_translations(true);
echo json_encode(array('message' => 'OK', 'fetched' => urlencode(' ' . sprintf(__('Fetched %d translations.', 'sitepress'), $fetched))));
} else {
echo json_encode(array('error' => __('Manual pick up is disabled.', 'sitepress')));
}
break;
}
}
示例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);
}
示例3: 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);
}
示例4: foreach
}
}
$this->save_settings($iclsettings);
// update account - add language pair
$incr = 0;
foreach ($this->settings['language_pairs'] as $k => $v) {
foreach ($v as $k2 => $v2) {
$incr++;
$data['from_language' . $incr] = $lang_server[$k];
$data['to_language' . $incr] = $lang_server[$k2];
}
}
$data['site_id'] = $this->settings['site_id'];
$data['accesskey'] = $this->settings['access_key'];
$data['create_account'] = 0;
$icl_query->updateAccount($data);
}
$icl_query = new ICanLocalizeQuery($this->settings['site_id'], $this->settings['access_key']);
$website_details = $icl_query->get_website_details();
if (empty($website_details)) {
echo '<p class="error">';
printf(__('There was a problem connecting to ICanLocalize. Please close this window and try again. If the problem persists please <a%s>contact us</a>.', 'sitepress'), ' target="_blank" href="http://wpml.org/?page_id=5255"');
echo '</p>';
exit;
}
$translation_languages = $website_details['translation_languages']['translation_language'];
if (isset($translation_languages['attr'])) {
$buff = $translation_languages;
unset($translation_languages);
$translation_languages[0] = $buff;
unset($buff);
示例5: array
$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;
$query = '';