Exemple #1
0
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     if ($this->getRequest()->getModuleName() == 'admin') {
         return;
     }
     $uri = $request->getRequestUri();
     if (!($titles = Z_Cache::getInstance()->load('z_titles'))) {
         $table_titles = new Z_Model_Titles();
         $titles = $table_titles->fetchAll(NULL, 'orderid asc');
         Z_Cache::getInstance()->save($titles, 'z_titles');
     }
     foreach ($titles as $title) {
         if (strpos($uri, $title->uri) === 0) {
             if ($title->title_block) {
                 Z_Seo::addTitle($title->title);
             } else {
                 Z_Seo::setTitle($title->title);
             }
             if ($title->description_block) {
                 Z_Seo::addDescription($title->description);
             } else {
                 Z_Seo::setDescription($title->description);
             }
             if ($title->keywords_block) {
                 Z_Seo::addKeywords($title->keywords);
             } else {
                 Z_Seo::setKeywords($title->keywords);
             }
         }
     }
 }
Exemple #2
0
 /**
  * Gets content panel for the Debugbar
  *
  * @return string
  */
 public function getPanel()
 {
     if (!Z_Acl::getInstance()->isAllowed(Z_Auth::getInstance()->getUser()->getRole(), $this->_z_resourceId)) {
         return;
     }
     $view = new Zend_View();
     $modelSeo = new Z_Model_Titles();
     $currentItem = $modelSeo->fetchRow(array('uri=?' => $_SERVER['REQUEST_URI']));
     if ($currentItem) {
         $adminUrl = '/admin/z_seo/edit/id/' . $currentItem->id;
         $adminLinkText = 'Изменить';
     } else {
         $adminUrl = '/admin/z_seo/add/uri/' . base64_encode($_SERVER['REQUEST_URI']);
         $adminLinkText = 'Добавить';
     }
     return '<h4>Текущие значения:</h4>' . '<strong>URI:</strong> ' . $_SERVER['REQUEST_URI'] . '<br />' . '<strong>Заголовок:</strong> ' . strip_tags($view->headTitle()) . '<br />' . '<strong>Мета:</strong> <br />' . nl2br($view->escape($view->headMeta())) . '<br />' . '<br /><a href="' . $adminUrl . '" target="_blank">' . $adminLinkText . '</a>';
 }