feat(partner): add link and image in episode description
This commit is contained in:
parent
62bae1eb70
commit
ad07bb9330
|
@ -164,6 +164,9 @@ class Podcast extends BaseController
|
||||||
'location' => $this->request->getPost('location_name'),
|
'location' => $this->request->getPost('location_name'),
|
||||||
'payment_pointer' => $this->request->getPost('payment_pointer'),
|
'payment_pointer' => $this->request->getPost('payment_pointer'),
|
||||||
'custom_rss_string' => $this->request->getPost('custom_rss'),
|
'custom_rss_string' => $this->request->getPost('custom_rss'),
|
||||||
|
'partner_id' => $this->request->getPost('partner_id'),
|
||||||
|
'partner_link_url' => $this->request->getPost('partner_link_url'),
|
||||||
|
'partner_image_url' => $this->request->getPost('partner_image_url'),
|
||||||
'is_blocked' => $this->request->getPost('block') === 'yes',
|
'is_blocked' => $this->request->getPost('block') === 'yes',
|
||||||
'is_completed' => $this->request->getPost('complete') === 'yes',
|
'is_completed' => $this->request->getPost('complete') === 'yes',
|
||||||
'is_locked' => $this->request->getPost('lock') === 'yes',
|
'is_locked' => $this->request->getPost('lock') === 'yes',
|
||||||
|
@ -263,6 +266,13 @@ class Podcast extends BaseController
|
||||||
$this->podcast->custom_rss_string = $this->request->getPost(
|
$this->podcast->custom_rss_string = $this->request->getPost(
|
||||||
'custom_rss'
|
'custom_rss'
|
||||||
);
|
);
|
||||||
|
$this->podcast->partner_id = $this->request->getPost('partner_id');
|
||||||
|
$this->podcast->partner_link_url = $this->request->getPost(
|
||||||
|
'partner_link_url'
|
||||||
|
);
|
||||||
|
$this->podcast->partner_image_url = $this->request->getPost(
|
||||||
|
'partner_image_url'
|
||||||
|
);
|
||||||
$this->podcast->is_blocked = $this->request->getPost('block') === 'yes';
|
$this->podcast->is_blocked = $this->request->getPost('block') === 'yes';
|
||||||
$this->podcast->is_completed =
|
$this->podcast->is_completed =
|
||||||
$this->request->getPost('complete') === 'yes';
|
$this->request->getPost('complete') === 'yes';
|
||||||
|
|
|
@ -140,6 +140,20 @@ class AddPodcasts extends Migration
|
||||||
],
|
],
|
||||||
'custom_rss' => [
|
'custom_rss' => [
|
||||||
'type' => 'JSON',
|
'type' => 'JSON',
|
||||||
|
],
|
||||||
|
'partner_id' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 32,
|
||||||
|
'null' => true,
|
||||||
|
],
|
||||||
|
'partner_link_url' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 512,
|
||||||
|
'null' => true,
|
||||||
|
],
|
||||||
|
'partner_image_url' => [
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => 512,
|
||||||
'null' => true,
|
'null' => true,
|
||||||
],
|
],
|
||||||
'created_by' => [
|
'created_by' => [
|
||||||
|
|
|
@ -483,19 +483,21 @@ class Episode extends Entity
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescriptionHtml()
|
public function getDescriptionHtml($serviceSlug = null)
|
||||||
{
|
{
|
||||||
if (
|
return (empty($this->getPodcast()->partner_id) ||
|
||||||
$descriptionFooter = $this->getPodcast()
|
empty($this->getPodcast()->partner_link_url) ||
|
||||||
->episode_description_footer_html
|
empty($this->getPodcast()->partner_image_url)
|
||||||
) {
|
? ''
|
||||||
return $this->attributes['description_html'] .
|
: "<div><a href=\"{$this->getPartnerLink(
|
||||||
'<footer>' .
|
$serviceSlug
|
||||||
$descriptionFooter .
|
)}\" rel=\"sponsored noopener noreferrer\" target=\"_blank\"><img src=\"{$this->getPartnerImage(
|
||||||
'</footer>';
|
$serviceSlug
|
||||||
}
|
)}\" alt=\"Partner image\" /></a></div>") .
|
||||||
|
$this->attributes['description_html'] .
|
||||||
return $this->attributes['description_html'];
|
(empty($this->getPodcast()->episode_description_footer_html)
|
||||||
|
? ''
|
||||||
|
: "<footer>{$this->getPodcast()->episode_description_footer_html}</footer>");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription()
|
public function getDescription()
|
||||||
|
@ -624,4 +626,24 @@ class Episode extends Entity
|
||||||
$this->attributes['custom_rss'] = null;
|
$this->attributes['custom_rss'] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPartnerLink($serviceSlug = null)
|
||||||
|
{
|
||||||
|
return rtrim($this->getPodcast()->partner_link_url, '/') .
|
||||||
|
'?pid=' .
|
||||||
|
$this->getPodcast()->partner_id .
|
||||||
|
'&guid=' .
|
||||||
|
urlencode($this->attributes['guid']) .
|
||||||
|
(empty($serviceSlug) ? '' : '&_from=' . $serviceSlug);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPartnerImage($serviceSlug = null)
|
||||||
|
{
|
||||||
|
return rtrim($this->getPodcast()->partner_image_url, '/') .
|
||||||
|
'?pid=' .
|
||||||
|
$this->getPodcast()->partner_id .
|
||||||
|
'&guid=' .
|
||||||
|
urlencode($this->attributes['guid']) .
|
||||||
|
(empty($serviceSlug) ? '' : '&_from=' . $serviceSlug);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,9 @@ class Podcast extends Entity
|
||||||
'location_osmid' => '?string',
|
'location_osmid' => '?string',
|
||||||
'payment_pointer' => '?string',
|
'payment_pointer' => '?string',
|
||||||
'custom_rss' => '?json-array',
|
'custom_rss' => '?json-array',
|
||||||
|
'partner_id' => '?string',
|
||||||
|
'partner_link_url' => '?string',
|
||||||
|
'partner_image_url' => '?string',
|
||||||
'created_by' => 'integer',
|
'created_by' => 'integer',
|
||||||
'updated_by' => 'integer',
|
'updated_by' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
|
@ -282,7 +282,10 @@ function get_rss_feed($podcast, $serviceSlug = '')
|
||||||
$locationElement->addAttribute('osm', $episode->location_osmid);
|
$locationElement->addAttribute('osm', $episode->location_osmid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$item->addChildWithCDATA('description', $episode->description_html);
|
$item->addChildWithCDATA(
|
||||||
|
'description',
|
||||||
|
$episode->getDescriptionHtml($serviceSlug)
|
||||||
|
);
|
||||||
$item->addChild(
|
$item->addChild(
|
||||||
'duration',
|
'duration',
|
||||||
$episode->enclosure_duration,
|
$episode->enclosure_duration,
|
||||||
|
|
|
@ -77,6 +77,13 @@ return [
|
||||||
'If you need RSS tags that Castopod does not handle, set them here.',
|
'If you need RSS tags that Castopod does not handle, set them here.',
|
||||||
'custom_rss' => 'Custom RSS tags for the podcast',
|
'custom_rss' => 'Custom RSS tags for the podcast',
|
||||||
'custom_rss_hint' => 'This will be injected within the ❬channel❭ tag.',
|
'custom_rss_hint' => 'This will be injected within the ❬channel❭ tag.',
|
||||||
|
'partnership' => 'Partnership',
|
||||||
|
'partner_id' => 'ID',
|
||||||
|
'partner_link_url' => 'Link URL',
|
||||||
|
'partner_image_url' => 'Image URL',
|
||||||
|
'partner_id_hint' => 'Your own partner ID',
|
||||||
|
'partner_link_url_hint' => 'The generic partner link address',
|
||||||
|
'partner_image_url_hint' => 'The generic partner image address',
|
||||||
'status_section_title' => 'Status',
|
'status_section_title' => 'Status',
|
||||||
'status_section_subtitle' => 'Dead or alive?',
|
'status_section_subtitle' => 'Dead or alive?',
|
||||||
'block' => 'Podcast should be hidden from all platforms',
|
'block' => 'Podcast should be hidden from all platforms',
|
||||||
|
|
|
@ -79,6 +79,13 @@ return [
|
||||||
'Si vous avez besoin d’une balise que nous n’avons pas couverte, définissez-la ici.',
|
'Si vous avez besoin d’une balise que nous n’avons pas couverte, définissez-la ici.',
|
||||||
'custom_rss' => 'Balises RSS personnalisées pour le podcast',
|
'custom_rss' => 'Balises RSS personnalisées pour le podcast',
|
||||||
'custom_rss_hint' => 'Ceci sera injecté dans la balise ❬channel❭.',
|
'custom_rss_hint' => 'Ceci sera injecté dans la balise ❬channel❭.',
|
||||||
|
'partnership' => 'Partenariat',
|
||||||
|
'partner_id' => 'ID',
|
||||||
|
'partner_link_url' => 'URL lien',
|
||||||
|
'partner_image_url' => 'URL image',
|
||||||
|
'partner_id_hint' => 'Votre identifiant personnel partenaire',
|
||||||
|
'partner_link_url_hint' => 'L’adresse générique des liens partenaire',
|
||||||
|
'partner_image_url_hint' => 'L’adresse générique des images partenaire',
|
||||||
'status_section_title' => 'Statut',
|
'status_section_title' => 'Statut',
|
||||||
'status_section_subtitle' => 'Vivant ou mort ?',
|
'status_section_subtitle' => 'Vivant ou mort ?',
|
||||||
'block' => 'Le podcast doit être masqué sur toutes les plateformes',
|
'block' => 'Le podcast doit être masqué sur toutes les plateformes',
|
||||||
|
|
|
@ -42,6 +42,9 @@ class PodcastModel extends Model
|
||||||
'location_osmid',
|
'location_osmid',
|
||||||
'payment_pointer',
|
'payment_pointer',
|
||||||
'custom_rss',
|
'custom_rss',
|
||||||
|
'partner_id',
|
||||||
|
'partner_link_url',
|
||||||
|
'partner_image_url',
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_by',
|
'updated_by',
|
||||||
];
|
];
|
||||||
|
|
|
@ -279,6 +279,57 @@
|
||||||
'class' => 'form-input mb-4',
|
'class' => 'form-input mb-4',
|
||||||
'value' => old('payment_pointer'),
|
'value' => old('payment_pointer'),
|
||||||
]) ?>
|
]) ?>
|
||||||
|
|
||||||
|
<?= form_label(lang('Podcast.form.partnership')) ?>
|
||||||
|
<div class="flex flex-col mb-4 gap-x-2 gap-y-4 md:flex-row">
|
||||||
|
<div class="flex flex-col flex-shrink w-32">
|
||||||
|
<?= form_label(
|
||||||
|
lang('Podcast.form.partner_id'),
|
||||||
|
'partner_id',
|
||||||
|
[],
|
||||||
|
lang('Podcast.form.partner_id_hint'),
|
||||||
|
true
|
||||||
|
) ?>
|
||||||
|
<?= form_input([
|
||||||
|
'id' => 'partner_id',
|
||||||
|
'name' => 'partner_id',
|
||||||
|
'class' => 'form-input w-full',
|
||||||
|
'value' => old('partner_id'),
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col flex-1">
|
||||||
|
<?= form_label(
|
||||||
|
lang('Podcast.form.partner_link_url'),
|
||||||
|
'partner_link_url',
|
||||||
|
[],
|
||||||
|
lang('Podcast.form.partner_link_url_hint'),
|
||||||
|
true
|
||||||
|
) ?>
|
||||||
|
<?= form_input([
|
||||||
|
'id' => 'partner_link_url',
|
||||||
|
'name' => 'partner_link_url',
|
||||||
|
'class' => 'form-input w-full',
|
||||||
|
'value' => old('partner_link_url'),
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col flex-1">
|
||||||
|
<?= form_label(
|
||||||
|
lang('Podcast.form.partner_image_url'),
|
||||||
|
'partner_image_url',
|
||||||
|
[],
|
||||||
|
lang('Podcast.form.partner_image_url_hint'),
|
||||||
|
|
||||||
|
true
|
||||||
|
) ?>
|
||||||
|
<?= form_input([
|
||||||
|
'id' => 'partner_image_url',
|
||||||
|
'name' => 'partner_image_url',
|
||||||
|
'class' => 'form-input w-full',
|
||||||
|
'value' => old('partner_image_url'),
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?= form_section_close() ?>
|
<?= form_section_close() ?>
|
||||||
|
|
||||||
<?= form_section(
|
<?= form_section(
|
||||||
|
|
|
@ -289,6 +289,55 @@
|
||||||
'class' => 'form-input mb-4',
|
'class' => 'form-input mb-4',
|
||||||
'value' => old('payment_pointer', $podcast->payment_pointer),
|
'value' => old('payment_pointer', $podcast->payment_pointer),
|
||||||
]) ?>
|
]) ?>
|
||||||
|
|
||||||
|
<?= form_label(lang('Podcast.form.partnership')) ?>
|
||||||
|
<div class="flex flex-col mb-4 gap-x-2 gap-y-4 md:flex-row">
|
||||||
|
<div class="flex flex-col flex-shrink w-32">
|
||||||
|
<?= form_label(
|
||||||
|
lang('Podcast.form.partner_id'),
|
||||||
|
'partner_id',
|
||||||
|
[],
|
||||||
|
lang('Podcast.form.partner_id_hint'),
|
||||||
|
true
|
||||||
|
) ?>
|
||||||
|
<?= form_input([
|
||||||
|
'id' => 'partner_id',
|
||||||
|
'name' => 'partner_id',
|
||||||
|
'class' => 'form-input w-full',
|
||||||
|
'value' => old('partner_id', $podcast->partner_id),
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col flex-1">
|
||||||
|
<?= form_label(
|
||||||
|
lang('Podcast.form.partner_link_url'),
|
||||||
|
'partner_link_url',
|
||||||
|
[],
|
||||||
|
lang('Podcast.form.partner_link_url_hint'),
|
||||||
|
true
|
||||||
|
) ?>
|
||||||
|
<?= form_input([
|
||||||
|
'id' => 'partner_link_url',
|
||||||
|
'name' => 'partner_link_url',
|
||||||
|
'class' => 'form-input w-full',
|
||||||
|
'value' => old('partner_link_url', $podcast->partner_link_url),
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col flex-1">
|
||||||
|
<?= form_label(
|
||||||
|
lang('Podcast.form.partner_image_url'),
|
||||||
|
'partner_image_url',
|
||||||
|
[],
|
||||||
|
lang('Podcast.form.partner_image_url_hint'),
|
||||||
|
true
|
||||||
|
) ?>
|
||||||
|
<?= form_input([
|
||||||
|
'id' => 'partner_image_url',
|
||||||
|
'name' => 'partner_image_url',
|
||||||
|
'class' => 'form-input w-full',
|
||||||
|
'value' => old('partner_image_url', $podcast->partner_image_url),
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<?= form_section_close() ?>
|
<?= form_section_close() ?>
|
||||||
|
|
||||||
<?= form_section(
|
<?= form_section(
|
||||||
|
|
|
@ -131,7 +131,7 @@
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<section class="w-full max-w-3xl px-2 py-6 mx-auto prose md:px-6">
|
<section class="w-full max-w-3xl px-2 py-6 mx-auto prose md:px-6">
|
||||||
<?= $episode->description_html ?>
|
<?= $episode->getDescriptionHtml('-+Website+-') ?>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
<footer class="px-2 py-4 border-t ">
|
<footer class="px-2 py-4 border-t ">
|
||||||
|
|
Loading…
Reference in New Issue