本文整理汇总了PHP中load::handler方法的典型用法代码示例。如果您正苦于以下问题:PHP load::handler方法的具体用法?PHP load::handler怎么用?PHP load::handler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类load
的用法示例。
在下文中一共展示了load::handler方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
function start()
{
db::connect();
if (!router::get(1)) {
return true;
}
self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2), 'id' => router::get(4));
s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR);
define('APP', APPS . self::get('app') . '/');
s::set('APP', APP);
define('MODULE', APP . self::get('module') . '/');
s::set('MODULE', MODULE);
if (stristr(self::$map['mode'], 'admin')) {
self::$map['mode'] = 'admin';
} else {
self::$map['mode'] = 'web';
}
if (self::$map['mode'] == 'admin') {
if (defined('ADMIN_USER_SITE_ID')) {
admin::observer();
define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
db::table('admin_sites');
db::where('site_id', ADMIN_USER_SITE_ID);
db::limit(1);
$row = db::select();
define('ADMIN_SITE', db::get('site_domain'));
s::set('ADMIN_SITE', ADMIN_SITE);
}
} else {
web::getSite();
$lang = lang::gets(LANG_INDEX, SITE_ID);
/*
Authentification webUser
*/
web::observer();
}
/*
Set params
*/
params::send();
if (router::get(0) == 'feed' || router::get(0) == 'rss') {
self::$map['module'] = 'feed';
}
if (self::$map['mode'] == 'admin') {
load::module(self::get('app'), self::get('module'), self::get('action'));
} else {
load::handler(self::get('app'), self::get('module'), self::get('action'));
}
}
示例2: observer
function observer($mode = false)
{
foreach (self::$handles as $k => $v) {
foreach ($v as $d => $f) {
if (self::$handles[$k][$d]['work']) {
continue;
}
if (self::detect($k)) {
params::send(self::gets());
unset($_POST[$k], $_GET[$k]);
self::$events[$k] = true;
self::$handles[$k]['work'] = true;
if ($f['handler']) {
load::handler($f['app'], $f['module'], $f['action']);
} else {
load::module($f['app'], $f['module'], $f['action']);
}
}
}
}
}
示例3: start
function start()
{
db::connect();
if (!router::get(1)) {
return true;
}
self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2));
if (router::get(3)) {
self::set('module', router::get(2));
self::set('action', router::get(3));
}
s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR);
define('APP', APPS . self::get('app') . '/');
s::set('APP', APP);
define('MODULE', APP . self::get('module') . '/');
s::set('MODULE', MODULE);
/*
Lang items
*/
if (self::get('mode') == 'webAjax') {
web::getSite();
$lang = lang::gets(LANG_INDEX, SITE_ID);
/*
Authentification webUser
*/
web::observer();
} else {
define('LANG_INDEX', SYS_INDEX);
$lang = lang::gets(LANG_INDEX);
admin::observer();
if (defined('ADMIN_USER_SITE_ID')) {
define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
$group_rules = ini::parse(SYS_ROOT . 'conf/admin/groups.ini', ADMIN_USER_GROUP_ID);
define('RULE', $group_rules['rule']);
db::table('admin_sites');
db::where('site_id', ADMIN_USER_SITE_ID);
db::limit(1);
define('ADMIN_SITE', db::get('site_domain'));
s::set('ADMIN_SITE', ADMIN_SITE);
}
}
/*
Set params
*/
params::send();
$tmpl = params::get('tmpl');
$sys = false;
if (self::get('mode') == 'adminAjax') {
$sys = true;
}
buffer::init(0, self::get('app'), false, $tmpl);
if (self::get('mode') == 'webAjax') {
load::handler(self::get('app'), self::get('module'), self::get('action'));
} else {
load::module(self::get('app'), self::get('module'), self::get('action'));
}
/*
Get plugin action
*/
ob_start();
/*
запуск обработчика с возвратом данных
тут два варианта либо данные просто выводим если нет шаблона, а если есть то сначала обрабатываем шаблон
если буффер полный выводим информацию из него
*/
$buffer = buffer::gets();
if ($buffer[0]) {
if ($sys) {
buffer::$module = self::get('module');
}
$section = params::get('section');
echo buffer::get($buffer[0]['app'], $buffer[0]['tmpl'], $buffer[0]['data'], $section, $sys);
}
$code = ob_get_contents();
ob_clean();
s::$mode = 'code';
s::setTmpl($code, $lang);
s::display();
}
示例4: getHandlers
function getHandlers($code)
{
self::$code = $code;
self::analyse();
foreach (self::$handlers as $k => $v) {
buffer::init($k, $v['app'], $v['replace'], $v['tmpl']);
if (isset($v['params'])) {
params::send($v['params']);
}
load::handler($v['app'], $v['module'], $v['action']);
}
self::setHandlers();
if (self::$handlers_repeat) {
foreach (self::$handlers_repeat as $k => $v) {
buffer::init($k, $v['app'], $v['replace'], $v['tmpl']);
if (isset($v['params'])) {
params::send($v['params']);
}
load::handler($v['app'], $v['module'], $v['action']);
}
self::setHandlersRepeat();
}
return self::$code;
}
示例5: start
function start()
{
/*
Test cache
*/
if (GLOBAL_CACHE == true) {
cache::get();
}
/*
Auth observer
*/
self::observerLogout('weblogoff');
db::connect();
/*
Get site info
*/
self::getSite();
/*
Get lang
*/
$lang = lang::gets(LANG_INDEX, SITE_ID);
define('GUI_STYLE', 'http://' . SERVER . SYS_DIR . 'gui/' . SYS_STYLE);
s::set('FACE_PATH', GUI_STYLE);
s::set('SYS_DIR', SYS_DIR);
s::set('SITE', SITE);
s::set('NOW_YEAR', date('Y'));
/*
Links with links for this page and parents pages
*/
self::$page_tree = self::getThisPageTree();
/*
Pages with pages parents
*/
self::loadPageData();
/*
Page handler events
*/
if (self::get('page_handler') == '1') {
self::getHandlerEvents(self::$page['page_folder'], URI_SELF);
define('PAGE_HANDLER', true);
} else {
define('PAGE_HANDLER', false);
self::$page['this'] = arrays::lastValue(explode('/', urldecode(string::clearBoth(URI_SELF))));
}
/*
Page cache
*/
define('PAGE_CACHE_ALL', false);
define('PAGE_CACHE', false);
define('PAGE_CACHE_TIME', 2);
if (PAGE_CACHE == true && GLOBAL_CACHE == false) {
if (PAGE_CACHE_ALL == true) {
self::set('page_cache', '1');
}
if (self::get('page_cache') == '1') {
cache::get();
}
}
/*
Main page analyse
*/
if (empty(router::$sections[0])) {
define('MAIN_PAGE', true);
} else {
define('MAIN_PAGE', false);
}
/*
Error 404
*/
if (self::getError404() || isset($_SESSION['E404'])) {
unset($_SESSION['E404']);
load::handler('pages', 'main', 'view404');
}
/*
Set page variables
*/
self::$page = self::pageSettings(self::$page);
s::set(self::$page);
define('PAGE_ID', self::get('page_id'));
s::set('PAGE_ID', PAGE_ID);
/*
Set tmpl
*/
self::$site_tmpl = self::get('tmpl_file');
/*
Authentification adminUser
*/
self::$jip = false;
if (isset($_SESSION['ADMIN_AUTH'])) {
//adminUser::update('site_id', SITE_ID, $_SESSION['ADMIN_USER_ID']);
adminUser::load($_SESSION['ADMIN_USER_ID']);
if (settings::get('pages', 'jip') == '1') {
self::$jip = true;
}
}
/*
Authentification webUser
*/
self::observer();
/*
//.........这里部分代码省略.........
示例6: view
function view()
{
/*
Block conf
*/
$block_conf = conf::parse('blocks');
$blocks = array();
db::table('blocks');
db::where('block_pub', 1);
db::where('site_id', SITE_ID);
$res = db::select('block_id', 'block_name', 'block_code', 'block_title');
while ($row = mysql_fetch_assoc($res)) {
$blocks[$row['block_id']] = $row;
}
foreach ($blocks as $k => $row) {
if ($block_conf) {
/*
Block pages
*/
$block_conf_pages_in = conf::get('blocks', 'in', $k);
$block_conf_pages_out = conf::get('blocks', 'out', $k);
if (!conf::testPages($block_conf_pages_out)) {
if (in_array(PAGE_ID, $block_conf_pages_out)) {
$row['block_code'] = false;
continue;
}
} else {
if (!conf::testPages($block_conf_pages_in)) {
if (!in_array(PAGE_ID, $block_conf_pages_in)) {
$row['block_code'] = false;
continue;
}
}
}
/*
Block events
*/
if (conf::get('blocks', 'events', $k)) {
foreach (conf::get('blocks', 'events', $k) as $v) {
$arr = explode('::', trim($v));
if (events::targetDetect($arr[0], $arr[1], $arr[2])) {
if ($arr[3] == 'replace') {
if (isset($blocks[$arr[4]])) {
$row['block_code'] = $blocks[$arr[4]]['block_code'];
}
} else {
if ($arr[3] == 'handler') {
load::handler($arr[4], $arr[5], $arr[6]);
} else {
if ($arr[3] == 'hide') {
$row['block_code'] = false;
}
}
}
} else {
if ($arr[3] == 'show') {
$row['block_code'] = false;
}
}
}
}
/*
Block handlers
*/
if (conf::get('blocks', 'methods', $k)) {
foreach (conf::get('blocks', 'methods', $k) as $v) {
$arr = explode('::', trim($v));
if (count($arr) == 3) {
load::handler($arr[0], $arr[1], $arr[2]);
}
}
}
if ($row['block_code'] !== false) {
s::set($row['block_name'], $row['block_code']);
} else {
s::set($row['block_name'], '');
}
/*
Block JIP
*/
if ($row['block_code'] !== false) {
if (!empty($row['block_title'])) {
$name = $row['block_title'];
} else {
$name = $row['block_name'];
}
s::roll('legenda_jip_blocks', array('path' => 'http://' . SITE . SYS_DIR . 'blocks/main/edit/' . $row['block_id'] . '/', 'name' => $name));
}
}
}
}