/** * Parse social navigation * * @param AbstractController $controller * @param Application $application * @return void */ public static function parse(AbstractController $controller, Application $application) { if ($controller->hasView() && ($controller instanceof \Phire\Content\Controller\IndexController || $controller instanceof \Phire\Categories\Controller\IndexController)) { $body = $controller->response()->getBody(); if (strpos($body, '[{social_nav') !== false) { $social = new Model\Social(); $body = str_replace(['[{social_nav}]', '[{social_nav_styles}]'], [$social->buildNav(), $social->getStyles()], $body); $controller->response()->setBody($body); } } }
/** * Index action method * * @return void */ public function index() { $this->prepareView('social/index.phtml'); $social = new Model\Social(); if ($this->request->isPost()) { $social->save($this->request->getPost()); $this->sess->setRequestValue('saved', true); $this->redirect(BASE_PATH . APP_URI . '/social'); } else { $this->view->title = 'Social Media'; $this->view->socialConfig = $social->getConfig(); } $this->send(); }