first commit
This commit is contained in:
26
modules/mod_syndicate/mod_syndicate.php
Normal file
26
modules/mod_syndicate/mod_syndicate.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?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\Helper\ModuleHelper;
|
||||
use Joomla\Module\Syndicate\Site\Helper\SyndicateHelper;
|
||||
|
||||
$params->def('format', 'rss');
|
||||
|
||||
$link = SyndicateHelper::getLink($params, $app->getDocument());
|
||||
|
||||
if ($link === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$text = htmlspecialchars($params->get('text', ''), ENT_COMPAT, 'UTF-8');
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_syndicate', $params->get('layout', 'default'));
|
||||
75
modules/mod_syndicate/mod_syndicate.xml
Normal file
75
modules/mod_syndicate/mod_syndicate.xml
Normal 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>
|
||||
<filename module="mod_syndicate">mod_syndicate.php</filename>
|
||||
<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>
|
||||
50
modules/mod_syndicate/src/Helper/SyndicateHelper.php
Normal file
50
modules/mod_syndicate/src/Helper/SyndicateHelper.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?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 1.5
|
||||
*/
|
||||
public static function getLink(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;
|
||||
}
|
||||
}
|
||||
25
modules/mod_syndicate/tmpl/default.php
Normal file
25
modules/mod_syndicate/tmpl/default.php
Normal 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);
|
||||
Reference in New Issue
Block a user