コード例 #1
0
 public function getFullLocale($registration = false)
 {
     if (!$registration) {
         $textmaster_api_obj = new TextMasterAPI($this);
         $user_info = $textmaster_api_obj->getUserInfo();
         return $user_info['locale'];
     }
     $locales_from_api = array();
     $textmaster_api_obj = new TextMasterAPI();
     foreach ($textmaster_api_obj->getLocales() as $row => $locale_info) {
         $locales_from_api[] = $locale_info['code'];
     }
     $registration_locale = $this->getRegistrationLocale();
     if (in_array($registration_locale, $locales_from_api)) {
         return $registration_locale;
     }
     return TEXTMASTER_DEFAULT_LOCALE;
 }
コード例 #2
0
ファイル: Project.php プロジェクト: ventsiwad/presta_addons
 public function quote()
 {
     $textMasterAPI = new TextMasterAPI();
     $result = $textMasterAPI->addProject($this->api_data, true);
     if (is_array($result) && isset($result['total_costs'])) {
         $user_info = $textMasterAPI->getUserInfo();
         foreach ($result['total_costs'] as $costs) {
             if ($costs['currency'] == $user_info['wallet']['currency_code']) {
                 // looks for the correct currency
                 return $costs['amount'] . ' ' . $costs['currency'];
             }
         }
     }
     return $result;
 }