Example #1
0
 /**
  * Abbreviate $content if a $limit greater than zero is given
  *
  */
 function AbbrevContent($content, $post_index, $limit = 0)
 {
     if (!is_numeric($limit) || $limit == 0) {
         return $content;
     }
     $content = strip_tags($content);
     if (SimpleBlogCommon::strlen($content) < $limit) {
         return $content;
     }
     $pos = SimpleBlogCommon::strpos($content, ' ', $limit - 5);
     if ($pos > 0 && $limit + 20 > $pos) {
         $limit = $pos;
     }
     $content = SimpleBlogCommon::substr($content, 0, $limit) . ' ... ';
     $label = gpOutput::SelectText('Read More');
     return $content . SimpleBlogCommon::PostLink($post_index, $label);
 }
 function substr_replace($str, $repl, $start, $length)
 {
     $part_one = SimpleBlogCommon::substr($str, 0, $start);
     $part_two = SimpleBlogCommon::substr($str, $start + $length);
     return $part_one . $repl . $part_two;
 }