Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
isCli())
{
$order = array('cli', 'backend');
}
elseif (FOFPlatform::getInstance()->isBackend())
{
$order = array('backend');
}
else
{
$order = array('frontend');
}
$order[] = 'common';
$order = array_reverse($order);
self::$configurations[$component] = array();
foreach ($order as $area)
{
$config = $this->parseComponentArea($component, $area);
self::$configurations[$component] = array_merge_recursive(self::$configurations[$component], $config);
}
}
/**
* Returns the value of a variable. Variables use a dot notation, e.g.
* view.config.whatever where the first part is the domain, the rest of the
* parts specify the path to the variable.
*
* @param string $variable The variable name
* @param mixed $default The default value, or null if not specified
*
* @return mixed The value of the variable
*/
public function get($variable, $default = null)
{
static $domains = null;
if (is_null($domains))
{
$domains = $this->getDomains();
}
list($component, $domain, $var) = explode('.', $variable, 3);
if (!isset(self::$configurations[$component]))
{
$this->parseComponent($component);
}
if (!in_array($domain, $domains))
{
return $default;
}
$class = 'FOFConfigDomain' . ucfirst($domain);
$o = new $class;
return $o->get(self::$configurations[$component], $var, $default);
}
/**
* Parses the configuration options of a specific component area
*
* @param string $component Which component's cionfiguration to parse
* @param string $area Which area to parse (frontend, backend, cli)
*
* @return array A hash array with the configuration data
*/
protected function parseComponentArea($component, $area)
{
// Initialise the return array
$ret = array();
// Get the folders of the component
$componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($component);
$filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
// Check that the path exists
$path = $componentPaths['admin'];
$path = $filesystem->pathCheck($path);
if (!$filesystem->folderExists($path))
{
return $ret;
}
// Read the filename if it exists
$filename = $path . '/fof.xml';
if (!$filesystem->fileExists($filename))
{
return $ret;
}
$data = file_get_contents($filename);
// Load the XML data in a SimpleXMLElement object
$xml = simplexml_load_string($data);
if (!($xml instanceof SimpleXMLElement))
{
return $ret;
}
// Get this area's data
$areaData = $xml->xpath('//' . $area);
if (empty($areaData))
{
return $ret;
}
$xml = array_shift($areaData);
// Parse individual configuration domains
$domains = $this->getDomains();
foreach ($domains as $dom)
{
$class = 'FOFConfigDomain' . ucfirst($dom);
if (class_exists($class, true))
{
$o = new $class;
$o->parseDomain($xml, $ret);
}
}
// Finally, return the result
return $ret;
}
/**
* Gets a list of the available configuration domain adapters
*
* @return array A list of the available domains
*/
protected function getDomains()
{
static $domains = array();
if (empty($domains))
{
$filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
$files = $filesystem->folderFiles(__DIR__ . '/domain', '.php');
if (!empty($files))
{
foreach ($files as $file)
{
$domain = basename($file, '.php');
if ($domain == 'interface')
{
continue;
}
$domain = preg_replace('/[^A-Za-z0-9]/', '', $domain);
$domains[] = $domain;
}
$domains = array_unique($domains);
}
}
return $domains;
}
}