mirror of
https://github.com/friendica/friendica
synced 2025-04-26 07:50:15 +00:00
reverting tinymce changes, updating smarty to 3.1.19
This commit is contained in:
parent
5633e88aad
commit
0e1f8f6486
155 changed files with 13663 additions and 10784 deletions
|
@ -2,27 +2,29 @@
|
|||
/**
|
||||
* Smarty shared plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage PluginsShared
|
||||
*/
|
||||
|
||||
if(!function_exists('smarty_mb_wordwrap')) {
|
||||
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
|
||||
* @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)
|
||||
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);
|
||||
$tokens = preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, - 1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
|
||||
$length = 0;
|
||||
$t = '';
|
||||
$_previous = false;
|
||||
|
@ -32,12 +34,12 @@ if(!function_exists('smarty_mb_wordwrap')) {
|
|||
$_tokens = array($_token);
|
||||
if ($token_length > $width) {
|
||||
// remove last space
|
||||
$t = mb_substr($t, 0, -1, Smarty::$_CHARSET);
|
||||
$t = mb_substr($t, 0, - 1, Smarty::$_CHARSET);
|
||||
$_previous = false;
|
||||
$length = 0;
|
||||
|
||||
if ($cut) {
|
||||
$_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, $_token, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
|
||||
$_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, $_token, - 1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
|
||||
// broken words go on a new line
|
||||
$t .= $break;
|
||||
}
|
||||
|
@ -51,7 +53,7 @@ if(!function_exists('smarty_mb_wordwrap')) {
|
|||
if ($length > $width) {
|
||||
// remove space before inserted break
|
||||
if ($_previous && $token_length < $width) {
|
||||
$t = mb_substr($t, 0, -1, Smarty::$_CHARSET);
|
||||
$t = mb_substr($t, 0, - 1, Smarty::$_CHARSET);
|
||||
}
|
||||
|
||||
// add the break before the token
|
||||
|
@ -63,7 +65,7 @@ if(!function_exists('smarty_mb_wordwrap')) {
|
|||
$length = 0;
|
||||
continue;
|
||||
}
|
||||
} else if ($token == "\n") {
|
||||
} elseif ($token == "\n") {
|
||||
// hard break must reset counters
|
||||
$_previous = 0;
|
||||
$length = 0;
|
||||
|
@ -78,6 +80,4 @@ if(!function_exists('smarty_mb_wordwrap')) {
|
|||
|
||||
return $t;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue