本文整理汇总了PHP中Admin::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::getInstance方法的具体用法?PHP Admin::getInstance怎么用?PHP Admin::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin
的用法示例。
在下文中一共展示了Admin::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$html = "";
if (isset($this->params[0]) && $this->params[0] != "") {
$extension = \ExtensionMaster::getInstance()->getExtensionById($this->params[0]);
$html = $extension->getInfoHtml();
} else {
$content = \Admin::getInstance()->loadTemplate("ExtensionIndex.template.html");
$extensions = \ExtensionMaster::getInstance()->getAllExtensions();
foreach ($extensions as $extension) {
$content->setCurrentBlock("BLOCK_EXTERNSION");
$content->setVariable("EXTERNSION_ID", $extension->getId());
$content->setVariable("EXTERNSION_NAME", $extension->getName());
$content->setVariable("EXTERNSION_ICON", "");
$content->setVariable("EXTERNSION_VERSION", $extension->getVersion());
$content->parse("BLOCK_EXTERNSION");
}
$html = $content->get();
}
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($html);
$frameResponseObject->setTitle("Extension Information");
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
}
示例2: writePackageSubscribeLog
public static function writePackageSubscribeLog($user_id, $package_id, $set_state)
{
$data = array('user_id' => $user_id, 'set_state' => $set_state, 'package_id' => $package_id);
if (!empty(Stb::getInstance()->id) && (empty($_SERVER['TARGET']) || $_SERVER['TARGET'] !== 'API' && $_SERVER['TARGET'] !== 'ADM')) {
$data['initiator_id'] = Stb::getInstance()->id;
$data['initiator'] = 'user';
} else {
$data['initiator_id'] = Admin::getInstance()->getId();
if (!empty($data['initiator_id'])) {
$data['initiator'] = 'admin';
}
}
Mysql::getInstance()->insert('package_subscribe_log', $data);
}
示例3: die
<?php
/**
* CubeCart v6
* ========================================
* CubeCart is a registered trade mark of CubeCart Limited
* Copyright CubeCart Limited 2015. All rights reserved.
* UK Private Limited Company No. 5323904
* ========================================
* Web: http://www.cubecart.com
* Email: sales@cubecart.com
* License: GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html
*/
if (!defined('CC_INI_SET')) {
die('Access Denied');
}
Admin::getInstance()->permissions('settings', CC_PERM_EDIT, true);
$GLOBALS['main']->addTabControl('PHP Info', 'php_info');
$GLOBALS['gui']->addBreadcrumb('PHP Info', '?_g=phpinfo', true);
ob_start();
phpinfo();
preg_match('%<style type="text/css">(.*?)</style>.*?<body>(.*?)</body>%s', ob_get_clean(), $matches);
$page_content = "<div class='phpinfodisplay tab_content' id='php_info'><style type='text/css'>\n";
$page_content .= join("\n", array_map(create_function('$i', 'return ".phpinfodisplay " . preg_replace( "/,/", ",.phpinfodisplay ", $i );'), preg_split('/\\n/', trim(preg_replace("/\nbody/", "\n", $matches[1])))));
$page_content .= "</style>\n" . $matches[2] . "\n</div>\n";
示例4: foreach
if (is_array($email_types[$data['content_type']]['macros'])) {
foreach ($email_types[$data['content_type']]['macros'] as $macro => $desc) {
$macro_data['name'] = htmlspecialchars($macro);
$macro_data['description'] = $desc;
$smarty_data['macros'][] = $macro_data;
}
$GLOBALS['smarty']->assign('CONTENT_MACROS', $smarty_data['macros']);
}
$GLOBALS['smarty']->assign('DISPLAY_CONTENT_FORM', true);
}
break;
case 'template':
## EMAIL TEMPLATES
switch (strtolower($_GET['action'])) {
case 'delete':
if (isset($_GET['template_id']) && is_numeric($_GET['template_id']) && Admin::getInstance()->permissions('documents', CC_PERM_DELETE)) {
if ($GLOBALS['db']->delete('CubeCart_email_template', array('template_id' => (int) $_GET['template_id']))) {
httpredir(currentPage(array('action', 'type', 'template_id')), 'email_templates');
}
}
break;
default:
if (in_array(strtolower($_GET['action']), array('clone', 'edit')) && isset($_GET['template_id']) && is_numeric($_GET['template_id'])) {
## Edit Template
$template = $GLOBALS['db']->select('CubeCart_email_template', false, array('template_id' => (int) $_GET['template_id']));
if ($template) {
$data = $template[0];
if (strtolower($_GET['action']) == 'clone') {
unset($data['template_id']);
} else {
$breadcrumb = $data['title'];
示例5: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->markTestSkipped('side effects');
$this->object = Admin::getInstance();
}
示例6: isset
}
$_GET['_g'] = isset($_GET['_g']) ? $_GET['_g'] : 'login';
switch (strtolower($_GET['_g'])) {
case 'recovery':
if (isset($_POST['email']) && isset($_POST['validate']) && isset($_POST['password'])) {
if (!Admin::getInstance()->passwordReset($_POST['email'], $_POST['validate'], $_POST['password'])) {
$GLOBALS['gui']->setError($lang['account']['error_validation']);
}
}
$GLOBALS['smarty']->assign('REQUEST', $_REQUEST);
$GLOBALS['smarty']->assign('RECOVERY', true);
break;
case 'password':
if (isset($_POST['email']) && isset($_POST['username'])) {
// Send a recovery email
if (Admin::getInstance()->passwordRequest($_POST['username'], $_POST['email'])) {
$GLOBALS['gui']->setNotify($lang['account']['notify_password_recovery']);
} else {
$GLOBALS['gui']->setError($lang['account']['error_details_wrong']);
}
}
$GLOBALS['smarty']->assign('PASSWORD', true);
break;
default:
switch (true) {
case isset($_GET['redir']) && !empty($_GET['redir']):
$redir = $_GET['redir'];
break;
case isset($_POST['redir']) && !empty($_POST['redir']):
$redir = $_POST['redir'];
break;
示例7: outOfStockWhere
/**
* Work out SQL where clause
*
* @param bool $original
* @param bool $label
* @param bool $force
* @return string
*/
public function outOfStockWhere($original = false, $label = false, $force = false)
{
$def = $original ? str_replace('WHERE ', '', $GLOBALS['db']->where('CubeCart_inventory', $original)) : '';
if ($GLOBALS['config']->get('config', 'hide_out_of_stock') && !Admin::getInstance()->is()) {
$def .= $force || $def ? ' AND' : '';
$oos = sprintf('%1$s ((%2$s.stock_level > 0 AND %2$s.use_stock_level = 1) OR %2$s.use_stock_level = 0)', $def, $label ? $label : sprintf('%sCubeCart_inventory', $GLOBALS['config']->get('config', 'dbprefix')));
}
return $GLOBALS['config']->get('config', 'hide_out_of_stock') && !Admin::getInstance()->is() ? $oos : $def;
}
示例8: cleanImageCache
$GLOBALS['cache']->clear();
$GLOBALS['cache']->tidy();
$GLOBALS['main']->setACPNotify($lang['maintain']['notify_cache_cleared']);
$clear_post = true;
}
if (isset($_POST['clearSQLCache']) && Admin::getInstance()->permissions('maintenance', CC_PERM_DELETE)) {
$GLOBALS['cache']->clear('sql');
$GLOBALS['main']->setACPNotify($lang['maintain']['notify_cache_cleared']);
$clear_post = true;
}
if (isset($_POST['clearLangCache']) && Admin::getInstance()->permissions('maintenance', CC_PERM_DELETE)) {
$GLOBALS['cache']->clear('lang');
$GLOBALS['main']->setACPNotify($lang['maintain']['notify_cache_cleared']);
$clear_post = true;
}
if (isset($_POST['clearImageCache']) && Admin::getInstance()->permissions('maintenance', CC_PERM_DELETE)) {
function cleanImageCache($path = null)
{
$path = isset($path) && is_dir($path) ? $path : CC_ROOT_DIR . '/images/cache' . '/';
$scan = glob($path . '*', GLOB_MARK);
if (is_array($scan) && !empty($scan)) {
foreach ($scan as $result) {
if (is_dir($result)) {
cleanImageCache($result);
rmdir($result);
} else {
unlink($result);
}
}
}
}
示例9: offline
/**
* Take the store offline?
*/
function offline()
{
## Check if store should be offline or not
if ($GLOBALS['config']->get('config', 'offline')) {
## Only show offline content if no admin session or admin is not allowed to view store front
if (!Admin::getInstance()->is()) {
$offlineContent = stripslashes($GLOBALS['config']->get('config', 'offline_content'));
// No needs to base64_decode as the main config is already plain since 5.1.1
$offlineFiles = glob('offline.{php,htm,html,txt}', GLOB_BRACE);
if (!empty($offlineFiles) && is_array($offlineFiles)) {
foreach ($offlineFiles as $file) {
include $file;
break;
}
} else {
echo $offlineContent;
}
## Load 'offline' hooks
foreach ($GLOBALS['hooks']->load('offline') as $hook) {
include $hook;
}
exit;
} else {
$GLOBALS['smarty']->assign('STORE_OFFLINE', true);
}
}
}
示例10: httpredir
if ($status_updated) {
$GLOBALS['main']->setACPNotify($lang['documents']['notify_document_status']);
}
}
## If no changes have been made let administrator know
if (!$updated && !$status_updated && !$order_updated) {
$GLOBALS['main']->setACPWarning($lang['common']['notify_no_changes']);
}
httpredir(currentPage());
}
}
if (isset($_GET['delete']) && is_numeric($_GET['delete'])) {
foreach ($GLOBALS['hooks']->load('admin.documents.delete') as $hook) {
include $hook;
}
if (Admin::getInstance()->permissions('documents', CC_PERM_DELETE)) {
## Load from db, and assign
$document = $GLOBALS['db']->select('CubeCart_documents', array('doc_name'), array('doc_id' => $_GET['delete']));
$GLOBALS['db']->delete('CubeCart_documents', array('doc_parent_id' => $_GET['delete']));
$GLOBALS['db']->delete('CubeCart_documents', array('doc_id' => $_GET['delete']));
$GLOBALS['seo']->delete('doc', $_GET['delete']);
$GLOBALS['main']->setACPNotify($lang['documents']['notify_document_delete']);
} else {
$GLOBALS['main']->setACPWarning($lang['documents']['error_document_delete']);
}
httpredir(currentPage(array('delete')));
}
###############################################
if (isset($_GET['action'])) {
foreach ($GLOBALS['hooks']->load('admin.documents.pre_display') as $hook) {
include $hook;
示例11: _displaySkinSelect
/**
* Display select skin box
*/
private function _displaySkinSelect()
{
if (!$GLOBALS['smarty']->templateExists('templates/box.skins.php')) {
return false;
}
$skin_setting = $GLOBALS['config']->get('config', 'skin_change');
if ($skin_setting == '1' || $skin_setting == '2' && Admin::getInstance()->is()) {
foreach ($this->_skins as $skin => $data) {
## Do not show mobile skins
if (!$data['info']['mobile']) {
$data['info']['selected'] = $this->_skin == $data['info']['name'] ? 'selected="selected"' : '';
$vars[$skin] = $data['info'];
if (isset($data['styles']) && is_array($data['styles'])) {
foreach ($data['styles'] as $style) {
$style['selected'] = $this->_skin == $data['info']['name'] && $this->_style == $style['directory'] ? 'selected="selected"' : '';
$vars[$skin]['styles'][] = $style;
}
}
}
}
foreach ($GLOBALS['hooks']->load('class.gui.display_skin_select') as $hook) {
include $hook;
}
$GLOBALS['smarty']->assign('SKINS', $vars);
$content = $GLOBALS['smarty']->fetch('templates/box.skins.php');
$GLOBALS['smarty']->assign('SKIN_SELECT', $content);
}
}
示例12: die
* ========================================
* CubeCart is a registered trade mark of CubeCart Limited
* Copyright CubeCart Limited 2015. All rights reserved.
* UK Private Limited Company No. 5323904
* ========================================
* Web: http://www.cubecart.com
* Email: sales@cubecart.com
* License: GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html
*/
if (!defined('CC_INI_SET')) {
die('Access Denied');
}
Admin::getInstance()->permissions('reviews', CC_PERM_READ, true);
global $lang;
## Delete Manufacturer
if (isset($_GET['delete']) && is_numeric($_GET['delete']) && Admin::getInstance()->permissions('products', CC_PERM_DELETE)) {
if ($GLOBALS['db']->delete('CubeCart_manufacturers', array('id' => (int) $_GET['delete']))) {
$GLOBALS['main']->setACPNotify($lang['catalogue']['notify_manufacturer_delete']);
} else {
$GLOBALS['main']->setACPWarning($lang['catalogue']['error_manufacturer_delete']);
}
foreach ($GLOBALS['hooks']->load('admin.product.manufacturers.delete') as $hook) {
include $hook;
}
httpredir(currentPage(array('delete')));
}
## Update Manufacturer
if (isset($_POST['manufacturer']) && is_array($_POST['manufacturer'])) {
foreach ($GLOBALS['hooks']->load('admin.product.manufacturers.save.pre_process') as $hook) {
include $hook;
}
示例13: httpredir
}
httpredir(currentPage(array('rebuild')));
}
if (Admin::getInstance()->permissions('filemanager', CC_PERM_EDIT) && !empty($_FILES)) {
if ($fm->upload()) {
if (count($_FILES) > 1) {
$GLOBALS['main']->setACPNotify($lang['filemanager']['notify_files_upload']);
} else {
$GLOBALS['main']->setACPNotify($lang['filemanager']['notify_file_upload']);
}
} else {
$GLOBALS['main']->setACPWarning($lang['filemanager']['error_file_upload']);
}
httpredir(currentPage());
}
if (Admin::getInstance()->permissions('filemanager', CC_PERM_DELETE) && isset($_GET['delete'])) {
if ($fm->delete($_GET['delete'])) {
$GLOBALS['main']->setACPNotify($lang['filemanager']['notify_file_delete']);
} else {
$GLOBALS['main']->setACPWarning($lang['filemanager']['error_file_delete']);
}
httpredir(currentPage(array('delete')));
}
$GLOBALS['smarty']->assign('UPLOAD_LIMIT', ini_get('post_max_size'));
if (isset($_GET['fm-edit']) && is_numeric($_GET['fm-edit'])) {
$page_content = $fm->editor($_GET['fm-edit']);
} else {
$GLOBALS['main']->addTabControl($lang['filemanager']['tab_files'], 'filemanager');
$GLOBALS['main']->addTabControl($lang['filemanager']['file_upload'], 'upload');
$GLOBALS['main']->addTabControl($lang['filemanager']['folder_create'], 'folder');
$GLOBALS['main']->addTabControl($lang['filemanager']['tab_rebuild'], false, currentPage(null, array('rebuild' => 'true')));
示例14: array
}
## Set default currency to have an exchange rate of 1
$GLOBALS['db']->update('CubeCart_currency', array('value' => 1), array('code' => $_POST['config']['default_currency']));
$updated = $GLOBALS['config']->set('config', '', $config_new) ? true : false;
if (isset($updated) && $updated || isset($logo_update)) {
$GLOBALS['main']->setACPNotify($lang['settings']['notify_settings_update']);
} else {
$GLOBALS['main']->setACPWarning($lang['settings']['error_settings_update']);
}
httpredir(currentPage());
}
if (isset($_GET['logo']) && isset($_GET['logo_id'])) {
if (($logo = $GLOBALS['db']->select('CubeCart_logo', false, array('logo_id' => (int) $_GET['logo_id']))) !== false) {
switch (strtolower($_GET['logo'])) {
case 'delete':
if (Admin::getInstance()->permissions('settings', CC_PERM_DELETE)) {
$paths = array('images/logos/' . $logo[0]['filename'], 'images/logos/' . $logo[0]['skin'] . '-' . $logo[0]['style'] . '.php', 'images/logos/' . $logo[0]['skin'] . '.php');
foreach ($paths as $path) {
if (file_exists($logo_path)) {
unlink($logo_path);
}
}
$GLOBALS['db']->delete('CubeCart_logo', array('logo_id' => $logo[0]['logo_id']));
$GLOBALS['main']->setACPNotify('Logo removed');
}
break;
}
}
$GLOBALS['gui']->rebuildLogos();
httpredir(currentPage(array('logo', 'logo_id')), 'Logos');
}
示例15: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$this->object = Admin::getInstance();
}