Loading app/Controllers/Admin/Episode.php +4 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,7 @@ class Episode extends BaseController : null, 'type' => $this->request->getPost('type'), 'is_blocked' => $this->request->getPost('block') == 'yes', 'custom_rss_string' => $this->request->getPost('custom_rss'), 'created_by' => user(), 'updated_by' => user(), 'published_at' => $publicationDate Loading Loading @@ -236,6 +237,9 @@ class Episode extends BaseController : null; $this->episode->type = $this->request->getPost('type'); $this->episode->is_blocked = $this->request->getPost('block') == 'yes'; $this->episode->custom_rss_string = $this->request->getPost( 'custom_rss' ); $publicationDate = $this->request->getPost('publication_date'); $this->episode->published_at = $publicationDate Loading app/Controllers/Admin/Podcast.php +4 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ class Podcast extends BaseController 'copyright' => $this->request->getPost('copyright'), 'location' => $this->request->getPost('location_name'), 'payment_pointer' => $this->request->getPost('payment_pointer'), 'custom_rss_string' => $this->request->getPost('custom_rss'), 'is_blocked' => $this->request->getPost('block') === 'yes', 'is_completed' => $this->request->getPost('complete') === 'yes', 'is_locked' => $this->request->getPost('lock') === 'yes', Loading Loading @@ -259,6 +260,9 @@ class Podcast extends BaseController $this->podcast->payment_pointer = $this->request->getPost( 'payment_pointer' ); $this->podcast->custom_rss_string = $this->request->getPost( 'custom_rss' ); $this->podcast->is_blocked = $this->request->getPost('block') === 'yes'; $this->podcast->is_completed = $this->request->getPost('complete') === 'yes'; Loading app/Database/Migrations/2020-05-30-101500_add_podcasts.php +4 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,10 @@ class AddPodcasts extends Migration 'constraint' => 12, 'null' => true, ], 'custom_rss' => [ 'type' => 'JSON', 'null' => true, ], 'created_by' => [ 'type' => 'INT', 'unsigned' => true, Loading app/Database/Migrations/2020-06-05-170000_add_episodes.php +4 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,10 @@ class AddEpisodes extends Migration 'constraint' => 12, 'null' => true, ], 'custom_rss' => [ 'type' => 'JSON', 'null' => true, ], 'created_by' => [ 'type' => 'INT', 'unsigned' => true, Loading app/Entities/Episode.php +60 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,13 @@ class Episode extends Entity */ protected $publication_status; /** * Return custom rss as string * * @var string */ protected $custom_rss_string; protected $dates = [ 'published_at', 'created_at', Loading Loading @@ -136,6 +143,7 @@ class Episode extends Entity 'location_name' => '?string', 'location_geo' => '?string', 'location_osmid' => '?string', 'custom_rss' => '?json-array', 'created_by' => 'integer', 'updated_by' => 'integer', ]; Loading Loading @@ -564,4 +572,56 @@ class Episode extends Entity } return $this; } /** * Get custom rss tag as XML String * * @return string * */ function getCustomRssString() { helper('rss'); if (empty($this->attributes['custom_rss'])) { return ''; } else { $xmlNode = (new \App\Libraries\SimpleRSSElement( '<?xml version="1.0" encoding="utf-8"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:podcast="https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"/>' )) ->addChild('channel') ->addChild('item'); array_to_rss( [ 'elements' => $this->custom_rss, ], $xmlNode ); return str_replace(['<item>', '</item>'], '', $xmlNode->asXML()); } } /** * Saves custom rss tag into json * * @param string $customRssString * */ function setCustomRssString($customRssString) { helper('rss'); $customRssArray = rss_to_array( simplexml_load_string( '<?xml version="1.0" encoding="utf-8"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:podcast="https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><item>' . $customRssString . '</item></channel></rss>' ) )['elements'][0]['elements'][0]; if (array_key_exists('elements', $customRssArray)) { $this->attributes['custom_rss'] = json_encode( $customRssArray['elements'] ); } else { $this->attributes['custom_rss'] = null; } } } Loading
app/Controllers/Admin/Episode.php +4 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,7 @@ class Episode extends BaseController : null, 'type' => $this->request->getPost('type'), 'is_blocked' => $this->request->getPost('block') == 'yes', 'custom_rss_string' => $this->request->getPost('custom_rss'), 'created_by' => user(), 'updated_by' => user(), 'published_at' => $publicationDate Loading Loading @@ -236,6 +237,9 @@ class Episode extends BaseController : null; $this->episode->type = $this->request->getPost('type'); $this->episode->is_blocked = $this->request->getPost('block') == 'yes'; $this->episode->custom_rss_string = $this->request->getPost( 'custom_rss' ); $publicationDate = $this->request->getPost('publication_date'); $this->episode->published_at = $publicationDate Loading
app/Controllers/Admin/Podcast.php +4 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ class Podcast extends BaseController 'copyright' => $this->request->getPost('copyright'), 'location' => $this->request->getPost('location_name'), 'payment_pointer' => $this->request->getPost('payment_pointer'), 'custom_rss_string' => $this->request->getPost('custom_rss'), 'is_blocked' => $this->request->getPost('block') === 'yes', 'is_completed' => $this->request->getPost('complete') === 'yes', 'is_locked' => $this->request->getPost('lock') === 'yes', Loading Loading @@ -259,6 +260,9 @@ class Podcast extends BaseController $this->podcast->payment_pointer = $this->request->getPost( 'payment_pointer' ); $this->podcast->custom_rss_string = $this->request->getPost( 'custom_rss' ); $this->podcast->is_blocked = $this->request->getPost('block') === 'yes'; $this->podcast->is_completed = $this->request->getPost('complete') === 'yes'; Loading
app/Database/Migrations/2020-05-30-101500_add_podcasts.php +4 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,10 @@ class AddPodcasts extends Migration 'constraint' => 12, 'null' => true, ], 'custom_rss' => [ 'type' => 'JSON', 'null' => true, ], 'created_by' => [ 'type' => 'INT', 'unsigned' => true, Loading
app/Database/Migrations/2020-06-05-170000_add_episodes.php +4 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,10 @@ class AddEpisodes extends Migration 'constraint' => 12, 'null' => true, ], 'custom_rss' => [ 'type' => 'JSON', 'null' => true, ], 'created_by' => [ 'type' => 'INT', 'unsigned' => true, Loading
app/Entities/Episode.php +60 −0 Original line number Diff line number Diff line Loading @@ -106,6 +106,13 @@ class Episode extends Entity */ protected $publication_status; /** * Return custom rss as string * * @var string */ protected $custom_rss_string; protected $dates = [ 'published_at', 'created_at', Loading Loading @@ -136,6 +143,7 @@ class Episode extends Entity 'location_name' => '?string', 'location_geo' => '?string', 'location_osmid' => '?string', 'custom_rss' => '?json-array', 'created_by' => 'integer', 'updated_by' => 'integer', ]; Loading Loading @@ -564,4 +572,56 @@ class Episode extends Entity } return $this; } /** * Get custom rss tag as XML String * * @return string * */ function getCustomRssString() { helper('rss'); if (empty($this->attributes['custom_rss'])) { return ''; } else { $xmlNode = (new \App\Libraries\SimpleRSSElement( '<?xml version="1.0" encoding="utf-8"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:podcast="https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"/>' )) ->addChild('channel') ->addChild('item'); array_to_rss( [ 'elements' => $this->custom_rss, ], $xmlNode ); return str_replace(['<item>', '</item>'], '', $xmlNode->asXML()); } } /** * Saves custom rss tag into json * * @param string $customRssString * */ function setCustomRssString($customRssString) { helper('rss'); $customRssArray = rss_to_array( simplexml_load_string( '<?xml version="1.0" encoding="utf-8"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:podcast="https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><item>' . $customRssString . '</item></channel></rss>' ) )['elements'][0]['elements'][0]; if (array_key_exists('elements', $customRssArray)) { $this->attributes['custom_rss'] = json_encode( $customRssArray['elements'] ); } else { $this->attributes['custom_rss'] = null; } } }