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,25 +702,14 @@ function has_pagination($total, $perpage, $page = 1) {
|
|||
}
|
||||
|
||||
// Get the meta description
|
||||
function get_description($text) {
|
||||
function get_description($string) {
|
||||
|
||||
$string = explode('</p>', $text);
|
||||
$string = preg_replace('/[^A-Za-z0-9 !@#$%^&*(),.-]/u', ' ', strip_tags($string[0] . '</p>'));
|
||||
$string = remove_accent($string);
|
||||
$string = preg_replace('/[^A-Za-z0-9 !@#$%^&*(),.-]/u', ' ', strip_tags($string));
|
||||
$string = ltrim($string);
|
||||
|
||||
if (strlen($string) > 1) {
|
||||
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
|
||||
function get_teaser($text, $url) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue