Your IP : 216.73.217.68


Current Path : /home/w/u/e/wuectly/www/03cbe/
Upload File :
Current File : /home/w/u/e/wuectly/www/03cbe/mediajce.tar

mediajce.xml000060400000004455152455613470007047 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.8" group="fields" method="upgrade">
	<name>plg_fields_mediajce</name>
	 <version>2.9.99.2</version>
  	<creationDate>22-04-2026</creationDate>
  	<author>Ryan Demmer</author>
  	<authorEmail>info@joomlacontenteditor.net</authorEmail>
  	<authorUrl>https://www.joomlacontenteditor.net</authorUrl>
  	<copyright>Copyright (C) 2006 - 2026 Ryan Demmer. All rights reserved</copyright>
  	<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
	<description>PLG_FIELDS_MEDIAJCE_XML_DESCRIPTION</description>

	<namespace path="src">Joomla\Plugin\Fields\MediaJce</namespace>

	<files folder="plugins/fields/mediajce">
		<filename plugin="mediajce">mediajce.php</filename>
		<folder>fields</folder>
		<folder>helper</folder>
		<folder>layouts</folder>
		<folder>params</folder>
		<folder>services</folder>
		<folder>src</folder>
		<folder>tmpl</folder>
	</files>

	<languages folder="administrator/language/en-GB">
		<language tag="en-GB">en-GB.plg_fields_mediajce.ini</language>
		<language tag="en-GB">en-GB.plg_fields_mediajce.sys.ini</language>
	</languages>

	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="legacymedia"
					type="list"
					label="PLG_FIELDS_MEDIAJCE_PARAMS_LEGACYMEDIA_LABEL"
					description="PLG_FIELDS_MEDIAJCE_PARAMS_LEGACYMEDIA_DESC"
					default="0"
				>
				<option value="1">JYES</option>
				<option value="0">JNO</option>
				</field>
				<field
					name="mediatype"
					type="combo"
					label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIATYPE_LABEL"
					description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIATYPE_DESC"
					layout="joomla.form.field.list-fancy-select"
				>
				<option value="images">images</option>
				<option value="media">media</option>
				<option value="documents">documents</option>
				<option value="files">files</option>
				</field>
				<field
					name="media_class"
					type="text"
					label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_CLASS_LABEL"
					description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_CLASS_DESC"
				/>
				<field
					name="media_description"
					type="text"
					label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_DESCRIPTION_LABEL"
					description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_DESCRIPTION_DESC"
				/>
			</fieldset>
		</fields>
	</config>
</extension>
mediajce.php000060400000001752152455613470007033 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Fields.MediaJce
 *
 * @copyright   Copyright (C) 2005 - 2023 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (C) 2020 - 2023 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::registerNamespace('Joomla\\Plugin\\Fields\\MediaJce', JPATH_PLUGINS . '/fields/mediajce/src', false, false, 'psr4');

use Joomla\Component\Fields\Administrator\Plugin\FieldsPlugin;
use Joomla\Plugin\Fields\MediaJce\PluginTraits\FormTrait;

if (!class_exists('\\Joomla\\Component\\Fields\\Administrator\\Plugin\\FieldsPlugin', false)) {
    JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);
    class_alias('FieldsPlugin', '\\Joomla\\Component\\Fields\\Administrator\\Plugin\\FieldsPlugin');
}

/**
 * Fields MediaJce Plugin
 *
 * @since  2.6.27
 */
class PlgFieldsMediaJce extends FieldsPlugin
{
    use FormTrait;
}params/mediajce.xml000060400000001307152455613470010323 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field name="mediatype" type="combo" label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIATYPE_LABEL" description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIATYPE_DESC">
				<option value="images">images</option>
				<option value="files">files</option>
			</field>
			<field name="media_class" type="text" label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_CLASS_LABEL" description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_CLASS_DESC" />
			<field name="media_description" type="text" label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_DESCRIPTION_LABEL" description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_DESCRIPTION_DESC" />
		</fieldset>
	</fields>
</form>fields/mediajce.xml000060400000000523152455613470010305 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fieldset name="media">
		<field name="media_src" type="mediajce" label="PLG_FIELDS_MEDIAJCE_MEDIA_FILE_LABEL" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" />
		<field name="media_text" type="text" label="PLG_FIELDS_MEDIAJCE_MEDIA_TEXT_LABEL" />
	</fieldset>
</form>fields/mediajce.php000060400000011054152455613470010275 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Fields.MediaJce
 *
 * @copyright   Copyright (C) 2005 - 2023 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (C) 2020 - 2024 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Form\Field\MediaField;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Helper\MediaHelper;

/**
 * Provides a modal media selector field for the JCE File Browser
 *
 * @since  2.6.17
 */
class JFormFieldMediaJce extends MediaField
{
    /**
     * The form field type.
     *
     * @var    string
     */
    protected $type = 'MediaJce';

    /**
     * Layout to render
     *
     * @var    string
     * @since  3.5
     */
    protected $layout = 'joomla.form.field.media';

    /**
     * The mediatype for the form field.
     *
     * @var    string
     * @since  2.9.37
     */
    protected $mediatype = 'images';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
     * @param   mixed             $value    The form field value to validate.
     * @param   string            $group    The field name group control value. This acts as an array container for the field.
     *                                      For example if the field has name="foo" and the group value is set to "bar" then the
     *                                      full field name would end up being "bar[foo]".
     *
     * @return  boolean  True on success.
     *
     * @see     JFormField::setup()
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        // decode value if it is a string
        if (is_string($value)) {
            $json = json_decode($value, true);

            if ($json) {
                $value = isset($json['media_src']) ? $json['media_src'] : $value;
            }
        } else {
            $value = (array) $value;
            $value = isset($value['media_src']) ? $value['media_src'] : '';
        }

        $result = parent::setup($element, $value, $group);

        if ($result === true) {
            $this->mediatype = isset($this->element['mediatype']) ? (string) $this->element['mediatype'] : 'images';

            if (isset($this->types) && (bool) $this->element['converted'] === false) {
                if (is_string($this->value)) {
                    $this->value = MediaHelper::getCleanMediaFieldValue($this->value);
                }
            }
        }

        return $result;
    }

    /**
     * Get the data that is going to be passed to the layout
     *
     * @return  array
     */
    public function getLayoutData()
    {
        // Get the basic field data
        $data = parent::getLayoutData();

        // component must be installed and enabled
        if (!ComponentHelper::isEnabled('com_jce')) {
            return $data;
        }
        
        // plugin must be enabled
        if (!PluginHelper::isEnabled('system', 'jce')) {
            return $data;
        }

        $data['class'] .= ' input-medium wf-media-input';

        // not enabled for media field
        if (!WfBrowserHelper::isMediaFieldEnabled()) {
            $data['readonly'] = true;
            $data['link'] = '';
            return $data;
        }

        $converted = (bool) $this->element['converted'];

        $config = array(
            'element' => $this->id,
            'mediatype' => strtolower($this->mediatype),
            'converted' => $converted,
            'mediafolder' => isset($this->element['media_folder']) ? (string) $this->element['media_folder'] : '',
        );

        // get individual field link
        $this->link = WfBrowserHelper::getMediaFieldUrl($config);

        $extraData = array(
            'link'  => $this->link,
            'class' => $data['class'] .= ' wf-media-input-active',
        );

        if ($converted) {
            $extraData['class'] .= ' wf-media-input-converted';;
        }

        // get global field options
        $options = WfBrowserHelper::getMediaFieldOptions();

        if ($options['upload'] == 1) {
            $extraData['class'] .= ' wf-media-input-upload';
        }

        if ($options['select_button'] == 0) {
            $extraData['class'] .= ' wf-media-input-no-select-button';
        }

        $extraData['class'] .= ' wf-media-input-core';

        return array_merge($data, $extraData);
    }
}
helper/mediahelper.php000060400000006135152455613470011030 0ustar00<?php 

final class WfMediaHelper {
    /**
     * An array of supported embed types and their mime types
     */
    private static $embedMimes = array(
        "doc"=> "application/msword",
        "xls"=> "application/vnd.ms-excel",
        "ppt"=> "application/vnd.ms-powerpoint",
        "dot"=> "application/msword",
        "pps"=> "application/vnd.ms-powerpoint",
        "docx"=> "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
        "dotx"=> "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
        "pptx"=> "application/vnd.openxmlformats-officedocument.presentationml.presentation",
        "xlsx"=> "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
        "xlsm"=> "application/vnd.ms-excel.sheet.macroEnabled.12",
        "ppsx"=> "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
        "sldx"=> "application/vnd.openxmlformats-officedocument.presentationml.slide",
        "potx"=> "application/vnd.openxmlformats-officedocument.presentationml.template",
        "xltx"=> "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
        "odt"=> "application/vnd.oasis.opendocument.text",
        "odg"=> "application/vnd.oasis.opendocument.graphics",
        "odp"=> "application/vnd.oasis.opendocument.presentation",
        "ods"=> "application/vnd.oasis.opendocument.spreadsheet",
        "odf"=> "application/vnd.oasis.opendocument.formula",
        "txt"=> "text/plain",
        "rtf"=> "application/rtf",
        "md"=> "text/markdown",
        "pdf"=> "application/pdf"
    );

    /**
     * An array of supported media layout types and their file extensions
     */
    private static $allowable = array(
        'image'     => 'jpg,jpeg,png,gif',
        'audio'     => 'mp3,m4a,mp4a,ogg',
        'video'     => 'mp4,mp4v,mpeg,mov,webm',
        'object'    => 'doc,docx,odg,odp,ods,odt,pdf,ppt,pptx,txt,xcf,xls,xlsx,csv',
        'iframe'    => '',
    );

    /**
     * Get the embed type from the file extension
     *
     * @param [string] $extension File extension
     * @return Mime type or false
     */
    public static function getMimeType($extension) {
        if (array_key_exists($extension, self::$embedMimes)) {
            return self::$embedMimes[$extension];
        }

        return false;
    }
    /**
     * Get the media layout from the file extension
     *
     * @param [type] $extension File extension
     * @return Layout type
     */
    public static function getLayoutFromExtension($extension) {
        $layout = 'link';
        
        array_walk(self::$allowable, function ($values, $key) use ($extension, &$layout) {
            if (in_array($extension, explode(',', $values))) {
                $layout = $key;
            }
        });

        return $layout;
    }

    /**
     * Determine whether the value is an image
     *
     * @param [string] $value
     * @return boolean
     */
    public static function isImage($value) {
        $extension = pathinfo($value, PATHINFO_EXTENSION);
        return in_array($extension, explode(',', self::$allowable['image']));
    }
}src/Extension/MediaJce.php000060400000001273152455613470011474 0ustar00<?php

/**
 * @package     Jce.Plugin
 * @subpackage  Fields.mediajce
 *
 * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @copyright   (C) 2020 - 2024 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Plugin\Fields\MediaJce\Extension;

use Joomla\Component\Fields\Administrator\Plugin\FieldsPlugin;
use Joomla\Plugin\Fields\MediaJce\PluginTraits\FormTrait;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Fields Media Plugin
 *
 * @since  2.9.73
 */
final class MediaJce extends FieldsPlugin
{   
    use FormTrait;
}src/PluginTraits/FormTrait.php000060400000006466152455613470012424 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Fields.MediaJce
 *
 * @copyright   Copyright (C) 2005 - 2023 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (C) 2020 - 2024 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Plugin\Fields\MediaJce\PluginTraits;

defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Uri\Uri;

/**
 * Fields MediaJce FormTrait
 *
 * @since  2.9.73
 */
trait FormTrait
{
    private $mediaLoaded = false;
    
    /**
     * Transforms the field into a DOM XML element and appends it as a child on the given parent.
     *
     * @param   stdClass    $field   The field.
     * @param   DOMElement  $parent  The field node parent.
     * @param   Form        $form    The form.
     *
     * @return  DOMElement
     *
     * @since   3.7.0
     */
    public function onCustomFieldsPrepareDom($field, \DOMElement $parent, Form $form)
    {
        $fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

        if (!$fieldNode) {
            return $fieldNode;
        }

        if ($field->type !== 'mediajce') {
            return $fieldNode;
        }

        // override "Edit Custom Field Value" permission if set
        $fieldNode->setAttribute('disabled', 'false');

        $fieldParams = clone $this->params;
        $fieldParams->merge($field->fieldparams);

        $field->fieldparams = clone $fieldParams;

        $form->addFieldPath(JPATH_PLUGINS . '/fields/mediajce/fields');

        Factory::getApplication()->triggerEvent('onWfCustomFieldsPrepareDom', array($field, $fieldNode, $form));

        return $fieldNode;
    }

    /**
     * Before prepares the field value.
     *
     * @param   string     $context  The context.
     * @param   \stdclass  $item     The item.
     * @param   \stdclass  $field    The field.
     *
     * @return  void
     *
     * @since   3.7.0
     */
    public function onCustomFieldsBeforePrepareField($context, $item, $field)
    {
        // Check if the field should be processed by us
        if ($field->type !== 'mediajce') {
            return;
        }

        // Check if the field value is an old (string) value
        if (is_string($field->value)) {
            $field->value = $this->checkValue($field->value);
        }

        $fieldParams = clone $this->params;
        $fieldParams->merge($field->fieldparams);

        $field->fieldparams = clone $fieldParams;

        // if extendedmedia is disabled, use restricted media support
        if ((int) $fieldParams->get('extendedmedia', 0) == 0 && is_array($field->value)) {
            $field->value['media_supported'] = array('img', 'a');
        }
    }

    /**
     * Before prepares the field value.
     *
     * @param   string  $value  The value to check.
     *
     * @return  array  The checked value
     *
     * @since   4.0.0
     */
    private function checkValue($value)
    {
        json_decode($value);

        if (json_last_error() === JSON_ERROR_NONE) {
            return (array) json_decode($value, true);
        }

        return array('media_src' => $value, 'media_text' => '');
    }
}
tmpl/mediajce.php000060400000014101152455613470007777 0ustar00<?php

/**
 * @package     JCE
 * @subpackage  Fields.MediaJce
 *
 * @copyright   Copyright (C) 2005 - 2023 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (C) 2020 - 2024 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;

use Joomla\CMS\Layout\LayoutHelper;
use Joomla\Filesystem\File;
use Joomla\Filesystem\Path;

// load helper
require_once JPATH_PLUGINS . '/fields/mediajce/helper/mediahelper.php';

if (empty($field->value)) {
    return;
}

// single value, may be subform
if (is_string($field->value)) {
    $field->value = array(
        'media_src' => $field->value,
        'media_type' => WfMediaHelper::isImage($field->value) ? 'embed' : 'link',
    );
}

// no src value set
if (empty($field->value['media_src'])) {
    return;
}

$data = array(
    'media_src' => '',
    'media_text' => (string) $fieldParams->get('media_description', ''),
    'media_type' => (string) $fieldParams->get('display_type', 'embed'),
    'media_target' => (string) $fieldParams->get('media_target', '_blank'),
    'media_class' => (string) $fieldParams->get('media_class', ''),
    'media_caption' => '',
    'media_supported' => array('img', 'video', 'audio', 'iframe', 'a', 'object'),
);

foreach ($field->value as $key => $value) {
    if (empty($value)) {
        continue;
    }

    $data[$key] = $value;
}

// convert to object
$data = (object) $data;

// convert legacy value
if (isset($data->src)) {
    $data->media_src = $data->src;
}

// add "image" to supported media to allow for "image" and "img"
$data->media_supported[] = 'image';

// clean Joomla 4 media stuff
if ($pos = strpos($data->media_src, '#')) {
    $data->media_src = substr($data->media_src, 0, $pos);
}

// get file extension to determine tag
$extension = pathinfo($data->media_src, PATHINFO_EXTENSION);

// lowercase
$extension = strtolower($extension);

// get layout from extension
$layout = WfMediaHelper::getLayoutFromExtension($extension);

// reset to link if not extended media
if ((int) $fieldParams->get('extendedmedia') == 0 && $layout !== 'image') {
    $layout = 'link';
}

// reset layout as link
if (!in_array($layout, $data->media_supported) || $data->media_type == 'link') {
    $layout = 'link';
}

$attribs = array();

if ($data->media_class) {
    $data->media_class = preg_replace('#[^-\w ]#i', '', $data->media_class);
    $attribs['class'] = trim($data->media_class);
}

$text = '';

if ($data->media_text) {
    $text = $data->media_text; // htmlspecialchars encoded in layout
}

// links
if ($layout == 'link') {
    $attribs['title'] = $text;
}

// images
if ($layout == 'image') {
    if (isset($data->media_width)) {
        $attribs['width'] = $data->media_width;
    }

    if (isset($data->media_height)) {
        $attribs['height'] = $data->media_height;
    }

    // set lazy loading only if dimensions are set
    if (!empty($data->media_width) && !empty($data->media_height)) {
        $attribs['loading'] = 'lazy';
    }

    // set alt text or emty value
    $attribs['alt'] = $text;
}

// audio
if ($layout == 'audio') {
    $attribs['controls'] = 'controls';

    if ($text) {
        $attribs['title'] = $text;
    }
}

// video
if ($layout == 'video') {
    $attribs['controls'] = 'controls';

    $attribs['width'] = isset($data->media_width) ? $data->media_width : '';
    $attribs['height'] = isset($data->media_height) ? $data->media_height : '';

    if ($text) {
        $attribs['title'] = $text;
    }
}

// object
if ($layout == 'object') {
    $attribs['width'] = isset($data->media_width) ? $data->media_width : '100%';
    $attribs['height'] = isset($data->media_height) ? $data->media_height : '100%';

    if ($text) {
        $attribs['title'] = $text;
    }

    $attribs['data'] = $data->media_src;

    $mimetype = WfMediaHelper::getMimeType($extension);

    if ($mimetype) {
        $attribs['type'] = $mimetype;
    } else {
        $layout = 'iframe';
    }
}

// iframe
if ($layout == 'iframe') {
    $attribs['frameborder'] = 0;
    $attribs['width'] = isset($data->media_width) ? $data->media_width : '100%';
    $attribs['height'] = isset($data->media_height) ? $data->media_height : '100%';

    // set lazy loading only if dimensions are set
    if (!empty($data->media_width) && !empty($data->media_height)) {
        $attribs['loading'] = 'lazy';
    }

    if ($text) {
        $attribs['title'] = $text;
    }
}

$buffer = '';

// perform pcre replacement of common invalid characters
$path = preg_replace('#[\+\\\?\#%&<>"\'=\[\]\{\},;@\^\(\)£€$]#u', '', $data->media_src);

// trim
$path = trim($path);

if ($path) {
    // clean slashes
    $path = Path::clean($path);

    // set text as basename if not an image
    if ($layout == 'link') {
        // set default target
        $attribs['target'] = $data->media_target;

        // set target as download
        if ($data->media_target == 'download') {
            $attribs['download'] = pathinfo($path, PATHINFO_FILENAME);
        }
    }

    if (!isset($attribs['class'])) {
        $attribs['class'] = '';
    }

    // add media type class
    $attribs['class'] .= ' mediajce-' . $layout;

    // trim class
    $attribs['class'] = trim($attribs['class']);

    // check for valid path after clean
    if (is_file(JPATH_SITE . '/' . $path)) {
        $attribs['src'] = $path;

        LayoutHelper::$defaultBasePath = JPATH_PLUGINS . '/fields/mediajce/layouts';

        $buffer = LayoutHelper::render('plugins.fields.mediajce.' . $layout, $attribs);

        // render with figure and figcaption
        if ($data->media_type == 'embed' && $data->media_caption) {

            $figure = array();
            $caption_class = (string) $fieldParams->get('media_caption_class', '');

            if ($caption_class) {
                $caption_class = preg_replace('#[^ \w-]#i', '', $caption_class);
                $figure['class'] = $caption_class;
            }

            $figure['caption'] = $data->media_caption;
            $figure['html'] = $buffer;

            $buffer = LayoutHelper::render('plugins.fields.mediajce.figure', $figure);
        }
    }
}

echo $buffer;
layouts/plugins/fields/mediajce/video.php000060400000000375152455613470014570 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<video ' . ArrayHelper::toString($displayData) . '></video>';layouts/plugins/fields/mediajce/iframe.php000060400000000377152455613470014727 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<iframe ' . ArrayHelper::toString($displayData) . '></iframe>';layouts/plugins/fields/mediajce/figure.php000060400000000750152455613470014740 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

$caption    = $displayData['caption'];
$html       = $displayData['html']; 

unset($displayData['caption']);
unset($displayData['html']);

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<figure' . ArrayHelper::toString($displayData) . '>' . $html . '<figcaption>' . htmlentities($caption, ENT_COMPAT, 'UTF-8', true) . '</figcaption></figure>';layouts/plugins/fields/mediajce/image.php000060400000000507152455613470014541 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');

    if ($key !== 'alt' && $value == '') {
        unset($displayData[$key]);
    }
});

echo '<img ' . ArrayHelper::toString($displayData) . '>';layouts/plugins/fields/mediajce/object.php000060400000000435152455613470014725 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

unset ($displayData['src']);

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<object ' . ArrayHelper::toString($displayData) . '></object>';layouts/plugins/fields/mediajce/link.php000060400000000753152455613470014417 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

$displayData['href'] = $displayData['src'];

unset($displayData['src']);

$attribs = array();

foreach ($displayData as $key => $value) {
    if ($value !== '') {
        $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
        $attribs[$key] = $value;
    }
};

$text = isset($attribs['title']) ? $attribs['title'] : basename($attribs['href']);

echo '<a ' . ArrayHelper::toString($attribs) . '>' . $text . '</a>';layouts/plugins/fields/mediajce/audio.php000060400000000375152455613470014563 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<audio ' . ArrayHelper::toString($displayData) . '></audio>';services/provider.php000060400000002554152455613470010750 0ustar00<?php

/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.mediajce
 *
 * @copyright   (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
 * @copyright   (C) 2020 - 2024 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Fields\MediaJce\Extension\MediaJce;

return new class () implements ServiceProviderInterface {
    /**
     * Registers the service provider with a DI container.
     *
     * @param   Container  $container  The DI container.
     *
     * @return  void
     *
     * @since   4.3.0
     */
    public function register(Container $container)
    {
        $container->set(
            PluginInterface::class,
            function (Container $container) {
                $dispatcher = $container->get(DispatcherInterface::class);
                $plugin     = new MediaJce(
                    $dispatcher,
                    (array) PluginHelper::getPlugin('fields', 'mediajce')
                );

                $plugin->setApplication(Factory::getApplication());

                return $plugin;
            }
        );
    }
};