method to create "get" string !no!ticket!number!
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@96 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
@ -3,11 +3,11 @@
|
||||
* Простейший шаблонизатор.
|
||||
* Зато быстрый.
|
||||
*
|
||||
* @copyright NetMonsters <team@netmonsters.ru>
|
||||
* @link
|
||||
* @copyright NetMonsters <team@netmonsters.ru>
|
||||
* @link
|
||||
* @package Majestic
|
||||
* @subpackage Decorator
|
||||
* @since
|
||||
* @since
|
||||
* @version SVN: $Id$
|
||||
* @filesource $URL$
|
||||
*/
|
||||
@ -94,23 +94,23 @@ final class Sublimer
|
||||
{
|
||||
return $this->head_array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* обрезает текст до заданной длинны
|
||||
*
|
||||
*
|
||||
* @param string $text
|
||||
* @param int $count
|
||||
* @param string $postfix
|
||||
*/
|
||||
protected function trimString($text, $count = 15, $postfix = "...")
|
||||
{
|
||||
return (mb_strlen($text) > $count) ? mb_substr($text, 0, $count).$postfix : $text;
|
||||
return (mb_strlen($text) > $count) ? mb_substr($text, 0, $count).$postfix : $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Выполняет разрыв строки на данное количество символов с использованием символа разрыва (wordwrap для utf)
|
||||
*
|
||||
*
|
||||
* @param string $text
|
||||
* @param int $width
|
||||
* @param string $break
|
||||
@ -122,14 +122,29 @@ final class Sublimer
|
||||
for ($i = 0; $i < count($words); $i++) {
|
||||
if (mb_strlen($words[$i]) > $width) {
|
||||
for ($j = $width; $j < mb_strlen($words[$i]); $j += $width + (mb_strlen($break))) {
|
||||
$words[$i] = mb_substr($words[$i], 0, $j) . $break . mb_substr($words[$i], $j);
|
||||
$words[$i] = mb_substr($words[$i], 0, $j) . $break . mb_substr($words[$i], $j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return implode(' ', $words);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function formGet(Array $replaces)
|
||||
{
|
||||
$get = $_GET; //дабы не менять дефолтный массив
|
||||
foreach($replaces as $key => $val) {
|
||||
$get[$key] = $val;
|
||||
}
|
||||
|
||||
$str = '?';
|
||||
foreach($get as $key => $val)
|
||||
{
|
||||
$str .= $key.'='.$val.'&';
|
||||
}
|
||||
|
||||
return mb_substr($str, 0, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user