Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgraded Shortcode library to latest v0.6 release
Browse files Browse the repository at this point in the history
thunderer committed Nov 7, 2016
1 parent 8bff003 commit 8b866f9
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
@@ -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**
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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"
},
8 changes: 4 additions & 4 deletions src/Coduo/PHPHumanizer/StringHumanizer.php
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 8b866f9

Please sign in to comment.