mirror of
https://github.com/danpros/htmly.git
synced 2026-04-22 05:26:22 +05:30
RSS Description config option added
Gives the admin the config option to choose to replace the RSS description value with Meta Description instead of Body (default is the current setting of body, if nothing is selected defaults to body).
This commit is contained in:
parent
651027b0ea
commit
32388b2a37
4 changed files with 38 additions and 7 deletions
|
|
@ -318,3 +318,6 @@ msg_error_field_req_link = "Link field is required."
|
||||||
msg_error_field_req_quote = "Quote field is required."
|
msg_error_field_req_quote = "Quote field is required."
|
||||||
msg_error_field_req_audio = "Audio field is required."
|
msg_error_field_req_audio = "Audio field is required."
|
||||||
msg_error_field_req_feedurl = "You need to specify the feed url."
|
msg_error_field_req_feedurl = "You need to specify the feed url."
|
||||||
|
rss_feeds_description_select = "RSS Description"
|
||||||
|
rss_description_body = "Post Body"
|
||||||
|
rss_description_meta = "Post Meta Description"
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="-config-static.frontpage" id="static.frontpage1" value="true" <?php if (config('static.frontpage') === 'true'):?>checked<?php endif;?>>
|
<input class="form-check-input" type="radio" name="-config-static.frontpage" id="static.frontpage2" value="true" <?php if (config('static.frontpage') === 'true'):?>checked<?php endif;?>>
|
||||||
<label class="form-check-label" for="static.frontpage2">
|
<label class="form-check-label" for="static.frontpage2">
|
||||||
<?php echo i18n('Static_page');?>
|
<?php echo i18n('Static_page');?>
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -134,6 +134,25 @@
|
||||||
<br>
|
<br>
|
||||||
<h4><?php echo i18n('RSS_settings');?></h4>
|
<h4><?php echo i18n('RSS_settings');?></h4>
|
||||||
<hr>
|
<hr>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-2 col-form-label"><?php echo i18n('RSS_feeds_description_select');?></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="radio" name="-config-rss.description" id="rss.description1" value="body" <?php if (config('rss.description') === 'body'):?>checked<?php endif;?>>
|
||||||
|
<label class="form-check-label" for="rss.description1">
|
||||||
|
<?php echo i18n('RSS_description_body');?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="radio" name="-config-rss.description" id="rss.description2" value="meta" <?php if (config('rss.description') === 'meta'):?>checked<?php endif;?>>
|
||||||
|
<label class="form-check-label" for="rss.description2">
|
||||||
|
<?php echo i18n('RSS_description_meta');?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="rss.count" class="col-sm-2 col-form-label"><?php echo i18n('RSS_feeds_show_the_most_recent');?></label>
|
<label for="rss.count" class="col-sm-2 col-form-label"><?php echo i18n('RSS_feeds_show_the_most_recent');?></label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
|
|
||||||
|
|
@ -92,5 +92,6 @@
|
||||||
"autosave.enable",
|
"autosave.enable",
|
||||||
"mfa.state",
|
"mfa.state",
|
||||||
"show.version",
|
"show.version",
|
||||||
"thumbnail.width"
|
"thumbnail.width",
|
||||||
|
"rss.description"
|
||||||
]
|
]
|
||||||
|
|
@ -2992,6 +2992,7 @@ function generate_rss($posts, $data = null)
|
||||||
$channel = new Channel();
|
$channel = new Channel();
|
||||||
$rssLength = config('rss.char');
|
$rssLength = config('rss.char');
|
||||||
$data = $data;
|
$data = $data;
|
||||||
|
$rssDesc = config('rss.description');
|
||||||
|
|
||||||
if (is_null($data)) {
|
if (is_null($data)) {
|
||||||
$channel
|
$channel
|
||||||
|
|
@ -3009,12 +3010,19 @@ function generate_rss($posts, $data = null)
|
||||||
if ($posts) {
|
if ($posts) {
|
||||||
foreach ($posts as $p) {
|
foreach ($posts as $p) {
|
||||||
$img = get_image($p->body);
|
$img = get_image($p->body);
|
||||||
|
if ($rssDesc == "meta") {
|
||||||
|
if (!empty($rssLength)) {
|
||||||
|
$body = shorten($p->description, $rssLength);
|
||||||
|
} else {
|
||||||
|
$body = $p->description;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (!empty($rssLength)) {
|
if (!empty($rssLength)) {
|
||||||
$body = shorten($p->body, $rssLength);
|
$body = shorten($p->body, $rssLength);
|
||||||
} else {
|
} else {
|
||||||
$body = $p->body;
|
$body = $p->body;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$item = new Item();
|
$item = new Item();
|
||||||
$item
|
$item
|
||||||
->category(strip_tags($p->category));
|
->category(strip_tags($p->category));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue