1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-11 17:24:46 +02:00
This commit is contained in:
Ryan Cramer
2019-11-05 08:55:36 -05:00
parent 76943ac192
commit ceca16506a

View File

@@ -323,6 +323,7 @@ class WireTextTools extends Wire {
* - `stripTags` (bool): Strip markup tags? (default=true)
* - `keepTags` (array): Array of tag names to keep, if stripTags==true. (default=[])
* - `collapseLinesWith` (string): String to collapse newlines with. (default=' ')
* - `linksToUrls` (bool): Convert links to "(url)" rather than removing entirely? (default=false) Since 3.0.132
* - `endBlocksWith` (string): Character or string to insert to identify paragraph/header separation (default='')
* - `convertEntities` (bool): Convert entity-encoded characters to text? (default=true)
* @return mixed|string
@@ -336,13 +337,17 @@ class WireTextTools extends Wire {
'collapseLinesWith' => ' ',
'endBlocksWith' => '',
'convertEntities' => true,
'linksToUrls' => false,
);
$options = array_merge($defaults, $options);
if($options['stripTags']) {
$str = $this->markupToText($str, array(
'underlineHeadlines' => false,
'uppercaseHeadlines' => false,
'convertEntities' => $options['convertEntities'],
'linksToUrls' => $options['linksToUrls'],
'keepTags' => $options['keepTags'],
));
if(!strlen($str)) return $str;