commit 69f5a2c2c855b5e1987d6d0281b9788b6300ad55
parent 9f56d0ac98f4b85eb9712df953ccc0ddc60f254c
Author: markseu <mark2011@mayberg.se>
Date: Fri, 4 May 2018 21:30:21 +0200
Updated core, experimental API
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/system/plugins/core.php b/system/plugins/core.php
@@ -3193,6 +3193,14 @@ class YellowToolbox
foreach($tokens as $key=>$value) if($value==$optional) $tokens[$key] = "";
return $tokens;
}
+
+ // Return number of words in text string
+ function getTextWords($text)
+ {
+ $text = preg_replace("/([\p{Han}\p{Hiragana}\p{Katakana}]{3})/u", "$1 ", $text);
+ $text = preg_replace("/(\pL|\p{N})/u", "x", $text);
+ return str_word_count($text);
+ }
// Create description from text string
function createTextDescription($text, $lengthMax = 0, $removeHtml = true, $endMarker = "", $endMarkerText = "")