public function testParse() { Config::parse('inistring=1', 'ini'); $this->assertEquals(1, Config::get('inistring')); Config::reset(); Config::parse('tests/framework/application/test.ini'); $this->assertTrue(Config::has('inifile')); $this->assertEquals(1, Config::get('inifile')); Config::reset(); }
public function testParse() { Config::parse('<?xml version="1.0"?><document><xmlstring>1</xmlstring></document>', 'xml'); $this->assertEquals(1, Config::get('xmlstring')); Config::reset(); Config::parse('tests/framework/application/test.xml'); $this->assertTrue(Config::has('xmlfile.istrue')); $this->assertEquals(1, Config::get('xmlfile.istrue')); Config::reset(); }
public function testParse() { Config::parse('<?xml version="1.0"?><document><xmlstring>1</xmlstring></document>', 'xml'); $this->assertEquals(1, Config::get('xmlstring')); Config::reset(); Config::parse(__DIR__ . '/fixtures/config.xml'); $this->assertTrue(Config::has('xmlfile.istrue')); $this->assertEquals(1, Config::get('xmlfile.istrue')); Config::reset(); }
public function testParse() { Config::parse('inistring=1', 'ini'); $this->assertEquals(1, Config::get('inistring')); Config::reset(); Config::parse(__DIR__ . '/fixtures/config.ini'); $this->assertTrue(Config::has('inifile')); $this->assertEquals(1, Config::get('inifile')); Config::reset(); }
public function testParse() { Config::parse('{"jsonstring":1}', 'json'); $this->assertEquals(1, Config::get('jsonstring')); Config::reset(); Config::parse(__DIR__ . '/fixtures/config.json'); $this->assertTrue(Config::has('jsonstring')); $this->assertEquals(1, Config::get('jsonstring')); Config::reset(); }
function read_file($file_path) { $confObj = array("vars" => array(), "steps" => array(), "collects" => array()); $config = new Config($file_path); $config->parse(); foreach ($config->varibles as $var) { array_push($confObj["vars"], array($var->name, $var->value)); } $confObj = read_element("step", $config, $confObj); $confObj = read_element("collect", $config, $confObj); return $confObj; }
#!/usr/bin/php <?php include dirname(__DIR__) . '/framework/init.php'; Autoload::init(array(LIBS, EXTERNAL, FRAMEWORK_LIBS, FRAMEWORK_EXTERNAL), CACHE); Config::parse('define.ini', true); Cache::$base_prefix = Config::get('cache', 'prefix'); function clear_dir($dir) { if (!file_exists($dir)) { return; } foreach (glob($dir . '/*') as $file) { unlink($file); } } $file = array_shift($argv); $set = array_shift($argv); if (empty($set)) { die('Set needed' . "\n"); } $set = Database::get_full_row('set', 'id = ?', $set); if (empty($set)) { die('Incorrect set' . "\n"); } if (!$set['grabbed']) { Grabber::get_set($set['id']); } $folder = IMAGES . SL . 'import'; if (!file_exists($folder . SL . $set['id']) || !is_dir($folder . SL . $set['id'])) { die('No import folder' . "\n"); }
#!/usr/bin/php <?php # Include PEAR::Console_Getopt require_once 'Console/Getopt.php'; $command = new Command(); print_r($command->command()); $config = new Config(); $config->load($command->config()); $config->parse(); $config->cql_check_boolean("and"); $config->cql_check_boolean("notexist"); $config->cql_check_apt("cql", "all", "="); $config->cql_check_apt("cql", "all", "notexist"); $config->cql_check_apt("cql", "notexist", "="); $config->cql_check_apt("notexist", "all", "<>"); print "DONE\n"; exit(0); class Command { private $options; private $command; private $short_format_config = 'hc:s:t:'; private $syntax_config = array('ccl', 'cql', 'pqf'); public function __construct() { $args = Console_Getopt::readPHPArgv(); if (PEAR::isError($args)) { fwrite(STDERR, $args->getMessage() . "\n"); exit(1); } // Compatibility between "php script.php" and "./script.php"
<?php include_once 'framework/init.php'; define('API_LIBS', ROOT_DIR . SL . 'api' . SL . 'libs' . SL); Autoload::init(array(LIBS, EXTERNAL, API_LIBS, FRAMEWORK_LIBS, FRAMEWORK_EXTERNAL), CACHE); mb_internal_encoding('UTF-8'); Config::parse(CONFIG . SL . 'define.ini', true); $url = explode('/', preg_replace('/\\?[^\\/]+$/', '', $_SERVER['REQUEST_URI'])); $url = array_filter($url); if (empty($url)) { $url = array('index'); } $module = reset($url); $class = 'Module_' . ucfirst($module); if (!class_exists($class)) { $class = 'Module_Error'; } $worker = new $class($url); $worker->send_headers()->send_output();