Load available countries and compose [$code=>$name] array.
550463
private function loadCountries()
    {
        $items = [];
        $country = $this->factCountry->create();
        $found = $this->modAllowedCountries->getAllowedCountries();
        foreach ($found as $code) {
            $country->loadByCode($code);
            $name = $country->getName();
            $items[$code] = $name;
        }
        $this->cacheCountries = $items;
    }
502280
def lookups(self, request, model_admin):
        
        list_of_countries = []

        # We don't need the country_count but we need to annotate them in order
        # to group the results.
        qs = Venue.objects.exclude(country='') \
                            .values('country') \
                            .annotate(country_count=Count('country')) \
                            .order_by('country')
        for obj in qs:
            country = obj['country']
            list_of_countries.append(
                (country, Venue.COUNTRIES[country])
            )

        return sorted(list_of_countries, key=lambda c: c[1])
935374
public function loadLanguage($code) {
        static $languages_seen = array(); // recursion guard

        // abort if we've already loaded it
        if (isset($this->cache[$code])) return;

        // generate filename
        $filename = $this->dir . '/Language/messages/' . $code . '.php';

        // default fallback : may be overwritten by the ensuing include
        $fallback = ($code != 'en') ? 'en' : false;

        // load primary localisation
        if (!file_exists($filename)) {
            // skip the include: will rely solely on fallback
            $filename = $this->dir . '/Language/messages/en.php';
            $cache = array();
        } else {
            include $filename;
            $cache = compact($this->keys);
        }

        // load fallback localisation
        if (!empty($fallback)) {

            // infinite recursion guard
            if (isset($languages_seen[$code])) {
                trigger_error('Circular fallback reference in language ' .
                    $code, E_USER_ERROR);
                $fallback = 'en';
            }
            $language_seen[$code] = true;

            // load the fallback recursively
            $this->loadLanguage($fallback);
            $fallback_cache = $this->cache[$fallback];

            // merge fallback with current language
            foreach ( $this->keys as $key ) {
                if (isset($cache[$key]) && isset($fallback_cache[$key])) {
                    if (isset($this->mergeable_keys_map[$key])) {
                        $cache[$key] = $cache[$key] + $fallback_cache[$key];
                    } elseif (isset($this->mergeable_keys_list[$key])) {
                        $cache[$key] = array_merge( $fallback_cache[$key], $cache[$key] );
                    }
                } else {
                    $cache[$key] = $fallback_cache[$key];
                }
            }

        }

        // save to cache for later retrieval
        $this->cache[$code] = $cache;

        return;
    }
1113108
public function setCountryCodeAttribute($code)
    {
        if (!$country = Country::whereCode($code)->first()) {
            return;
        }

        $this->model->country = $country;
    }
555515
public function populate()
    {
        $currenciesCodes = [];
        $currencies = $this
            ->currencyRepository
            ->findAll();

        /**
         * Create an array of all active currency codes.
         *
         * @var CurrencyInterface $currency
         */
        foreach ($currencies as $currency) {
            if ($currency->getIso() != $this->defaultCurrency) {
                $currenciesCodes[] = $currency->getIso();
            }
        }

        /**
         * Get rates for all of the enabled and active currencies.
         */
        $rates = $this
            ->currencyExchangeRatesAdapter
            ->getExchangeRates(
                $this->defaultCurrency,
                $currenciesCodes
            );

        /**
         * @var CurrencyInterface $sourceCurrency
         */
        $sourceCurrency = $this
            ->currencyRepository
            ->findOneBy([
                'iso' => $this->defaultCurrency,
            ]);

        /**
         * [
         *      "EUR" => "1,378278",
         *      "YEN" => "0,784937",
         * ].
         */
        foreach ($rates as $code => $rate) {

            /**
             * @var CurrencyInterface $targetCurrency
             */
            $targetCurrency = $this
                ->currencyRepository
                ->findOneBy([
                    'iso' => $code,
                ]);

            if (!($targetCurrency instanceof CurrencyInterface)) {
                continue;
            }

            /**
             * check if this is a new exchange rate, or if we have to
             * create a new one.
             */
            $exchangeRate = $this
                ->currencyExchangeRateObjectDirector
                ->findOneBy([
                    'sourceCurrency' => $sourceCurrency,
                    'targetCurrency' => $targetCurrency,
                ]);

            if (!($exchangeRate instanceof CurrencyExchangeRateInterface)) {
                $exchangeRate = $this
                    ->currencyExchangeRateObjectDirector
                    ->create();
            }

            $exchangeRate
                ->setExchangeRate($rate)
                ->setSourceCurrency($sourceCurrency)
                ->setTargetCurrency($targetCurrency);

            $this
                ->currencyExchangeRateObjectDirector
                ->save($exchangeRate);
        }

        return $this;
    }
529758
protected function createCountries()
    {
        $rows = $placeholders = array();

        foreach ((array) $this->getCountryModel()->getIso() as $code => $country) {
            $placeholders[] = '(?,?,?,?,?)';
            $native_name = empty($country['native_name']) ? $country['name'] : $country['native_name'];
            $rows = array_merge($rows, array(0, $country['name'], $code, $native_name, serialize(array())));
        }

        $values = implode(',', $placeholders);
        $sql = "INSERT INTO country (status, name, code, native_name, format) VALUES $values";
        $this->db->run($sql, $rows);
    }
736346
protected function setCountry($code)
    {
        $this->data_country = $this->country->get($code);

        if (empty($this->data_country)) {
            $this->outputHttpStatus(404);
        }
    }
1336171
public static function countryContinentCode($countryCode)
    {
        foreach (static::CODES as $code => $countryCodes) {
            if (in_array($countryCode, $countryCodes)) {
                return $code;
            }
        }

        return null;
    }
500560
protected function setCountryCity($country_code)
    {
        $this->data_country = $this->country->get($country_code);

        if (empty($this->data_country)) {
            $this->outputHttpStatus(404);
        }
    }
758600
function load( available, toLoad ) {
    let loadList = available;
    if ('string' === typeof toLoad ) {
      loadList = [toLoad];
    }
    if (Array.isArray(toLoad)) {
      loadList = toLoad;
    }
    loadList.forEach(function( name ) {
      if ( available.indexOf(name) < 0 ) {
        return;
      }
      require('./'+name);
    });
  }
832303
static public function load($code)
    {
        if (self::$_directory===null) {
            self::$_directory = dirname(dirname(__FILE__)).'/locale/';
        }

        // must be in lower case
        $code = strtolower($code);

        // must be [a-z-0-9]
        if (!preg_match('/^([a-z0-9]+)$/isU', $code)) {
            throw new HTML2PDF_exception(0, 'invalid language code ['.self::$_code.']');
        }

        // save the code
        self::$_code = $code;

        // get the name of the locale file
        $file = self::$_directory.self::$_code.'.csv';

        // the file must exist
        if (!is_file($file)) {
            throw new HTML2PDF_exception(0, 'language code ['.self::$_code.'] unknown. You can create the translation file ['.$file.'] and send it to the webmaster of html2pdf in order to integrate it into a future release');
        }

        // load the file
        self::$_list = array();
        $handle = fopen($file, 'r');
        while (!feof($handle)) {
            $line = fgetcsv($handle);
            if (count($line)!=2) continue;
            self::$_list[trim($line[0])] = trim($line[1]);
        }
        fclose($handle);
    }
69550
public function loadCountries()
    {
        $this->countriesJson = $this->loadCountriesJson();

        $overload = $this->helper->loadJsonFiles($this->helper->dataDir('countries/overload'))->mapWithKeys(function ($country, $code) {
            return [upper($code) => $country];
        });

        $this->countriesJson = $this->countriesJson->overwrite($overload);

        return $this->countriesJson;
    }
337282
private function loadValues()
    {
        if (function_exists('CheckAuthentication')) {
            $this->_isEnabled = CheckAuthentication();
        }
        if (isset($GLOBALS['config']['LicenseName'])) {
            $this->_licenseName = (string)$GLOBALS['config']['LicenseName'];
        }
        if (isset($GLOBALS['config']['LicenseKey'])) {
            $this->_licenseKey = (string)$GLOBALS['config']['LicenseKey'];
        }
        if (isset($GLOBALS['config']['FilesystemEncoding'])) {
            $this->_filesystemEncoding = (string)$GLOBALS['config']['FilesystemEncoding'];
        }
        if (isset($GLOBALS['config']['RoleSessionVar'])) {
            $this->_roleSessionVar = (string)$GLOBALS['config']['RoleSessionVar'];
        }
        if (isset($GLOBALS['config']['CheckDoubleExtension'])) {
            $this->_checkDoubleExtension = CKFinder_Connector_Utils_Misc::booleanValue($GLOBALS['config']['CheckDoubleExtension']);
        }
        if (isset($GLOBALS['config']['DisallowUnsafeCharacters'])) {
            $this->_disallowUnsafeCharacters = CKFinder_Connector_Utils_Misc::booleanValue($GLOBALS['config']['DisallowUnsafeCharacters']);
        }
        if (isset($GLOBALS['config']['SecureImageUploads'])) {
            $this->_secureImageUploads = CKFinder_Connector_Utils_Misc::booleanValue($GLOBALS['config']['SecureImageUploads']);
        }
        if (isset($GLOBALS['config']['CheckSizeAfterScaling'])) {
            $this->_checkSizeAfterScaling = CKFinder_Connector_Utils_Misc::booleanValue($GLOBALS['config']['CheckSizeAfterScaling']);
        }
        if (isset($GLOBALS['config']['ForceAscii'])) {
            $this->_forceAscii = CKFinder_Connector_Utils_Misc::booleanValue($GLOBALS['config']['ForceAscii']);
        }
        if (isset($GLOBALS['config']['HtmlExtensions'])) {
            $this->_htmlExtensions = (array)$GLOBALS['config']['HtmlExtensions'];
        }
        if (isset($GLOBALS['config']['HideFolders'])) {
            $this->_hideFolders = (array)$GLOBALS['config']['HideFolders'];
        }
        if (isset($GLOBALS['config']['HideFiles'])) {
            $this->_hideFiles = (array)$GLOBALS['config']['HideFiles'];
        }
        if (isset($GLOBALS['config']['ChmodFiles'])) {
            $this->_chmodFiles = $GLOBALS['config']['ChmodFiles'];
        }
        if (isset($GLOBALS['config']['ChmodFolders'])) {
            $this->_chmodFolders = $GLOBALS['config']['ChmodFolders'];
        }
        if (isset($GLOBALS['config']['DefaultResourceTypes'])) {
            $_defaultResourceTypes = (string)$GLOBALS['config']['DefaultResourceTypes'];
            if (strlen($_defaultResourceTypes)) {
                $this->_defaultResourceTypes = explode(",", $_defaultResourceTypes);
            }
        }
        if (isset($GLOBALS['config']['TempDirectory'])) {
          $this->_tempDirectory = $GLOBALS['config']['TempDirectory'];
        }
        if (isset($GLOBALS['config']['XSendfile'])) {
          $this->_xsendfile = CKFinder_Connector_Utils_Misc::booleanValue($GLOBALS['config']['XSendfile']);
        }
        if (isset($GLOBALS['config']['XSendfileNginx'])) {
          $this->_xsendfileNginx = (array)$GLOBALS['config']['XSendfileNginx'];
        }
    }
1172224
function (countries, preferred, preferredDelim) {
        var preferredShortCodes = preferred.split(',').reverse();
        var preferredMap = {};
        var foundPreferred = false;

        var updatedCountries = countries.filter(function (c) {
            if (preferredShortCodes.indexOf(c[1]) !== -1) {
                preferredMap[c[1]] = c;
                foundPreferred = true;
                return false;
            }
            return true;
        });

        if (foundPreferred && preferredDelim) {
            updatedCountries.unshift([preferredDelim, "", "", {}, true]);
        }

        // now prepend the preferred countries
        for (var i=0; i<preferredShortCodes.length; i++) {
            var code = preferredShortCodes[i];
            updatedCountries.unshift(preferredMap[code]);
        }

        return updatedCountries;
    }
386493
def country_code_select(priority_countries, options)
			selected = object.send(@method_name)

			countries = ""
			if priority_countries
				countries += options_for_select(priority_countries, selected)
				countries += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
      elsif options[:include_blank]
        countries += "<option value=\"\">" + options[:include_blank] + "</options>\n"
				countries += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
			end

			countries = countries + options_for_select(COUNTRIES, selected)
      content_tag(:select, countries, options.merge(id: "#{@object_name}_#{@method_name}", :name => "#{@object_name}[#{@method_name}]"), false)
		end
451653
public function loadCurrenciesForCountry($code)
    {
        $currencies = $this->helper->loadJson(
            $this->helper->dataDir('currencies/default/'.strtolower($code).'.json')
        );

        return $currencies;
    }
985488
def load_states_xxx( country_key, xxx, name )
    country = Country.find_by_key!( country_key )
    logger.debug "Country #{country.key} >#{country.name} (#{country.code})<"

    reader = create_hash_reader( name )

    reader.each do |key, value|
      state = State.find_by_country_id_and_key!( country.id, key )
      state.send( "#{xxx}=", value )
      state.save!
    end
  end