unable to return three dots at the end of excerpt.
-
<?php /** * * Class A5 Excerpt * * @ A5 Plugin Framework * Version: 1.0 beta * * Gets the excerpt of a post according to some parameters * * standard parameters: offset(=0), usertext, excerpt, count * additional parameters: class(classname), filter(boolean), shortcode(boolean), format(boolean), readmore_link(boolean), * readmore_text(string) * */ class A5_Excerpt { public static function text($args) { extract($args); $offset = (isset($offset)) ? $offset : 0; $class = (!empty($class)) ? ' class ="'.$class.'"' : ''; $filter = (isset($filter)) ? $filter : false; $shortcode = (isset($shortcode)) ? $shortcode : false; $format = (isset($format)) ? $format : false; if (!empty($usertext)) : $output = $usertext; else: if (!empty($excerpt)) : $output = $excerpt; else : $excerpt_base = (empty($shortcode)) ? preg_replace('/\[caption(.*?)\[\/caption\]/', '', $content) : strip_shortcodes($content); $text = (empty($format)) ? strip_tags(trim(preg_replace('/\s\s+/', ' ', str_replace(array("\r\n", "\n", "\r", " "), ' ', $excerpt_base)))) : preg_replace('#<img(.*?)/>#', '', $excerpt_base); $text = preg_replace('/\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i', '', $text); $length = (isset($count)) ? $count : 15; $dots = 'hello'; $style = (isset($type)) ? $type : 'sentences'; switch ($style) : case 'words' : $short = array_slice(explode(' ', $text), $offset, $length); $output = trim(implode(' ', $short)); break; case 'sentences' : /* $short = array_slice(preg_split("/([\t.!?:]+)/", $text, -1, PREG_SPLIT_DELIM_CAPTURE), $offset*2, $length*2); $output = trim(implode($short)); */ $short = array_slice(explode(' ', $text), $offset, $length); $output = trim(implode(' ', $short)); break; case 'letters' : $output = substr($text, $offset, $length); break; default : $output = $text; endswitch; endif; endif; if (!empty($linespace)) : $short=preg_split("/([\t.!?:]+)/", $output, -1, PREG_SPLIT_DELIM_CAPTURE); $short[count($short)] = ''; foreach ($short as $key => $pieces) : if (!($key % 2) && $key < (count($short)-1)) : $tmpex[] = implode(array($short[$key], $short[$key+1])); endif; endforeach; if (isset($tmpex)) $output = trim(implode('<br /><br />', $tmpex)); endif; if (!empty($readmore)) $output.=' <a href="'.$link.'" title="'.$title.'"'.$class.'>'.$rmtext.'</a>'; $output = ($filter === true) ? apply_filters('the_excerpt', $output) : $output; return $output; } } // A5_Excerpt ?>
Above code how its look like. please help me out to return 3 dots at the end of excerpt. Its very urgent.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘unable to return three dots at the end of excerpt.’ is closed to new replies.