| Current Path : /proc/thread-self/root/proc/thread-self/root/proc/1908984/root/proc/1147586/cwd/ |
| Current File : //proc/thread-self/root/proc/thread-self/root/proc/1908984/root/proc/1147586/cwd/mediajce.php.tar |
home/digilove/public_html/110/plugins/fields/mediajce/mediajce.php 0000644 00000001120 15237725334 0021050 0 ustar 00 <?php
/**
* @package JCE.Plugin
* @subpackage Fields.Media_Jce
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2020 Ryan Demmer. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);
JForm::addFieldPath(JPATH_PLUGINS . '/system/jce/fields');
/**
* Fields MediaJce Plugin
*
* @since 2.6.27
*/
class PlgFieldsMediaJce extends FieldsPlugin
{
} home/digilove/public_html/110/plugins/fields/mediajce/tmpl/mediajce.php 0000644 00000004262 15243040711 0022020 0 ustar 00 <?php
/**
* @package Joomla.Plugin
* @subpackage Fields.MediaJce
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2020 Ryan Demmer. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.filesystem.path');
if ($field->value == '') {
return;
}
$data = json_decode($field->value);
if (!$data) {
$data = (object) array('src' => $field->value, 'alt' => '');
}
$class = (string) $fieldParams->get('media_class', '');
$target = (string) $fieldParams->get('media_target', '');
$type = (string) $fieldParams->get('mediatype', 'images');
$text = (string) $fieldParams->get('media_description', '');
$attribs = array();
if ($class) {
$attribs[] = 'class="' . htmlentities($class, ENT_COMPAT, 'UTF-8', true) . '"';
}
if ($text) {
$text = htmlentities($text, ENT_COMPAT, 'UTF-8', true);
}
$value = (array) $data->src;
$buffer = '';
$element = '<img src="%s"%s alt="%s" />';
if ($type !== "images") {
$element = '<a href="%s"%s>%s</a>';
} else {
$text = $data->alt;
}
foreach ($value as $path) {
if (!$path) {
continue;
}
// remove some common characters
$path = preg_replace('#[\+\\\?\#%&<>"\'=\[\]\{\},;@\^\(\)£€$]#', '', $path);
// trim
$path = trim($path);
// check for valid path after clean
if (!$path) {
continue;
}
// clean path
$path = JPath::clean($path);
// create full path
$fullpath = JPATH_SITE . '/' . trim($path, '/');
// check path is valid
if (!is_file($fullpath)) {
continue;
}
// set text as basename if not an image
if (!$text && $type !== "images") {
$text = basename($path);
if ($target) {
if ($target == 'download') {
$target = ' download="' . $path . '"';
} else {
$target = ' target="' . $target . '"';
}
$attribs[] = $target;
}
}
$buffer .= sprintf($element,
htmlentities($path, ENT_COMPAT, 'UTF-8', true),
implode(' ', $attribs),
$text
);
}
echo $buffer;