From 77bb35428b8fbe5cd19ef3633dba5f287f9dbf69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szab=C3=B3=20Gerg=C5=91?= Date: Tue, 29 Nov 2016 09:00:40 +0100 Subject: [PATCH 1/3] Improve the translation --- Plugin.php | 17 +++++++++-------- components/Popular.php | 9 ++++----- components/Views.php | 9 ++++----- lang/en/lang.php | 14 ++++++++++++-- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/Plugin.php b/Plugin.php index a6802d5..efe6d2f 100644 --- a/Plugin.php +++ b/Plugin.php @@ -29,10 +29,11 @@ class Plugin extends PluginBase public function pluginDetails() { return [ - 'name' => 'Blog Views', - 'description' => 'The plugin enables blog posts views tracking and displaying popular articles.', + 'name' => 'vdomah.blogviews::lang.plugin.name', + 'description' => 'vdomah.blogviews::lang.plugin.description', 'author' => 'Art Gek', - 'icon' => 'icon-signal' + 'icon' => 'icon-signal', + 'homepage' => 'https://github.com/vdomah/blogviews' ]; } @@ -44,16 +45,17 @@ public function pluginDetails() public function registerComponents() { return [ - 'Vdomah\BlogViews\Components\Views' => 'views', - 'Vdomah\BlogViews\Components\Popular' => 'popularPosts', + 'Vdomah\BlogViews\Components\Views' => 'views', + 'Vdomah\BlogViews\Components\Popular' => 'popularPosts' ]; } public function boot() { PostComponent::extend(function($component) { - if ($this->app->runningInBackend()) + if ($this->app->runningInBackend()) { return; + } if (!Session::has('postsviewed')) { Session::put('postsviewed', []); @@ -101,9 +103,8 @@ public function setViews($post, $views = null) } Db::table($this->table_views)->insert([ 'post_id' => $post->getKey(), - 'views' => $views, + 'views' => $views ]); } } - } diff --git a/components/Popular.php b/components/Popular.php index 7095c30..50e23fb 100644 --- a/components/Popular.php +++ b/components/Popular.php @@ -32,8 +32,8 @@ class Popular extends ComponentBase public function componentDetails() { return [ - 'name' => 'Popular Posts', - 'description' => 'Most viewed posts list' + 'name' => 'vdomah.blogviews::lang.component.popular_name', + 'description' => 'vdomah.blogviews::lang.component.popular_description' ]; } @@ -60,7 +60,7 @@ public function defineProperties() 'type' => 'dropdown', 'default' => 'blog/post', 'group' => 'Links', - ], + ] ]; } @@ -104,5 +104,4 @@ public function getPostPageOptions() { return Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName'); } - -} \ No newline at end of file +} diff --git a/components/Views.php b/components/Views.php index 726d16e..396be06 100644 --- a/components/Views.php +++ b/components/Views.php @@ -14,8 +14,8 @@ class Views extends ComponentBase public function componentDetails() { return [ - 'name' => 'Post Views', - 'description' => 'Show post views' + 'name' => 'vdomah.blogviews::lang.component.views_name', + 'description' => 'vdomah.blogviews::lang.component.views_description' ]; } @@ -27,7 +27,7 @@ public function defineProperties() 'description' => 'rainlab.blog::lang.settings.post_slug_description', 'default' => '{{ :slug }}', 'type' => 'string' - ], + ] ]; } @@ -58,5 +58,4 @@ protected function getViews() return $out; } - -} \ No newline at end of file +} diff --git a/lang/en/lang.php b/lang/en/lang.php index bcc629d..e228fed 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -1,6 +1,10 @@ [ + 'name' => 'Blog Views', + 'description' => 'The plugin enables blog posts views tracking and displaying popular articles.' + ], 'settings' => [ 'posts_limit' => 'Limit', 'posts_limit_validation' => 'Invalid format of the limit value', @@ -10,6 +14,12 @@ 'posts_post_description' => 'Name of the blog post page file for the "Learn more" links. This property is used by the default component partial.' ], 'post' => [ - 'tab_views' => 'Views', + 'tab_views' => 'Views' ], -]; \ No newline at end of file + 'component' => [ + 'popular_name' => 'Popular Posts', + 'popular_description' => 'Most viewed posts list', + 'views_name' => 'Post Views', + 'views_description' => 'Show post views' + ] +]; From fcb6d7044e3da003dbf6154e6e80a2a093df096b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szab=C3=B3=20Gerg=C5=91?= Date: Tue, 29 Nov 2016 09:00:58 +0100 Subject: [PATCH 2/3] Add MIT license --- LICENCE.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 LICENCE.md diff --git a/LICENCE.md b/LICENCE.md new file mode 100644 index 0000000..38cee79 --- /dev/null +++ b/LICENCE.md @@ -0,0 +1,19 @@ +# MIT license + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 2766966356d95b4479e05cfeda38302e31c9588e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szab=C3=B3=20Gerg=C5=91?= Date: Tue, 29 Nov 2016 09:01:26 +0100 Subject: [PATCH 3/3] Remove the unnecessary newlines --- updates/create_post_views_table.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/updates/create_post_views_table.php b/updates/create_post_views_table.php index 13965d3..f74ef16 100644 --- a/updates/create_post_views_table.php +++ b/updates/create_post_views_table.php @@ -5,7 +5,6 @@ class CreatePostViewsTable extends Migration { - public function up() { Schema::create('vdomah_blogviews_views', function($table) @@ -21,5 +20,4 @@ public function down() { Schema::dropIfExists('vdomah_blogviews_views'); } - }