本文整理汇总了PHP中Router::GetActionEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::GetActionEvent方法的具体用法?PHP Router::GetActionEvent怎么用?PHP Router::GetActionEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Router
的用法示例。
在下文中一共展示了Router::GetActionEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Init
public function Init()
{
$this->Viewer_SetResponseAjax(true);
$this->sEvent = Router::GetActionEvent();
//$this->SetDefaultEvent($this->sEvent);
$this->SetDefaultEvent('file');
}
示例2: ExecEvent
/**
* Запускает евент на выполнение
* Если текущий евент не определен то запускается тот которые определен по умолчанию(default event)
*
* @return unknown
*/
public function ExecEvent()
{
$this->sCurrentEvent = Router::GetActionEvent();
if ($this->sCurrentEvent == null) {
$this->sCurrentEvent = $this->GetDefaultEvent();
Router::SetActionEvent($this->sCurrentEvent);
}
foreach ($this->aRegisterEvent as $aEvent) {
if (preg_match($aEvent['preg'], $this->sCurrentEvent, $aMatch)) {
$this->aParamsEventMatch['event'] = $aMatch;
$this->aParamsEventMatch['params'] = array();
foreach ($aEvent['params_preg'] as $iKey => $sParamPreg) {
if (preg_match($sParamPreg, $this->GetParam($iKey, ''), $aMatch)) {
$this->aParamsEventMatch['params'][$iKey] = $aMatch;
} else {
continue 2;
}
}
$sCmd = '$result=$this->' . $aEvent['method'] . '();';
$this->Hook_Run("action_event_" . strtolower($this->sCurrentAction) . "_before", array('event' => $this->sCurrentEvent, 'params' => $this->GetParams()));
eval($sCmd);
$this->Hook_Run("action_event_" . strtolower($this->sCurrentAction) . "_after", array('event' => $this->sCurrentEvent, 'params' => $this->GetParams()));
return $result;
}
}
return $this->EventNotFound();
}
示例3: RegisterHook
public function RegisterHook()
{
if (ACE::IsMobile()) {
return;
}
if (Config::Get('plugin.' . $this->sPlugin . '.skin')) {
$this->sSkinName = Config::Get('plugin.' . $this->sPlugin . '.skin');
}
Config::Set('path.admin.skin', '___path.root.web___/plugins/aceadminpanel/templates/skin/admin_' . $this->sSkinName);
$sActionEvent = Router::GetActionEvent();
if (Router::GetAction() == 'admin') {
if (Config::Get('plugin.aceadminpanel.compatible.default') == 'compatible') {
$bCompatible = !in_array($sActionEvent, ACE::Str2Array(Config::Get('plugin.aceadminpanel.autonomous.events')));
} else {
$bCompatible = (!$sActionEvent or in_array($sActionEvent, $this->aCompatibleEvents) or in_array($sActionEvent, ACE::Str2Array(Config::Get('plugin.aceadminpanel.compatible.events'))));
}
if ($bCompatible) {
$this->_preInit();
}
}
$this->_checkSkinDir();
$this->AddHook('engine_init_complete', 'EngineInitComplete', __CLASS__, 1000);
$this->AddHook('init_action', 'InitAction', __CLASS__, 1000);
$this->AddHook('template_html_head_end', 'HtmlHeadEnd', __CLASS__);
$this->AddHook('template_statistics_performance_item', 'TplStatisticsPerformanceItem', __CLASS__);
$this->AddHook('template_profile_sidebar_end', 'TplProfileSidebarEnd', __CLASS__);
}
示例4: _EventPluginsMenu
protected function _EventPluginsMenu()
{
$this->PluginDelBlock('right', 'AdminInfo');
$sEvent = Router::GetActionEvent();
if (isset($this->aExternalEvents[$sEvent])) {
return $this->EventPluginsExec($this->aExternalEvents[$sEvent]);
}
}
示例5: ShutdownAddRating
public function ShutdownAddRating($aParams)
{
$aBonuses = Config::Get('plugin.ratingbonus.action_bonus');
$oCurrentUser = $this->User_GetUserCurrent();
if (isset($oCurrentUser)) {
if (isset($aBonuses[Router::GetActionEvent()]) && isset($aBonuses[Router::GetActionEvent()][Router::GetActionEventName()])) {
$sTag = Router::GetActionEvent() . '_' . Router::GetActionEventName();
$oCurrentUser = $this->PluginRatingbonus_Ratingbonus_AddBonus($oCurrentUser, $sTag, $aBonuses[Router::GetActionEvent()][Router::GetActionEventName()]);
}
$this->User_Update($oCurrentUser);
}
}
示例6: WriteActionCounter
public function WriteActionCounter($aParams)
{
$sAction = Router::GetAction();
$sEvent = Router::GetActionEvent();
if (!$sEvent) {
$sEvent = 'default';
}
$oUser = $this->User_GetUserCurrent();
if ($oUser) {
$this->PluginBotchecker_Botchecker_writeActionCounter($oUser, $sAction, $sEvent);
}
}
示例7: EventIndex
protected function EventIndex()
{
$sLanguage = Router::GetActionEvent();
if ($sLanguage) {
$this->Session_Set('language', $sLanguage);
if (Config::Get('plugin.aceadminpanel.lang_save_period')) {
@setcookie('LANG_CURRENT', $sLanguage, time() + 60 * 60 * 24 * intVal(Config::Get('plugin.aceadminpanel.lang_save_period')), Config::Get('sys.cookie.path'), Config::Get('sys.cookie.host'));
}
if (isset($_SERVER['HTTP_REFERER'])) {
func_header_location($_SERVER['HTTP_REFERER']);
}
}
func_header_location(Config::Get('path.root.web'));
}
示例8: CheckUserRights
/**
* Check user rights
*
* @return booblean
*/
protected function CheckUserRights()
{
$oUser = $this->User_GetUserCurrent();
//Current user
// если необходимо - можно будет вынести в конфиг список Events, доступ к которым необходим всем
if (Router::GetActionEvent() == 'redirect') {
return true;
}
if (!$oUser || !$oUser->isAdministrator()) {
//Test user rigts
return false;
}
return true;
}
示例9: CheckSearch
public function CheckSearch($aVars)
{
if (!MYSEARCH_HOOK_ENABLE) {
return;
}
if (Router::GetAction() == 'search') {
if (getRequest('q') && isset($_SERVER["HTTP_REFERER"]) && preg_match('|/search/(\\w+)/|', $_SERVER["HTTP_REFERER"], $m)) {
$sActionEvent = $m[1];
} else {
$sActionEvent = Router::GetActionEvent();
}
Router::Action('mysearch', $sActionEvent, Router::GetParams());
}
}
示例10: Init
public function Init()
{
$this->sCurrentEvent = Router::GetActionEvent();
if ($result = parent::Init()) {
return $result;
}
if ($this->User_IsAuthorization()) {
$this->oUserCurrent = $this->PluginAceadminpanel_Admin_GetUserCurrent();
}
if (!$this->oUserCurrent or !$this->oUserCurrent->isAdministrator()) {
return $this->EventDenied();
}
if (!$this->oUserCurrent) {
$this->oUserCurrent = $this->User_GetUserCurrent();
}
$this->Viewer_Assign('ROUTE_PAGE_ADMIN', ROUTE_PAGE_ADMIN);
$this->Viewer_Assign('sModuleVersion', $this->PluginAceadminpanel_Admin_getVersion(true));
$this->_InitParams();
$this->aConfig = array_merge($this->aConfig, HelperPlugin::GetConfig());
if (Config::Get('plugin.avalogs.admin_file') and Config::Get('plugin.avalogs.admin_enable')) {
if (!$this->oLogs) {
$this->oLogs = $this->Adminlogs_GetLogs();
}
$this->oLogs->SetLogOptions('admin', array('file' => Config::Get('plugin.avalogs.admin_file')));
$this->aLogsMsg[] = 'user=>' . $this->oUserCurrent->GetLogin() . ', ip=>' . $_SERVER["REMOTE_ADDR"] . ', action=>' . Router::GetAction() . ', event=>' . Router::GetActionEvent() . ', path=>' . Router::GetPathWebCurrent();
}
$this->sPageRef = ACE::Backward('url');
if (ACE::Backward('action') == Router::GetAction()) {
$this->sFormAction = $this->sPageRef;
}
//$this->_PluginSetTemplate(Router::GetActionEvent());
$this->sMenuItemSelect = Router::GetActionEvent();
$this->sMenuSubItemSelect = Router::GetParam(0);
$sVerion = HelperPlugin::GetConfig('version');
if (!$sVerion) {
$sVerion = ACEADMINPANEL_VERSION . '.' . ACEADMINPANEL_VERSION_BUILD;
}
if (preg_match('|[a-z\\-]+|i', $sVerion, $m)) {
$sVerion = str_replace($m[0], '', $sVerion) . $m[0];
}
$this->aPluginInfo = array('version' => $sVerion);
$sHtmlTitle = $this->Lang_Get('adm_title') . ' v.' . $this->PluginAceadminpanel_Admin_getVersion();
//$this->Viewer_AddTemplateDir(HelperPlugin::GetTemplatePath(), true);
$this->Viewer_AddHtmlTitle($sHtmlTitle);
$this->Viewer_Assign('sAdminTitle', 'aceAdminPanel v.' . $this->PluginAceadminpanel_Admin_getVersion());
}
示例11: Init
/**
* Инициализация
*
*/
public function Init()
{
/**
* Если включены инвайты то перенаправляем на страницу регистрации по инвайтам
*/
if (!$this->User_IsAuthorization() and Config::Get('general.reg.invite') and in_array(Router::GetActionEvent(), array('register', 'ajax-register')) and !$this->CheckInviteRegister()) {
return Router::Action('auth', 'invite');
}
/**
* Устанавливаем дефолтный евент
*/
$this->SetDefaultEvent('login');
/**
* Отключаем отображение статистики выполнения
*/
Router::SetIsShowStats(false);
}
示例12: Init
/**
* Инициализация
*
* @return unknown
*/
public function Init()
{
/**
* Проверяем аторизован ли юзер
*/
if ($this->User_IsAuthorization()) {
$this->Message_AddErrorSingle($this->Lang_Get('registration_is_authorization'), $this->Lang_Get('attention'));
return Router::Action('error');
}
/**
* Если включены инвайты то перенаправляем на страницу регистрации по инвайтам
*/
if (!$this->User_IsAuthorization() and Config::Get('general.reg.invite') and !in_array(Router::GetActionEvent(), array('invite', 'activate', 'confirm')) and !$this->CheckInviteRegister()) {
return Router::Action('registration', 'invite');
}
$this->SetDefaultEvent('index');
$this->Viewer_AddHtmlTitle($this->Lang_Get('registration'));
}
示例13: RegisterHook
public function RegisterHook()
{
if (Config::Get('plugin.' . $this->sPlugin . '.skin')) {
$this->sSkinName = Config::Get('plugin.' . $this->sPlugin . '.skin');
}
Config::Set('path.admin.skin', '___path.root.web___/plugins/aceadminpanel/templates/skin/admin_' . $this->sSkinName);
$sActionEvent = Router::GetActionEvent();
if (Router::GetAction() == 'admin') {
if (Config::Get('plugin.aceadminpanel.compatible.default') == 'compatible') {
$bCompatible = !in_array($sActionEvent, ACE::Str2Array(Config::Get('plugin.aceadminpanel.autonomous.events')));
} else {
$bCompatible = (!$sActionEvent or in_array($sActionEvent, $this->aCompatibleEvents) or in_array($sActionEvent, ACE::Str2Array(Config::Get('plugin.aceadminpanel.compatible.events'))));
}
if ($bCompatible) {
$this->_preInit();
}
}
$this->AddHook('engine_init_complete', 'EngineInitComplete', __CLASS__, 1000);
$this->AddHook('init_action', 'InitAction', __CLASS__, 1000);
$this->AddHook('template_html_head_end', 'HtmlHeadEnd', __CLASS__);
$this->AddHook('template_body_end', 'MemoryStats', __CLASS__);
}
示例14: EventSeopackEdit
protected function EventSeopackEdit()
{
$this->sMainMenuItem = 'content';
$this->_setTitle(E::ModuleLang()->Get('plugin.seopack.seopack_title'));
if (F::isPost('submit_seopack_save')) {
$this->SubmitSaveSeopack();
}
E::ModuleViewer()->Assign('sMode', str_replace('seopack', '', Router::GetActionEvent()));
if (Router::GetActionEvent() == 'seopackedit') {
if ($oSeopack = E::ModuleSeopack()->GetSeopackBySeopackId($this->GetParam(0))) {
if (!F::isPost('submit_seopack_save')) {
$_REQUEST['url'] = $oSeopack->getUrl();
$_REQUEST['title'] = $oSeopack->getTitle();
$_REQUEST['description'] = $oSeopack->getDescription();
$_REQUEST['keywords'] = $oSeopack->getKeywords();
$_REQUEST['seopack_id'] = $oSeopack->getSeopackId();
}
} else {
E::ModuleMessage()->AddError(E::ModuleLang()->Get('plugin.seopack.seopack_edit_notfound'), E::ModuleLang()->Get('error'));
$this->SetParam(0, null);
}
}
$this->SetTemplateAction('seopack_edit');
}
示例15: BuildBlocks
/**
* Анализируем правила и наборы массивов
* получаем окончательные списки блоков
*/
protected function BuildBlocks()
{
$sAction = strtolower(Router::GetAction());
$sEvent = strtolower(Router::GetActionEvent());
foreach ($this->aBlockRules as $sName => $aRule) {
$bUse = false;
/**
* Если в правиле не указан список блоков, нам такое не нужно
*/
if (!array_key_exists('blocks', $aRule)) {
continue;
}
/**
* Если не задан action для исполнения и нет ни одного шаблона path,
* или текущий не входит в перечисленные в правиле
* то выбираем следующее правило
*/
if (!array_key_exists('action', $aRule) && !array_key_exists('path', $aRule)) {
continue;
}
if (isset($aRule['action'])) {
if (in_array($sAction, (array) $aRule['action'])) {
$bUse = true;
}
if (array_key_exists($sAction, (array) $aRule['action'])) {
/**
* Если задан список event`ов и текущий в него не входит,
* переходи к следующему действию.
*/
foreach ((array) $aRule['action'][$sAction] as $sEventPreg) {
if (substr($sEventPreg, 0, 1) != '/') {
/**
* значит это название event`a
*/
if ($sEvent == $sEventPreg) {
$bUse = true;
break;
}
} else {
/**
* это регулярное выражение
*/
if (preg_match($sEventPreg, $sEvent)) {
$bUse = true;
break;
}
}
}
}
}
/**
* Если не найдено совпадение по паре Action/Event,
* переходим к поиску по regexp путей.
*/
if (!$bUse && isset($aRule['path'])) {
$sPath = rtrim(Router::GetPathWebCurrent(), "/");
/**
* Проверяем последовательно каждый regexp
*/
foreach ((array) $aRule['path'] as $sRulePath) {
$sPattern = "~" . str_replace(array('/', '*'), array('\\/', '[\\w\\-]+'), $sRulePath) . "~";
if (preg_match($sPattern, $sPath)) {
$bUse = true;
break 1;
}
}
}
if ($bUse) {
/**
* Если задан режим очистки блоков, сначала чистим старые блоки
*/
if (isset($aRule['clear'])) {
switch (true) {
/**
* Если установлен в true, значит очищаем все
*/
case $aRule['clear'] === true:
$this->ClearBlocksAll();
break;
case is_string($aRule['clear']):
$this->ClearBlocks($aRule['clear']);
break;
case is_array($aRule['clear']):
foreach ($aRule['clear'] as $sGroup) {
$this->ClearBlocks($sGroup);
}
break;
}
}
/**
* Добавляем все блоки, указанные в параметре blocks
*/
foreach ($aRule['blocks'] as $sGroup => $aBlocks) {
foreach ((array) $aBlocks as $sName => $aParams) {
/**
* Если название блока указывается в параметрах
//.........这里部分代码省略.........