first commit

This commit is contained in:
2025-06-17 11:53:18 +02:00
commit 9f0f7ba12b
8804 changed files with 1369176 additions and 0 deletions

View File

@ -0,0 +1,274 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="module" client="site" method="upgrade">
<name>mod_articles_news</name>
<author>Joomla! Project</author>
<creationDate>2006-07</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_ARTICLES_NEWS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Module\ArticlesNews</namespace>
<files>
<folder module="mod_articles_news">services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/mod_articles_news.ini</language>
<language tag="en-GB">language/en-GB/mod_articles_news.sys.ini</language>
</languages>
<help key="Site_Modules:_Articles_-_Newsflash"/>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="catid"
type="category"
label="JCATEGORY"
extension="com_content"
multiple="true"
filter="intarray"
class="multipleCategories"
layout="joomla.form.field.list-fancy-select"
/>
<field
name="tag"
type="tag"
label="JTAG"
mode="nested"
multiple="true"
filter="intarray"
class="multipleTags"
custom="deny"
/>
<field
name="image"
type="radio"
layout="joomla.form.field.radio.switcher"
label="MOD_ARTICLES_NEWS_FIELD_IMAGES_LABEL"
description="MOD_ARTICLES_NEWS_FIELD_IMAGES_DESC"
default="0"
filter="integer"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="img_intro_full"
type="list"
label="MOD_ARTICLES_NEWS_FIELD_IMAGES_ARTICLE_LABEL"
default="none"
validate="options"
>
<option value="intro">MOD_ARTICLES_NEWS_OPTION_INTROIMAGE</option>
<option value="full">MOD_ARTICLES_NEWS_OPTION_FULLIMAGE</option>
<option value="none">JNO</option>
</field>
<field
name="item_title"
type="radio"
layout="joomla.form.field.radio.switcher"
label="MOD_ARTICLES_NEWS_FIELD_TITLE_LABEL"
default="0"
filter="integer"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="link_titles"
type="list"
label="MOD_ARTICLES_NEWS_FIELD_LINKTITLE_LABEL"
default=""
filter="integer"
class="form-select-color"
showon="item_title:1"
validate="options"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="item_heading"
type="list"
label="MOD_ARTICLES_NEWS_TITLE_HEADING"
default="h4"
showon="item_title:1"
validate="options"
>
<option value="h1">JH1</option>
<option value="h2">JH2</option>
<option value="h3">JH3</option>
<option value="h4">JH4</option>
<option value="h5">JH5</option>
</field>
<field
name="triggerevents"
type="radio"
label="MOD_ARTICLES_NEWS_FIELD_TRIGGEREVENTS_LABEL"
layout="joomla.form.field.radio.switcher"
default="1"
filter="integer"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="showLastSeparator"
type="radio"
layout="joomla.form.field.radio.switcher"
label="MOD_ARTICLES_NEWS_FIELD_SEPARATOR_LABEL"
default="1"
filter="integer"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_introtext"
type="radio"
layout="joomla.form.field.radio.switcher"
label="MOD_ARTICLES_NEWS_FIELD_SHOWINTROTEXT_LABEL"
default="1"
filter="integer"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="readmore"
type="radio"
layout="joomla.form.field.radio.switcher"
label="MOD_ARTICLES_NEWS_FIELD_READMORE_LABEL"
default="0"
filter="integer"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="count"
type="number"
label="MOD_ARTICLES_NEWS_FIELD_ITEMS_LABEL"
default="5"
filter="integer"
min="1"
validate="number"
/>
<field
name="show_featured"
type="list"
label="MOD_ARTICLES_NEWS_FIELD_FEATURED_LABEL"
default=""
filter="integer"
validate="options"
>
<option value="">JSHOW</option>
<option value="0">JHIDE</option>
<option value="1">MOD_ARTICLES_NEWS_VALUE_ONLY_SHOW_FEATURED</option>
</field>
<field
name="exclude_current"
type="radio"
label="MOD_ARTICLES_NEWS_FIELD_EXCLUDE_CURRENT_LABEL"
layout="joomla.form.field.radio.switcher"
default="1"
filter="integer"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="ordering"
type="list"
label="MOD_ARTICLES_NEWS_FIELD_ORDERING_LABEL"
default="a.publish_up"
validate="options"
>
<option value="a.publish_up">MOD_ARTICLES_NEWS_FIELD_ORDERING_PUBLISHED_DATE</option>
<option value="a.created">MOD_ARTICLES_NEWS_FIELD_ORDERING_CREATED_DATE</option>
<option value="a.modified">MOD_ARTICLES_NEWS_FIELD_ORDERING_MODIFIED_DATE</option>
<option value="a.ordering">MOD_ARTICLES_NEWS_FIELD_ORDERING_ORDERING</option>
<option value="a.hits">JGLOBAL_HITS</option>
<option value="rand()">MOD_ARTICLES_NEWS_FIELD_ORDERING_RANDOM</option>
</field>
<field
name="direction"
type="list"
label="JGLOBAL_ORDER_DIRECTION_LABEL"
default="1"
filter="integer"
showon="ordering:a.publish_up,a.created,a.modified,a.ordering,a.hits"
validate="options"
>
<option value="0">JGLOBAL_ORDER_ASCENDING</option>
<option value="1">JGLOBAL_ORDER_DESCENDING</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"
/>
<field
name="cache"
type="list"
label="COM_MODULES_FIELD_CACHING_LABEL"
default="1"
filter="integer"
validate="options"
>
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="number"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
default="900"
filter="integer"
/>
<field
name="cachemode"
type="hidden"
default="itemid"
>
<option value="itemid"></option>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

@ -0,0 +1,41 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_news
*
* @copyright (C) 2022 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 article news module service provider.
*
* @since 4.2.0
*/
return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since 4.2.0
*/
public function register(Container $container)
{
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\ArticlesNews'));
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\ArticlesNews\\Site\\Helper'));
$container->registerServiceProvider(new Module());
}
};

View File

@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_news
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Module\ArticlesNews\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_articles_news
*
* @since 4.2.0
*/
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
{
use HelperFactoryAwareTrait;
/**
* Returns the layout data.
*
* @return array
*
* @since 4.2.0
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
$data['list'] = $this->getHelperFactory()->getHelper('ArticlesNewsHelper')->getArticles($data['params'], $this->getApplication());
return $data;
}
}

View File

@ -0,0 +1,209 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_news
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Module\ArticlesNews\Site\Helper;
use Joomla\CMS\Access\Access;
use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Component\Content\Site\Helper\RouteHelper;
use Joomla\Database\DatabaseAwareInterface;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Registry\Registry;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Helper for mod_articles_news
*
* @since 1.6
*/
class ArticlesNewsHelper implements DatabaseAwareInterface
{
use DatabaseAwareTrait;
/**
* Get a list of the latest articles from the article model.
*
* @param Registry $params Object holding the models parameters
* @param SiteApplication $app The app
*
* @return mixed
*
* @since 4.2.0
*/
public function getArticles(Registry $params, SiteApplication $app)
{
/** @var \Joomla\Component\Content\Site\Model\ArticlesModel $model */
$model = $app->bootComponent('com_content')->getMVCFactory()->createModel('Articles', 'Site', ['ignore_request' => true]);
// Set application parameters in model
$appParams = $app->getParams();
$model->setState('params', $appParams);
$model->setState('list.start', 0);
$model->setState('filter.published', 1);
// Set the filters based on the module params
$model->setState('list.limit', (int) $params->get('count', 5));
// This module does not use tags data
$model->setState('load_tags', false);
// Access filter
$access = !ComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = Access::getAuthorisedViewLevels($app->getIdentity() ? $app->getIdentity()->id : 0);
$model->setState('filter.access', $access);
// Category filter
$model->setState('filter.category_id', $params->get('catid', []));
// Filter by language
$model->setState('filter.language', $app->getLanguageFilter());
// Filter by tag
$model->setState('filter.tag', $params->get('tag', []));
// Featured switch
$featured = $params->get('show_featured', '');
if ($featured === '') {
$model->setState('filter.featured', 'show');
} elseif ($featured) {
$model->setState('filter.featured', 'only');
} else {
$model->setState('filter.featured', 'hide');
}
$input = $app->getInput();
// Filter by id in case it should be excluded
if (
$params->get('exclude_current', true)
&& $input->get('option') === 'com_content'
&& $input->get('view') === 'article'
) {
// Exclude the current article from displaying in this module
$model->setState('filter.article_id', $input->get('id', 0, 'UINT'));
$model->setState('filter.article_id.include', false);
}
// Set ordering
$ordering = $params->get('ordering', 'a.publish_up');
$model->setState('list.ordering', $ordering);
if (trim($ordering) === 'rand()') {
$model->setState('list.ordering', $this->getDatabase()->getQuery(true)->rand());
} else {
$direction = $params->get('direction', 1) ? 'DESC' : 'ASC';
$model->setState('list.direction', $direction);
$model->setState('list.ordering', $ordering);
}
// Check if we should trigger additional plugin events
$triggerEvents = $params->get('triggerevents', 1);
// Retrieve Content
$items = $model->getItems();
foreach ($items as &$item) {
$item->readmore = \strlen(trim($item->fulltext));
$item->slug = $item->id . ':' . $item->alias;
if ($access || \in_array($item->access, $authorised)) {
// We know that user has the privilege to view the article
$item->link = Route::_(RouteHelper::getArticleRoute($item->slug, $item->catid, $item->language));
$item->linkText = Text::_('MOD_ARTICLES_NEWS_READMORE');
} else {
$item->link = new Uri(Route::_('index.php?option=com_users&view=login', false));
$item->link->setVar('return', base64_encode(RouteHelper::getArticleRoute($item->slug, $item->catid, $item->language)));
$item->linkText = Text::_('MOD_ARTICLES_NEWS_READMORE_REGISTER');
}
$item->introtext = HTMLHelper::_('content.prepare', $item->introtext, '', 'mod_articles_news.content');
// Remove any images belongs to the text
if (!$params->get('image')) {
$item->introtext = preg_replace('/<img[^>]*>/', '', $item->introtext);
}
// Show the Intro/Full image field of the article
if ($params->get('img_intro_full') !== 'none') {
$images = json_decode($item->images);
$item->imageSrc = '';
$item->imageAlt = '';
$item->imageCaption = '';
if ($params->get('img_intro_full') === 'intro' && !empty($images->image_intro)) {
$item->imageSrc = htmlspecialchars($images->image_intro, ENT_COMPAT, 'UTF-8');
$item->imageAlt = htmlspecialchars($images->image_intro_alt, ENT_COMPAT, 'UTF-8');
if ($images->image_intro_caption) {
$item->imageCaption = htmlspecialchars($images->image_intro_caption, ENT_COMPAT, 'UTF-8');
}
} elseif ($params->get('img_intro_full') === 'full' && !empty($images->image_fulltext)) {
$item->imageSrc = htmlspecialchars($images->image_fulltext, ENT_COMPAT, 'UTF-8');
$item->imageAlt = htmlspecialchars($images->image_fulltext_alt, ENT_COMPAT, 'UTF-8');
if ($images->image_intro_caption) {
$item->imageCaption = htmlspecialchars($images->image_fulltext_caption, ENT_COMPAT, 'UTF-8');
}
}
}
if ($triggerEvents) {
$item->text = '';
$app->triggerEvent('onContentPrepare', ['com_content.article', &$item, &$params, 0]);
$results = $app->triggerEvent('onContentAfterTitle', ['com_content.article', &$item, &$params, 0]);
$item->afterDisplayTitle = trim(implode("\n", $results));
$results = $app->triggerEvent('onContentBeforeDisplay', ['com_content.article', &$item, &$params, 0]);
$item->beforeDisplayContent = trim(implode("\n", $results));
$results = $app->triggerEvent('onContentAfterDisplay', ['com_content.article', &$item, &$params, 0]);
$item->afterDisplayContent = trim(implode("\n", $results));
} else {
$item->afterDisplayTitle = '';
$item->beforeDisplayContent = '';
$item->afterDisplayContent = '';
}
}
return $items;
}
/**
* Get a list of the latest articles from the article model
*
* @param \Joomla\Registry\Registry &$params object holding the models parameters
*
* @return mixed
*
* @since 1.6
*
* @deprecated 4.3 will be removed in 6.0
* Use the non-static method getArticles
* Example: Factory::getApplication()->bootModule('mod_articles_news', 'site')
* ->getHelper('ArticlesNewsHelper')
* ->getArticles($params, Factory::getApplication())
*/
public static function getList(&$params)
{
return (new self())->getArticles($params, Factory::getApplication());
}
}

View File

@ -0,0 +1,59 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_news
*
* @copyright (C) 2010 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\Layout\LayoutHelper;
?>
<?php if ($params->get('item_title')) : ?>
<?php $item_heading = $params->get('item_heading', 'h4'); ?>
<<?php echo $item_heading; ?> class="newsflash-title">
<?php if ($item->link !== '' && $params->get('link_titles')) : ?>
<a href="<?php echo $item->link; ?>">
<?php echo $item->title; ?>
</a>
<?php else : ?>
<?php echo $item->title; ?>
<?php endif; ?>
</<?php echo $item_heading; ?>>
<?php endif; ?>
<?php if ($params->get('img_intro_full') !== 'none' && !empty($item->imageSrc)) : ?>
<figure class="newsflash-image">
<?php echo LayoutHelper::render(
'joomla.html.image',
[
'src' => $item->imageSrc,
'alt' => $item->imageAlt,
]
); ?>
<?php if (!empty($item->imageCaption)) : ?>
<figcaption>
<?php echo $item->imageCaption; ?>
</figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
<?php if (!$params->get('intro_only')) : ?>
<?php echo $item->afterDisplayTitle; ?>
<?php endif; ?>
<?php echo $item->beforeDisplayContent; ?>
<?php if ($params->get('show_introtext', 1)) : ?>
<?php echo $item->introtext; ?>
<?php endif; ?>
<?php echo $item->afterDisplayContent; ?>
<?php if (isset($item->link) && $item->readmore != 0 && $params->get('readmore')) : ?>
<?php echo LayoutHelper::render('joomla.content.readmore', ['item' => $item, 'params' => $item->params, 'link' => $item->link]); ?>
<?php endif; ?>

View File

@ -0,0 +1,26 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_news
*
* @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;
if (!$list) {
return;
}
?>
<div class="mod-articlesnews newsflash">
<?php foreach ($list as $item) : ?>
<div class="mod-articlesnews__item" itemscope itemtype="https://schema.org/Article">
<?php require ModuleHelper::getLayoutPath('mod_articles_news', '_item'); ?>
</div>
<?php endforeach; ?>
</div>

View File

@ -0,0 +1,30 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_news
*
* @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;
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $app->getDocument()->getWebAssetManager();
$wa->registerAndUseStyle('mod_articles_news_horizontal', 'mod_articles_news/template.css');
if (empty($list)) {
return;
}
?>
<ul class="mod-articlesnews-horizontal newsflash-horiz mod-list">
<?php foreach ($list as $item) : ?>
<li itemscope itemtype="https://schema.org/Article">
<?php require ModuleHelper::getLayoutPath('mod_articles_news', '_item'); ?>
</li>
<?php endforeach; ?>
</ul>

View File

@ -0,0 +1,35 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_news
*
* @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;
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $app->getDocument()->getWebAssetManager();
$wa->registerAndUseStyle('mod_articles_news_vertical', 'mod_articles_news/template-vert.css');
if (!$list) {
return;
}
?>
<ul class="mod-articlesnews-vertical newsflash-vert mod-list">
<?php for ($i = 0, $n = count($list); $i < $n; $i++) : ?>
<?php $item = $list[$i]; ?>
<li class="newsflash-item" itemscope itemtype="https://schema.org/Article">
<?php require ModuleHelper::getLayoutPath('mod_articles_news', '_item'); ?>
<?php if ($n > 1 && (($i < $n - 1) || $params->get('showLastSeparator'))) : ?>
<span class="article-separator">&#160;</span>
<?php endif; ?>
</li>
<?php endfor; ?>
</ul>