diff --git a/application/classes/hooks/HookMain.class.php b/application/classes/hooks/HookMain.class.php index 9bcf9f54..e60fc3a3 100644 --- a/application/classes/hooks/HookMain.class.php +++ b/application/classes/hooks/HookMain.class.php @@ -33,10 +33,12 @@ class HookMain extends Hook public function RegisterHook() { $this->AddHook('init_action', 'InitAction', __CLASS__, 1000); + $this->AddHook('start_action', 'StartAction', __CLASS__, 1000); } /** * Обработка хука инициализации экшенов + * Может выполняться несколько раз, например, при использовании внутренних реврайтов */ public function InitAction() { @@ -47,15 +49,76 @@ class HookMain extends Hook if (!$oUserCurrent and Config::Get('general.close') and !Router::CheckIsCurrentAction((array)Config::Get('general.close_exceptions'))) { Router::Action('auth/login'); } - $this->LoadDefaultJsVar(); + } + + /** + * Обработка запуска экшена + * Выполняется всегда только один раз + */ + public function StartAction() + { + $this->LoadDefaultJsVarAndLang(); /** * Запуск обработки сборщика */ $this->Ls_SenderRun(); } - public function LoadDefaultJsVar() + /** + * Загрузка необходимых переменных и текстовок в шаблон + */ + public function LoadDefaultJsVarAndLang() { - $this->Viewer_AssignJs('recaptcha.site_key', Config::Get('module.validate.recaptcha.site_key')); + /** + * Загружаем JS переменные + */ + $this->Viewer_AssignJs( + array( + 'recaptcha.site_key' => Config::Get('module.validate.recaptcha.site_key'), + 'comment_max_tree' => Config::Get('module.comment.max_tree'), + 'comment_show_form' => Config::Get('module.comment.show_form'), + 'topic_max_blog_count' => Config::Get('module.topic.max_blog_count'), + 'block_stream_show_tip' => Config::Get('block.stream.show_tip'), + 'poll_max_answers' => Config::Get('module.poll.max_answers'), + ) + ); + + /** + * Загрузка языковых текстовок + */ + $this->Lang_AddLangJs(array( + 'comments.comments_declension', + 'comments.unsubscribe', + 'comments.subscribe', + 'comments.folding.unfold', + 'comments.folding.fold', + 'comments.folding.unfold_all', + 'comments.folding.fold_all', + 'poll.notices.error_answers_max', + 'blog.blog', + 'favourite.add', + 'favourite.remove', + 'field.geo.select_city', + 'field.geo.select_region', + 'blog.add.fields.type.note_open', + 'blog.add.fields.type.note_close', + 'common.success.add', + 'common.success.remove', + 'pagination.notices.first', + 'pagination.notices.last', + 'user.actions.unfollow', + 'user.actions.follow', + 'user.friends.status.added', + 'user.friends.status.notfriends', + 'user.friends.status.pending', + 'user.friends.status.rejected', + 'user.friends.status.sent', + 'user.friends.status.linked', + 'blog.blocks.navigator.blog', + 'user.settings.profile.notices.error_max_userfields', + 'common.remove_confirm', + 'more.empty', + 'validate.tags.count' + )); } } \ No newline at end of file diff --git a/application/frontend/skin/developer/layouts/layout.base.tpl b/application/frontend/skin/developer/layouts/layout.base.tpl index a2025261..32463c7d 100644 --- a/application/frontend/skin/developer/layouts/layout.base.tpl +++ b/application/frontend/skin/developer/layouts/layout.base.tpl @@ -24,14 +24,7 @@ {block 'layout_head' append} {** diff --git a/framework b/framework index 02a94670..ef81022a 160000 --- a/framework +++ b/framework @@ -1 +1 @@ -Subproject commit 02a946708f5b3c0c21c0f7b251a2e26b2ea9f057 +Subproject commit ef81022a97a3233a18d6a87c08c5160daab3c007