aboutsummaryrefslogtreecommitdiffstats
path: root/library/Smarty/libs/plugins/shared.mb_wordwrap.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-12-18 15:48:49 +0100
committerMario Vavti <mario@mariovavti.com>2017-12-18 15:48:49 +0100
commit439d41b194073285ab97be94253b3f4cb4395e43 (patch)
tree272d4c64ea2d766235ecb41009117b5269f8cdfd /library/Smarty/libs/plugins/shared.mb_wordwrap.php
parent08a8f195e749a120642f6c486c1dad62a73924d1 (diff)
downloadvolse-hubzilla-439d41b194073285ab97be94253b3f4cb4395e43.tar.gz
volse-hubzilla-439d41b194073285ab97be94253b3f4cb4395e43.tar.bz2
volse-hubzilla-439d41b194073285ab97be94253b3f4cb4395e43.zip
install smarty via composer and update other php libs
Diffstat (limited to 'library/Smarty/libs/plugins/shared.mb_wordwrap.php')
-rw-r--r--library/Smarty/libs/plugins/shared.mb_wordwrap.php73
1 files changed, 0 insertions, 73 deletions
diff --git a/library/Smarty/libs/plugins/shared.mb_wordwrap.php b/library/Smarty/libs/plugins/shared.mb_wordwrap.php
deleted file mode 100644
index 31f4acf01..000000000
--- a/library/Smarty/libs/plugins/shared.mb_wordwrap.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-/**
- * Smarty shared plugin
- *
- * @package Smarty
- * @subpackage PluginsShared
- */
-
-if (!function_exists('smarty_mb_wordwrap')) {
-
- /**
- * Wrap a string to a given number of characters
- *
- * @link http://php.net/manual/en/function.wordwrap.php for similarity
- *
- * @param string $str the string to wrap
- * @param int $width the width of the output
- * @param string $break the character used to break the line
- * @param boolean $cut ignored parameter, just for the sake of
- *
- * @return string wrapped string
- * @author Rodney Rehm
- */
- function smarty_mb_wordwrap($str, $width = 75, $break = "\n", $cut = false)
- {
- // break words into tokens using white space as a delimiter
- $tokens = preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, - 1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
- $length = 0;
- $t = '';
- $_previous = false;
- $_space = false;
-
- foreach ($tokens as $_token) {
- $token_length = mb_strlen($_token, Smarty::$_CHARSET);
- $_tokens = array($_token);
- if ($token_length > $width) {
- if ($cut) {
- $_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, $_token, - 1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
- }
- }
-
- foreach ($_tokens as $token) {
- $_space = !!preg_match('!^\s$!S' . Smarty::$_UTF8_MODIFIER, $token);
- $token_length = mb_strlen($token, Smarty::$_CHARSET);
- $length += $token_length;
-
- if ($length > $width) {
- // remove space before inserted break
- if ($_previous) {
- $t = mb_substr($t, 0, - 1, Smarty::$_CHARSET);
- }
-
- if (!$_space) {
- // add the break before the token
- if (!empty($t)) {
- $t .= $break;
- }
- $length = $token_length;
- }
- } elseif ($token == "\n") {
- // hard break must reset counters
- $_previous = 0;
- $length = 0;
- }
- $_previous = $_space;
- // add the token
- $t .= $token;
- }
- }
-
- return $t;
- }
-}