コード例 #1
0
ファイル: Lookup.php プロジェクト: forthrobot/inuvik
 /**
  * Finds the translated region name for a specific region index
  *
  * @since 1.1
  * @version 1.4
  *
  * @param type $var Description...
  * @return string The translated region name
  **/
 public static function region($country, $index = false)
 {
     $regions = self::regions(true);
     $region = Shopp::array_search_deep($country, $regions);
     if (empty($region)) {
         return false;
     }
     if (false !== $index) {
         return array_search($region, array_keys($regions));
     }
     return $region;
 }
コード例 #2
0
ファイル: Locale.php プロジェクト: forthrobot/inuvik
 public function __construct($code, $country)
 {
     $currencies = $this->currencies();
     if (!isset($currencies[$code])) {
         return false;
     }
     $this->code = $code;
     if (count($currencies[$code]) > 1) {
         $json_format = Shopp::array_search_deep($country, $currencies[$code]);
     } else {
         $json_format = key($currencies[$code]);
     }
     $format = json_decode($json_format);
     list($this->position, $this->symbol, $this->precision, $this->decimals, $this->thousands, $this->grouping) = (array) $format;
 }
コード例 #3
0
ファイル: Locale.php プロジェクト: jonathandavis/shopp
 public function lookup($code = false)
 {
     $countries = ShoppLookup::countries();
     if (!isset($countries[$code])) {
         return false;
     }
     $this->code = $code;
     $this->name = $countries[$code];
     // Currency
     $currencies = (include $this->data('currencies.php'));
     $currency = Shopp::array_search_deep($code, $currencies);
     $this->Currency = new ShoppLocaleCurrency($currency);
     // Region
     $regions = (include $this->data('regions.php'));
     $this->region = Shopp::array_search_deep($code, $regions);
     // Addressing
     $addrs = (include $this->data('addressing.php'));
     if (isset($addrs[$code])) {
         $this->addressing = $addrs[$code];
     } else {
         $this->addressing = SHOPP_DEFAULT_ADDRESSING;
     }
     // Units
     $imperial = array_flip(ShoppLookup::imperial_units());
     if (isset($imperial[$code])) {
         $this->units = 'imperial';
     }
 }