Skip to content

Commit

Permalink
Merge pull request #4 from meatpaste/master
Browse files Browse the repository at this point in the history
add 'strip_tags' parameter
  • Loading branch information
Derek Jones committed Feb 6, 2019
2 parents c31314c + 910c420 commit 7513c2a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions word_limit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ Permits you to limit the number of words in some text
#### Parameters

- `total` - lets you specify the number of words.
- `strip_tags` - removes any HTML code before limiting words.

## Change Log

### 2.1.0
- Add 'strip_tags' parameter

### 2.0

- Updated plugin to be 3.0 compatible
Expand Down
2 changes: 1 addition & 1 deletion word_limit/addon.setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'author_url' => 'https://ellislab.com/',
'name' => 'Word Limiter',
'description' => 'Permits you to limit the number of words in some text',
'version' => '2.0',
'version' => '2.1.0',
'namespace' => 'User\Addons\WordLimit',
'settings_exist' => FALSE
);
7 changes: 7 additions & 0 deletions word_limit/pi.word_limit.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ function __construct($str = '')
$total = ( ! ee()->TMPL->fetch_param('total')) ? 500 : ee()->TMPL->fetch_param('total');
$total = ( ! is_numeric($total)) ? 500 : $total;

$strip_tags = get_bool_from_string(ee()->TMPL->fetch_param('strip_tags', 'no'));

$str = ($str == '') ? ee()->TMPL->tagdata : $str;

if ($strip_tags)
{
$str = strip_tags($str);
}

$this->return_data = ee()->functions->word_limiter($str, $total);
}
Expand Down

0 comments on commit 7513c2a

Please sign in to comment.