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


PHP ICanLocalizeQuery::createAccount方法代码示例

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


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

示例1: switch

 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

示例2: intval

            $user['project_kind'] = 2;
            $user['pickup_type'] = intval($sitepress_settings['translation_pickup_method']);
            $notifications = 0;
            if (!empty($sitepress_settings['icl_notify_complete'])) {
                $notifications += 1;
            }
            if ($sitepress_settings['alert_delay']) {
                $notifications += 2;
            }
            $user['notifications'] = $notifications;
            $user['ignore_languages'] = 0;
            $user['from_language1'] = isset($_GET['lang_from']) ? $_GET['lang_from'] : 'English';
            $user['to_language1'] = isset($_GET['lang_to']) ? $_GET['lang_to'] : 'French';
        }
        define('ICL_DEB_SHOW_ICL_RAW_RESPONSE', true);
        $resp = $icl_query->createAccount($user);
        echo '<textarea style="width:100%;height:400px;font-size:9px;">';
        if (defined('ICL_API_ENDPOINT')) {
            echo ICL_API_ENDPOINT . "\r\n\r\n";
        }
        echo __('Data', 'sitepress') . "\n----------------------------------------\n" . print_r($user, 1) . __('Response', 'sitepress') . "\n----------------------------------------\n" . print_r($resp, 1) . '</textarea>';
        ?>

		<?php 
    }
    ?>
		<a class="button" href="admin.php?page=<?php 
    echo ICL_PLUGIN_FOLDER;
    ?>
/menu/troubleshooting.php&ts=<?php 
    echo time();
开发者ID:GaryJones,项目名称:TPWP,代码行数:31,代码来源:troubleshooting.php

示例3: intval

 }
 $user['interview_translators'] = $this->settings['interview_translators'];
 $user['project_kind'] = 2;
 $user['pickup_type'] = intval($this->settings['translation_pickup_method']);
 $notifications = 0;
 if (!empty($this->settings['icl_notify_complete'])) {
     $notifications += 1;
 }
 if ($this->settings['alert_delay']) {
     $notifications += 2;
 }
 $user['notifications'] = $notifications;
 $user['ignore_languages'] = 0;
 $user['from_language1'] = $lang_server[$from_lang];
 $user['to_language1'] = $lang_server[$to_lang];
 list($site_id, $access_key) = $icl_query->createAccount($user);
 if ($site_id && $access_key) {
     $this->settings['site_id'] = $iclsettings['site_id'] = $site_id;
     $this->settings['access_key'] = $iclsettings['access_key'] = $access_key;
     $iclsettings['language_pairs'][$from_lang][$to_lang] = 1;
     $this->save_settings($iclsettings);
 } else {
     $user['pickup_type'] = ICL_PRO_TRANSLATION_PICKUP_POLLING;
     list($site_id, $access_key) = $icl_query->createAccount($user);
     if ($site_id && $access_key) {
         $this->settings['site_id'] = $iclsettings['site_id'] = $site_id;
         $this->settings['access_key'] = $iclsettings['access_key'] = $access_key;
         $iclsettings['language_pairs'][$from_lang][$to_lang] = 1;
         $iclsettings['translation_pickup_method'] = ICL_PRO_TRANSLATION_PICKUP_POLLING;
         $this->save_settings($iclsettings);
     } else {
开发者ID:besimhu,项目名称:LDF-site,代码行数:31,代码来源:icl-reminder-popup.php

示例4: ICanLocalizeQuery

 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

示例5: array

 /**
  * Create an account for the website.
  * This is used in case the website project has not been set up yet.
  */
 function create_account()
 {
     global $sitepress, $sitepress_settings, $wpdb;
     $user = array();
     $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('home');
     $user['title'] = get_option('blogname');
     $user['description'] = isset($sitepress_settings['icl_site_description']) ? $sitepress_settings['icl_site_description'] : '';
     $user['is_verified'] = 1;
     $user['interview_translators'] = $sitepress_settings['interview_translators'];
     $user['project_kind'] = isset($sitepress_settings['website_kind']) ? $sitepress_settings['website_kind'] : 2;
     $user['pickup_type'] = intval($sitepress_settings['translation_pickup_method']);
     $user['ignore_languages'] = 1;
     if (defined('ICL_AFFILIATE_ID') && defined('ICL_AFFILIATE_KEY')) {
         $user['affiliate_id'] = ICL_AFFILIATE_ID;
         $user['affiliate_key'] = ICL_AFFILIATE_KEY;
     }
     $notifications = 0;
     if (isset($sitepress_settings['icl_notify_complete'])) {
         if ($sitepress_settings['icl_notify_complete']) {
             $notifications += 1;
         }
         if ($sitepress_settings['alert_delay']) {
             $notifications += 2;
         }
     }
     $user['notifications'] = $notifications;
     require_once ICL_PLUGIN_PATH . '/lib/icl_api.php';
     $icl_query = new ICanLocalizeQuery();
     list($site_id, $access_key) = $icl_query->createAccount($user);
     if (!$site_id) {
         $user['pickup_type'] = ICL_PRO_TRANSLATION_PICKUP_POLLING;
         list($site_id, $access_key) = $icl_query->createAccount($user);
     }
     if ($site_id) {
         if ($user['pickup_type'] == ICL_PRO_TRANSLATION_PICKUP_POLLING) {
             $sitepress_settings['translation_pickup_method'] = ICL_PRO_TRANSLATION_PICKUP_POLLING;
         }
         $sitepress_settings['site_id'] = $site_id;
         $sitepress_settings['access_key'] = $access_key;
         $sitepress_settings['icl_account_email'] = isset($user['email']) ? $user['email'] : '';
         $sitepress->get_icl_translator_status($sitepress_settings);
         $sitepress->save_settings($sitepress_settings);
     }
 }
开发者ID:ascarius,项目名称:wordpress-bootstrap,代码行数:53,代码来源:translation-analytics.class.php

示例6: foreach

     foreach ($language_pairs as $k => $v) {
         $english_fr = $wpdb->get_var("SELECT english_name FROM {$wpdb->prefix}icl_languages WHERE code='{$k}' ");
         foreach ($v as $k => $v) {
             $incr++;
             $english_to = $wpdb->get_var("SELECT english_name FROM {$wpdb->prefix}icl_languages WHERE code='{$k}' ");
             $lang_pairs['from_language' . $incr] = ICL_Pro_Translation::server_languages_map($english_fr);
             $lang_pairs['to_language' . $incr] = ICL_Pro_Translation::server_languages_map($english_to);
             if ($pay_per_use) {
                 $lang_pairs['pay_per_use' . $incr] = 1;
             }
         }
     }
 }
 require_once ICL_PLUGIN_PATH . '/lib/icl_api.php';
 $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) {
         // We will force the next try to be http.
         update_option('_force_mp_post_http', 1);
     }
     $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;
开发者ID:santikrass,项目名称:apache,代码行数:31,代码来源:quote-get-submit.php


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