This commit is contained in:
AlexBa16
2026-06-08 15:29:52 +02:00
commit 27903eed4a
9931 changed files with 1535659 additions and 0 deletions
@@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.Media
*
* @copyright (C) 2026 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Layout\LayoutHelper;
if (empty($field->value) || empty($field->value['file'])) {
return;
}
$displayData = [
'src' => $field->value['file'],
];
if ($class = (string) $fieldParams->get('css_class', '')) {
$displayData['class'] = $class;
}
if ($fieldParams->get('controls', 1) === 1) {
$displayData['controls'] = 'controls';
}
if ($fieldParams->get('autoplay', 0) === 1) {
$displayData['autoplay'] = 'autoplay';
}
if ($fieldParams->get('loop', 0) === 1) {
$displayData['loop'] = 'loop';
}
if ($fieldParams->get('muted', 0) === 1) {
$displayData['muted'] = 'muted';
}
$displayData['preload'] = $fieldParams->get('preload', 'auto');
echo LayoutHelper::render('joomla.html.audio', $displayData);
@@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.Media
*
* @copyright (C) 2026 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Helper\MediaHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\Uri\Uri;
if (empty($file = $field->value) || empty($field->value['file'])) {
return;
}
$fileUrl = MediaHelper::getCleanMediaFieldValue($field->value['file']);
// detect local file path
$isLocalFile = false;
if (empty((new Uri($fileUrl))->getHost())) {
$fileUrl = JPATH_SITE . DIRECTORY_SEPARATOR . $fileUrl;
$isLocalFile = true;
}
if ($isLocalFile && !\is_file($fileUrl)) {
return;
}
$class = $fieldParams->get('css_class');
$options = [];
if ($class) {
$options['class'] = $class;
}
$linkText = $field->value['linktext'] ?? Text::_('JLIB_FORM_FIELD_PARAM_ACCESSIBLEMEDIA_PARAMS_LINKTEXT_DEFAULT_VALUE');
$fileUrl = $isLocalFile ? $field->value['file'] : $fileUrl;
if (str_contains($linkText, '{filename}')) {
$linkText = str_replace('{filename}', basename($fileUrl), $linkText);
}
echo HTMLHelper::link($fileUrl, $linkText, $options);
@@ -0,0 +1,29 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.Media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Layout\LayoutHelper;
if (empty($field->value) || empty($field->value['imagefile'])) {
return;
}
$class = $fieldParams->get('image_class');
$options = [
'src' => $field->value['imagefile'],
'alt' => empty($field->value['alt_text']) && empty($field->value['alt_empty']) ? false : $field->value['alt_text'],
];
if ($class) {
$options['class'] = $class;
}
echo LayoutHelper::render('joomla.html.image', $options);
@@ -0,0 +1,55 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Fields.Media
*
* @copyright (C) 2026 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
\defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Layout\LayoutHelper;
if (empty($field->value) || empty($field->value['file'])) {
return;
}
$displayData = [
'src' => $field->value['file'],
];
if (!empty($class = (string) $fieldParams->get('css_class', ''))) {
$displayData['class'] = $class;
}
if ((int) $fieldParams->get('video_poster', 1) && !empty($poster = $field->value['poster'])) {
$displayData['poster'] = (HTMLHelper::cleanImageURL($poster))->url;
}
if ($fieldParams->get('controls', 1)) {
$displayData['controls'] = 'controls';
}
if ($fieldParams->get('autoplay', 0)) {
$displayData['autoplay'] = 'autoplay';
}
if ($fieldParams->get('loop', 0)) {
$displayData['loop'] = 'loop';
}
if ($fieldParams->get('muted', 0)) {
$displayData['muted'] = 'muted';
}
if ($fieldParams->get('video_playsinline', 1)) {
$displayData['playsinline'] = 'playsinline';
}
$displayData['preload'] = $fieldParams->get('preload', 'auto');
echo LayoutHelper::render('joomla.html.video', $displayData);