예제 #1
0
파일: Seo.php 프로젝트: phirecms/phire-seo
 /**
  * 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);
     }
 }
예제 #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();
 }