protected function executeImpl(ArrayAdapter $params) { $fav = $params->bool('fav'); $type = $params->str('type'); $ident = $params->str('ident'); PopupPagesManager::inst()->toggleUserPopup($fav, $type, $ident); return new AjaxSuccess(); }
public static function afterUserRegistered(PsUser $user) { //Отправим приветственное сообщение MSG_UserRegistered::inst()->sendSystemMsg($user); //Дадим очки за регистрацию UP_registration::inst()->givePoints($user); //Привяжем ему набор дефолтных страниц - плагинов PopupPagesManager::inst()->bindDefaultPages2User($user->getId()); }
protected function doBuild(PageContext $ctxt, PageBuilderContext $builderCtxt, RequestArrayAdapter $requestParams, ArrayAdapter $buildParams) { //1. ЗАГОЛОВОК $builderCtxt->setTitle($this->popupPage->getTitle()); //2. JAVASCRIPT $builderCtxt->setJsParams($this->popupPage->getJsParams()); //3. SMARTY RESOURCES $builderCtxt->setSmartyParam4Resources('IDENT', $this->popupPage->getIdent()); $builderCtxt->setSmartyParam4Resources('MATHJAX_DISABLE', true); $builderCtxt->setSmartyParams4Resources($this->popupPage->getSmartyParams4Resources()); //4. GET SMARTY PARAMS FOR TPL $smartyParams['page'] = $this->popupPage; $smartyParams['content'] = $this->PPM->getPopupPageContent($this->popupPage); $smartyParams['header'] = PopupPagesManager::inst()->isShowPageHeader(); $smartyParams['list'] = $this->popupPage->getIdent() == PP_404::getIdent(); return $smartyParams; }
/** * Основной метод, выполняющий всю работу. * К этому моменту мы уже определили плагин и установили контекст. * Остаётся только построить сам плагин. */ private function buildImpl(BasePlugin $plugin, $content, ArrayAdapter $params) { //Если $content === null, то мы отображаем плагин в popup окне //В противном случае запросим УРЛ для перехода к popup-виду плагина $popupUrl = $content === null ? null : PopupPagesManager::inst()->getPluginUrl($plugin); $ident = $plugin->getIdent(); $content = trim($content); try { $pluginContent = $plugin->getPluginContent($content, $params, PluginFetchingContext::getInstance()); $tpl = PSSmarty::template('psplugins/BASE.tpl'); $tpl->assign('url', $popupUrl); $tpl->assign('ident', $ident); $tpl->assign('content', $this->getResourcesLinks($ident, $pluginContent->getContent())); return $tpl->fetch(); } catch (Exception $e) { //Произошла ошибка... От нас требуется вернуть её текстовое представление, //так как самое важное - отключить контекст выполнения плагина. return ExceptionHandler::getHtml($e); } }
/** * Список фолдингов */ public static function listFoldings() { $managers = array(MagManager::inst(), BlogManager::inst(), TrainManager::inst()); $foldings = array(); foreach ($managers as $manager) { if ($manager instanceof RubricsProcessor) { $foldings[] = $manager->getRubricsFolding(); } if ($manager instanceof PostsProcessor) { $foldings[] = $manager->getFolding(); } } //Фолдинги $foldings[] = PopupPagesManager::inst(); $foldings[] = PluginsManager::inst(); $foldings[] = IdentPagesManager::inst(); $foldings[] = TimeLineManager::inst(); $foldings[] = TemplateMessages::inst(); $foldings[] = UserPointsManager::inst(); $foldings[] = StockManager::inst(); $foldings[] = HelpManager::inst(); $foldings[] = EmailManager::inst(); $foldings[] = PSForm::inst(); $foldings[] = DialogManager::inst(); //Библиотеки $foldings[] = PoetsManager::inst(); $foldings[] = ScientistsManager::inst(); //Админские страницы $foldings[] = APagesResources::inst(); //Базовые страницы $foldings[] = BasicPagesManager::inst(); //Построитель страниц $foldings[] = PageBuilder::inst(); //Управление списком предпросмотра постов $foldings[] = ShowcasesCtrlManager::inst(); //Элементы в правой панели навигации $foldings[] = ClientBoxManager::inst(); //Все фолдинги системы return $foldings; }
private function __construct() { PsProfiler::inst(__CLASS__)->start(__FUNCTION__); //Фолдинги $this->foldings[] = PopupPagesManager::inst(); $this->foldings[] = PluginsManager::inst(); $this->foldings[] = TimeLineManager::inst(); $this->foldings[] = UserPointsManager::inst(); $this->foldings[] = StockManager::inst(); $this->foldings[] = HelpManager::inst(); $this->foldings[] = EmailManager::inst(); $this->foldings[] = PSForm::inst(); $this->foldings[] = DialogManager::inst(); //Библиотеки $this->foldings[] = PoetsManager::inst(); $this->foldings[] = ScientistsManager::inst(); //Админские страницы $this->foldings[] = APagesResources::inst(); /* * Выделим различные подклассы фолдингов */ foreach ($this->foldings as $folding) { //Фолдинги библиотек if ($folding instanceof LibResources) { $this->libs[] = $folding; } //Фолдинги для баблов if ($folding instanceof BubbledFolding) { $this->bubbles[] = $folding; } //Фолдинги, предоставляющие панели if ($folding instanceof PanelFolding) { $this->panels[] = $folding; } } PsProfiler::inst(__CLASS__)->stop(); }
private function __construct() { PsProfiler::inst(__CLASS__)->start(__FUNCTION__); $managers = array(MagManager::inst(), BlogManager::inst(), TrainManager::inst()); foreach ($managers as $manager) { //Соберём типы постов $this->postTypes[] = $manager->getPostType(); if ($manager instanceof RubricsProcessor) { $this->rubricsProcessors[$manager->getPostType()] = $manager; $this->foldings[] = $manager->getRubricsFolding(); } if ($manager instanceof PostsProcessor) { $this->postsProcessors[$manager->getPostType()] = $manager; $this->foldings[] = $manager->getFolding(); } if ($manager instanceof CommentsProcessor) { $this->commentProcessors[$manager->getPostType()] = $manager; $this->discussionControllers[$manager->getDiscussionController()->getDiscussionUnique()] = $manager->getDiscussionController(); } if ($manager instanceof PagePreloadListener) { $this->pagePreloadListeners[] = $manager; } if ($manager instanceof NewsProvider) { $this->newsProviders[$manager->getNewsEventType()] = $manager; } } //Контроллеры дискуссий $this->discussionControllers[FeedbackManager::inst()->getDiscussionUnique()] = FeedbackManager::inst(); //Фолдинги $this->foldings[] = PopupPagesManager::inst(); $this->foldings[] = PluginsManager::inst(); $this->foldings[] = IdentPagesManager::inst(); $this->foldings[] = TimeLineManager::inst(); $this->foldings[] = TemplateMessages::inst(); $this->foldings[] = UserPointsManager::inst(); $this->foldings[] = StockManager::inst(); $this->foldings[] = HelpManager::inst(); $this->foldings[] = EmailManager::inst(); $this->foldings[] = PSForm::inst(); $this->foldings[] = DialogManager::inst(); //Библиотеки $this->foldings[] = PoetsManager::inst(); $this->foldings[] = ScientistsManager::inst(); //Админские страницы $this->foldings[] = APagesResources::inst(); //Базовые страницы $this->foldings[] = BasicPagesManager::inst(); //Построитель страниц $this->foldings[] = PageBuilder::inst(); //Управление списком предпросмотра постов $this->foldings[] = ShowcasesCtrlManager::inst(); //Элементы в правой панели навигации $this->foldings[] = ClientBoxManager::inst(); /* * Выделим различные подклассы фолдингов */ foreach ($this->foldings as $folding) { //Фолдинги библиотек if ($folding instanceof LibResources) { $this->libs[] = $folding; } //Фолдинги обработчиков постов if ($folding instanceof PostFoldedResources) { $this->postProcessorFoldings[] = $folding; } //Фолдинги для баблов if ($folding instanceof BubbledFolding) { $this->bubbles[] = $folding; } //Фолдинги, предоставляющие панели if ($folding instanceof PanelFolding) { $this->panels[] = $folding; } //Фолдинги, финализирующие контент страницы if ($folding instanceof PageFinalizerFolding) { $this->pageFinaliseFoldings[] = $folding; } //Индексированный список фолдингов $this->folding2unique[$folding->getUnique()] = $folding; //Префиксы smarty к фолдингам $this->folding2smartyPrefix[$folding->getSmartyPrefix()] = $folding; //Префиксы классов к фолдингам if ($folding->getClassPrefix()) { $this->folding2classPrefix[$folding->getClassPrefix()] = $folding; } } PsProfiler::inst(__CLASS__)->stop(); }
protected function getPageUrl(array $params = array()) { return PopupPagesManager::inst()->getPageUrl($this, $params); }
public function buildContent() { $pages = PopupPagesManager::inst()->getPagesList(); return $this->getFoldedEntity()->fetchTpl(array('pages' => $pages)); }
/** * Ссылка для открытия акции в отдельном окне */ public function popup() { return PopupPagesManager::inst()->getPageUrl(PP_stock::getIdent(), array(STOCK_IDENT_PARAM => $this->stockIdent)); }
/** * Регистрация страниц SDK */ private function registerSdkFoldings() { $this->register(PopupPagesManager::inst()); $this->register(PluginsManager::inst()); $this->register(TimeLineManager::inst()); $this->register(UserPointsManager::inst()); $this->register(StockManager::inst()); $this->register(HelpManager::inst()); $this->register(EmailManager::inst()); $this->register(PSForm::inst()); $this->register(DialogManager::inst()); $this->register(PageBuilder::inst()); //Библиотеки $this->register(PoetsManager::inst()); $this->register(ScientistsManager::inst()); //Админские страницы $this->register(APagesResources::inst()); }
public function getRequestUrl() { if (!isset($this->requestUrl)) { $this->requestUrl = $this->getPage()->getPath(); $GET_PARAMS = array(); if ($this->isRubricPage()) { $GET_PARAMS[GET_PARAM_RUBRIC_ID] = $this->getRubricId(); } if ($this->isPostPage()) { $GET_PARAMS[GET_PARAM_POST_ID] = $this->getPostId(); } if ($this->isPopupPage()) { $GET_PARAMS = array_merge($GET_PARAMS, PopupPagesManager::inst()->getRequestParams()); } ksort($GET_PARAMS); $this->requestUrl = PsUrl::addParams($this->requestUrl, $GET_PARAMS); } return $this->requestUrl; }
/** * Основной метод, выполняющий построение страницы */ public final function buildPage() { //Проверим, установлена ли эта страница, как текущая check_condition(WebPages::isCurPage($this), "{$this} не установлена, как текущая, и не может быть построена"); //Если у пользователя нет доступа к данной странице - выполним редирект if (!$this->hasAccess()) { $this->redirectHere(); } //Теперь провалидируем установленный контекст $ctxt = PageContext::inst(); check_condition($this->isIt($ctxt->getPage()), PsUtil::getClassName($ctxt) . ' проинициализирован некорректно'); $redirectPage = self::inst(is_numeric($this->pageCodeBase) ? $this->pageCodeBase : BASE_PAGE_INDEX); if ($ctxt->isRubricPage() && !$ctxt->getRubric()) { $redirectPage->redirectHere(); } if ($ctxt->isPostPage() && !$ctxt->getPost()) { $redirectPage->redirectHere(); } if ($ctxt->isPopupPage() && !PopupPagesManager::inst()->isValidPageRequested()) { $redirectPage->redirectHere(); } PageBuilder::inst()->buildPage(); }
{ echo 'X'; } } class Y extends X { function __construct() { //parent::__construct(); } } $y = new Y(); echo PsSecurity::isBasic(); die; ExceptionHandler::registerPretty(); print_r(PopupPagesManager::inst()->getPagesList()); die(''); echo PluginsManager::inst()->getAutogenDi('advgraph', array('x', 'y', 'z'), null, 'temp', 'php')->touch(); die; echo TestUtils::testProductivity(function () { FoldedStorage::getEntities('lib-s'); }, 200); br(); echo FoldedStorage::extractInfoFromClassName('PL_slib', $classPrefix, $entity); br(); echo $classPrefix; br(); echo $entity; die; $prefix = 'PL_math'; echo preg_match('/^[A-Z]+\\_/', $prefix, $matches);
protected function getWindowTplSmartyParams() { $params['pages'] = PopupPagesManager::inst()->getPagesList(); return $params; }
public function processRequest(ArrayAdapter $params) { return new IdentPageFilling(array('pages' => PopupPagesManager::inst()->getCurrentUserPagesList())); }
protected function executeImpl(ArrayAdapter $params) { $items = $params->arr('states'); $res = PopupPagesManager::inst()->updateCurrentUserPagesOrder($items); return $res === true ? new AjaxSuccess() : $res; }