Register a custom domain.

@param string $domain Name of domain
@param string $dir Path to messages directory
@param array $info [optional] Domain info
@return array
486306
public function registerDomain( $domain, $dir, $info = [] ) {
		$info['dir'] = $dir;
		$this->domainInfos[ $this->normalizeDomain( $domain ) ] = $info;
	}
73174
public static function domainToUnicode($domain)
    {
        return mb_strlen($domain, 'UTF-8') <= self::PHP_IDN_HANDLEABLE_LENGTH
            ? idn_to_utf8($domain, 0, INTL_IDNA_VARIANT_UTS46)
            : false;
    }
111314
public function getTranslationsFromFiles($domain, $path, array $directories = [])
    {
        if (!$directories) {
            $directories = [
                $path . 'Resources' . DIRECTORY_SEPARATOR . 'translations',
                $this->kernelRoot . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . $domain . DIRECTORY_SEPARATOR . 'translations',
            ];
        }

        $finder = new Finder();
        $translations = [];

        foreach ($directories as $directory) {
            if (is_dir($directory)) {
                $finder->files()
                    ->name($this->getFileNamePattern())
                    ->in($directory);

                foreach ($finder as $file) {
                    $translations = array_replace_recursive($this->getFileTranslationMessages($file, $domain), $translations);
                }
            }
        }

        return $translations;
    }
333439
public function getAvailableLangs( $domain = null ) {
		$domainInfo = $this->getDomainInfo( $domain ?? $this->getDomain() );
		if ( !$domainInfo ) {
			$languages = [];
		} else {
			if ( isset( $domainInfo['langs'] ) ) {
				$languages = $domainInfo['langs'];
			} else {
				$files = @scandir( $domainInfo['dir'], SCANDIR_SORT_NONE ) ?: [];

				$languages = [];
				foreach ( $files as $filename ) {
					$langCode = basename( $filename, '.json' );
					$langName = $this->getLangName( $langCode );
					if ( $langName !== '' ) {
						$languages[$langCode] = $langName;
					}
				}
				$this->addDomainInfo( $domain, [ 'langs' => $languages ] );
			}
		}

		$languages = array_merge( $languages, $this->availableLanguages );
		ksort( $languages );
		return $languages;
	}
374009
public function importTranslationFiles($domain, $dir)
    {
        $translations = $this->getTranslationsFromFiles($domain, $dir);
        $this->writeToStorage($domain, $translations);
    }
431652
def registerDirs(self,json_dirs):
        
        url = self._url + "/directories/registerDirs"
        params = {
            "f" : "json",
            "directories" : json_dirs
        }

        res = self._post(url=url,
                         param_dict=params,
                         securityHandler=self._securityHandler,
                         proxy_url=self._proxy_url,
                         proxy_port=self._proxy_port)

        return res
1358645
public function addDomain(Domain $domain)
    {
        $domain->setSite($this);

        $this->domains[] = $domain;

        return $this;
    }
1322664
function get_domain_id($domain)
    {
        $xml = $this->domain_info($domain);
        $id  = intval($xml->site->get->result->id);
        $id  = (is_int($id)) ? $id : false;

        return $id;
    }
369241
public function retrieve($domain)
	{
		$key = $this->key($domain);

		$messages = isset($this->messages[$key]) ? $this->messages[$key] : array();

		if (count($messages))
		{
			$this->clear($domain);
		}

		return $messages;
	}
626961
public function setDomain($domain)
    {
        if (is_string($domain)) {
            $this->domain = $domain;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($domain) . "' for argument 'domain' given. String expected."
            );
        }
    }
45423
private function registerModule($module, $dir)
    {
        $parentModuleFile = $this->jsDir.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$this->getParentModuleFile($dir).".js";

        if (!file_exists($parentModuleFile)) {
            return;
        }
        
        $fileContent = file_get_contents($parentModuleFile);

        $fileContent = str_replace('/*@modules*/', ",'".$module."'\n            /*@modules*/", $fileContent);

        file_put_contents($parentModuleFile, $fileContent);
    }
325996
public function domainAdd($domain = '') {
        $arr = array("domain" => $domain);
        //设置参数体
        $this->setData(json_encode($arr));
        //设置请求的方法
        $this->setMethod('POST');
        //初始化参数
        $this->initParam();
        //获取返回值
        return $this->response();
    }
854210
public function setDomain(Domain $domain)
    {
        $this->domain = $domain;
        $this->domainId = $domain->getDomainId();
    }
748099
public function setDefaultPathAndDomain($path, $domain, $secure = false, $sameSite = null)
    {
        [$this->path, $this->domain, $this->secure, $this->sameSite] = [$path, $domain, $secure, $sameSite];

        return $this;
    }
509813
public function siteIconUrl($domain) {
		if (strpos($domain, 'http') === 0) {
			// Strip protocol
			$pieces = parse_url($domain);
			$domain = $pieces['host'];
		}
		return 'http://www.google.com/s2/favicons?domain=' . $domain;
	}
731397
def info(self, message, domain=None):
        
        if domain is None:
            domain = self.extension_name
        info(message, domain)
718160
protected function ensureLoaded( $domain, $lang ) {
		if ( isset( $this->loadedDomains[ $domain ][ $lang ] ) ) {
			// Already tried
			return $this->loadedDomains[ $domain ][ $lang ];
		}

		// Validate input and protect against path traversal
		if ( !IntuitionUtil::nonEmptyStrs( $domain, $lang ) ||
			strcspn( $domain, ":/\\\000" ) !== strlen( $domain ) ||
			strcspn( $lang, ":/\\\000" ) !== strlen( $lang )
		) {
			$this->errTrigger( 'Illegal domain or lang', __METHOD__, E_NOTICE );
			return false;
		}

		$this->loadedDomains[ $domain ][ $lang ] = false;

		if ( !isset( self::$messageCache[ $domain ][ $lang ] ) ) {
			// Load from disk
			$domainInfo = $this->getDomainInfo( $domain );
			if ( !$domainInfo ) {
				// Unknown domain. Perhaps dev-mode only with
				// messages provided via setMsgs()?
				return false;
			}
			$file = $domainInfo['dir'] . "/$lang.json";
			$this->loadMessageFile( $domain, $lang, $file );
		} else {
			// Load from static cache, e.g. from a previous instance of this class
			$this->setMsgs( self::$messageCache[ $domain ][ $lang ], $domain, $lang );
		}

		$this->loadedDomains[ $domain ][ $lang ] = true;
		return true;
	}