From a241eea0eaa97f72e2a238eff70c88b2a9dcb6c5 Mon Sep 17 00:00:00 2001 From: Venelin Iliev Date: Fri, 5 Aug 2016 18:36:23 +0300 Subject: [PATCH 01/13] use mb_* --- .gitignore | 1 + src/Torann/LaravelMetaTags/MetaTag.php | 10 ++--- tests/Tests.php | 52 +++++++++++++------------- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 5826402..9c10d38 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ composer.phar composer.lock .DS_Store +.idea diff --git a/src/Torann/LaravelMetaTags/MetaTag.php b/src/Torann/LaravelMetaTags/MetaTag.php index f804242..28ec2ed 100644 --- a/src/Torann/LaravelMetaTags/MetaTag.php +++ b/src/Torann/LaravelMetaTags/MetaTag.php @@ -241,7 +241,7 @@ private function setTitle($value) if ($title && $this->config['title_limit']) { $title = ' - '.$title; - $limit = $this->config['title_limit'] - strlen($title); + $limit = $this->config['title_limit'] - mb_strlen($title); } else { $limit = 'title'; @@ -297,16 +297,16 @@ private function cut($text, $key) return $text; } - $length = strlen($text); + $length = mb_strlen($text); if ($length <= (int) $limit) { return $text; } - $text = substr($text, 0, ($limit -= 3)); + $text = mb_substr($text, 0, ($limit -= 3)); - if ($space = strrpos($text, ' ')) { - $text = substr($text, 0, $space); + if ($space = mb_strrpos($text, ' ')) { + $text = mb_substr($text, 0, $space); } return $text.'...'; diff --git a/tests/Tests.php b/tests/Tests.php index 05c7ac0..4aaf45c 100644 --- a/tests/Tests.php +++ b/tests/Tests.php @@ -22,11 +22,11 @@ protected static function text($length) $base = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $text = ''; - while (strlen($text) < $length) { + while (mb_strlen($text) < $length) { $text .= str_shuffle($base); } - return substr($text, 0, $length); + return mb_substr($text, 0, $length); } public function testMetaTitle() @@ -38,7 +38,7 @@ public function testMetaTitle() $response = $this->Meta->meta('title', $text = self::text(80)); $this->assertNotTrue($text, $response); - $this->assertTrue(strlen($response) === 70); + $this->assertTrue(mb_strlen($response) === 70); } public function testMetaDescription() @@ -50,7 +50,7 @@ public function testMetaDescription() $response = $this->Meta->meta('description', $text = self::text(250)); $this->assertNotTrue($text === $response); - $this->assertTrue(strlen($response) === 200); + $this->assertTrue(mb_strlen($response) === 200); } public function testMetaTitleWithTitle() @@ -66,7 +66,7 @@ public function testMetaTitleWithTitle() $response = $this->Meta->meta('title', $text = self::text(80)); $this->assertNotTrue($text.' - '.self::$title === $response); - $this->assertTrue(strlen($response) === 70); + $this->assertTrue(mb_strlen($response) === 70); } public function testMetaImage() @@ -99,8 +99,8 @@ public function testTagTitle() $tag = $this->Meta->tag('title'); - $this->assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'title"') === 4); + $this->assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'title"') === 4); $this->assertTrue(strstr($tag, self::$title) ? true : false); $this->assertTrue(strstr($tag, $text) ? true : false); } @@ -112,8 +112,8 @@ public function testTagMetaNameTitle() $tag = $this->Meta->tagMetaName('title'); - $this->assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'title"') === 2); + $this->assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'title"') === 2); $this->assertTrue(strstr($tag, self::$title) ? true : false); $this->assertTrue(strstr($tag, $text) ? true : false); } @@ -125,8 +125,8 @@ public function testTagMetaPropertyTitle() $tag = $this->Meta->tagMetaProperty('title'); - $this->assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'title"') === 2); + $this->assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'title"') === 2); $this->assertTrue(strstr($tag, self::$title) ? true : false); $this->assertTrue(strstr($tag, $text) ? true : false); } @@ -137,8 +137,8 @@ public function testTagDescription() $tag = $this->Meta->tag('description'); - $this->assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'description"') === 4); + $this->assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'description"') === 4); $this->assertTrue(strstr($tag, $text) ? true : false); } @@ -148,8 +148,8 @@ public function testTagMetaNameDescription() $tag = $this->Meta->tagMetaName('description'); - $this->assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'description"') === 2); + $this->assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'description"') === 2); $this->assertTrue(strstr($tag, $text) ? true : false); } @@ -159,8 +159,8 @@ public function testTagMetaPropertyDescription() $tag = $this->Meta->tagMetaProperty('description'); - $this->assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'description"') === 2); + $this->assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'description"') === 2); $this->assertTrue(strstr($tag, $text) ? true : false); } @@ -170,8 +170,8 @@ public function testTagKeywords() $tag = $this->Meta->tag('keywords'); - $this->assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'keywords"') === 2); + $this->assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'keywords"') === 2); $this->assertTrue(strstr($tag, $text) ? true : false); } @@ -181,8 +181,8 @@ public function testTagMetaNameKeywords() $tag = $this->Meta->tagMetaName('keywords'); - $this->assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'keywords"') === 1); + $this->assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'keywords"') === 1); $this->assertTrue(strstr($tag, $text) ? true : false); } @@ -192,8 +192,8 @@ public function testTagMetaPropertyKeywords() $tag = $this->Meta->tagMetaProperty('keywords'); - $this->assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'keywords"') === 1); + $this->assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'keywords"') === 1); $this->assertTrue(strstr($tag, $text) ? true : false); } @@ -205,8 +205,8 @@ public function testTagImage() $tag = $this->Meta->tag('image'); - $this->assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'assertTrue(substr_count($tag, 'image') === 25); + $this->assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'assertTrue(mb_substr_count($tag, 'image') === 25); } } From 366fd2f16a8a6da4b9f7449e206a675dc78c5c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B5=D0=BD=D0=B5=D0=BB=D0=B8=D0=BD=20=D0=98=D0=BB?= =?UTF-8?q?=D0=B8=D0=B5=D0=B2?= Date: Fri, 26 Aug 2016 13:05:07 +0300 Subject: [PATCH 02/13] add to packagist --- composer.json | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index a3772ac..18ec034 100644 --- a/composer.json +++ b/composer.json @@ -1,16 +1,12 @@ { - "name": "torann/laravel-meta-tags", + "name": "provision/laravel-meta-tags", "keywords": ["meta tags", "meta", "tags", "head", "laravel"], "description": "A package to manage Header Meta Tags", "license": "MIT", "authors": [ { - "name": "Lito", - "email": "lito@eordes.com" - }, - { - "name": "Daniel Stainback", - "email": "daniel@lyften.com" + "name": "Venelin Iliev", + "email": "venelin@provision.bg" } ], "require": { From 944b9267481cbd347070fa1b25786991309329f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B5=D0=BD=D0=B5=D0=BB=D0=B8=D0=BD=20=D0=98=D0=BB?= =?UTF-8?q?=D0=B8=D0=B5=D0=B2?= Date: Fri, 26 Aug 2016 13:13:24 +0300 Subject: [PATCH 03/13] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 63b6149..fd03b42 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ With this package you can manage header Meta Tags from Laravel controllers. From the command line run ``` -$ composer require torann/laravel-meta-tags +$ composer require provision/laravel-meta-tags ``` Once Meta Tags is installed you need to register the service provider with the application. Open up `config/app.php` and find the `providers` key. @@ -162,4 +162,4 @@ class HomeController extends Controller @yield('content') -``` \ No newline at end of file +``` From 315c866ab2bdf23bcc3f2fe7dffefcc9c548e715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B5=D0=BD=D0=B5=D0=BB=D0=B8=D0=BD=20=D0=98=D0=BB?= =?UTF-8?q?=D0=B8=D0=B5=D0=B2?= Date: Tue, 30 Aug 2016 19:49:14 +0300 Subject: [PATCH 04/13] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 18ec034..6fc648a 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": ">=5.5.9", - "illuminate/support": "5.1.*|5.2.*" + "illuminate/support": "5.1.*|5.2.*|5.3.*" }, "require-dev": { "phpunit/phpunit": "^4.8", From 8755ad99c46a71c27b7000c69d9ce364128c95a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B5=D0=BD=D0=B5=D0=BB=D0=B8=D0=BD=20=D0=98=D0=BB?= =?UTF-8?q?=D0=B8=D0=B5=D0=B2?= Date: Thu, 10 Nov 2016 17:18:04 +0200 Subject: [PATCH 05/13] Fix new rows after meta tag --- src/Torann/LaravelMetaTags/MetaTag.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Torann/LaravelMetaTags/MetaTag.php b/src/Torann/LaravelMetaTags/MetaTag.php index 28ec2ed..7ff2191 100644 --- a/src/Torann/LaravelMetaTags/MetaTag.php +++ b/src/Torann/LaravelMetaTags/MetaTag.php @@ -265,7 +265,7 @@ private function createTag(array $values) $attributes = implode(' ', $attributes); - return "\n "; + return ""; } /** From 5535cdc9503e17912890cad847775617c1498821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B5=D0=BD=D0=B5=D0=BB=D0=B8=D0=BD=20=D0=98=D0=BB?= =?UTF-8?q?=D0=B8=D0=B5=D0=B2?= Date: Fri, 27 Jan 2017 13:57:14 +0200 Subject: [PATCH 06/13] Update MetaTagsServiceProvider.php --- src/Torann/LaravelMetaTags/MetaTagsServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Torann/LaravelMetaTags/MetaTagsServiceProvider.php b/src/Torann/LaravelMetaTags/MetaTagsServiceProvider.php index 10e2028..d358d29 100644 --- a/src/Torann/LaravelMetaTags/MetaTagsServiceProvider.php +++ b/src/Torann/LaravelMetaTags/MetaTagsServiceProvider.php @@ -32,7 +32,7 @@ public function boot() */ public function register() { - $this->app['metatag'] = $this->app->share(function ($app) { + $this->app['metatag'] = $this->app->singleton(function ($app) { return new MetaTag( $app['request'], $app['config']['meta-tags'], From 45628bd4b96ed59cff1f86e559023bb89707ce75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B5=D0=BD=D0=B5=D0=BB=D0=B8=D0=BD=20=D0=98=D0=BB?= =?UTF-8?q?=D0=B8=D0=B5=D0=B2?= Date: Fri, 27 Jan 2017 14:06:55 +0200 Subject: [PATCH 07/13] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6fc648a..46d99f4 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": ">=5.5.9", - "illuminate/support": "5.1.*|5.2.*|5.3.*" + "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*" }, "require-dev": { "phpunit/phpunit": "^4.8", From eee3ab9635854938a7e93d30e9d08f3593599689 Mon Sep 17 00:00:00 2001 From: Venelin Iliev Date: Fri, 27 Jan 2017 14:53:09 +0200 Subject: [PATCH 08/13] laravel 5.4 update --- src/Torann/LaravelMetaTags/MetaTagsServiceProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Torann/LaravelMetaTags/MetaTagsServiceProvider.php b/src/Torann/LaravelMetaTags/MetaTagsServiceProvider.php index d358d29..2678ad6 100644 --- a/src/Torann/LaravelMetaTags/MetaTagsServiceProvider.php +++ b/src/Torann/LaravelMetaTags/MetaTagsServiceProvider.php @@ -21,7 +21,7 @@ class MetaTagsServiceProvider extends ServiceProvider public function boot() { $this->publishes([ - __DIR__.'/../../config/config.php' => config_path('meta-tags.php') + __DIR__ . '/../../config/config.php' => config_path('meta-tags.php') ]); } @@ -32,7 +32,7 @@ public function boot() */ public function register() { - $this->app['metatag'] = $this->app->singleton(function ($app) { + $this->app->singleton('metatag', function ($app) { return new MetaTag( $app['request'], $app['config']['meta-tags'], From f16f3407f4b08eeb4789fc705c29630cba785cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B5=D0=BD=D0=B5=D0=BB=D0=B8=D0=BD=20=D0=98=D0=BB?= =?UTF-8?q?=D0=B8=D0=B5=D0=B2?= Date: Sat, 28 Jan 2017 14:06:46 +0200 Subject: [PATCH 09/13] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 46d99f4..6aa4881 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "provision/laravel-meta-tags", + "name": "provision/meta-tags", "keywords": ["meta tags", "meta", "tags", "head", "laravel"], "description": "A package to manage Header Meta Tags", "license": "MIT", From c9be95d88c4da9552df8a4aa371c6e9641a4179c Mon Sep 17 00:00:00 2001 From: Venelin Iliev Date: Sat, 28 Jan 2017 14:31:06 +0200 Subject: [PATCH 10/13] provision/meta-tags --- README.md | 6 +++--- composer.json | 8 ++------ {src/config => config}/config.php | 0 src/{Torann/LaravelMetaTags => }/Facades/MetaTag.php | 4 ++-- src/{Torann/LaravelMetaTags => }/MetaTag.php | 2 +- .../LaravelMetaTags => }/MetaTagsServiceProvider.php | 6 +++--- 6 files changed, 11 insertions(+), 15 deletions(-) rename {src/config => config}/config.php (100%) rename src/{Torann/LaravelMetaTags => }/Facades/MetaTag.php (77%) rename src/{Torann/LaravelMetaTags => }/MetaTag.php (99%) rename src/{Torann/LaravelMetaTags => }/MetaTagsServiceProvider.php (83%) diff --git a/README.md b/README.md index fd03b42..9680ee2 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Once Meta Tags is installed you need to register the service provider with the a ```php 'providers' => array( - Torann\LaravelMetaTags\MetaTagsServiceProvider::class, + ProVision\MetaTags\MetaTagsServiceProvider::class, ) ``` @@ -32,7 +32,7 @@ Meta Tags also ships with a facade which provides the static syntax for creating ```php 'aliases' => array( - 'MetaTag' => Torann\LaravelMetaTags\Facades\MetaTag::class, + 'MetaTag' => ProVision\MetaTags\Facades\MetaTag::class, ) ``` @@ -42,7 +42,7 @@ Meta Tags also ships with a facade which provides the static syntax for creating Run this on the command line from the root of your project: ``` -$ php artisan vendor:publish --provider="Torann\LaravelMetaTags\MetaTagsServiceProvider" +$ php artisan vendor:publish --provider="ProVision\MetaTags\MetaTagsServiceProvider" ``` A configuration file will be publish to `config/meta-tags.php`. diff --git a/composer.json b/composer.json index 6aa4881..fdd8004 100644 --- a/composer.json +++ b/composer.json @@ -11,15 +11,11 @@ ], "require": { "php": ">=5.5.9", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*" - }, - "require-dev": { - "phpunit/phpunit": "^4.8", - "mockery/mockery": "^0.9.4" + "illuminate/support": "~5.1" }, "autoload": { "psr-4": { - "Torann\\LaravelMetaTags\\": "src/Torann/LaravelMetaTags/" + "ProVision\\MetaTags\\": "src/" } } } diff --git a/src/config/config.php b/config/config.php similarity index 100% rename from src/config/config.php rename to config/config.php diff --git a/src/Torann/LaravelMetaTags/Facades/MetaTag.php b/src/Facades/MetaTag.php similarity index 77% rename from src/Torann/LaravelMetaTags/Facades/MetaTag.php rename to src/Facades/MetaTag.php index fadf107..f1e318f 100644 --- a/src/Torann/LaravelMetaTags/Facades/MetaTag.php +++ b/src/Facades/MetaTag.php @@ -1,6 +1,6 @@ publishes([ - __DIR__ . '/../../config/config.php' => config_path('meta-tags.php') + __DIR__ . '/../config/config.php' => config_path('meta-tags.php') ]); } @@ -32,7 +32,7 @@ public function boot() */ public function register() { - $this->app->singleton('metatag', function ($app) { + $this->app->singleton('meta-tag', function ($app) { return new MetaTag( $app['request'], $app['config']['meta-tags'], From 08a3ccf8e4a062e6b28fca70e1daf79c402782d8 Mon Sep 17 00:00:00 2001 From: Venelin Iliev Date: Sat, 28 Jan 2017 14:32:45 +0200 Subject: [PATCH 11/13] readme --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9680ee2..78e4bfb 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,12 @@ With this package you can manage header Meta Tags from Laravel controllers. ## Installation -- [Laravel MetaTags on Packagist](https://packagist.org/packages/torann/laravel-meta-tags) -- [Laravel MetaTags on GitHub](https://github.com/Torann/laravel-meta-tags) +- [Laravel MetaTags on Packagist](https://packagist.org/packages/provision/meta-tags) From the command line run ``` -$ composer require provision/laravel-meta-tags +$ composer require provision/meta-tags ``` Once Meta Tags is installed you need to register the service provider with the application. Open up `config/app.php` and find the `providers` key. From 8030f977661a338188a7be925585043333904c50 Mon Sep 17 00:00:00 2001 From: Venelin Iliev Date: Mon, 30 Jan 2017 10:45:58 +0200 Subject: [PATCH 12/13] facade fix --- src/Facades/MetaTag.php | 2 +- src/MetaTagsServiceProvider.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Facades/MetaTag.php b/src/Facades/MetaTag.php index f1e318f..69f83d0 100644 --- a/src/Facades/MetaTag.php +++ b/src/Facades/MetaTag.php @@ -13,6 +13,6 @@ class MetaTag extends Facade */ protected static function getFacadeAccessor() { - return 'MetaTag'; + return 'metatag'; } } diff --git a/src/MetaTagsServiceProvider.php b/src/MetaTagsServiceProvider.php index 32a6525..4556c31 100644 --- a/src/MetaTagsServiceProvider.php +++ b/src/MetaTagsServiceProvider.php @@ -32,7 +32,7 @@ public function boot() */ public function register() { - $this->app->singleton('meta-tag', function ($app) { + $this->app->singleton('metatag', function ($app) { return new MetaTag( $app['request'], $app['config']['meta-tags'], From 8af906083dc5ab0a5571e91caf37ed16aba3f3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B5=D0=BD=D0=B5=D0=BB=D0=B8=D0=BD=20=D0=98=D0=BB?= =?UTF-8?q?=D0=B8=D0=B5=D0=B2?= Date: Mon, 20 Feb 2017 17:56:11 +0200 Subject: [PATCH 13/13] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fdd8004..df2ce70 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": ">=5.5.9", - "illuminate/support": "~5.1" + "illuminate/support": "~5" }, "autoload": { "psr-4": {