Skip to content

Commit

Permalink
upgraded Shortcode library to latest v0.6 release
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderer committed Nov 7, 2016
1 parent 8bff003 commit 79d33fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ StringHumanizer::truncateHtml($text, 75, '<b><i><u><em><strong><a><span>', '...'

```

**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**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
8 changes: 4 additions & 4 deletions src/Coduo/PHPHumanizer/StringHumanizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 79d33fd

Please sign in to comment.