mirror of
https://github.com/danpros/htmly.git
synced 2026-04-19 12:06:22 +05:30
Update functions.php
This commit is contained in:
parent
a8e3c0e670
commit
ce23850edd
1 changed files with 7 additions and 4 deletions
|
|
@ -2907,7 +2907,7 @@ function generate_rss($posts, $data = null)
|
||||||
}
|
}
|
||||||
if ($posts) {
|
if ($posts) {
|
||||||
foreach ($posts as $p) {
|
foreach ($posts as $p) {
|
||||||
|
$img = get_image($p->body);
|
||||||
if (!empty($rssLength)) {
|
if (!empty($rssLength)) {
|
||||||
if (strlen(strip_tags($p->body)) < config('rss.char')) {
|
if (strlen(strip_tags($p->body)) < config('rss.char')) {
|
||||||
$string = preg_replace('/\s\s+/', ' ', strip_tags($p->body));
|
$string = preg_replace('/\s\s+/', ' ', strip_tags($p->body));
|
||||||
|
|
@ -2931,10 +2931,13 @@ function generate_rss($posts, $data = null)
|
||||||
->description($body)
|
->description($body)
|
||||||
->url($p->url)
|
->url($p->url)
|
||||||
->appendTo($channel);
|
->appendTo($channel);
|
||||||
|
|
||||||
if ($p->image !== null) {
|
if (!empty($p->image)) {
|
||||||
$item->enclosure($p->image, 0, "image/" . end(explode('.', $p->image)));
|
$item->enclosure($p->image, 0, "image/" . pathinfo($p->image, PATHINFO_EXTENSION));
|
||||||
|
} elseif (!empty($img)) {
|
||||||
|
$item->enclosure($img, 0, "image/" . pathinfo($img, PATHINFO_EXTENSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue