Beispiel #1
0
 /**
  * Parse SEO
  *
  * @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)) {
         $seo = new Model\Seo();
         $body = $controller->response()->getBody();
         if (strpos($body, '[{seo_meta_tags}]') !== false) {
             $body = str_replace('[{seo_meta_tags}]', $seo->buildMetaTags($controller->view()->description, $controller->view()->keywords), $body);
         }
         if (!empty($seo->tracking)) {
             $body = str_replace('</head>', $seo->tracking . PHP_EOL . PHP_EOL . '</head>', $body);
         }
         $controller->response()->setBody($body);
     }
 }
Beispiel #2
0
 /**
  * Analysis action method
  *
  * @return void
  */
 public function analysis()
 {
     $this->prepareView('seo/analysis.phtml');
     $seo = new Model\Seo();
     if ($this->request->getQuery('run') == '1') {
         $seo->saveAnalysis($this->application->module('phire-seo')['exclude']);
         $this->sess->setRequestValue('saved', true);
         $this->redirect(BASE_PATH . APP_URI . '/seo/analysis');
     } else {
         $this->view->title = 'SEO Analysis';
         $this->view->seoAnalysis = $seo->getAnalysis();
     }
     $this->send();
 }