Example #1
0
 /**
  * @inheritdoc
  */
 public function splitTextIntoPages($text, $baseUrlPath)
 {
     $pages = parent::splitTextIntoPages($text, $baseUrlPath);
     $this->metaStatements->setNextPage($pages['next']);
     $this->metaStatements->setPreviousPage($pages['previous']);
     return $pages;
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function generatePictureAliases(ModelSaveEvent $event)
 {
     if ($this->aliases && $this->metaStatements && $this->uriAliasManager) {
         $galleryId = $event->getEntryId();
         $pictures = $this->pictureRepository->getPicturesByGalleryId($galleryId);
         $alias = $this->aliases->getUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId), true);
         $seoKeywords = $this->metaStatements->getKeywords(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId));
         $seoDescription = $this->metaStatements->getDescription(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId));
         foreach ($pictures as $picture) {
             $this->uriAliasManager->insertUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_PICTURE, $picture['id']), !empty($alias) ? $alias . '/img-' . $picture['id'] : '', $seoKeywords, $seoDescription);
         }
     }
 }
Example #3
0
 /**
  * @inheritdoc
  */
 protected function setMetaStatements()
 {
     parent::setMetaStatements();
     // Vorherige und nächste Seite für Suchmaschinen und Prefetching propagieren
     if ($this->request->getArea() !== AreaEnum::AREA_ADMIN) {
         $path = ($this->request->getArea() === AreaEnum::AREA_ADMIN ? 'acp/' : '') . $this->request->getUriWithoutPages();
         $link = $this->router->route($path);
         if ($this->currentPage - 1 > 0) {
             // Seitenangabe in der Seitenbeschreibung ab Seite 2 angeben
             $this->metaStatements->setDescriptionPostfix($this->translator->t('system', 'page_x', ['%page%' => $this->currentPage]));
             $this->metaStatements->setPreviousPage($link . 'page_' . ($this->currentPage - 1) . '/');
         }
         if ($this->currentPage + 1 <= $this->totalPages) {
             $this->metaStatements->setNextPage($link . 'page_' . ($this->currentPage + 1) . '/');
         }
         if ($this->request->getParameters()->get('page', 0) === 1) {
             $this->metaStatements->setCanonicalUri($link);
         }
     }
 }
Example #4
0
 /**
  * @param int $cat
  */
 protected function addBreadcrumbStep($cat)
 {
     if ($cat !== 0 && $this->newsSettings['category_in_breadcrumb'] == 1) {
         if ($this->metaStatements instanceof MetaStatements) {
             $this->metaStatements->setCanonicalUri($this->router->route('news'));
         }
         $this->breadcrumb->append($this->translator->t('news', 'news'), 'news');
         $category = $this->categoryRepository->getTitleById($cat);
         if (!empty($category)) {
             $this->breadcrumb->append($category);
         }
     }
 }
Example #5
0
File: Create.php Project: acp3/cms
 /**
  * Setzt einen einzelnen Alias für ein Bild einer Fotogalerie
  *
  * @param integer $pictureId
  *
  * @return boolean
  */
 protected function generatePictureAlias($pictureId)
 {
     if ($this->aliases && $this->metaStatements && $this->uriAliasManager) {
         $galleryId = $this->pictureRepository->getGalleryIdFromPictureId($pictureId);
         $alias = $this->aliases->getUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId), true);
         if (!empty($alias)) {
             $alias .= '/img-' . $pictureId;
         }
         $seoKeywords = $this->metaStatements->getKeywords(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId));
         $seoDescription = $this->metaStatements->getDescription(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId));
         return $this->uriAliasManager->insertUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_PICTURE, $pictureId), $alias, $seoKeywords, $seoDescription);
     }
     return true;
 }
 /**
  * If there is an URI alias available, set the alias as the canonical URI
  *
  * @param \ACP3\Core\Application\Event\ControllerActionBeforeDispatchEvent $event
  */
 public function onBeforeDispatch(ControllerActionBeforeDispatchEvent $event)
 {
     if ($this->isInFrontend($event) && $this->uriAliasExists()) {
         $this->metaStatements->setCanonicalUri($this->router->route($this->request->getQuery()));
     }
 }
 /**
  * @param string $routeName
  * @return bool
  */
 private function pageIsIndexable($routeName)
 {
     return in_array($this->metaStatements->getRobotsSetting($routeName), ['index,follow', 'index,nofollow']);
 }
Example #8
0
 /**
  * @return array
  */
 protected function getRobotsChoicesGeneratorValues()
 {
     return [0 => $this->translator->t('seo', 'robots_use_system_default', ['%default%' => $this->metaStatements->getRobotsSetting()]), 1 => $this->translator->t('seo', 'robots_index_follow'), 2 => $this->translator->t('seo', 'robots_index_nofollow'), 3 => $this->translator->t('seo', 'robots_noindex_follow'), 4 => $this->translator->t('seo', 'robots_noindex_nofollow')];
 }
Example #9
0
File: Details.php Project: acp3/cms
 /**
  * @param int $previousPicture
  */
 protected function setPreviousPage($previousPicture)
 {
     if ($this->metaStatements instanceof MetaStatements) {
         $this->metaStatements->setPreviousPage($this->router->route(sprintf(Gallery\Helpers::URL_KEY_PATTERN_PICTURE, $previousPicture)));
     }
 }
Example #10
0
 /**
  * @param Core\Helpers\DataGrid $dataGrid
  */
 protected function addDataGridColumns(Core\Helpers\DataGrid $dataGrid)
 {
     $dataGrid->addColumn(['label' => $this->translator->t('seo', 'uri'), 'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class, 'fields' => ['uri'], 'default_sort' => true], 60)->addColumn(['label' => $this->translator->t('seo', 'alias'), 'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class, 'fields' => ['alias']], 50)->addColumn(['label' => $this->translator->t('seo', 'keywords'), 'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class, 'fields' => ['keywords']], 40)->addColumn(['label' => $this->translator->t('seo', 'description'), 'type' => Core\Helpers\DataGrid\ColumnRenderer\TextColumnRenderer::class, 'fields' => ['description']], 30)->addColumn(['label' => $this->translator->t('seo', 'robots'), 'type' => Core\Helpers\DataGrid\ColumnRenderer\ReplaceValueColumnRenderer::class, 'fields' => ['robots'], 'custom' => ['search' => [0, 1, 2, 3, 4], 'replace' => [$this->translator->t('seo', 'robots_use_system_default', ['%default%' => $this->metaStatements->getRobotsSetting()]), $this->translator->t('seo', 'robots_index_follow'), $this->translator->t('seo', 'robots_index_nofollow'), $this->translator->t('seo', 'robots_noindex_follow'), $this->translator->t('seo', 'robots_noindex_nofollow')]]], 20)->addColumn(['label' => $this->translator->t('system', 'id'), 'type' => Core\Helpers\DataGrid\ColumnRenderer\IntegerColumnRenderer::class, 'fields' => ['id'], 'primary' => true], 10);
 }
Example #11
0
 public function renderSeoMetaTags()
 {
     $this->view->assign('META', $this->metaStatements->getMetaTags());
     $this->view->displayTemplate('Seo/Partials/meta.tpl');
 }