mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-12 05:18:06 +02:00
- add podcast sidebar navigation - add podcast dashboard with latest episodes - add pagination to podcast episodes - add components helper to reuse ui components (button, data_table, etc.) - enhance podcast and episode forms by splitting them into form sections - add hint tooltips to podcast and episode forms - transform radio inputs as buttons for better ux - replace explicit field by parental_advisory - replace author field by publisher - add podcasts_categories table to set multiple categories - use choices.js to enhance multiselect fields - update Language files - update js dependencies to latest versions closes #31, #9
76 lines
1.8 KiB
PHP
76 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @copyright 2020 Podlibre
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
/**
|
|
* Returns the inline svg icon
|
|
*
|
|
* @param string $name name of the icon file without the .svg extension
|
|
* @param string $class to be added to the svg string
|
|
* @return string svg contents
|
|
*/
|
|
function icon(string $name, string $class = '')
|
|
{
|
|
$svg_contents = file_get_contents('assets/icons/' . $name . '.svg');
|
|
if ($class !== '') {
|
|
$svg_contents = str_replace(
|
|
'<svg',
|
|
'<svg class="' . $class . '"',
|
|
$svg_contents
|
|
);
|
|
}
|
|
|
|
return $svg_contents;
|
|
}
|
|
|
|
/**
|
|
* Returns the inline svg image
|
|
*
|
|
* @param string $name name of the image file without the .svg extension
|
|
* @param string $class to be added to the svg string
|
|
* @return string svg contents
|
|
*/
|
|
function svg($name, $class = null)
|
|
{
|
|
$svg_contents = file_get_contents('assets/images/' . $name . '.svg');
|
|
if ($class) {
|
|
$svg_contents = str_replace(
|
|
'<svg',
|
|
'<svg class="' . $class . '"',
|
|
$svg_contents
|
|
);
|
|
}
|
|
return $svg_contents;
|
|
}
|
|
|
|
/**
|
|
* Returns the inline svg platform icon. Returns the default icon if not found.
|
|
*
|
|
* @param string $name name of the image file without the .svg extension
|
|
* @param string $class to be added to the svg string
|
|
* @return string svg contents
|
|
*/
|
|
function platform_icon($name, $class = null)
|
|
{
|
|
try {
|
|
$svg_contents = file_get_contents('assets/images/platforms/' . $name);
|
|
} catch (\Exception $e) {
|
|
$svg_contents = file_get_contents(
|
|
'assets/images/platforms/_default.svg'
|
|
);
|
|
}
|
|
|
|
if ($class) {
|
|
$svg_contents = str_replace(
|
|
'<svg',
|
|
'<svg class="' . $class . '"',
|
|
$svg_contents
|
|
);
|
|
}
|
|
return $svg_contents;
|
|
}
|