本文整理汇总了PHP中Flight::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::get方法的具体用法?PHP Flight::get怎么用?PHP Flight::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* PRedis constructor.
*
* @param array $conf
* @param $options
*/
public function __construct($conf = [], $options = null)
{
if (!$conf) {
$conf = \Flight::get('config')->get('redis');
}
parent::__construct($conf, $options);
}
示例2: __construct
/**
* Constructor
*/
public function __construct($install)
{
parent::__construct($install);
if (F::has('pageinfos')) {
F::view()->assign(array('pageinfos' => Files::getPageInfos(F::get('pageinfos')['cat'], F::get('pageinfos')['page'])));
}
}
示例3: getselectfields
/**
* Gets fields/columns from specified tables and generates dropdown options
*/
public function getselectfields()
{
$tablesJSON = $_POST['tables'];
if ($tablesJSON) {
$html = '';
$tables = json_decode($tablesJSON, true);
foreach ($tables as $table) {
// table columns
$stmt = Flight::get('db')->query("DESCRIBE {$table}");
$columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
//pretty_print($columns);
$fields = array();
foreach ($columns as $values) {
if (isset($values['Field'])) {
$fields[] = $values['Field'];
}
}
//pretty_print($fields);
$html .= '<optgroup label="' . $table . '">' . "\n";
$html .= getOptions($fields, false, $table);
$html .= '</optgroup>' . "\n";
}
echo $html;
}
}
示例4: render_boilerplate
function render_boilerplate()
{
Flight::render('head', array('my_url' => MY_URL, 'title' => _('WLAN at ') . PAGE_NAME), 'head');
Flight::render('foot', array('privacy_url' => MY_URL . 'privacy/', 'imprint_url' => IMPRINT_URL), 'foot');
Flight::render('back_to_code_widget', array('retry_url' => Flight::get('retry_url')), 'back_to_code_widget');
Flight::render('access_code_widget', array('codeurl' => MY_URL . 'access_code/'), 'access_code_widget');
}
示例5: __construct
public function __construct()
{
new Model_Test();
include "test.html";
$tmp = Flight::get('test');
echo "Controller_Test" . $tmp;
}
示例6: __construct
/**
* AssetsManager constructor.
* @param array $conf
*/
public function __construct($conf = [])
{
if (!$conf) {
$conf = \Flight::get('config')->get('assets');
}
$this->loadConfig($conf);
}
示例7: get
public function get($key)
{
if ($val = parent::get($key)) {
return $val;
}
return Flight::has($key) ? Flight::get($key) : null;
}
示例8: saveProfile
/**
* Save properties of the user profile
* @return [JSON] Success or error message
*/
public static function saveProfile()
{
if (!Flight::has('currentUser')) {
Flight::json(['Error' => 'No Access']);
}
$currentUser = Flight::get('currentUser');
if (isset(Flight::request()->query->bio)) {
$currentUser->bio = Flight::request()->data->bio;
} else {
if (isset(Flight::request()->query->password)) {
if (!isset(Flight::request()->data->passwordold) || !isset(Flight::request()->data->passwordnew1) || !isset(Flight::request()->data->passwordnew2)) {
Flight::json(['success' => false, 'exception' => 'Empty fields']);
}
if ($currentUser->password === hash("sha256", Flight::request()->data->passwordold)) {
if (Flight::request()->data->passwordnew1 == Flight::request()->data->passwordnew2) {
$currentUser->password = hash("sha256", Flight::request()->data->passwordnew1);
} else {
Flight::json(['success' => false, 'exception' => 'New passwords are not the same']);
}
} else {
Flight::json(['success' => false, 'exception' => 'Old password is not correct ']);
}
}
}
$result = $currentUser->update();
if ($result != false) {
$_SESSION['user'] = Flight::users()->getUserWithId(Flight::get('currentUser')->id);
Flight::json(['success' => true]);
} else {
Flight::json(['sucess' => false, 'exception' => 'An error']);
}
}
示例9: access
/**
* Login POST verification (authentication)
*/
public function access()
{
$pass = F::request()->data->password;
# captcha
if (!empty(F::get('config')['recaptcha']['public'])) {
$captcha = F::request()->data['g-recaptcha-response'];
if (!Verif::okCaptcha($captcha)) {
$_SESSION['flashbag'] = '<div class="alert alert-danger">Wrong security captcha.</div>';
$this->index();
exit;
}
}
# password
if (Verif::okPassword($pass)) {
$_SESSION['admin'] = 1;
$_SESSION['flashbag'] = '
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
You are now logged in.
</div>';
F::redirect('/');
} else {
$_SESSION['flashbag'] = '<div class="alert alert-danger">Wrong password.</div>';
}
$this->index();
}
示例10: smarty_function_res
function smarty_function_res($params, &$smarty)
{
if (empty($params['path'])) {
return "[plugin:res] missing parameter.";
}
return \Flight::get('root') . 'web/' . $params['path'];
}
示例11: __construct
public function __construct()
{
try {
$this->pdo = new PDO('mysql:host=' . Flight::get('DBhost') . ';dbname=' . Flight::get('DBname'), Flight::get('DBlogin'), Flight::get('DBpassword'));
} catch (PDOException $e) {
echo 'Po³¹czenie nie mog³o zostaæ utworzone.<br />';
}
}
示例12: __construct
/**
* DataPool constructor.
* @param array $conf
*/
public function __construct($conf = [])
{
if (!$conf) {
$conf = \Flight::get('config')->get('datapool');
$conf['debug'] = isDebug();
}
$this->dataPool = new DefaultDataPool($conf, ROOT);
}
示例13: createPost
/**
* Create a post
*/
public static function createPost()
{
if (!Flight::has('currentUser')) {
Flight::redirect('/');
}
$post = new post(['user' => Flight::get('currentUser')->id, 'title' => Flight::request()->data->title, 'content' => Flight::request()->data->content]);
$post->store();
}
示例14: __construct
/**
* Timer constructor.
* @param array $conf
*/
public function __construct($conf = [])
{
if (!$conf) {
$tz = \Flight::get('config')->get('timezone');
$conf = ['timezone' => $tz];
}
$this->loadConfig($conf);
}
示例15: __construct
public function __construct($paths, $pattern)
{
$this->paths = $paths;
$this->pattern = $pattern;
$this->ignores = $this->update_ignores(\Flight::setting("ignores"));
$settings = \Flight::get("organizer.settings");
$settings["ignores"] = $this->ignores;
\Flight::write_settings($settings);
}