/** * Run plugin */ public function run() { global $grid_gallery_supsystic; $this->environment->run(); $this->environment->getTwig()->addGlobal('core_alerts', $this->alerts); $grid_gallery_supsystic = $this->environment; }
/** * Creates new response * @param string $template The name of the template * @param array $data An associative array of the data * @return Rsc_Http_Response */ public function response($template, array $data = array()) { if ($template != Rsc_Http_Response::AJAX) { try { $twig = $this->environment->getTwig(); $content = $twig->render($template, $data); } catch (Exception $e) { wp_die($e->getMessage()); } } else { wp_send_json($data); } return Rsc_Http_Response::create()->setContent($content); }
/** * Shows notice about the unavailable button sets. * This may happens while PRO version is disabled but one or more projects * uses PRO button sets. */ public function invalidBuilderNotice() { if (!$this->environment->isPluginPage()) { return; } $twig = $this->environment->getTwig(); $twig->display('notice.twig', array('type' => 'error', 'message' => sprintf($this->environment->translate('Selected button set is unavailable for the project "%s", "Flat 1" will be used.'), $this->project->getTitle()))); }
public function handle() { $action = $this->request->query->get('action', 'index') . 'Action'; if (method_exists($this->getController(), $action)) { return call_user_func_array(array($this->getController(), $action), array($this->request)); } $twig = $this->environment->getTwig(); return Rsc_Http_Response::create()->setContent($twig->render('404.twig')); }
public function handle() { $action = $this->request->query->get('action', 'index') . 'Action'; $welcomePageShowed = $this->environment->getConfig()->get('welcome_page_was_showed'); $promoController = $this->environment->getConfig()->get('promo_controller'); if ($promoController && class_exists($promoController) && !$welcomePageShowed) { $promoController = new $promoController($this->environment, $this->request); if (method_exists($promoController, 'indexAction')) { return call_user_func_array(array($promoController, 'indexAction'), array($this->request)); } } else { if (method_exists($this->getController(), $action)) { return call_user_func_array(array($this->getController(), $action), array($this->request)); } } $twig = $this->environment->getTwig(); return Rsc_Http_Response::create()->setContent($twig->render('404.twig')); }
public function reinit() { if ($this->modules->isEmpty()) { return; } $twig = $this->environment->getTwig()->getLoader(); $config = $this->environment->getConfig(); $loader = $config->getLoader(); foreach ($this->modules as $name => $module) { if ($module->getOverloadController()) { $prefix = $config->get('pro_modules_prefix'); $location = $config->get('pro_modules_path') . DIRECTORY_SEPARATOR . $prefix . DIRECTORY_SEPARATOR . ucfirst($name); try { $twig->addPath($location . '/views', $name . '_pro'); } catch (Twig_Error_Loader $e) { // Do nothing. Path does not exists. } $loader->add($location . '/configs', $name . '_pro'); $module->setRequest($this->request); $module->onInit(); } } }
/** * Run plugin */ public function run() { $this->environment->run(); $this->environment->getTwig()->addGlobal('core_alerts', $this->alerts); }