本文整理汇总了PHP中app\App::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP App::getInstance方法的具体用法?PHP App::getInstance怎么用?PHP App::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\App
的用法示例。
在下文中一共展示了App::getInstance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGenres
/**
* Récupère les genres d'un album
*/
public function getGenres()
{
if (isset($this->id)) {
$this->genres = App::getInstance()->getTable('Genres')->allByAlbum($this->id);
$this->total_genres = count($this->genres);
}
}
示例2: getAlbums
/**
* Récupère les albums d'un artiste
*/
public function getAlbums()
{
if (isset($this->id)) {
$this->albums = App::getInstance()->getTable('Albums')->allByArtist($this->id);
$this->total_albums = count($this->albums);
}
}
示例3: __construct
public function __construct()
{
parent::__construct();
$app = App::getInstance();
$auth = new DBAuth($app->getDb());
if (!$auth->logged()) {
$this->forbidden();
}
}
示例4: login
public function login()
{
$errors = false;
if (!empty($_POST)) {
$auth = new DBAuth(App::getInstance()->getDb());
if ($auth->login($_POST['username'], $_POST['password'])) {
header('Location: index.php?page=admin.post.index');
} else {
$errors = true;
}
}
$form = new FoundationForm($_POST);
$this->render('user.login', compact('form', 'errors'));
}
示例5:
<?php
use App\App;
$app = App::getInstance();
$app->title = $category->title;
?>
<div class="main">
<h1><?php
echo $category->title;
?>
</h1>
<?php
foreach ($posts as $post) {
?>
<h2>
<a href="<?php
echo $post->url;
?>
"><?php
echo $post->title;
?>
</a>
</h2>
<p>
<?php
echo $post->extract;
?>
</p>
<?php
}
示例6: IsAdmin
public static function IsAdmin($username, $uniqId)
{
$db = new Database('blog');
$app = \App\App::getInstance();
$username = $app::destroyHTML($username);
$uniqId = $app::destroyHTML($uniqId);
$isAdmin = $db->prepare("SELECT * FROM users WHERE username = :username AND uniqid = :uniqid", array("username" => $username, "uniqid" => $uniqId), "App\\Table\\User", true);
if ($isAdmin) {
return true;
}
}
示例7: loadModel
protected function loadModel($model)
{
$this->{$model} = App::getInstance()->getTable($model);
}
示例8: app
/**
* App container
* @return object
*/
protected function app()
{
return App::getInstance();
}
示例9: init
/**
* Run initialize after services were registered.
*/
public function init()
{
$this->event->trigger('phifty.before_init');
$self = $this;
$this->web = function () use($self) {
return new Web($self);
};
if (CLI) {
CommandLine::init($this);
} else {
if (isset($this->session)) {
$this->session;
}
}
if (isset($this->locale)) {
$this->locale;
}
$this->app = \App\App::getInstance($this, []);
$this->app->init();
$this->bundles->init();
$this->event->trigger('phifty.after_init');
}