From 254fe00d9e41310dcfb8aa9f7b5d5e5f4a941b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 22 Sep 2017 21:46:47 +0000 Subject: [PATCH] Upgrade Blog plugin to version 1.2.16 --- plugins/rainlab/blog/Plugin.php | 53 +++- plugins/rainlab/blog/README.md | 19 +- .../rainlab/blog/components/Categories.php | 16 +- plugins/rainlab/blog/components/Post.php | 44 ++- plugins/rainlab/blog/components/Posts.php | 27 +- plugins/rainlab/blog/components/RssFeed.php | 11 + .../rainlab/blog/components/post/default.htm | 51 ++-- .../rainlab/blog/components/posts/default.htm | 43 ++- plugins/rainlab/blog/composer.lock | 15 +- plugins/rainlab/blog/controllers/Posts.php | 10 +- .../blog/controllers/posts/_list_toolbar.htm | 4 +- .../blog/controllers/posts/config_filter.yaml | 11 +- .../posts/config_import_export.yaml | 4 +- .../blog/formwidgets/MLBlogMarkdown.php | 6 +- plugins/rainlab/blog/lang/bg/lang.php | 4 +- plugins/rainlab/blog/lang/cs/lang.php | 27 +- plugins/rainlab/blog/lang/de/lang.php | 48 +++- plugins/rainlab/blog/lang/en/lang.php | 21 +- plugins/rainlab/blog/lang/fa/lang.php | 7 +- plugins/rainlab/blog/lang/fr/lang.php | 19 +- plugins/rainlab/blog/lang/hu/lang.php | 40 ++- plugins/rainlab/blog/lang/it/lang.php | 107 +++++++ plugins/rainlab/blog/lang/ja/lang.php | 4 +- plugins/rainlab/blog/lang/nb-no/lang.php | 2 + plugins/rainlab/blog/lang/nl/lang.php | 4 +- plugins/rainlab/blog/lang/pl/lang.php | 4 +- plugins/rainlab/blog/lang/pt-br/lang.php | 30 +- plugins/rainlab/blog/lang/ru/lang.php | 4 +- plugins/rainlab/blog/lang/tr/lang.php | 49 +++- plugins/rainlab/blog/models/Category.php | 28 +- plugins/rainlab/blog/models/Post.php | 267 +++++++++++++++++- plugins/rainlab/blog/models/PostExport.php | 12 +- plugins/rainlab/blog/models/PostImport.php | 12 +- .../rainlab/blog/models/category/fields.yaml | 7 + .../blog/updates/create_posts_table.php | 4 +- .../updates/update_timestamp_nullable.php | 5 +- plugins/rainlab/blog/updates/version.yaml | 7 + plugins/rainlab/blog/vendor/autoload.php | 2 +- .../blog/vendor/composer/autoload_real.php | 6 +- .../blog/vendor/composer/installed.json | 17 +- .../blog/vendor/composer/installers/README.md | 10 +- .../vendor/composer/installers/composer.json | 5 + .../Composer/Installers/AsgardInstaller.php | 8 +- .../Composer/Installers/AttogramInstaller.php | 9 + .../Composer/Installers/CockpitInstaller.php | 34 +++ .../Installers/ExpressionEngineInstaller.php | 4 +- .../src/Composer/Installers/Installer.php | 8 +- .../Installers/PlentymarketsInstaller.php | 29 ++ .../Composer/Installers/ReIndexInstaller.php | 10 + .../Composer/Installers/ShopwareInstaller.php | 4 +- .../Composer/Installers/VanillaInstaller.php | 10 + .../Composer/Installers/YawikInstaller.php | 32 +++ .../Installers/Test/AsgardInstallerTest.php | 26 +- .../Installers/Test/BitrixInstallerTest.php | 76 +++++ .../Installers/Test/InstallerTest.php | 24 +- .../Installers/Test/YawikInstallerTest.php | 64 +++++ 56 files changed, 1210 insertions(+), 194 deletions(-) create mode 100644 plugins/rainlab/blog/lang/it/lang.php create mode 100644 plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php create mode 100644 plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php create mode 100644 plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php create mode 100644 plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php create mode 100644 plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php create mode 100644 plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php create mode 100644 plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php create mode 100644 plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php diff --git a/plugins/rainlab/blog/Plugin.php b/plugins/rainlab/blog/Plugin.php index 863078a765..04b5240dd1 100644 --- a/plugins/rainlab/blog/Plugin.php +++ b/plugins/rainlab/blog/Plugin.php @@ -2,6 +2,7 @@ use Backend; use Controller; +use RainLab\Blog\Models\Post; use System\Classes\PluginBase; use RainLab\Blog\Classes\TagProcessor; use RainLab\Blog\Models\Category; @@ -26,17 +27,33 @@ class Plugin extends PluginBase 'RainLab\Blog\Components\Post' => 'blogPost', 'RainLab\Blog\Components\Posts' => 'blogPosts', 'RainLab\Blog\Components\Categories' => 'blogCategories', - 'RainLab\Blog\Components\RssFeed' => 'blogRssFeed', + 'RainLab\Blog\Components\RssFeed' => 'blogRssFeed' ]; } public function registerPermissions() { return [ - 'rainlab.blog.access_posts' => ['tab' => 'rainlab.blog::lang.blog.tab', 'label' => 'rainlab.blog::lang.blog.access_posts'], - 'rainlab.blog.access_categories' => ['tab' => 'rainlab.blog::lang.blog.tab', 'label' => 'rainlab.blog::lang.blog.access_categories'], - 'rainlab.blog.access_other_posts' => ['tab' => 'rainlab.blog::lang.blog.tab', 'label' => 'rainlab.blog::lang.blog.access_other_posts'], - 'rainlab.blog.access_import_export' => ['tab' => 'rainlab.blog::lang.blog.tab', 'label' => 'rainlab.blog::lang.blog.access_import_export'] + 'rainlab.blog.access_posts' => [ + 'tab' => 'rainlab.blog::lang.blog.tab', + 'label' => 'rainlab.blog::lang.blog.access_posts' + ], + 'rainlab.blog.access_categories' => [ + 'tab' => 'rainlab.blog::lang.blog.tab', + 'label' => 'rainlab.blog::lang.blog.access_categories' + ], + 'rainlab.blog.access_other_posts' => [ + 'tab' => 'rainlab.blog::lang.blog.tab', + 'label' => 'rainlab.blog::lang.blog.access_other_posts' + ], + 'rainlab.blog.access_import_export' => [ + 'tab' => 'rainlab.blog::lang.blog.tab', + 'label' => 'rainlab.blog::lang.blog.access_import_export' + ], + 'rainlab.blog.access_publish' => [ + 'tab' => 'rainlab.blog::lang.blog.tab', + 'label' => 'rainlab.blog::lang.blog.access_publish' + ] ]; } @@ -49,7 +66,7 @@ class Plugin extends PluginBase 'icon' => 'icon-pencil', 'iconSvg' => 'plugins/rainlab/blog/assets/images/blog-icon.svg', 'permissions' => ['rainlab.blog.*'], - 'order' => 30, + 'order' => 300, 'sideMenu' => [ 'new_post' => [ @@ -93,8 +110,10 @@ class Plugin extends PluginBase /* * Register the image tag processing callback */ - TagProcessor::instance()->registerCallback(function($input, $preview){ - if (!$preview) return $input; + TagProcessor::instance()->registerCallback(function($input, $preview) { + if (!$preview) { + return $input; + } return preg_replace('|\([0-9]+)]*)\/>|m', ' @@ -114,19 +133,29 @@ class Plugin extends PluginBase */ Event::listen('pages.menuitem.listTypes', function() { return [ - 'blog-category' => 'Blog Category', - 'all-blog-categories' => 'All Blog Categories' + 'blog-category' => 'rainlab.blog::lang.menuitem.blog_category', + 'all-blog-categories' => 'rainlab.blog::lang.menuitem.all_blog_categories', + 'blog-post' => 'rainlab.blog::lang.menuitem.blog_post', + 'all-blog-posts' => 'rainlab.blog::lang.menuitem.all_blog_posts', ]; }); Event::listen('pages.menuitem.getTypeInfo', function($type) { - if ($type == 'blog-category' || $type == 'all-blog-categories') + if ($type == 'blog-category' || $type == 'all-blog-categories') { return Category::getMenuTypeInfo($type); + } + elseif ($type == 'blog-post' || $type == 'all-blog-posts') { + return Post::getMenuTypeInfo($type); + } }); Event::listen('pages.menuitem.resolveItem', function($type, $item, $url, $theme) { - if ($type == 'blog-category' || $type == 'all-blog-categories') + if ($type == 'blog-category' || $type == 'all-blog-categories') { return Category::resolveMenuItem($item, $url, $theme); + } + elseif ($type == 'blog-post' || $type == 'all-blog-posts') { + return Post::resolveMenuItem($item, $url, $theme); + } }); } } diff --git a/plugins/rainlab/blog/README.md b/plugins/rainlab/blog/README.md index 6269b674c5..6ce74d19c9 100644 --- a/plugins/rainlab/blog/README.md +++ b/plugins/rainlab/blog/README.md @@ -20,6 +20,22 @@ You can also add classes or ids to images by using the [markdown extra](http://m ![1](image){#id .class} +## Excerpt Vs. Read more + +Posts are managed by selecting *Blog > Posts* from the menu. Each post can contain an excerpt by entering some text in this field on the *Manage* tab. This content is displayed on the page using the `summary` attribute of the blog post. + + {{ post.summary|raw }} + +Alternatively this field can be left blank and the excerpt can be captured from the main content (*Edit* tab). Use the special tag `` to specify a summary from the main content, all content above this tag will be treated as the summary. For example: + + This is a great introduction to a great blog post. This text is included as part of the excerpt / summary. + + + + Let's dive in to more detail about why this post is so great. This text will not be included in the summary. + +Finally, if no excerpt is specified and the "more" tag is not used, the blog post will capture the first 600 characters of the content and use this for the summary. + ## Implementing front-end pages The plugin provides several components for building the post list page (archive), category page, post details page and category list for the sidebar. @@ -35,6 +51,7 @@ Use the `blogPosts` component to display a list of latest blog posts on a page. * **sortOrder** - the column name and direction used for the sort order of the posts. The default value is **published_at desc**. * **categoryPage** - path to the category page. The default value is **blog/category** - it matches the pages/blog/category.htm file in the theme directory. This property is used in the default component partial for creating links to the blog categories. * **postPage** - path to the post details page. The default value is **blog/post** - it matches the pages/blog/post.htm file in the theme directory. This property is used in the default component partial for creating links to the blog posts. +* **exceptPost** - ignore a single post by its slug or unique ID. The ignored post will not be included in the list, useful for showing other/related posts. The blogPosts component injects the following variables to the page where it's used: @@ -165,7 +182,7 @@ The component can be used on any page, it will hijack the entire page cycle to d == -## Using markdown +## Markdown guide October supports [standard markdown syntax](http://daringfireball.net/projects/markdown/) as well as [extended markdown syntax](http://michelf.ca/projects/php-markdown/extra/) diff --git a/plugins/rainlab/blog/components/Categories.php b/plugins/rainlab/blog/components/Categories.php index 467d266974..2f64bf084c 100644 --- a/plugins/rainlab/blog/components/Categories.php +++ b/plugins/rainlab/blog/components/Categories.php @@ -74,12 +74,16 @@ class Categories extends ComponentBase $categories = BlogCategory::orderBy('name'); if (!$this->property('displayEmpty')) { $categories->whereExists(function($query) { - $query->select(Db::raw(1)) - ->from('rainlab_blog_posts_categories') - ->join('rainlab_blog_posts', 'rainlab_blog_posts.id', '=', 'rainlab_blog_posts_categories.post_id') - ->whereNotNull('rainlab_blog_posts.published') - ->where('rainlab_blog_posts.published', '=', 1) - ->whereRaw('rainlab_blog_categories.id = rainlab_blog_posts_categories.category_id'); + $prefix = Db::getTablePrefix(); + + $query + ->select(Db::raw(1)) + ->from('rainlab_blog_posts_categories') + ->join('rainlab_blog_posts', 'rainlab_blog_posts.id', '=', 'rainlab_blog_posts_categories.post_id') + ->whereNotNull('rainlab_blog_posts.published') + ->where('rainlab_blog_posts.published', '=', 1) + ->whereRaw($prefix.'rainlab_blog_categories.id = '.$prefix.'rainlab_blog_posts_categories.category_id') + ; }); } diff --git a/plugins/rainlab/blog/components/Post.php b/plugins/rainlab/blog/components/Post.php index 428d0470d8..28ff0c3bd3 100644 --- a/plugins/rainlab/blog/components/Post.php +++ b/plugins/rainlab/blog/components/Post.php @@ -56,17 +56,57 @@ class Post extends ComponentBase protected function loadPost() { $slug = $this->property('slug'); - $post = BlogPost::isPublished()->where('slug', $slug)->first(); + + $post = new BlogPost; + + $post = $post->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel') + ? $post->transWhere('slug', $slug) + : $post->where('slug', $slug); + + $post = $post->isPublished()->first(); /* * Add a "url" helper attribute for linking to each category */ if ($post && $post->categories->count()) { - $post->categories->each(function($category){ + $post->categories->each(function($category) { $category->setUrl($this->categoryPage, $this->controller); }); } return $post; } + + public function previousPost() + { + return $this->getPostSibling(-1); + } + + public function nextPost() + { + return $this->getPostSibling(1); + } + + protected function getPostSibling($direction = 1) + { + if (!$this->post) { + return; + } + + $method = $direction === -1 ? 'previousPost' : 'nextPost'; + + if (!$post = $this->post->$method()) { + return; + } + + $postPage = $this->getPage()->getBaseFileName(); + + $post->setUrl($postPage, $this->controller); + + $post->categories->each(function($category) { + $category->setUrl($this->categoryPage, $this->controller); + }); + + return $post; + } } diff --git a/plugins/rainlab/blog/components/Posts.php b/plugins/rainlab/blog/components/Posts.php index 167113a8b8..7bd8fbfdf2 100644 --- a/plugins/rainlab/blog/components/Posts.php +++ b/plugins/rainlab/blog/components/Posts.php @@ -107,6 +107,15 @@ class Posts extends ComponentBase 'default' => 'blog/post', 'group' => 'Links', ], + 'exceptPost' => [ + 'title' => 'rainlab.blog::lang.settings.posts_except_post', + 'description' => 'rainlab.blog::lang.settings.posts_except_post_description', + 'type' => 'string', + 'validationPattern' => 'string', + 'validationMessage' => 'rainlab.blog::lang.settings.posts_except_post_validation', + 'default' => '', + 'group' => 'Exceptions', + ], ]; } @@ -166,7 +175,9 @@ class Posts extends ComponentBase 'page' => $this->property('pageNumber'), 'sort' => $this->property('sortOrder'), 'perPage' => $this->property('postsPerPage'), - 'category' => $category + 'search' => trim(input('search')), + 'category' => $category, + 'exceptPost' => $this->property('exceptPost'), ]); /* @@ -185,12 +196,18 @@ class Posts extends ComponentBase protected function loadCategory() { - if (!$categoryId = $this->property('categoryFilter')) + if (!$slug = $this->property('categoryFilter')) { return null; + } - if (!$category = BlogCategory::whereSlug($categoryId)->first()) - return null; + $category = new BlogCategory; - return $category; + $category = $category->isClassExtendedWith('RainLab.Translate.Behaviors.TranslatableModel') + ? $category->transWhere('slug', $slug) + : $category->where('slug', $slug); + + $category = $category->first(); + + return $category ?: null; } } diff --git a/plugins/rainlab/blog/components/RssFeed.php b/plugins/rainlab/blog/components/RssFeed.php index e97f1bcb4a..715c537473 100644 --- a/plugins/rainlab/blog/components/RssFeed.php +++ b/plugins/rainlab/blog/components/RssFeed.php @@ -50,6 +50,12 @@ class RssFeed extends ComponentBase 'type' => 'string', 'default' => '' ], + 'sortOrder' => [ + 'title' => 'rainlab.blog::lang.settings.posts_order', + 'description' => 'rainlab.blog::lang.settings.posts_order_description', + 'type' => 'dropdown', + 'default' => 'created_at desc', + ], 'postsPerPage' => [ 'title' => 'rainlab.blog::lang.settings.posts_per_page', 'type' => 'string', @@ -84,6 +90,11 @@ class RssFeed extends ComponentBase return Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName'); } + public function getSortOrderOptions() + { + return BlogPost::$allowedSortingOptions; + } + public function onRun() { $this->prepareVars(); diff --git a/plugins/rainlab/blog/components/post/default.htm b/plugins/rainlab/blog/components/post/default.htm index fc3bd37676..26b0b4f7a9 100644 --- a/plugins/rainlab/blog/components/post/default.htm +++ b/plugins/rainlab/blog/components/post/default.htm @@ -1,30 +1,27 @@ {% set post = __SELF__.post %} -
- {{ post.published_at|date('d') }}
- {{ post.published_at|date('M Y') }} -

-

-
{{ post.user.full_name }}

-
-
-

{{ post.title }}

- {% if post.featured_images.count %} - - {% endif %} - {{ post.content_html|raw }} - -
- +
{{ post.content_html|raw }}
-
 
+{% if post.featured_images.count %} + +{% endif %} + +

+ Posted + {% if post.categories.count %} in + {% for category in post.categories %} + {{ category.name }}{% if not loop.last %}, {% endif %} + {% endfor %} + {% endif %} + on {{ post.published_at|date('M d, Y') }} +

diff --git a/plugins/rainlab/blog/components/posts/default.htm b/plugins/rainlab/blog/components/posts/default.htm index 82f830fd19..c1b07bad54 100755 --- a/plugins/rainlab/blog/components/posts/default.htm +++ b/plugins/rainlab/blog/components/posts/default.htm @@ -1,11 +1,40 @@ {% set posts = __SELF__.posts %} + + +{% if posts.lastPage > 1 %} + +{% endif %} \ No newline at end of file diff --git a/plugins/rainlab/blog/composer.lock b/plugins/rainlab/blog/composer.lock index 3ecfe11287..9e83a45d77 100644 --- a/plugins/rainlab/blog/composer.lock +++ b/plugins/rainlab/blog/composer.lock @@ -9,16 +9,16 @@ "packages": [ { "name": "composer/installers", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/composer/installers.git", - "reference": "a3595c5272a6f247228abb20076ed27321e4aae9" + "reference": "d78064c68299743e0161004f2de3a0204e33b804" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/a3595c5272a6f247228abb20076ed27321e4aae9", - "reference": "a3595c5272a6f247228abb20076ed27321e4aae9", + "url": "https://api.github.com/repos/composer/installers/zipball/d78064c68299743e0161004f2de3a0204e33b804", + "reference": "d78064c68299743e0161004f2de3a0204e33b804", "shasum": "" }, "require": { @@ -65,6 +65,7 @@ "MODX Evo", "Mautic", "OXID", + "Plentymarkets", "RadPHP", "SMF", "Thelia", @@ -72,9 +73,11 @@ "agl", "aimeos", "annotatecms", + "attogram", "bitrix", "cakephp", "chef", + "cockpit", "codeigniter", "concrete5", "croogo", @@ -98,16 +101,18 @@ "piwik", "ppi", "puppet", + "reindex", "roundcube", "shopware", "silverstripe", "symfony", "typo3", "wordpress", + "yawik", "zend", "zikula" ], - "time": "2016-07-05 06:18:20" + "time": "2016-08-13 20:53:52" } ], "packages-dev": [], diff --git a/plugins/rainlab/blog/controllers/Posts.php b/plugins/rainlab/blog/controllers/Posts.php index c423401c46..67f23acccb 100644 --- a/plugins/rainlab/blog/controllers/Posts.php +++ b/plugins/rainlab/blog/controllers/Posts.php @@ -18,6 +18,7 @@ class Posts extends Controller public $formConfig = 'config_form.yaml'; public $listConfig = 'config_list.yaml'; public $importExportConfig = 'config_import_export.yaml'; + public $relationConfig; public $requiredPermissions = ['rainlab.blog.access_other_posts', 'rainlab.blog.access_posts']; @@ -87,8 +88,9 @@ class Posts extends Controller if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) { foreach ($checkedIds as $postId) { - if ((!$post = Post::find($postId)) || !$post->canEdit($this->user)) + if ((!$post = Post::find($postId)) || !$post->canEdit($this->user)) { continue; + } $post->delete(); } @@ -104,8 +106,9 @@ class Posts extends Controller */ public function listInjectRowClass($record, $definition = null) { - if (!$record->published) + if (!$record->published) { return 'safe disabled'; + } } public function formBeforeCreate($model) @@ -123,5 +126,4 @@ class Posts extends Controller 'preview' => $previewHtml ]; } - -} \ No newline at end of file +} diff --git a/plugins/rainlab/blog/controllers/posts/_list_toolbar.htm b/plugins/rainlab/blog/controllers/posts/_list_toolbar.htm index d2517b88f6..d0f93f6742 100644 --- a/plugins/rainlab/blog/controllers/posts/_list_toolbar.htm +++ b/plugins/rainlab/blog/controllers/posts/_list_toolbar.htm @@ -25,12 +25,12 @@ - Export posts + - Import posts + diff --git a/plugins/rainlab/blog/controllers/posts/config_filter.yaml b/plugins/rainlab/blog/controllers/posts/config_filter.yaml index 405fc6066f..38f0c2a7b5 100644 --- a/plugins/rainlab/blog/controllers/posts/config_filter.yaml +++ b/plugins/rainlab/blog/controllers/posts/config_filter.yaml @@ -1,6 +1,7 @@ # =================================== # Filter Scope Definitions # =================================== + scopes: category: @@ -31,6 +32,12 @@ scopes: - published = '1' published_date: - label: Date + + # Filter name + label: rainlab.blog::lang.posts.filter_date + + # Filter type type: daterange - conditions: created_at >= ':after' AND created_at <= ':before' \ No newline at end of file + + # SQL Conditions + conditions: created_at >= ':after' AND created_at <= ':before' diff --git a/plugins/rainlab/blog/controllers/posts/config_import_export.yaml b/plugins/rainlab/blog/controllers/posts/config_import_export.yaml index 18eb84ead3..e0cf8c5b56 100644 --- a/plugins/rainlab/blog/controllers/posts/config_import_export.yaml +++ b/plugins/rainlab/blog/controllers/posts/config_import_export.yaml @@ -4,7 +4,7 @@ import: # Page title - title: Import posts + title: rainlab.blog::lang.posts.import_post # Import List Column configuration list: $/rainlab/blog/models/postimport/columns.yaml @@ -23,7 +23,7 @@ import: export: # Page title - title: Export posts + title: rainlab.blog::lang.posts.export_post # Output file name fileName: posts.csv diff --git a/plugins/rainlab/blog/formwidgets/MLBlogMarkdown.php b/plugins/rainlab/blog/formwidgets/MLBlogMarkdown.php index 74ffbc4a9c..9558587279 100644 --- a/plugins/rainlab/blog/formwidgets/MLBlogMarkdown.php +++ b/plugins/rainlab/blog/formwidgets/MLBlogMarkdown.php @@ -68,11 +68,11 @@ class MLBlogMarkdown extends BlogMarkdown /* * Set the translated values to the model */ - if ($this->model->methodExists('setTranslateAttribute')) { + if ($this->model->methodExists('setAttributeTranslated')) { foreach ($localeData as $locale => $value) { - $this->model->setTranslateAttribute('content', $value, $locale); + $this->model->setAttributeTranslated('content', $value, $locale); - $this->model->setTranslateAttribute( + $this->model->setAttributeTranslated( 'content_html', Post::formatHtml($value), $locale diff --git a/plugins/rainlab/blog/lang/bg/lang.php b/plugins/rainlab/blog/lang/bg/lang.php index ac33ee9152..6e5161df1f 100644 --- a/plugins/rainlab/blog/lang/bg/lang.php +++ b/plugins/rainlab/blog/lang/bg/lang.php @@ -93,6 +93,8 @@ return [ 'posts_category' => 'страница на категориите', 'posts_category_description' => 'Име на страницата за категории , за "публикувано в". Това се използва подразбиране от компонента.', 'posts_post' => 'Post page', - 'posts_post_description' => 'Име на страницата за публикации "Прочетете повече". Това се използва подразбиране от компонента.' + 'posts_post_description' => 'Име на страницата за публикации "Прочетете повече". Това се използва подразбиране от компонента.', + 'posts_except_post' => 'Except post', + 'posts_except_post_description' => 'Enter ID/URL or variable with post ID/URL you want to except', ] ]; diff --git a/plugins/rainlab/blog/lang/cs/lang.php b/plugins/rainlab/blog/lang/cs/lang.php index 0d11f43905..34658a4bf7 100644 --- a/plugins/rainlab/blog/lang/cs/lang.php +++ b/plugins/rainlab/blog/lang/cs/lang.php @@ -17,16 +17,20 @@ return [ 'access_categories' => 'Správa blogových kategorií', 'access_other_posts' => 'Správa příspěvků ostatních uživatelů', 'access_import_export' => 'Možnost importu a exportu příspěvků', + 'access_publish' => 'Možnost publikovat příspěvky', 'delete_confirm' => 'Jste si jistí?', 'chart_published' => 'Publikované', 'chart_drafts' => 'Návrhy', - 'chart_total' => 'Celkem' + 'chart_total' => 'Celkem', ], 'posts' => [ 'list_title' => 'Správa blogových příspěvků', 'filter_category' => 'Kategorie', 'filter_published' => 'Schovat publikované', - 'new_post' => 'Nový příspěvek' + 'filter_date' => 'Datum', + 'new_post' => 'Nový příspěvek', + 'export_post' => 'Export příspěvků', + 'import_post' => 'Import příspěvků', ], 'post' => [ 'title' => 'Název', @@ -55,12 +59,12 @@ return [ 'featured_images' => 'Obrázky', 'delete_confirm' => 'Opravdu chcete smazat tento příspěvek?', 'close_confirm' => 'Příspěvek není uložený.', - 'return_to_posts' => 'Zpět na seznam příspěvků' + 'return_to_posts' => 'Zpět na seznam příspěvků', ], 'categories' => [ 'list_title' => 'Správa blogových kategorií', 'new_category' => 'Nová kategorie', - 'uncategorized' => 'Nezařazeno' + 'uncategorized' => 'Nezařazeno', ], 'category' => [ 'name' => 'Název', @@ -69,7 +73,12 @@ return [ 'slug_placeholder' => 'zadejte-url-kategorie', 'posts' => 'Počet příspěvků', 'delete_confirm' => 'Opravdu chcete smazat tuto kategorii?', - 'return_to_categories' => 'Zpět na seznam blogových kategorií' + 'return_to_categories' => 'Zpět na seznam blogových kategorií', + 'reorder' => 'Změnit pořadí', + ], + 'menuitem' => [ + 'blog_category' => 'Blogová kategorie', + 'all_blog_categories' => 'Všechny blogové kategorie', ], 'settings' => [ 'category_title' => 'Seznam kategorií', @@ -101,6 +110,12 @@ return [ 'posts_category' => 'Stránka kategorií', 'posts_category_description' => 'Vyberte stránku která slouží k zobrazení všech kategorií (nebo detailu kategorie).', 'posts_post' => 'Stránka příspěvků', - 'posts_post_description' => 'Vyberte stránku která slouží k zobrazení článků (nebo detailu článku).' + 'posts_post_description' => 'Vyberte stránku která slouží k zobrazení článků (nebo detailu článku).', + 'posts_except_post' => 'Vyloučit příspěvěk', + 'posts_except_post_description' => 'Zadejte ID nebo URL příspěvku který chcete vyloučit', + 'rssfeed_blog' => 'Blogová stránka', + 'rssfeed_blog_description' => 'Name of the main blog page file for generating links. This property is used by the default component partial.', + 'rssfeed_title' => 'RSS Kanál', + 'rssfeed_description' => 'Vygeneruje RSS kanál který obsahuje blogové příspěvky.', ] ]; diff --git a/plugins/rainlab/blog/lang/de/lang.php b/plugins/rainlab/blog/lang/de/lang.php index 5fb484c8c2..89575dc4ab 100644 --- a/plugins/rainlab/blog/lang/de/lang.php +++ b/plugins/rainlab/blog/lang/de/lang.php @@ -16,6 +16,8 @@ return [ 'access_posts' => 'Blog Artikel verwalten', 'access_categories' => 'Blog Kategorien verwalten', 'access_other_posts' => 'Blog Artikel anderer Benutzer verwalten', + 'access_import_export' => 'Blog Artikel importieren oder exportieren', + 'access_publish' => 'Kann Artikel veröffentlichen', 'delete_confirm' => 'Bist du sicher?', 'chart_published' => 'Veröffentlicht', 'chart_drafts' => 'Entwurf', @@ -25,17 +27,26 @@ return [ 'list_title' => 'Blog Artikel verwalten', 'filter_category' => 'Kategorie', 'filter_published' => 'Veröffentlichte ausblenden', - 'new_post' => 'Neuer Artikel' + 'filter_date' => 'Date', + 'new_post' => 'Neuer Artikel', + 'export_post' => 'Exportiere Artikel', + 'import_post' => 'Importiere Artikel' ], 'post' => [ 'title' => 'Titel', 'title_placeholder' => 'Neuer Titel', + 'content' => 'Inhalt', + 'content_html' => 'HTML-Inhalt', 'slug' => 'Slug', - 'slug_placeholder' => 'new-post-slug', + 'slug_placeholder' => 'neuer-artikel-slug', 'categories' => 'Kategorien', + 'author_email' => 'Autor E-Mail', 'created' => 'Erstellt', + 'created_date' => 'Erstellzeitpunkt', 'updated' => 'Aktualisiert', + 'updated_date' => 'Aktualisierungszeitpunk', 'published' => 'Veröffentlicht', + 'published_date' => 'Veröffentlichungszeitpunkt', 'published_validation' => 'Bitte gebe das Datum der Veröffentlichung an', 'tab_edit' => 'Bearbeiten', 'tab_categories' => 'Kategorien', @@ -44,8 +55,9 @@ return [ 'tab_manage' => 'Verwalten', 'published_on' => 'Veröffentlicht am', 'excerpt' => 'Textauszug', + 'summary' => 'Zusammenfassung', 'featured_images' => 'Zugehörige Bilder', - 'delete_confirm' => 'Möchtest du diesen Post wirklich löschen?', + 'delete_confirm' => 'Möchtest du diesen Artikel wirklich löschen?', 'close_confirm' => 'Der Artikel ist noch nicht gespeichert.', 'return_to_posts' => 'Zurück zur Artikel-Übersicht' ], @@ -57,16 +69,24 @@ return [ 'category' => [ 'name' => 'Name', 'name_placeholder' => 'Neuer Kategorie Name', + 'description' => 'Beschreibung', 'slug' => 'Slug', - 'slug_placeholder' => 'new-category-slug', - 'posts' => 'Posts', + 'slug_placeholder' => 'neuer-kategorie-slug', + 'posts' => 'Artikel', 'delete_confirm' => 'Möchtest du die Kategorie wirklich löschen?', - 'return_to_categories' => 'Zurück zur Kategorie-Übersicht.' + 'return_to_categories' => 'Zurück zur Kategorie-Übersicht.', + 'reorder' => 'Kategorien sortieren' + ], + 'menuitem' => [ + 'blog_category' => 'Blog Kategorie', + 'all_blog_categories' => 'Alle Blog Kategorien', + 'blog_post' => 'Blog Artikel', + 'all_blog_posts' => 'Alle Blog Artikel' ], 'settings' => [ 'category_title' => 'Blog Kategorie-Übersicht', 'category_description' => 'Zeigt eine Blog Kategorien-Übersicht.', - 'category_slug' => 'Slug param name', + 'category_slug' => 'Slug Parametername', 'category_slug_description' => 'Der URL-Routen-Parameter welcher verwendet wird um die aktuelle Kategorie zu bestimmen. Wird von der Standard-Komponente benötigt um die aktive Kategorie zu markieren.', 'category_display_empty' => 'Leere Kategorien anzeigen', 'category_display_empty_description' => 'Kategorien zeigen welche keine Artikel besitzen.', @@ -74,14 +94,14 @@ return [ 'category_page_description' => 'Name der Kategorien-Seiten-Datei für die Kategorien Links. Wird von der Standard-Komponente benötigt.', 'post_title' => 'Blog Artikel', 'post_description' => 'Zeigt einen Blog Artikel auf der Seite.', - 'post_slug' => 'Slug Parameter Name', + 'post_slug' => 'Slug Parametername', 'post_slug_description' => 'Der URL-Routen-Parameter um den Post mittels "Slug" zu bestimmen.', 'post_category' => 'Kategorien-Seite', 'post_category_description' => 'Name der Kategorien-Seiten-Datei für Kategorie-Links.', 'posts_title' => 'Blog Artikel-Übersicht', 'posts_description' => 'Stellt eine Liste der neuesten Artikel auf der Seite dar.', - 'posts_pagination' => 'Blättern Parameter-Name', - 'posts_pagination_description' => 'Der erwartete Parameter-Name welcher für Seiten verwendet wird.', + 'posts_pagination' => 'Blättern Parametername', + 'posts_pagination_description' => 'Der erwartete Parametername welcher für Seiten verwendet wird.', 'posts_filter' => 'Kategorien-Filter', 'posts_filter_description' => 'Bitte gebe ein Kategorien-Slug oder URL-Parameter an, mittels den die Artikel gefiltert werden. Wenn der Wert leer ist, werden alle Artikel angezeigt.', 'posts_per_page' => 'Artikel pro Seite', @@ -93,6 +113,12 @@ return [ 'posts_category' => 'Kategorien-Seite', 'posts_category_description' => 'Name der Kategorien-Seiten-Datei für "Veröffentlicht in" Kategorien-Links. Dieser Wert von der Standard-Komponente verwendet.', 'posts_post' => 'Artikel Seite', - 'posts_post_description' => 'Name der Artikel-Seiten-Datei für die "Erfahre mehr" Links. Dieser Wert für von der Standard-Komponente verwendet.' + 'posts_post_description' => 'Name der Artikel-Seiten-Datei für die "Erfahre mehr" Links. Dieser Wert für von der Standard-Komponente verwendet.', + 'posts_except_post' => 'Artikel ausschließen', + 'posts_except_post_description' => 'Gebe direkt die ID/URL oder eine Variable mit der Artikel-ID/URL an um diesen Artikel auszuschließen. Dieser Wert für von der Standard-Komponente verwendet.', + 'rssfeed_blog' => 'Blog Seite', + 'rssfeed_blog_description' => 'Name der Artikel-Seiten-Datei für die Links. Dieser Wert für von der Standard-Komponente verwendet.', + 'rssfeed_title' => 'RSS-Feed', + 'rssfeed_description' => 'Erstellt einen RSS-Feed mit Artikeln aus dem Blog.' ] ]; diff --git a/plugins/rainlab/blog/lang/en/lang.php b/plugins/rainlab/blog/lang/en/lang.php index 3a80a2c9e2..6badb9039f 100644 --- a/plugins/rainlab/blog/lang/en/lang.php +++ b/plugins/rainlab/blog/lang/en/lang.php @@ -17,6 +17,7 @@ return [ 'access_categories' => 'Manage the blog categories', 'access_other_posts' => 'Manage other users blog posts', 'access_import_export' => 'Allowed to import and export posts', + 'access_publish' => 'Allowed to publish posts', 'delete_confirm' => 'Are you sure?', 'chart_published' => 'Published', 'chart_drafts' => 'Drafts', @@ -26,7 +27,10 @@ return [ 'list_title' => 'Manage the blog posts', 'filter_category' => 'Category', 'filter_published' => 'Published', - 'new_post' => 'New post' + 'filter_date' => 'Date', + 'new_post' => 'New post', + 'export_post' => 'Export posts', + 'import_post' => 'Import posts' ], 'post' => [ 'title' => 'Title', @@ -53,7 +57,7 @@ return [ 'excerpt' => 'Excerpt', 'summary' => 'Summary', 'featured_images' => 'Featured Images', - 'delete_confirm' => 'Do you really want to delete this post?', + 'delete_confirm' => 'Delete this post?', 'close_confirm' => 'The post is not saved.', 'return_to_posts' => 'Return to posts list' ], @@ -65,13 +69,20 @@ return [ 'category' => [ 'name' => 'Name', 'name_placeholder' => 'New category name', + 'description' => 'Description', 'slug' => 'Slug', 'slug_placeholder' => 'new-category-slug', 'posts' => 'Posts', - 'delete_confirm' => 'Do you really want to delete this category?', + 'delete_confirm' => 'Delete this category?', 'return_to_categories' => 'Return to the blog category list', 'reorder' => 'Reorder Categories' ], + 'menuitem' => [ + 'blog_category' => 'Blog category', + 'all_blog_categories' => 'All blog categories', + 'blog_post' => 'Blog post', + 'all_blog_posts' => 'All blog posts' + ], 'settings' => [ 'category_title' => 'Category List', 'category_description' => 'Displays a list of blog categories on the page.', @@ -103,9 +114,11 @@ return [ 'posts_category_description' => 'Name of the category page file for the "Posted into" category links. This property is used by the default component partial.', 'posts_post' => 'Post page', 'posts_post_description' => 'Name of the blog post page file for the "Learn more" links. This property is used by the default component partial.', + 'posts_except_post' => 'Except post', + 'posts_except_post_description' => 'Enter ID/URL or variable with post ID/URL you want to except', 'rssfeed_blog' => 'Blog page', 'rssfeed_blog_description' => 'Name of the main blog page file for generating links. This property is used by the default component partial.', 'rssfeed_title' => 'RSS Feed', - 'rssfeed_description' => 'Generates an RSS feed containing posts from the blog.', + 'rssfeed_description' => 'Generates an RSS feed containing posts from the blog.' ] ]; diff --git a/plugins/rainlab/blog/lang/fa/lang.php b/plugins/rainlab/blog/lang/fa/lang.php index 98bddc00ee..0413451917 100644 --- a/plugins/rainlab/blog/lang/fa/lang.php +++ b/plugins/rainlab/blog/lang/fa/lang.php @@ -69,7 +69,8 @@ return [ 'slug_placeholder' => 'آدرس-جدید-دسته-بندی', 'posts' => 'پست ها', 'delete_confirm' => 'آیا از حذف این دسته بندی اطمینان دارید؟', - 'return_to_categories' => 'بازگشت به لیست دسته بندی های وبلاگ' + 'return_to_categories' => 'بازگشت به لیست دسته بندی های وبلاگ', + 'reorder' => 'مرتب سازی دسته بندی ها' ], 'settings' => [ 'category_title' => 'لیست دسته بندی', @@ -101,6 +102,8 @@ return [ 'posts_category' => 'صفحه دسته بندی', 'posts_category_description' => 'نام صفحه دسته بندی برای نمایش پستهای مربوط به آن.', 'posts_post' => 'صفحه پست', - 'posts_post_description' => 'نام صفحه مربوط به نمایش کامل پست ها جهت لینک ادامه مطلب' + 'posts_post_description' => 'نام صفحه مربوط به نمایش کامل پست ها جهت لینک ادامه مطلب', + 'posts_except_post' => 'Except post', + 'posts_except_post_description' => 'Enter ID/URL or variable with post ID/URL you want to except', ] ]; diff --git a/plugins/rainlab/blog/lang/fr/lang.php b/plugins/rainlab/blog/lang/fr/lang.php index 6e5dd1056a..023774240e 100644 --- a/plugins/rainlab/blog/lang/fr/lang.php +++ b/plugins/rainlab/blog/lang/fr/lang.php @@ -17,6 +17,7 @@ return [ 'access_categories' => 'Gérer les catégories', 'access_other_posts' => 'Gérer les articles d’autres utilisateurs', 'access_import_export' => 'Autorisé à importer et exporter des articles', + 'access_publish' => 'Autorisé à publier des articles', 'delete_confirm' => 'Confirmez-vous la suppression des articles sélectionnés ?', 'chart_published' => 'Publié', 'chart_drafts' => 'Brouillons', @@ -26,7 +27,10 @@ return [ 'list_title' => 'Gérer les articles du blog', 'filter_category' => 'Catégorie', 'filter_published' => 'Masquer la publication', - 'new_post' => 'Nouvel article' + 'filter_date' => 'Date', + 'new_post' => 'Nouvel article', + 'export_post' => 'Exporter les articles', + 'import_post' => 'Importer des articles' ], 'post' => [ 'title' => 'Titre', @@ -65,6 +69,7 @@ return [ 'category' => [ 'name' => 'Nom', 'name_placeholder' => 'Nom de la nouvelle catégorie', + 'description' => 'Description', 'slug' => 'Adresse URL', 'slug_placeholder' => 'adresse-de-la-nouvelle-catégorie', 'posts' => 'Articles', @@ -72,6 +77,10 @@ return [ 'return_to_categories' => 'Retour à la liste des catégories', 'reorder' => 'Réorganiser les catégories' ], + 'menuitem' => [ + 'blog_category' => 'Catégories du blog', + 'all_blog_categories' => 'Toutes les catégories du blog' + ], 'settings' => [ 'category_title' => 'Liste des catégories', 'category_description' => 'Afficher une liste des catégories sur la page.', @@ -99,9 +108,15 @@ return [ 'posts_no_posts_description' => 'Message à afficher dans la liste d’articles lorsqu’il n’y a aucun article. Cette propriété est utilisée par le partial par défaut du composant.', 'posts_order' => 'Ordre des articles', 'posts_order_description' => 'Attribut selon lequel les articles seront ordonnés', + 'posts_except_post' => 'Except post', + 'posts_except_post_description' => 'Enter ID/URL or variable with post ID/URL you want to except', 'posts_category' => 'Page des catégories', 'posts_category_description' => 'Nom de la page des catégories pour les liens de catégories "Publié dans". Cette propriété est utilisée par le partial par défaut du composant.', 'posts_post' => 'Page d’article', - 'posts_post_description' => 'Nom de la page d’articles pour les liens "En savoir plus". Cette propriété est utilisée par le partial par défaut du composant.' + 'posts_post_description' => 'Nom de la page d’articles pour les liens "En savoir plus". Cette propriété est utilisée par le partial par défaut du composant.', + 'rssfeed_blog' => 'Page du blog', + 'rssfeed_blog_description' => 'Nom de la page principale du blog pour générer les liens. Cette propriété est utilisé par le composant dans le partial.', + 'rssfeed_title' => 'Flux RSS', + 'rssfeed_description' => 'Génère un Flux RSS contenant les articles du blog.' ] ]; diff --git a/plugins/rainlab/blog/lang/hu/lang.php b/plugins/rainlab/blog/lang/hu/lang.php index e13c4c4ad5..66cc936478 100644 --- a/plugins/rainlab/blog/lang/hu/lang.php +++ b/plugins/rainlab/blog/lang/hu/lang.php @@ -17,16 +17,20 @@ return [ 'access_categories' => 'Blog kategóriák kezelése', 'access_other_posts' => 'Más felhasználók bejegyzéseinek kezelése', 'access_import_export' => 'Bejegyzések importálása és exportálása', - 'delete_confirm' => 'Valóban törölni akarja a kijelölt bejegyzéseket?', + 'access_publish' => 'Blog bejegyzések közzététele', + 'delete_confirm' => 'Törölni akarja a kijelölt bejegyzéseket?', 'chart_published' => 'Közzétéve', 'chart_drafts' => 'Piszkozatok', 'chart_total' => 'Összesen' ], 'posts' => [ - 'list_title' => 'Blog bejegyzések kezelése', + 'list_title' => 'Blog bejegyzések', 'filter_category' => 'Kategória', - 'filter_published' => 'Közzétettek elrejtése', - 'new_post' => 'Új bejegyzés' + 'filter_published' => 'Közzétéve', + 'filter_date' => 'Létrehozva', + 'new_post' => 'Új bejegyzés', + 'export_post' => 'Exportálás', + 'import_post' => 'Importálás' ], 'post' => [ 'title' => 'Cím', @@ -39,8 +43,8 @@ return [ 'author_email' => 'Szerző e-mail címe', 'created' => 'Létrehozva', 'created_date' => 'Létrehozás dátuma', - 'updated' => 'Frissítve', - 'updated_date' => 'Frissítés dátuma', + 'updated' => 'Módosítva', + 'updated_date' => 'Módosítás dátuma', 'published' => 'Közzétéve', 'published_date' => 'Közzététel dátuma', 'published_validation' => 'Adja meg a közzététel dátumát', @@ -58,18 +62,26 @@ return [ 'return_to_posts' => 'Vissza a bejegyzésekhez' ], 'categories' => [ - 'list_title' => 'A blog kategóriák kezelése', + 'list_title' => 'Blog kategóriák', 'new_category' => 'Új kategória', 'uncategorized' => 'Nincs kategorizálva' ], 'category' => [ 'name' => 'Név', 'name_placeholder' => 'Új kategória neve', + 'description' => 'Leírás', 'slug' => 'Keresőbarát cím', 'slug_placeholder' => 'uj-kategoria-keresobarat-neve', 'posts' => 'Bejegyzések', 'delete_confirm' => 'Valóban törölni akarja ezt a kategóriát?', - 'return_to_categories' => 'Vissza a kategóriákhoz' + 'return_to_categories' => 'Vissza a kategóriákhoz', + 'reorder' => 'Kategóriák sorrendje' + ], + 'menuitem' => [ + 'blog_category' => 'Blog kategória', + 'all_blog_categories' => 'Összes blog kategória', + 'blog_post' => 'Blog bejegyzés', + 'all_blog_posts' => 'Összes blog bejegyzés' ], 'settings' => [ 'category_title' => 'Blog kategória lista', @@ -80,7 +92,7 @@ return [ 'category_display_empty_description' => 'Azon kategóriák megjelenítése, melyekben nincs egy bejegyzés sem.', 'category_page' => 'Kategórialap', 'category_page_description' => 'A kategória hivatkozások kategórialap fájljának neve. Az alapértelmezett komponensrész használja ezt a tulajdonságot.', - 'post_title' => 'Blogbejegyzés', + 'post_title' => 'Blog bejegyzés', 'post_description' => 'Egy blog bejegyzést jelez ki a lapon.', 'post_slug' => 'Keresőbarát cím paraméter neve', 'post_slug_description' => 'A webcím útvonal paramétere a bejegyzés keresőbarát címe alapján való kereséséhez.', @@ -97,10 +109,16 @@ return [ 'posts_no_posts' => 'Nincsenek bejegyzések üzenet ', 'posts_no_posts_description' => 'A blog bejegyzés listában kijelezendő üzenet abban az esetben, ha nincsenek bejegyzések. Az alapértelmezett komponensrész használja ezt a tulajdonságot.', 'posts_order' => 'Bejegyzések sorrendje', - 'posts_order_description' => 'Attribútum, mely alapján rendezni kell a bejegyzéseket', + 'posts_order_description' => 'Jellemző, ami alapján rendezni kell a bejegyzéseket', 'posts_category' => 'Kategórialap', 'posts_category_description' => 'A "Kategória" kategória hivatkozások kategórialap fájljának neve. Az alapértelmezett komponensrész használja ezt a tulajdonságot.', 'posts_post' => 'Bejegyzéslap', - 'posts_post_description' => 'A "Tovább olvasom" hivatkozások blog bejegyzéslap fájljának neve. Az alapértelmezett komponensrész használja ezt a tulajdonságot.' + 'posts_post_description' => 'A "Tovább olvasom" hivatkozások blog bejegyzéslap fájljának neve. Az alapértelmezett komponensrész használja ezt a tulajdonságot.', + 'posts_except_post' => 'Bejegyzés kizárása', + 'posts_except_post_description' => 'Adja meg annak a bejegyzésnek az azonosítóját vagy webcímét, amit nem akar megjeleníteni a listázáskor.', + 'rssfeed_blog' => 'Blog oldal', + 'rssfeed_blog_description' => 'Annak a lapnak a neve, ahol listázódnak a blog bejegyzések. Ezt a beállítást használja alapértelmezetten a blog komponens is.', + 'rssfeed_title' => 'RSS hírfolyam', + 'rssfeed_description' => 'A bloghoz tartozó RSS hírfolyam generálása.' ] ]; diff --git a/plugins/rainlab/blog/lang/it/lang.php b/plugins/rainlab/blog/lang/it/lang.php new file mode 100644 index 0000000000..0eade81aa6 --- /dev/null +++ b/plugins/rainlab/blog/lang/it/lang.php @@ -0,0 +1,107 @@ + [ + 'name' => 'Blog', + 'description' => 'Una solida piattaforma di blogging.' + ], + 'blog' => [ + 'menu_label' => 'Blog', + 'menu_description' => 'Gestisci i post', + 'posts' => 'Post', + 'create_post' => 'post del blog', + 'categories' => 'Categorie', + 'create_category' => 'categorie del blog', + 'tab' => 'Blog', + 'access_posts' => 'Gestisci i post', + 'access_categories' => 'Gestisci le categorie', + 'access_other_posts' => 'Gestisci i post di altri utenti', + 'access_import_export' => 'Permesso ad importare ed esportare i post', + 'delete_confirm' => 'Sei sicuro?', + 'chart_published' => 'Pubblicato', + 'chart_drafts' => 'Bozze', + 'chart_total' => 'Totale' + ], + 'posts' => [ + 'list_title' => 'Gestisci i post', + 'category' => 'Categoria', + 'hide_published' => 'Nascondi pubblicati', + 'new_post' => 'Nuovo post' + ], + 'post' => [ + 'title' => 'Titolo', + 'title_placeholder' => 'Titolo del nuovo post', + 'content' => 'Contenuto', + 'content_html' => 'Contenuto HTML', + 'slug' => 'Slug', + 'slug_placeholder' => 'slug-del-nuovo-post', + 'categories' => 'Categorie', + 'author_email' => 'Email dell\'autore', + 'created' => 'Creato', + 'created_date' => 'Data di creazione', + 'updated' => 'Aggiornato', + 'updated_date' => 'Data di aggiornamento', + 'published' => 'Pubblicato', + 'published_date' => 'Data di pubblicazione', + 'published_validation' => 'Per favore fornisci la data di pubblicazione', + 'tab_edit' => 'Modifica', + 'tab_categories' => 'Categorie', + 'categories_comment' => 'Seleziona le categorie a cui appartiene il post', + 'categories_placeholder' => 'Non ci sono categorie, per iniziare dovresti crearne una!', + 'tab_manage' => 'Gestisci', + 'published_on' => 'Pubblicato il', + 'excerpt' => 'Estratto', + 'summary' => 'Riassunto', + 'featured_images' => 'Immagini in evidenza', + 'delete_confirm' => 'Vuoi veramente cancellare questo post?', + 'close_confirm' => 'Questo post non è salvato.', + 'return_to_posts' => 'Ritorna all\'elenco dei post' + ], + 'categories' => [ + 'list_title' => 'Gestisci le categorie del blog', + 'new_category' => 'Nuova categoria', + 'uncategorized' => 'Non categorizzato' + ], + 'category' => [ + 'name' => 'Nome', + 'name_placeholder' => 'Nome della nuova categoria', + 'slug' => 'Slug', + 'slug_placeholder' => 'slug-nuova-categoria', + 'posts' => 'Post', + 'delete_confirm' => 'Vuoi veramente cancellare questa categoria?', + 'return_to_categories' => 'Ritorna all\'elenco delle categorie del blog', + 'reorder' => 'Riordino Categorie' + ], + 'settings' => [ + 'category_title' => 'Elenco Categorie', + 'category_description' => 'Mostra un\'elenco delle categorie del blog sulla pagina.', + 'category_slug' => 'Slug categoria', + 'category_slug_description' => "Cerca la categoria del blog usando lo slug fornito. Questa proprietà è usata dal componente parziale di default per segnare la categoria attualmente usata.", + 'category_display_empty' => 'Mostra categorie vuote', + 'category_display_empty_description' => 'Mostra categorie che non hanno alcun post.', + 'category_page' => 'Pagina delle categorie', + 'category_page_description' => 'Nome del file della pagina delle categorie contenente i link delle categorie. Questa proprietà è usata dal componente parziale di default.', + 'post_title' => 'Post', + 'post_description' => 'Mostra un post sulla pagina.', + 'post_slug' => 'Slug del post', + 'post_slug_description' => "Cerca il post con lo slug fornito.", + 'post_category' => 'Pagina delle categorie', + 'post_category_description' => 'Nome del file della pagina delle categorie contenente i link delle categorie. Questa proprietà è usata dal componente parziale di default.', + 'posts_title' => 'Elenco dei post', + 'posts_description' => 'Mostra un\'elenco degli ultimi post sulla pagina.', + 'posts_pagination' => 'Numero di pagina', + 'posts_pagination_description' => 'Questo valore è usato per determinare su quale pagina è l\'utente.', + 'posts_filter' => 'Filtro delle categorie', + 'posts_filter_description' => 'Inserisci lo slug di una categoria o un parametro dell\'URL con il quale filtrare i post. Lascia vuoto per mostrare tutti i post.', + 'posts_per_page' => 'Post per pagina', + 'posts_per_page_validation' => 'Il valore di post per pagina ha un formato non valido ', + 'posts_no_posts' => 'Messaggio per l\'assenza di post', + 'posts_no_posts_description' => 'Messaggio da mostrare nell\'elenco dei post in caso non ce ne siano. Questa proprietà è usata dal componente parziale di default.', + 'posts_order' => 'Ordine dei post', + 'posts_order_description' => 'Attributo sul quale i post dovrebbero esser ordinati', + 'posts_category' => 'Pagina delle categorie', + 'posts_category_description' => 'Nome del file per la pagina delle categorie per i link "Postato in" alle categorie. Questa proprietà è usata dal componente parziale di default.', + 'posts_post' => 'Pagina del post', + 'posts_post_description' => 'Nome del file per la pagina del post per i link "Scopri di più". Questa proprietà è usata dal componente parziale di default.' + ] +]; diff --git a/plugins/rainlab/blog/lang/ja/lang.php b/plugins/rainlab/blog/lang/ja/lang.php index 86c116b9ed..be6d0b4854 100644 --- a/plugins/rainlab/blog/lang/ja/lang.php +++ b/plugins/rainlab/blog/lang/ja/lang.php @@ -93,6 +93,8 @@ return [ 'posts_category' => 'カテゴリページ', 'posts_category_description' => 'カテゴリリンクを生成するために、カテゴリページのファイル名を指定します。この項目はコンポーネントのデフォルトパーシャルで使用されます。', 'posts_post' => '投稿ページ', - 'posts_post_description' => '"Learn more"リンクを生成するため、投稿ページのファイル名を指定します。拡張子(.htm)は省いてください。この項目はコンポーネントのデフォルトパーシャルで使用されます。' + 'posts_post_description' => '"Learn more"リンクを生成するため、投稿ページのファイル名を指定します。拡張子(.htm)は省いてください。この項目はコンポーネントのデフォルトパーシャルで使用されます。', + 'posts_except_post' => 'Except post', + 'posts_except_post_description' => 'Enter ID/URL or variable with post ID/URL you want to except', ] ]; diff --git a/plugins/rainlab/blog/lang/nb-no/lang.php b/plugins/rainlab/blog/lang/nb-no/lang.php index 976c143e3e..d0336326cc 100644 --- a/plugins/rainlab/blog/lang/nb-no/lang.php +++ b/plugins/rainlab/blog/lang/nb-no/lang.php @@ -93,5 +93,7 @@ return [ 'posts_category_description' => 'Name of the category page file for the "Posted into" category links. This property is used by the default component partial.', 'posts_post' => 'Post page', 'posts_post_description' => 'Name of the blog post page file for the "Learn more" links. This property is used by the default component partial.', + 'posts_except_post' => 'Except post', + 'posts_except_post_description' => 'Enter ID/URL or variable with post ID/URL you want to except', ], ]; diff --git a/plugins/rainlab/blog/lang/nl/lang.php b/plugins/rainlab/blog/lang/nl/lang.php index 56659da51c..6142835fae 100644 --- a/plugins/rainlab/blog/lang/nl/lang.php +++ b/plugins/rainlab/blog/lang/nl/lang.php @@ -101,6 +101,8 @@ return [ 'posts_category' => 'Categorie pagina', 'posts_category_description' => 'Naam van categorie pagina bestand voor gekoppeld artikel overzichts pagina. Deze waarde wordt standaard gebruikt door de partial.', 'posts_post' => 'Artikel pagina', - 'posts_post_description' => 'Naam van blog pagina bestand voor de "Lees meer" links. Deze waarde wordt standaard gebruikt door de partial.' + 'posts_post_description' => 'Naam van blog pagina bestand voor de "Lees meer" links. Deze waarde wordt standaard gebruikt door de partial.', + 'posts_except_post' => 'Except post', + 'posts_except_post_description' => 'Enter ID/URL or variable with post ID/URL you want to except', ] ]; diff --git a/plugins/rainlab/blog/lang/pl/lang.php b/plugins/rainlab/blog/lang/pl/lang.php index b201d181a7..f79cd7398f 100644 --- a/plugins/rainlab/blog/lang/pl/lang.php +++ b/plugins/rainlab/blog/lang/pl/lang.php @@ -93,6 +93,8 @@ return [ 'posts_category' => 'Strona kategorii', 'posts_category_description' => 'Nazwa strony kategorii w wyświetlaniu linków "Posted into" [Opublikowano w]. Ten parametr jest domyślnie używany przez komponent.', 'posts_post' => 'Strona postu', - 'posts_post_description' => 'Nazwa strony postu dla linków "Learn more" [Czytaj więcej]. Ten parametr jest domyślnie używany przez komponent.' + 'posts_post_description' => 'Nazwa strony postu dla linków "Learn more" [Czytaj więcej]. Ten parametr jest domyślnie używany przez komponent.', + 'posts_except_post' => 'Except post', + 'posts_except_post_description' => 'Enter ID/URL or variable with post ID/URL you want to except', ] ]; diff --git a/plugins/rainlab/blog/lang/pt-br/lang.php b/plugins/rainlab/blog/lang/pt-br/lang.php index 9bec325dc0..98037ce293 100644 --- a/plugins/rainlab/blog/lang/pt-br/lang.php +++ b/plugins/rainlab/blog/lang/pt-br/lang.php @@ -9,14 +9,15 @@ return [ 'menu_label' => 'Blog', 'menu_description' => 'Gerencie os posts do blog', 'posts' => 'Posts', - 'create_post' => 'blog post', + 'create_post' => 'Blog post', 'categories' => 'Categorias', - 'create_category' => 'blog categoria', + 'create_category' => 'Blog categoria', 'tab' => 'Blog', 'access_posts' => 'Gerencie os posts do blog', 'access_categories' => 'Gerenciar as categorias de blog', - 'access_other_posts' => 'Gerencie outros postos de usuários do blog', + 'access_other_posts' => 'Gerencie outros posts de usuários do blog', 'access_import_export' => 'Permissão para importação e exportação de mensagens', + 'access_publish' => 'Permitido publicar posts', 'delete_confirm' => 'Você tem certeza?', 'chart_published' => 'Publicados', 'chart_drafts' => 'Rascunhos', @@ -26,7 +27,10 @@ return [ 'list_title' => 'Gerencie os posts do blog', 'filter_category' => 'Categoria', 'filter_published' => 'Esconder publicados', - 'new_post' => 'Novo post' + 'filter_date' => 'Data', + 'new_post' => 'Novo post', + 'export_post' => 'Exportar posts', + 'import_post' => 'Importar posts' ], 'post' => [ 'title' => 'Título', @@ -65,11 +69,19 @@ return [ 'category' => [ 'name' => 'Nome', 'name_placeholder' => 'Novo nome para a categoria', + 'description' => 'Descrição', 'slug' => 'Slug', 'slug_placeholder' => 'novo-slug-da-categoria', 'posts' => 'Posts', 'delete_confirm' => 'Você realmente quer apagar esta categoria?', - 'return_to_categories' => 'Voltar para a lista de categorias do blog' + 'return_to_categories' => 'Voltar para a lista de categorias do blog', + 'reorder' => 'Reordenar Categorias' + ], + 'menuitem' => [ + 'blog_category' => 'Blog categoria', + 'all_blog_categories' => 'Todas as categorias de blog', + 'blog_post' => 'Blog post', + 'all_blog_posts' => 'Todas as postagens do blog' ], 'settings' => [ 'category_title' => 'Lista de categoria', @@ -101,6 +113,12 @@ return [ 'posts_category' => 'Página de Categoria', 'posts_category_description' => 'Nome do arquivo de página da categoria para os links de categoria. Esta propriedade é usada pelo componente default parcial.', 'posts_post' => 'Página de posts', - 'posts_post_description' => 'Nome do arquivo post página para os "Saiba mais" links. Esta propriedade é usada pelo componente default parcial.' + 'posts_post_description' => 'Nome do arquivo post página para os "Saiba mais" links. Esta propriedade é usada pelo componente default parcial.', + 'posts_except_post' => 'Except post', + 'posts_except_post_description' => 'Enter ID/URL or variable with post ID/URL you want to except', + 'rssfeed_blog' => 'Página do Blog', + 'rssfeed_blog_description' => 'Nome do arquivo principal da página do blog para geração de links. Essa propriedade é usada pelo componente padrão parcial.', + 'rssfeed_title' => 'RSS Feed', + 'rssfeed_description' => 'Gera um feed RSS que contém posts do blog.' ] ]; diff --git a/plugins/rainlab/blog/lang/ru/lang.php b/plugins/rainlab/blog/lang/ru/lang.php index ce2e6473fe..16d424a4cd 100644 --- a/plugins/rainlab/blog/lang/ru/lang.php +++ b/plugins/rainlab/blog/lang/ru/lang.php @@ -102,6 +102,8 @@ return [ 'posts_category' => 'Страница категорий', 'posts_category_description' => 'Название категории на странице записи "размещена в категории". Это свойство используется по умолчанию компонентом.', 'posts_post' => 'Страница записи', - 'posts_post_description' => 'Название страницы для ссылки "подробнее". Это свойство используется по умолчанию компонентом.' + 'posts_post_description' => 'Название страницы для ссылки "подробнее". Это свойство используется по умолчанию компонентом.', + 'posts_except_post' => 'Except post', + 'posts_except_post_description' => 'Enter ID/URL or variable with post ID/URL you want to except', ] ]; diff --git a/plugins/rainlab/blog/lang/tr/lang.php b/plugins/rainlab/blog/lang/tr/lang.php index 032c3fe431..0635ee035c 100644 --- a/plugins/rainlab/blog/lang/tr/lang.php +++ b/plugins/rainlab/blog/lang/tr/lang.php @@ -13,9 +13,11 @@ return [ 'categories' => 'Kategoriler', 'create_category' => 'blog kategorisi', 'tab' => 'Blog', - 'access_posts' => 'Gönderileri yönet', - 'access_categories' => 'Blog kategorilerini yönet', - 'access_other_posts' => 'Diğer kullanıcıların gönderilerini yönet', + 'access_posts' => 'Gönderileri yönetebilsin', + 'access_categories' => 'Blog kategorilerini yönetebilsin', + 'access_other_posts' => 'Diğer kullanıcıların gönderilerini yönetebilsin', + 'access_import_export' => 'Gönderileri içeri/dışarı aktarabilsin', + 'access_publish' => 'Gönderi yayınlayabilsin', 'delete_confirm' => 'Emin misiniz?', 'chart_published' => 'Yayınlandı', 'chart_drafts' => 'Taslaklar', @@ -25,17 +27,26 @@ return [ 'list_title' => 'Blog gönderilerini yönet', 'filter_category' => 'Kategori', 'filter_published' => 'Yayınlananı gizle', - 'new_post' => 'Yeni gönderi' + 'filter_date' => 'Tarih', + 'new_post' => 'Yeni gönderi', + 'export_post' => 'Gönderileri dışarı aktar', + 'import_post' => 'Gönderileri içeri aktar', ], 'post' => [ 'title' => 'Başlık', 'title_placeholder' => 'Yeni gönderi başlığı', + 'content' => 'İçerik', + 'content_html' => 'HTML İçeriği', 'slug' => 'Kısa URL', - 'slug_placeholder' => 'new-post-slug', + 'slug_placeholder' => 'yeni-gonderi-basligi', 'categories' => 'Kategoriler', + 'author_email' => 'Yazar E-mail', 'created' => 'Oluşturuldu', + 'created_date' => 'Oluşturulma tarihi', 'updated' => 'Güncellendi', + 'updated_date' => 'Güncellenme tarihi', 'published' => 'Yayınlandı', + 'published_date' => 'Yayınlanma tarihi', 'published_validation' => 'Yayınlanan tarihi belirtiniz', 'tab_edit' => 'Düzenle', 'tab_categories' => 'Kategoriler', @@ -44,6 +55,7 @@ return [ 'tab_manage' => 'Yönet', 'published_on' => 'Yayınlandı', 'excerpt' => 'Alıntı', + 'summary' => 'Özet', 'featured_images' => 'Öne Çıkan Görseller', 'delete_confirm' => 'Bu yazıyı silmek istiyor musunuz?', 'close_confirm' => 'Gönderi kaydedilmedi.', @@ -56,12 +68,21 @@ return [ ], 'category' => [ 'name' => 'İsim', - 'name_placeholder' => 'NYeni kategori adı', + 'name_placeholder' => 'Yeni kategori adı', + 'description' => 'Açıklama', 'slug' => 'Kısa URL', - 'slug_placeholder' => 'new-category-slug', + 'slug_placeholder' => 'yeni-kategori-basligi', 'posts' => 'Gönderiler', 'delete_confirm' => 'Bu kategoriyi silmek istiyor musunuz?', - 'return_to_categories' => 'Kategori listesine dön' + 'return_to_categories' => 'Kategori listesine dön', + 'reorder' => 'Kategorileri sırala', + ], + 'menuitem' => [ + 'blog_category' => 'Blog kategorisi', + 'all_blog_categories' => 'Tüm blog kategorileri', + 'blog_post' => 'Blog gönderisi', + 'all_blog_posts' => 'Tüm blog gönderileri', + ], 'settings' => [ 'category_title' => 'Kategori Listesi', @@ -89,10 +110,16 @@ return [ 'posts_no_posts' => 'Gönderi mesajı yok', 'posts_no_posts_description' => 'Eğer bir gönderi yoksa gönderi listesinde görüntülenecek mesaj. Bu özellik varsayılan kısmi bileşeni tarafından kullanılır.', 'posts_order' => 'Gönderi Sırası', - 'posts_order_description' => 'Attribute on which the posts should be ordered', + 'posts_order_description' => 'Gönderilerin sıralama türü', 'posts_category' => 'Kategori sayfası', - 'posts_category_description' => 'Name of the category page file for the "Posted into" category links. Bu özellik varsayılan kısmi bileşeni tarafından kullanılır.', + 'posts_category_description' => '"Yayınlanan" kategori bağlantıları için kategori sayfası dosyasının adı. Bu özellik varsayılan kısmi bileşeni tarafından kullanılır.', 'posts_post' => 'Gönderi sayfası', - 'posts_post_description' => '"Daha fazla bilgi edinin" bağlantıları için gönderi sayfası dosyasının adı. Bu özellik varsayılan kısmi bileşeni tarafından kullanılır.' + 'posts_post_description' => '"Daha fazla bilgi edinin" bağlantıları için gönderi sayfası dosyasının adı. Bu özellik varsayılan kısmi bileşeni tarafından kullanılır.', + 'posts_except_post' => 'Harici gönderi', + 'posts_except_post_description' => 'Hariç tutmak istediğiniz gönderinin ID/URL sini girin', + 'rssfeed_blog' => 'Blog sayfası', + 'rssfeed_blog_description' => 'Linkleri üretmek için blog sayfasının adını girin. Bu bilgi, ana component için kullanılacak.', + 'rssfeed_title' => 'RSS Beslemesi', + 'rssfeed_description' => 'Blog içerisindeki gönderileri veren RSS beslemesi oluşturur.' ] ]; diff --git a/plugins/rainlab/blog/models/Category.php b/plugins/rainlab/blog/models/Category.php index 366c6ee573..b88c10d305 100644 --- a/plugins/rainlab/blog/models/Category.php +++ b/plugins/rainlab/blog/models/Category.php @@ -30,6 +30,8 @@ class Category extends Model */ public $translatable = [ 'name', + 'description', + ['slug', 'index' => true] ]; protected $guarded = []; @@ -45,8 +47,9 @@ class Category extends Model public function beforeValidate() { // Generate a URL slug for this model - if (!$this->exists && !$this->slug) + if (!$this->exists && !$this->slug) { $this->slug = Str::slug($this->name); + } } public function afterDelete() @@ -67,7 +70,7 @@ class Category extends Model public function setUrl($pageName, $controller) { $params = [ - 'id' => $this->id, + 'id' => $this->id, 'slug' => $this->slug, ]; @@ -86,7 +89,7 @@ class Category extends Model * false if omitted. * - dynamicItems - Boolean value indicating whether the item type could generate new menu items. * Optional, false if omitted. - * - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to + * - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to * resolve the item URL. * @param string $type Specifies the menu item type * @return array Returns an array @@ -169,9 +172,9 @@ class Category extends Model * - url - the menu item URL. Not required for menu item types that return all available records. * The URL should be returned relative to the website root and include the subdirectory, if any. * Use the URL::to() helper to generate the URLs. - * - isActive - determines whether the menu item is active. Not required for menu item types that + * - isActive - determines whether the menu item is active. Not required for menu item types that * return all available records. - * - items - an array of arrays with the same keys (url, isActive, items) + the title key. + * - items - an array of arrays with the same keys (url, isActive, items) + the title key. * The items array should be added only if the $item's $nesting property value is TRUE. * @param \RainLab\Pages\Classes\MenuItem $item Specifies the menu item. * @param \Cms\Classes\Theme $theme Specifies the current theme. @@ -184,16 +187,19 @@ class Category extends Model $result = null; if ($item->type == 'blog-category') { - if (!$item->reference || !$item->cmsPage) + if (!$item->reference || !$item->cmsPage) { return; + } $category = self::find($item->reference); - if (!$category) + if (!$category) { return; + } $pageUrl = self::getCategoryPageUrl($item->cmsPage, $category, $theme); - if (!$pageUrl) + if (!$pageUrl) { return; + } $pageUrl = URL::to($pageUrl); @@ -256,7 +262,9 @@ class Category extends Model protected static function getCategoryPageUrl($pageCode, $category, $theme) { $page = CmsPage::loadCached($theme, $pageCode); - if (!$page) return; + if (!$page) { + return; + } $properties = $page->getComponentProperties('blogPosts'); if (!isset($properties['categoryFilter'])) { @@ -276,4 +284,4 @@ class Category extends Model return $url; } -} \ No newline at end of file +} diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 6c85f8e494..c3f9c472f7 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -1,16 +1,20 @@ true] ]; /** @@ -49,7 +54,7 @@ class Post extends Model * The attributes on which the post list can be ordered * @var array */ - public static $allowedSortingOptions = array( + public static $allowedSortingOptions = [ 'title asc' => 'Title (ascending)', 'title desc' => 'Title (descending)', 'created_at asc' => 'Created (ascending)', @@ -59,7 +64,7 @@ class Post extends Model 'published_at asc' => 'Published (ascending)', 'published_at desc' => 'Published (descending)', 'random' => 'Random' - ); + ]; /* * Relations @@ -88,6 +93,28 @@ class Post extends Model public $preview = null; + /** + * Limit visibility of the published-button + * @return void + */ + public function filterFields($fields, $context = null) + { + if (!isset($fields->published, $fields->published_at)) { + return; + } + + $user = BackendAuth::getUser(); + + if (!$user->hasAnyAccess(['rainlab.blog.access_publish'])) { + $fields->published->hidden = true; + $fields->published_at->hidden = true; + } + else { + $fields->published->hidden = false; + $fields->published_at->hidden = false; + } + } + public function afterValidate() { if ($this->published && !$this->published_at) { @@ -110,7 +137,7 @@ class Post extends Model public function setUrl($pageName, $controller) { $params = [ - 'id' => $this->id, + 'id' => $this->id, 'slug' => $this->slug, ]; @@ -118,6 +145,13 @@ class Post extends Model $params['category'] = $this->categories->count() ? $this->categories->first()->slug : null; } + //expose published year, month and day as URL parameters + if ($this->published) { + $params['year'] = $this->published_at->format('Y'); + $params['month'] = $this->published_at->format('m'); + $params['day'] = $this->published_at->format('d'); + } + return $this->url = $controller->pageUrl($pageName, $params); } @@ -176,7 +210,8 @@ class Post extends Model 'categories' => null, 'category' => null, 'search' => '', - 'published' => true + 'published' => true, + 'exceptPost' => null, ], $options)); $searchableFields = ['title', 'slug', 'excerpt', 'content']; @@ -185,6 +220,18 @@ class Post extends Model $query->isPublished(); } + /* + * Ignore a post + */ + if ($exceptPost) { + if (is_numeric($exceptPost)) { + $query->where('id', '<>', $exceptPost); + } + else { + $query->where('slug', '<>', $exceptPost); + } + } + /* * Sorting */ @@ -201,7 +248,7 @@ class Post extends Model } list($sortField, $sortDirection) = $parts; if ($sortField == 'random') { - $sortField = DB::raw('RAND()'); + $sortField = Db::raw('RAND()'); } $query->orderBy($sortField, $sortDirection); } @@ -263,7 +310,13 @@ class Post extends Model */ public function getHasSummaryAttribute() { - return strlen($this->getSummaryAttribute()) < strlen($this->content_html); + $more = ''; + + return ( + !!strlen(trim($this->excerpt)) || + strpos($this->content_html, $more) !== false || + strlen(Html::strip($this->content_html)) > 600 + ); } /** @@ -275,7 +328,7 @@ class Post extends Model */ public function getSummaryAttribute() { - $excerpt = array_get($this->attributes, 'excerpt'); + $excerpt = $this->excerpt; if (strlen(trim($excerpt))) { return $excerpt; } @@ -286,6 +339,200 @@ class Post extends Model return array_get($parts, 0); } - return Str::limit(Html::strip($this->content_html), 600); + return Html::limit($this->content_html, 600); + } + + // + // Next / Previous + // + + /** + * Returns the next post, if available. + * @return self + */ + public function nextPost() + { + return self::isPublished() + ->where('id', '>' , $this->id) + ->orderBy('id', 'asc') + ->first() + ; + } + + /** + * Returns the previous post, if available. + * @return self + */ + public function previousPost() + { + return self::isPublished() + ->where('id', '<' , $this->id) + ->orderBy('id', 'desc') + ->first() + ; + } + + // + // Menu helpers + // + + /** + * Handler for the pages.menuitem.getTypeInfo event. + * Returns a menu item type information. The type information is returned as array + * with the following elements: + * - references - a list of the item type reference options. The options are returned in the + * ["key"] => "title" format for options that don't have sub-options, and in the format + * ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional, + * required only if the menu item type requires references. + * - nesting - Boolean value indicating whether the item type supports nested items. Optional, + * false if omitted. + * - dynamicItems - Boolean value indicating whether the item type could generate new menu items. + * Optional, false if omitted. + * - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to + * resolve the item URL. + * @param string $type Specifies the menu item type + * @return array Returns an array + */ + public static function getMenuTypeInfo($type) + { + $result = []; + + if ($type == 'blog-post') { + + $references = []; + $posts = self::orderBy('title')->get(); + foreach ($posts as $post) { + $references[$post->id] = $post->title; + } + + $result = [ + 'references' => $references, + 'nesting' => false, + 'dynamicItems' => false + ]; + } + + if ($type == 'all-blog-posts') { + $result = [ + 'dynamicItems' => true + ]; + } + + if ($result) { + $theme = Theme::getActiveTheme(); + + $pages = CmsPage::listInTheme($theme, true); + $cmsPages = []; + + foreach ($pages as $page) { + if (!$page->hasComponent('blogPost')) { + continue; + } + + /* + * Component must use a categoryPage filter with a routing parameter and post slug + * eg: categoryPage = "{{ :somevalue }}", slug = "{{ :somevalue }}" + */ + $properties = $page->getComponentProperties('blogPost'); + if (!isset($properties['categoryPage']) || !preg_match('/{{\s*:/', $properties['slug'])) { + continue; + } + + $cmsPages[] = $page; + } + + $result['cmsPages'] = $cmsPages; + } + + return $result; + } + + /** + * Handler for the pages.menuitem.resolveItem event. + * Returns information about a menu item. The result is an array + * with the following keys: + * - url - the menu item URL. Not required for menu item types that return all available records. + * The URL should be returned relative to the website root and include the subdirectory, if any. + * Use the Url::to() helper to generate the URLs. + * - isActive - determines whether the menu item is active. Not required for menu item types that + * return all available records. + * - items - an array of arrays with the same keys (url, isActive, items) + the title key. + * The items array should be added only if the $item's $nesting property value is TRUE. + * @param \RainLab\Pages\Classes\MenuItem $item Specifies the menu item. + * @param \Cms\Classes\Theme $theme Specifies the current theme. + * @param string $url Specifies the current page URL, normalized, in lower case + * The URL is specified relative to the website root, it includes the subdirectory name, if any. + * @return mixed Returns an array. Returns null if the item cannot be resolved. + */ + public static function resolveMenuItem($item, $url, $theme) + { + $result = null; + + if ($item->type == 'blog-post') { + if (!$item->reference || !$item->cmsPage) + return; + + $category = self::find($item->reference); + if (!$category) + return; + + $pageUrl = self::getPostPageUrl($item->cmsPage, $category, $theme); + if (!$pageUrl) + return; + + $pageUrl = Url::to($pageUrl); + + $result = []; + $result['url'] = $pageUrl; + $result['isActive'] = $pageUrl == $url; + $result['mtime'] = $category->updated_at; + } + elseif ($item->type == 'all-blog-posts') { + $result = [ + 'items' => [] + ]; + + $posts = self::orderBy('title')->get(); + foreach ($posts as $post) { + $postItem = [ + 'title' => $post->title, + 'url' => self::getPostPageUrl($item->cmsPage, $post, $theme), + 'mtime' => $post->updated_at, + ]; + + $postItem['isActive'] = $postItem['url'] == $url; + + $result['items'][] = $postItem; + } + } + + return $result; + } + + /** + * Returns URL of a post page. + */ + protected static function getPostPageUrl($pageCode, $category, $theme) + { + $page = CmsPage::loadCached($theme, $pageCode); + if (!$page) return; + + $properties = $page->getComponentProperties('blogPost'); + if (!isset($properties['slug'])) { + return; + } + + /* + * Extract the routing parameter name from the category filter + * eg: {{ :someRouteParam }} + */ + if (!preg_match('/^\{\{([^\}]+)\}\}$/', $properties['slug'], $matches)) { + return; + } + + $paramName = substr(trim($matches[1]), 1); + $url = CmsPage::url($page->getBaseFileName(), [$paramName => $category->slug]); + + return $url; } } diff --git a/plugins/rainlab/blog/models/PostExport.php b/plugins/rainlab/blog/models/PostExport.php index 05092d9871..ce260ec126 100644 --- a/plugins/rainlab/blog/models/PostExport.php +++ b/plugins/rainlab/blog/models/PostExport.php @@ -54,13 +54,19 @@ class PostExport extends ExportModel public function getAuthorEmailAttribute() { - if (!$this->post_user) return ''; + if (!$this->post_user) { + return ''; + } + return $this->post_user->email; } public function getCategoriesAttribute() { - if (!$this->post_categories) return ''; + if (!$this->post_categories) { + return ''; + } + return $this->encodeArrayValue($this->post_categories->lists('name')); } -} \ No newline at end of file +} diff --git a/plugins/rainlab/blog/models/PostImport.php b/plugins/rainlab/blog/models/PostImport.php index 194a194f51..d9852b6f89 100644 --- a/plugins/rainlab/blog/models/PostImport.php +++ b/plugins/rainlab/blog/models/PostImport.php @@ -3,6 +3,7 @@ use Backend\Models\ImportModel; use Backend\Models\User as AuthorModel; use ApplicationException; +use Exception; /** * Post Import Model @@ -15,8 +16,8 @@ class PostImport extends ImportModel * Validation rules */ public $rules = [ - 'title' => 'required', - 'content' => 'required', + 'title' => 'required', + 'content' => 'required' ]; protected $authorEmailCache = []; @@ -139,7 +140,9 @@ class PostImport extends ImportModel $categoryNames = $this->decodeArrayValue(array_get($data, 'categories')); foreach ($categoryNames as $name) { - if (!$name = trim($name)) continue; + if (!$name = trim($name)) { + continue; + } if (isset($this->categoryNameCache[$name])) { $ids[] = $this->categoryNameCache[$name]; @@ -156,5 +159,4 @@ class PostImport extends ImportModel return $ids; } - -} \ No newline at end of file +} diff --git a/plugins/rainlab/blog/models/category/fields.yaml b/plugins/rainlab/blog/models/category/fields.yaml index f1f9b63a8c..adcf1bc3f1 100644 --- a/plugins/rainlab/blog/models/category/fields.yaml +++ b/plugins/rainlab/blog/models/category/fields.yaml @@ -14,3 +14,10 @@ fields: span: right placeholder: rainlab.blog::lang.category.slug_placeholder preset: name + + description: + label: 'rainlab.blog::lang.category.description' + size: large + oc.commentPosition: '' + span: full + type: textarea diff --git a/plugins/rainlab/blog/updates/create_posts_table.php b/plugins/rainlab/blog/updates/create_posts_table.php index 03e3afd4af..2bd2d3256b 100644 --- a/plugins/rainlab/blog/updates/create_posts_table.php +++ b/plugins/rainlab/blog/updates/create_posts_table.php @@ -16,8 +16,8 @@ class CreatePostsTable extends Migration $table->string('title')->nullable(); $table->string('slug')->index(); $table->text('excerpt')->nullable(); - $table->text('content')->nullable(); - $table->text('content_html')->nullable(); + $table->longText('content')->nullable(); + $table->longText('content_html')->nullable(); $table->timestamp('published_at')->nullable(); $table->boolean('published')->default(false); $table->timestamps(); diff --git a/plugins/rainlab/blog/updates/update_timestamp_nullable.php b/plugins/rainlab/blog/updates/update_timestamp_nullable.php index 311ecabba9..7de7961c14 100644 --- a/plugins/rainlab/blog/updates/update_timestamp_nullable.php +++ b/plugins/rainlab/blog/updates/update_timestamp_nullable.php @@ -1,12 +1,10 @@ $path) { diff --git a/plugins/rainlab/blog/vendor/composer/installed.json b/plugins/rainlab/blog/vendor/composer/installed.json index 88b7f679b4..99df1e76c4 100644 --- a/plugins/rainlab/blog/vendor/composer/installed.json +++ b/plugins/rainlab/blog/vendor/composer/installed.json @@ -1,17 +1,17 @@ [ { "name": "composer/installers", - "version": "v1.1.0", - "version_normalized": "1.1.0.0", + "version": "v1.2.0", + "version_normalized": "1.2.0.0", "source": { "type": "git", "url": "https://github.com/composer/installers.git", - "reference": "a3595c5272a6f247228abb20076ed27321e4aae9" + "reference": "d78064c68299743e0161004f2de3a0204e33b804" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/a3595c5272a6f247228abb20076ed27321e4aae9", - "reference": "a3595c5272a6f247228abb20076ed27321e4aae9", + "url": "https://api.github.com/repos/composer/installers/zipball/d78064c68299743e0161004f2de3a0204e33b804", + "reference": "d78064c68299743e0161004f2de3a0204e33b804", "shasum": "" }, "require": { @@ -25,7 +25,7 @@ "composer/composer": "1.0.*@dev", "phpunit/phpunit": "4.1.*" }, - "time": "2016-07-05 06:18:20", + "time": "2016-08-13 20:53:52", "type": "composer-plugin", "extra": { "class": "Composer\\Installers\\Plugin", @@ -60,6 +60,7 @@ "MODX Evo", "Mautic", "OXID", + "Plentymarkets", "RadPHP", "SMF", "Thelia", @@ -67,9 +68,11 @@ "agl", "aimeos", "annotatecms", + "attogram", "bitrix", "cakephp", "chef", + "cockpit", "codeigniter", "concrete5", "croogo", @@ -93,12 +96,14 @@ "piwik", "ppi", "puppet", + "reindex", "roundcube", "shopware", "silverstripe", "symfony", "typo3", "wordpress", + "yawik", "zend", "zikula" ] diff --git a/plugins/rainlab/blog/vendor/composer/installers/README.md b/plugins/rainlab/blog/vendor/composer/installers/README.md index 50aca3429f..ed38d2262e 100644 --- a/plugins/rainlab/blog/vendor/composer/installers/README.md +++ b/plugins/rainlab/blog/vendor/composer/installers/README.md @@ -35,6 +35,7 @@ is not needed to install packages with these frameworks: | --------- | ----- | Aimeos | `aimeos-extension` | Asgard | `asgard-module`
`asgard-theme` +| Attogram | `attogram-module` | AGL | `agl-module` | Bonefish | `bonefish-package` | AnnotateCms | `annotatecms-module`
`annotatecms-component`
`annotatecms-service` @@ -42,6 +43,7 @@ is not needed to install packages with these frameworks: | CakePHP 2+ | **`cakephp-plugin`** | Chef | `chef-cookbook`
`chef-role` | CCFramework | `ccframework-ship`
`ccframework-theme` +| Cockpit | `cockpit-module` | CodeIgniter | `codeigniter-library`
`codeigniter-third-party`
`codeigniter-module` | concrete5 | `concrete5-block`
`concrete5-package`
`concrete5-theme`
`concrete5-update` | Craft | `craft-plugin` @@ -75,20 +77,24 @@ is not needed to install packages with these frameworks: | Piwik | `piwik-plugin` | phpBB | `phpbb-extension`
`phpbb-style`
`phpbb-language` | Pimcore | `pimcore-plugin` +| Plentymarkets | `plentymarkets-plugin` | PPI | **`ppi-module`** | Puppet | `puppet-module` | RadPHP | `radphp-bundle` | REDAXO | `redaxo-addon` +| ReIndex | **`reindex-plugin`**
**`reindex-theme`** | Roundcube | `roundcube-plugin` -| shopware | `shopware-backend-plugin`
`shopware-core-plugin`
`shopware-frontend-plugin`
`shopware-theme` +| shopware | `shopware-backend-plugin`
`shopware-core-plugin`
`shopware-frontend-plugin`
`shopware-theme`
`shopware-plugin`
`shopware-frontend-theme` | SilverStripe | `silverstripe-module`
`silverstripe-theme` | SMF | `smf-module`
`smf-theme` | symfony1 | **`symfony1-plugin`** | Tusk | `tusk-task`
`tusk-command`
`tusk-asset` | TYPO3 Flow | `typo3-flow-package`
`typo3-flow-framework`
`typo3-flow-plugin`
`typo3-flow-site`
`typo3-flow-boilerplate`
`typo3-flow-build` | TYPO3 CMS | `typo3-cms-extension` (Deprecated in this package, use the [TYPO3 CMS Installers](https://packagist.org/packages/typo3/cms-composer-installers) instead) +| Vanilla | `vanilla-plugin`
`vanilla-theme` | Wolf CMS | `wolfcms-plugin` | WordPress | `wordpress-plugin`
`wordpress-theme`

`wordpress-muplugin` +| YAWIK | `yawik-module` | Zend | `zend-library`
`zend-extra`
`zend-module` | Zikula | `zikula-module`
`zikula-theme` | Prestashop | `prestashop-module`
`prestashop-theme` @@ -187,7 +193,7 @@ not be inflected. ## Contribute! * [Fork and clone](https://help.github.com/articles/fork-a-repo). -* Run the command `php composer.phar install` to install the dependencies. +* Run the command `php composer.phar install` to install the dependencies. This will also install the dev dependencies. See [Composer](https://getcomposer.org/doc/03-cli.md#install). * Use the command `phpunit` to run the tests. See [PHPUnit](http://phpunit.de). * Create a branch, commit, push and send us a diff --git a/plugins/rainlab/blog/vendor/composer/installers/composer.json b/plugins/rainlab/blog/vendor/composer/installers/composer.json index 8491fd72b1..3b12fa51e5 100644 --- a/plugins/rainlab/blog/vendor/composer/installers/composer.json +++ b/plugins/rainlab/blog/vendor/composer/installers/composer.json @@ -8,9 +8,11 @@ "Aimeos", "AGL", "AnnotateCms", + "Attogram", "Bitrix", "CakePHP", "Chef", + "Cockpit", "CodeIgniter", "concrete5", "Craft", @@ -38,9 +40,11 @@ "Moodle", "Piwik", "phpBB", + "Plentymarkets", "PPI", "Puppet", "RadPHP", + "ReIndex", "Roundcube", "shopware", "SilverStripe", @@ -50,6 +54,7 @@ "TYPO3", "WolfCMS", "WordPress", + "YAWIK", "Zend", "Zikula" ], diff --git a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php index 995ee2b49b..22dad1b9a0 100644 --- a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php +++ b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php @@ -31,14 +31,18 @@ class AsgardInstaller extends BaseInstaller protected function inflectPluginVars($vars) { - $vars['name'] = ucfirst(preg_replace('/-module/', '', $vars['name'])); + $vars['name'] = preg_replace('/-module$/', '', $vars['name']); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); return $vars; } protected function inflectThemeVars($vars) { - $vars['name'] = ucfirst(preg_replace('/-theme$/', '', $vars['name'])); + $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); return $vars; } diff --git a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php new file mode 100644 index 0000000000..d62fd8fd1e --- /dev/null +++ b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/AttogramInstaller.php @@ -0,0 +1,9 @@ + 'modules/{$name}/', + ); +} diff --git a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php new file mode 100644 index 0000000000..c7816dfce2 --- /dev/null +++ b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php @@ -0,0 +1,34 @@ + 'cockpit/modules/addons/{$name}/', + ); + + /** + * Format module name. + * + * Strip `module-` prefix from package name. + * + * @param array @vars + * + * @return array + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] == 'cockpit-module') { + return $this->inflectModuleVars($vars); + } + + return $vars; + } + + public function inflectModuleVars($vars) + { + $vars['name'] = ucfirst(preg_replace('/cockpit-/i', '', $vars['name'])); + + return $vars; + } +} diff --git a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php index f8e4de1d8d..d5321a8ca1 100644 --- a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php +++ b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php @@ -9,8 +9,8 @@ class ExpressionEngineInstaller extends BaseInstaller protected $locations = array(); private $ee2Locations = array( - 'addon' => 'system/expressionengine/third-party/{$name}/', - 'theme' => 'themes/third-party/{$name}/', + 'addon' => 'system/expressionengine/third_party/{$name}/', + 'theme' => 'themes/third_party/{$name}/', ); private $ee3Locations = array( diff --git a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/Installer.php b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/Installer.php index a8488a050d..5b6c553a83 100644 --- a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/Installer.php +++ b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/Installer.php @@ -16,6 +16,7 @@ class Installer extends LibraryInstaller private $supportedTypes = array( 'aimeos' => 'AimeosInstaller', 'asgard' => 'AsgardInstaller', + 'attogram' => 'AttogramInstaller', 'agl' => 'AglInstaller', 'annotatecms' => 'AnnotateCmsInstaller', 'bitrix' => 'BitrixInstaller', @@ -23,6 +24,7 @@ class Installer extends LibraryInstaller 'cakephp' => 'CakePHPInstaller', 'chef' => 'ChefInstaller', 'ccframework' => 'ClanCatsFrameworkInstaller', + 'cockpit' => 'CockpitInstaller', 'codeigniter' => 'CodeIgniterInstaller', 'concrete5' => 'Concrete5Installer', 'craft' => 'CraftInstaller', @@ -49,7 +51,7 @@ class Installer extends LibraryInstaller 'mako' => 'MakoInstaller', 'mautic' => 'MauticInstaller', 'mediawiki' => 'MediaWikiInstaller', - 'microweber' => 'MicroweberInstaller', + 'microweber' => 'MicroweberInstaller', 'modulework' => 'MODULEWorkInstaller', 'modxevo' => 'MODXEvoInstaller', 'moodle' => 'MoodleInstaller', @@ -58,11 +60,13 @@ class Installer extends LibraryInstaller 'phpbb' => 'PhpBBInstaller', 'pimcore' => 'PimcoreInstaller', 'piwik' => 'PiwikInstaller', + 'plentymarkets'=> 'PlentymarketsInstaller', 'ppi' => 'PPIInstaller', 'puppet' => 'PuppetInstaller', 'radphp' => 'RadPHPInstaller', 'phifty' => 'PhiftyInstaller', 'redaxo' => 'RedaxoInstaller', + 'reindex' => 'ReIndexInstaller', 'roundcube' => 'RoundcubeInstaller', 'shopware' => 'ShopwareInstaller', 'silverstripe' => 'SilverStripeInstaller', @@ -72,9 +76,11 @@ class Installer extends LibraryInstaller 'tusk' => 'TuskInstaller', 'typo3-cms' => 'TYPO3CmsInstaller', 'typo3-flow' => 'TYPO3FlowInstaller', + 'vanilla' => 'VanillaInstaller', 'whmcs' => 'WHMCSInstaller', 'wolfcms' => 'WolfCMSInstaller', 'wordpress' => 'WordPressInstaller', + 'yawik' => 'YawikInstaller', 'zend' => 'ZendInstaller', 'zikula' => 'ZikulaInstaller', 'prestashop' => 'PrestashopInstaller' diff --git a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php new file mode 100644 index 0000000000..903e55f62c --- /dev/null +++ b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/PlentymarketsInstaller.php @@ -0,0 +1,29 @@ + '{$name}/' + ); + + /** + * Remove hyphen, "plugin" and format to camelcase + * @param array $vars + * + * @return array + */ + public function inflectPackageVars($vars) + { + $vars['name'] = explode("-", $vars['name']); + foreach ($vars['name'] as $key => $name) { + $vars['name'][$key] = ucfirst($vars['name'][$key]); + if (strcasecmp($name, "Plugin") == 0) { + unset($vars['name'][$key]); + } + } + $vars['name'] = implode("",$vars['name']); + + return $vars; + } +} diff --git a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php new file mode 100644 index 0000000000..252c7339f9 --- /dev/null +++ b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php @@ -0,0 +1,10 @@ + 'themes/{$name}/', + 'plugin' => 'plugins/{$name}/' + ); +} diff --git a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php index 673f1fc1f2..d0193cba3f 100644 --- a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php +++ b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php @@ -11,7 +11,9 @@ class ShopwareInstaller extends BaseInstaller 'backend-plugin' => 'engine/Shopware/Plugins/Local/Backend/{$name}/', 'core-plugin' => 'engine/Shopware/Plugins/Local/Core/{$name}/', 'frontend-plugin' => 'engine/Shopware/Plugins/Local/Frontend/{$name}/', - 'theme' => 'templates/{$name}/' + 'theme' => 'templates/{$name}/', + 'plugin' => 'custom/plugins/{$name}/', + 'frontend-theme' => 'themes/Frontend/{$name}/', ); /** diff --git a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php new file mode 100644 index 0000000000..24ca645129 --- /dev/null +++ b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php @@ -0,0 +1,10 @@ + 'plugins/{$name}/', + 'theme' => 'themes/{$name}/', + ); +} diff --git a/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php new file mode 100644 index 0000000000..27f429ff21 --- /dev/null +++ b/plugins/rainlab/blog/vendor/composer/installers/src/Composer/Installers/YawikInstaller.php @@ -0,0 +1,32 @@ + 'module/{$name}/', + ); + + /** + * Format package name to CamelCase + * @param array $vars + * + * @return array + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name'])); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } +} \ No newline at end of file diff --git a/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php b/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php index 71480eca53..f6e8341045 100644 --- a/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php +++ b/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php @@ -8,7 +8,7 @@ use Composer\Composer; class AsgardInstallerTest extends \PHPUnit_Framework_TestCase { /** - * @var OctoberInstaller + * @var AsgardInstaller */ private $installer; @@ -26,14 +26,20 @@ class AsgardInstallerTest extends \PHPUnit_Framework_TestCase public function testInflectPackageVars($type, $name, $expected) { $this->assertEquals( - $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)), - array('name' => $expected, 'type' => $type) + array('name' => $expected, 'type' => $type), + $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)) ); } public function packageNameInflectionProvider() { return array( + // Should keep module name StudlyCase + array( + 'asgard-module', + 'user-profile', + 'UserProfile' + ), array( 'asgard-module', 'asgard-module', @@ -44,11 +50,17 @@ class AsgardInstallerTest extends \PHPUnit_Framework_TestCase 'blog', 'Blog' ), + // tests that exactly one '-module' is cut off + array( + 'asgard-module', + 'some-module-module', + 'SomeModule', + ), // tests that exactly one '-theme' is cut off array( 'asgard-theme', 'some-theme-theme', - 'Some-theme', + 'SomeTheme', ), // tests that names without '-theme' suffix stay valid array( @@ -56,6 +68,12 @@ class AsgardInstallerTest extends \PHPUnit_Framework_TestCase 'someothertheme', 'Someothertheme', ), + // Should keep theme name StudlyCase + array( + 'asgard-theme', + 'adminlte-advanced', + 'AdminlteAdvanced' + ), ); } } diff --git a/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php b/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php new file mode 100644 index 0000000000..e909bb4262 --- /dev/null +++ b/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php @@ -0,0 +1,76 @@ +composer = new Composer(); + } + + /** + * @param string $vars + * @param string $expectedVars + * + * @covers ::inflectPackageVars + * + * @dataProvider provideExpectedInflectionResults + */ + final public function testInflectPackageVars($vars, $expectedVars) + { + + $this->installer = new BitrixInstaller( + new Package($vars['name'], '4.2', '4.2'), + $this->composer + ); + $actual = $this->installer->inflectPackageVars($vars); + $this->assertEquals($actual, $expectedVars); + } + + /** + * Provides various parameters for packages and the expected result after inflection + * + * @return array + */ + final public function provideExpectedInflectionResults() + { + return array( + //check bitrix-dir is correct + array( + array('name' => 'Nyan/Cat'), + array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix') + ), + array( + array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix'), + array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix') + ), + array( + array('name' => 'Nyan/Cat', 'bitrix_dir' => 'local'), + array('name' => 'Nyan/Cat', 'bitrix_dir' => 'local') + ), + ); + } +} \ No newline at end of file diff --git a/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php b/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php index d967e5aabe..df699da3b4 100644 --- a/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php +++ b/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php @@ -89,6 +89,7 @@ class InstallerTest extends TestCase array('annotatecms-module', true), array('annotatecms-component', true), array('annotatecms-service', true), + array('attogram-module', true), array('bitrix-module', true), array('bitrix-component', true), array('bitrix-theme', true), @@ -99,6 +100,7 @@ class InstallerTest extends TestCase array('cakephp-plugin', true), array('chef-cookbook', true), array('chef-role', true), + array('cockpit-module', true), array('codeigniter-app', false), array('codeigniter-library', true), array('codeigniter-third-party', true), @@ -151,6 +153,7 @@ class InstallerTest extends TestCase array('piwik-plugin', true), array('phpbb-extension', true), array('pimcore-plugin', true), + array('plentymarkets-plugin', true), array('ppi-module', true), array('prestashop-module', true), array('prestashop-theme', true), @@ -158,11 +161,15 @@ class InstallerTest extends TestCase array('radphp-bundle', true), array('redaxo-addon', true), array('redaxo-bestyle-plugin', true), + array('reindex-theme', true), + array('reindex-plugin', true), array('roundcube-plugin', true), array('shopware-backend-plugin', true), array('shopware-core-plugin', true), array('shopware-frontend-plugin', true), array('shopware-theme', true), + array('shopware-plugin', true), + array('shopware-frontend-theme', true), array('silverstripe-module', true), array('silverstripe-theme', true), array('smf-module', true), @@ -176,10 +183,13 @@ class InstallerTest extends TestCase array('tusk-asset', true), array('typo3-flow-plugin', true), array('typo3-cms-extension', true), + array('vanilla-plugin', true), + array('vanilla-theme', true), array('whmcs-gateway', true), array('wolfcms-plugin', true), array('wordpress-plugin', true), array('wordpress-core', false), + array('yawik-module', true), array('zend-library', true), array('zikula-module', true), array('zikula-theme', true), @@ -217,6 +227,7 @@ class InstallerTest extends TestCase array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'), array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'), array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'), + array('attogram-module', 'modules/my_module/', 'author/my_module'), array('bitrix-module', 'bitrix/modules/my_module/', 'author/my_module'), array('bitrix-component', 'bitrix/components/my_component/', 'author/my_component'), array('bitrix-theme', 'bitrix/templates/my_theme/', 'author/my_theme'), @@ -227,6 +238,7 @@ class InstallerTest extends TestCase array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'), array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'), array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'), + array('cockpit-module', 'cockpit/modules/addons/My_module/', 'piotr-cz/cockpit-my_module'), array('codeigniter-library', 'application/libraries/my_package/', 'shama/my_package'), array('codeigniter-module', 'application/modules/my_package/', 'shama/my_package'), array('concrete5-block', 'blocks/concrete5_block/', 'remo/concrete5_block'), @@ -247,8 +259,8 @@ class InstallerTest extends TestCase array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'), array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'), array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'), - array('ee2-addon', 'system/expressionengine/third-party/ee_theme/', 'author/ee_theme'), - array('ee2-theme', 'themes/third-party/ee_package/', 'author/ee_package'), + array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'), + array('ee2-theme', 'themes/third_party/ee_package/', 'author/ee_package'), array('fuel-module', 'fuel/app/modules/module/', 'fuel/module'), array('fuel-package', 'fuel/packages/orm/', 'fuel/orm'), array('fuel-theme', 'fuel/app/themes/theme/', 'fuel/theme'), @@ -289,17 +301,22 @@ class InstallerTest extends TestCase array('phpbb-style', 'styles/foo/', 'test/foo'), array('phpbb-language', 'language/foo/', 'test/foo'), array('pimcore-plugin', 'plugins/MyPlugin/', 'ubikz/my_plugin'), + array('plentymarkets-plugin', 'HelloWorld/', 'plugin-hello-world'), array('ppi-module', 'modules/foo/', 'test/foo'), array('puppet-module', 'modules/puppet-name/', 'puppet/puppet-name'), array('radphp-bundle', 'src/Migration/', 'atkrad/migration'), array('redaxo-addon', 'redaxo/include/addons/my_plugin/', 'shama/my_plugin'), array('redaxo-bestyle-plugin', 'redaxo/include/addons/be_style/plugins/my_plugin/', 'shama/my_plugin'), + array('reindex-theme', 'themes/my_module/', 'author/my_module'), + array('reindex-plugin', 'plugins/my_module/', 'author/my_module'), array('roundcube-plugin', 'plugins/base/', 'test/base'), array('roundcube-plugin', 'plugins/replace_dash/', 'test/replace-dash'), array('shopware-backend-plugin', 'engine/Shopware/Plugins/Local/Backend/ShamaMyBackendPlugin/', 'shama/my-backend-plugin'), array('shopware-core-plugin', 'engine/Shopware/Plugins/Local/Core/ShamaMyCorePlugin/', 'shama/my-core-plugin'), array('shopware-frontend-plugin', 'engine/Shopware/Plugins/Local/Frontend/ShamaMyFrontendPlugin/', 'shama/my-frontend-plugin'), array('shopware-theme', 'templates/my_theme/', 'shama/my-theme'), + array('shopware-frontend-theme', 'themes/Frontend/ShamaMyFrontendTheme/', 'shama/my-frontend-theme'), + array('shopware-plugin', 'custom/plugins/ShamaMyPlugin/', 'shama/my-plugin'), array('silverstripe-module', 'my_module/', 'shama/my_module'), array('silverstripe-module', 'sapphire/', 'silverstripe/framework', '2.4.0'), array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0'), @@ -318,6 +335,8 @@ class InstallerTest extends TestCase array('typo3-flow-package', 'Packages/Application/my_package/', 'shama/my_package'), array('typo3-flow-build', 'Build/my_package/', 'shama/my_package'), array('typo3-cms-extension', 'typo3conf/ext/my_extension/', 'shama/my_extension'), + array('vanilla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'), + array('vanilla-theme', 'themes/my_theme/', 'shama/my_theme'), array('whmcs-gateway', 'modules/gateways/gateway_name/', 'vendor/gateway_name'), array('wolfcms-plugin', 'wolf/plugins/my_plugin/', 'shama/my_plugin'), array('wordpress-plugin', 'wp-content/plugins/my_plugin/', 'shama/my_plugin'), @@ -330,6 +349,7 @@ class InstallerTest extends TestCase array('phifty-bundle', 'bundles/core/', 'shama/core'), array('phifty-library', 'libraries/my-lib/', 'shama/my-lib'), array('phifty-framework', 'frameworks/my-framework/', 'shama/my-framework'), + array('yawik-module', 'module/MyModule/', 'shama/my_module'), ); } diff --git a/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php b/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php new file mode 100644 index 0000000000..d8d35ff245 --- /dev/null +++ b/plugins/rainlab/blog/vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php @@ -0,0 +1,64 @@ +package = new Package('YawikCompanyRegistration', '1.0', '1.0'); + $this->io = $this->getMock('Composer\IO\PackageInterface'); + $this->composer = new Composer(); + } + + /** + * testInflectPackageVars + * + * @dataProvider packageNameProvider + * @return void + */ + public function testInflectPackageVars($input) + { + $installer = new YawikInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => $input)); + $this->assertEquals($result, array('name' => 'YawikCompanyRegistration')); + } + + public function packageNameProvider() + { + return array( + array('yawik-company-registration'), + array('yawik_company_registration'), + array('YawikCompanyRegistration') + ); + } +}