Appends language urls to $aHosts.

@param array $aLanguageUrls array of language urls to extract
@param array $aHosts        hosts array
495546
protected function _addLanguageHost($aLanguageUrls, &$aHosts)
    {
        $iLanguageId = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();

        if (isset($aLanguageUrls[$iLanguageId])) {
            $this->_addHost($aLanguageUrls[$iLanguageId], $aHosts);
        }
    }
94787
public function getN2nLocaleSwitch(array $ulAttrs = null, array $liAttrs = null, array $aAttrs = null) {
		$urls = $this->meta->getN2nLocaleSwitchUrls();
		if (empty($urls)) {
			return null;
		}
		
		$n2nLocales = array();
		$langUsages = array();
		foreach (array_keys($urls) as $n2nLocaleId) {
			$n2nLocale = new N2nLocale($n2nLocaleId);
			$n2nLocales[$n2nLocaleId] = $n2nLocale;
			$langId = $n2nLocale->getLanguageId();
			if (!isset($langUsages[$langId])) $langUsages[$langId] = 1;
			else $langUsages[$langId]++;
		}
		
		$ul = new HtmlElement('ul', $ulAttrs);
		
		$html = $this->view->getHtmlBuilder();
		foreach ($urls as $n2nLocaleId => $navUrl) {
			$label = null;
			if ($langUsages[$n2nLocales[$n2nLocaleId]->getLanguageId()] > 1) {
				$label = $n2nLocales[$n2nLocaleId]->toPrettyId();
			} else {
				$label = mb_strtoupper($n2nLocales[$n2nLocaleId]->getLanguageId());
			}
			
			$elemLiAttrs = $liAttrs;
			if ($this->view->getN2nLocale()->equals($n2nLocales[$n2nLocaleId])) {
				$elemLiAttrs = HtmlUtils::mergeAttrs((array) $elemLiAttrs, array('class' => 'active'));
			}
			
			$ul->appendLn(new HtmlElement('li', $elemLiAttrs, $html->getLink($navUrl, $label, $aAttrs)));
		}
		
		return $ul;
	}
199450
protected function HLSetLangs($hlId, array $langs)
    {
        $hlId = (int) $hlId;
        if (!$hlId) {
            throw new Exception('Empty Hl id for langs');
        }

        $res = HighloadBlockLangTable::getList([
            'filter' => ['ID' => $hlId],
        ]);
        while ($loc = $res->fetch()) {
            HighloadBlockLangTable::delete($loc['ID']);
        }

        foreach ($langs as $langId => $langValue) {
            $langRes = HighloadBlockLangTable::add([
                'ID' => $hlId,
                'LID' => $langId,
                'NAME' => $langValue,
            ]);
            if (!$langRes->isSuccess()) {
                throw new Exception("Can't create lang {$langId} for {$hlId} highload block: " . implode(', ', $langRes->getErrorMessages()));
            }
        }
    }
827301
protected function _getHosts()
    {
        if ($this->_aHosts === null) {
            $this->_aHosts = [];
            $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

            $this->_addMallHosts($this->_aHosts);

            // language url
            $this->_addLanguageHost($oConfig->getConfigParam('aLanguageURLs'), $this->_aHosts);
            $this->_addLanguageHost($oConfig->getConfigParam('aLanguageSSLURLs'), $this->_aHosts);

            // current url
            $this->_addHost($oConfig->getConfigParam("sShopURL"), $this->_aHosts);
            $this->_addHost($oConfig->getConfigParam("sSSLShopURL"), $this->_aHosts);

            if ($this->isAdmin()) {
                $this->_addHost($oConfig->getConfigParam("sAdminSSLURL"), $this->_aHosts);
            }
        }

        return $this->_aHosts;
    }
86559
public void addHostAlias(String virtualHost, String alias)
    {
        log.warn("addHostAlias is deprecated. Use HttpContext.addVirtualHost");
        Object contextMap=_virtualHostMap.get(virtualHost);
        if (contextMap==null)
            throw new IllegalArgumentException("No Such Host: "+virtualHost);
        _virtualHostMap.put(alias,contextMap);
    }
1317098
private function getTrackerHosts($urls)
    {
        $hosts = array();
        foreach ($urls as $url) {
            $url = parse_url($url);
            if (isset($url['host'])) {
                $hosts[] = $url['host'];
            }
        }
        return $hosts;
    }
1373034
private function syncKeysBetweenLanguages($translationFiles)
    {
        $this->info('Synchronizing language files...');

        $filesResults = [];

        // Here we collect the file results
        foreach ($translationFiles as $fileName => $languageFiles) {
            foreach ($languageFiles as $languageKey => $filePath) {
                $filesResults[$fileName][$languageKey] = $this->manager->getFileContent($filePath);
            }
        }

        $values = Arr::dot($filesResults);

        $missing = $this->manager->getKeysExistingInALanguageButNotTheOther($values);

        foreach ($missing as &$missingKey) {
            list($file, $key) = explode('.', $missingKey, 2);

            list($key, $language) = explode(':', $key, 2);

            $this->fillMissingKeys($file, [$key], $language);
        }
    }
1107804
public function language($langs)
    {
        //force array
        settype($langs, 'array');

        $scripts = '';
        $language = $this->getService('anahita:language');
        $tag = $language->getTag();
        $base = $language->getLanguagePath(ANPATH_ROOT, $tag);

        foreach ($langs as $lang) {
            $path = $base.'/'.$tag.'.'.$lang.'.js';
            if (is_readable($path)) {
                $src = AnService::get('com:application')->getRouter()->getBaseUrl().'/language/'.$tag.'/'.$tag.'.'.$lang.'.js';
                $scripts .= '<script type="text/javascript" src="'.$src.'"></script>'."\n";
            }
        }

        return  $scripts;
    }
447022
public static function setHost($host) {
        $host = rtrim($host, '/');
        if(!filter_var($host, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException("'$host' is not a valid URL");
        }
        self::$host = $host;
    }
1131323
public static function setTrustedHosts(array $hostPatterns) {

		self::$trustedHostPatterns = array_map(function ($hostPattern) {
			return sprintf('#%s#i', $hostPattern);
		}, $hostPatterns);

		self::$trustedHosts = [];

	}
91728
private static function extractHeaders($headers, Translations $translations)
    {
        $headers = explode("\n", $headers);
        $currentHeader = null;

        foreach ($headers as $line) {
            $line = self::convertString($line);

            if ($line === '') {
                continue;
            }

            if (self::isHeaderDefinition($line)) {
                $header = \array_map('\trim', \explode(':', $line, 2));
                $currentHeader = $header[0];
                $translations->setHeader($currentHeader, $header[1]);
            } else {
                $entry = $translations->getHeader($currentHeader);
                $translations->setHeader($currentHeader, $entry.$line);
            }
        }
    }
273382
public function addTranslation($locale, $url)
    {
        $this->validateUrl($url);

        $this->translations[] = [
            'hreflang' => $locale,
            'href'     => $url
        ];

        return $this;
    }
517945
private function makeDataFallbackToEnglish($textFile, &$mappings)
    {
        $englishPath = $this->getEnglishDataPath($textFile);

        if ($textFile == $englishPath || !file_exists($this->getFilePath($englishPath))) {
            return;
        }

        $countryCode = substr($textFile, 3, 2);

        if (!array_key_exists($countryCode, $this->englishMaps)) {
            $englishMap = $this->readMappingsFromFile($englishPath);

            $this->englishMaps[$countryCode] = $englishMap;
        }

        $this->compressAccordingToEnglishData($this->englishMaps[$countryCode], $mappings);
    }
193358
public function setCurrentSite($siteId, $siteName, $siteDefaultLanguage, array $languages)
    {
        parent::setSite($siteId, $siteName, $siteDefaultLanguage, $languages);
    }
524341
public function addURLs($urls)
  {
    PHPCrawlerBenchmark::start("adding_urls_to_sqlitecache");

    $this->PDO->exec("BEGIN EXCLUSIVE TRANSACTION;");

    $cnt = count($urls);
    for ($x=0; $x<$cnt; $x++)
    {
      if ($urls[$x] != null)
      {
        $this->addURL($urls[$x]);
      }

      // Commit after 1000 URLs (reduces memory-usage)
      if ($x%1000 == 0 && $x > 0)
      {
        $this->PDO->exec("COMMIT;");
        $this->PDO->exec("BEGIN EXCLUSIVE TRANSACTION;");
      }
    }

    $this->PDO->exec("COMMIT;");
    $this->PreparedInsertStatement->closeCursor();

    if ($this->db_analyzed == false)
    {
      $this->PDO->exec("ANALYZE;");
      $this->db_analyzed = true;
    }

    PHPCrawlerBenchmark::stop("adding_urls_to_sqlitecache");
  }
855476
public function storeI18nStrings(array $args = array()) {
        // @todo Adapt for multiple languages
        $nl = $this->_loadI18nStrings('nl');
        $en = $this->_loadI18nStrings('en');

        // Wether the snippets are editable in the CMS
        $editable = !array_key_exists('editable', $args) || !!$args['editable'];
        $this->_overwrite = isset($args['overwrite']) && $args['overwrite'];

        foreach ($nl as $key => $value) {
            $snippet = array(
                'has_text' => 1,
                'identifier' => $key,
                'is_editable' => $editable,
                'text' => array(
                    'nl' => $value
                )
            );
            if (array_key_exists($key, $en)) {
                $snippet['text']['en'] = $en[$key];
            }
            $existing = $this->_fetchExisting($key);
            if (!$this->_overwrite && $existing) {
                Garp_Cli::lineOut('Skipping ' . $key . '. Snippet already exists.');
                continue;
            }
            $this->_insertOrUpdate($snippet, $existing);
        }

        return true;
    }
627022
private function appendCustomUrls(Webspace $webspace, Context $context, JsonSerializationVisitor $visitor)
    {
        $customUrls = [];
        foreach ($webspace->getPortals() as $portal) {
            $customUrls = array_merge(
                $customUrls,
                $this->getCustomUrlsForEnvironment($portal, $portal->getEnvironment($this->environment), $context)
            );
        }

        $customUrls = $context->accept($customUrls);
        $visitor->addData('customUrls', $customUrls);
    }