mirror of
https://github.com/danpros/htmly.git
synced 2026-04-18 11:36:20 +05:30
fixed Issue #68
This commit is contained in:
parent
f70ce4e950
commit
c02ca49118
1 changed files with 5 additions and 16 deletions
|
|
@ -702,24 +702,13 @@ function has_pagination($total, $perpage, $page = 1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the meta description
|
// Get the meta description
|
||||||
function get_description($text) {
|
function get_description($string) {
|
||||||
|
|
||||||
$string = explode('</p>', $text);
|
$string = remove_accent($string);
|
||||||
$string = preg_replace('/[^A-Za-z0-9 !@#$%^&*(),.-]/u', ' ', strip_tags($string[0] . '</p>'));
|
$string = preg_replace('/[^A-Za-z0-9 !@#$%^&*(),.-]/u', ' ', strip_tags($string));
|
||||||
$string = ltrim($string);
|
$string = ltrim($string);
|
||||||
|
$string = substr($string, 0, config('description.char'));
|
||||||
if (strlen($string) > 1) {
|
return $string = substr($string, 0, strrpos($string, ' '));
|
||||||
return $string;
|
|
||||||
} else {
|
|
||||||
$string = preg_replace('/[^A-Za-z0-9 !@#$%^&*(),.-]/u', ' ', strip_tags($text));
|
|
||||||
$string = rtrim(ltrim($string), $string);
|
|
||||||
if (strlen($string) < config('description.char')) {
|
|
||||||
return $string;
|
|
||||||
} else {
|
|
||||||
$string = substr($string, 0, config('description.char'));
|
|
||||||
return $string = substr($string, 0, strrpos($string, ' '));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the teaser
|
// Get the teaser
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue