From 42bdba7ce0050f8819ec5868377cd2ed7fa5034e Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Fri, 29 Jun 2012 11:40:57 +0200 Subject: [PATCH] Remove old cut_text function --- include.misc.php | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/include.misc.php b/include.misc.php index f4d496b..71fb53c 100644 --- a/include.misc.php +++ b/include.misc.php @@ -193,48 +193,6 @@ function cut_text($input, $length) } } -function cut_text($value, $length) -{ - /* Thanks to highstrike at gmail dot com (http://www.php.net/manual/en/function.substr.php#80247) */ - if(is_array($value)) list($string, $match_to) = $value; - else { $string = $value; $match_to = $value{0}; } - - $match_start = stristr($string, $match_to); - $match_compute = strlen($string) - strlen($match_start); - - if (strlen($string) > $length) - { - if ($match_compute < ($length - strlen($match_to))) - { - $pre_string = substr($string, 0, $length); - $pos_end = strrpos($pre_string, " "); - if($pos_end === false) $string = $pre_string."..."; - else $string = substr($pre_string, 0, $pos_end)."..."; - } - else if ($match_compute > (strlen($string) - ($length - strlen($match_to)))) - { - $pre_string = substr($string, (strlen($string) - ($length - strlen($match_to)))); - $pos_start = strpos($pre_string, " "); - $string = "...".substr($pre_string, $pos_start); - if($pos_start === false) $string = "...".$pre_string; - else $string = "...".substr($pre_string, $pos_start); - } - else - { - $pre_string = substr($string, ($match_compute - round(($length / 3))), $length); - $pos_start = strpos($pre_string, " "); $pos_end = strrpos($pre_string, " "); - $string = "...".substr($pre_string, $pos_start, $pos_end)."..."; - if($pos_start === false && $pos_end === false) $string = "...".$pre_string."..."; - else $string = "...".substr($pre_string, $pos_start, $pos_end)."..."; - } - - $match_start = stristr($string, $match_to); - $match_compute = strlen($string) - strlen($match_start); - } - - return $string; -} - function filter_html($input) { return strip_tags_attr($input, "



    1. ", "href,src,alt,class,style,align,valign,color,face,size,width,height,shape,coords,target,border,cellpadding,cellspacing,colspan,rowspan");