first commit

This commit is contained in:
2019-08-13 23:32:13 +02:00
commit 89ae9f3a3a
141 changed files with 168907 additions and 0 deletions

27
assets/php/cuttext.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
/**
* Cut text to specific length.
*
* @author JoseRobinson.com
* @version 201306301956
* @link GitHup: https://gist.github.com/5897554
* @param string $str The text to cut.
* @param int $limit The maximum number of characters that must be returned.
* @param stirng $brChar The character to use for breaking the string.
* @param string $pad The string to use at the end of the cutted string.
* @return string
*/
function cutText($str, $limit, $brChar = ' ', $pad = '...')
{
if (empty($str) || strlen($str) <= $limit) {
return $str;
}
$output = substr($str, 0, ($limit+1));
$brCharPos = strrpos($output, $brChar);
$output = substr($output, 0, $brCharPos);
$output = preg_replace('#\W+$#', '', $output);
$output .= $pad;
return $output;
}