public function __construct() { switch (true) { case function_exists('apc_get'): $driver = 'apc'; break; case class_exists('Memcache'): $driver = 'memcache'; break; default: throw new Oops_Exception("No cache drivers available"); } switch (true) { case extension_loaded('mongo'): $mapstore = 'mongodb'; break; case function_exists('mysql_connect'): $mapstore = 'mysql'; break; default: throw new Oops_Exception("No db drivers available"); } $d = array('manager' => 'cascade', 'driver' => array('class' => $driver), 'mapstore' => array('class' => $mapstore)); parent::__construct($d); }
/** * * @param string $filename * @param string $keyDelimiter * @param boolean $allowModifications */ function __construct($filename, $keyDelimiter = '.', $allowModifications = false) { set_error_handler(array($this, "_parseIniErrorHandler")); $data = parse_ini_file($filename, true); restore_error_handler(); if ($this->_parseError) { trigger_error("Config/InvalidIniFile/{$filename}", E_USER_WARNING); return; } parent::__construct($data, $keyDelimiter, $allowModifications); }
/** * Reads config values from DB and constructs Config object * * @param string $table * @param string|array $keyFields Field name(s) to use as config key. If not given table's primary key will be used * @param string|array $valueFields Field name(s) to use as config value. If not given all fields excluding keys will be used * @param string $keyDelimiter Explode keys by this delimiter and group values for each exploded part */ public function __construct($table, $keyFields = null, $valueFields = null, $keyDelimiter = '.', $allowModifications = false) { $table = Oops_Sql_Common::escapeIdentifiers($table); if (is_null($keyFields)) { $keyFields = array(); $r = Oops_Sql::Query("SHOW COLUMNS FROM {$table}", OOPS_SQL_EXCEPTION); while (($row = mysql_fetch_row($r)) !== false) { if (strtoupper($row[3]) == 'PRI') { $keyFields[] = $row[0]; } } } else { Oops_Utils::ToArray($keyFields); } if (!count($keyFields)) { throw new Exception("No key fields for config"); } if (is_null($valueFields)) { $sql = "SELECT * FROM {$table}"; } else { Oops_Utils::ToArray($valueFields); $select = array_merge($keyFields, $valueFields); foreach ($select as $k => $v) { $select[$k] = Oops_Sql_Common::escapeIdentifiers($v); } $sql = 'SELECT ' . join(',', $select) . " FROM {$table}"; } $r = Oops_Sql::Query($sql); $data = array(); while (($row = mysql_fetch_assoc($r)) !== false) { $keyParts = array(); foreach ($keyFields as $keyField) { $keyParts[] = $row[$keyField]; unset($row[$keyField]); } if (count($row) == 1) { $row = array_pop($row); } $data[join($keyDelimiter, $keyParts)] = $row; } parent::__construct($data, $keyDelimiter, $allowModifications); }
function __construct() { parent::__construct(array("oops" => array("default_action" => "index", "default_extension" => "php", "include_path" => "./application/library", "templates_path" => "./application/templates", "default_basename" => "_default.php", "strict_views" => true), "router" => array("class" => "Oops_Server_Router", "source" => ""))); }
public function __construct() { $data = array('stats' => array('vo' => 'null', 'ao' => 'null', 'noconsolecontrols' => '', 'nojoystick' => '', 'nolirc' => '', 'noar' => '', 'nomouseinput' => '', 'really-quiet' => '', 'identify' => '', 'frames' => 0), 'preview' => array("ss" => "00:00:15", "ao" => 'null', "vf" => "screenshot", 'noconsolecontrols' => '', 'nojoystick' => '', 'nolirc' => '', 'noar' => '', 'nomouseinput' => '', 'really-quiet' => '', "frames" => "1"), 'mencoder' => array('ofps' => 25, 'of' => 'lavf', 'oac' => 'mp3lame', 'lameopts' => 'abr:br=32', 'srate' => 22050, 'ovc' => 'lavc', 'lavcopts' => 'vcodec=flv:keyint=50:vbitrate=100:mbd=2:mv0:trell:v4mv:cbp:last_pred=3', 'quiet' => '', 'really-quiet' => '', 'vf' => 'scale=320:240', 'af' => 'channels=1', 'forceidx' => '', 'endpos' => 10), 'tmpdir' => '.tmp', 'keepFLV' => false); parent::__construct($data); }