本文整理汇总了PHP中Core::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::getInstance方法的具体用法?PHP Core::getInstance怎么用?PHP Core::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
$this->__core = Core::getInstance();
$this->__lib = $this->__core->getLib();
$this->__uri = $this->__core->getUri();
$this->__req = $this->__core->getRequest();
}
示例2: main
function main($url = null)
{
if (strtolower($_SERVER["REQUEST_METHOD"]) == "get") {
//todo : if request method is get,
require_once APPPATH . 'views' . DS . 'templates' . DS . 'template_login.php';
} else {
//todo : if request method is post
//todo : should we set session time out?
if (isset($_POST["email"]) && isset($_POST["password"])) {
$email = $_POST["email"];
$password = $_POST["password"];
$member = Core::getInstance("Member_md")->getMember($email, $password);
if ($member) {
//todo : redirect main page
$_SESSION["member"] = $member[0];
$SID = session_id();
echo '1 : ', $SID;
$this->redirect("/term");
//require_once APPPATH.'views'.DS.'templates'.DS.'template_term_list.php';
} else {
//todo : invalid user information,
}
}
}
}
示例3: getPersistenceObject
function getPersistenceObject()
{
$loader = \Core::getInstance()->getLoader();
if ($loader->has($this->_persistenceObject)) {
return $loader->get($this->_persistenceObject);
}
}
示例4: execRouterHook
public static function execRouterHook(_Core_Request $request, &$class, &$method, array &$chunks, &$templateEngine)
{
if (JS_MINIFY) {
$templateEngine->append('js', 'global-min.js');
} else {
foreach (file(SYS_DIR_INC . 'assets/js.list') as $js) {
$templateEngine->append('js', $js);
}
}
if (IS_DEMO) {
$templateEngine->append('js', 'demo_message.js');
}
/**
* Динамическое подключение js файлов
* в зависимости от модуля
*
*/
$jsArr = array();
$urlArr = explode('/', $request->uri, 3);
// первый элемент
array_shift($urlArr);
$module = strtolower(array_shift($urlArr));
if (array_key_exists($module, Core::getInstance()->js)) {
$jsArr = Core::getInstance()->js[$module];
}
foreach ($jsArr as $jsFile) {
$templateEngine->append('js', $jsFile . '.js');
}
}
示例5: __construct
/**
* Controller constructor
* @param [type] $view [description]
*/
public function __construct($view = null)
{
if ($view) {
$this->view = $view;
}
$this->view = Core::getInstance("View");
}
示例6: add
function add($name, $schema)
{
$dataSet = \Core::getInstance()->getDatabase()->getDataSet();
if ($schema instanceof \DBAL\Data\Model) {
$dataSet->addModel($schema);
}
return parent::add($name, $schema);
}
示例7: __construct
public function __construct($templateEngine, _Core_Request $request)
{
//Проверяем авторизован ли пользователь. Если нет - редиректим на логин
if (!Core::getInstance()->CurrentUserIsAuthorized()) {
header('Location: /login/');
}
parent::__construct($templateEngine, $request);
}
示例8: execute
protected function execute(&$source = null)
{
$result = parent::execute($source);
if ($source instanceof \DBAL\Data\Source) {
$core = \Core::getInstance();
$core->getDatabase()->Models->Data = \Util\Arrays\names($source->Data);
}
return $result;
}
示例9: getEntity
function getEntity()
{
$core = \Core::getInstance();
if (is_null($this->entity)) {
$this->entity = $core->Database->Models[$this->EntityName];
}
//TODO: entity by entityname if blank
return $this->entity;
}
示例10: __construct
/**
* Конструктор
*
*/
public final function __construct($templateEngine, _Core_Request $request)
{
parent::__construct($templateEngine, $request);
// Если эксперт - редирект на дефолтную для экспертов
if (Core::getInstance()->user->getType() == 1) {
header('Location: /expert/');
exit;
}
}
示例11: __construct
/**
* Конструктор класса
* @return void
*/
function __construct()
{
if (is_null(Core::getInstance()->db)) {
Core::getInstance()->initDB();
}
$this->db = Core::getInstance()->db;
// Загружаем список валют
$this->loadCurrency();
}
示例12: delete_service_mail
/**
* Удаляет у пользователя служебную почту
*/
function delete_service_mail()
{
$user = Core::getInstance()->user;
if ($this->model->deleteServiceMail($user)) {
$this->tpl->assign('result', array('text' => 'Ящик успешно удалён'));
} else {
$this->tpl->assign('error', array('text' => 'Ошибка при удалении ящика'));
}
}
示例13: __construct
/**
* Initialize application and parse input parameters
*
*/
public function __construct()
{
$this->_app = Core::getInstance(array('app' => 'shell', 'document_root' => dirname(__FILE__) . '/', 'app_root' => dirname(__FILE__) . '/../app/'));
$this->_factory = FactoryModel::getInstance();
$this->_applyPhpVariables();
$this->_parseArgs();
$this->_validate();
$this->_showHelp();
}
示例14: write
/**
* 写入记录
* @param string $message
* @param string $level
*/
public static function write($message, $level = self::ERR)
{
if (!self::$status) {
self::getConfig();
}
$now = date(self::$config['time_format']);
$message = Core::getInstance()->getHook()->apply("Log_write", $message, $level);
error_log("[{$now}] " . URL_NOW . "; {$level}: {$message}\r\n", self::$config['type'], self::$config['destination'], self::$config['headers']);
}
示例15: getCurrent
public static function getCurrent()
{
$user = null;
//Временный хак под старый класс
if (Core::getInstance()->user->getId()) {
$user = Core::getInstance()->user;
}
return $user;
}