本文整理汇总了PHP中Options::filter方法的典型用法代码示例。如果您正苦于以下问题:PHP Options::filter方法的具体用法?PHP Options::filter怎么用?PHP Options::filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::filter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readConfigFile
public static function readConfigFile($path)
{
require_once $path;
return Options::filter(get_defined_vars());
}
示例2: init
public static function init()
{
// Displays all errors
if (DEBUG) {
ini_set('display_errors', 'On');
ini_set('display_startup_errors', 'On');
ini_set('error_reporting', -1);
}
// Vendor libs by some great guys
require_once PATH . '/app/Vendor/phpass.php';
require_once PATH . '/app/Vendor/idiorm.php';
require_once PATH . '/app/Vendor/Identicon/autoload.php';
// Connection to mysql database
require_once PATH . '/app/Core/config.php';
// Configuration file
$cfg['dsn'] = "mysql:dbname={$cfg['database']};host={$cfg['hostname']}";
ORM::configure($cfg['dsn']);
ORM::configure('username', $cfg['username']);
ORM::configure('password', $cfg['password']);
ORM::configure('return_result_sets', true);
if (DEBUG) {
ORM::configure('logging', true);
}
ORM::configure('caching', true);
ORM::configure('caching_auto_clear', true);
ORM::configure('id_column_overrides', array('session' => 'sid'));
// Configuration data
self::$g = Options::filter('pairs');
self::$g['logged'] = User::filter('byLogged');
define('LOGGED', self::$g['logged'] ? self::$g['logged']->id : 0);
define('ADMIN', LOGGED && '1' === self::$g['logged']->admin);
define('UPLOAD_PATH', PATH . '/uploads/');
// View library init
View::init();
// Selects parameter from query
$param = !empty($_GET['p']) ? $_GET['p'] : '';
$param = explode('/', $param, 3);
// Splits parameter
// Checks parameters for inadequate behaviour
foreach ($param as &$v) {
if (!Validate::slug($v)) {
$v = '';
}
}
// Checks the existence of controller
$controller = 'home';
if (!empty($param[0])) {
if (ctype_lower($param[0]) && file_exists(PATH . '/app/Controller/' . $param[0] . '.php')) {
$controller = $param[0];
} elseif ($param[0] === 'u') {
$controller = 'profile';
} elseif (ctype_digit($param[0])) {
$controller = 'playlist';
}
}
// Sets the rest of parameters for global use
define('FIRST_PARAMETER', isset($param[0]) ? $param[0] : '');
define('SECOND_PARAMETER', isset($param[1]) ? $param[1] : '');
define('THIRD_PARAMETER', isset($param[2]) ? $param[2] : '');
// Initializes the controller
require_once PATH . '/app/Controller/' . $controller . '.php';
$controller = new Controller();
}