primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1,54 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_wrapper
*
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Module\Wrapper\Site\Dispatcher;
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Dispatcher class for mod_wrapper
*
* @since 5.1.0
*/
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
{
use HelperFactoryAwareTrait;
/**
* Returns the layout data.
*
* @return array
*
* @since 5.1.0
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
$params = $this->getHelperFactory()->getHelper('WrapperHelper')->getParamsWrapper($data['params'], $this->getApplication());
$data['load'] = $params->get('load');
$data['url'] = htmlspecialchars($params->get('url', ''), ENT_COMPAT, 'UTF-8');
$data['target'] = htmlspecialchars($params->get('target', ''), ENT_COMPAT, 'UTF-8');
$data['width'] = htmlspecialchars($params->get('width', ''), ENT_COMPAT, 'UTF-8');
$data['height'] = htmlspecialchars($params->get('height', ''), ENT_COMPAT, 'UTF-8');
$data['ititle'] = $this->module->title;
$data['id'] = $this->module->id;
$data['lazyloading'] = $params->get('lazyloading', 'lazy');
return $data;
}
}

View File

@ -0,0 +1,92 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_wrapper
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Module\Wrapper\Site\Helper;
use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Factory;
use Joomla\Registry\Registry;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Helper for mod_wrapper
*
* @since 1.5
*/
class WrapperHelper
{
/**
* Gets the parameters for the wrapper
*
* @param Registry $params The module parameters.
* @param SiteApplication $app The current application.
*
* @return mixed $params The modified parameters
*
* @since 5.1.0
*/
public function getParamsWrapper(Registry $params, SiteApplication $app)
{
$params->def('url', '');
$params->def('scrolling', 'auto');
$params->def('height', '200');
$params->def('height_auto', 0);
$params->def('width', '100%');
$params->def('add', 1);
$params->def('name', 'wrapper');
$url = $params->get('url');
if ($params->get('add')) {
// Adds 'http://' if none is set
if (strpos($url, '/') === 0) {
// Relative URL in component. use server http_host.
$url = 'http://' . $app->getInput()->server->get('HTTP_HOST') . $url;
} elseif (strpos($url, 'http') === false && strpos($url, 'https') === false) {
$url = 'http://' . $url;
}
}
$load = '';
// Auto height control
if ($params->def('height_auto')) {
$load = 'onload="iFrameHeight(this)"';
}
$params->set('load', $load);
$params->set('url', $url);
return $params;
}
/**
* Gets the parameters for the wrapper
*
* @param mixed &$params The parameters set in the administrator section
*
* @return mixed &$params The modified parameters
*
* @since 1.5
*
* @deprecated 5.1.0 will be removed in 7.0
* Use the non-static method getParamsWrapper
* Example: Factory::getApplication()->bootModule('mod_wrapper', 'site')
* ->getHelper('WrapperHelper')
* ->getParamsWrapper($params, Factory::getApplication())
*/
public static function getParams(&$params)
{
return (new self())->getParamsWrapper($params, Factory::getApplication());
}
}