本文整理汇总了PHP中core::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP core::getInstance方法的具体用法?PHP core::getInstance怎么用?PHP core::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::getInstance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
function register($payload)
{
$core = core::getInstance();
$stmt = 'INSERT INTO users (id, name, email, user_img, usergroup) VALUES (?,?,?,?,?)';
$core->db->execute($stmt, $payload['sub'], $payload['name'], $payload['email'], $payload['picture'], 2);
// usergroup: 0 -admin; 1 - mod; 2 - user
return true;
}
示例2: pluginsmanagerAdminNotifications
function pluginsmanagerAdminNotifications()
{
$core = core::getInstance();
$pluginsManager = pluginsManager::getInstance();
$list = '';
foreach ($pluginsManager->getPlugins() as $plugin) {
if (!$pluginsManager->isActivePlugin($plugin->getName())) {
$list .= $plugin->getInfoVal('name') . ', ';
}
}
if ($list != '') {
show::msg($core->lang("Plugins are inactive") . ' (' . trim($list, ', ') . ')', "info");
}
}
示例3: getContent_DB
function getContent_DB($req)
{
$core = core::getInstance();
$topics = array();
foreach ($req as $v) {
$v->author = $core->db->fetchAll('SELECT * FROM users WHERE id=? LIMIT 1', $v->author)[0];
$t = isset($v->topic_name) ? $v->topic_name : isset($v->topic) ? $v->topic : "";
$t2 = isset($v->text) ? $v->text : isset($v->text) ? $v->text : "";
$v->topic = utf8_encode($t);
$v->author->name = utf8_encode($v->author->name);
$v->author->email = utf8_encode($v->author->email);
$v->description = utf8_encode($v->description);
$v->text = utf8_encode($t2);
if ($_SESSION['usergroup'] <= $v->ual) {
$topics[] = $v;
}
}
return $topics;
}
示例4: currentUrl
public static function currentUrl()
{
$core = core::getInstance();
eval($core->callHook('startShowCurrentUrl'));
$data = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
eval($core->callHook('endShowCurrentUrl'));
echo $data;
}
示例5: VALUES
if ($count == 0) {
$query = "INSERT INTO `nostarch`.`books` (`bookId`,`title`,`author`,`ISBN13`,`relesedDate`,`summary`,`dateAdded`,`dateUpdated`) VALUES (NULL,:title,:author,:ISBN13,:relesedDate,:summary,:dateAdded,NULL);";
$stmt = core::getInstance()->dbh->prepare($query);
#$stmt->bindParam(":title",filter_var($book['imageUrl'],FILTER_SANITIZE_ENCODED));
$stmt->bindParam(":title", filter_var($book['title'], FILTER_SANITIZE_FULL_SPECIAL_CHARS));
echo filter_var($book['pageUrl'], FILTER_SANITIZE_ENCODED) . "<br/>\n";
$stmt->bindParam(":summary", filter_var($book['summary'], FILTER_SANITIZE_FULL_SPECIAL_CHARS));
$stmt->bindParam(":author", filter_var($book['author'], FILTER_SANITIZE_FULL_SPECIAL_CHARS));
$stmt->bindParam(":ISBN13", filter_var($book['ISBN13'], FILTER_SANITIZE_FULL_SPECIAL_CHARS));
$stmt->bindParam(":relesedDate", filter_var($book['releasedDate'], FILTER_SANITIZE_FULL_SPECIAL_CHARS));
echo filter_var($book['MSRP'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "<br/>\n";
$stmt->bindParam(":dateAdded", date("Y-m-d H:i:s"));
$stmt->execute();
} else {
$query = "";
$stmt = core::getInstance()->dbh->prepare($query);
$stmt->bindParam();
$stmt->execute();
}
}
function update($table, $updateData, $whereKey, $whereValue)
{
$updateString = '';
for ($i = 0; $i < count($updateData); $i++) {
list($key, $value) = each($updateData);
$updateString .= "`" . $key . "` = " . "'" . $value . "'";
if ($i != count($updateData)) {
$updateString .= ' , ';
}
}
$query = "UPDATE `" . $table . "` SET " . $updateString . " WHERE " . $whereKey . " LIKE '" . $whereValue . "'";
示例6: session_start
* @copyright 2010 Jonathan Coulet (contact@99ko.org)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
## Préchauffage...
session_start();
defined('ROOT') or exit('No direct script access allowed');
include_once ROOT . 'common/config.php';
include_once COMMON . 'util.class.php';
include_once COMMON . 'core.class.php';
include_once COMMON . 'pluginsManager.class.php';
include_once COMMON . 'plugin.class.php';
include_once COMMON . 'show.class.php';
## Création de l'instance core
$core = core::getInstance();
## Plugin par défaut du mode public
define('DEFAULT_PLUGIN', $core->getConfigVal('defaultPlugin'));
## Plugin par défaut du mode admin
define('DEFAULT_ADMIN_PLUGIN', $core->getConfigVal('defaultAdminPlugin'));
## Si le core n'est pas installé on redirige vers le script d'installation
if (!$core->isInstalled()) {
header('location:' . ROOT . 'install.php');
die;
}
## Création de l'istance pluginsManager
$pluginsManager = pluginsManager::getInstance();
## On boucle sur les plugins
foreach ($pluginsManager->getPlugins() as $plugin) {
// On inclut le fichier PHP principal
include_once $plugin->getLibFile();
示例7: createPlugin
private function createPlugin($name)
{
// Instance du core
$core = core::getInstance();
// Infos du plugin
$infos = util::readJsonFile(PLUGINS . $name . '/param/infos.json');
// Configuration du plugin
$config = util::readJsonFile(DATA_PLUGIN . $name . '/config.json');
// Hooks du plugin
$hooks = util::readJsonFile(PLUGINS . $name . '/param/hooks.json');
// Config usine
$initConfig = util::readJsonFile(PLUGINS . $name . '/param/config.json');
// lang
$lang = util::readJsonFile(PLUGINS . $name . '/lang/' . $core->getConfigVal('siteLang') . '.json');
// Derniers checks
if (!is_array($config)) {
$config = array();
}
if (!is_array($hooks)) {
$hooks = array();
}
// Création de l'objet
$plugin = new plugin($name, $config, $infos, $hooks, $initConfig, $lang);
return $plugin;
}
示例8: makeUrl
public function makeUrl($obj)
{
$core = core::getInstance();
// => Page
if ($obj->targetIs() == 'page') {
$temp = $core->getConfigVal('defaultPlugin') == 'page' && $obj->getIsHomepage() ? $core->getConfigVal('siteUrl') : $core->getConfigVal('siteUrl') . '/' . $core->makeUrl('page', array('name' => $obj->getName(), 'id' => $obj->getId()));
} elseif ($obj->targetIs() == 'url') {
$temp = $obj->getTarget();
} else {
$temp = $core->getConfigVal('siteUrl') . '/' . $core->makeUrl($obj->getTarget());
}
return $temp;
}
示例9: setTitleTag
public function setTitleTag($val)
{
$core = core::getInstance();
if ($this->isDefaultPlugin) {
$val = $core->getConfigVal('siteName') . ' | ' . trim($val);
} else {
$val = $val . ' | ' . $core->getConfigVal('siteName');
}
$this->titleTag = $val;
}