import config file.

@access  public
@param   string  $file
499078
public function import($file)
    {
        $data = $this->yaml->load($file);
        parent::import($data);
    }
555913
protected function parseSshConfigFile($file)
    {
        if (!file_exists($file) || !is_readable($file)) {
            throw new RuntimeException("The file '$file' does not exist or is not readable");
        }
        $contents = file_get_contents($file);
        $configs = array();
        $lineNumber = 1;
        foreach (explode(PHP_EOL, $contents) as $line) {
            $line = trim($line);
            if ($line == '' || $line[0] == '#') {
                continue;
            }
            $pos = strpos($line, '=');
            if ($pos !== false) {
                $key = strtolower(trim(substr($line, 0, $pos)));
                $value = trim(substr($line, $pos + 1, strlen($line)));
            } else {
                $i = 0;
                while ($i < strlen($line)) {
                    if ($line[$i] == ' ') {
                        break;
                    }
                    $i++;
                }
                if ($i == strlen($line)) {
                    throw new RuntimeException("The file '$file' is not parsable at line '$lineNumber'");
                }
                $key = strtolower(trim(substr($line, 0, $i)));
                $value = trim(substr($line, $i + 1, strlen($line)));
            }
            if ($key == 'host') {
                $this->configs = array_merge($this->configs, $configs);
                $configs = array();
                $hosts = explode(' ', $value);
                foreach ($hosts as $host) {
                    $configs[] = array('host' => $host);
                }

            } else {
                foreach ($configs as $host => $config) {
                    $configs[$host][$key] = $value;
                }
            }
            $lineNumber++;
        }
        $this->configs = array_merge($this->configs, $configs);
    }
948036
public function load($file)
    {
        $loader = new PhpConfig();
        $templates = $loader->read($file);
        $this->add($templates);
    }
120936
public function readConfig($file = 'config.php')
    {
        $orig_file = $file;

        if (strpos($file, '.php') != strlen($file) - 4) {
            $file .= '.php';
        }

        if (strpos($file, '/') === false) {
            $file = getcwd().'/'.$this->config_location.'/'.$file;
        }

        if (file_exists($file)) {
            // some tricky thing to make config be read in some cases it could not in simple way
            unset($config);

            $config = &$this->config;
            $this->config_files_loaded[] = $file;
            include $file;

            unset($config);

            return true;
        }

        return false;
    }
1246808
public static function loadFromFile($file)
    {
        if (file_exists($file) === false) {
            throw new FileNotFoundException($file);
        }

        if (preg_match('/(\.toml)$/', $file) !== 1) {
            throw new NotSupportFileTypeException($file);
        }

        $values = Toml::parse($file);
        $values = (is_array($values) === true) ? $values : [];

        $config = new Config($values);
        $config->merge(new Config([
            self::CONFIG_FILE_KEY => $file,
            self::CONFIG_DIRECTORY_KEY => dirname(realpath($file)) . DIRECTORY_SEPARATOR
        ]));

        return new BuilderConfiguration($config);
    }
670441
private function importFile($file) {
        $template = new Template($this->include_path . $file);
        return $template->process($this->rules, $this->data);
    }
12917
public function load($file)
    {
        $file_name = $this->_config_path.$file.'.php';

        // load the file, but only once
        if (is_file($file_name) and ! array_key_exists($file, $this->_loaded)) {
            // the config file values are secondary to the config values that have already been set
            $this->_config = array_merge(require $file_name, $this->_config);

            $this->_loaded[$file] = true;

            return true;
        } elseif (! is_file($file_name)) {
            throw new \QuickCacheException('The config file "'.$file.'" does not exist');
        }
    }
1014428
protected function readConfigurationFile($file)
    {
        if (! file_exists($file)) {
            throw InvalidSetupException::confNotFound($file);
        }
        if (! $json = file_get_contents($file)) {
            throw InvalidSetupException::confNotReadable($file);
        }
        if (! $config = json_decode($json)) {
            throw InvalidSetupException::confNotJson($file);
        }
        sodium_memzero($json);
        return $config;
    }
1210281
public function load($file, $type = null)
    {
        $path = $this->locator->locate($file);

        $content = $this->loadFile($path);

        $this->configCollection->addResource(new FileResource($path));

        // empty file
        if (null === $content) {
            return;
        }

        // imports
        $this->parseImports($content, $path);

        // parameters
        if (isset($content['parameters'])) {
            foreach ($content['parameters'] as $key => $value) {
                $this->configCollection->setParameter($key, $value);
            }
        }

        // extensions
        $this->loadFromExtensions($content);
    }
1260920
public function inc($file)
    {
        $b = $this;
        if (file_exists($this->getBlockPath() . '/' . $file)) {
            include $this->getBlockPath() . '/' . $file;
        }
    }
656409
function config($file) {
		preg_match_all(
			'/(?<=^|\n)(?:'.
				'\[(?<section>.+?)\]|'.
				'(?<lval>[^\h\r\n;].*?)\h*=\h*'.
				'(?<rval>(?:\\\\\h*\r?\n|.+?)*)'.
			')(?=\r?\n|$)/',
			$this->read($file),
			$matches,PREG_SET_ORDER);
		if ($matches) {
			$sec='globals';
			foreach ($matches as $match) {
				if ($match['section']) {
					$sec=$match['section'];
					if (preg_match('/^(?!(?:global|config|route|map|redirect)s\b)'.
						'((?:\.?\w)+)/i',$sec,$msec) && !$this->exists($msec[0]))
						$this->set($msec[0],NULL);
				}
				else {
					if (preg_match('/^(config|route|map|redirect)s\b/i',
						$sec,$cmd)) {
						call_user_func_array(
							array($this,$cmd[1]),
							array_merge(array($match['lval']),
								str_getcsv($match['rval'])));
					}
					else {
						$args=array_map(
							function($val) {
								if (is_numeric($val))
									return $val+0;
								$val=ltrim($val);
								if (preg_match('/^\w+$/i',$val) &&
									defined($val))
									return constant($val);
								return trim(preg_replace(
									array('/\\\\"/','/\\\\\h*(\r?\n)/'),
									array('"','\1'),$val));
							},
							// Mark quoted strings with 0x00 whitespace
							str_getcsv(preg_replace('/(?<!\\\\)(")(.*?)\1/',
								"\\1\x00\\2\\1",$match['rval']))
						);
						preg_match('/^(?<section>[^:]+)(?:\:(?<func>.+))?/',
							$sec,$parts);
						$func=isset($parts['func'])?$parts['func']:NULL;
						$custom=(strtolower($parts['section'])!='globals');
						if ($func)
							$args=array($this->call($func,
								count($args)>1?array($args):$args));
						call_user_func_array(
							array($this,'set'),
							array_merge(
								array(
									($custom?($parts['section'].'.'):'').
									$match['lval']
								),
								count($args)>1?array($args):$args
							)
						);
					}
				}
			}
		}
		return $this;
	}
687618
public function loadConfigurationFile($file)
    {
        if (!file_exists($file)) {
            throw new \InvalidArgumentException(sprintf('Configuration file "%s" not found', $file));
        }
        $this->loadedConfig = Yaml::parse(file_get_contents($file));

        return $this;
    }
1089510
public static function setFile($file)
    {
        if (is_file($file)) {
            $options = Yaml::parse(file_get_contents($file));
            self::$instance = new self($options);
            self::$instance->validateOptions();
        } else {
            throw new Exception("Can't find config file at ".$file);
        }
    }
1165260
public function load_config_file($file)
    {
        if (!is_readable($file)) {
            return;
        }

        include $file;

        // read comments from config file
        if (function_exists('token_get_all')) {
            $tokens    = token_get_all(file_get_contents($file));
            $in_config = false;
            $buffer    = '';

            for ($i = 0; $i < count($tokens); $i++) {
                $token = $tokens[$i];
                if ($token[0] == T_VARIABLE && ($token[1] == '$config' || $token[1] == '$rcmail_config')) {
                    $in_config = true;
                    if ($buffer && $tokens[$i+1] == '[' && $tokens[$i+2][0] == T_CONSTANT_ENCAPSED_STRING) {
                        $propname = trim($tokens[$i+2][1], "'\"");
                        $this->comments[$propname] = $buffer;
                        $buffer = '';
                        $i += 3;
                    }
                }
                else if ($in_config && $token[0] == T_COMMENT) {
                    $buffer .= strtr($token[1], array('\n' => "\n"));
                }
            }
        }

        // deprecated name of config variable
        if (is_array($rcmail_config)) {
            return $rcmail_config;
        }

        return $config;
    }
775084
public static function parse($file)
    {
        $config_path = self::$config_path == '' ? APP_PATH . '/config/' : self::$config_path;
        if($file == null){
            $file = scandir($config_path);
            foreach ($file as $k => $v)
            {
                unset($file[0], $file[1]);
                if($v == 'routes.php' )
                {
                    unset($file[$k]);
                }
            }
            foreach ($file as $k => $v)
            {
                $name = str_replace('.php', '', $v);
                $file = $config_path . $v;
                $data[$name] = include $file;
            }
        }else{
            $type = $file;
            if(strpos($type, '.')){
                $type = explode('.', $type);
                $file = $config_path . $type[0] . '.php';
                if(!array_key_exists($type[1], self::load($file)))
                {
                    throw new Exception('This configuration [' . self::$config . '] is not supported!');
                }
                $data = self::load($file)[$type[1]];
            }else{
                $file = $config_path . $file . '.php';
                $data = self::load($file);
            }

        }
        return $data;
    }
1251984
protected function loadConfigFile($file)
    {
        $path = $this->getConfigPath() . '/' . $file;

        if (file_exists($path)) {
            $config = include $path;
            return is_array($config) ? $config : null;
        }

        return null;
    }
948570
public function import($file)
    {
        if (!file_exists($file)) {
            throw new \InvalidArgumentException("Footprint file '$file' does not exist");
        }
        $content = file_get_contents($file);
        $this->importJson($content);
    }