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,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="module" client="site" method="upgrade">
<name>mod_syndicate</name>
<author>Joomla! Project</author>
<creationDate>2006-05</creationDate>
<copyright>(C) 2006 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>MOD_SYNDICATE_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Module\Syndicate</namespace>
<files>
<folder module="mod_syndicate">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/mod_syndicate.ini</language>
<language tag="en-GB">language/en-GB/mod_syndicate.sys.ini</language>
</languages>
<help key="Site_Modules:_Syndication_Feeds" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="text"
type="text"
label="MOD_SYNDICATE_FIELD_TEXT_LABEL"
description="MOD_SYNDICATE_FIELD_TEXT_DESC"
/>
<field
name="display_text"
type="radio"
layout="joomla.form.field.radio.switcher"
label="MOD_SYNDICATE_FIELD_DISPLAYTEXT_LABEL"
default="1"
filter="integer"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="format"
type="list"
label="MOD_SYNDICATE_FIELD_FORMAT_LABEL"
default="rss"
validate="options"
>
<option value="rss">MOD_SYNDICATE_FIELD_VALUE_RSS</option>
<option value="atom">MOD_SYNDICATE_FIELD_VALUE_ATOM</option>
</field>
</fieldset>
<fieldset name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
class="form-select"
validate="moduleLayout"
/>
<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
rows="3"
validate="CssIdentifier"
/>
</fieldset>
</fields>
</config>
</extension>

View File

@ -0,0 +1,41 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_syndicate
*
* @copyright (C) 2024 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\Extension\Service\Provider\HelperFactory;
use Joomla\CMS\Extension\Service\Provider\Module;
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
/**
* The syndicate link module service provider.
*
* @since 5.1.0
*/
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 5.1.0
*/
public function register(Container $container)
{
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Syndicate'));
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Syndicate\\Site\\Helper'));
$container->registerServiceProvider(new Module());
}
};

View File

@ -0,0 +1,66 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_syndicate
*
* @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\Syndicate\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_syndicate
*
* @since 5.1.0
*/
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
{
use HelperFactoryAwareTrait;
/**
* Runs the dispatcher.
*
* @return void
*
* @since 5.1.0
*/
public function dispatch()
{
$displayData = $this->getLayoutData();
if ($displayData['link'] === null) {
return;
}
parent::dispatch();
}
/**
* Returns the layout data.
*
* @return array
*
* @since 5.1.0
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
$data['params']->def('format', 'rss');
$data['link'] = $this->getHelperFactory()->getHelper('SyndicateHelper')->getSyndicateLink($data['params'], $this->getApplication()->getDocument());
$data['text'] = htmlspecialchars($data['params']->get('text', ''), ENT_COMPAT, 'UTF-8');
return $data;
}
}

View File

@ -0,0 +1,71 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_syndicate
*
* @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\Syndicate\Site\Helper;
use Joomla\CMS\Document\HtmlDocument;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Helper for mod_syndicate
*
* @since 1.5
*/
class SyndicateHelper
{
/**
* Gets the link
*
* @param Registry $params The module parameters
* @param HtmlDocument $document The document
*
* @return string|null The link as a string, if found
*
* @since 5.1.0
*/
public function getSyndicateLink(Registry $params, HtmlDocument $document)
{
foreach ($document->_links as $link => $value) {
$value = ArrayHelper::toString($value);
if (strpos($value, 'application/' . $params->get('format') . '+xml')) {
return $link;
}
}
return null;
}
/**
* Gets the link
*
* @param Registry $params The module parameters
* @param HtmlDocument $document The document
*
* @return string|null The link as a string, if found
*
* @since 1.5
*
* @deprecated 5.1.0 will be removed in 7.0
* Use the non-static method getSyndicateLink
* Example: Factory::getApplication()->bootModule('mod_syndicate', 'site')
* ->getHelper('SyndicateHelper')
* ->getSyndicateLink($params, Factory::getApplication()->getDocument())
*/
public static function getLink(Registry $params, HtmlDocument $document)
{
return (new self())->getSyndicateLink($params, $document);
}
}

View File

@ -0,0 +1,25 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_syndicate
*
* @copyright (C) 2006 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\Language\Text;
$textClass = ($params->get('display_text', 1) ? '' : 'class="visually-hidden"');
$linkText = '<span class="icon-feed m-1" aria-hidden="true"></span>';
$linkText .= '<span ' . $textClass . '>' . (!empty($text) ? $text : Text::_('MOD_SYNDICATE_DEFAULT_FEED_ENTRIES')) . '</span>';
$attribs = [
'class' => 'mod-syndicate syndicate-module'
];
echo HTMLHelper::_('link', $link, $linkText, $attribs);