本文整理汇总了PHP中base::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP base::instance方法的具体用法?PHP base::instance怎么用?PHP base::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类base
的用法示例。
在下文中一共展示了base::instance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_instance
public static function get_instance()
{
if (self::$instance == null) {
self::$instance = new self();
}
return self::$instance;
}
示例2: _log
public function _log($typeID, $id = array(), $text = "", $data = array())
{
//save($id=array("contentID"=>"","commentID"=>"","meetingID"=>"","companyID"=>"","answerID"=>""),$text="",$userID="") {
$timer = new timer();
$f3 = \base::instance();
$user = $f3->get("user");
$userID = $user['ID'];
//test_array($id);
$values = array('typeID' => $typeID, 'userID' => $userID, 'contentID' => isset($id["contentID"]) ? $id["contentID"] : null, 'commentID' => isset($id["commentID"]) ? $id["commentID"] : null, 'meetingID' => isset($id["meetingID"]) ? $id["meetingID"] : null, 'companyID' => isset($id["companyID"]) ? $id["companyID"] : null, 'optionID' => isset($id["optionID"]) ? $id["optionID"] : null, 'fileID' => isset($id["fileID"]) ? $id["fileID"] : null, 'text' => $text, 'data' => json_encode($data), 'sessionID' => session_id());
//test_array($values);
if ($values['fileID'] != null && $values['contentID'] == null) {
$values['contentID'] = $this->lookup($values['fileID'], 'mp_content_files')->contentID;
}
if ($values['optionID'] != null && $values['contentID'] == null) {
$values['contentID'] = $this->lookup($values['optionID'], 'mp_content_poll_answers')->contentID;
}
if ($values['commentID'] != null && $values['contentID'] == null) {
$values['contentID'] = $this->lookup($values['commentID'], 'mp_content_comments')->contentID;
}
if ($values['contentID'] != null && $values['meetingID'] == null) {
$values['meetingID'] = $this->lookup($values['contentID'], 'mp_content')->meetingID;
}
if ($values['meetingID'] != null && $values['companyID'] == null) {
$values['companyID'] = $this->lookup($values['meetingID'], 'mp_meetings')->companyID;
}
$art = new \DB\SQL\Mapper($this->f3->get("DB"), 'mp_logs');
foreach ($values as $key => $value) {
if (isset($art->{$key}) && $key != "ID") {
$art->{$key} = $value;
}
}
$art->save();
$timer->_stop(__NAMESPACE__, __CLASS__, __FUNCTION__, func_get_args());
return $values;
}
示例3: __construct
function __construct()
{
$this->f3 = \base::instance();
$this->user = $this->f3->get("user");
if ($this->user['ID'] == "") {
$this->f3->reroute("/login?msg=Login+Failed");
}
}
示例4: dirname
$errorPath = dirname(ini_get('error_log'));
$errorFile = $errorPath . DIRECTORY_SEPARATOR . basename(__DIR__) . "-errors.log";
ini_set("error_log", $errorFile);
if (session_id() == "") {
$SID = @session_start();
} else {
$SID = session_id();
}
if (!$SID) {
session_start();
$SID = session_id();
}
$GLOBALS["output"] = array();
$GLOBALS["models"] = array();
require_once 'vendor/autoload.php';
$f3 = \base::instance();
require 'inc/timer.php';
require 'inc/template.php';
require 'inc/functions.php';
require 'inc/pagination.php';
$GLOBALS['page_execute_timer'] = new timer(true);
$cfg = array();
require_once 'config.default.inc.php';
if (file_exists("config.inc.php")) {
require_once 'config.inc.php';
}
$f3->set('AUTOLOAD', './|lib/|controllers/|inc/|/modules/');
$f3->set('PLUGINS', 'vendor/bcosca/fatfree/lib/');
$f3->set('CACHE', true);
$f3->set('DB', new DB\SQL('mysql:host=' . $cfg['DB']['host'] . ';dbname=' . $cfg['DB']['database'] . '', $cfg['DB']['username'], $cfg['DB']['password']));
$f3->set('cfg', $cfg);
示例5: format
static function format($data)
{
$timer = new timer();
$f3 = \base::instance();
$single = false;
if (isset($data['ID'])) {
$single = true;
$data = array($data);
}
$i = 1;
$n = array();
//test_array($items);
foreach ($data as $item) {
unset($item['password']);
$n[] = $item;
}
if ($single) {
$n = $n[0];
}
$timer->_stop(__NAMESPACE__, __CLASS__, __FUNCTION__, func_get_args());
return $n;
}
示例6: remove
static function remove($ID)
{
$timer = new timer();
$f3 = \base::instance();
// test_array($values);
$art = new \DB\SQL\Mapper($f3->get("DB"), "dir_items");
$art->load("ID='{$ID}'");
$art->erase();
$timer->_stop(__NAMESPACE__, __CLASS__, __FUNCTION__, func_get_args());
return "done";
}
示例7: __construct
function __construct()
{
$this->f3 = \base::instance();
$this->user = $this->f3->get("user");
$this->cfg = $this->f3->get("cfg");
}