diff --git a/Plugin.php b/Plugin.php index 63c8c54..15548c6 100644 --- a/Plugin.php +++ b/Plugin.php @@ -134,6 +134,7 @@ public function registerComponents() 'Indikator\News\Components\Posts' => 'newsPosts', 'Indikator\News\Components\Post' => 'newsPost', 'Indikator\News\Components\Categories' => 'newsCategories', + 'Indikator\News\Components\Tags' => 'newsTags', 'Indikator\News\Components\Subscribe' => 'newsSubscribe', 'Indikator\News\Components\Unsubscribe' => 'newsUnsubscribe' ]; diff --git a/components/Categories.php b/components/Categories.php index 8e96ef0..69da968 100644 --- a/components/Categories.php +++ b/components/Categories.php @@ -31,11 +31,11 @@ public function defineProperties() 'default' => '{{ :slug }}', 'type' => 'string', ], - 'noPostsMessage' => [ - 'title' => 'indikator.news::lang.settings.no_posts_title', - 'description' => 'indikator.news::lang.settings.no_posts_description', + 'noCategoryMessage' => [ + 'title' => 'indikator.news::lang.settings.no_category_title', + 'description' => 'indikator.news::lang.settings.no_category_description', 'type' => 'string', - 'default' => Lang::get('indikator.news::lang.settings.no_posts_found'), + 'default' => Lang::get('indikator.news::lang.settings.no_category_found'), 'showExternalParam' => false ], 'categoryFilter' => [ @@ -78,7 +78,7 @@ public function onRun() $this->currentCategorySlug = $this->page['currentCategorySlug'] = $this->property('slug'); $this->categoryPage = $this->page['categoryPage'] = $this->property('categoryPage'); - $this->page['noPostsMessage'] = $this->property('noPostsMessage'); + $this->page['noCategoryMessage'] = $this->property('noCategoryMessage'); $this->categories = $this->page['categories'] = $this->listCategories(); } diff --git a/components/Tags.php b/components/Tags.php new file mode 100644 index 0000000..2dcb3e0 --- /dev/null +++ b/components/Tags.php @@ -0,0 +1,69 @@ + 'indikator.news::lang.component.tags', + 'description' => '' + ]; + } + + public function defineProperties() + { + return [ + 'slug' => [ + 'title' => 'indikator.news::lang.settings.tags_slug_title', + 'description' => 'indikator.news::lang.settings.tags_slug_description', + 'default' => '{{ :slug }}', + 'type' => 'string', + ], + 'noTagsMessage' => [ + 'title' => 'indikator.news::lang.settings.no_tags_title', + 'description' => 'indikator.news::lang.settings.no_tags_description', + 'type' => 'string', + 'default' => Lang::get('indikator.news::lang.settings.no_tags_found'), + 'showExternalParam' => false + ], + 'tagPage' => [ + 'title' => 'indikator.news::lang.settings.tag_page_title', + 'description' => 'indikator.news::lang.settings.tag_page_description', + 'type' => 'dropdown', + 'default' => '' + ] + ]; + } + + public function getTagPageOptions() + { + return Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName'); + } + + public function onRun() + { + $tags = []; + $news = Posts::where('status', 1)->where('published_at', '<=', date('Y-m-d H:i:00'))->get()->all(); + + foreach ($news as $post) { + foreach ($post['tags'] as $tag) { + if (! in_array($tag, $tags)) { + $tags[] = $tag; + } + } + } + + usort($tags, function($item1, $item2) { + return $item1 <=> $item2; + }); + + $this->page['tags'] = $tags; + $this->page['noTagsMessage'] = $this->property('noTagsMessage'); + $this->page['tagPage'] = $this->property('tagPage'); + } +} diff --git a/components/categories/default.htm b/components/categories/default.htm index 298ca92..9855db3 100644 --- a/components/categories/default.htm +++ b/components/categories/default.htm @@ -20,5 +20,5 @@ {% endif %} {% else %} - {{ noPostsMessage }} + {{ noCategoryMessage }} {% endfor %} diff --git a/components/tags/default.htm b/components/tags/default.htm new file mode 100644 index 0000000..d3ed8d9 --- /dev/null +++ b/components/tags/default.htm @@ -0,0 +1,13 @@ +{% set tags = __SELF__.tags %} + +{% for tag in tags %} + {% if loop.first %} + + {% endif %} +{% else %} + {{ noTagsMessage }} +{% endfor %} diff --git a/lang/en/lang.php b/lang/en/lang.php index a0740e7..c5a1764 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -199,6 +199,7 @@ 'posts' => 'Display posts', 'post' => 'Post content', 'categories' => 'Categories', + 'tags' => 'Tags', 'subscribe' => 'Subscriber form', 'unsubscribe' => 'Unsubscribe form' ], @@ -221,6 +222,12 @@ 'no_posts_title' => 'No posts message', 'no_posts_description' => 'Message to display in the post list in case if there are no posts. This property is used by the default component partial.', 'no_posts_found' => 'No posts found', + 'no_category_title' => 'No categories message', + 'no_category_description' => 'Message to display in the category list in case if there are no categories.', + 'no_category_found' => 'No categories found', + 'no_tags_title' => 'No tags message', + 'no_tags_description' => 'Message to display in the tag list in case if there are no tag.', + 'no_tags_found' => 'No tags found', 'posts_order_title' => 'Post order', 'posts_order_description' => 'Attribute on which the posts should be ordered', 'post_title' => 'Post page', @@ -240,6 +247,10 @@ 'category_filter_description' => 'Enter a category slug or URL parameter to filter the posts by. Leave empty to show all posts.', 'nested_category_posts_title' => 'Nested Posts', 'nested_category_posts_description' => 'Display posts which are in a nested category.', + 'tag_slug_title' => 'Tag slug', + 'tag_slug_description' => 'Look up the tag using the supplied slug value. This property is used by the default component partial for marking the currently active tag.', + 'tag_page_title' => 'Tag page', + 'tag_page_description' => 'Name of the tag page file for the tag links. This property is used by the default component partial.', 'links' => 'Links' ], 'sorting' => [ diff --git a/lang/hu/lang.php b/lang/hu/lang.php index 3bb0a90..0bc88bd 100644 --- a/lang/hu/lang.php +++ b/lang/hu/lang.php @@ -197,6 +197,7 @@ 'posts' => 'Hírek listázása', 'post' => 'Bejegyzés mutatása', 'categories' => 'Hír kategóriák', + 'tags' => 'Címkék', 'subscribe' => 'Űrlap feliratkozáshoz', 'unsubscribe' => 'Űrlap leiratkozáshoz' ], @@ -219,6 +220,12 @@ 'no_posts_title' => 'Nincs találat', 'no_posts_description' => 'A bejegyzés listában megjelenő üzenet abban az esetben, ha nincsenek bejegyzések.', 'no_posts_found' => 'Nincsenek bejegyzések', + 'no_category_title' => 'Nincs találat', + 'no_category_description' => 'A kategória listában megjelenő üzenet abban az esetben, ha nincsenek kategóriák.', + 'no_category_found' => 'Nincsenek kategóriák', + 'no_tags_title' => 'Nincs találat', + 'no_tags_description' => 'A címke listában megjelenő üzenet abban az esetben, ha nincsenek címkék.', + 'no_tags_found' => 'Nincsenek címkék', 'posts_order_title' => 'Bejegyzések sorrendje', 'posts_order_description' => 'Ez alapján rendeződnek a bejegyzések.', 'post_title' => 'Bejegyzés lapja', @@ -230,10 +237,18 @@ 'list_notfeatured' => 'Csak a nem kiemeltek', 'translated_title' => 'Lefordított bejegyzések', 'translated_description' => 'Bejegyzés elrejtése, ha annak a nyelve nem egyezik meg a honlapéval.', + 'category_slug_title' => 'Kategória webcím', + 'category_slug_description' => '', 'category_page_title' => 'Kategória aloldal', 'category_page_description' => 'Adja meg a kategória fájl nevét. Ennek alapján lesznek generálva a kategória linkek webcíme.', 'category_filter_title' => 'Kategória szűrés', 'category_filter_description' => 'Adja meg a kategória webcímét, ami alapján szűrve lesznek a bejegyzések. Üresen hagyva minden bejegyzés meg fog jelenni.', + 'nested_category_posts_title' => 'Alkategória', + 'nested_category_posts_description' => 'Alkategóriához tartozó bejegyzések megjelenítése.', + 'tag_slug_title' => 'Címke webcím', + 'tag_slug_description' => '', + 'tag_page_title' => 'Címke aloldal', + 'tag_page_description' => 'Adja meg a címke fájl nevét. Ennek alapján lesznek generálva a címke linkek webcíme.', 'links' => 'Linkek' ], 'sorting' => [ diff --git a/updates/version.yaml b/updates/version.yaml index 6bd3595..fa51084 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -77,7 +77,7 @@ 1.8.4: Added the preview feature for posts. 1.8.5: Added more options for Settings page. 1.8.6: - - !!! Reworked again the sending newsletter feature. + - Reworked again the sending newsletter feature. - update_send_feature_2.php 1.9.0: - Added categories feature. @@ -134,9 +134,10 @@ 1.11.8: Fixed bug showing the previous and next post. 1.11.9: Fixed the email sending bug. 1.12.0: - - !!! New configuration was added. If you had no categories enabled or non set, you need to disable newsletter_subscriber_categories + - New configuration was added. If you had no categories enabled or non set, you need to disable newsletter_subscriber_categories - Adding nested categories support and multiple category news. - If no category is set, and newsletter_subscriber_categories is enabled, none of your subscriber will receive any newsletter anymore. - - Added prev/next post in category + - Added prev / next post in category. - add_nested_categories_support.php - create_posts_categories_table.php +1.12.1: Added Tag list component.