diff --git a/src/NewsBundle/Configuration/Configuration.php b/src/NewsBundle/Configuration/Configuration.php index 61eb3ff..3a803f8 100644 --- a/src/NewsBundle/Configuration/Configuration.php +++ b/src/NewsBundle/Configuration/Configuration.php @@ -1,5 +1,16 @@ config[$slot]; } -} \ No newline at end of file +} diff --git a/src/NewsBundle/Controller/Admin/SettingsController.php b/src/NewsBundle/Controller/Admin/SettingsController.php index cbc192d..e0a6019 100644 --- a/src/NewsBundle/Controller/Admin/SettingsController.php +++ b/src/NewsBundle/Controller/Admin/SettingsController.php @@ -1,5 +1,16 @@ getDefinition(BundleConfiguration::class); $configManagerDefinition->addMethodCall('setConfig', [$config]); } -} \ No newline at end of file +} diff --git a/src/NewsBundle/Document/Areabrick/News/News.php b/src/NewsBundle/Document/Areabrick/News/News.php index 1af94bc..d9ee74a 100755 --- a/src/NewsBundle/Document/Areabrick/News/News.php +++ b/src/NewsBundle/Document/Areabrick/News/News.php @@ -1,21 +1,32 @@ $fieldConfiguration['single_objects']['relations_config'] ]; - $secondTabItems[] = [ 'type' => 'numeric', 'label' => $this->translator->trans('news.entries_per_page', [], 'admin'), @@ -226,7 +236,7 @@ public function action(Document\Editable\Area\Info $info): ?Response $presetParams = []; //check if preset has been selected at first - if($this->isPresetMode($fieldConfiguration)) { + if ($this->isPresetMode($fieldConfiguration)) { $isPresetMode = true; $preset = $this->presetRegistry->get($fieldConfiguration['presets']['value']); $preset->setInfo($info); @@ -278,9 +288,9 @@ public function action(Document\Editable\Area\Info $info): ?Response if ($fieldConfiguration['entry_types']['value'] !== 'all') { $mainClasses[] = 'entry-type-' . str_replace([ - '_', - ' ' - ], ['-'], strtolower($fieldConfiguration['entry_types']['value'])); + '_', + ' ' + ], ['-'], strtolower($fieldConfiguration['entry_types']['value'])); } $event = new NewsBrickEvent($info, $querySettings); @@ -580,5 +590,4 @@ public function getHtmlTagClose(Document\Editable\Area\Info $info): string { return ''; } - } diff --git a/src/NewsBundle/Event/NewsBrickEvent.php b/src/NewsBundle/Event/NewsBrickEvent.php index 2056e68..fa533b7 100644 --- a/src/NewsBundle/Event/NewsBrickEvent.php +++ b/src/NewsBundle/Event/NewsBrickEvent.php @@ -1,5 +1,16 @@ setArgument('data', $data); + return; } @@ -76,13 +88,13 @@ public function setEntryTypeLayout(GenericEvent $e): void $data['currentLayoutId'] = 0; $data['layout'] = $object->getClass()->getLayoutDefinitions(); $e->setArgument('data', $data); + return; } //watch out, a new object is coming in! if (is_null($layoutType)) { $layoutType = $defaultLayoutType; - } foreach ($entryTypes as $typeName => $type) { @@ -92,6 +104,7 @@ public function setEntryTypeLayout(GenericEvent $e): void if ($layoutType === $typeName) { $layoutId = $type['custom_layout_id']; + break; } } @@ -104,12 +117,14 @@ public function setEntryTypeLayout(GenericEvent $e): void $data['layout'] = null; $data['currentLayoutId'] = null; $e->setArgument('data', $data); + return; } } if ($layoutId !== 0) { $customLayout = null; + try { $customLayout = CustomLayout::getById($layoutId); } catch (\Exception $e) { diff --git a/src/NewsBundle/EventListener/MetaDataListener.php b/src/NewsBundle/EventListener/MetaDataListener.php index 4426312..dcfc0e0 100644 --- a/src/NewsBundle/EventListener/MetaDataListener.php +++ b/src/NewsBundle/EventListener/MetaDataListener.php @@ -1,5 +1,16 @@ headMetaGenerator->getTitlePosition()) { case Container::SET: $this->headTitle->set($title); + break; case Container::PREPEND: $this->headTitle->prepend($title); + break; case Container::APPEND: default: $this->headTitle->append($title); + break; } } diff --git a/src/NewsBundle/EventListener/NewsSeoListener.php b/src/NewsBundle/EventListener/NewsSeoListener.php index 425b063..ecff2dd 100644 --- a/src/NewsBundle/EventListener/NewsSeoListener.php +++ b/src/NewsBundle/EventListener/NewsSeoListener.php @@ -1,14 +1,25 @@ request->has($copyTransactionArgument) === false) { $reset = false; + break; } } @@ -91,7 +103,6 @@ private function parseUrl($object): void } foreach ($languages as $language) { - $oldDetailUrl = null; $title = $object->getName($language); @@ -110,6 +121,7 @@ private function parseUrl($object): void if (empty($title) && !empty($currentDetailUrl)) { $currentDetailUrl = null; $object->setDetailUrl($currentDetailUrl, $language); + return; } @@ -128,6 +140,7 @@ private function parseUrl($object): void if ($this->otherElementsExists($objectListingClass, $language, $currentDetailUrl, $object->getId()) === false) { $object->setDetailUrl($currentDetailUrl, $language); + continue; } @@ -153,7 +166,7 @@ protected function slugify(string $string, ?string $language): string } $string = preg_replace(['/®/', '/©/'], '', $string); - $string = transliterator_transliterate("Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();", $string); + $string = transliterator_transliterate('Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();', $string); // Remove repeating hyphens and spaces (e.g. 'foo---bar' becomes 'foo-bar') $string = preg_replace('/[-\s]+/', '-', $string); diff --git a/src/NewsBundle/Exception/ImplementedByPimcoreException.php b/src/NewsBundle/Exception/ImplementedByPimcoreException.php index 31781ce..68838e3 100644 --- a/src/NewsBundle/Exception/ImplementedByPimcoreException.php +++ b/src/NewsBundle/Exception/ImplementedByPimcoreException.php @@ -1,5 +1,16 @@ getRedirectLink() instanceof Document) { $path = $entry->getRedirectLink()->getFullPath(); + return Tool::getHostUrl() . $path; } @@ -79,4 +91,4 @@ public function generateBackLink(EntryInterface $entry): string return $backLink; } -} \ No newline at end of file +} diff --git a/src/NewsBundle/Generator/LinkGeneratorInterface.php b/src/NewsBundle/Generator/LinkGeneratorInterface.php index dd043a4..1952610 100644 --- a/src/NewsBundle/Generator/LinkGeneratorInterface.php +++ b/src/NewsBundle/Generator/LinkGeneratorInterface.php @@ -1,5 +1,16 @@ $news->getEntryType(), 'includeSubCategories' => false, 'ignoreCategory' => false - ], $params); /** @var DataObject\NewsEntry\Listing $newsListing */ @@ -42,7 +53,7 @@ public function generateRelatedEntries(EntryInterface $news, array $params = []) } $newsListing->addConditionParam('name <> ""'); - $newsListing->setGroupBy($newsListing->getDao()->getTableName().'.id', false); + $newsListing->setGroupBy($newsListing->getDao()->getTableName() . '.id', false); $categories = []; if (count($news->getCategories()) > 0 && !$settings['ignoreCategory']) { @@ -57,7 +68,7 @@ public function generateRelatedEntries(EntryInterface $news, array $params = []) $newsListing->addConditionParam('entryType = ?', $settings['entryType']); } - $newsListing->addConditionParam($newsListing->getDao()->getTableName().'.id != ?', $news->getId()); + $newsListing->addConditionParam($newsListing->getDao()->getTableName() . '.id != ?', $news->getId()); //add additional where clauses. if (count($settings['where'])) { diff --git a/src/NewsBundle/Generator/RelatedEntriesGeneratorInterface.php b/src/NewsBundle/Generator/RelatedEntriesGeneratorInterface.php index d1dd453..fa1a9fc 100644 --- a/src/NewsBundle/Generator/RelatedEntriesGeneratorInterface.php +++ b/src/NewsBundle/Generator/RelatedEntriesGeneratorInterface.php @@ -1,5 +1,16 @@ setCondition('name = ?', $type['custom_layout_id']); $list = $list->load(); if (isset($list[0]) && $list[0] instanceof DataObject\ClassDefinition\CustomLayout) { - $customLayoutId = (int)$list[0]->getId(); + $customLayoutId = (int) $list[0]->getId(); } else { $customLayoutId = 0; //reset layout to default -> custom layout is not available! } diff --git a/src/NewsBundle/Model/AdminStyle.php b/src/NewsBundle/Model/AdminStyle.php index 84d0742..4b59a5b 100644 --- a/src/NewsBundle/Model/AdminStyle.php +++ b/src/NewsBundle/Model/AdminStyle.php @@ -1,5 +1,16 @@ getHierarchy(); + return $mostTop[0]; } - public static function getAllChildCategories(Category $category): array + public static function getAllChildCategories(self $category): array { $allChildren = [$category->getId()]; $loopChildren = static function (Category $child) use (&$loopChildren, &$allChildren) { @@ -94,7 +106,7 @@ public function getEntriesPaging( ); } - public function inCategory(Category $category, int $level = 0): bool + public function inCategory(self $category, int $level = 0): bool { $mostTop = $this->getHierarchy(); $mostTop = $mostTop[$level]; diff --git a/src/NewsBundle/Model/CategoryInterface.php b/src/NewsBundle/Model/CategoryInterface.php index 4190cde..317a23e 100644 --- a/src/NewsBundle/Model/CategoryInterface.php +++ b/src/NewsBundle/Model/CategoryInterface.php @@ -1,5 +1,16 @@ [], 'where' => [], 'request' => [] - ], $params); $newsListing = DataObject\NewsEntry::getList(); @@ -131,7 +140,8 @@ public static function addTimeRange(DataObject\NewsEntry\Listing $newsListing, a $identifier = '<'; } - $newsListing->addConditionParam(sprintf('( + $newsListing->addConditionParam( + sprintf('( CASE WHEN showEntryUntil IS NOT NULL THEN showEntryUntil %1$s UNIX_TIMESTAMP(NOW()) @@ -165,7 +175,6 @@ public static function addCategorySelectorToQuery(DataObject\Listing\Concrete $n //allow query modification. static::modifyQuery($query, $newsListing, $settings); - }); if (!empty($categories)) { diff --git a/src/NewsBundle/Model/EntryInterface.php b/src/NewsBundle/Model/EntryInterface.php index 3e10df5..3c9121a 100644 --- a/src/NewsBundle/Model/EntryInterface.php +++ b/src/NewsBundle/Model/EntryInterface.php @@ -1,5 +1,16 @@ getClasses() as $className => $path) { - $class = new DataObject\ClassDefinition(); try { @@ -85,7 +93,6 @@ public function installClasses(): void $data = file_get_contents($path); DataObject\ClassDefinition\Service::importClassDefinitionFromJson($class, $data); - } } @@ -166,7 +173,8 @@ protected function getClasses(): array if (false === $path || !is_file($path)) { throw new \RuntimeException(sprintf( 'Class export for class "%s" was expected in "%s" but file does not exist', - $className, $path + $className, + $path )); } diff --git a/src/NewsBundle/Twig/Extension/NewsExtension.php b/src/NewsBundle/Twig/Extension/NewsExtension.php index ede9fe9..b996a60 100644 --- a/src/NewsBundle/Twig/Extension/NewsExtension.php +++ b/src/NewsBundle/Twig/Extension/NewsExtension.php @@ -1,5 +1,16 @@ imageThumbnails, true) ? $this->imageThumbnails[$thumbnail] : ''; } -} \ No newline at end of file +} diff --git a/src/NewsBundle/Twig/Extension/RelatedEntriesExtension.php b/src/NewsBundle/Twig/Extension/RelatedEntriesExtension.php index 67d7ed8..16a22a5 100644 --- a/src/NewsBundle/Twig/Extension/RelatedEntriesExtension.php +++ b/src/NewsBundle/Twig/Extension/RelatedEntriesExtension.php @@ -1,5 +1,16 @@ relatedEntriesGenerator->generateRelatedEntries($entry, $params); } -} \ No newline at end of file +} diff --git a/src/NewsBundle/Twig/Extension/VideoTagExtension.php b/src/NewsBundle/Twig/Extension/VideoTagExtension.php index eaee886..e081872 100644 --- a/src/NewsBundle/Twig/Extension/VideoTagExtension.php +++ b/src/NewsBundle/Twig/Extension/VideoTagExtension.php @@ -1,5 +1,16 @@