本文整理汇总了PHP中Front::addPreAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Front::addPreAction方法的具体用法?PHP Front::addPreAction怎么用?PHP Front::addPreAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Front
的用法示例。
在下文中一共展示了Front::addPreAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
public function dispatch()
{
# B/C start
global $registry;
$registry = $this->registry;
global $config;
$config = $this->registry->get('config');
global $db;
$db = $this->registry->get('db');
global $log;
$log = $this->registry->get('log');
global $loader;
$loader = $this->registry->get('load');
# B/C end
// Front Controller
$controller = new Front($this->registry);
// Maintenance Mode
$controller->addPreAction(new Action('common/maintenance'));
// Router
if (isset($this->request->get['route'])) {
$action = new Action($this->request->get['route']);
} else {
$action = new Action('common/home');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Set the page cache if enabled
$this->pagecache->setPage($this->response);
$this->trigger->fire('post.app.dispatch');
}
示例2: Config
$config = new Config();
$config->load('message');
$registry->set('config', $config);
foreach ($_config as $key => $value) {
$config->set($key, $value);
}
// Database
$db = new \Siiwi\Api\DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$registry->set('db', $db);
// Request
$request = new \Siiwi\Api\Request();
$registry->set('request', $request);
// Response
$response = new \Siiwi\Api\Response();
$response->addHeader('Access-Control-Allow-Origin: *');
$response->addHeader('Content-Type: application/json; charset=utf-8');
$response->setCompression($config->get('config_compression'));
$response->setMessage($config->get('api'));
$response->setRequest($request->get['route']);
$registry->set('response', $response);
// Front Controller
$controller = new Front($registry);
// Signature
$controller->addPreAction(new Action('signature/verify'));
// Router
$route = isset($request->get['route']) ? $request->get['route'] : 'common/error';
$action = new Action($route);
// Dispatch
$controller->dispatch($action, new Action('common/error'));
// Output
$response->output();
示例3: dispatch
public function dispatch()
{
# B/C start
global $registry;
$registry = $this->registry;
global $config;
$config = $this->registry->get('config');
global $db;
$db = $this->registry->get('db');
global $log;
$log = $this->registry->get('log');
# B/C end
if (!$this->canAccessAdmin()) {
$catalog = Client::isAdmin() ? HTTPS_CATALOG : HTTPS_SERVER;
$this->response->redirect($catalog);
}
// Front Controller
$controller = new Front($this->registry);
// Login
$controller->addPreAction(new Action('common/login/check'));
// Permission
$controller->addPreAction(new Action('error/permission/check'));
// Router
if (isset($this->request->get['route'])) {
$action = new Action($this->request->get['route']);
} else {
$action = new Action('common/dashboard');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
$this->trigger->fire('post.app.dispatch');
}
示例4: setcookie
setcookie('language', $code, time() + 60 * 60 * 24 * 30, '/', $request->server['HTTP_HOST']);
}
$config->set('config_language_id', $languages[$code]['language_id']);
$config->set('config_language', $languages[$code]['code']);
// Language
$language = new Language($languages[$code]['directory']);
$language->load($languages[$code]['filename']);
$registry->set('language', $language);
// Customer
$registry->set('customer', new Customer($registry));
// Currency
$registry->set('currency', new Currency($registry));
// Tax
$registry->set('tax', new Tax($registry));
// Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
// Front Controller
$controller = new Front($registry);
// SEO URL's
$controller->addPreAction(new Action('common/seo_url'));
// Router
$route = 'payment/tenpay/callback';
$action = new Action($route);
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例5: Cart
// Currency
$registry->set('currency', new Sumo\Currency($registry));
// Tax
$registry->set('tax', new Sumo\Tax($registry));
// Weight
$registry->set('weight', new Sumo\Weight($registry));
// Length
$registry->set('length', new Sumo\Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
// Encryption
$registry->set('encryption', new Encryption($config->get('encryption')));
// Front Controller
$controller = new Front($registry);
// SEO URL's
$controller->addPreAction(new Sumo\Action('common/seo_url'));
// Router
if (!isset($request->get['route']) && isset($request->get['_route_'])) {
$request->get['route'] = $request->get['_route_'];
}
// Maintenance Mode
$controller->addPreAction(new Sumo\Action('common/maintenance/index'));
if (isset($request->get['route'])) {
$action = new Sumo\Action(strtolower($request->get['route']));
} else {
$action = new Sumo\Action('common/home');
}
// Dispatch
$controller->dispatch($action, new Sumo\Action('error/not_found'));
// Output
$output = $response->output(true);
示例6: Request
$registry->set('request', new Request());
// Response
$response = new Response();
$response->addHeader('Content-Type: text/html; charset=utf-8');
$registry->set('response', $response);
// Session
$session = new Session();
$session->start();
$registry->set('session', $session);
// Cache
$registry->set('cache', new Cache('file'));
// Url
$registry->set('url', new Url($_SERVER['HTTP_HOST']));
// Event
$registry->set('event', new Event($registry));
// Language
$registry->set('language', new Language('en-gb'));
// Document
$registry->set('document', new Document());
// Front Controller
$controller = new Front($registry);
// Pre Action
if ($config->has('config_pre_action')) {
foreach ($config->get('config_pre_action') as $action) {
$controller->addPreAction(new Action($action));
}
}
// Dispatch
$controller->dispatch(new Action('action/route'), new Action('error/not_found'));
// Output
$response->output();
示例7: Weight
// Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// User
$registry->set('user', new User($registry));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "event");
foreach ($query->rows as $result) {
$event->register($result['trigger'], $result['action']);
}
// Front Controller
$controller = new Front($registry);
// Login
$controller->addPreAction(new Action('common/login/check'));
// Permission
$controller->addPreAction(new Action('error/permission/check'));
// Router
if (isset($request->get['route'])) {
$action = new Action($request->get['route']);
} else {
$action = new Action('common/dashboard');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例8: Language
$config->set('config_language_id', $languages[$config->get('config_admin_language')]['language_id']);
$language = new Language($languages[$config->get('config_admin_language')]['directory']);
$language->load($languages[$config->get('config_admin_language')]['filename']);
$registry->set('language', $language);
// Currency
$currency = new Currency($registry);
// always RU
$currency->set('RUB');
//$symbol_right = trim($currency->getSymbolRight('RUB'));
//$currency->setSymbolRight('RUB', '<span class="ru"> Б</span>');
$registry->set('currency', $currency);
// Tax
$registry->set('tax', new Tax($registry));
// Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
// Front Controller
$controller = new Front($registry);
//require_once(DIR_APPLICATION . 'controller/feed/yandex_yml.php');
//$controller = new ControllerFeedYandexYml($registry);
// SEO URL's
if (!($seo_type = $config->get('config_seo_url_type'))) {
$seo_type = 'seo_url';
}
$controller->addPreAction(new Action('common/' . $seo_type));
$action = new Action('feed/yandex_yml3/savetofile', array(dirname(__FILE__) . '/yandex_yml3.xml'));
$controller->dispatch($action, '');
//$controller->saveToFile(dirname(__FILE__).'/yandex_yml.xml');
示例9: Url
// Url
Registry::set('url', new Url());
// Document
Registry::set('document', new Document());
// Language
$language = new Language($config->get('config_admin_language'));
Registry::set('language', $language);
// Currency
Registry::set('currency', new Currency());
// Weight
Registry::set('weight', new Weight());
// Measurement
Registry::set('measurement', new Measurement());
// User
Registry::set('user', new User());
// Front Controller
$controller = new Front();
// Login
$controller->addPreAction(new Router('common/login/check'));
// Permission
$controller->addPreAction(new Router('common/permission/check'));
// Router
if (isset($request->get['route'])) {
$action = new Router($request->get['route']);
} else {
$action = new Router('common/home');
}
// Dispatch
$controller->dispatch($action, new Router('error/not_found'));
// Output
$response->output();
示例10: Cart
// Cart
$registry->set('cart', new Cart($registry));
// Encryption
$registry->set('encryption', new Encryption($config->get('config_encryption')));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "event");
foreach ($query->rows as $result) {
$event->register($result['trigger'], $result['action']);
}
// Front Controller
$controller = new Front($registry);
// Check Login
$controller->addPreAction(new Action('account/login/check'));
// Maintenance Mode
$controller->addPreAction(new Action('common/maintenance'));
// SEO URL's
$controller->addPreAction(new Action('common/seo_url'));
// Router
if (isset($request->get['route'])) {
$action = new Action($request->get['route']);
} else {
$action = new Action('common/home');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例11: Openbay
// Currency
$registry->set('currency', new Cart\Currency($registry));
// Weight
$registry->set('weight', new Cart\Weight($registry));
// Length
$registry->set('length', new Cart\Length($registry));
// User
$registry->set('user', new Cart\User($registry));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM `" . DB_PREFIX . "event` WHERE `trigger` LIKE 'admin/%'");
foreach ($query->rows as $result) {
$event->register(substr($result['trigger'], strrpos($result['trigger'], '/') + 1), new Action($result['action']));
}
// Front Controller
$controller = new Front($registry);
// Error Handling
$controller->addPreAction(new Action('event/error'));
// Compile Sass
$controller->addPreAction(new Action('event/sass'));
// Login
$controller->addPreAction(new Action('event/login'));
// Permission
$controller->addPreAction(new Action('event/permission'));
// Dispatch
$controller->dispatch(new Action('event/route'), new Action('error/not_found'));
// Output
$response->output();
示例12: Security
$registry->set('protocol', $protocol);
//security
$registry->set('security', new Security());
//url
$url = new Url(HTTP_SERVER);
$registry->set('url', $url);
// Cache
$cache = new Cache('file');
$registry->set('cache', $cache);
//token
$token = new Token();
$registry->set('token', $token);
//statistik
$statistik = new statistik($registry);
$registry->set('statistik', $statistik);
//click counter
$counter = new counter($registry);
$registry->set('counter', $counter);
//loader
$loader = new loader($registry);
$registry->set('load', $loader);
$front = new Front($registry);
$front->addPreAction(new action('login/check'));
$front->addPreAction(new action('permission/check'));
if (isset($request->get['url'])) {
$action = new action($request->get['url']);
} else {
$action = new action('home/index');
}
$front->dispatch($action, new action('error/index'));
$response->output();
示例13: Encryption
$registry->set('weight', new Cart\Weight($registry));
// Length
$registry->set('length', new Cart\Length($registry));
// Cart
$registry->set('cart', new Cart\Cart($registry));
// Encryption
$registry->set('encryption', new Encryption($config->get('config_encryption')));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
// Template Override
$event->register('view/*/before', new Action('event/template'));
// Add events from the DB
$query = $db->query("SELECT * FROM `" . DB_PREFIX . "event` WHERE `trigger` LIKE 'catalog/%'");
foreach ($query->rows as $result) {
$event->register(substr($result['trigger'], strpos($result['trigger'], '/') + 1), new Hook($result['action']));
}
// Front Controller
$controller = new Front($registry);
// Maintenance Mode
$controller->addPreAction(new Action('event/maintenance'));
// SEO URL's
$controller->addPreAction(new Action('event/seo_url'));
// Error Handling
$controller->addPreAction(new Action('common/error'));
// Dispatch
$controller->dispatch(new Action('event/route'), new Action('error/not_found'));
// Output
$response->output();
示例14: Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// User
$registry->set('user', new User($registry));
$registry->set('merchant', new Merchant($registry));
//OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "event");
foreach ($query->rows as $result) {
$event->register($result['trigger'], $result['action']);
}
// Front Controller
$controller = new Front($registry);
// Login
$controller->addPreAction(new Action('merchant/login/check'));
// Permission
$controller->addPreAction(new Action('error/permission/check'));
// Router
if (isset($request->get['route'])) {
$action = new Action($request->get['route']);
} else {
$action = new Action('common/dashboard');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
示例15: Openbay
// Length
$registry->set('length', new Cart\Length($registry));
// User
$registry->set('user', new Cart\User($registry));
// OpenBay Pro
$registry->set('openbay', new Openbay($registry));
// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM `" . DB_PREFIX . "event` WHERE `trigger` LIKE 'admin/%'");
foreach ($query->rows as $result) {
$event->register(substr($result['trigger'], strrpos($result['trigger'], '/') + 1), new Action($result['action']));
}
// Front Controller
$controller = new Front($registry);
// Compile Sass
$controller->addPreAction(new Action('override/sass'));
// Login
$controller->addPreAction(new Action('override/login'));
// Permission
$controller->addPreAction(new Action('override/permission'));
// Router
if (isset($request->get['route'])) {
$action = new Action($request->get['route']);
} else {
$action = new Action('common/dashboard');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();