Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • alpha
  • beta
  • develop
  • docs/fix-readme
  • docs/update-vitepress
  • draft/rss-feed
  • feat/dashboard
  • feat/episodes-page-ux
  • feat/generator-user-agent
  • feat/headliner
  • feat/new-languages
  • feat/plugins
  • fix/federation
  • fix/forms-ux
  • i18n
  • main
  • next
  • refactor/transcripts
  • v1.0.0
  • v1.0.0-alpha.1
  • v1.0.0-alpha.10
  • v1.0.0-alpha.11
  • v1.0.0-alpha.12
  • v1.0.0-alpha.13
  • v1.0.0-alpha.14
  • v1.0.0-alpha.15
  • v1.0.0-alpha.16
  • v1.0.0-alpha.17
  • v1.0.0-alpha.18
  • v1.0.0-alpha.19
  • v1.0.0-alpha.2
  • v1.0.0-alpha.20
  • v1.0.0-alpha.21
  • v1.0.0-alpha.22
  • v1.0.0-alpha.23
  • v1.0.0-alpha.24
  • v1.0.0-alpha.25
  • v1.0.0-alpha.26
  • v1.0.0-alpha.27
  • v1.0.0-alpha.28
  • v1.0.0-alpha.29
  • v1.0.0-alpha.3
  • v1.0.0-alpha.30
  • v1.0.0-alpha.31
  • v1.0.0-alpha.32
  • v1.0.0-alpha.33
  • v1.0.0-alpha.34
  • v1.0.0-alpha.35
  • v1.0.0-alpha.36
  • v1.0.0-alpha.37
  • v1.0.0-alpha.38
  • v1.0.0-alpha.39
  • v1.0.0-alpha.4
  • v1.0.0-alpha.40
  • v1.0.0-alpha.41
  • v1.0.0-alpha.42
  • v1.0.0-alpha.43
  • v1.0.0-alpha.44
  • v1.0.0-alpha.45
  • v1.0.0-alpha.46
  • v1.0.0-alpha.47
  • v1.0.0-alpha.48
  • v1.0.0-alpha.49
  • v1.0.0-alpha.5
  • v1.0.0-alpha.50
  • v1.0.0-alpha.51
  • v1.0.0-alpha.52
  • v1.0.0-alpha.53
  • v1.0.0-alpha.54
  • v1.0.0-alpha.55
  • v1.0.0-alpha.56
  • v1.0.0-alpha.57
  • v1.0.0-alpha.58
  • v1.0.0-alpha.59
  • v1.0.0-alpha.6
  • v1.0.0-alpha.60
  • v1.0.0-alpha.61
  • v1.0.0-alpha.62
  • v1.0.0-alpha.63
  • v1.0.0-alpha.64
  • v1.0.0-alpha.65
  • v1.0.0-alpha.66
  • v1.0.0-alpha.67
  • v1.0.0-alpha.68
  • v1.0.0-alpha.69
  • v1.0.0-alpha.7
  • v1.0.0-alpha.70
  • v1.0.0-alpha.71
  • v1.0.0-alpha.72
  • v1.0.0-alpha.73
  • v1.0.0-alpha.74
  • v1.0.0-alpha.75
  • v1.0.0-alpha.76
  • v1.0.0-alpha.77
  • v1.0.0-alpha.78
  • v1.0.0-alpha.79
  • v1.0.0-alpha.8
  • v1.0.0-alpha.80
  • v1.0.0-alpha.9
  • v1.0.0-beta.1
  • v1.0.0-beta.10
  • v1.0.0-beta.11
  • v1.0.0-beta.12
  • v1.0.0-beta.13
  • v1.0.0-beta.14
  • v1.0.0-beta.15
  • v1.0.0-beta.16
  • v1.0.0-beta.17
  • v1.0.0-beta.18
  • v1.0.0-beta.19
  • v1.0.0-beta.2
  • v1.0.0-beta.20
  • v1.0.0-beta.21
  • v1.0.0-beta.22
  • v1.0.0-beta.23
  • v1.0.0-beta.24
  • v1.0.0-beta.3
  • v1.0.0-beta.4
118 results

Target

Select target project
  • adaures/castopod
  • mkljczk/castopod-host
  • spaetz/castopod-host
  • PatrykMis/castopod
  • jonas/castopod
  • ajeremias/castopod
  • misuzu/castopod
  • KrzysztofDomanczyk/castopod
  • Behel/castopod
  • nebulon/castopod
  • ewen/castopod
  • NeoluxConsulting/castopod
  • nateritter/castopod-og
  • prcutler/castopod
14 results
Select Git revision
  • alpha
  • beta
  • develop
  • docs/fix-readme
  • docs/update-vitepress
  • draft/rss-feed
  • feat/dashboard
  • feat/episodes-page-ux
  • feat/generator-user-agent
  • feat/headliner
  • feat/new-languages
  • feat/plugins
  • fix/federation
  • fix/forms-ux
  • i18n
  • main
  • next
  • refactor/transcripts
  • v1.0.0
  • v1.0.0-alpha.1
  • v1.0.0-alpha.10
  • v1.0.0-alpha.11
  • v1.0.0-alpha.12
  • v1.0.0-alpha.13
  • v1.0.0-alpha.14
  • v1.0.0-alpha.15
  • v1.0.0-alpha.16
  • v1.0.0-alpha.17
  • v1.0.0-alpha.18
  • v1.0.0-alpha.19
  • v1.0.0-alpha.2
  • v1.0.0-alpha.20
  • v1.0.0-alpha.21
  • v1.0.0-alpha.22
  • v1.0.0-alpha.23
  • v1.0.0-alpha.24
  • v1.0.0-alpha.25
  • v1.0.0-alpha.26
  • v1.0.0-alpha.27
  • v1.0.0-alpha.28
  • v1.0.0-alpha.29
  • v1.0.0-alpha.3
  • v1.0.0-alpha.30
  • v1.0.0-alpha.31
  • v1.0.0-alpha.32
  • v1.0.0-alpha.33
  • v1.0.0-alpha.34
  • v1.0.0-alpha.35
  • v1.0.0-alpha.36
  • v1.0.0-alpha.37
  • v1.0.0-alpha.38
  • v1.0.0-alpha.39
  • v1.0.0-alpha.4
  • v1.0.0-alpha.40
  • v1.0.0-alpha.41
  • v1.0.0-alpha.42
  • v1.0.0-alpha.43
  • v1.0.0-alpha.44
  • v1.0.0-alpha.45
  • v1.0.0-alpha.46
  • v1.0.0-alpha.47
  • v1.0.0-alpha.48
  • v1.0.0-alpha.49
  • v1.0.0-alpha.5
  • v1.0.0-alpha.50
  • v1.0.0-alpha.51
  • v1.0.0-alpha.52
  • v1.0.0-alpha.53
  • v1.0.0-alpha.54
  • v1.0.0-alpha.55
  • v1.0.0-alpha.56
  • v1.0.0-alpha.57
  • v1.0.0-alpha.58
  • v1.0.0-alpha.59
  • v1.0.0-alpha.6
  • v1.0.0-alpha.60
  • v1.0.0-alpha.61
  • v1.0.0-alpha.62
  • v1.0.0-alpha.63
  • v1.0.0-alpha.64
  • v1.0.0-alpha.65
  • v1.0.0-alpha.66
  • v1.0.0-alpha.67
  • v1.0.0-alpha.68
  • v1.0.0-alpha.69
  • v1.0.0-alpha.7
  • v1.0.0-alpha.70
  • v1.0.0-alpha.71
  • v1.0.0-alpha.72
  • v1.0.0-alpha.73
  • v1.0.0-alpha.74
  • v1.0.0-alpha.75
  • v1.0.0-alpha.76
  • v1.0.0-alpha.77
  • v1.0.0-alpha.78
  • v1.0.0-alpha.79
  • v1.0.0-alpha.8
  • v1.0.0-alpha.80
  • v1.0.0-alpha.9
  • v1.0.0-beta.1
  • v1.0.0-beta.10
  • v1.0.0-beta.11
  • v1.0.0-beta.12
  • v1.0.0-beta.13
  • v1.0.0-beta.14
  • v1.0.0-beta.15
  • v1.0.0-beta.16
  • v1.0.0-beta.17
  • v1.0.0-beta.18
  • v1.0.0-beta.19
  • v1.0.0-beta.2
  • v1.0.0-beta.20
  • v1.0.0-beta.21
  • v1.0.0-beta.22
  • v1.0.0-beta.23
  • v1.0.0-beta.24
  • v1.0.0-beta.3
  • v1.0.0-beta.4
118 results
Show changes
Commits on Source (2)
Showing
with 366 additions and 113 deletions
# [1.0.0-alpha.38](https://code.podlibre.org/podlibre/castopod/compare/v1.0.0-alpha.37...v1.0.0-alpha.38) (2021-02-27)
### Features
* **embeddable-player:** add embeddable player widget ([141788f](https://code.podlibre.org/podlibre/castopod/commit/141788fa089f9dedc8956c64ca515a4a4625f904))
# [1.0.0-alpha.37](https://code.podlibre.org/podlibre/castopod/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2021-02-17) # [1.0.0-alpha.37](https://code.podlibre.org/podlibre/castopod/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2021-02-17)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// //
// NOTE: this constant is updated upon release with Continuous Integration. // NOTE: this constant is updated upon release with Continuous Integration.
// //
defined('CP_VERSION') || define('CP_VERSION', '1.0.0-alpha.37'); defined('CP_VERSION') || define('CP_VERSION', '1.0.0-alpha.38');
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// App Namespace // App Namespace
......
...@@ -326,6 +326,14 @@ $routes->group( ...@@ -326,6 +326,14 @@ $routes->group(
'filter' => 'permission:podcast_episodes-edit', 'filter' => 'permission:podcast_episodes-edit',
] ]
); );
$routes->get(
'embeddable-player',
'Episode::embeddablePlayer/$1/$2',
[
'as' => 'embeddable-player-add',
'filter' => 'permission:podcast_episodes-edit',
]
);
$routes->group('persons', function ($routes) { $routes->group('persons', function ($routes) {
$routes->get('/', 'EpisodePerson/$1/$2', [ $routes->get('/', 'EpisodePerson/$1/$2', [
...@@ -565,9 +573,19 @@ $routes->group(config('App')->authGateway, function ($routes) { ...@@ -565,9 +573,19 @@ $routes->group(config('App')->authGateway, function ($routes) {
// Public routes // Public routes
$routes->group('@(:podcastName)', function ($routes) { $routes->group('@(:podcastName)', function ($routes) {
$routes->get('/', 'Podcast/$1', ['as' => 'podcast']); $routes->get('/', 'Podcast/$1', ['as' => 'podcast']);
$routes->get('(:slug)', 'Episode/$1/$2', [ $routes->group('(:slug)', function ($routes) {
'as' => 'episode', $routes->get('/', 'Episode/$1/$2', [
]); 'as' => 'episode',
]);
$routes->group('embeddable-player', function ($routes) {
$routes->get('/', 'Episode::embeddablePlayer/$1/$2', [
'as' => 'embeddable-player',
]);
$routes->get('(:slug)', 'Episode::embeddablePlayer/$1/$2/$3', [
'as' => 'embeddable-player-theme',
]);
});
});
$routes->head('feed.xml', 'Feed/$1', ['as' => 'podcast_feed']); $routes->head('feed.xml', 'Feed/$1', ['as' => 'podcast_feed']);
$routes->get('feed.xml', 'Feed/$1', ['as' => 'podcast_feed']); $routes->get('feed.xml', 'Feed/$1', ['as' => 'podcast_feed']);
}); });
......
...@@ -420,4 +420,21 @@ class Episode extends BaseController ...@@ -420,4 +420,21 @@ class Episode extends BaseController
$this->episode->id, $this->episode->id,
]); ]);
} }
public function embeddablePlayer()
{
helper(['form']);
$data = [
'podcast' => $this->podcast,
'episode' => $this->episode,
'themes' => EpisodeModel::$themes,
];
replace_breadcrumb_params([
0 => $this->podcast->title,
1 => $this->episode->title,
]);
return view('admin/episode/embeddable_player', $data);
}
} }
...@@ -81,6 +81,12 @@ class PodcastPlatform extends BaseController ...@@ -81,6 +81,12 @@ class PodcastPlatform extends BaseController
) )
? $podcastPlatform['visible'] == 'yes' ? $podcastPlatform['visible'] == 'yes'
: false, : false,
'is_on_embeddable_player' => array_key_exists(
'on_embeddable_player',
$podcastPlatform
)
? $podcastPlatform['on_embeddable_player'] == 'yes'
: false,
]); ]);
} }
} }
......
...@@ -49,8 +49,16 @@ class Analytics extends Controller ...@@ -49,8 +49,16 @@ class Analytics extends Controller
public function hit($base64EpisodeData, ...$filename) public function hit($base64EpisodeData, ...$filename)
{ {
helper('media', 'analytics'); helper('media', 'analytics');
$session = \Config\Services::session();
$serviceName = isset($_GET['_from']) ? $_GET['_from'] : ''; $session->start();
$serviceName = '';
if (isset($_GET['_from'])) {
$serviceName = $_GET['_from'];
} elseif (!empty($session->get('embeddable_player_domain'))) {
$serviceName = $session->get('embeddable_player_domain');
} elseif ($session->get('referer') !== '- Direct -') {
$serviceName = parse_url($session->get('referer'), PHP_URL_HOST);
}
$episodeData = unpack( $episodeData = unpack(
'IpodcastId/IepisodeId/IbytesThreshold/IfileSize/Iduration/IpublicationDate', 'IpodcastId/IepisodeId/IbytesThreshold/IfileSize/Iduration/IpublicationDate',
......
...@@ -36,8 +36,9 @@ class Episode extends BaseController ...@@ -36,8 +36,9 @@ class Episode extends BaseController
) { ) {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound(); throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
} }
unset($params[1]);
return $this->$method(); unset($params[0]);
return $this->$method(...$params);
} }
public function index() public function index()
...@@ -54,48 +55,12 @@ class Episode extends BaseController ...@@ -54,48 +55,12 @@ class Episode extends BaseController
$this->podcast->type $this->podcast->type
); );
helper(['persons']);
$persons = []; $persons = [];
foreach ($this->episode->episode_persons as $episodePerson) { construct_episode_person_array(
if (array_key_exists($episodePerson->person->id, $persons)) { $this->episode->episode_persons,
$persons[$episodePerson->person->id]['roles'] .= $persons
empty($episodePerson->person_group) || );
empty($episodePerson->person_role)
? ''
: (empty(
$persons[$episodePerson->person->id][
'roles'
]
)
? ''
: ', ') .
lang(
'PersonsTaxonomy.persons.' .
$episodePerson->person_group .
'.roles.' .
$episodePerson->person_role .
'.label'
);
} else {
$persons[$episodePerson->person->id] = [
'full_name' => $episodePerson->person->full_name,
'information_url' =>
$episodePerson->person->information_url,
'thumbnail_url' =>
$episodePerson->person->image->thumbnail_url,
'roles' =>
empty($episodePerson->person_group) ||
empty($episodePerson->person_role)
? ''
: lang(
'PersonsTaxonomy.persons.' .
$episodePerson->person_group .
'.roles.' .
$episodePerson->person_role .
'.label'
),
];
}
}
$data = [ $data = [
'previousEpisode' => $previousNextEpisodes['previous'], 'previousEpisode' => $previousNextEpisodes['previous'],
...@@ -120,4 +85,58 @@ class Episode extends BaseController ...@@ -120,4 +85,58 @@ class Episode extends BaseController
return $cachedView; return $cachedView;
} }
public function embeddablePlayer($theme = 'light-transparent')
{
self::triggerWebpageHit($this->episode->podcast_id);
$session = \Config\Services::session();
$session->start();
if (isset($_SERVER['HTTP_REFERER'])) {
$session->set(
'embeddable_player_domain',
parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)
);
}
$locale = service('request')->getLocale();
$cacheName = "page_podcast{$this->episode->podcast_id}_episode{$this->episode->id}_embeddable_player_{$theme}_{$locale}";
if (!($cachedView = cache($cacheName))) {
$episodeModel = new EpisodeModel();
$theme = EpisodeModel::$themes[$theme];
helper(['persons']);
$persons = [];
construct_episode_person_array(
$this->episode->episode_persons,
$persons
);
constructs_podcast_person_array(
$this->podcast->podcast_persons,
$persons
);
$data = [
'podcast' => $this->podcast,
'episode' => $this->episode,
'persons' => $persons,
'theme' => $theme,
];
$secondsToNextUnpublishedEpisode = $episodeModel->getSecondsToNextUnpublishedEpisode(
$this->podcast->id
);
// The page cache is set to a decade so it is deleted manually upon podcast update
return view('embeddable_player', $data, [
'cache' => $secondsToNextUnpublishedEpisode
? $secondsToNextUnpublishedEpisode
: DECADE,
'cache_name' => $cacheName,
]);
}
return $cachedView;
}
} }
...@@ -109,48 +109,12 @@ class Podcast extends BaseController ...@@ -109,48 +109,12 @@ class Podcast extends BaseController
]); ]);
} }
helper(['persons']);
$persons = []; $persons = [];
foreach ($this->podcast->podcast_persons as $podcastPerson) { constructs_podcast_person_array(
if (array_key_exists($podcastPerson->person->id, $persons)) { $this->podcast->podcast_persons,
$persons[$podcastPerson->person->id]['roles'] .= $persons
empty($podcastPerson->person_group) || );
empty($podcastPerson->person_role)
? ''
: (empty(
$persons[$podcastPerson->person->id][
'roles'
]
)
? ''
: ', ') .
lang(
'PersonsTaxonomy.persons.' .
$podcastPerson->person_group .
'.roles.' .
$podcastPerson->person_role .
'.label'
);
} else {
$persons[$podcastPerson->person->id] = [
'full_name' => $podcastPerson->person->full_name,
'information_url' =>
$podcastPerson->person->information_url,
'thumbnail_url' =>
$podcastPerson->person->image->thumbnail_url,
'roles' =>
empty($podcastPerson->person_group) ||
empty($podcastPerson->person_role)
? ''
: lang(
'PersonsTaxonomy.persons.' .
$podcastPerson->person_group .
'.roles.' .
$podcastPerson->person_role .
'.label'
),
];
}
}
$data = [ $data = [
'podcast' => $this->podcast, 'podcast' => $this->podcast,
......
...@@ -40,6 +40,11 @@ class AddPodcastsPlatforms extends Migration ...@@ -40,6 +40,11 @@ class AddPodcastsPlatforms extends Migration
'constraint' => 1, 'constraint' => 1,
'default' => 0, 'default' => 0,
], ],
'is_on_embeddable_player' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
],
]); ]);
$this->forge->addPrimaryKey(['podcast_id', 'platform_slug']); $this->forge->addPrimaryKey(['podcast_id', 'platform_slug']);
......
...@@ -94,6 +94,13 @@ class Episode extends Entity ...@@ -94,6 +94,13 @@ class Episode extends Entity
*/ */
protected $description; protected $description;
/**
* The embeddable player URL
*
* @var string
*/
protected $embeddable_player;
/** /**
* @var string * @var string
*/ */
...@@ -421,6 +428,24 @@ class Episode extends Entity ...@@ -421,6 +428,24 @@ class Episode extends Entity
); );
} }
public function getEmbeddablePlayer($theme = null)
{
return base_url(
$theme
? route_to(
'embeddable-player-theme',
$this->getPodcast()->name,
$this->attributes['slug'],
$theme
)
: route_to(
'embeddable-player',
$this->getPodcast()->name,
$this->attributes['slug']
)
);
}
public function setGuid(string $guid) public function setGuid(string $guid)
{ {
return $this->attributes['guid'] = empty($guid) return $this->attributes['guid'] = empty($guid)
......
...@@ -21,5 +21,6 @@ class Platform extends Entity ...@@ -21,5 +21,6 @@ class Platform extends Entity
'link_url' => '?string', 'link_url' => '?string',
'link_content' => '?string', 'link_content' => '?string',
'is_visible' => '?boolean', 'is_visible' => '?boolean',
'is_on_embeddable_player' => '?boolean',
]; ];
} }
...@@ -324,6 +324,24 @@ class Podcast extends Entity ...@@ -324,6 +324,24 @@ class Podcast extends Entity
return $this->podcastingPlatforms; return $this->podcastingPlatforms;
} }
/**
* Returns true if the podcast has podcasting platform links
*/
public function getHasPodcastingPlatforms()
{
if (empty($this->id)) {
throw new \RuntimeException(
'Podcast must be created before getting podcasting platform.'
);
}
foreach ($this->getPodcastingPlatforms() as $podcastingPlatform) {
if ($podcastingPlatform->is_on_embeddable_player) {
return true;
}
}
return false;
}
/** /**
* Returns the podcast's social platform links * Returns the podcast's social platform links
* *
...@@ -347,6 +365,24 @@ class Podcast extends Entity ...@@ -347,6 +365,24 @@ class Podcast extends Entity
return $this->socialPlatforms; return $this->socialPlatforms;
} }
/**
* Returns true if the podcast has social platform links
*/
public function getHasSocialPlatforms()
{
if (empty($this->id)) {
throw new \RuntimeException(
'Podcast must be created before getting social platform.'
);
}
foreach ($this->getSocialPlatforms() as $socialPlatform) {
if ($socialPlatform->is_on_embeddable_player) {
return true;
}
}
return false;
}
/** /**
* Returns the podcast's funding platform links * Returns the podcast's funding platform links
* *
...@@ -370,6 +406,24 @@ class Podcast extends Entity ...@@ -370,6 +406,24 @@ class Podcast extends Entity
return $this->fundingPlatforms; return $this->fundingPlatforms;
} }
/**
* Returns true if the podcast has social platform links
*/
public function getHasFundingPlatforms()
{
if (empty($this->id)) {
throw new \RuntimeException(
'Podcast must be created before getting Funding platform.'
);
}
foreach ($this->getFundingPlatforms() as $fundingPlatform) {
if ($fundingPlatform->is_on_embeddable_player) {
return true;
}
}
return false;
}
public function getOtherCategories() public function getOtherCategories()
{ {
if (empty($this->id)) { if (empty($this->id)) {
......
...@@ -111,9 +111,6 @@ function set_user_session_player() ...@@ -111,9 +111,6 @@ function set_user_session_player()
$session->start(); $session->start();
if (!$session->has('player')) { if (!$session->has('player')) {
$session = \Config\Services::session();
$session->start();
$playerFound = null; $playerFound = null;
$userAgent = $_SERVER['HTTP_USER_AGENT']; $userAgent = $_SERVER['HTTP_USER_AGENT'];
......
...@@ -384,29 +384,12 @@ if (!function_exists('location_link')) { ...@@ -384,29 +384,12 @@ if (!function_exists('location_link')) {
$locationOsmid, $locationOsmid,
$class = '' $class = ''
) { ) {
$link = null; $link = '';
if (!empty($locationName)) { if (!empty($locationName)) {
$uri = '';
if (!empty($locationOsmid)) {
$uri =
'https://www.openstreetmap.org/' .
['N' => 'node', 'W' => 'way', 'R' => 'relation'][
substr($locationOsmid, 0, 1)
] .
'/' .
substr($locationOsmid, 1);
} elseif (!empty($locationGeo)) {
$uri =
'https://www.openstreetmap.org/#map=17/' .
str_replace(',', '/', substr($locationGeo, 4));
} else {
$uri =
'https://www.openstreetmap.org/search?query=' .
urlencode($locationName);
}
$link = button( $link = button(
$locationName, $locationName,
$uri, location_url($locationName, $locationGeo, $locationOsmid),
[ [
'variant' => 'default', 'variant' => 'default',
'size' => 'small', 'size' => 'small',
...@@ -421,6 +404,7 @@ if (!function_exists('location_link')) { ...@@ -421,6 +404,7 @@ if (!function_exists('location_link')) {
] ]
); );
} }
return $link; return $link;
} }
} }
......
<?php
/**
* @copyright 2021 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
/**
* Fetches persons from an episode
*
* @param array $podcast_persons
* @param array &$persons
*/
function constructs_podcast_person_array($podcast_persons, &$persons)
{
foreach ($podcast_persons as $podcastPerson) {
if (array_key_exists($podcastPerson->person->id, $persons)) {
$persons[$podcastPerson->person->id]['roles'] .=
empty($podcastPerson->person_group) ||
empty($podcastPerson->person_role)
? ''
: (empty($persons[$podcastPerson->person->id]['roles'])
? ''
: ', ') .
lang(
'PersonsTaxonomy.persons.' .
$podcastPerson->person_group .
'.roles.' .
$podcastPerson->person_role .
'.label'
);
} else {
$persons[$podcastPerson->person->id] = [
'full_name' => $podcastPerson->person->full_name,
'information_url' => $podcastPerson->person->information_url,
'thumbnail_url' => $podcastPerson->person->image->thumbnail_url,
'roles' =>
empty($podcastPerson->person_group) ||
empty($podcastPerson->person_role)
? ''
: lang(
'PersonsTaxonomy.persons.' .
$podcastPerson->person_group .
'.roles.' .
$podcastPerson->person_role .
'.label'
),
];
}
}
}
/**
* Fetches persons from an episode
*
* @param array $episode_persons
* @param array &$persons
*/
function construct_episode_person_array($episode_persons, &$persons)
{
foreach ($episode_persons as $episodePerson) {
if (array_key_exists($episodePerson->person->id, $persons)) {
$persons[$episodePerson->person->id]['roles'] .=
empty($episodePerson->person_group) ||
empty($episodePerson->person_role)
? ''
: (empty($persons[$episodePerson->person->id]['roles'])
? ''
: ', ') .
lang(
'PersonsTaxonomy.persons.' .
$episodePerson->person_group .
'.roles.' .
$episodePerson->person_role .
'.label'
);
} else {
$persons[$episodePerson->person->id] = [
'full_name' => $episodePerson->person->full_name,
'information_url' => $episodePerson->person->information_url,
'thumbnail_url' => $episodePerson->person->image->thumbnail_url,
'roles' =>
empty($episodePerson->person_group) ||
empty($episodePerson->person_role)
? ''
: lang(
'PersonsTaxonomy.persons.' .
$episodePerson->person_group .
'.roles.' .
$episodePerson->person_role .
'.label'
),
];
}
}
}
...@@ -38,3 +38,39 @@ if (!function_exists('current_season_url')) { ...@@ -38,3 +38,39 @@ if (!function_exists('current_season_url')) {
return current_url() . $season_query_string; return current_url() . $season_query_string;
} }
} }
if (!function_exists('location_url')) {
/**
* Returns URL to display from location info
*
* @param string $locationName
* @param string $locationGeo
* @param string $locationOsmid
*
* @return string
*/
function location_url($locationName, $locationGeo, $locationOsmid)
{
$uri = '';
if (!empty($locationOsmid)) {
$uri =
'https://www.openstreetmap.org/' .
['N' => 'node', 'W' => 'way', 'R' => 'relation'][
substr($locationOsmid, 0, 1)
] .
'/' .
substr($locationOsmid, 1);
} elseif (!empty($locationGeo)) {
$uri =
'https://www.openstreetmap.org/#map=17/' .
str_replace(',', '/', substr($locationGeo, 4));
} elseif (!empty($locationName)) {
$uri =
'https://www.openstreetmap.org/search?query=' .
urlencode($locationName);
}
return $uri;
}
}
...@@ -32,4 +32,5 @@ return [ ...@@ -32,4 +32,5 @@ return [
'listening-time' => 'listening time', 'listening-time' => 'listening time',
'time-periods' => 'time periods', 'time-periods' => 'time periods',
'soundbites' => 'soundbites', 'soundbites' => 'soundbites',
'embeddable-player' => 'embeddable player',
]; ];
...@@ -109,4 +109,16 @@ return [ ...@@ -109,4 +109,16 @@ return [
'Click while playing to get current position, click again to get duration.', 'Click while playing to get current position, click again to get duration.',
'submit_edit' => 'Save all soundbites', 'submit_edit' => 'Save all soundbites',
], ],
'embeddable_player' => [
'add' => 'Add embeddable player',
'title' => 'Embeddable player',
'label' =>
'Pick a theme color, copy the embeddable player to clipboard, then paste it on your website.',
'clipboard_iframe' => 'Copy embeddable player to clipboard',
'clipboard_url' => 'Copy address to clipboard',
'dark' => 'Dark',
'dark-transparent' => 'Dark transparent',
'light' => 'Light',
'light-transparent' => 'Light transparent',
],
]; ];
...@@ -11,6 +11,7 @@ return [ ...@@ -11,6 +11,7 @@ return [
'home_url' => 'Go to {platformName} website', 'home_url' => 'Go to {platformName} website',
'submit_url' => 'Submit your podcast on {platformName}', 'submit_url' => 'Submit your podcast on {platformName}',
'visible' => 'Display in podcast homepage?', 'visible' => 'Display in podcast homepage?',
'on_embeddable_player' => 'Display on embeddable player?',
'remove' => 'Remove {platformName}', 'remove' => 'Remove {platformName}',
'submit' => 'Save', 'submit' => 'Save',
'messages' => [ 'messages' => [
......
...@@ -32,4 +32,5 @@ return [ ...@@ -32,4 +32,5 @@ return [
'listening-time' => 'drée d’écoute', 'listening-time' => 'drée d’écoute',
'time-periods' => 'périodes', 'time-periods' => 'périodes',
'soundbites' => 'extraits sonores', 'soundbites' => 'extraits sonores',
'embeddable-player' => 'lecteur intégré',
]; ];