From 79d33fda3b5920441465fbd3a9271b93e4f588ea Mon Sep 17 00:00:00 2001 From: Tomasz Kowalczyk Date: Mon, 7 Nov 2016 17:36:25 +0100 Subject: [PATCH] upgraded Shortcode library to latest v0.6 release --- README.md | 9 +++++++++ composer.json | 2 +- src/Coduo/PHPHumanizer/StringHumanizer.php | 8 ++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 04d2502..324e420 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,15 @@ StringHumanizer::truncateHtml($text, 75, '', '...' ``` +**Remove shortcodes** + +```php +$text = 'A text with [short]random[/short] [codes]words[/codes].'; + +StringHumanizer::removeShortcodes($text); // "A text with ." +StringHumanizer::removeShortcodeTags($text); // "A text with random words." +``` + ## Number **Ordinalize** diff --git a/composer.json b/composer.json index 1615773..a0d77ea 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "symfony/yaml": "^2.3|^3.0" }, "require-dev": { - "thunderer/shortcode": "~0.5", + "thunderer/shortcode": "^0.6", "phpspec/phpspec": "^2", "phpunit/phpunit": "^4.5|^5.0" }, diff --git a/src/Coduo/PHPHumanizer/StringHumanizer.php b/src/Coduo/PHPHumanizer/StringHumanizer.php index 686fe59..86f5fc0 100644 --- a/src/Coduo/PHPHumanizer/StringHumanizer.php +++ b/src/Coduo/PHPHumanizer/StringHumanizer.php @@ -59,9 +59,9 @@ public static function truncateHtml($text, $charactersCount, $allowedTags = '', public static function removeShortcodes($text) { if (!class_exists('Thunder\Shortcode\Processor\Processor')) { - throw new \RuntimeException("Please add \"thunderer/shortcode\": ~0.5 to composer.json first"); + throw new \RuntimeException("Please add \"thunderer/shortcode\": ^0.6 to composer.json first"); } - + $processor = new ShortcodeProcessor(); return $processor->removeShortcodes($text); @@ -74,9 +74,9 @@ public static function removeShortcodes($text) public static function removeShortcodeTags($text) { if (!class_exists('Thunder\Shortcode\Processor\Processor')) { - throw new \RuntimeException("Please add \"thunderer/shortcode\": ~0.5 to composer.json first"); + throw new \RuntimeException("Please add \"thunderer/shortcode\": ^0.6 to composer.json first"); } - + $processor = new ShortcodeProcessor(); return $processor->removeShortcodeTags($text);