primo commit
This commit is contained in:
1
modules/index.html
Normal file
1
modules/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
768
modules/mod_articles/mod_articles.xml
Normal file
768
modules/mod_articles/mod_articles.xml
Normal file
@ -0,0 +1,768 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>MOD_ARTICLES</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2024-07</creationDate>
|
||||
<copyright>(C) 2024 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>5.2.0</version>
|
||||
<description>MOD_ARTICLES_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Articles</namespace>
|
||||
<files>
|
||||
<folder module="mod_articles">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_articles.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_articles.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Articles" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic"
|
||||
addfieldprefix="Joomla\Component\Content\Administrator\Field" >
|
||||
<field
|
||||
name="mode"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_MODE_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_MODE_DESC"
|
||||
default="normal"
|
||||
validate="options"
|
||||
>
|
||||
<option value="normal">MOD_ARTICLES_OPTION_NORMAL_VALUE</option>
|
||||
<option value="dynamic">MOD_ARTICLES_OPTION_DYNAMIC_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_on_article_page"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_SHOWONARTICLEPAGE_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_SHOWONARTICLEPAGE_DESC"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="mode:dynamic"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_FIELD_COUNT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_COUNT_DESC"
|
||||
default="5"
|
||||
filter="integer"
|
||||
min="0"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="category_filtering_type"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_CATFILTERINGTYPE_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_CATFILTERINGTYPE_DESC"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_OPTION_EXCLUSIVE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_OPTION_INCLUSIVE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
label="JCATEGORY"
|
||||
extension="com_content"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
filter="intarray"
|
||||
class="multipleCategories"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_child_category_articles"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_SHOWCHILDCATEGORYARTICLES_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_SHOWCHILDCATEGORYARTICLES_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_OPTION_EXCLUDE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_OPTION_INCLUDE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="levels"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_FIELD_CATDEPTH_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="show_child_category_articles:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="exclude_current"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_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="ex_or_include_articles"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_EX_OR_INCLUDE_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_OPTION_EXCLUDE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_OPTION_INCLUDE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="excluded_articles"
|
||||
type="subform"
|
||||
label="MOD_ARTICLES_FIELD_EXCLUDEDARTICLES_LABEL"
|
||||
multiple="true"
|
||||
buttons="add,remove"
|
||||
showon="ex_or_include_articles:0"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="id"
|
||||
type="modal_article"
|
||||
label="MOD_ARTICLES_FIELD_SELECT_ARTICLE_LABEL"
|
||||
select="true"
|
||||
new="false"
|
||||
edit="false"
|
||||
clear="true"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="included_articles"
|
||||
type="subform"
|
||||
label="MOD_ARTICLES_FIELD_INCLUDEDARTICLES_LABEL"
|
||||
multiple="true"
|
||||
buttons="add,remove"
|
||||
showon="ex_or_include_articles:1"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="id"
|
||||
type="modal_article"
|
||||
label="MOD_ARTICLES_FIELD_SELECT_ARTICLE_LABEL"
|
||||
select="true"
|
||||
new="false"
|
||||
edit="false"
|
||||
clear="true"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="display"
|
||||
label="MOD_ARTICLES_FIELD_GROUP_DISPLAY_LABEL"
|
||||
>
|
||||
<field
|
||||
name="title_only"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_TITLEONLY_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="articles_layout"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_LAYOUT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_LAYOUT_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_FIELD_LAYOUT_VERT</option>
|
||||
<option value="1">MOD_ARTICLES_FIELD_LAYOUT_HOR</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="layout_columns"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_LAYOUT_COL_LABEL"
|
||||
default="3"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]articles_layout:1"
|
||||
validate="options"
|
||||
>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="item_title"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_TITLE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="item_heading"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_TITLE_HEADING"
|
||||
default="h4"
|
||||
showon="title_only:0[AND]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>
|
||||
<option value="div">MOD_ARTICLES_FIELD_TITLE_HEADING_NONE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_titles"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_FIELD_LINKTITLES_LABEL"
|
||||
default="1"
|
||||
showon="title_only:0[AND]item_title:1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_author"
|
||||
type="radio"
|
||||
label="JAUTHOR"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_category"
|
||||
type="radio"
|
||||
label="JCATEGORY"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_category_link"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_SHOWCATEGORYLINK_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]show_category:1"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_date"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="JDATE"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_date_field"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_DATEFIELD_LABEL"
|
||||
default="created"
|
||||
showon="title_only:0[AND]show_date:1"
|
||||
validate="options"
|
||||
>
|
||||
<option value="created">MOD_ARTICLES_OPTION_CREATED_VALUE</option>
|
||||
<option value="modified">MOD_ARTICLES_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="publish_up">MOD_ARTICLES_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_date_format"
|
||||
type="text"
|
||||
label="MOD_ARTICLES_FIELD_DATEFIELDFORMAT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_DATEFIELDFORMAT_DESC"
|
||||
default="Y-m-d H:i:s"
|
||||
showon="title_only:0[AND]show_date:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_hits"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_SHOWHITS_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="info_layout"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_INFOLAYOUT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_INFOLAYOUT_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="show_date:1[OR]show_category:1[OR]show_hits:1[OR]show_author:1[AND]title_only:0"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_FIELD_LAYOUT_MULTILINE</option>
|
||||
<option value="1">MOD_ARTICLES_FIELD_LAYOUT_SINGLELINE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_tags"
|
||||
type="radio"
|
||||
label="JTAG"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="trigger_events"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_TRIGGER_EVENTS_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_TRIGGER_EVENTS_DESC"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_introtext"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_SHOWINTROTEXT_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="introtext_limit"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_FIELD_INTROTEXTLIMIT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_INTROTEXTLIMIT_DESC"
|
||||
default="100"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]show_introtext:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="image"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_IMAGES_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_IMAGES_DESC"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]introtext_limit:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="img_intro_full"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_IMAGES_ARTICLE_LABEL"
|
||||
default="none"
|
||||
validate="options"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="intro">MOD_ARTICLES_OPTION_INTROIMAGE</option>
|
||||
<option value="full">MOD_ARTICLES_OPTION_FULLIMAGE</option>
|
||||
<option value="none">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_readmore"
|
||||
type="radio"
|
||||
label="JGLOBAL_SHOW_READMORE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_readmore_title"
|
||||
type="radio"
|
||||
label="JGLOBAL_SHOW_READMORE_TITLE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]show_readmore:1"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="readmore_limit"
|
||||
type="number"
|
||||
label="JGLOBAL_SHOW_READMORE_LIMIT_LABEL"
|
||||
default="15"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]show_readmore:1[AND]show_readmore_title:1"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="filtering"
|
||||
label="MOD_ARTICLES_FIELD_GROUP_FILTERING_LABEL"
|
||||
>
|
||||
<field
|
||||
name="show_featured"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_SHOWFEATURED_LABEL"
|
||||
default="show"
|
||||
validate="options"
|
||||
>
|
||||
<option value="show">JSHOW</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="only">MOD_ARTICLES_OPTION_ONLYFEATURED_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="filteringspacer1"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_archived"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_ONLYARCHIVED_LABEL"
|
||||
default="hide"
|
||||
validate="options"
|
||||
>
|
||||
<option value="show">MOD_ARTICLES_OPTION_ONLYARCHIVEDSHOW_VALUE</option>
|
||||
<option value="hide">MOD_ARTICLES_OPTION_ONLYARCHIVEDHIDE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="filteringspacer2"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filter_tag"
|
||||
type="tag"
|
||||
label="JTAG"
|
||||
mode="nested"
|
||||
multiple="true"
|
||||
filter="intarray"
|
||||
class="multipleTags"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer3"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="author_filtering_type"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_AUTHORFILTERING_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_OPTION_EXCLUSIVE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_OPTION_INCLUSIVE_VALUE</option>
|
||||
<option value="2">MOD_ARTICLES_OPTION_ONLYCURRENTUSER_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="created_by"
|
||||
type="author"
|
||||
label="MOD_ARTICLES_FIELD_AUTHOR_LABEL"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
filter="intarray"
|
||||
class="multipleAuthors"
|
||||
showon="author_filtering_type!:2"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer4"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="author_alias_filtering_type"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_AUTHORALIASFILTERING_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_OPTION_EXCLUSIVE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_OPTION_INCLUSIVE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="created_by_alias"
|
||||
type="sql"
|
||||
label="MOD_ARTICLES_FIELD_AUTHORALIAS_LABEL"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
query="select distinct(created_by_alias) from #__content where created_by_alias != '' order by created_by_alias ASC"
|
||||
key_field="created_by_alias"
|
||||
value_field="created_by_alias"
|
||||
class="multipleAuthorAliases"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer5"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="date_filtering"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_DATEFILTERING_LABEL"
|
||||
default="off"
|
||||
validate="options"
|
||||
>
|
||||
<option value="off">MOD_ARTICLES_OPTION_OFF_VALUE</option>
|
||||
<option value="range">MOD_ARTICLES_OPTION_DATERANGE_VALUE</option>
|
||||
<option value="relative">MOD_ARTICLES_OPTION_RELATIVEDAY_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="date_field"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_DATERANGEFIELD_LABEL"
|
||||
default="a.created"
|
||||
showon="date_filtering!:off"
|
||||
validate="options"
|
||||
>
|
||||
<option value="a.created">MOD_ARTICLES_OPTION_CREATED_VALUE</option>
|
||||
<option value="a.modified">MOD_ARTICLES_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="a.publish_up">MOD_ARTICLES_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="start_date_range"
|
||||
type="calendar"
|
||||
label="MOD_ARTICLES_FIELD_STARTDATE_LABEL"
|
||||
translateformat="true"
|
||||
showtime="true"
|
||||
filter="user_utc"
|
||||
showon="date_filtering:range"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="end_date_range"
|
||||
type="calendar"
|
||||
label="MOD_ARTICLES_FIELD_ENDDATE_LABEL"
|
||||
translateformat="true"
|
||||
showtime="true"
|
||||
filter="user_utc"
|
||||
showon="date_filtering:range"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="relative_date"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_FIELD_RELATIVEDATE_LABEL"
|
||||
default="30"
|
||||
filter="integer"
|
||||
showon="date_filtering:relative"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="ordering"
|
||||
label="MOD_ARTICLES_FIELD_GROUP_ORDERING_LABEL"
|
||||
>
|
||||
<field
|
||||
name="article_ordering"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_ARTICLEORDERING_LABEL"
|
||||
default="a.title"
|
||||
validate="options"
|
||||
>
|
||||
<option value="a.ordering">MOD_ARTICLES_OPTION_ORDERING_VALUE</option>
|
||||
<option value="fp.ordering">MOD_ARTICLES_OPTION_ORDERINGFEATURED_VALUE</option>
|
||||
<option value="a.hits" requires="hits">MOD_ARTICLES_OPTION_HITS_VALUE</option>
|
||||
<option value="a.title">JGLOBAL_TITLE</option>
|
||||
<option value="a.id">MOD_ARTICLES_OPTION_ID_VALUE</option>
|
||||
<option value="a.alias">JFIELD_ALIAS_LABEL</option>
|
||||
<option value="a.created">MOD_ARTICLES_OPTION_CREATED_VALUE</option>
|
||||
<option value="modified">MOD_ARTICLES_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="publish_up">MOD_ARTICLES_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
<option value="a.publish_down">MOD_ARTICLES_OPTION_FINISHPUBLISHING_VALUE</option>
|
||||
<option value="random">MOD_ARTICLES_OPTION_RANDOM_VALUE</option>
|
||||
<option value="rating_count" requires="vote">MOD_ARTICLES_OPTION_VOTE_VALUE</option>
|
||||
<option value="rating" requires="vote">MOD_ARTICLES_OPTION_RATING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="article_ordering_direction"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_ARTICLEORDERINGDIR_LABEL"
|
||||
default="ASC"
|
||||
validate="options"
|
||||
>
|
||||
<option value="DESC">MOD_ARTICLES_OPTION_DESCENDING_VALUE</option>
|
||||
<option value="ASC">MOD_ARTICLES_OPTION_ASCENDING_VALUE</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="grouping"
|
||||
label="MOD_ARTICLES_FIELD_GROUP_GROUPING_LABEL"
|
||||
>
|
||||
<field
|
||||
name="article_grouping"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_ARTICLEGROUPING_LABEL"
|
||||
default="none"
|
||||
validate="options"
|
||||
>
|
||||
<option value="none">JNONE</option>
|
||||
<option value="year">MOD_ARTICLES_OPTION_YEAR_VALUE</option>
|
||||
<option value="month_year">MOD_ARTICLES_OPTION_MONTHYEAR_VALUE</option>
|
||||
<option value="author">JAUTHOR</option>
|
||||
<option value="category_title">JCATEGORY</option>
|
||||
<option value="tags">JTAG</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="date_grouping_field"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_DATEGROUPINGFIELD_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_DATEGROUPINGFIELD_DESC"
|
||||
default="created"
|
||||
showon="article_grouping:year,month_year"
|
||||
validate="options"
|
||||
>
|
||||
<option value="created">MOD_ARTICLES_OPTION_CREATED_VALUE</option>
|
||||
<option value="modified">MOD_ARTICLES_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="publish_up">MOD_ARTICLES_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="month_year_format"
|
||||
type="text"
|
||||
label="MOD_ARTICLES_FIELD_MONTHYEARFORMAT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_MONTHYEARFORMAT_DESC"
|
||||
default="F Y"
|
||||
showon="article_grouping:year,month_year"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="article_grouping_direction"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_ARTICLEGROUPINGDIR_LABEL"
|
||||
default="ksort"
|
||||
showon="article_grouping!:none"
|
||||
validate="options"
|
||||
>
|
||||
<option value="krsort">MOD_ARTICLES_OPTION_DESCENDING_VALUE</option>
|
||||
<option value="ksort">MOD_ARTICLES_OPTION_ASCENDING_VALUE</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="owncache"
|
||||
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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
modules/mod_articles/services/provider.php
Normal file
41
modules/mod_articles/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @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 articles module service provider.
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since __ DEPLOY_VERSION__
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Articles'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Articles\\Site\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
84
modules/mod_articles/src/Dispatcher/Dispatcher.php
Normal file
84
modules/mod_articles/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @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\Articles\Site\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Dispatcher class for mod_articles
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
|
||||
{
|
||||
use HelperFactoryAwareTrait;
|
||||
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
protected function getLayoutData(): array
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
$params = $data['params'];
|
||||
|
||||
// Prep for Normal or Dynamic Modes
|
||||
$mode = $params->get('mode', 'normal');
|
||||
$idBase = null;
|
||||
|
||||
switch ($mode) {
|
||||
case 'dynamic':
|
||||
$option = $data['input']->get('option');
|
||||
$view = $data['input']->get('view');
|
||||
|
||||
if ($option === 'com_content') {
|
||||
switch ($view) {
|
||||
case 'category':
|
||||
case 'categories':
|
||||
$idBase = $data['input']->getInt('id');
|
||||
break;
|
||||
case 'article':
|
||||
if ($params->get('show_on_article_page', 1)) {
|
||||
$idBase = $data['input']->getInt('catid');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$idBase = $params->get('catid');
|
||||
break;
|
||||
}
|
||||
|
||||
$cacheParams = new \stdClass();
|
||||
$cacheParams->cachemode = 'id';
|
||||
$cacheParams->class = $this->getHelperFactory()->getHelper('ArticlesHelper');
|
||||
$cacheParams->method = 'getArticles';
|
||||
$cacheParams->methodparams = [$params, $data['app']];
|
||||
$cacheParams->modeparams = md5(serialize([$idBase, $this->module->module, $this->module->id]));
|
||||
|
||||
$data['list'] = ModuleHelper::moduleCache($this->module, $params, $cacheParams);
|
||||
|
||||
$data['grouped'] = $params->get('article_grouping', 'none') !== 'none';
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
589
modules/mod_articles/src/Helper/ArticlesHelper.php
Normal file
589
modules/mod_articles/src/Helper/ArticlesHelper.php
Normal file
@ -0,0 +1,589 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @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\Articles\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Access\Access;
|
||||
use Joomla\CMS\Application\SiteApplication;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Date\Date;
|
||||
use Joomla\CMS\Event\Content;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Content\Administrator\Extension\ContentComponent;
|
||||
use Joomla\Component\Content\Site\Helper\RouteHelper;
|
||||
use Joomla\Database\DatabaseAwareInterface;
|
||||
use Joomla\Database\DatabaseAwareTrait;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_articles
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
class ArticlesHelper implements DatabaseAwareInterface
|
||||
{
|
||||
use DatabaseAwareTrait;
|
||||
|
||||
/**
|
||||
* Retrieve a list of articles
|
||||
*
|
||||
* @param Registry $params The module parameters.
|
||||
* @param SiteApplication $app The current application.
|
||||
*
|
||||
* @return object[]
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
public function getArticles(Registry $params, SiteApplication $app)
|
||||
{
|
||||
$factory = $app->bootComponent('com_content')->getMVCFactory();
|
||||
|
||||
// Get an instance of the generic articles model
|
||||
$articles = $factory->createModel('Articles', 'Site', ['ignore_request' => true]);
|
||||
|
||||
// Set application parameters in model
|
||||
$input = $app->getInput();
|
||||
$appParams = $app->getParams();
|
||||
$articles->setState('params', $appParams);
|
||||
|
||||
$articles->setState('list.start', 0);
|
||||
$articles->setState('filter.published', ContentComponent::CONDITION_PUBLISHED);
|
||||
|
||||
// Set the filters based on the module params
|
||||
$articles->setState('list.limit', (int) $params->get('count', 0));
|
||||
$articles->setState('load_tags', $params->get('show_tags', 0) || $params->get('article_grouping', 'none') === 'tags');
|
||||
|
||||
// Get the user object
|
||||
$user = $app->getIdentity();
|
||||
|
||||
// Access filter
|
||||
$access = !ComponentHelper::getParams('com_content')->get('show_noauth');
|
||||
$authorised = Access::getAuthorisedViewLevels($user->id);
|
||||
$articles->setState('filter.access', $access);
|
||||
|
||||
// Prep for Normal or Dynamic Modes
|
||||
$mode = $params->get('mode', 'normal');
|
||||
|
||||
switch ($mode) {
|
||||
case 'dynamic':
|
||||
$option = $input->get('option');
|
||||
$view = $input->get('view');
|
||||
|
||||
if ($option === 'com_content') {
|
||||
switch ($view) {
|
||||
case 'category':
|
||||
case 'categories':
|
||||
$catids = [$input->getInt('id')];
|
||||
break;
|
||||
case 'article':
|
||||
if ($params->get('show_on_article_page', 1)) {
|
||||
$article_id = $input->getInt('id');
|
||||
$catid = $input->getInt('catid');
|
||||
|
||||
if (!$catid) {
|
||||
// Get an instance of the generic article model
|
||||
$article = $factory->createModel('Article', 'Site', ['ignore_request' => true]);
|
||||
|
||||
$article->setState('params', $appParams);
|
||||
$article->setState('filter.published', 1);
|
||||
$article->setState('article.id', (int) $article_id);
|
||||
$item = $article->getItem();
|
||||
$catids = [$item->catid];
|
||||
} else {
|
||||
$catids = [$catid];
|
||||
}
|
||||
} else {
|
||||
// Return right away if show_on_article_page option is off
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Return right away if not on the category or article views
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Return right away if not on a com_content page
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$catids = $params->get('catid');
|
||||
$articles->setState('filter.category_id.include', (bool) $params->get('category_filtering_type', 1));
|
||||
break;
|
||||
}
|
||||
|
||||
// Category filter
|
||||
if ($catids) {
|
||||
if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) {
|
||||
// Get an instance of the generic categories model
|
||||
$categories = $factory->createModel('Categories', 'Site', ['ignore_request' => true]);
|
||||
$categories->setState('params', $appParams);
|
||||
$levels = $params->get('levels', 1) ?: 9999;
|
||||
$categories->setState('filter.get_children', $levels);
|
||||
$categories->setState('filter.published', 1);
|
||||
$categories->setState('filter.access', $access);
|
||||
$additional_catids = [];
|
||||
|
||||
foreach ($catids as $catid) {
|
||||
$categories->setState('filter.parentId', $catid);
|
||||
$recursive = true;
|
||||
$items = $categories->getItems($recursive);
|
||||
|
||||
if ($items) {
|
||||
foreach ($items as $category) {
|
||||
$condition = (($category->level - $categories->getParent()->level) <= $levels);
|
||||
|
||||
if ($condition) {
|
||||
$additional_catids[] = $category->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$catids = array_unique(array_merge($catids, $additional_catids));
|
||||
}
|
||||
|
||||
$articles->setState('filter.category_id', $catids);
|
||||
}
|
||||
|
||||
// Ordering
|
||||
$ordering = $params->get('article_ordering', 'a.ordering');
|
||||
|
||||
switch ($ordering) {
|
||||
case 'random':
|
||||
$articles->setState('list.ordering', $this->getDatabase()->getQuery(true)->rand());
|
||||
break;
|
||||
|
||||
case 'rating_count':
|
||||
case 'rating':
|
||||
$articles->setState('list.ordering', $ordering);
|
||||
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
|
||||
|
||||
if (!PluginHelper::isEnabled('content', 'vote')) {
|
||||
$articles->setState('list.ordering', 'a.ordering');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$articles->setState('list.ordering', $ordering);
|
||||
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter by multiple tags
|
||||
$articles->setState('filter.tag', $params->get('filter_tag', []));
|
||||
|
||||
// Filter by featured
|
||||
$articles->setState('filter.featured', $params->get('show_featured', 'show'));
|
||||
|
||||
// Filter by author
|
||||
if ($params->get('author_filtering_type', 1) === 2) {
|
||||
$articles->setState('filter.author_id', [$user->id]);
|
||||
} else {
|
||||
$articles->setState('filter.author_id', $params->get('created_by', []));
|
||||
$articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1));
|
||||
}
|
||||
|
||||
$articles->setState('filter.author_alias', $params->get('created_by_alias', []));
|
||||
$articles->setState('filter.author_alias.include', $params->get('author_alias_filtering_type', 1));
|
||||
|
||||
// Filter archived articles
|
||||
if ($params->get('show_archived', 'hide') === 'show') {
|
||||
$articles->setState('filter.published', ContentComponent::CONDITION_ARCHIVED);
|
||||
}
|
||||
|
||||
// Check if we include or exclude articles and process data
|
||||
$ex_or_include_articles = $params->get('ex_or_include_articles', 0);
|
||||
$filterInclude = true;
|
||||
$articlesList = [];
|
||||
$currentArticleId = $input->get('id', 0, 'UINT');
|
||||
|
||||
$isArticleAndShouldExcluded = $params->get('exclude_current', 1) === 1
|
||||
&& $input->get('option') === 'com_content'
|
||||
&& $input->get('view') === 'article';
|
||||
|
||||
$articlesListToProcess = $params->get('included_articles', '');
|
||||
|
||||
if ($ex_or_include_articles === 0) {
|
||||
$filterInclude = false;
|
||||
|
||||
if ($isArticleAndShouldExcluded) {
|
||||
$articlesList[] = $currentArticleId;
|
||||
}
|
||||
|
||||
$articlesListToProcess = $params->get('excluded_articles', '');
|
||||
}
|
||||
|
||||
foreach (ArrayHelper::fromObject($articlesListToProcess) as $article) {
|
||||
if (
|
||||
$ex_or_include_articles === 1
|
||||
&& $isArticleAndShouldExcluded
|
||||
&& (int) $article['id'] === $currentArticleId
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$articlesList[] = (int) $article['id'];
|
||||
}
|
||||
|
||||
// Edge case when the user select include mode but didn't add an article,
|
||||
// we might have to exclude the current article
|
||||
if (
|
||||
$ex_or_include_articles === 1
|
||||
&& $isArticleAndShouldExcluded
|
||||
&& empty($articlesList)
|
||||
) {
|
||||
$filterInclude = false;
|
||||
$articlesList[] = $currentArticleId;
|
||||
}
|
||||
|
||||
if (!empty($articlesList)) {
|
||||
$articles->setState('filter.article_id', $articlesList);
|
||||
$articles->setState('filter.article_id.include', $filterInclude);
|
||||
}
|
||||
|
||||
$date_filtering = $params->get('date_filtering', 'off');
|
||||
|
||||
if ($date_filtering !== 'off') {
|
||||
$articles->setState('filter.date_filtering', $date_filtering);
|
||||
$articles->setState('filter.date_field', $params->get('date_field', 'a.created'));
|
||||
$articles->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00'));
|
||||
$articles->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59'));
|
||||
$articles->setState('filter.relative_date', $params->get('relative_date', 30));
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
$articles->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
$items = $articles->getItems();
|
||||
|
||||
// Display options
|
||||
$show_date = $params->get('show_date', 0);
|
||||
$show_date_field = $params->get('show_date_field', 'created');
|
||||
$show_date_format = $params->get('show_date_format', 'Y-m-d H:i:s');
|
||||
$show_category = $params->get('show_category', 0);
|
||||
$show_category_link = $params->get('show_category_link', 0);
|
||||
$show_hits = $params->get('show_hits', 0);
|
||||
$show_author = $params->get('show_author', 0);
|
||||
$show_introtext = $params->get('show_introtext', 0);
|
||||
$introtext_limit = $params->get('introtext_limit', 100);
|
||||
|
||||
// Find current Article ID if on an article page
|
||||
$option = $input->get('option');
|
||||
$view = $input->get('view');
|
||||
|
||||
if ($option === 'com_content' && $view === 'article') {
|
||||
$active_article_id = $input->getInt('id');
|
||||
} else {
|
||||
$active_article_id = 0;
|
||||
}
|
||||
|
||||
// Prepare data for display using display options
|
||||
foreach ($items as &$item) {
|
||||
$item->slug = $item->id . ':' . $item->alias;
|
||||
|
||||
$articleLink = Route::_(RouteHelper::getArticleRoute($item->slug, $item->catid, $item->language));
|
||||
|
||||
if ($access || \in_array($item->access, $authorised)) {
|
||||
// We know that user has the privilege to view the article
|
||||
$item->link = $articleLink;
|
||||
} else {
|
||||
$menu = $app->getMenu();
|
||||
$menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login');
|
||||
|
||||
if (isset($menuitems[0])) {
|
||||
$Itemid = $menuitems[0]->id;
|
||||
} elseif ($input->getInt('Itemid') > 0) {
|
||||
// Use Itemid from requesting page only if there is no existing menu
|
||||
$Itemid = $input->getInt('Itemid');
|
||||
}
|
||||
|
||||
$return = base64_encode($articleLink);
|
||||
|
||||
$item->link = Route::_('index.php?option=com_users&view=login&Itemid=' . $Itemid . '&return=' . $return);
|
||||
}
|
||||
|
||||
$item->event = new \stdClass();
|
||||
|
||||
// Check if we should trigger additional plugin events
|
||||
if ($params->get('trigger_events', 0)) {
|
||||
$dispatcher = Factory::getApplication()->getDispatcher();
|
||||
|
||||
// Process the content plugins.
|
||||
PluginHelper::importPlugin('content', null, true, $dispatcher);
|
||||
|
||||
$contentEventArguments = [
|
||||
'context' => 'com_content.article',
|
||||
'subject' => $item,
|
||||
'params' => $item->params,
|
||||
];
|
||||
|
||||
// Extra content from events
|
||||
|
||||
$contentEvents = [
|
||||
'afterDisplayTitle' => new Content\AfterTitleEvent('onContentAfterTitle', $contentEventArguments),
|
||||
'beforeDisplayContent' => new Content\BeforeDisplayEvent('onContentBeforeDisplay', $contentEventArguments),
|
||||
'afterDisplayContent' => new Content\AfterDisplayEvent('onContentAfterDisplay', $contentEventArguments),
|
||||
];
|
||||
|
||||
foreach ($contentEvents as $resultKey => $event) {
|
||||
$results = $dispatcher->dispatch($event->getName(), $event)->getArgument('result', []);
|
||||
|
||||
$item->event->{$resultKey} = $results ? trim(implode("\n", $results)) : '';
|
||||
}
|
||||
} else {
|
||||
$item->event->afterDisplayTitle = '';
|
||||
$item->event->beforeDisplayContent = '';
|
||||
$item->event->afterDisplayContent = '';
|
||||
}
|
||||
|
||||
// Used for styling the active article
|
||||
$item->active = $item->id == $active_article_id ? 'active' : '';
|
||||
|
||||
if ($show_date) {
|
||||
$item->displayDate = HTMLHelper::_('date', $item->$show_date_field, $show_date_format);
|
||||
}
|
||||
|
||||
if ($show_category) {
|
||||
$item->displayCategoryTitle = $item->category_title;
|
||||
}
|
||||
|
||||
if ($show_category_link) {
|
||||
$item->displayCategoryLink = Route::_(RouteHelper::getCategoryRoute($item->catid, $item->category_language));
|
||||
}
|
||||
|
||||
$item->displayAuthorName = $show_author ? $item->author : '';
|
||||
$item->displayCategoryTitle = $show_category ? $item->category_title : '';
|
||||
$item->displayCategoryLink = $show_category_link ? $item->displayCategoryLink : '';
|
||||
$item->displayDate = $show_date ? $item->displayDate : '';
|
||||
$item->displayHits = $show_hits ? $item->hits : '';
|
||||
|
||||
if ($show_introtext) {
|
||||
$item->displayIntrotext = HTMLHelper::_('content.prepare', $item->introtext, '', 'mod_articles.content');
|
||||
|
||||
// Remove any images belongs to the text
|
||||
if (!$params->get('image')) {
|
||||
$item->displayIntrotext = preg_replace('/<img[^>]*>/', '', $item->displayIntrotext);
|
||||
}
|
||||
|
||||
if ($introtext_limit != 0) {
|
||||
$item->displayIntrotext = HTMLHelper::_('string.truncateComplex', $item->displayIntrotext, $introtext_limit);
|
||||
}
|
||||
}
|
||||
|
||||
// Show the Intro/Full image field of the article
|
||||
if ($params->get('img_intro_full') !== 'none') {
|
||||
$images = (new Registry($item->images))->toObject();
|
||||
$item->imageSrc = '';
|
||||
|
||||
if ($params->get('img_intro_full') === 'intro' && !empty($images->image_intro)) {
|
||||
$item->imageSrc = htmlspecialchars($images->image_intro, ENT_COMPAT, 'UTF-8');
|
||||
$images->float_intro = 'mod-articles-image';
|
||||
} elseif ($params->get('img_intro_full') === 'full' && !empty($images->image_fulltext)) {
|
||||
$item->imageSrc = htmlspecialchars($images->image_fulltext, ENT_COMPAT, 'UTF-8');
|
||||
$images->float_fulltext = 'mod-articles-image';
|
||||
}
|
||||
|
||||
$item->images = json_encode($images);
|
||||
}
|
||||
|
||||
$item->displayReadmore = $item->alternative_readmore;
|
||||
}
|
||||
|
||||
// Check if items need be grouped
|
||||
$article_grouping = $params->get('article_grouping', 'none');
|
||||
$article_grouping_direction = $params->get('article_grouping_direction', 'ksort');
|
||||
$grouped = $article_grouping !== 'none';
|
||||
|
||||
if ($items && $grouped) {
|
||||
switch ($article_grouping) {
|
||||
case 'year':
|
||||
case 'month_year':
|
||||
$items = ArticlesHelper::groupByDate(
|
||||
$items,
|
||||
$article_grouping_direction,
|
||||
$article_grouping,
|
||||
$params->get('month_year_format', 'F Y'),
|
||||
$params->get('date_grouping_field', 'created')
|
||||
);
|
||||
break;
|
||||
case 'author':
|
||||
case 'category_title':
|
||||
$items = ArticlesHelper::groupBy($items, $article_grouping, $article_grouping_direction);
|
||||
break;
|
||||
case 'tags':
|
||||
$items = ArticlesHelper::groupByTags($items, $article_grouping_direction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups items by field
|
||||
*
|
||||
* @param array $list list of items
|
||||
* @param string $fieldName name of field that is used for grouping
|
||||
* @param string $direction ordering direction
|
||||
* @param null $fieldNameToKeep field name to keep
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
public static function groupBy($list, $fieldName, $direction, $fieldNameToKeep = null)
|
||||
{
|
||||
$grouped = [];
|
||||
|
||||
if (!\is_array($list)) {
|
||||
if ($list === '') {
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
$list = [$list];
|
||||
}
|
||||
|
||||
foreach ($list as $key => $item) {
|
||||
if (!isset($grouped[$item->$fieldName])) {
|
||||
$grouped[$item->$fieldName] = [];
|
||||
}
|
||||
|
||||
if ($fieldNameToKeep === null) {
|
||||
$grouped[$item->$fieldName][$key] = $item;
|
||||
} else {
|
||||
$grouped[$item->$fieldName][$key] = $item->$fieldNameToKeep;
|
||||
}
|
||||
|
||||
unset($list[$key]);
|
||||
}
|
||||
|
||||
$direction($grouped);
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups items by date
|
||||
*
|
||||
* @param array $list list of items
|
||||
* @param string $direction ordering direction
|
||||
* @param string $type type of grouping
|
||||
* @param string $monthYearFormat date format to use
|
||||
* @param string $field date field to group by
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
public static function groupByDate($list, $direction = 'ksort', $type = 'year', $monthYearFormat = 'F Y', $field = 'created')
|
||||
{
|
||||
$grouped = [];
|
||||
|
||||
if (!\is_array($list)) {
|
||||
if ($list === '') {
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
$list = [$list];
|
||||
}
|
||||
|
||||
foreach ($list as $key => $item) {
|
||||
switch ($type) {
|
||||
case 'month_year':
|
||||
$month_year = StringHelper::substr($item->$field, 0, 7);
|
||||
|
||||
if (!isset($grouped[$month_year])) {
|
||||
$grouped[$month_year] = [];
|
||||
}
|
||||
|
||||
$grouped[$month_year][$key] = $item;
|
||||
break;
|
||||
|
||||
default:
|
||||
$year = StringHelper::substr($item->$field, 0, 4);
|
||||
|
||||
if (!isset($grouped[$year])) {
|
||||
$grouped[$year] = [];
|
||||
}
|
||||
|
||||
$grouped[$year][$key] = $item;
|
||||
break;
|
||||
}
|
||||
|
||||
unset($list[$key]);
|
||||
}
|
||||
|
||||
$direction($grouped);
|
||||
|
||||
if ($type === 'month_year') {
|
||||
foreach ($grouped as $group => $items) {
|
||||
$date = new Date($group);
|
||||
$formatted_group = $date->format($monthYearFormat);
|
||||
$grouped[$formatted_group] = $items;
|
||||
|
||||
unset($grouped[$group]);
|
||||
}
|
||||
}
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups items by tags
|
||||
*
|
||||
* @param array $list list of items
|
||||
* @param string $direction ordering direction
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
public static function groupByTags($list, $direction = 'ksort')
|
||||
{
|
||||
$grouped = [];
|
||||
$untagged = [];
|
||||
|
||||
if (!$list) {
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
foreach ($list as $item) {
|
||||
if ($item->tags->itemTags) {
|
||||
foreach ($item->tags->itemTags as $tag) {
|
||||
$grouped[$tag->title][] = $item;
|
||||
}
|
||||
} else {
|
||||
$untagged[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
$direction($grouped);
|
||||
|
||||
if ($untagged) {
|
||||
$grouped['MOD_ARTICLES_UNTAGGED'] = $untagged;
|
||||
}
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
}
|
||||
49
modules/mod_articles/tmpl/default.php
Normal file
49
modules/mod_articles/tmpl/default.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @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\Helper\ModuleHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $app->getDocument()->getWebAssetManager();
|
||||
$wa->registerAndUseStyle('mod_articles', 'mod_articles/mod-articles.css');
|
||||
|
||||
if (!$list) {
|
||||
return;
|
||||
}
|
||||
|
||||
$groupHeading = 'h4';
|
||||
|
||||
if ((bool) $module->showtitle) {
|
||||
$modTitle = $params->get('header_tag');
|
||||
|
||||
if ($modTitle == 'h1') {
|
||||
$groupHeading = 'h2';
|
||||
} elseif ($modTitle == 'h2') {
|
||||
$groupHeading = 'h3';
|
||||
}
|
||||
}
|
||||
|
||||
$layoutSuffix = $params->get('title_only', 0) ? '_titles' : '_items';
|
||||
|
||||
?>
|
||||
<?php if ($grouped) : ?>
|
||||
<?php foreach ($list as $groupName => $items) : ?>
|
||||
<div class="mod-articles-group">
|
||||
<<?php echo $groupHeading; ?>><?php echo Text::_($groupName); ?></<?php echo $groupHeading; ?>>
|
||||
<?php require ModuleHelper::getLayoutPath('mod_articles', $params->get('layout', 'default') . $layoutSuffix); ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<?php $items = $list; ?>
|
||||
<?php require ModuleHelper::getLayoutPath('mod_articles', $params->get('layout', 'default') . $layoutSuffix); ?>
|
||||
<?php endif;
|
||||
124
modules/mod_articles/tmpl/default_items.php
Normal file
124
modules/mod_articles/tmpl/default_items.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @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\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
if ($params->get('articles_layout') == 1) {
|
||||
$gridCols = 'grid-cols-' . $params->get('layout_columns');
|
||||
}
|
||||
|
||||
?>
|
||||
<ul class="mod-articles-items<?php echo ($params->get('articles_layout') == 1 ? ' mod-articles-grid ' . $gridCols : ''); ?> mod-list">
|
||||
<?php foreach ($items as $item) : ?>
|
||||
<?php
|
||||
$displayInfo = $item->displayHits || $item->displayAuthorName || $item->displayCategoryTitle || $item->displayDate;
|
||||
?>
|
||||
<li>
|
||||
<article class="mod-articles-item" itemscope itemtype="https://schema.org/Article">
|
||||
|
||||
<?php if ($params->get('item_title') || $displayInfo || $params->get('show_tags') || $params->get('show_introtext') || $params->get('show_readmore')) : ?>
|
||||
<div class="mod-articles-item-content">
|
||||
|
||||
<?php if ($params->get('item_title')) : ?>
|
||||
<?php $item_heading = $params->get('item_heading', 'h4'); ?>
|
||||
<<?php echo $item_heading; ?> class="mod-articles-title" itemprop="name">
|
||||
<?php if ($params->get('link_titles') == 1) : ?>
|
||||
<?php $attributes = ['class' => 'mod-articles-link ' . $item->active, 'itemprop' => 'url']; ?>
|
||||
<?php $link = htmlspecialchars($item->link, ENT_COMPAT, 'UTF-8', false); ?>
|
||||
<?php $title = htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8', false); ?>
|
||||
<?php echo HTMLHelper::_('link', $link, $title, $attributes); ?>
|
||||
<?php else : ?>
|
||||
<?php echo $item->title; ?>
|
||||
<?php endif; ?>
|
||||
</<?php echo $item_heading; ?>>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $item->event->afterDisplayTitle; ?>
|
||||
|
||||
<?php if ($displayInfo) : ?>
|
||||
<?php $listClass = ($params->get('info_layout') == 1) ? 'list-inline' : 'list-unstyled'; ?>
|
||||
<dl class="<?php echo $listClass; ?>">
|
||||
<dt class="article-info-term">
|
||||
<span class="visually-hidden">
|
||||
<?php echo Text::_('MOD_ARTICLES_INFO'); ?>
|
||||
</span>
|
||||
</dt>
|
||||
|
||||
<?php if ($item->displayAuthorName) : ?>
|
||||
<dd class="mod-articles-writtenby <?php echo ($params->get('info_layout') == 1 ? 'list-inline-item' : ''); ?>">
|
||||
<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'icon-user icon-fw']); ?>
|
||||
<?php echo $item->displayAuthorName; ?>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayCategoryTitle) : ?>
|
||||
<dd class="mod-articles-category <?php echo ($params->get('info_layout') == 1 ? 'list-inline-item' : ''); ?>">
|
||||
<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'icon-folder-open icon-fw']); ?>
|
||||
<?php if ($item->displayCategoryLink) : ?>
|
||||
<a href="<?php echo $item->displayCategoryLink; ?>">
|
||||
<?php echo $item->displayCategoryTitle; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo $item->displayCategoryTitle; ?>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayDate) : ?>
|
||||
<dd class="mod-articles-date <?php echo ($params->get('info_layout') == 1 ? 'list-inline-item' : ''); ?>">
|
||||
<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'icon-calendar icon-fw']); ?>
|
||||
<?php echo $item->displayDate; ?>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayHits) : ?>
|
||||
<dd class="mod-articles-hits <?php echo ($params->get('info_layout') == 1 ? 'list-inline-item' : ''); ?>">
|
||||
<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'icon-eye icon-fw']); ?>
|
||||
<?php echo $item->displayHits; ?>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
</dl>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (in_array($params->get('img_intro_full'), ['intro', 'full']) && !empty($item->imageSrc)) : ?>
|
||||
<?php echo LayoutHelper::render('joomla.content.' . $params->get('img_intro_full') . '_image', $item); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_tags', 0) && $item->tags->itemTags) : ?>
|
||||
<div class="mod-articles-tags">
|
||||
<?php echo LayoutHelper::render('joomla.content.tags', $item->tags->itemTags); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $item->event->beforeDisplayContent; ?>
|
||||
|
||||
<?php if ($params->get('show_introtext', 1)) : ?>
|
||||
<?php echo $item->displayIntrotext; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $item->event->afterDisplayContent; ?>
|
||||
|
||||
<?php if ($params->get('show_readmore')) : ?>
|
||||
<?php if ($params->get('show_readmore_title', '') !== '') : ?>
|
||||
<?php $item->params->set('show_readmore_title', $params->get('show_readmore_title')); ?>
|
||||
<?php $item->params->set('readmore_limit', $params->get('readmore_limit')); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo LayoutHelper::render('joomla.content.readmore', ['item' => $item, 'params' => $item->params, 'link' => $item->link]); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
24
modules/mod_articles/tmpl/default_titles.php
Normal file
24
modules/mod_articles/tmpl/default_titles.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @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;
|
||||
|
||||
?>
|
||||
<ul class="mod-articles mod-list">
|
||||
<?php foreach ($items as $item) : ?>
|
||||
<li itemscope itemtype="https://schema.org/Article">
|
||||
<a <?php echo $item->active ? 'class="' . $item->active . '" ' : ''; ?>href="<?php echo $item->link; ?>" itemprop="url">
|
||||
<span itemprop="name">
|
||||
<?php echo $item->title; ?>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
84
modules/mod_articles_archive/mod_articles_archive.xml
Normal file
84
modules/mod_articles_archive/mod_articles_archive.xml
Normal file
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_articles_archive</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_ARCHIVE_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\ArticlesArchive</namespace>
|
||||
<files>
|
||||
<folder module="mod_articles_archive">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_articles_archive.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_articles_archive.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Articles_-_Archived" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_ARCHIVE_FIELD_COUNT_LABEL"
|
||||
default="10"
|
||||
filter="integer"
|
||||
min="1"
|
||||
validate="number"
|
||||
/>
|
||||
</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="static"
|
||||
>
|
||||
<option value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
modules/mod_articles_archive/services/provider.php
Normal file
41
modules/mod_articles_archive/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
*
|
||||
* @copyright (C) 2023 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 articles archive module service provider.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function register(Container $container): void
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\ArticlesArchive'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\ArticlesArchive\\Site\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
45
modules/mod_articles_archive/src/Dispatcher/Dispatcher.php
Normal file
45
modules/mod_articles_archive/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\ArticlesArchive\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_archive
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
|
||||
{
|
||||
use HelperFactoryAwareTrait;
|
||||
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
protected function getLayoutData(): array
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
|
||||
$data['list'] = $this->getHelperFactory()->getHelper('ArticlesArchiveHelper')->getArticlesByMonths($data['params'], $data['app']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
*
|
||||
* @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\ArticlesArchive\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Application\SiteApplication;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Content\Administrator\Extension\ContentComponent;
|
||||
use Joomla\Database\DatabaseAwareInterface;
|
||||
use Joomla\Database\DatabaseAwareTrait;
|
||||
use Joomla\Database\ParameterType;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_archive
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
class ArticlesArchiveHelper implements DatabaseAwareInterface
|
||||
{
|
||||
use DatabaseAwareTrait;
|
||||
|
||||
/**
|
||||
* Retrieve a list of months with archived articles
|
||||
*
|
||||
* @param Registry $moduleParams The module parameters.
|
||||
* @param SiteApplication $app The current application.
|
||||
*
|
||||
* @return \stdClass[]
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function getArticlesByMonths(Registry $moduleParams, SiteApplication $app): array
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select($query->month($db->quoteName('created')) . ' AS created_month')
|
||||
->select('MIN(' . $db->quoteName('created') . ') AS created')
|
||||
->select($query->year($db->quoteName('created')) . ' AS created_year')
|
||||
->from($db->quoteName('#__content', 'c'))
|
||||
->where($db->quoteName('c.state') . ' = ' . ContentComponent::CONDITION_ARCHIVED)
|
||||
->group($query->year($db->quoteName('c.created')) . ', ' . $query->month($db->quoteName('c.created')))
|
||||
->order($query->year($db->quoteName('c.created')) . ' DESC, ' . $query->month($db->quoteName('c.created')) . ' DESC');
|
||||
|
||||
// Filter by language
|
||||
if ($app->getLanguageFilter()) {
|
||||
$query->whereIn($db->quoteName('language'), [$app->getLanguage()->getTag(), '*'], ParameterType::STRING);
|
||||
}
|
||||
|
||||
$query->setLimit((int) $moduleParams->get('count'));
|
||||
$db->setQuery($query);
|
||||
|
||||
try {
|
||||
$rows = (array) $db->loadObjectList();
|
||||
} catch (\RuntimeException $e) {
|
||||
$app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
$menu = $app->getMenu();
|
||||
$item = $menu->getItems('link', 'index.php?option=com_content&view=archive', true);
|
||||
$itemid = (isset($item) && !empty($item->id)) ? '&Itemid=' . $item->id : '';
|
||||
|
||||
$i = 0;
|
||||
$lists = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$date = Factory::getDate($row->created);
|
||||
|
||||
$createdMonth = $date->format('n');
|
||||
$createdYear = $date->format('Y');
|
||||
|
||||
$createdYearCal = HTMLHelper::_('date', $row->created, 'Y');
|
||||
$monthNameCal = HTMLHelper::_('date', $row->created, 'F');
|
||||
|
||||
$lists[$i] = new \stdClass();
|
||||
|
||||
$lists[$i]->link = Route::_('index.php?option=com_content&view=archive&year=' . $createdYear . '&month=' . $createdMonth . $itemid);
|
||||
$lists[$i]->text = Text::sprintf('MOD_ARTICLES_ARCHIVE_DATE', $monthNameCal, $createdYearCal);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve list of archived articles
|
||||
*
|
||||
* @param Registry &$params module parameters
|
||||
*
|
||||
* @return \stdClass[]
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @deprecated 4.4.0 will be removed in 6.0
|
||||
* Use the non-static method getArticlesByMonths
|
||||
* Example: Factory::getApplication()->bootModule('mod_articles_archive', 'site')
|
||||
* ->getHelper('ArticlesArchiveHelper')
|
||||
* ->getArticlesByMonths($params, Factory::getApplication())
|
||||
*/
|
||||
public static function getList(&$params)
|
||||
{
|
||||
/** @var SiteApplication $app */
|
||||
$app = Factory::getApplication();
|
||||
|
||||
return (new self())->getArticlesByMonths($params, $app);
|
||||
}
|
||||
}
|
||||
26
modules/mod_articles_archive/tmpl/default.php
Normal file
26
modules/mod_articles_archive/tmpl/default.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_archive
|
||||
*
|
||||
* @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;
|
||||
|
||||
if (!$list) {
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<ul class="mod-articlesarchive archive-module mod-list">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li>
|
||||
<a href="<?php echo $item->link; ?>">
|
||||
<?php echo $item->text; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
173
modules/mod_articles_categories/mod_articles_categories.xml
Normal file
173
modules/mod_articles_categories/mod_articles_categories.xml
Normal file
@ -0,0 +1,173 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_articles_categories</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2010-02</creationDate>
|
||||
<copyright>(C) 2010 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_CATEGORIES_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\ArticlesCategories</namespace>
|
||||
<files>
|
||||
<folder module="mod_articles_categories">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_articles_categories.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_articles_categories.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Articles_-_Categories" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" addfieldprefix="Joomla\Component\Categories\Administrator\Field">
|
||||
<field
|
||||
name="parent"
|
||||
type="modal_category"
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_PARENT_LABEL"
|
||||
extension="com_content"
|
||||
filter="integer"
|
||||
published=""
|
||||
select="true"
|
||||
new="true"
|
||||
edit="true"
|
||||
clear="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_description"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_SHOW_DESCRIPTION_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="numitems"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_NUMITEMS_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_children"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_SHOW_CHILDREN_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_COUNT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORIES_FIELD_COUNT_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JALL</option>
|
||||
<option value="1">J1</option>
|
||||
<option value="2">J2</option>
|
||||
<option value="3">J3</option>
|
||||
<option value="4">J4</option>
|
||||
<option value="5">J5</option>
|
||||
<option value="6">J6</option>
|
||||
<option value="7">J7</option>
|
||||
<option value="8">J8</option>
|
||||
<option value="9">J9</option>
|
||||
<option value="10">J10</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="maxlevel"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORIES_FIELD_MAXLEVEL_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JALL</option>
|
||||
<option value="1">J1</option>
|
||||
<option value="2">J2</option>
|
||||
<option value="3">J3</option>
|
||||
<option value="4">J4</option>
|
||||
<option value="5">J5</option>
|
||||
<option value="6">J6</option>
|
||||
<option value="7">J7</option>
|
||||
<option value="8">J8</option>
|
||||
<option value="9">J9</option>
|
||||
<option value="10">J10</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
validate="moduleLayout"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="item_heading"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORIES_TITLE_HEADING_LABEL"
|
||||
default="4"
|
||||
filter="integer"
|
||||
validate="options"
|
||||
>
|
||||
<option value="1">JH1</option>
|
||||
<option value="2">JH2</option>
|
||||
<option value="3">JH3</option>
|
||||
<option value="4">JH4</option>
|
||||
<option value="5">JH5</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="owncache"
|
||||
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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
modules/mod_articles_categories/services/provider.php
Normal file
41
modules/mod_articles_categories/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_categories
|
||||
*
|
||||
* @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 articles categories module service provider.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\ArticlesCategories'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\ArticlesCategories\\Site\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_categories
|
||||
*
|
||||
* @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\ArticlesCategories\Site\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Dispatcher class for mod_articles_categories
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
|
||||
{
|
||||
use HelperFactoryAwareTrait;
|
||||
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
protected function getLayoutData(): array
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
$params = $data['params'];
|
||||
|
||||
$cacheParams = new \stdClass();
|
||||
$cacheParams->cachemode = 'id';
|
||||
$cacheParams->class = $this->getHelperFactory()->getHelper('ArticlesCategoriesHelper');
|
||||
$cacheParams->method = 'getChildrenCategories';
|
||||
$cacheParams->methodparams = [$params, $data['app']];
|
||||
$cacheParams->modeparams = md5(serialize($this->module->id));
|
||||
|
||||
$data['list'] = ModuleHelper::moduleCache($this->module, $params, $cacheParams);
|
||||
|
||||
$data['startLevel'] = $data['list'] ? reset($data['list'])->getParent()->level : null;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_categories
|
||||
*
|
||||
* @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\ArticlesCategories\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Application\SiteApplication;
|
||||
use Joomla\CMS\Categories\CategoryInterface;
|
||||
use Joomla\CMS\Categories\CategoryNode;
|
||||
use Joomla\CMS\Factory;
|
||||
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_categories
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
class ArticlesCategoriesHelper implements DatabaseAwareInterface
|
||||
{
|
||||
use DatabaseAwareTrait;
|
||||
|
||||
/**
|
||||
* Given a parent category, return a list of children categories
|
||||
*
|
||||
* @param Registry $moduleParams The module parameters.
|
||||
* @param SiteApplication $app The current application.
|
||||
*
|
||||
* @return CategoryNode[]
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function getChildrenCategories(Registry $moduleParams, SiteApplication $app): array
|
||||
{
|
||||
// Joomla\CMS\Categories\Categories options to set
|
||||
$options = [];
|
||||
|
||||
// Get the number of items in this category or descendants of this category at the expense of performance.
|
||||
$options['countItems'] = $moduleParams->get('numitems', 0);
|
||||
|
||||
/** @var CategoryInterface $categoryFactory */
|
||||
$categoryFactory = $app->bootComponent('com_content')->getCategory($options);
|
||||
|
||||
/** @var CategoryNode $parentCategory */
|
||||
$parentCategory = $categoryFactory->get($moduleParams->get('parent', 'root'));
|
||||
|
||||
if ($parentCategory === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Get all the children categories of this node
|
||||
$childrenCategories = $parentCategory->getChildren();
|
||||
|
||||
$count = $moduleParams->get('count', 0);
|
||||
|
||||
if ($count > 0 && \count($childrenCategories) > $count) {
|
||||
$childrenCategories = \array_slice($childrenCategories, 0, $count);
|
||||
}
|
||||
|
||||
return $childrenCategories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of categories
|
||||
*
|
||||
* @param Registry $params module parameters
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.6
|
||||
*
|
||||
* @deprecated 4.4.0 will be removed in 6.0
|
||||
* Use the non-static method getChildrenCategories
|
||||
* Example: Factory::getApplication()->bootModule('mod_articles_categories', 'site')
|
||||
* ->getHelper('ArticlesCategoriesHelper')
|
||||
* ->getChildrenCategories($params, Factory::getApplication())
|
||||
*/
|
||||
public static function getList($params)
|
||||
{
|
||||
/** @var SiteApplication $app */
|
||||
$app = Factory::getApplication();
|
||||
|
||||
return (new self())->getChildrenCategories($params, $app);
|
||||
}
|
||||
}
|
||||
22
modules/mod_articles_categories/tmpl/default.php
Normal file
22
modules/mod_articles_categories/tmpl/default.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_categories
|
||||
*
|
||||
* @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\Helper\ModuleHelper;
|
||||
|
||||
if (!$list) {
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<ul class="mod-articlescategories categories-module mod-list">
|
||||
<?php require ModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default') . '_items'); ?>
|
||||
</ul>
|
||||
51
modules/mod_articles_categories/tmpl/default_items.php
Normal file
51
modules/mod_articles_categories/tmpl/default_items.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_categories
|
||||
*
|
||||
* @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\Helper\ModuleHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Content\Site\Helper\RouteHelper;
|
||||
|
||||
$input = $app->getInput();
|
||||
$option = $input->getCmd('option');
|
||||
$view = $input->getCmd('view');
|
||||
$id = $input->getInt('id');
|
||||
|
||||
foreach ($list as $item) : ?>
|
||||
<li<?php if ($id == $item->id && in_array($view, ['category', 'categories']) && $option == 'com_content') {
|
||||
echo ' class="active"';
|
||||
} ?>> <?php $levelup = $item->level - $startLevel - 1; ?>
|
||||
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>">
|
||||
<?php echo $item->title; ?>
|
||||
<?php if ($params->get('numitems')) : ?>
|
||||
(<?php echo $item->numitems; ?>)
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
|
||||
<?php if ($params->get('show_description', 0)) : ?>
|
||||
<?php echo HTMLHelper::_('content.prepare', $item->description, $item->getParams(), 'mod_articles_categories.content'); ?>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
if (
|
||||
$params->get('show_children', 0) && (($params->get('maxlevel', 0) == 0)
|
||||
|| ($params->get('maxlevel') >= ($item->level - $startLevel)))
|
||||
&& count($item->getChildren())
|
||||
) : ?>
|
||||
<?php echo '<ul>'; ?>
|
||||
<?php $temp = $list; ?>
|
||||
<?php $list = $item->getChildren(); ?>
|
||||
<?php require ModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default') . '_items'); ?>
|
||||
<?php $list = $temp; ?>
|
||||
<?php echo '</ul>'; ?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
571
modules/mod_articles_category/mod_articles_category.xml
Normal file
571
modules/mod_articles_category/mod_articles_category.xml
Normal file
@ -0,0 +1,571 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_articles_category</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2010-02</creationDate>
|
||||
<copyright>(C) 2010 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_CATEGORY_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\ArticlesCategory</namespace>
|
||||
<files>
|
||||
<folder module="mod_articles_category">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_articles_category.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_articles_category.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Articles_-_Category" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="mode"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_MODE_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_MODE_DESC"
|
||||
default="normal"
|
||||
validate="options"
|
||||
>
|
||||
<option value="normal">MOD_ARTICLES_CATEGORY_OPTION_NORMAL_VALUE</option>
|
||||
<option value="dynamic">MOD_ARTICLES_CATEGORY_OPTION_DYNAMIC_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_on_article_page"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_SHOWONARTICLEPAGE_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_SHOWONARTICLEPAGE_DESC"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="mode:dynamic"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset
|
||||
name="filtering"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_GROUP_FILTERING_LABEL"
|
||||
>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_COUNT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_COUNT_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_front"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_SHOWFEATURED_LABEL"
|
||||
default="show"
|
||||
validate="options"
|
||||
>
|
||||
<option value="show">JSHOW</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="only">MOD_ARTICLES_CATEGORY_OPTION_ONLYFEATURED_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="filteringspacer0"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="category_filtering_type"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_CATFILTERINGTYPE_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_CATEGORY_OPTION_EXCLUSIVE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_CATEGORY_OPTION_INCLUSIVE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
label="JCATEGORY"
|
||||
extension="com_content"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
filter="intarray"
|
||||
class="multipleCategories"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_child_category_articles"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_SHOWCHILDCATEGORYARTICLES_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_CATEGORY_OPTION_EXCLUDE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_CATEGORY_OPTION_INCLUDE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="levels"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_CATDEPTH_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="show_child_category_articles:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer1"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filter_tag"
|
||||
type="tag"
|
||||
label="JTAG"
|
||||
mode="nested"
|
||||
multiple="true"
|
||||
filter="intarray"
|
||||
class="multipleTags"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer2"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="author_filtering_type"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_AUTHORFILTERING_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_CATEGORY_OPTION_EXCLUSIVE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_CATEGORY_OPTION_INCLUSIVE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="created_by"
|
||||
type="author"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_AUTHOR_LABEL"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
filter="intarray"
|
||||
class="multipleAuthors"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer3"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="author_alias_filtering_type"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_AUTHORALIASFILTERING_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_CATEGORY_OPTION_EXCLUSIVE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_CATEGORY_OPTION_INCLUSIVE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="created_by_alias"
|
||||
type="sql"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_AUTHORALIAS_LABEL"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
query="select distinct(created_by_alias) from #__content where created_by_alias != '' order by created_by_alias ASC"
|
||||
key_field="created_by_alias"
|
||||
value_field="created_by_alias"
|
||||
class="multipleAuthorAliases"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer4"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="excluded_articles"
|
||||
type="textarea"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_EXCLUDEDARTICLES_LABEL"
|
||||
cols="10"
|
||||
rows="3"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer5"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="date_filtering"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_DATEFILTERING_LABEL"
|
||||
default="off"
|
||||
validate="options"
|
||||
>
|
||||
<option value="off">MOD_ARTICLES_CATEGORY_OPTION_OFF_VALUE</option>
|
||||
<option value="range">MOD_ARTICLES_CATEGORY_OPTION_DATERANGE_VALUE</option>
|
||||
<option value="relative">MOD_ARTICLES_CATEGORY_OPTION_RELATIVEDAY_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="date_field"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_DATERANGEFIELD_LABEL"
|
||||
default="a.created"
|
||||
showon="date_filtering!:off"
|
||||
validate="options"
|
||||
>
|
||||
<option value="a.created">MOD_ARTICLES_CATEGORY_OPTION_CREATED_VALUE</option>
|
||||
<option value="a.modified">MOD_ARTICLES_CATEGORY_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="a.publish_up">MOD_ARTICLES_CATEGORY_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="start_date_range"
|
||||
type="calendar"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_STARTDATE_LABEL"
|
||||
translateformat="true"
|
||||
showtime="true"
|
||||
filter="user_utc"
|
||||
showon="date_filtering:range"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="end_date_range"
|
||||
type="calendar"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_ENDDATE_LABEL"
|
||||
translateformat="true"
|
||||
showtime="true"
|
||||
filter="user_utc"
|
||||
showon="date_filtering:range"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="relative_date"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_RELATIVEDATE_LABEL"
|
||||
default="30"
|
||||
filter="integer"
|
||||
showon="date_filtering:relative"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset
|
||||
name="ordering"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_GROUP_ORDERING_LABEL"
|
||||
>
|
||||
|
||||
<field
|
||||
name="article_ordering"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEORDERING_LABEL"
|
||||
default="a.title"
|
||||
validate="options"
|
||||
>
|
||||
<option value="a.ordering">MOD_ARTICLES_CATEGORY_OPTION_ORDERING_VALUE</option>
|
||||
<option value="fp.ordering">MOD_ARTICLES_CATEGORY_OPTION_ORDERINGFEATURED_VALUE</option>
|
||||
<option value="a.hits" requires="hits">MOD_ARTICLES_CATEGORY_OPTION_HITS_VALUE</option>
|
||||
<option value="a.title">JGLOBAL_TITLE</option>
|
||||
<option value="a.id">MOD_ARTICLES_CATEGORY_OPTION_ID_VALUE</option>
|
||||
<option value="a.alias">JFIELD_ALIAS_LABEL</option>
|
||||
<option value="a.created">MOD_ARTICLES_CATEGORY_OPTION_CREATED_VALUE</option>
|
||||
<option value="modified">MOD_ARTICLES_CATEGORY_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="publish_up">MOD_ARTICLES_CATEGORY_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
<option value="a.publish_down">MOD_ARTICLES_CATEGORY_OPTION_FINISHPUBLISHING_VALUE</option>
|
||||
<option value="random">MOD_ARTICLES_CATEGORY_OPTION_RANDOM_VALUE</option>
|
||||
<option value="rating_count" requires="vote">MOD_ARTICLES_CATEGORY_OPTION_VOTE_VALUE</option>
|
||||
<option value="rating" requires="vote">MOD_ARTICLES_CATEGORY_OPTION_RATING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="article_ordering_direction"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEORDERINGDIR_LABEL"
|
||||
default="ASC"
|
||||
validate="options"
|
||||
>
|
||||
<option value="DESC">MOD_ARTICLES_CATEGORY_OPTION_DESCENDING_VALUE</option>
|
||||
<option value="ASC">MOD_ARTICLES_CATEGORY_OPTION_ASCENDING_VALUE</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset
|
||||
name="grouping"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_GROUP_GROUPING_LABEL"
|
||||
>
|
||||
|
||||
<field
|
||||
name="article_grouping"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEGROUPING_LABEL"
|
||||
default="none"
|
||||
validate="options"
|
||||
>
|
||||
<option value="none">JNONE</option>
|
||||
<option value="year">MOD_ARTICLES_CATEGORY_OPTION_YEAR_VALUE</option>
|
||||
<option value="month_year">MOD_ARTICLES_CATEGORY_OPTION_MONTHYEAR_VALUE</option>
|
||||
<option value="author">JAUTHOR</option>
|
||||
<option value="category_title">JCATEGORY</option>
|
||||
<option value="tags">JTAG</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="date_grouping_field"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_DATEGROUPINGFIELD_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_DATEGROUPINGFIELD_DESC"
|
||||
default="created"
|
||||
showon="article_grouping:year,month_year"
|
||||
validate="options"
|
||||
>
|
||||
<option value="created">MOD_ARTICLES_CATEGORY_OPTION_CREATED_VALUE</option>
|
||||
<option value="modified">MOD_ARTICLES_CATEGORY_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="publish_up">MOD_ARTICLES_CATEGORY_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="month_year_format"
|
||||
type="text"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_MONTHYEARFORMAT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_MONTHYEARFORMAT_DESC"
|
||||
default="F Y"
|
||||
showon="article_grouping:year,month_year"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="article_grouping_direction"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_ARTICLEGROUPINGDIR_LABEL"
|
||||
default="ksort"
|
||||
showon="article_grouping!:none"
|
||||
validate="options"
|
||||
>
|
||||
<option value="krsort">MOD_ARTICLES_CATEGORY_OPTION_DESCENDING_VALUE</option>
|
||||
<option value="ksort">MOD_ARTICLES_CATEGORY_OPTION_ASCENDING_VALUE</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset
|
||||
name="display"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_GROUP_DISPLAY_LABEL"
|
||||
>
|
||||
|
||||
<field
|
||||
name="link_titles"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_LINKTITLES_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_date"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="JDATE"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_date_field"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_DATEFIELD_LABEL"
|
||||
default="created"
|
||||
showon="show_date:1"
|
||||
validate="options"
|
||||
>
|
||||
<option value="created">MOD_ARTICLES_CATEGORY_OPTION_CREATED_VALUE</option>
|
||||
<option value="modified">MOD_ARTICLES_CATEGORY_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="publish_up">MOD_ARTICLES_CATEGORY_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_date_format"
|
||||
type="text"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_DATEFIELDFORMAT_LABEL"
|
||||
description="MOD_ARTICLES_CATEGORY_FIELD_DATEFIELDFORMAT_DESC"
|
||||
default="Y-m-d H:i:s"
|
||||
showon="show_date:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_category"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="JCATEGORY"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_hits"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_SHOWHITS_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_author"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="JAUTHOR"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_tags"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="JTAG"
|
||||
default="0"
|
||||
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_CATEGORY_FIELD_SHOWINTROTEXT_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="introtext_limit"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_CATEGORY_FIELD_INTROTEXTLIMIT_LABEL"
|
||||
default="100"
|
||||
filter="integer"
|
||||
showon="show_introtext:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_readmore"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="JGLOBAL_SHOW_READMORE_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_readmore_title"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="JGLOBAL_SHOW_READMORE_TITLE_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="show_readmore:1"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="readmore_limit"
|
||||
type="number"
|
||||
label="JGLOBAL_SHOW_READMORE_LIMIT_LABEL"
|
||||
default="15"
|
||||
filter="integer"
|
||||
showon="show_readmore:1[AND]show_readmore_title:1"
|
||||
/>
|
||||
|
||||
</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="owncache"
|
||||
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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
modules/mod_articles_category/services/provider.php
Normal file
41
modules/mod_articles_category/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_category
|
||||
*
|
||||
* @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 articles category module service provider.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\ArticlesCategory'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\ArticlesCategory\\Site\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
84
modules/mod_articles_category/src/Dispatcher/Dispatcher.php
Normal file
84
modules/mod_articles_category/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_category
|
||||
*
|
||||
* @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\ArticlesCategory\Site\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Dispatcher class for mod_articles_category
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
|
||||
{
|
||||
use HelperFactoryAwareTrait;
|
||||
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
protected function getLayoutData(): array
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
$params = $data['params'];
|
||||
|
||||
// Prep for Normal or Dynamic Modes
|
||||
$mode = $params->get('mode', 'normal');
|
||||
$idBase = null;
|
||||
|
||||
switch ($mode) {
|
||||
case 'dynamic':
|
||||
$option = $data['input']->get('option');
|
||||
$view = $data['input']->get('view');
|
||||
|
||||
if ($option === 'com_content') {
|
||||
switch ($view) {
|
||||
case 'category':
|
||||
case 'categories':
|
||||
$idBase = $data['input']->getInt('id');
|
||||
break;
|
||||
case 'article':
|
||||
if ($params->get('show_on_article_page', 1)) {
|
||||
$idBase = $data['input']->getInt('catid');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$idBase = $params->get('catid');
|
||||
break;
|
||||
}
|
||||
|
||||
$cacheParams = new \stdClass();
|
||||
$cacheParams->cachemode = 'id';
|
||||
$cacheParams->class = $this->getHelperFactory()->getHelper('ArticlesCategoryHelper');
|
||||
$cacheParams->method = 'getArticles';
|
||||
$cacheParams->methodparams = [$params, $data['app']];
|
||||
$cacheParams->modeparams = md5(serialize([$idBase, $this->module->module, $this->module->id]));
|
||||
|
||||
$data['list'] = ModuleHelper::moduleCache($this->module, $params, $cacheParams);
|
||||
|
||||
$data['grouped'] = $params->get('article_grouping', 'none') !== 'none';
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,551 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_category
|
||||
*
|
||||
* @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\ArticlesCategory\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Access\Access;
|
||||
use Joomla\CMS\Application\SiteApplication;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Date\Date;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Content\Administrator\Extension\ContentComponent;
|
||||
use Joomla\Component\Content\Site\Helper\RouteHelper;
|
||||
use Joomla\Database\DatabaseAwareInterface;
|
||||
use Joomla\Database\DatabaseAwareTrait;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_category
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ArticlesCategoryHelper implements DatabaseAwareInterface
|
||||
{
|
||||
use DatabaseAwareTrait;
|
||||
|
||||
/**
|
||||
* Retrieve a list of article
|
||||
*
|
||||
* @param Registry $params The module parameters.
|
||||
* @param SiteApplication $app The current application.
|
||||
*
|
||||
* @return object[]
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function getArticles(Registry $params, SiteApplication $app)
|
||||
{
|
||||
$factory = $app->bootComponent('com_content')->getMVCFactory();
|
||||
|
||||
// Get an instance of the generic articles model
|
||||
$articles = $factory->createModel('Articles', 'Site', ['ignore_request' => true]);
|
||||
|
||||
// Set application parameters in model
|
||||
$input = $app->getInput();
|
||||
$appParams = $app->getParams();
|
||||
$articles->setState('params', $appParams);
|
||||
|
||||
$articles->setState('list.start', 0);
|
||||
$articles->setState('filter.published', ContentComponent::CONDITION_PUBLISHED);
|
||||
|
||||
// Set the filters based on the module params
|
||||
$articles->setState('list.limit', (int) $params->get('count', 0));
|
||||
$articles->setState('load_tags', $params->get('show_tags', 0) || $params->get('article_grouping', 'none') === 'tags');
|
||||
|
||||
// Access filter
|
||||
$access = !ComponentHelper::getParams('com_content')->get('show_noauth');
|
||||
$authorised = Access::getAuthorisedViewLevels($app->getIdentity()->get('id'));
|
||||
$articles->setState('filter.access', $access);
|
||||
|
||||
// Prep for Normal or Dynamic Modes
|
||||
$mode = $params->get('mode', 'normal');
|
||||
|
||||
switch ($mode) {
|
||||
case 'dynamic':
|
||||
$option = $input->get('option');
|
||||
$view = $input->get('view');
|
||||
|
||||
if ($option === 'com_content') {
|
||||
switch ($view) {
|
||||
case 'category':
|
||||
case 'categories':
|
||||
$catids = [$input->getInt('id')];
|
||||
break;
|
||||
case 'article':
|
||||
if ($params->get('show_on_article_page', 1)) {
|
||||
$article_id = $input->getInt('id');
|
||||
$catid = $input->getInt('catid');
|
||||
|
||||
if (!$catid) {
|
||||
// Get an instance of the generic article model
|
||||
$article = $factory->createModel('Article', 'Site', ['ignore_request' => true]);
|
||||
|
||||
$article->setState('params', $appParams);
|
||||
$article->setState('filter.published', 1);
|
||||
$article->setState('article.id', (int) $article_id);
|
||||
$item = $article->getItem();
|
||||
$catids = [$item->catid];
|
||||
} else {
|
||||
$catids = [$catid];
|
||||
}
|
||||
} else {
|
||||
// Return right away if show_on_article_page option is off
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Return right away if not on the category or article views
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Return right away if not on a com_content page
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$catids = $params->get('catid');
|
||||
$articles->setState('filter.category_id.include', (bool) $params->get('category_filtering_type', 1));
|
||||
break;
|
||||
}
|
||||
|
||||
// Category filter
|
||||
if ($catids) {
|
||||
if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) {
|
||||
// Get an instance of the generic categories model
|
||||
$categories = $factory->createModel('Categories', 'Site', ['ignore_request' => true]);
|
||||
$categories->setState('params', $appParams);
|
||||
$levels = $params->get('levels', 1) ?: 9999;
|
||||
$categories->setState('filter.get_children', $levels);
|
||||
$categories->setState('filter.published', 1);
|
||||
$categories->setState('filter.access', $access);
|
||||
$additional_catids = [];
|
||||
|
||||
foreach ($catids as $catid) {
|
||||
$categories->setState('filter.parentId', $catid);
|
||||
$recursive = true;
|
||||
$items = $categories->getItems($recursive);
|
||||
|
||||
if ($items) {
|
||||
foreach ($items as $category) {
|
||||
$condition = (($category->level - $categories->getParent()->level) <= $levels);
|
||||
|
||||
if ($condition) {
|
||||
$additional_catids[] = $category->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$catids = array_unique(array_merge($catids, $additional_catids));
|
||||
}
|
||||
|
||||
$articles->setState('filter.category_id', $catids);
|
||||
}
|
||||
|
||||
// Ordering
|
||||
$ordering = $params->get('article_ordering', 'a.ordering');
|
||||
|
||||
switch ($ordering) {
|
||||
case 'random':
|
||||
$articles->setState('list.ordering', $this->getDatabase()->getQuery(true)->rand());
|
||||
break;
|
||||
|
||||
case 'rating_count':
|
||||
case 'rating':
|
||||
$articles->setState('list.ordering', $ordering);
|
||||
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
|
||||
|
||||
if (!PluginHelper::isEnabled('content', 'vote')) {
|
||||
$articles->setState('list.ordering', 'a.ordering');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$articles->setState('list.ordering', $ordering);
|
||||
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter by multiple tags
|
||||
$articles->setState('filter.tag', $params->get('filter_tag', []));
|
||||
|
||||
$articles->setState('filter.featured', $params->get('show_front', 'show'));
|
||||
$articles->setState('filter.author_id', $params->get('created_by', []));
|
||||
$articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1));
|
||||
$articles->setState('filter.author_alias', $params->get('created_by_alias', []));
|
||||
$articles->setState('filter.author_alias.include', $params->get('author_alias_filtering_type', 1));
|
||||
$excluded_articles = $params->get('excluded_articles', '');
|
||||
|
||||
if ($excluded_articles) {
|
||||
$excluded_articles = explode("\r\n", $excluded_articles);
|
||||
$articles->setState('filter.article_id', $excluded_articles);
|
||||
|
||||
// Exclude
|
||||
$articles->setState('filter.article_id.include', false);
|
||||
}
|
||||
|
||||
$date_filtering = $params->get('date_filtering', 'off');
|
||||
|
||||
if ($date_filtering !== 'off') {
|
||||
$articles->setState('filter.date_filtering', $date_filtering);
|
||||
$articles->setState('filter.date_field', $params->get('date_field', 'a.created'));
|
||||
$articles->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00'));
|
||||
$articles->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59'));
|
||||
$articles->setState('filter.relative_date', $params->get('relative_date', 30));
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
$articles->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
$items = $articles->getItems();
|
||||
|
||||
// Display options
|
||||
$show_date = $params->get('show_date', 0);
|
||||
$show_date_field = $params->get('show_date_field', 'created');
|
||||
$show_date_format = $params->get('show_date_format', 'Y-m-d H:i:s');
|
||||
$show_category = $params->get('show_category', 0);
|
||||
$show_hits = $params->get('show_hits', 0);
|
||||
$show_author = $params->get('show_author', 0);
|
||||
$show_introtext = $params->get('show_introtext', 0);
|
||||
$introtext_limit = $params->get('introtext_limit', 100);
|
||||
|
||||
// Find current Article ID if on an article page
|
||||
$option = $input->get('option');
|
||||
$view = $input->get('view');
|
||||
|
||||
if ($option === 'com_content' && $view === 'article') {
|
||||
$active_article_id = $input->getInt('id');
|
||||
} else {
|
||||
$active_article_id = 0;
|
||||
}
|
||||
|
||||
// Prepare data for display using display options
|
||||
foreach ($items as &$item) {
|
||||
$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));
|
||||
} else {
|
||||
$menu = $app->getMenu();
|
||||
$menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login');
|
||||
|
||||
if (isset($menuitems[0])) {
|
||||
$Itemid = $menuitems[0]->id;
|
||||
} elseif ($input->getInt('Itemid') > 0) {
|
||||
// Use Itemid from requesting page only if there is no existing menu
|
||||
$Itemid = $input->getInt('Itemid');
|
||||
}
|
||||
|
||||
$item->link = Route::_('index.php?option=com_users&view=login&Itemid=' . $Itemid);
|
||||
}
|
||||
|
||||
// Used for styling the active article
|
||||
$item->active = $item->id == $active_article_id ? 'active' : '';
|
||||
$item->displayDate = '';
|
||||
|
||||
if ($show_date) {
|
||||
$item->displayDate = HTMLHelper::_('date', $item->$show_date_field, $show_date_format);
|
||||
}
|
||||
|
||||
if ($item->catid) {
|
||||
$item->displayCategoryLink = Route::_(RouteHelper::getCategoryRoute($item->catid, $item->category_language));
|
||||
$item->displayCategoryTitle = $show_category ? '<a href="' . $item->displayCategoryLink . '">' . $item->category_title . '</a>' : '';
|
||||
} else {
|
||||
$item->displayCategoryTitle = $show_category ? $item->category_title : '';
|
||||
}
|
||||
|
||||
$item->displayHits = $show_hits ? $item->hits : '';
|
||||
$item->displayAuthorName = $show_author ? $item->author : '';
|
||||
|
||||
if ($show_introtext) {
|
||||
$item->introtext = HTMLHelper::_('content.prepare', $item->introtext, '', 'mod_articles_category.content');
|
||||
$item->introtext = self::_cleanIntrotext($item->introtext);
|
||||
}
|
||||
|
||||
$item->displayIntrotext = $show_introtext ? self::truncate($item->introtext, $introtext_limit) : '';
|
||||
$item->displayReadmore = $item->alternative_readmore;
|
||||
}
|
||||
|
||||
// Check if items need be grouped
|
||||
$article_grouping = $params->get('article_grouping', 'none');
|
||||
$article_grouping_direction = $params->get('article_grouping_direction', 'ksort');
|
||||
$grouped = $article_grouping !== 'none';
|
||||
|
||||
if ($items && $grouped) {
|
||||
switch ($article_grouping) {
|
||||
case 'year':
|
||||
case 'month_year':
|
||||
$items = ArticlesCategoryHelper::groupByDate(
|
||||
$items,
|
||||
$article_grouping_direction,
|
||||
$article_grouping,
|
||||
$params->get('month_year_format', 'F Y'),
|
||||
$params->get('date_grouping_field', 'created')
|
||||
);
|
||||
break;
|
||||
case 'author':
|
||||
case 'category_title':
|
||||
$items = ArticlesCategoryHelper::groupBy($items, $article_grouping, $article_grouping_direction);
|
||||
break;
|
||||
case 'tags':
|
||||
$items = ArticlesCategoryHelper::groupByTags($items, $article_grouping_direction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of articles from a specific category
|
||||
*
|
||||
* @param Registry &$params object holding the models parameters
|
||||
*
|
||||
* @return array The array of users
|
||||
*
|
||||
* @since 1.6
|
||||
*
|
||||
* @deprecated 4.4.0 will be removed in 6.0
|
||||
* Use the non-static method getArticles
|
||||
* Example: Factory::getApplication()->bootModule('mod_articles_category', 'site')
|
||||
* ->getHelper('ArticlesCategoryHelper')
|
||||
* ->getArticles($params, Factory::getApplication())
|
||||
*/
|
||||
public static function getList(&$params)
|
||||
{
|
||||
/* @var SiteApplication $app */
|
||||
$app = Factory::getApplication();
|
||||
|
||||
return (new self())->getArticles($params, $app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips unnecessary tags from the introtext
|
||||
*
|
||||
* @param string $introtext introtext to sanitize
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function _cleanIntrotext($introtext)
|
||||
{
|
||||
$introtext = str_replace(['<p>', '</p>'], ' ', $introtext);
|
||||
$introtext = strip_tags($introtext, '<a><em><strong><joomla-hidden-mail>');
|
||||
|
||||
return trim($introtext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to truncate introtext
|
||||
*
|
||||
* The goal is to get the proper length plain text string with as much of
|
||||
* the html intact as possible with all tags properly closed.
|
||||
*
|
||||
* @param string $html The content of the introtext to be truncated
|
||||
* @param int $maxLength The maximum number of characters to render
|
||||
*
|
||||
* @return string The truncated string
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function truncate($html, $maxLength = 0)
|
||||
{
|
||||
$baseLength = \strlen($html);
|
||||
|
||||
// First get the plain text string. This is the rendered text we want to end up with.
|
||||
$ptString = HTMLHelper::_('string.truncate', $html, $maxLength, true, false);
|
||||
|
||||
for ($maxLength; $maxLength < $baseLength;) {
|
||||
// Now get the string if we allow html.
|
||||
$htmlString = HTMLHelper::_('string.truncate', $html, $maxLength, true, true);
|
||||
|
||||
// Now get the plain text from the html string.
|
||||
$htmlStringToPtString = HTMLHelper::_('string.truncate', $htmlString, $maxLength, true, false);
|
||||
|
||||
// If the new plain text string matches the original plain text string we are done.
|
||||
if ($ptString === $htmlStringToPtString) {
|
||||
return $htmlString;
|
||||
}
|
||||
|
||||
// Get the number of html tag characters in the first $maxlength characters
|
||||
$diffLength = \strlen($ptString) - \strlen($htmlStringToPtString);
|
||||
|
||||
// Set new $maxlength that adjusts for the html tags
|
||||
$maxLength += $diffLength;
|
||||
|
||||
if ($baseLength <= $maxLength || $diffLength <= 0) {
|
||||
return $htmlString;
|
||||
}
|
||||
}
|
||||
|
||||
return $ptString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups items by field
|
||||
*
|
||||
* @param array $list list of items
|
||||
* @param string $fieldName name of field that is used for grouping
|
||||
* @param string $direction ordering direction
|
||||
* @param null $fieldNameToKeep field name to keep
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function groupBy($list, $fieldName, $direction, $fieldNameToKeep = null)
|
||||
{
|
||||
$grouped = [];
|
||||
|
||||
if (!\is_array($list)) {
|
||||
if ($list === '') {
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
$list = [$list];
|
||||
}
|
||||
|
||||
foreach ($list as $key => $item) {
|
||||
if (!isset($grouped[$item->$fieldName])) {
|
||||
$grouped[$item->$fieldName] = [];
|
||||
}
|
||||
|
||||
if ($fieldNameToKeep === null) {
|
||||
$grouped[$item->$fieldName][$key] = $item;
|
||||
} else {
|
||||
$grouped[$item->$fieldName][$key] = $item->$fieldNameToKeep;
|
||||
}
|
||||
|
||||
unset($list[$key]);
|
||||
}
|
||||
|
||||
$direction($grouped);
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups items by date
|
||||
*
|
||||
* @param array $list list of items
|
||||
* @param string $direction ordering direction
|
||||
* @param string $type type of grouping
|
||||
* @param string $monthYearFormat date format to use
|
||||
* @param string $field date field to group by
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function groupByDate($list, $direction = 'ksort', $type = 'year', $monthYearFormat = 'F Y', $field = 'created')
|
||||
{
|
||||
$grouped = [];
|
||||
|
||||
if (!\is_array($list)) {
|
||||
if ($list === '') {
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
$list = [$list];
|
||||
}
|
||||
|
||||
foreach ($list as $key => $item) {
|
||||
switch ($type) {
|
||||
case 'month_year':
|
||||
$month_year = StringHelper::substr($item->$field, 0, 7);
|
||||
|
||||
if (!isset($grouped[$month_year])) {
|
||||
$grouped[$month_year] = [];
|
||||
}
|
||||
|
||||
$grouped[$month_year][$key] = $item;
|
||||
break;
|
||||
|
||||
default:
|
||||
$year = StringHelper::substr($item->$field, 0, 4);
|
||||
|
||||
if (!isset($grouped[$year])) {
|
||||
$grouped[$year] = [];
|
||||
}
|
||||
|
||||
$grouped[$year][$key] = $item;
|
||||
break;
|
||||
}
|
||||
|
||||
unset($list[$key]);
|
||||
}
|
||||
|
||||
$direction($grouped);
|
||||
|
||||
if ($type === 'month_year') {
|
||||
foreach ($grouped as $group => $items) {
|
||||
$date = new Date($group);
|
||||
$formatted_group = $date->format($monthYearFormat);
|
||||
$grouped[$formatted_group] = $items;
|
||||
|
||||
unset($grouped[$group]);
|
||||
}
|
||||
}
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups items by tags
|
||||
*
|
||||
* @param array $list list of items
|
||||
* @param string $direction ordering direction
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public static function groupByTags($list, $direction = 'ksort')
|
||||
{
|
||||
$grouped = [];
|
||||
$untagged = [];
|
||||
|
||||
if (!$list) {
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
foreach ($list as $item) {
|
||||
if ($item->tags->itemTags) {
|
||||
foreach ($item->tags->itemTags as $tag) {
|
||||
$grouped[$tag->title][] = $item;
|
||||
}
|
||||
} else {
|
||||
$untagged[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
$direction($grouped);
|
||||
|
||||
if ($untagged) {
|
||||
$grouped['MOD_ARTICLES_CATEGORY_UNTAGGED'] = $untagged;
|
||||
}
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
}
|
||||
35
modules/mod_articles_category/tmpl/default.php
Normal file
35
modules/mod_articles_category/tmpl/default.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_category
|
||||
*
|
||||
* @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\Helper\ModuleHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
if (!$list) {
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<ul class="mod-articlescategory category-module mod-list">
|
||||
<?php if ($grouped) : ?>
|
||||
<?php foreach ($list as $groupName => $items) : ?>
|
||||
<li>
|
||||
<div class="mod-articles-category-group"><?php echo Text::_($groupName); ?></div>
|
||||
<ul>
|
||||
<?php require ModuleHelper::getLayoutPath('mod_articles_category', $params->get('layout', 'default') . '_items'); ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<?php $items = $list; ?>
|
||||
<?php require ModuleHelper::getLayoutPath('mod_articles_category', $params->get('layout', 'default') . '_items'); ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
84
modules/mod_articles_category/tmpl/default_items.php
Normal file
84
modules/mod_articles_category/tmpl/default_items.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_category
|
||||
*
|
||||
* @copyright (C) 2020 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;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
?>
|
||||
<?php foreach ($items as $item) : ?>
|
||||
<li>
|
||||
<?php if ($params->get('link_titles') == 1) : ?>
|
||||
<?php $attributes = ['class' => 'mod-articles-category-title ' . $item->active]; ?>
|
||||
<?php $link = htmlspecialchars($item->link, ENT_COMPAT, 'UTF-8', false); ?>
|
||||
<?php $title = htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8', false); ?>
|
||||
<?php echo HTMLHelper::_('link', $link, $title, $attributes); ?>
|
||||
<?php else : ?>
|
||||
<?php echo $item->title; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayHits) : ?>
|
||||
<span class="mod-articles-category-hits">
|
||||
(<?php echo $item->displayHits; ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_author')) : ?>
|
||||
<span class="mod-articles-category-writtenby">
|
||||
<?php echo $item->displayAuthorName; ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayCategoryTitle) : ?>
|
||||
<span class="mod-articles-category-category">
|
||||
(<?php echo $item->displayCategoryTitle; ?>)
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayDate) : ?>
|
||||
<span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_tags', 0) && $item->tags->itemTags) : ?>
|
||||
<div class="mod-articles-category-tags">
|
||||
<?php echo LayoutHelper::render('joomla.content.tags', $item->tags->itemTags); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_introtext')) : ?>
|
||||
<p class="mod-articles-category-introtext">
|
||||
<?php echo $item->displayIntrotext; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_readmore')) : ?>
|
||||
<p class="mod-articles-category-readmore">
|
||||
<a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
|
||||
<?php if ($item->params->get('access-view') == false) : ?>
|
||||
<?php echo Text::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE'); ?>
|
||||
<?php elseif ($item->alternative_readmore) : ?>
|
||||
<?php echo $item->alternative_readmore; ?>
|
||||
<?php echo HTMLHelper::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
|
||||
<?php if ($params->get('show_readmore_title', 0)) : ?>
|
||||
<?php echo HTMLHelper::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($params->get('show_readmore_title', 0)) : ?>
|
||||
<?php echo Text::_('MOD_ARTICLES_CATEGORY_READ_MORE'); ?>
|
||||
<?php echo HTMLHelper::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
|
||||
<?php else : ?>
|
||||
<?php echo Text::_('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE'); ?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
143
modules/mod_articles_latest/mod_articles_latest.xml
Normal file
143
modules/mod_articles_latest/mod_articles_latest.xml
Normal file
@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_articles_latest</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2004-07</creationDate>
|
||||
<copyright>(C) 2005 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_LATEST_NEWS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\ArticlesLatest</namespace>
|
||||
<files>
|
||||
<folder module="mod_articles_latest">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_articles_latest.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_articles_latest.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Articles_-_Latest" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
label="JCATEGORY"
|
||||
extension="com_content"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
filter="intarray"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_LATEST_NEWS_FIELD_COUNT_LABEL"
|
||||
default="5"
|
||||
filter="integer"
|
||||
min="1"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_featured"
|
||||
type="list"
|
||||
label="MOD_LATEST_NEWS_FIELD_FEATURED_LABEL"
|
||||
default=""
|
||||
filter="integer"
|
||||
validate="options"
|
||||
>
|
||||
<option value="">JSHOW</option>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">MOD_LATEST_NEWS_VALUE_ONLY_SHOW_FEATURED</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="ordering"
|
||||
type="list"
|
||||
label="MOD_LATEST_NEWS_FIELD_ORDERING_LABEL"
|
||||
default="p_dsc"
|
||||
validate="options"
|
||||
>
|
||||
<option value="c_dsc">MOD_LATEST_NEWS_VALUE_RECENT_ADDED</option>
|
||||
<option value="m_dsc">MOD_LATEST_NEWS_VALUE_RECENT_MODIFIED</option>
|
||||
<option value="p_dsc">MOD_LATEST_NEWS_VALUE_RECENT_PUBLISHED</option>
|
||||
<option value="mc_dsc">MOD_LATEST_NEWS_VALUE_RECENT_TOUCHED</option>
|
||||
<option value="random">MOD_LATEST_NEWS_VALUE_RECENT_RAND</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="user_id"
|
||||
type="list"
|
||||
label="MOD_LATEST_NEWS_FIELD_USER_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">MOD_LATEST_NEWS_VALUE_ANYONE</option>
|
||||
<option value="by_me">MOD_LATEST_NEWS_VALUE_ADDED_BY_ME</option>
|
||||
<option value="not_me">MOD_LATEST_NEWS_VALUE_NOTADDED_BY_ME</option>
|
||||
<option value="created_by">MOD_LATEST_NEWS_VALUE_CREATED_BY</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="author"
|
||||
type="author"
|
||||
label="MOD_LATEST_NEWS_FIELD_AUTHOR_LABEL"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
showon="user_id:created_by"
|
||||
/>
|
||||
</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="static"
|
||||
>
|
||||
<option value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
modules/mod_articles_latest/services/provider.php
Normal file
41
modules/mod_articles_latest/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_latest
|
||||
*
|
||||
* @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 latest 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\\ArticlesLatest'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\ArticlesLatest\\Site\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
45
modules/mod_articles_latest/src/Dispatcher/Dispatcher.php
Normal file
45
modules/mod_articles_latest/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_latest
|
||||
*
|
||||
* @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\ArticlesLatest\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_latest
|
||||
*
|
||||
* @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('ArticlesLatestHelper')->getArticles($data['params'], $this->getApplication());
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
169
modules/mod_articles_latest/src/Helper/ArticlesLatestHelper.php
Normal file
169
modules/mod_articles_latest/src/Helper/ArticlesLatestHelper.php
Normal file
@ -0,0 +1,169 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_latest
|
||||
*
|
||||
* @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\ArticlesLatest\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Access\Access;
|
||||
use Joomla\CMS\Application\SiteApplication;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Content\Site\Helper\RouteHelper;
|
||||
use Joomla\Component\Content\Site\Model\ArticlesModel;
|
||||
use Joomla\Database\DatabaseAwareInterface;
|
||||
use Joomla\Database\DatabaseAwareTrait;
|
||||
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_articles_latest
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class ArticlesLatestHelper implements DatabaseAwareInterface
|
||||
{
|
||||
use DatabaseAwareTrait;
|
||||
|
||||
/**
|
||||
* Retrieve a list of article
|
||||
*
|
||||
* @param Registry $params The module parameters.
|
||||
* @param ArticlesModel $model The model.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 4.2.0
|
||||
*/
|
||||
public function getArticles(Registry $params, SiteApplication $app)
|
||||
{
|
||||
// Get the Dbo and User object
|
||||
$db = $this->getDatabase();
|
||||
$user = $app->getIdentity();
|
||||
|
||||
/** @var ArticlesModel $model */
|
||||
$model = $app->bootComponent('com_content')->getMVCFactory()->createModel('Articles', 'Site', ['ignore_request' => true]);
|
||||
|
||||
// Set application parameters in model
|
||||
$model->setState('params', $app->getParams());
|
||||
|
||||
$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($user->id);
|
||||
$model->setState('filter.access', $access);
|
||||
|
||||
// Category filter
|
||||
$model->setState('filter.category_id', $params->get('catid', []));
|
||||
|
||||
// State filter
|
||||
$model->setState('filter.condition', 1);
|
||||
|
||||
// User filter
|
||||
$userId = $user->id;
|
||||
|
||||
switch ($params->get('user_id')) {
|
||||
case 'by_me':
|
||||
$model->setState('filter.author_id', (int) $userId);
|
||||
break;
|
||||
case 'not_me':
|
||||
$model->setState('filter.author_id', $userId);
|
||||
$model->setState('filter.author_id.include', false);
|
||||
break;
|
||||
|
||||
case 'created_by':
|
||||
$model->setState('filter.author_id', $params->get('author', []));
|
||||
break;
|
||||
|
||||
case '0':
|
||||
break;
|
||||
|
||||
default:
|
||||
$model->setState('filter.author_id', (int) $params->get('user_id'));
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
$model->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
// 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');
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
$order_map = [
|
||||
'm_dsc' => 'a.modified DESC, a.created',
|
||||
'mc_dsc' => 'a.modified',
|
||||
'c_dsc' => 'a.created',
|
||||
'p_dsc' => 'a.publish_up',
|
||||
'random' => $db->getQuery(true)->rand(),
|
||||
];
|
||||
|
||||
$ordering = ArrayHelper::getValue($order_map, $params->get('ordering', 'p_dsc'), 'a.publish_up');
|
||||
$dir = 'DESC';
|
||||
|
||||
$model->setState('list.ordering', $ordering);
|
||||
$model->setState('list.direction', $dir);
|
||||
|
||||
$items = $model->getItems();
|
||||
|
||||
foreach ($items as &$item) {
|
||||
$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));
|
||||
} else {
|
||||
$item->link = Route::_('index.php?option=com_users&view=login');
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a list of articles
|
||||
*
|
||||
* @param Registry $params The module parameters.
|
||||
* @param ArticlesModel $model The model.
|
||||
*
|
||||
* @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_latest', 'site')
|
||||
* ->getHelper('ArticlesLatestHelper')
|
||||
* ->getArticles($params, Factory::getApplication())
|
||||
*/
|
||||
public static function getList(Registry $params, ArticlesModel $model)
|
||||
{
|
||||
return (new self())->getArticles($params, Factory::getApplication());
|
||||
}
|
||||
}
|
||||
28
modules/mod_articles_latest/tmpl/default.php
Normal file
28
modules/mod_articles_latest/tmpl/default.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_latest
|
||||
*
|
||||
* @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;
|
||||
|
||||
if (!$list) {
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<ul class="mod-articleslatest latestnews mod-list">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li itemscope itemtype="https://schema.org/Article">
|
||||
<a href="<?php echo $item->link; ?>" itemprop="url">
|
||||
<span itemprop="name">
|
||||
<?php echo $item->title; ?>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
274
modules/mod_articles_news/mod_articles_news.xml
Normal file
274
modules/mod_articles_news/mod_articles_news.xml
Normal 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>
|
||||
41
modules/mod_articles_news/services/provider.php
Normal file
41
modules/mod_articles_news/services/provider.php
Normal 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());
|
||||
}
|
||||
};
|
||||
45
modules/mod_articles_news/src/Dispatcher/Dispatcher.php
Normal file
45
modules/mod_articles_news/src/Dispatcher/Dispatcher.php
Normal 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;
|
||||
}
|
||||
}
|
||||
209
modules/mod_articles_news/src/Helper/ArticlesNewsHelper.php
Normal file
209
modules/mod_articles_news/src/Helper/ArticlesNewsHelper.php
Normal 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());
|
||||
}
|
||||
}
|
||||
59
modules/mod_articles_news/tmpl/_item.php
Normal file
59
modules/mod_articles_news/tmpl/_item.php
Normal 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; ?>
|
||||
26
modules/mod_articles_news/tmpl/default.php
Normal file
26
modules/mod_articles_news/tmpl/default.php
Normal 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>
|
||||
30
modules/mod_articles_news/tmpl/horizontal.php
Normal file
30
modules/mod_articles_news/tmpl/horizontal.php
Normal 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>
|
||||
35
modules/mod_articles_news/tmpl/vertical.php
Normal file
35
modules/mod_articles_news/tmpl/vertical.php
Normal 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"> </span>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
||||
165
modules/mod_articles_popular/mod_articles_popular.xml
Normal file
165
modules/mod_articles_popular/mod_articles_popular.xml
Normal file
@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_articles_popular</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_POPULAR_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\ArticlesPopular</namespace>
|
||||
<files>
|
||||
<folder module="mod_articles_popular">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_articles_popular.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_articles_popular.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Articles_-_Most_Read" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
label="JCATEGORY"
|
||||
extension="com_content"
|
||||
multiple="true"
|
||||
filter="intarray"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_POPULAR_FIELD_COUNT_LABEL"
|
||||
default="5"
|
||||
filter="integer"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_front"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_POPULAR_FIELD_FEATURED_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="basicspacer1"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="date_filtering"
|
||||
type="list"
|
||||
label="MOD_POPULAR_FIELD_DATEFILTERING_LABEL"
|
||||
default="off"
|
||||
validate="options"
|
||||
>
|
||||
<option value="off">MOD_POPULAR_OPTION_OFF_VALUE</option>
|
||||
<option value="range">MOD_POPULAR_OPTION_DATERANGE_VALUE</option>
|
||||
<option value="relative">MOD_POPULAR_OPTION_RELATIVEDAY_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="date_field"
|
||||
type="list"
|
||||
label="MOD_POPULAR_FIELD_DATEFIELD_LABEL"
|
||||
default="a.created"
|
||||
showon="date_filtering:range,relative"
|
||||
validate="options"
|
||||
>
|
||||
<option value="a.created">MOD_POPULAR_OPTION_CREATED_VALUE</option>
|
||||
<option value="a.modified">MOD_POPULAR_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="a.publish_up">MOD_POPULAR_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="start_date_range"
|
||||
type="calendar"
|
||||
label="MOD_POPULAR_FIELD_STARTDATE_LABEL"
|
||||
translateformat="true"
|
||||
showtime="true"
|
||||
filter="user_utc"
|
||||
showon="date_filtering:range"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="end_date_range"
|
||||
type="calendar"
|
||||
label="MOD_POPULAR_FIELD_ENDDATE_LABEL"
|
||||
translateformat="true"
|
||||
showtime="true"
|
||||
filter="user_utc"
|
||||
showon="date_filtering:range"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="relative_date"
|
||||
type="number"
|
||||
label="MOD_POPULAR_FIELD_RELATIVEDATE_LABEL"
|
||||
default="30"
|
||||
filter="integer"
|
||||
showon="date_filtering:relative"
|
||||
/>
|
||||
</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="static"
|
||||
>
|
||||
<option value="static"></option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
modules/mod_articles_popular/services/provider.php
Normal file
41
modules/mod_articles_popular/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_popular
|
||||
*
|
||||
* @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 popular articles module service provider.
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\ArticlesPopular'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\ArticlesPopular\\Site\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
51
modules/mod_articles_popular/src/Dispatcher/Dispatcher.php
Normal file
51
modules/mod_articles_popular/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_popular
|
||||
*
|
||||
* @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\ArticlesPopular\Site\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Dispatcher class for mod_articles_popular
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
|
||||
{
|
||||
use HelperFactoryAwareTrait;
|
||||
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
protected function getLayoutData()
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
|
||||
if (!ComponentHelper::getParams('com_content')->get('record_hits', 1)) {
|
||||
$data['hitsDisabledMessage'] = Text::_('JGLOBAL_RECORD_HITS_DISABLED');
|
||||
} else {
|
||||
$data['list'] = $this->getHelperFactory()->getHelper('ArticlesPopularHelper', $data)->getArticles($data['params'], $data['app']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_popular
|
||||
*
|
||||
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\ArticlesPopular\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Access\Access;
|
||||
use Joomla\CMS\Application\SiteApplication;
|
||||
use Joomla\CMS\Cache\CacheControllerFactoryInterface;
|
||||
use Joomla\CMS\Cache\Controller\OutputController;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Content\Administrator\Extension\ContentComponent;
|
||||
use Joomla\Component\Content\Site\Helper\RouteHelper;
|
||||
use Joomla\Component\Content\Site\Model\ArticlesModel;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_articles_popular
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
class ArticlesPopularHelper
|
||||
{
|
||||
/**
|
||||
* The module instance
|
||||
*
|
||||
* @var \stdClass
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
protected $module;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function __construct($config = [])
|
||||
{
|
||||
$this->module = $config['module'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a list of months with archived articles
|
||||
*
|
||||
* @param Registry $params The module parameters.
|
||||
* @param SiteApplication $app The current application.
|
||||
*
|
||||
* @return object[]
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function getArticles(Registry $moduleParams, SiteApplication $app)
|
||||
{
|
||||
$cacheKey = md5(serialize([$moduleParams->toString(), $this->module->module, $this->module->id]));
|
||||
|
||||
/** @var OutputController $cache */
|
||||
$cache = Factory::getContainer()->get(CacheControllerFactoryInterface::class)
|
||||
->createCacheController('output', ['defaultgroup' => 'mod_articles_popular']);
|
||||
|
||||
if (!$cache->contains($cacheKey)) {
|
||||
$mvcContentFactory = $app->bootComponent('com_content')->getMVCFactory();
|
||||
|
||||
/** @var ArticlesModel $articlesModel */
|
||||
$articlesModel = $mvcContentFactory->createModel('Articles', 'Site', ['ignore_request' => true]);
|
||||
|
||||
// Set application parameters in model
|
||||
$appParams = $app->getParams();
|
||||
$articlesModel->setState('params', $appParams);
|
||||
|
||||
$articlesModel->setState('list.start', 0);
|
||||
$articlesModel->setState('filter.published', ContentComponent::CONDITION_PUBLISHED);
|
||||
|
||||
// Set the filters based on the module params
|
||||
$articlesModel->setState('list.limit', (int) $moduleParams->get('count', 5));
|
||||
$articlesModel->setState('filter.featured', $moduleParams->get('show_front', 1) == 1 ? 'show' : 'hide');
|
||||
|
||||
// This module does not use tags data
|
||||
$articlesModel->setState('load_tags', false);
|
||||
|
||||
// Access filter
|
||||
$access = !ComponentHelper::getParams('com_content')->get('show_noauth');
|
||||
$articlesModel->setState('filter.access', $access);
|
||||
|
||||
// Category filter
|
||||
$articlesModel->setState('filter.category_id', $moduleParams->get('catid', []));
|
||||
|
||||
// Date filter
|
||||
$date_filtering = $moduleParams->get('date_filtering', 'off');
|
||||
|
||||
if ($date_filtering !== 'off') {
|
||||
$articlesModel->setState('filter.date_filtering', $date_filtering);
|
||||
$articlesModel->setState('filter.date_field', $moduleParams->get('date_field', 'a.created'));
|
||||
$articlesModel->setState('filter.start_date_range', $moduleParams->get('start_date_range', '1000-01-01 00:00:00'));
|
||||
$articlesModel->setState('filter.end_date_range', $moduleParams->get('end_date_range', '9999-12-31 23:59:59'));
|
||||
$articlesModel->setState('filter.relative_date', $moduleParams->get('relative_date', 30));
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
$articlesModel->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
// Ordering
|
||||
$articlesModel->setState('list.ordering', 'a.hits');
|
||||
$articlesModel->setState('list.direction', 'DESC');
|
||||
|
||||
// Prepare the module output
|
||||
$items = [];
|
||||
$itemParams = new \stdClass();
|
||||
|
||||
$itemParams->authorised = Access::getAuthorisedViewLevels($app->getIdentity()->get('id'));
|
||||
$itemParams->access = $access;
|
||||
|
||||
foreach ($articlesModel->getItems() as $item) {
|
||||
$items[] = $this->prepareItem($item, $itemParams);
|
||||
}
|
||||
|
||||
// Cache the output and return
|
||||
$cache->store($items, $cacheKey);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
// Return the cached output
|
||||
return $cache->get($cacheKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the article before render.
|
||||
*
|
||||
* @param object $item The article to prepare
|
||||
* @param \stdClass $params The model item
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
private function prepareItem($item, $params): object
|
||||
{
|
||||
$item->slug = $item->id . ':' . $item->alias;
|
||||
|
||||
if ($params->access || \in_array($item->access, $params->authorised)) {
|
||||
// We know that user has the privilege to view the article
|
||||
$item->link = Route::_(RouteHelper::getArticleRoute($item->slug, $item->catid, $item->language));
|
||||
} else {
|
||||
$item->link = Route::_('index.php?option=com_users&view=login');
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of popular articles from the articles model
|
||||
*
|
||||
* @param \Joomla\Registry\Registry &$params object holding the models parameters
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 4.3.0
|
||||
*
|
||||
* @deprecated 4.3 will be removed in 6.0
|
||||
* Use the non-static method getArticles
|
||||
* Example: Factory::getApplication()->bootModule('mod_articles_popular', 'site')
|
||||
* ->getHelper('ArticlesPopularHelper')
|
||||
* ->getArticles($params, Factory::getApplication())
|
||||
*/
|
||||
public static function getList(&$params)
|
||||
{
|
||||
return (new self())->getArticles($params, Factory::getApplication());
|
||||
}
|
||||
}
|
||||
31
modules/mod_articles_popular/tmpl/default.php
Normal file
31
modules/mod_articles_popular/tmpl/default.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles_popular
|
||||
*
|
||||
* @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;
|
||||
|
||||
if (!isset($list)) {
|
||||
if (isset($hitsDisabledMessage)) {
|
||||
echo $hitsDisabledMessage;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<ul class="mostread mod-list">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li itemscope itemtype="https://schema.org/Article">
|
||||
<a href="<?php echo $item->link; ?>" itemprop="url">
|
||||
<span itemprop="name">
|
||||
<?php echo $item->title; ?>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
154
modules/mod_banners/mod_banners.xml
Normal file
154
modules/mod_banners/mod_banners.xml
Normal file
@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_banners</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_BANNERS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Banners</namespace>
|
||||
<files>
|
||||
<folder module="mod_banners">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_banners.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_banners.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Banners" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset
|
||||
name="basic"
|
||||
addfieldprefix="Joomla\Component\Banners\Administrator\Field"
|
||||
>
|
||||
|
||||
<field
|
||||
name="target"
|
||||
type="list"
|
||||
label="MOD_BANNERS_FIELD_TARGET_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JBROWSERTARGET_PARENT</option>
|
||||
<option value="1">JBROWSERTARGET_NEW</option>
|
||||
<option value="2">JBROWSERTARGET_POPUP</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_BANNERS_FIELD_COUNT_LABEL"
|
||||
description="MOD_BANNERS_FIELD_COUNT_DESC"
|
||||
default="5"
|
||||
filter="integer"
|
||||
class="validate-numeric"
|
||||
min="1"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="cid"
|
||||
type="bannerclient"
|
||||
label="MOD_BANNERS_FIELD_BANNERCLIENT_LABEL"
|
||||
description="MOD_BANNERS_FIELD_BANNERCLIENT_DESC"
|
||||
filter="integer"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
label="JCATEGORY"
|
||||
extension="com_banners"
|
||||
multiple="true"
|
||||
filter="intarray"
|
||||
class="multipleCategories"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="tag_search"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_BANNERS_FIELD_TAG_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="ordering"
|
||||
type="list"
|
||||
label="MOD_BANNERS_FIELD_RANDOMISE_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">MOD_BANNERS_VALUE_STICKYORDERING</option>
|
||||
<option value="random">MOD_BANNERS_VALUE_STICKYRANDOMISE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="header_text"
|
||||
type="textarea"
|
||||
label="MOD_BANNERS_FIELD_HEADER_LABEL"
|
||||
filter="safehtml"
|
||||
rows="3"
|
||||
cols="40"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="footer_text"
|
||||
type="textarea"
|
||||
label="MOD_BANNERS_FIELD_FOOTER_LABEL"
|
||||
filter="safehtml"
|
||||
rows="3"
|
||||
cols="40"
|
||||
/>
|
||||
</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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
modules/mod_banners/services/provider.php
Normal file
41
modules/mod_banners/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_banners
|
||||
*
|
||||
* @copyright (C) 2023 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 banners 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): void
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Banners'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Banners\\Site\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
50
modules/mod_banners/src/Dispatcher/Dispatcher.php
Normal file
50
modules/mod_banners/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_banners
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Banners\Site\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
|
||||
use Joomla\Component\Banners\Administrator\Helper\BannersHelper as BannersComponentHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Dispatcher class for mod_banners
|
||||
*
|
||||
* @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(): array
|
||||
{
|
||||
BannersComponentHelper::updateReset();
|
||||
|
||||
$data = parent::getLayoutData();
|
||||
|
||||
$data['headerText'] = trim($data['params']->get('header_text', ''));
|
||||
$data['footerText'] = trim($data['params']->get('footer_text', ''));
|
||||
$data['list'] = $this->getHelperFactory()->getHelper('BannersHelper')->getBanners($data['params'], $this->getApplication());
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
89
modules/mod_banners/src/Helper/BannersHelper.php
Normal file
89
modules/mod_banners/src/Helper/BannersHelper.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_banners
|
||||
*
|
||||
* @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\Banners\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Environment\Browser;
|
||||
use Joomla\Component\Banners\Site\Model\BannersModel;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_banners
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
class BannersHelper
|
||||
{
|
||||
/**
|
||||
* Retrieve list of banners
|
||||
*
|
||||
* @param Registry $params The module parameters
|
||||
* @param CMSApplication $app The application
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 5.1.0
|
||||
*/
|
||||
public function getBanners(Registry $params, CMSApplication $app)
|
||||
{
|
||||
/** @var BannersModel $model */
|
||||
$model = $app->bootComponent('com_banners')->getMVCFactory()->createModel('Banners', 'Site', ['ignore_request' => true]);
|
||||
|
||||
$keywords = explode(',', $app->getDocument()->getMetaData('keywords'));
|
||||
$config = ComponentHelper::getParams('com_banners');
|
||||
|
||||
$model->setState('filter.client_id', (int) $params->get('cid'));
|
||||
$model->setState('filter.category_id', $params->get('catid', []));
|
||||
$model->setState('list.limit', (int) $params->get('count', 1));
|
||||
$model->setState('list.start', 0);
|
||||
$model->setState('filter.ordering', $params->get('ordering'));
|
||||
$model->setState('filter.tag_search', $params->get('tag_search'));
|
||||
$model->setState('filter.keywords', $keywords);
|
||||
$model->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
$banners = $model->getItems();
|
||||
|
||||
if ($banners) {
|
||||
if ($config->get('track_robots_impressions', 1) == 1 || !Browser::getInstance()->isRobot()) {
|
||||
$model->impress();
|
||||
}
|
||||
}
|
||||
|
||||
return $banners;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve list of banners
|
||||
*
|
||||
* @param Registry $params The module parameters
|
||||
* @param BannersModel $model The model
|
||||
* @param CMSApplication $app The application
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @deprecated 5.1.0 will be removed in 7.0
|
||||
* Use the non-static method getBanners
|
||||
* Example: Factory::getApplication()->bootModule('mod_banners', 'site')
|
||||
* ->getHelper('BannersHelper')
|
||||
* ->getBanners($params, Factory::getApplication())
|
||||
*/
|
||||
public static function getList(Registry $params, BannersModel $model, CMSApplication $app)
|
||||
{
|
||||
return (new self())->getBanners($params, $app);
|
||||
}
|
||||
}
|
||||
96
modules/mod_banners/tmpl/default.php
Normal file
96
modules/mod_banners/tmpl/default.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_banners
|
||||
*
|
||||
* @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\MediaHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
?>
|
||||
<div class="mod-banners bannergroup">
|
||||
<?php if ($headerText) : ?>
|
||||
<div class="bannerheader">
|
||||
<?php echo $headerText; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<div class="mod-banners__item banneritem">
|
||||
<?php $link = Route::_('index.php?option=com_banners&task=click&id=' . $item->id); ?>
|
||||
<?php if ($item->type == 1) : ?>
|
||||
<?php // Text based banners ?>
|
||||
<?php echo str_replace(['{CLICKURL}', '{NAME}'], [$link, $item->name], $item->custombannercode); ?>
|
||||
<?php else : ?>
|
||||
<?php $imageobject = HTMLHelper::cleanImageURL($item->params->get('imageurl')); ?>
|
||||
<?php $imageurl = $imageobject->url; ?>
|
||||
<?php if (!empty($imageurl) && (MediaHelper::isImage($imageurl) || MediaHelper::getMimeType($imageurl) === 'image/svg+xml')) : ?>
|
||||
<?php // Image based banner ?>
|
||||
<?php $baseurl = strpos($imageurl, 'http') === 0 ? '' : Uri::base(); ?>
|
||||
<?php $alt = $item->params->get('alt'); ?>
|
||||
<?php $alt = $alt ?: $item->name; ?>
|
||||
<?php $alt = $alt ?: Text::_('MOD_BANNERS_BANNER'); ?>
|
||||
<?php $width = $item->params->get('width'); ?>
|
||||
<?php $height = $item->params->get('height'); ?>
|
||||
<?php $imageAttribs = [
|
||||
'src' => $baseurl . $imageurl,
|
||||
'alt' => $alt
|
||||
];?>
|
||||
<?php if (!empty($width)) : ?>
|
||||
<?php $imageAttribs['width'] = $width; ?>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($height)) : ?>
|
||||
<?php $imageAttribs['height'] = $height; ?>
|
||||
<?php endif; ?>
|
||||
<?php $image = LayoutHelper::render('joomla.html.image', $imageAttribs); ?>
|
||||
<?php if ($item->clickurl) : ?>
|
||||
<?php // Wrap the banner in a link ?>
|
||||
<?php $target = $params->get('target', 1); ?>
|
||||
<?php if ($target == 1) : ?>
|
||||
<?php // Open in a new window ?>
|
||||
<a
|
||||
href="<?php echo $link; ?>" target="_blank" rel="noopener noreferrer"
|
||||
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<?php echo $image; ?>
|
||||
</a>
|
||||
<?php elseif ($target == 2) : ?>
|
||||
<?php // Open in a popup window ?>
|
||||
<a
|
||||
href="<?php echo $link; ?>" onclick="window.open(this.href, '',
|
||||
'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550');
|
||||
return false"
|
||||
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<?php echo $image; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php // Open in parent window ?>
|
||||
<a
|
||||
href="<?php echo $link; ?>"
|
||||
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<?php echo $image; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<?php // Just display the image if no link specified ?>
|
||||
<?php echo $image; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ($footerText) : ?>
|
||||
<div class="mod-banners__footer bannerfooter">
|
||||
<?php echo $footerText; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
117
modules/mod_breadcrumbs/mod_breadcrumbs.xml
Normal file
117
modules/mod_breadcrumbs/mod_breadcrumbs.xml
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_breadcrumbs</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_BREADCRUMBS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Breadcrumbs</namespace>
|
||||
<files>
|
||||
<folder module="mod_breadcrumbs">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_breadcrumbs.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_breadcrumbs.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Breadcrumbs" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="showHere"
|
||||
type="radio"
|
||||
label="MOD_BREADCRUMBS_FIELD_SHOWHERE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="showHome"
|
||||
type="radio"
|
||||
label="MOD_BREADCRUMBS_FIELD_SHOWHOME_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="homeText"
|
||||
type="text"
|
||||
label="MOD_BREADCRUMBS_FIELD_HOMETEXT_LABEL"
|
||||
description="MOD_BREADCRUMBS_FIELD_HOMETEXT_DESC"
|
||||
showon="showHome:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="showLast"
|
||||
type="radio"
|
||||
label="MOD_BREADCRUMBS_FIELD_SHOWLAST_LABEL"
|
||||
default="1"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</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="0"
|
||||
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="0"
|
||||
filter="integer"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="itemid"
|
||||
>
|
||||
<option value="itemid"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
modules/mod_breadcrumbs/services/provider.php
Normal file
41
modules/mod_breadcrumbs/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
*
|
||||
* @copyright (C) 2023 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 breadcrumbs module service provider.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function register(Container $container): void
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Breadcrumbs'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Breadcrumbs\\Site\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
50
modules/mod_breadcrumbs/src/Dispatcher/Dispatcher.php
Normal file
50
modules/mod_breadcrumbs/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Breadcrumbs\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_breadcrumbs
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
|
||||
{
|
||||
use HelperFactoryAwareTrait;
|
||||
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
protected function getLayoutData(): array
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
|
||||
$data['list'] = $this->getHelperFactory()->getHelper('BreadcrumbsHelper')->getBreadcrumbs($data['params'], $data['app']);
|
||||
$data['count'] = \count($data['list']);
|
||||
|
||||
if (!$data['params']->get('showHome', 1)) {
|
||||
$data['homeCrumb'] = $this->getHelperFactory()->getHelper('BreadcrumbsHelper')->getHomeItem($data['params'], $data['app']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
162
modules/mod_breadcrumbs/src/Helper/BreadcrumbsHelper.php
Normal file
162
modules/mod_breadcrumbs/src/Helper/BreadcrumbsHelper.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
*
|
||||
* @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\Breadcrumbs\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Application\SiteApplication;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Multilanguage;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_breadcrumbs
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
class BreadcrumbsHelper
|
||||
{
|
||||
/**
|
||||
* Retrieve breadcrumb items
|
||||
*
|
||||
* @param Registry $params The module parameters
|
||||
* @param SiteApplication $app The application
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function getBreadcrumbs(Registry $params, SiteApplication $app): array
|
||||
{
|
||||
// Get the PathWay object from the application
|
||||
$pathway = $app->getPathway();
|
||||
$items = $pathway->getPathway();
|
||||
$count = \count($items);
|
||||
|
||||
// Don't use $items here as it references JPathway properties directly
|
||||
$crumbs = [];
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$crumbs[$i] = new \stdClass();
|
||||
$crumbs[$i]->name = stripslashes(htmlspecialchars($items[$i]->name, ENT_COMPAT, 'UTF-8'));
|
||||
$crumbs[$i]->link = $items[$i]->link;
|
||||
}
|
||||
|
||||
if ($params->get('showHome', 1)) {
|
||||
array_unshift($crumbs, $this->getHomeItem($params, $app));
|
||||
}
|
||||
|
||||
return $crumbs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve home item (start page)
|
||||
*
|
||||
* @param Registry $params The module parameters
|
||||
* @param SiteApplication $app The application
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function getHomeItem(Registry $params, SiteApplication $app): object
|
||||
{
|
||||
$menu = $app->getMenu();
|
||||
|
||||
if (Multilanguage::isEnabled()) {
|
||||
$home = $menu->getDefault($app->getLanguage()->getTag());
|
||||
} else {
|
||||
$home = $menu->getDefault();
|
||||
}
|
||||
|
||||
$item = new \stdClass();
|
||||
$item->name = htmlspecialchars($params->get('homeText', $app->getLanguage()->_('MOD_BREADCRUMBS_HOME')), ENT_COMPAT, 'UTF-8');
|
||||
$item->link = 'index.php?Itemid=' . $home->id;
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the breadcrumbs separator for the breadcrumbs display.
|
||||
*
|
||||
* @param string $custom Custom xhtml compliant string to separate the items of the breadcrumbs
|
||||
*
|
||||
* @return string Separator string
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @deprecated 4.4.0 will be removed in 6.0 as this function is not used anymore
|
||||
*/
|
||||
public static function setSeparator($custom = null)
|
||||
{
|
||||
$lang = Factory::getApplication()->getLanguage();
|
||||
|
||||
// If a custom separator has not been provided we try to load a template
|
||||
// specific one first, and if that is not present we load the default separator
|
||||
if ($custom === null) {
|
||||
if ($lang->isRtl()) {
|
||||
$_separator = HTMLHelper::_('image', 'system/arrow_rtl.png', null, null, true);
|
||||
} else {
|
||||
$_separator = HTMLHelper::_('image', 'system/arrow.png', null, null, true);
|
||||
}
|
||||
} else {
|
||||
$_separator = htmlspecialchars($custom, ENT_COMPAT, 'UTF-8');
|
||||
}
|
||||
|
||||
return $_separator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve breadcrumb items
|
||||
*
|
||||
* @param Registry $params The module parameters
|
||||
* @param CMSApplication $app The application
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @deprecated 4.4.0 will be removed in 6.0
|
||||
* Use the non-static method getBreadcrumbs
|
||||
* Example: Factory::getApplication()->bootModule('mod_breadcrumbs', 'site')
|
||||
* ->getHelper('BreadcrumbsHelper')
|
||||
* ->getBreadcrumbs($params, Factory::getApplication())
|
||||
*/
|
||||
public static function getList(Registry $params, CMSApplication $app)
|
||||
{
|
||||
return (new self())->getBreadcrumbs($params, Factory::getApplication());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve home item (start page)
|
||||
*
|
||||
* @param Registry $params The module parameters
|
||||
* @param CMSApplication $app The application
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
* @since 4.2.0
|
||||
*
|
||||
* @deprecated 4.4.0 will be removed in 6.0
|
||||
* Use the non-static method getHomeItem
|
||||
* Example: Factory::getApplication()->bootModule('mod_breadcrumbs', 'site')
|
||||
* ->getHelper('BreadcrumbsHelper')
|
||||
* ->getHomeItem($params, Factory::getApplication())
|
||||
*/
|
||||
public static function getHome(Registry $params, CMSApplication $app)
|
||||
{
|
||||
return (new self())->getHomeItem($params, Factory::getApplication());
|
||||
}
|
||||
}
|
||||
129
modules/mod_breadcrumbs/tmpl/default.php
Normal file
129
modules/mod_breadcrumbs/tmpl/default.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_breadcrumbs
|
||||
*
|
||||
* @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;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\WebAsset\WebAssetManager;
|
||||
|
||||
?>
|
||||
<nav class="mod-breadcrumbs__wrapper" aria-label="<?php echo htmlspecialchars($module->title, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<ol class="mod-breadcrumbs breadcrumb px-3 py-2">
|
||||
<?php if ($params->get('showHere', 1)) : ?>
|
||||
<li class="mod-breadcrumbs__here float-start">
|
||||
<?php echo Text::_('MOD_BREADCRUMBS_HERE'); ?> 
|
||||
</li>
|
||||
<?php else : ?>
|
||||
<li class="mod-breadcrumbs__divider float-start">
|
||||
<span class="divider icon-location icon-fw" aria-hidden="true"></span>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
// Get rid of duplicated entries on trail including home page when using multilanguage
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if ($i === 1 && !empty($list[$i]->link) && !empty($list[$i - 1]->link) && $list[$i]->link === $list[$i - 1]->link) {
|
||||
unset($list[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Find last and penultimate items in breadcrumbs list
|
||||
end($list);
|
||||
$last_item_key = key($list);
|
||||
prev($list);
|
||||
$penult_item_key = key($list);
|
||||
|
||||
// Make a link if not the last item in the breadcrumbs
|
||||
$show_last = $params->get('showLast', 1);
|
||||
|
||||
$class = null;
|
||||
|
||||
// Generate the trail
|
||||
foreach ($list as $key => $item) :
|
||||
if ($key !== $last_item_key) :
|
||||
if (!empty($item->link)) :
|
||||
$breadcrumbItem = HTMLHelper::_('link', Route::_($item->link), '<span>' . $item->name . '</span>', ['class' => 'pathway']);
|
||||
else :
|
||||
$breadcrumbItem = '<span>' . $item->name . '</span>';
|
||||
endif;
|
||||
echo '<li class="mod-breadcrumbs__item breadcrumb-item' . $class . '">' . $breadcrumbItem . '</li>';
|
||||
elseif ($show_last) :
|
||||
// Render last item if required.
|
||||
$breadcrumbItem = '<span>' . $item->name . '</span>';
|
||||
$class = ' active';
|
||||
echo '<li class="mod-breadcrumbs__item breadcrumb-item' . $class . '">' . $breadcrumbItem . '</li>';
|
||||
endif;
|
||||
endforeach; ?>
|
||||
</ol>
|
||||
<?php
|
||||
|
||||
// Structured data as JSON
|
||||
$data = [
|
||||
'@context' => 'https://schema.org',
|
||||
'@type' => 'BreadcrumbList',
|
||||
'@id' => Uri::root() . '#/schema/BreadcrumbList/' . (int) $module->id,
|
||||
'itemListElement' => []
|
||||
];
|
||||
|
||||
// Use an independent counter for positions. E.g. if Heading items in pathway.
|
||||
$itemsCounter = 0;
|
||||
|
||||
// If showHome is disabled use the fallback $homeCrumb for startpage at first position.
|
||||
if (isset($homeCrumb)) {
|
||||
$data['itemListElement'][] = [
|
||||
'@type' => 'ListItem',
|
||||
'position' => ++$itemsCounter,
|
||||
'item' => [
|
||||
'@id' => Route::_($homeCrumb->link, true, Route::TLS_IGNORE, true),
|
||||
'name' => $homeCrumb->name,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($list as $key => $item) {
|
||||
// Only add item to JSON if it has a valid link, otherwise skip it.
|
||||
if (!empty($item->link)) {
|
||||
$data['itemListElement'][] = [
|
||||
'@type' => 'ListItem',
|
||||
'position' => ++$itemsCounter,
|
||||
'item' => [
|
||||
'@id' => Route::_($item->link, true, Route::TLS_IGNORE, true),
|
||||
'name' => $item->name,
|
||||
],
|
||||
];
|
||||
} elseif ($key === $last_item_key) {
|
||||
// Add the last item (current page) to JSON, but without a link.
|
||||
// Google accepts items without a URL only as the current page.
|
||||
$data['itemListElement'][] = [
|
||||
'@type' => 'ListItem',
|
||||
'position' => ++$itemsCounter,
|
||||
'item' => [
|
||||
'name' => $item->name,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if ($itemsCounter) {
|
||||
/** @var WebAssetManager $wa */
|
||||
$wa = $app->getDocument()->getWebAssetManager();
|
||||
$prettyPrint = JDEBUG ? JSON_PRETTY_PRINT : 0;
|
||||
$wa->addInline(
|
||||
'script',
|
||||
json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | $prettyPrint),
|
||||
['name' => 'inline.mod_breadcrumbs-schemaorg'],
|
||||
['type' => 'application/ld+json']
|
||||
);
|
||||
}
|
||||
?>
|
||||
</nav>
|
||||
BIN
modules/mod_cookiesaccept/img/close.png
Normal file
BIN
modules/mod_cookiesaccept/img/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
0
modules/mod_cookiesaccept/img/index.html
Normal file
0
modules/mod_cookiesaccept/img/index.html
Normal file
BIN
modules/mod_cookiesaccept/img/przez.png
Normal file
BIN
modules/mod_cookiesaccept/img/przez.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 B |
BIN
modules/mod_cookiesaccept/img/przez_b.png
Normal file
BIN
modules/mod_cookiesaccept/img/przez_b.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 923 B |
0
modules/mod_cookiesaccept/index.html
Normal file
0
modules/mod_cookiesaccept/index.html
Normal file
172
modules/mod_cookiesaccept/mod_cookiesaccept.php
Normal file
172
modules/mod_cookiesaccept/mod_cookiesaccept.php
Normal file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/*------------------------------------------------------------------------
|
||||
# mod_cookiesaccept
|
||||
# ------------------------------------------------------------------------
|
||||
# author Le Cinquième Crayon
|
||||
# copyright Copyright (C) 2013 Le Cinquième Crayon. All Rights Reserved.
|
||||
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||
# Websites: http://www.cinquiemecrayon.eu
|
||||
-------------------------------------------------------------------------*/
|
||||
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$document->addStyleSheet('modules/mod_cookiesaccept/screen.css');
|
||||
|
||||
if($params->get('jquery'))
|
||||
$document->addScript("http://code.jquery.com/jquery-latest.min.js");
|
||||
$color = $params->get('color');
|
||||
$position = $params->get('position');
|
||||
$enable_info = $params->get('enable_info');
|
||||
$article_info = $params->get('article_info');
|
||||
$more_info = FALSE;
|
||||
$accept = FALSE;
|
||||
$lang =& JFactory::getLanguage();
|
||||
$other_lang = $params->get('lang_code');
|
||||
$current_lang = $lang->getTag();
|
||||
//$current_lang = 'no-NO';
|
||||
$ca_banner = $params->get('ca_banner');
|
||||
$ca_banner_h2 = $params->get('ca_banner_h2');
|
||||
$ca_banner_p = $params->get('ca_banner_p');
|
||||
$ca_banner_p_span = $params->get('ca_banner_p_span');
|
||||
$ca_banner_div_accept = $params->get('ca_banner_div_accept');
|
||||
$ca_banner_div_accept_hover = $params->get('ca_banner_div_accept_hover');
|
||||
if($ca_banner_div_accept_hover)
|
||||
echo "<style>#ca_banner div.accept:hover {".$ca_banner_div_accept_hover."}</style>";
|
||||
$ca_info = $params->get('ca_info');
|
||||
$ca_info_close = $params->get('ca_info_close');
|
||||
$ca_info_plus = $params->get('ca_info_plus');
|
||||
|
||||
|
||||
if (!isset($_COOKIE['cookieaccept'])) :
|
||||
|
||||
switch ($current_lang) {
|
||||
case 'fr-FR':
|
||||
$info1 = $params->get('info1_fr-FR');
|
||||
$info2 = $params->get('info2_fr-FR');
|
||||
$text = $params->get('text_fr-FR');
|
||||
$link = $params->get('article_info_link_fr-FR');
|
||||
break;
|
||||
case 'pl-PL':
|
||||
$info1 = $params->get('info1_pl-PL');
|
||||
$info2 = $params->get('info2_pl-PL');
|
||||
$text = $params->get('text_pl-PL');
|
||||
$link = $params->get('article_info_link_pl-PL');
|
||||
break;
|
||||
case 'it-IT':
|
||||
$info1 = $params->get('info1_it-IT');
|
||||
$info2 = $params->get('info2_it-IT');
|
||||
$text = $params->get('text_it-IT');
|
||||
$link = $params->get('article_info_link_it-IT');
|
||||
break;
|
||||
case 'es-ES':
|
||||
$info1 = $params->get('info1_es-ES');
|
||||
$info2 = $params->get('info2_es-ES');
|
||||
$text = $params->get('text_es-ES');
|
||||
$link = $params->get('article_info_link_es-ES');
|
||||
break;
|
||||
case $other_lang:
|
||||
$info1 = $params->get('info1_xx-XX');
|
||||
$info2 = $params->get('info2_xx-XX');
|
||||
$text = $params->get('text_xx-XX');
|
||||
$more_info = $params->get('more_info');
|
||||
$accept = $params->get('accept');
|
||||
$link = $params->get('article_info_link_xx-XX');
|
||||
break;
|
||||
default:
|
||||
$info1 = $params->get('info1_en-GB');
|
||||
$info2 = $params->get('info2_en-GB');
|
||||
$text = $params->get('text_en-GB');
|
||||
$link = $params->get('article_info_link_en-GB');
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
<!--googleoff: all-->
|
||||
<div id="ca_banner"
|
||||
style="<?php echo $position; ?>:0px;
|
||||
<?php if($color=="black" && $ca_banner=="") echo "background:url('".JURI::base()."modules/mod_cookiesaccept/img/przez_b.png');border-color:#000;color:#fff;" ?>
|
||||
<?php echo $ca_banner; ?>
|
||||
">
|
||||
<div class="cookie" style="<?php if($color=="black" && $ca_banner_h2=="") echo "color:#fff;" ?>
|
||||
<?php echo $ca_banner_h2; ?>"><?php echo $info1; ?></div>
|
||||
<p style="
|
||||
<?php if($color=="black" && $ca_banner_p=="") echo "color:#fff;" ?>
|
||||
<?php echo $ca_banner_p; ?>"><?php echo $info2; ?>
|
||||
<?php if($enable_info) : ?>
|
||||
<?php if($article_info) : ?>
|
||||
<span class="infoplus" style="<?php echo $ca_banner_p_span; ?>"><a href="<?php echo $link; ?>"><?php if(!$more_info) { echo JText::_('MOD_COOKIESACCEPT_PLUS_INFO'); } else { echo $more_info; }; ?></a></span>
|
||||
<?php else: ?>
|
||||
<span class="infoplus info_modal" style="<?php echo $ca_banner_p_span; ?>"><?php if(!$more_info) { echo JText::_('MOD_COOKIESACCEPT_PLUS_INFO'); } else { echo $more_info; }; ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
<div class="accept" style="<?php echo $ca_banner_div_accept; ?>"><?php if(!$accept) { echo JText::_('MOD_COOKIESACCEPT_ACCEPT'); } else { echo $accept; }; ?></div>
|
||||
</div>
|
||||
<?php if($enable_info && !$article_info) : ?>
|
||||
<div id="ca_info" style="<?php echo $ca_info; ?>">
|
||||
<div class="ca_info_close" style="<?php echo $ca_info_close; ?>"></div>
|
||||
<div id="ca_info_plus" style="<?php echo $ca_info_plus; ?>">
|
||||
<?php echo $text; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(isset($_POST['set_cookie'])):
|
||||
if($_POST['set_cookie']==1)
|
||||
setcookie("cookieaccept", "yes", time()+3600*24*365, "/");
|
||||
?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
function setCookie(c_name,value,exdays)
|
||||
{
|
||||
var exdate=new Date();
|
||||
exdate.setDate(exdate.getDate() + exdays);
|
||||
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()) + "; path=/";
|
||||
document.cookie=c_name + "=" + c_value;
|
||||
}
|
||||
|
||||
function readCookie(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0;i < ca.length;i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
var $ca_banner = jQuery('#ca_banner');
|
||||
var $ca_infoplus = jQuery('.infoplus.info_modal');
|
||||
var $ca_info = jQuery('#ca_info');
|
||||
var $ca_info_close = jQuery('.ca_info_close');
|
||||
var $ca_infoaccept = jQuery('.accept');
|
||||
|
||||
var cookieaccept = readCookie('cookieaccept');
|
||||
if(!(cookieaccept == "yes")){
|
||||
|
||||
$ca_banner.delay(1000).slideDown('fast');
|
||||
$ca_infoplus.click(function(){
|
||||
$ca_info.fadeIn("fast");
|
||||
});
|
||||
$ca_info_close.click(function(){
|
||||
$ca_info.fadeOut("slow");
|
||||
});
|
||||
$ca_infoaccept.click(function(){
|
||||
setCookie("cookieaccept","yes",365);
|
||||
jQuery.post('<?php echo JURI::current(); ?>', 'set_cookie=1', function(){});
|
||||
$ca_banner.slideUp('slow');
|
||||
$ca_info.fadeOut("slow");
|
||||
});
|
||||
}
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
<!--googleon: all-->
|
||||
<?php endif ?>
|
||||
433
modules/mod_cookiesaccept/mod_cookiesaccept.xml
Normal file
433
modules/mod_cookiesaccept/mod_cookiesaccept.xml
Normal file
@ -0,0 +1,433 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" version="2.5" client="site" method="upgrade">
|
||||
<name>CookiesAccept</name>
|
||||
<author>Le Cinquième Crayon</author>
|
||||
<creationDate>Juin 2013</creationDate>
|
||||
<copyright>All rights reserved by Le Cinquième Crayon 2013</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>contact@cinquiemecrayon.eu</authorEmail>
|
||||
<authorUrl>www.cinquiemecrayon.eu</authorUrl>
|
||||
<version>1.3</version>
|
||||
<description>MOD_COOKIESACCEPT_DESCRIPTION</description>
|
||||
|
||||
<files>
|
||||
<folder>img</folder>
|
||||
<filename module="mod_cookiesaccept">mod_cookiesaccept.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>screen.css</filename>
|
||||
<filename>mod_cookiesaccept.xml</filename>
|
||||
</files>
|
||||
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB.mod_cookiesaccept.ini</language>
|
||||
<language tag="fr-FR">language/fr-FR.mod_cookiesaccept.ini</language>
|
||||
<language tag="pl-PL">language/pl-PL.mod_cookiesaccept.ini</language>
|
||||
<language tag="it-IT">language/it-IT.mod_cookiesaccept.ini</language>
|
||||
<language tag="es-ES">language/es-ES.mod_cookiesaccept.ini</language>
|
||||
</languages>
|
||||
|
||||
<config>
|
||||
<fields name="params">
|
||||
|
||||
<fieldset name="basics">
|
||||
|
||||
<field
|
||||
name="position"
|
||||
type="list"
|
||||
default="bottom"
|
||||
label="MOD_COOKIESACCEPT_POSITION"
|
||||
description="MOD_COOKIESACCEPT_POSITION_DESC"
|
||||
>
|
||||
<option value="top">MOD_COOKIESACCEPT_POSITION_TOP</option>
|
||||
<option value="bottom">MOD_COOKIESACCEPT_POSITION_BOTTOM</option>
|
||||
</field>
|
||||
<field
|
||||
name="jquery"
|
||||
type="radio"
|
||||
default="1"
|
||||
label="MOD_COOKIESACCEPT_JQUERY"
|
||||
description="MOD_COOKIESACCEPT_JQUERY_DESC"
|
||||
>
|
||||
<option value="0">MOD_COOKIESACCEPT_NO</option>
|
||||
<option value="1">MOD_COOKIESACCEPT_YES</option>
|
||||
</field>
|
||||
<field
|
||||
name="color"
|
||||
type="list"
|
||||
default="white"
|
||||
label="MOD_COOKIESACCEPT_COLOR"
|
||||
description="MOD_COOKIESACCEPT_COLOR_DESC"
|
||||
>
|
||||
<option value="white">MOD_COOKIESACCEPT_COLOR_WHITE</option>
|
||||
<option value="black">MOD_COOKIESACCEPT_COLOR_BLACK</option>
|
||||
</field>
|
||||
<field
|
||||
name="enable_info"
|
||||
type="radio"
|
||||
default="1"
|
||||
label="MOD_COOKIESACCEPT_INFO_ENABLE"
|
||||
description="MOD_COOKIESACCEPT_INFO_ENABLE_DESC"
|
||||
>
|
||||
<option value="0">MOD_COOKIESACCEPT_NO</option>
|
||||
<option value="1">MOD_COOKIESACCEPT_YES</option>
|
||||
</field>
|
||||
<field
|
||||
name="article_info"
|
||||
type="radio"
|
||||
default="0"
|
||||
label="MOD_COOKIESACCEPT_ARTICLE_INFO"
|
||||
description="MOD_COOKIESACCEPT_ARTICLE_INFO_DESC"
|
||||
>
|
||||
<option value="0">MOD_COOKIESACCEPT_NO</option>
|
||||
<option value="1">MOD_COOKIESACCEPT_YES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="english">
|
||||
<field
|
||||
name="info1_en-GB"
|
||||
type="text"
|
||||
size="60"
|
||||
default="NOTE! This site uses cookies and similar technologies."
|
||||
label="MOD_COOKIESACCEPT_INFO_1"
|
||||
description="MOD_COOKIESACCEPT_INFO_1_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="info2_en-GB"
|
||||
type="text"
|
||||
size="60"
|
||||
default="If you not change browser settings, you agree to it."
|
||||
label="MOD_COOKIESACCEPT_INFO_2"
|
||||
description="MOD_COOKIESACCEPT_INFO_2_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="text_en-GB"
|
||||
type="editor"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_TEXT"
|
||||
description="MOD_COOKIESACCEPT_TEXT"
|
||||
filter="safehtml"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="article_info_link_en-GB"
|
||||
type="text"
|
||||
size="60"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK"
|
||||
description="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK_DESC"
|
||||
>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="french">
|
||||
<field
|
||||
name="info1_fr-FR"
|
||||
type="text"
|
||||
size="60"
|
||||
default="REMARQUE ! Ce site utilise des cookies et autres technologies similaires."
|
||||
label="MOD_COOKIESACCEPT_INFO_1"
|
||||
description="MOD_COOKIESACCEPT_INFO_1_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="info2_fr-FR"
|
||||
type="text"
|
||||
size="60"
|
||||
default="Si vous ne changez pas les paramètres de votre navigateur, vous êtes d'accord."
|
||||
label="MOD_COOKIESACCEPT_INFO_2"
|
||||
description="MOD_COOKIESACCEPT_INFO_2_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="text_fr-FR"
|
||||
type="editor"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_TEXT"
|
||||
description="MOD_COOKIESACCEPT_TEXT"
|
||||
filter="safehtml"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="article_info_link_fr-FR"
|
||||
type="text"
|
||||
size="60"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK"
|
||||
description="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK_DESC"
|
||||
>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="polish">
|
||||
<field
|
||||
name="info1_pl-PL"
|
||||
type="text"
|
||||
size="60"
|
||||
default="UWAGA! Ten serwis używa cookies i podobnych technologii."
|
||||
label="MOD_COOKIESACCEPT_INFO_1"
|
||||
description="MOD_COOKIESACCEPT_INFO_1_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="info2_pl-PL"
|
||||
type="text"
|
||||
size="60"
|
||||
default="Brak zmiany ustawienia przeglądarki oznacza zgodę na to."
|
||||
label="MOD_COOKIESACCEPT_INFO_2"
|
||||
description="MOD_COOKIESACCEPT_INFO_2_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="text_pl-PL"
|
||||
type="editor"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_TEXT"
|
||||
description="MOD_COOKIESACCEPT_TEXT"
|
||||
filter="safehtml"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="article_info_link_pl-PL"
|
||||
type="text"
|
||||
size="60"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK"
|
||||
description="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK_DESC"
|
||||
>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="italian">
|
||||
<field
|
||||
name="info1_it-IT"
|
||||
type="text"
|
||||
size="60"
|
||||
default="NOTA! Questo sito utilizza i cookie e tecnologie simili."
|
||||
label="MOD_COOKIESACCEPT_INFO_1"
|
||||
description="MOD_COOKIESACCEPT_INFO_1_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="info2_it-IT"
|
||||
type="text"
|
||||
size="60"
|
||||
default="Se non si modificano le impostazioni del browser, l'utente accetta."
|
||||
label="MOD_COOKIESACCEPT_INFO_2"
|
||||
description="MOD_COOKIESACCEPT_INFO_2_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="text_it-IT"
|
||||
type="editor"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_TEXT"
|
||||
description="MOD_COOKIESACCEPT_TEXT"
|
||||
filter="safehtml"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="article_info_link_it-IT"
|
||||
type="text"
|
||||
size="60"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK"
|
||||
description="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK_DESC"
|
||||
>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="spanish">
|
||||
<field
|
||||
name="info1_es-ES"
|
||||
type="text"
|
||||
size="60"
|
||||
default="¡Atención! Este sitio usa cookies y tecnologías similares."
|
||||
label="MOD_COOKIESACCEPT_INFO_1"
|
||||
description="MOD_COOKIESACCEPT_INFO_1_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="info2_es-ES"
|
||||
type="text"
|
||||
size="60"
|
||||
default="Si no cambia la configuración de su navegador, usted acepta su uso."
|
||||
label="MOD_COOKIESACCEPT_INFO_2"
|
||||
description="MOD_COOKIESACCEPT_INFO_2_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="text_es-ES"
|
||||
type="editor"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_TEXT"
|
||||
description="MOD_COOKIESACCEPT_TEXT"
|
||||
filter="safehtml"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="article_info_link_es-ES"
|
||||
type="text"
|
||||
size="60"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK"
|
||||
description="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK_DESC"
|
||||
>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="other">
|
||||
<field
|
||||
name="lang_code"
|
||||
type="text"
|
||||
size="10"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_LANG_CODE"
|
||||
description="MOD_COOKIESACCEPT_LANG_CODE_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="info1_xx-XX"
|
||||
type="text"
|
||||
size="60"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_INFO_1"
|
||||
description="MOD_COOKIESACCEPT_INFO_1_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="info2_xx-XX"
|
||||
type="text"
|
||||
size="60"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_INFO_2"
|
||||
description="MOD_COOKIESACCEPT_INFO_2_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="text_xx-XX"
|
||||
type="editor"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_TEXT"
|
||||
description="MOD_COOKIESACCEPT_TEXT"
|
||||
filter="safehtml"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="more_info"
|
||||
type="text"
|
||||
size="10"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_MORE"
|
||||
description="MOD_COOKIESACCEPT_MORE_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="accept"
|
||||
type="text"
|
||||
size="10"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_ACCEPT"
|
||||
description="MOD_COOKIESACCEPT_ACCEPT_DESC"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="article_info_link_xx-XX"
|
||||
type="text"
|
||||
size="60"
|
||||
default=""
|
||||
label="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK"
|
||||
description="MOD_COOKIESACCEPT_ARTICLE_INFO_LINK_DESC"
|
||||
>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset name="theme">
|
||||
<field
|
||||
name="ca_banner"
|
||||
type="textarea"
|
||||
default=""
|
||||
rows="4" cols="40"
|
||||
label="#ca_banner"
|
||||
description="For example: background:#800; height:200px;"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="ca_banner_h2"
|
||||
type="textarea"
|
||||
default=""
|
||||
rows="4" cols="40"
|
||||
label="#ca_banner>h2"
|
||||
description="For example: color:#faa; font-style:italic;"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="ca_banner_p"
|
||||
type="textarea"
|
||||
default=""
|
||||
rows="4" cols="40"
|
||||
label="#ca_banner>p"
|
||||
description="For example: color:#400; font-size:12px;"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="ca_banner_p_span"
|
||||
type="textarea"
|
||||
default=""
|
||||
rows="4" cols="40"
|
||||
label="#ca_banner>p>span"
|
||||
description="For example: color:#fff; text-decoration:none;"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="ca_banner_div_accept"
|
||||
type="textarea"
|
||||
default=""
|
||||
rows="4" cols="40"
|
||||
label="#ca_banner>div.accept"
|
||||
description="For example: color:#fff; background-image:none; background-color:#000;"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="ca_banner_div_accept_hover"
|
||||
type="textarea"
|
||||
default=""
|
||||
rows="4" cols="40"
|
||||
label="#ca_banner>.accept:hover"
|
||||
description="For example: box-shadow:0 0 4px #000;"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="ca_info"
|
||||
type="textarea"
|
||||
default=""
|
||||
rows="4" cols="40"
|
||||
label="#ca_info"
|
||||
description="For example: width:1000px; margin-right:-500px;"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="ca_info_plus"
|
||||
type="textarea"
|
||||
default=""
|
||||
rows="4" cols="40"
|
||||
label="#ca_info_plus"
|
||||
description="For example: width:1000px; margin-right:-500px;"
|
||||
>
|
||||
</field>
|
||||
<field
|
||||
name="ca_info_close"
|
||||
type="textarea"
|
||||
default=""
|
||||
rows="4" cols="40"
|
||||
label=".ca_info_close"
|
||||
description="For example: background-color:#090; top:5px; right:5px;"
|
||||
>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
</fields>
|
||||
</config>
|
||||
|
||||
</extension>
|
||||
103
modules/mod_cookiesaccept/screen.css
Normal file
103
modules/mod_cookiesaccept/screen.css
Normal file
@ -0,0 +1,103 @@
|
||||
#ca_banner {
|
||||
position: fixed!important;
|
||||
z-index: 16777270;
|
||||
width: 100%!important;
|
||||
background: url('img/przez.png');
|
||||
text-align: center;
|
||||
border-width: 1px 0 1px 0!important;
|
||||
border-style: solid!important;
|
||||
border-color: #fff!important;
|
||||
display: none;
|
||||
box-shadow: 0 0 40px #444;
|
||||
padding: 10px 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
float:none!important;
|
||||
text-shadow:none;
|
||||
border-radius: 0!important;
|
||||
margin: 0 auto!important;
|
||||
}
|
||||
#ca_info {
|
||||
background: #fff;
|
||||
height: 304px;
|
||||
left: 50%;
|
||||
margin-left: -350px;
|
||||
margin-top: -182px;
|
||||
margin-bottom:20px;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
width: 700px;
|
||||
box-shadow:0 0 40px #444;
|
||||
z-index:16777271;
|
||||
padding:30px;
|
||||
box-sizing:border-box;
|
||||
display:none;
|
||||
border:1px solid #999999;
|
||||
text-shadow:none;
|
||||
}
|
||||
#ca_info .ca_info_close {
|
||||
position: absolute;
|
||||
top: -15px;
|
||||
right: -15px;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
height: 25px;
|
||||
width: 25px;
|
||||
border-radius: 16px;
|
||||
background: #AA0000 url('img/close.png');
|
||||
text-align: center;
|
||||
line-height: 1.3em;
|
||||
font-size: 18px;
|
||||
cursor:pointer;
|
||||
}
|
||||
#ca_info_plus {
|
||||
box-sizing:border-box;
|
||||
overflow: auto;
|
||||
height: 254px;
|
||||
padding-right:10px;
|
||||
color:#000;
|
||||
text-align:left;
|
||||
}
|
||||
#ca_info_plus p{
|
||||
color:#000;
|
||||
text-align:left;
|
||||
font-size:12px;
|
||||
}
|
||||
|
||||
#ca_banner p,#ca_banner h2 {
|
||||
margin:4px 0;
|
||||
padding:0;
|
||||
line-height:1.2em;
|
||||
color:#000;
|
||||
float:none!important;
|
||||
}
|
||||
#ca_banner h2 {
|
||||
font-size:20px;
|
||||
font-weight:bold;
|
||||
}
|
||||
#ca_banner p {
|
||||
font-size:14px
|
||||
}
|
||||
|
||||
#ca_banner p span {
|
||||
text-decoration:underline;
|
||||
color:#0089F2;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
float:none!important;
|
||||
}
|
||||
#ca_banner .accept {
|
||||
cursor:pointer;
|
||||
font-size:14px;
|
||||
margin:5px auto;
|
||||
width:120px;
|
||||
background: #0089f2;
|
||||
padding:3px;
|
||||
border-radius:3px;
|
||||
text-shadow:1px 1px 0 #0072ca;
|
||||
color:#fff;
|
||||
float:none!important;
|
||||
}
|
||||
#ca_banner .accept:hover {
|
||||
box-shadow:0 0 15px #000;
|
||||
}
|
||||
96
modules/mod_custom/mod_custom.xml
Normal file
96
modules/mod_custom/mod_custom.xml
Normal file
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_custom</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2004-07</creationDate>
|
||||
<copyright>(C) 2005 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_CUSTOM_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Custom</namespace>
|
||||
<customContent />
|
||||
<files>
|
||||
<folder module="mod_custom">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_custom.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_custom.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Custom" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="options" label="COM_MODULES_BASIC_FIELDSET_LABEL">
|
||||
<field
|
||||
name="prepare_content"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_CUSTOM_FIELD_PREPARE_CONTENT_LABEL"
|
||||
description="MOD_CUSTOM_FIELD_PREPARE_CONTENT_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="backgroundimage"
|
||||
type="media"
|
||||
schemes="http,https,ftp,ftps,data,file"
|
||||
validate="url"
|
||||
relative="true"
|
||||
label="MOD_CUSTOM_FIELD_BACKGROUNDIMAGE_LABEL"
|
||||
/>
|
||||
</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="static"
|
||||
>
|
||||
<option value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
38
modules/mod_custom/services/provider.php
Normal file
38
modules/mod_custom/services/provider.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_custom
|
||||
*
|
||||
* @copyright (C) 2023 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\Module;
|
||||
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
|
||||
/**
|
||||
* The module Custom HTML service provider.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function register(Container $container): void
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Custom'));
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
44
modules/mod_custom/src/Dispatcher/Dispatcher.php
Normal file
44
modules/mod_custom/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_custom
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Custom\Site\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Dispatcher class for mod_custom
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher
|
||||
{
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
protected function getLayoutData()
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
|
||||
if (($data['params'])->get('prepare_content', 1)) {
|
||||
($data['module'])->content = HTMLHelper::_('content.prepare', ($data['module'])->content, '', 'mod_custom.content');
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
31
modules/mod_custom/tmpl/default.php
Normal file
31
modules/mod_custom/tmpl/default.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_custom
|
||||
*
|
||||
* @copyright (C) 2009 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\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
$modId = 'mod-custom' . $module->id;
|
||||
|
||||
if ($params->get('backgroundimage')) {
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
|
||||
$wa->addInlineStyle('
|
||||
#' . $modId . '{background-image: url("' . Uri::root(true) . '/' . HTMLHelper::_('cleanImageURL', $params->get('backgroundimage'))->url . '");}
|
||||
', ['name' => $modId]);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div id="<?php echo $modId; ?>" class="mod-custom custom">
|
||||
<?php echo $module->content; ?>
|
||||
</div>
|
||||
176
modules/mod_feed/mod_feed.xml
Normal file
176
modules/mod_feed/mod_feed.xml
Normal file
@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_feed</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2005-07</creationDate>
|
||||
<copyright>(C) 2005 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_FEED_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Feed</namespace>
|
||||
<files>
|
||||
<folder module="mod_feed">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_feed.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_feed.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Feed_Display" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="rssurl"
|
||||
type="url"
|
||||
label="MOD_FEED_FIELD_RSSURL_LABEL"
|
||||
filter="url"
|
||||
required="true"
|
||||
validate="url"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="rssrtl"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_FEED_FIELD_RTL_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rsstitle"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_FEED_FIELD_RSSTITLE_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rssdesc"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_FEED_FIELD_DESCRIPTION_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rssdate"
|
||||
type="radio"
|
||||
label="MOD_FEED_FIELD_DATE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rssimage"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_FEED_FIELD_IMAGE_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rssitems"
|
||||
type="number"
|
||||
label="MOD_FEED_FIELD_ITEMS_LABEL"
|
||||
default="3"
|
||||
filter="integer"
|
||||
min="1"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="rssitemdesc"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_FEED_FIELD_ITEMDESCRIPTION_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rssitemdate"
|
||||
type="radio"
|
||||
label="MOD_FEED_FIELD_ITEMDATE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="word_count"
|
||||
type="text"
|
||||
label="MOD_FEED_FIELD_WORDCOUNT_LABEL"
|
||||
description="MOD_FEED_FIELD_WORDCOUNT_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
/>
|
||||
</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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
modules/mod_feed/services/provider.php
Normal file
41
modules/mod_feed/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_feed
|
||||
*
|
||||
* @copyright (C) 2023 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 feed 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): void
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Feed'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Feed\\Site\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
47
modules/mod_feed/src/Dispatcher/Dispatcher.php
Normal file
47
modules/mod_feed/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_feed
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Feed\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_feed
|
||||
*
|
||||
* @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(): array
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
|
||||
$data['rssurl'] = $data['params']->get('rssurl', '');
|
||||
$data['rssrtl'] = $data['params']->get('rssrtl', 0);
|
||||
$data['feed'] = $this->getHelperFactory()->getHelper('FeedHelper')->getFeedInformation($data['params']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
76
modules/mod_feed/src/Helper/FeedHelper.php
Normal file
76
modules/mod_feed/src/Helper/FeedHelper.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_feed
|
||||
*
|
||||
* @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\Feed\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Feed\FeedFactory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_feed
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
class FeedHelper
|
||||
{
|
||||
/**
|
||||
* Retrieve feed information
|
||||
*
|
||||
* @param \Joomla\Registry\Registry $params module parameters
|
||||
*
|
||||
* @return \Joomla\CMS\Feed\Feed|string
|
||||
*
|
||||
* @since 5.1.0
|
||||
*/
|
||||
public function getFeedInformation($params)
|
||||
{
|
||||
// Module params
|
||||
$rssurl = $params->get('rssurl', '');
|
||||
|
||||
// Get RSS parsed object
|
||||
try {
|
||||
$feed = new FeedFactory();
|
||||
$rssDoc = $feed->getFeed($rssurl);
|
||||
} catch (\Exception $e) {
|
||||
return Text::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
|
||||
if (empty($rssDoc)) {
|
||||
return Text::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
|
||||
if ($rssDoc) {
|
||||
return $rssDoc;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve feed information
|
||||
*
|
||||
* @param \Joomla\Registry\Registry $params module parameters
|
||||
*
|
||||
* @return \Joomla\CMS\Feed\Feed|string
|
||||
*
|
||||
* @deprecated 5.1.0 will be removed in 7.0
|
||||
* Use the non-static method getFeedInformation
|
||||
* Example: Factory::getApplication()->bootModule('mod_feed', 'site')
|
||||
* ->getHelper('FeedHelper')
|
||||
* ->getFeedInformation($params, Factory::getApplication())
|
||||
*
|
||||
*/
|
||||
public static function getFeed($params)
|
||||
{
|
||||
return (new self())->getFeedInformation($params);
|
||||
}
|
||||
}
|
||||
120
modules/mod_feed/tmpl/default.php
Normal file
120
modules/mod_feed/tmpl/default.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_feed
|
||||
*
|
||||
* @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;
|
||||
use Joomla\Filter\OutputFilter;
|
||||
|
||||
// Check if feed URL has been set
|
||||
if (empty($rssurl)) {
|
||||
echo '<div>' . Text::_('MOD_FEED_ERR_NO_URL') . '</div>';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($feed) && is_string($feed)) {
|
||||
echo $feed;
|
||||
} else {
|
||||
$lang = $app->getLanguage();
|
||||
$myrtl = $params->get('rssrtl', 0);
|
||||
$direction = ' ';
|
||||
|
||||
$isRtl = $lang->isRtl();
|
||||
|
||||
if ($isRtl && $myrtl == 0) {
|
||||
$direction = ' redirect-rtl';
|
||||
} elseif ($isRtl && $myrtl == 1) {
|
||||
// Feed description
|
||||
$direction = ' redirect-ltr';
|
||||
} elseif ($isRtl && $myrtl == 2) {
|
||||
$direction = ' redirect-rtl';
|
||||
} elseif ($myrtl == 0) {
|
||||
$direction = ' redirect-ltr';
|
||||
} elseif ($myrtl == 1) {
|
||||
$direction = ' redirect-ltr';
|
||||
} elseif ($myrtl == 2) {
|
||||
$direction = ' redirect-rtl';
|
||||
}
|
||||
|
||||
if ($feed !== false) {
|
||||
?>
|
||||
<div style="direction: <?php echo $rssrtl ? 'rtl' : 'ltr'; ?>;" class="text-<?php echo $rssrtl ? 'right' : 'left'; ?> feed">
|
||||
<?php
|
||||
// Feed title
|
||||
if ($feed->title !== null && $params->get('rsstitle', 1)) {
|
||||
?>
|
||||
<h2 class="<?php echo $direction; ?>">
|
||||
<a href="<?php echo htmlspecialchars($rssurl, ENT_COMPAT, 'UTF-8'); ?>" target="_blank" rel="noopener">
|
||||
<?php echo $feed->title; ?></a>
|
||||
</h2>
|
||||
<?php
|
||||
}
|
||||
// Feed date
|
||||
if ($params->get('rssdate', 1) && ($feed->publishedDate !== null)) : ?>
|
||||
<h3>
|
||||
<?php echo HTMLHelper::_('date', $feed->publishedDate, Text::_('DATE_FORMAT_LC3')); ?>
|
||||
</h3>
|
||||
<?php endif;
|
||||
// Feed description
|
||||
if ($params->get('rssdesc', 1)) {
|
||||
?>
|
||||
<?php echo $feed->description; ?>
|
||||
<?php
|
||||
}
|
||||
// Feed image
|
||||
if ($feed->image && $params->get('rssimage', 1)) :
|
||||
?>
|
||||
<?php echo HTMLHelper::_('image', $feed->image->uri, $feed->image->title); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<!-- Show items -->
|
||||
<?php if (!empty($feed)) { ?>
|
||||
<ul class="newsfeed">
|
||||
<?php for ($i = 0, $max = min(count($feed), $params->get('rssitems', 3)); $i < $max; $i++) { ?>
|
||||
<?php
|
||||
$uri = $feed[$i]->uri || !$feed[$i]->isPermaLink ? trim($feed[$i]->uri) : trim($feed[$i]->guid);
|
||||
$uri = !$uri || stripos($uri, 'http') !== 0 ? $rssurl : $uri;
|
||||
$text = $feed[$i]->content !== '' ? trim($feed[$i]->content) : '';
|
||||
?>
|
||||
<li>
|
||||
<?php if (!empty($uri)) : ?>
|
||||
<span class="feed-link">
|
||||
<a href="<?php echo htmlspecialchars($uri, ENT_COMPAT, 'UTF-8'); ?>" target="_blank" rel="noopener">
|
||||
<?php echo trim($feed[$i]->title); ?></a></span>
|
||||
<?php else : ?>
|
||||
<span class="feed-link"><?php echo trim($feed[$i]->title); ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('rssitemdate', 0) && $feed[$i]->publishedDate !== null) : ?>
|
||||
<div class="feed-item-date">
|
||||
<?php echo HTMLHelper::_('date', $feed[$i]->publishedDate, Text::_('DATE_FORMAT_LC3')); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('rssitemdesc', 1) && $text !== '') : ?>
|
||||
<div class="feed-item-description">
|
||||
<?php
|
||||
// Strip the images.
|
||||
$text = OutputFilter::stripImages($text);
|
||||
$text = HTMLHelper::_('string.truncate', $text, $params->get('word_count', 0));
|
||||
echo str_replace(''', "'", $text);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php }
|
||||
}
|
||||
54
modules/mod_finder/mod_finder.php
Normal file
54
modules/mod_finder/mod_finder.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_finder
|
||||
*
|
||||
* @copyright (C) 2011 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\Component\ComponentHelper;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Component\Finder\Administrator\Helper\LanguageHelper;
|
||||
use Joomla\Component\Finder\Site\Helper\RouteHelper;
|
||||
use Joomla\Module\Finder\Site\Helper\FinderHelper;
|
||||
|
||||
$cparams = ComponentHelper::getParams('com_finder');
|
||||
|
||||
// Check for OpenSearch
|
||||
if ($params->get('opensearch', $cparams->get('opensearch', 1))) {
|
||||
$defaultTitle = Text::_('MOD_FINDER_OPENSEARCH_NAME') . ' ' . $app->get('sitename');
|
||||
$ostitle = $params->get('opensearch_name', $cparams->get('opensearch_name', $defaultTitle));
|
||||
$app->getDocument()->addHeadLink(
|
||||
Uri::getInstance()->toString(['scheme', 'host', 'port']) . Route::_('index.php?option=com_finder&view=search&format=opensearch'),
|
||||
'search',
|
||||
'rel',
|
||||
['title' => $ostitle, 'type' => 'application/opensearchdescription+xml']
|
||||
);
|
||||
}
|
||||
|
||||
// Get the route.
|
||||
$route = RouteHelper::getSearchRoute($params->get('searchfilter', null));
|
||||
|
||||
if ($params->get('set_itemid')) {
|
||||
$uri = Uri::getInstance($route);
|
||||
$uri->setVar('Itemid', $params->get('set_itemid'));
|
||||
$route = $uri->toString(['path', 'query']);
|
||||
}
|
||||
|
||||
// Load component language file.
|
||||
LanguageHelper::loadComponentLanguage();
|
||||
|
||||
// Load plugin language files.
|
||||
LanguageHelper::loadPluginLanguage();
|
||||
|
||||
// Get Smart Search query object.
|
||||
$query = FinderHelper::getQuery($params);
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_finder', $params->get('layout', 'default'));
|
||||
135
modules/mod_finder/mod_finder.xml
Normal file
135
modules/mod_finder/mod_finder.xml
Normal file
@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_finder</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2011-08</creationDate>
|
||||
<copyright>(C) 2011 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_FINDER_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Finder</namespace>
|
||||
<files>
|
||||
<filename module="mod_finder">mod_finder.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_finder.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_finder.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Smart_Search" />
|
||||
<config>
|
||||
<fields name="params" addfieldprefix="Joomla\Component\Finder\Administrator\Field">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="searchfilter"
|
||||
type="searchfilter"
|
||||
label="MOD_FINDER_FIELDSET_BASIC_SEARCHFILTER_LABEL"
|
||||
default=""
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_autosuggest"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_FINDER_FIELDSET_BASIC_AUTOSUGGEST_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_advanced"
|
||||
type="list"
|
||||
label="MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
validate="options"
|
||||
>
|
||||
<option value="2">MOD_FINDER_FIELDSET_BASIC_SHOW_ADVANCED_OPTION_LINK</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="0">JHIDE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_label"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_SHOW_LABEL_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="alt_label"
|
||||
type="text"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_ALT_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_button"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_SHOW_BUTTON_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="opensearch"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_FINDER_FIELD_OPENSEARCH_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="opensearch_name"
|
||||
type="text"
|
||||
label="MOD_FINDER_FIELD_OPENSEARCH_TEXT_LABEL"
|
||||
showon="opensearch:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="set_itemid"
|
||||
type="menuitem"
|
||||
label="MOD_FINDER_FIELDSET_ADVANCED_SETITEMID_LABEL"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_FINDER_SELECT_MENU_ITEMID</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>
|
||||
84
modules/mod_finder/src/Helper/FinderHelper.php
Normal file
84
modules/mod_finder/src/Helper/FinderHelper.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_finder
|
||||
*
|
||||
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Finder\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Filter\InputFilter;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Component\Finder\Administrator\Indexer\Query;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Finder module helper.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
class FinderHelper
|
||||
{
|
||||
/**
|
||||
* Method to get hidden input fields for a get form so that control variables
|
||||
* are not lost upon form submission.
|
||||
*
|
||||
* @param string $route The route to the page. [optional]
|
||||
* @param integer $paramItem The menu item ID. (@since 3.1) [optional]
|
||||
*
|
||||
* @return string A string of hidden input form fields
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public static function getGetFields($route = null, $paramItem = 0)
|
||||
{
|
||||
$fields = [];
|
||||
$uri = Uri::getInstance(Route::_($route));
|
||||
$uri->delVar('q');
|
||||
|
||||
// Create hidden input elements for each part of the URI.
|
||||
foreach ($uri->getQuery(true) as $n => $v) {
|
||||
$fields[] = '<input type="hidden" name="' . $n . '" value="' . $v . '">';
|
||||
}
|
||||
|
||||
return implode('', $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Smart Search query object.
|
||||
*
|
||||
* @param \Joomla\Registry\Registry $params Module parameters.
|
||||
*
|
||||
* @return Query object
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public static function getQuery($params)
|
||||
{
|
||||
$request = Factory::getApplication()->getInput()->request;
|
||||
$filter = InputFilter::getInstance();
|
||||
|
||||
// Get the static taxonomy filters.
|
||||
$options = [];
|
||||
$options['filter'] = ($request->get('f', 0, 'int') !== 0) ? $request->get('f', '', 'int') : $params->get('searchfilter');
|
||||
$options['filter'] = $filter->clean($options['filter'], 'int');
|
||||
|
||||
// Get the dynamic taxonomy filters.
|
||||
$options['filters'] = $request->get('t', '', 'array');
|
||||
$options['filters'] = $filter->clean($options['filters'], 'array');
|
||||
$options['filters'] = ArrayHelper::toInteger($options['filters']);
|
||||
|
||||
// Instantiate a query object.
|
||||
return new Query($options, Factory::getContainer()->get(DatabaseInterface::class));
|
||||
}
|
||||
}
|
||||
76
modules/mod_finder/tmpl/default.php
Normal file
76
modules/mod_finder/tmpl/default.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_finder
|
||||
*
|
||||
* @copyright (C) 2011 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;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Module\Finder\Site\Helper\FinderHelper;
|
||||
|
||||
// Load the smart search component language file.
|
||||
$lang = $app->getLanguage();
|
||||
$lang->load('com_finder', JPATH_SITE);
|
||||
|
||||
$input = '<input type="text" name="q" id="mod-finder-searchword' . $module->id . '" class="js-finder-search-query form-control" value="' . htmlspecialchars($app->getInput()->get('q', '', 'string'), ENT_COMPAT, 'UTF-8') . '"'
|
||||
. ' placeholder="' . Text::_('MOD_FINDER_SEARCH_VALUE') . '">';
|
||||
|
||||
$showLabel = $params->get('show_label', 1);
|
||||
$labelClass = (!$showLabel ? 'visually-hidden ' : '') . 'finder';
|
||||
$label = '<label for="mod-finder-searchword' . $module->id . '" class="' . $labelClass . '">' . $params->get('alt_label', Text::_('JSEARCH_FILTER_SUBMIT')) . '</label>';
|
||||
|
||||
$output = '';
|
||||
|
||||
if ($params->get('show_button', 0)) {
|
||||
$output .= $label;
|
||||
$output .= '<div class="mod-finder__search input-group">';
|
||||
$output .= $input;
|
||||
$output .= '<button class="btn btn-primary" type="submit"><span class="icon-search icon-white" aria-hidden="true"></span> ' . Text::_('JSEARCH_FILTER_SUBMIT') . '</button>';
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
$output .= $label;
|
||||
$output .= $input;
|
||||
}
|
||||
|
||||
Text::script('MOD_FINDER_SEARCH_VALUE');
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $app->getDocument()->getWebAssetManager();
|
||||
$wa->getRegistry()->addExtensionRegistryFile('com_finder');
|
||||
|
||||
/*
|
||||
* This segment of code sets up the autocompleter.
|
||||
*/
|
||||
if ($params->get('show_autosuggest', 1)) {
|
||||
$wa->usePreset('awesomplete');
|
||||
$app->getDocument()->addScriptOptions('finder-search', ['url' => Route::_('index.php?option=com_finder&task=suggestions.suggest&format=json&tmpl=component', false)]);
|
||||
|
||||
Text::script('JLIB_JS_AJAX_ERROR_OTHER');
|
||||
Text::script('JLIB_JS_AJAX_ERROR_PARSE');
|
||||
}
|
||||
|
||||
$wa->useScript('com_finder.finder');
|
||||
|
||||
?>
|
||||
|
||||
<form class="mod-finder js-finder-searchform form-search" action="<?php echo Route::_($route); ?>" method="get" role="search">
|
||||
<?php echo $output; ?>
|
||||
|
||||
<?php $show_advanced = $params->get('show_advanced', 0); ?>
|
||||
<?php if ($show_advanced == 2) : ?>
|
||||
<br>
|
||||
<a href="<?php echo Route::_($route); ?>" class="mod-finder__advanced-link"><?php echo Text::_('COM_FINDER_ADVANCED_SEARCH'); ?></a>
|
||||
<?php elseif ($show_advanced == 1) : ?>
|
||||
<div class="mod-finder__advanced js-finder-advanced">
|
||||
<?php echo HTMLHelper::_('filter.select', $query, $params); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo FinderHelper::getGetFields($route, (int) $params->get('set_itemid', 0)); ?>
|
||||
</form>
|
||||
72
modules/mod_footer/mod_footer.xml
Normal file
72
modules/mod_footer/mod_footer.xml
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>mod_footer</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_FOOTER_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Footer</namespace>
|
||||
<files>
|
||||
<folder module="mod_footer">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_footer.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_footer.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Footer" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<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="static"
|
||||
>
|
||||
<option value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
38
modules/mod_footer/services/provider.php
Normal file
38
modules/mod_footer/services/provider.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_footer
|
||||
*
|
||||
* @copyright (C) 2023 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\Module;
|
||||
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
|
||||
/**
|
||||
* The footer module service provider.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
public function register(Container $container): void
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Footer'));
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
46
modules/mod_footer/src/Dispatcher/Dispatcher.php
Normal file
46
modules/mod_footer/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_footer
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Footer\Site\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Dispatcher class for mod_footer
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher
|
||||
{
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.4.0
|
||||
*/
|
||||
protected function getLayoutData(): array
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
|
||||
$lineOne = $this->getApplication()->getLanguage()->_('MOD_FOOTER_LINE1');
|
||||
$lineOne = str_replace('%date%', HTMLHelper::_('date', 'now', 'Y'), $lineOne);
|
||||
$lineOne = str_replace('%sitename%', $this->getApplication()->get('sitename', ''), $lineOne);
|
||||
|
||||
$data['lineone'] = $lineOne;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
19
modules/mod_footer/tmpl/default.php
Normal file
19
modules/mod_footer/tmpl/default.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_footer
|
||||
*
|
||||
* @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\Language\Text;
|
||||
|
||||
?>
|
||||
<div class="mod-footer">
|
||||
<div class="footer1"><?php echo $lineone; ?></div>
|
||||
<div class="footer2"><?php echo Text::_('MOD_FOOTER_LINE2'); ?></div>
|
||||
</div>
|
||||
169
modules/mod_jem/helper.php
Normal file
169
modules/mod_jem/helper.php
Normal file
@ -0,0 +1,169 @@
|
||||
<?php
|
||||
/**
|
||||
* @package JEM
|
||||
* @subpackage JEM Module
|
||||
* @copyright (C) 2013-2024 joomlaeventmanager.net
|
||||
* @copyright (C) 2005-2009 Christoph Lukes
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
|
||||
|
||||
BaseDatabaseModel::addIncludePath(JPATH_SITE.'/components/com_jem/models', 'JemModel');
|
||||
|
||||
/**
|
||||
* Module-Basic
|
||||
*/
|
||||
abstract class ModJemHelper
|
||||
{
|
||||
|
||||
/**
|
||||
* Method to get the events
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public static function getList(&$params)
|
||||
{
|
||||
mb_internal_encoding('UTF-8');
|
||||
|
||||
$db = Factory::getContainer()->get('DatabaseDriver');
|
||||
$user = JemFactory::getUser();
|
||||
$levels = $user->getAuthorisedViewLevels();
|
||||
$settings = JemHelper::config();
|
||||
|
||||
// Use (short) format saved in module settings or in component settings or format in language file otherwise
|
||||
$dateFormat = $params->get('formatdate', '');
|
||||
if (empty($dateFormat)) {
|
||||
// on empty format long format will be used but we need short format
|
||||
if (isset($settings->formatShortDate) && $settings->formatShortDate) {
|
||||
$dateFormat = $settings->formatShortDate;
|
||||
} else {
|
||||
$dateFormat = Text::_('COM_JEM_FORMAT_SHORT_DATE');
|
||||
}
|
||||
}
|
||||
$timeFormat = $params->get('formattime', '');
|
||||
$addSuffix = false;
|
||||
if (empty($timeFormat)) {
|
||||
// on empty format component's format will be used, so also use component's time suffix
|
||||
$addSuffix = true;
|
||||
}
|
||||
|
||||
# Retrieve Eventslist model for the data
|
||||
$model = BaseDatabaseModel::getInstance('Eventslist', 'JemModel', array('ignore_request' => true));
|
||||
|
||||
# Set params for the model
|
||||
# has to go before the getItems function
|
||||
$model->setState('params', $params);
|
||||
|
||||
# filter published
|
||||
# 0: unpublished
|
||||
# 1: published
|
||||
# 2: archived
|
||||
# -2: trashed
|
||||
|
||||
$type = $params->get('type');
|
||||
|
||||
# archived events
|
||||
if ($type == 2) {
|
||||
$model->setState('filter.published',2);
|
||||
$model->setState('filter.orderby',array('a.dates DESC', 'a.times DESC', 'a.created DESC'));
|
||||
$cal_from = "";
|
||||
}
|
||||
|
||||
# upcoming or running events, on mistake default to upcoming events
|
||||
else {
|
||||
$model->setState('filter.published',1);
|
||||
$model->setState('filter.orderby',array('a.dates ASC', 'a.times ASC', 'a.created ASC'));
|
||||
|
||||
$offset_minutes = 60 * $params->get('offset_hours', 0);
|
||||
|
||||
$cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > $offset_minutes) ";
|
||||
$cal_from .= ($type == 1) ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > $offset_minutes)) " : ") ";
|
||||
}
|
||||
|
||||
$model->setState('filter.calendar_from',$cal_from);
|
||||
$model->setState('filter.groupby','a.id');
|
||||
|
||||
# filter category's
|
||||
$catids = JemHelper::getValidIds($params->get('catid'));
|
||||
if ($catids) {
|
||||
$model->setState('filter.category_id',$catids);
|
||||
$model->setState('filter.category_id.include',true);
|
||||
}
|
||||
|
||||
# filter venue's
|
||||
$venids = JemHelper::getValidIds($params->get('venid'));
|
||||
if ($venids) {
|
||||
$model->setState('filter.venue_id',$venids);
|
||||
$model->setState('filter.venue_id.include',true);
|
||||
}
|
||||
|
||||
# count
|
||||
$count = $params->get('count', '2');
|
||||
$model->setState('list.limit',$count);
|
||||
|
||||
# Retrieve the available Events
|
||||
$events = $model->getItems();
|
||||
|
||||
# Loop through the result rows and prepare data
|
||||
$i = -1;
|
||||
$lists = array();
|
||||
|
||||
foreach ($events as $row)
|
||||
{
|
||||
# cut titel
|
||||
$length = mb_strlen($row->title);
|
||||
|
||||
if ($length > $params->get('cuttitle', '18')) {
|
||||
$row->title = mb_substr($row->title, 0, $params->get('cuttitle', '18'));
|
||||
$row->title = $row->title.'...';
|
||||
}
|
||||
|
||||
$lists[++$i] = new stdClass;
|
||||
|
||||
$lists[$i]->eventid = $row->id;
|
||||
$lists[$i]->title = htmlspecialchars($row->title ?? '', ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->link = Route::_(JemHelperRoute::getEventRoute($row->slug));
|
||||
$lists[$i]->dateinfo = JemOutput::formatDateTime($row->dates, $row->times, $row->enddates, $row->endtimes,
|
||||
$dateFormat, $timeFormat, $addSuffix);
|
||||
$lists[$i]->dateschema = JEMOutput::formatSchemaOrgDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $showTime = true);
|
||||
|
||||
$lists[$i]->venue = htmlspecialchars($row->venue ?? '', ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->city = htmlspecialchars($row->city ?? '', ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->postalCode = htmlspecialchars($row->postalCode, ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->street = htmlspecialchars($row->street, ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->state = htmlspecialchars($row->state, ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->country = htmlspecialchars($row->country ?? '', ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->venueurl = !empty($row->venueslug) ? Route::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : null;
|
||||
$lists[$i]->featured = $row->featured;
|
||||
|
||||
# provide custom fields
|
||||
for ($n = 1; $n <= 10; ++$n) {
|
||||
$var = 'custom'.$n;
|
||||
$lists[$i]->$var = htmlspecialchars($row->$var, ENT_COMPAT, 'UTF-8');
|
||||
}
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a valid url
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
protected static function _format_url($url)
|
||||
{
|
||||
if(!empty($url) && strtolower(substr($url, 0, 7)) != "https://") {
|
||||
$url = 'https://'.$url;
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
1
modules/mod_jem/index.html
Normal file
1
modules/mod_jem/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
1
modules/mod_jem/language/en-GB/index.html
Normal file
1
modules/mod_jem/language/en-GB/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
63
modules/mod_jem/language/en-GB/mod_jem.ini
Normal file
63
modules/mod_jem/language/en-GB/mod_jem.ini
Normal file
@ -0,0 +1,63 @@
|
||||
; @package JEM
|
||||
; @subpackage JEM Upcoming Events Basic Module
|
||||
; @copyright (C) 2013-2024 joomlaeventmanager.net
|
||||
; @copyright (C) 2005-2009 Christoph Lukes
|
||||
; @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
|
||||
;
|
||||
; All translations can be found at https://app.transifex.com/jemproject/
|
||||
; Please join the translation team if you want to contribute your changes to the translations
|
||||
;
|
||||
; Note: All ini files need to be saved as UTF-8, no BOM
|
||||
|
||||
MOD_JEM_EVENTS_IN_MODULE="Events in module"
|
||||
MOD_JEM_EVENTS_IN_MODULE_DESC="Number of events shown in module."
|
||||
MOD_JEM_UPCOMING_OR_ARCHIVED="Events Display-Type"
|
||||
MOD_JEM_UPCOMING_OR_ARCHIVED_DESC="Select if you want to display upcoming, unfinished or archived Events."
|
||||
MOD_JEM_UPCOMING_EVENTS="Upcoming Events"
|
||||
MOD_JEM_UNFINISHED_EVENTS="Unfinished Events"
|
||||
MOD_JEM_ARCHIVED_EVENTS="Archived Events"
|
||||
MOD_JEM_SHOW_NO_EVENTS="Show 'No events'"
|
||||
MOD_JEM_SHOW_NO_EVENTS_DESC="Show a text if no events has been found. Otherwise module will not be shown."
|
||||
MOD_JEM_HIGHLIGHT_FEATURED="Highlight Featured"
|
||||
MOD_JEM_HIGHLIGHT_FEATURED_DESC="Show a special style for the featured events, by default bold."
|
||||
MOD_JEM_OFFSET_HOURS="Time offset (in hours)"
|
||||
MOD_JEM_OFFSET_HOURS_DESC="Moves time into future (positive values) or into past (negative values). Only used to display not archived events. <br>Examples: To show events finished at least two hours ago set type to Unfinished Events and offset to -2. To show events starting in one week or later set type to Upcoming Events and offset to 168 (7 * 24)."
|
||||
MOD_JEM_TITLE_OR_VENUE="Show Title or Venue"
|
||||
MOD_JEM_TITLE_OR_VENUE_DESC="Choose if the title of the event or the venue should be displayed."
|
||||
MOD_JEM_VENUE="Venue"
|
||||
MOD_JEM_TITLE="Title"
|
||||
MOD_JEM_MAX_TITLE_LENGTH="Max. Title length"
|
||||
MOD_JEM_MAX_TITLE_LENGTH_DESC="Max. length of the title."
|
||||
MOD_JEM_LINK_TO_VENUE="Link to Venue"
|
||||
MOD_JEM_LINK_TO_VENUE_DESC="Link to the Venue. Only if the Venue was chosen above!"
|
||||
MOD_JEM_LINK_TO_EVENT="Link to event on"
|
||||
MOD_JEM_LINK_TO_EVENT_DESC="Link to the event page on Date or Title (if aktivated)."
|
||||
MOD_JEM_SHOW_ICON_COUNTRY_VENUE="Show icon country"
|
||||
MOD_JEM_SHOW_ICON_COUNTRY_VENUE_DESC="Show the small icon country of venue for each event."
|
||||
MOD_JEM_SHOW_FLAG_ICON="Flag icon"
|
||||
MOD_JEM_DATE="Date"
|
||||
MOD_JEM_CATEGORY_ID="Categories"
|
||||
MOD_JEM_CATEGORY_ID_DESC="Choose categories to limit the output to them. Leave blank if you want to show all events."
|
||||
MOD_JEM_VENUE_ID="Venues"
|
||||
MOD_JEM_VENUE_ID_DESC="Choose venues to limit the output to them. Leave blank if you want to show all events."
|
||||
MOD_JEM_DATE_FORMAT="Date format"
|
||||
MOD_JEM_DATE_FORMAT_DESC="Date format using the PHP date format, for example: \"j. M Y\". For more information <a href=\"https://www.php.net/manual/en/datetime.format.php\" target=\"_blank\">visit the PHP manual</a>."
|
||||
MOD_JEM_TIME_FORMAT="Time format"
|
||||
MOD_JEM_TIME_FORMAT_DESC="Time format using the PHP time format, for example: \"H:i\". For more information <a href=\"https://www.php.net/manual/en/datetime.format.php\" target=\"_blank\">visit the PHP manual</a>."
|
||||
MOD_JEM_MODULE_CLASS_SUFFIX="Module Class Suffix"
|
||||
MOD_JEM_MODULE_CLASS_SUFFIX_DESC="A suffix to be applied to the css class of the module, this allows individual module styling."
|
||||
MOD_JEM_CACHING="Caching"
|
||||
MOD_JEM_CACHING_DESC="Select whether to cache the content of this module."
|
||||
MOD_JEM_USE_GLOBAL="Use global"
|
||||
MOD_JEM_NO_CACHING="No caching"
|
||||
MOD_JEM_CACHE_TIME="Cache Time"
|
||||
MOD_JEM_CACHE_TIME_DESC="The time before the module is recached."
|
||||
; MOD_JEM_OCCURING_IN="Events occuring in (days)"
|
||||
; MOD_JEM_OCCURING_IN_DESC="If set, only events occuring after the specified number of days will be listed."
|
||||
; MOD_JEM_OPEN_DATE="Open date"
|
||||
|
||||
MOD_JEM="JEM - Module-Basic"
|
||||
MOD_JEM_XML_DESCRIPTION="JEM Basic Module <br>Displays the events in a module position"
|
||||
|
||||
; Frontend
|
||||
MOD_JEM_NO_EVENTS="No events found."
|
||||
13
modules/mod_jem/language/en-GB/mod_jem.sys.ini
Normal file
13
modules/mod_jem/language/en-GB/mod_jem.sys.ini
Normal file
@ -0,0 +1,13 @@
|
||||
; @package JEM
|
||||
; @subpackage JEM Upcoming Events Basic Module
|
||||
; @copyright (C) 2013-2024 joomlaeventmanager.net
|
||||
; @copyright (C) 2005-2009 Christoph Lukes
|
||||
; @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
|
||||
;
|
||||
; All translations can be found at https://app.transifex.com/jemproject/
|
||||
; Please join the translation team if you want to contribute your changes to the translations
|
||||
;
|
||||
; Note: All ini files need to be saved as UTF-8, no BOM
|
||||
|
||||
MOD_JEM="JEM - Basic Module"
|
||||
MOD_JEM_XML_DESCRIPTION="This module shows a short list of a specified number of events."
|
||||
1
modules/mod_jem/language/index.html
Normal file
1
modules/mod_jem/language/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
53
modules/mod_jem/language/it-IT/it-IT.mod_jem.ini
Normal file
53
modules/mod_jem/language/it-IT/it-IT.mod_jem.ini
Normal file
@ -0,0 +1,53 @@
|
||||
; @version 2.1.6
|
||||
; @package JEM
|
||||
; @subpackage JEM Upcoming Events Basic Module
|
||||
; @copyright (C) 2005-2009 Christoph Lukes
|
||||
; @copyright (C) 2013-2016 joomlaeventmanager.net
|
||||
; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||
;
|
||||
; All translations can be found at https://www.transifex.com/projects/p/JEM/
|
||||
; Please join the translation team if you want to contribute your changes to the translations
|
||||
;
|
||||
; Note : All ini files need to be saved as UTF-8 - No BOM
|
||||
|
||||
MOD_JEM_EVENTS_IN_MODULE="Eventi nel modulo"
|
||||
MOD_JEM_EVENTS_IN_MODULE_DESC="Numero di eventi da mostrare nel modulo."
|
||||
MOD_JEM_UPCOMING_OR_ARCHIVED="Tipo di visualizzazione degli eventi"
|
||||
MOD_JEM_UPCOMING_OR_ARCHIVED_DESC="Selezionare se si desidera visualizzare i prossimi eventi, quelli non ancora passati o archiviati."
|
||||
MOD_JEM_UPCOMING_EVENTS="Prossimi eventi"
|
||||
MOD_JEM_UNFINISHED_EVENTS="Eventi in corso"
|
||||
MOD_JEM_ARCHIVED_EVENTS="Eventi archiviati"
|
||||
MOD_JEM_OFFSET_HOURS="Tempo offset (in ore)"
|
||||
MOD_JEM_OFFSET_HOURS_DESC="Sposta il tempo nel futuro (valori positivi) o nel passato (valori negativi). Utilizzato solo per visualizzare gli eventi non archiviati.<br>Esempi: Per mostrare gli eventi finiti almeno due ore fa, impostare il tipo di eventi "_QQ_"In corso"_QQ_" e offset a -2. Per mostrare gli eventi che inizieranno tra una settimana o piu` tardi, impostare il tipo di eventi "_QQ_"prossimi eventi"_QQ_" e offset a 188."
|
||||
MOD_JEM_TITLE_OR_VENUE="Mostra titolo o sede"
|
||||
MOD_JEM_TITLE_OR_VENUE_DESC="Scegli se devono essere visualizzati il titolo dell'evento o la sede."
|
||||
MOD_JEM_VENUE="Sede"
|
||||
MOD_JEM_TITLE="Titolo"
|
||||
MOD_JEM_MAX_TITLE_LENGTH="Lunghezza massima titolo"
|
||||
MOD_JEM_MAX_TITLE_LENGTH_DESC="Lunghezza massima titolo."
|
||||
MOD_JEM_LINK_TO_VENUE="Link alla sede"
|
||||
MOD_JEM_LINK_TO_VENUE_DESC="Link alla sede. Solo se il luogo è stato scelto sopra!"
|
||||
MOD_JEM_LINK_TO_EVENT="Link all'evento attivo"
|
||||
MOD_JEM_LINK_TO_EVENT_DESC="Link alla pagina dell'evento sulla data o titolo (se attivato)."
|
||||
MOD_JEM_DATE="Data"
|
||||
MOD_JEM_CATEGORY_ID="Categorie"
|
||||
MOD_JEM_CATEGORY_ID_DESC="Scegli categorie per limitare l'output. Lasciare vuoto se si desidera visualizzare tutti gli eventi."
|
||||
MOD_JEM_VENUE_ID="Sedi"
|
||||
MOD_JEM_VENUE_ID_DESC="Scegli categorie per limitare l'output. Lasciare vuoto se si desidera visualizzare tutti gli eventi."
|
||||
MOD_JEM_DATE_FORMAT="Formato data"
|
||||
MOD_JEM_DATE_FORMAT_DESC="Formato data utilizzando il formato della data di PHP, per esempio: "_QQ_"j. M Y"_QQ_". Per maggiori informazioni consulta il manuale PHP sui php.net."
|
||||
MOD_JEM_TIME_FORMAT="Formato ora"
|
||||
MOD_JEM_TIME_FORMAT_DESC="Formato ora utilizzando il formato PHP strftime, per esempio: "_QQ_"%H:%M. Per maggiori informazioni consulta il manuale PHP sui php.net."
|
||||
MOD_JEM_MODULE_CLASS_SUFFIX="Suffisso classe del modulo"
|
||||
MOD_JEM_MODULE_CLASS_SUFFIX_DESC="Un suffisso da applicare alla classe CSS del modulo, che ne permette lo stile indipendente."
|
||||
MOD_JEM_CACHING="Cache"
|
||||
MOD_JEM_CACHING_DESC="Selezionare se memorizzare nella cache il contenuto di questo modulo."
|
||||
MOD_JEM_USE_GLOBAL="Usa globali"
|
||||
MOD_JEM_NO_CACHING="Nessuna cache"
|
||||
MOD_JEM_CACHE_TIME="Durata cache"
|
||||
MOD_JEM_CACHE_TIME_DESC="Il tempo prima che la cache venga ricaricata."
|
||||
MOD_JEM_OCCURING_IN="Eventi che si verificano in (giorni)"
|
||||
MOD_JEM_OCCURING_IN_DESC="Se impostato, verranno elencati solo gli eventi che si verificano dopo il numero specificato di giorni."
|
||||
MOD_JEM_OPEN_DATE="Data di inizio"
|
||||
|
||||
MOD_JEM_XML_DESCRIPTION="JEM - Modulo base<BR>Mostra gli eventi in un modulo"
|
||||
14
modules/mod_jem/language/it-IT/it-IT.mod_jem.sys.ini
Normal file
14
modules/mod_jem/language/it-IT/it-IT.mod_jem.sys.ini
Normal file
@ -0,0 +1,14 @@
|
||||
; @version 2.0.0
|
||||
; @package JEM
|
||||
; @subpackage JEM Upcoming Events Basic Module
|
||||
; @copyright (C) 2005-2009 Christoph Lukes
|
||||
; @copyright (C) 2013-2014 joomlaeventmanager.net
|
||||
; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||
;
|
||||
; All translations can be found at https://www.transifex.com/projects/p/JEM/
|
||||
; Please join the translation team if you want to contribute your changes to the translations
|
||||
;
|
||||
; Note : All ini files need to be saved as UTF-8 - No BOM
|
||||
|
||||
MOD_JEM="JEM - Modulo base"
|
||||
MOD_JEM_XML_DESCRIPTION="Questo modulo mostra uno specifico numero di eventi in una breve lista."
|
||||
37
modules/mod_jem/mod_jem.php
Normal file
37
modules/mod_jem/mod_jem.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @package JEM
|
||||
* @subpackage JEM Module
|
||||
* @copyright (C) 2013-2024 joomlaeventmanager.net
|
||||
* @copyright (C) 2005-2009 Christoph Lukes
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
// get helper
|
||||
require_once __DIR__ . '/helper.php';
|
||||
|
||||
require_once(JPATH_SITE.'/components/com_jem/helpers/route.php');
|
||||
require_once(JPATH_SITE.'/components/com_jem/helpers/helper.php');
|
||||
require_once(JPATH_SITE.'/components/com_jem/classes/output.class.php');
|
||||
require_once(JPATH_SITE.'/components/com_jem/factory.php');
|
||||
|
||||
Factory::getApplication()->getLanguage()->load('com_jem', JPATH_SITE.'/components/com_jem');
|
||||
|
||||
$list = ModJemHelper::getList($params);
|
||||
|
||||
// check if any results returned
|
||||
if (empty($list) && !$params->get('show_no_events')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$mod_name = 'mod_jem';
|
||||
|
||||
// maybe a layout style provides a css file
|
||||
JemHelper::loadModuleStyleSheet($mod_name);
|
||||
// load icon font if needed
|
||||
JemHelper::loadIconFont();
|
||||
|
||||
require(JemHelper::getModuleLayoutPath($mod_name));
|
||||
157
modules/mod_jem/mod_jem.xml
Normal file
157
modules/mod_jem/mod_jem.xml
Normal file
@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" version="2.5" client="site" method="upgrade">
|
||||
<name>mod_jem</name>
|
||||
<author>JEM Community</author>
|
||||
<authorEmail>info@joomlaeventmanager.net</authorEmail>
|
||||
<authorUrl>https://www.joomlaeventmanager.net</authorUrl>
|
||||
<creationDate>October 2024</creationDate>
|
||||
<copyright>copyright (C) 2013-2024 joomlaeventmanager.net</copyright>
|
||||
<license>https://www.gnu.org/licenses/gpl-3.0 GNU/GPL</license>
|
||||
<version>4.3.1</version>
|
||||
<description>MOD_JEM_XML_DESCRIPTION</description>
|
||||
|
||||
<scriptfile>script.php</scriptfile>
|
||||
|
||||
<files>
|
||||
<filename module="mod_jem">mod_jem.php</filename>
|
||||
<filename>helper.php</filename>
|
||||
<filename>script.php</filename>
|
||||
<filename>index.html</filename>
|
||||
|
||||
<folder>tmpl</folder>
|
||||
<folder>language</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_jem.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_jem.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Modules" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" addfieldpath="/administrator/components/com_jem/models/fields">
|
||||
<field name="type" type="list"
|
||||
default="0"
|
||||
label="MOD_JEM_UPCOMING_OR_ARCHIVED"
|
||||
description="MOD_JEM_UPCOMING_OR_ARCHIVED_DESC"
|
||||
>
|
||||
<option value="0">MOD_JEM_UPCOMING_EVENTS</option>
|
||||
<option value="1">MOD_JEM_UNFINISHED_EVENTS</option>
|
||||
<option value="2">MOD_JEM_ARCHIVED_EVENTS</option>
|
||||
</field>
|
||||
<field name="count" type="text"
|
||||
default="5"
|
||||
label="MOD_JEM_EVENTS_IN_MODULE"
|
||||
description="MOD_JEM_EVENTS_IN_MODULE_DESC"
|
||||
/>
|
||||
<field name="show_no_events" type="radio"
|
||||
default="1"
|
||||
label="MOD_JEM_SHOW_NO_EVENTS"
|
||||
description="MOD_JEM_SHOW_NO_EVENTS_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
>
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="highlight_featured" type="radio"
|
||||
default="0"
|
||||
label="MOD_JEM_HIGHLIGHT_FEATURED"
|
||||
description="MOD_JEM_HIGHLIGHT_FEATURED_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
>
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="offset_hours" type="text"
|
||||
default=""
|
||||
label="MOD_JEM_OFFSET_HOURS"
|
||||
description="MOD_JEM_OFFSET_HOURS_DESC"
|
||||
/>
|
||||
<field name="showtitloc" type="list"
|
||||
default="1"
|
||||
label="MOD_JEM_TITLE_OR_VENUE"
|
||||
description="MOD_JEM_TITLE_OR_VENUE_DESC"
|
||||
>
|
||||
<option value="0">MOD_JEM_VENUE</option>
|
||||
<option value="1">MOD_JEM_TITLE</option>
|
||||
</field>
|
||||
<field name="cuttitle" type="text"
|
||||
default="30"
|
||||
label="MOD_JEM_MAX_TITLE_LENGTH"
|
||||
description="MOD_JEM_MAX_TITLE_LENGTH_DESC"
|
||||
/>
|
||||
<field name="linkloc" type="radio"
|
||||
default="1"
|
||||
label="MOD_JEM_LINK_TO_VENUE"
|
||||
description="MOD_JEM_LINK_TO_VENUE_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
>
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="linkdet" type="list"
|
||||
default="1"
|
||||
label="MOD_JEM_LINK_TO_EVENT"
|
||||
description="MOD_JEM_LINK_TO_EVENT_DESC"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">MOD_JEM_DATE</option>
|
||||
<option value="2">MOD_JEM_TITLE</option>
|
||||
</field>
|
||||
<field name="showiconcountry" type="radio"
|
||||
default="0"
|
||||
label="MOD_JEM_SHOW_ICON_COUNTRY_VENUE"
|
||||
description="MOD_JEM_SHOW_ICON_COUNTRY_VENUE_DESC"
|
||||
class="btn-group btn-group-yesno"
|
||||
>
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="catid" type="categoryedit"
|
||||
default=""
|
||||
multiple="true"
|
||||
removeroot="true"
|
||||
label="MOD_JEM_CATEGORY_ID"
|
||||
description="MOD_JEM_CATEGORY_ID_DESC"
|
||||
/>
|
||||
<field name="venid" type="venueoptions"
|
||||
default=""
|
||||
multiple="true"
|
||||
label="MOD_JEM_VENUE_ID"
|
||||
description="MOD_JEM_VENUE_ID_DESC"
|
||||
/>
|
||||
<field name="formatdate" type="text"
|
||||
default="D, j. F Y"
|
||||
label="MOD_JEM_DATE_FORMAT"
|
||||
description="MOD_JEM_DATE_FORMAT_DESC"
|
||||
/>
|
||||
<field name="formattime" type="text"
|
||||
default=""
|
||||
label="MOD_JEM_TIME_FORMAT"
|
||||
description="MOD_JEM_TIME_FORMAT_DESC"
|
||||
/>
|
||||
<field name="moduleclass_sfx" type="text"
|
||||
default=""
|
||||
label="MOD_JEM_MODULE_CLASS_SUFFIX"
|
||||
description="MOD_JEM_MODULE_CLASS_SUFFIX_DESC"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="advanced">
|
||||
<field name="cache" type="list"
|
||||
default="1"
|
||||
label="MOD_JEM_CACHING"
|
||||
description="MOD_JEM_CACHING_DESC"
|
||||
>
|
||||
<option value="1">MOD_JEM_USE_GLOBAL</option>
|
||||
<option value="0">MOD_JEM_NO_CACHING</option>
|
||||
</field>
|
||||
<field name="cache_time" type="text"
|
||||
default="900"
|
||||
label="MOD_JEM_CACHE_TIME"
|
||||
description="MOD_JEM_CACHE_TIME_DESC"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
131
modules/mod_jem/script.php
Normal file
131
modules/mod_jem/script.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* @package JEM
|
||||
* @copyright (C) 2013-2024 joomlaeventmanager.net
|
||||
* @copyright (C) 2005-2009 Christoph Lukes
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
/**
|
||||
* Script file of JEM component
|
||||
*/
|
||||
class mod_jemInstallerScript
|
||||
{
|
||||
|
||||
private $name = 'mod_jem';
|
||||
|
||||
private $oldRelease = "";
|
||||
private $newRelease = "";
|
||||
|
||||
/**
|
||||
* method to run before an install/update/uninstall method
|
||||
* (it seams method is not called on uninstall)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function preflight($type, $parent)
|
||||
{
|
||||
// abort if the release being installed is not newer than the currently installed version
|
||||
if (strtolower($type) == 'update') {
|
||||
// Installed component version
|
||||
$this->oldRelease = $this->getParam('version');
|
||||
|
||||
// Installing component version as per Manifest file
|
||||
$this->newRelease = (string) $parent->getManifest()->version;
|
||||
|
||||
if (version_compare($this->newRelease, $this->oldRelease, 'lt')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run after an install/update/uninstall method
|
||||
* (it seams method is not called on uninstall)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function postflight($type, $parent)
|
||||
{
|
||||
if (strtolower($type) == 'update') {
|
||||
// Changes between 2.1.5 -> 2.1.6
|
||||
if (version_compare($this->oldRelease, '2.1.6-rc3', 'le') && version_compare($this->newRelease, '2.1.6-rc3', 'ge')) {
|
||||
// change category/venue/event ID lists from string to array
|
||||
$this->updateParams216();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a parameter from the manifest file (actually, from the manifest cache).
|
||||
*
|
||||
* @param $name The name of the parameter
|
||||
*
|
||||
* @return The parameter
|
||||
*/
|
||||
private function getParam($name)
|
||||
{
|
||||
$db = Factory::getContainer()->get('DatabaseDriver');
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('manifest_cache')->from('#__extensions')->where(array("type = 'module'", "element = '".$this->name."'"));
|
||||
$db->setQuery($query);
|
||||
$manifest = json_decode($db->loadResult(), true);
|
||||
return $manifest[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment category ids in params of JEM modules.
|
||||
* (required when updating from 1.9.4 or below to 1.9.5 or newer)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function updateParams216()
|
||||
{
|
||||
// get all "mod_jem..." entries
|
||||
$db = Factory::getContainer()->get('DatabaseDriver');
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('id, params');
|
||||
$query->from('#__modules');
|
||||
$query->where('module = "' . $this->name . '"');
|
||||
$db->setQuery($query);
|
||||
$items = $db->loadObjectList();
|
||||
|
||||
foreach ($items as $item) {
|
||||
// Decode the item params
|
||||
$reg = new Registry;
|
||||
$reg->loadString($item->params);
|
||||
|
||||
$modified = false;
|
||||
|
||||
// catid - if string then convert to array
|
||||
$ids = $reg->get('catid');
|
||||
if (!empty($ids) && is_string($ids)) {
|
||||
$reg->set('catid', explode(',', $ids));
|
||||
$modified = true;
|
||||
}
|
||||
// venid - if string then convert to array
|
||||
$ids = $reg->get('venid');
|
||||
if (!empty($ids) && is_string($ids)) {
|
||||
$reg->set('venid', explode(',', $ids));
|
||||
$modified = true;
|
||||
}
|
||||
|
||||
// write back
|
||||
if ($modified) {
|
||||
// write changed params back into DB
|
||||
$query = $db->getQuery(true);
|
||||
$query->update('#__modules');
|
||||
$query->set('params = '.$db->quote((string)$reg));
|
||||
$query->where(array('id = '.$db->quote($item->id)));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
48
modules/mod_jem/tmpl/alternative/default.php
Normal file
48
modules/mod_jem/tmpl/alternative/default.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @version 2.3.6
|
||||
* @package JEM
|
||||
* @subpackage JEM Module
|
||||
* @copyright (C) 2013-2020 joomlaeventmanager.net
|
||||
* @copyright (C) 2005-2009 Christoph Lukes
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
|
||||
<div class="jemmodulebasic<?php echo $params->get('moduleclass_sfx')?>" id="jemmodulebasic">
|
||||
<?php if (count($list)): ?>
|
||||
<ul class="jemmod">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li>
|
||||
<?php if ($params->get('linkdet') == 1) : ?>
|
||||
<a href="<?php echo $item->link; ?>">
|
||||
<?php echo $item->dateinfo; ?>
|
||||
</a>
|
||||
<?php else :
|
||||
echo $item->dateinfo;
|
||||
endif;
|
||||
?>
|
||||
<br />
|
||||
|
||||
<?php if ($params->get('showtitloc') == 0 && $params->get('linkloc') == 1) : ?>
|
||||
<a href="<?php echo $item->venueurl; ?>">
|
||||
<?php echo $item->text; ?>
|
||||
</a>
|
||||
<?php elseif ($params->get('showtitloc') == 1 && $params->get('linkdet') == 2) : ?>
|
||||
<a href="<?php echo $item->link; ?>">
|
||||
<?php echo $item->text; ?>
|
||||
</a>
|
||||
<?php
|
||||
else :
|
||||
echo $item->text;
|
||||
endif;
|
||||
?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else : ?>
|
||||
<?php echo JText::_('MOD_JEM_NO_EVENTS'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
1
modules/mod_jem/tmpl/alternative/index.html
Normal file
1
modules/mod_jem/tmpl/alternative/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
87
modules/mod_jem/tmpl/default.php
Normal file
87
modules/mod_jem/tmpl/default.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* @package JEM
|
||||
* @subpackage JEM Module
|
||||
* @copyright (C) 2013-2024 joomlaeventmanager.net
|
||||
* @copyright (C) 2005-2009 Christoph Lukes
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
$highlight_featured = $params->get('highlight_featured');
|
||||
$showtitloc = $params->get('showtitloc');
|
||||
$linkloc = $params->get('linkloc');
|
||||
$linkdet = $params->get('linkdet');
|
||||
$showiconcountry = $params->get('showiconcountry');
|
||||
$settings = JemHelper::config();
|
||||
?>
|
||||
|
||||
<div class="jemmodulebasic<?php echo $params->get('moduleclass_sfx')?>" id="jemmodulebasic">
|
||||
<?php if (count($list)): ?>
|
||||
<ul class="jemmod">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li class="event_id<?php echo $item->eventid; ?>" itemprop="event" itemscope itemtype="https://schema.org/Event">
|
||||
<?php if($highlight_featured && $item->featured): ?>
|
||||
<span class="event-title highlight_featured">
|
||||
<?php else : ?>
|
||||
<span class="event-title">
|
||||
<?php endif; ?>
|
||||
<?php if (($showiconcountry == 1) && !empty($item->country)) : ?>
|
||||
<?php $flagpath = $settings->flagicons_path . (str_ends_with($settings->flagicons_path, '/')?'':'/');
|
||||
$flagext = substr($flagpath, strrpos($flagpath,"-")+1,-1) ;
|
||||
$flagfile = Uri::getInstance()->base() . $flagpath . strtolower($item->country) . '.' . $flagext;
|
||||
echo '<img src="' . $flagfile . '" alt="' . $item->country . ' ' , Text::_('MOD_JEM_SHOW_FLAG_ICON') . '">' ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($showtitloc == 0 && $linkloc == 1) : ?>
|
||||
<a href="<?php echo $item->venueurl; ?>">
|
||||
<?php echo $item->venue; ?>
|
||||
</a>
|
||||
<?php elseif ($showtitloc == 1 && $linkdet == 2) : ?>
|
||||
<a href="<?php echo $item->link; ?>" title="<?php echo strip_tags($item->title); ?>">
|
||||
<?php echo $item->title; ?>
|
||||
</a>
|
||||
<?php elseif ($showtitloc == 1 && $linkdet == 1) :
|
||||
echo $item->title;
|
||||
|
||||
elseif ($showtitloc == 0 && $linkdet == 1) :
|
||||
echo $item->venue;
|
||||
endif; ?>
|
||||
|
||||
</span>
|
||||
<br />
|
||||
<?php if($highlight_featured && $item->featured): ?>
|
||||
<span class="event-title highlight_featured">
|
||||
<?php else : ?>
|
||||
<span class="event-title">
|
||||
<?php endif; ?>
|
||||
<?php if ($linkdet == 1) : ?>
|
||||
<a href="<?php echo $item->link; ?>" title="<?php echo strip_tags($item->dateinfo); ?>">
|
||||
<?php echo $item->dateinfo; ?>
|
||||
</a>
|
||||
<?php else :
|
||||
echo $item->dateinfo;
|
||||
endif; ?>
|
||||
</span>
|
||||
<?php echo $item->dateschema; ?>
|
||||
<meta itemprop="name" content="<?php echo $item->title; ?>" />
|
||||
<div itemprop="location" itemscope itemtype="https://schema.org/Place" style="display:none;">
|
||||
<meta itemprop="name" content="<?php echo $item->venue; ?>" />
|
||||
<div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress" style="display:none;">
|
||||
<meta itemprop="streetAddress" content="<?php echo $item->street; ?>" />
|
||||
<meta itemprop="addressLocality" content="<?php echo $item->city; ?>" />
|
||||
<meta itemprop="addressRegion" content="<?php echo $item->state; ?>" />
|
||||
<meta itemprop="postalCode" content="<?php echo $item->postalCode; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else : ?>
|
||||
<?php echo Text::_('MOD_JEM_NO_EVENTS'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
1
modules/mod_jem/tmpl/index.html
Normal file
1
modules/mod_jem/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
28
modules/mod_jem/tmpl/mod_jem.css
Normal file
28
modules/mod_jem/tmpl/mod_jem.css
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @package JEM
|
||||
* @subpackage JEM Latest Events Basic Module
|
||||
* @copyright (C) 2013-2024 joomlaeventmanager.net
|
||||
* @copyright (C) 2005-2009 Christoph Lukes
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
|
||||
*/
|
||||
|
||||
|
||||
.highlight_featured{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#jemmodulebasic {
|
||||
padding: 10px 5px;
|
||||
}
|
||||
|
||||
#jemmodulebasic ul {
|
||||
margin-left: 0.7em;
|
||||
padding-left: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#jemmodulebasic ul li {
|
||||
position: relative;
|
||||
margin-left: 1em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
90
modules/mod_jem/tmpl/responsive/default.php
Normal file
90
modules/mod_jem/tmpl/responsive/default.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* @package JEM
|
||||
* @subpackage JEM Module
|
||||
* @copyright (C) 2013-2024 joomlaeventmanager.net
|
||||
* @copyright (C) 2005-2009 Christoph Lukes
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$document = $app->getDocument();
|
||||
|
||||
$highlight_featured = $params->get('highlight_featured');
|
||||
$showtitloc = $params->get('showtitloc');
|
||||
$linkloc = $params->get('linkloc');
|
||||
$linkdet = $params->get('linkdet');
|
||||
$showiconcountry = $params->get('showiconcountry');
|
||||
$settings = JemHelper::config();
|
||||
?>
|
||||
|
||||
<div class="jemmodulebasic<?php echo $params->get('moduleclass_sfx')?>" id="jemmodulebasic">
|
||||
<?php if (count($list)): ?>
|
||||
<ul>
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li class="event_id<?php echo $item->eventid; ?>" itemprop="event" itemscope itemtype="https://schema.org/Event">
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<?php if($highlight_featured && $item->featured): ?>
|
||||
<span class="event-title highlight_featured">
|
||||
<?php else : ?>
|
||||
<span class="event-title">
|
||||
<?php endif; ?>
|
||||
<?php if (($showiconcountry == 1) && !empty($item->country)) : ?>
|
||||
<?php $flagpath = $settings->flagicons_path . (str_ends_with($settings->flagicons_path, '/')?'':'/');
|
||||
$flagext = substr($flagpath, strrpos($flagpath,"-")+1,-1) ;
|
||||
$flagfile = Uri::getInstance()->base() . $flagpath . strtolower($item->country) . '.' . $flagext;
|
||||
echo '<img src="' . $flagfile . '" alt="' . $item->country . ' ' , Text::_('MOD_JEM_SHOW_FLAG_ICON') . '">' ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($showtitloc == 0 && $linkloc == 1) : ?>
|
||||
<a href="<?php echo $item->venueurl; ?>">
|
||||
<?php echo $item->venue; ?>
|
||||
</a>
|
||||
<?php elseif ($showtitloc == 1 && $linkdet == 2) : ?>
|
||||
<a href="<?php echo $item->link; ?>" title="<?php echo strip_tags($item->title); ?>" itemprop="url">
|
||||
<?php echo $item->title; ?>
|
||||
</a>
|
||||
<?php elseif ($showtitloc == 1 && $linkdet == 1) :
|
||||
echo $item->title; ?>
|
||||
<?php elseif ($showtitloc == 0 && $linkdet == 1) :
|
||||
echo $item->venue; ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<br />
|
||||
<?php if($highlight_featured && $item->featured): ?>
|
||||
<span class="event-title highlight_featured">
|
||||
<?php else : ?>
|
||||
<span class="event-title">
|
||||
<?php endif; ?>
|
||||
<?php if ($linkdet == 1) : ?>
|
||||
<a href="<?php echo $item->link; ?>" title="<?php echo strip_tags($item->dateinfo); ?>" itemprop="url">
|
||||
<?php echo $item->dateinfo; ?>
|
||||
</a>
|
||||
<?php else :
|
||||
echo $item->dateinfo;
|
||||
endif; ?>
|
||||
</span>
|
||||
<?php echo $item->dateschema; ?>
|
||||
<meta itemprop="name" content="<?php echo $item->title; ?>" />
|
||||
<div itemprop="location" itemscope itemtype="https://schema.org/Place" style="display:none;">
|
||||
<meta itemprop="name" content="<?php echo $item->venue; ?>" />
|
||||
<div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress" style="display:none;">
|
||||
<meta itemprop="streetAddress" content="<?php echo $item->street; ?>" />
|
||||
<meta itemprop="addressLocality" content="<?php echo $item->city; ?>" />
|
||||
<meta itemprop="addressRegion" content="<?php echo $item->state; ?>" />
|
||||
<meta itemprop="postalCode" content="<?php echo $item->postalCode; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else : ?>
|
||||
<?php echo Text::_('MOD_JEM_NO_EVENTS'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
1
modules/mod_jem/tmpl/responsive/index.html
Normal file
1
modules/mod_jem/tmpl/responsive/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
100
modules/mod_jem/tmpl/responsive/mod_jem.css
Normal file
100
modules/mod_jem/tmpl/responsive/mod_jem.css
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
* @package JEM
|
||||
* @subpackage JEM Latest Events Basic Module
|
||||
* @copyright (C) 2013-2024 joomlaeventmanager.net
|
||||
* @copyright (C) 2005-2009 Christoph Lukes
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
|
||||
*/
|
||||
|
||||
/*
|
||||
#jemmodulebasic ul {
|
||||
list-style: none;
|
||||
margin-left: 0;
|
||||
padding-left: 1.2em;
|
||||
text-indent: -1.2em;
|
||||
}
|
||||
|
||||
#jemmodulebasic li:before {
|
||||
font-family: FontAwesome;
|
||||
content: "\f073";
|
||||
display: block;
|
||||
float: left;
|
||||
width: 1.2em;
|
||||
}*/
|
||||
|
||||
#jemmodulebasic {
|
||||
padding: 10px 5px;
|
||||
}
|
||||
|
||||
#jemmodulebasic ul {
|
||||
margin-left: 0.7em;
|
||||
padding-left: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#jemmodulebasic ul li {
|
||||
position: relative;
|
||||
margin-left: 1em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* #jemmodulebasic ul li:before {
|
||||
position: absolute;
|
||||
left: -1.5em;
|
||||
font-family: FontAwesome;
|
||||
content: "\f073";
|
||||
} */
|
||||
|
||||
#jemmodulebasic .event-title {
|
||||
hyphens: auto;
|
||||
}
|
||||
|
||||
.highlight_featured{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@media print {
|
||||
#main a:link, #main a:visited {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
div#jem {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
div#jem h2 {
|
||||
border: none;
|
||||
}
|
||||
|
||||
div#jem .flyerimage {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
a[href]:after {
|
||||
content: none !important;
|
||||
}
|
||||
|
||||
div#jem .buttons {
|
||||
display: none;
|
||||
}
|
||||
|
||||
abbr[title]:after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
.ir a:after,
|
||||
a[href^="javascript:"]:after,
|
||||
a[href^="#"]:after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
a:link:after, a:visited:after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
|
||||
div#jem .flyerimage {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
578
modules/mod_jem_banner/helper.php
Normal file
578
modules/mod_jem_banner/helper.php
Normal file
@ -0,0 +1,578 @@
|
||||
<?php
|
||||
/**
|
||||
* @package JEM
|
||||
* @subpackage JEM Banner Module
|
||||
* @copyright (C) 2013-2024 joomlaeventmanager.net
|
||||
* @copyright (C) 2005-2009 Christoph Lukes
|
||||
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use \Joomla\CMS\Factory;
|
||||
use \Joomla\CMS\Language\Text;
|
||||
use \Joomla\CMS\Router\Route;
|
||||
use \Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
|
||||
use Joomla\CMS\Date\Date;
|
||||
|
||||
BaseDatabaseModel::addIncludePath(JPATH_SITE.'/components/com_jem/models', 'JemModel');
|
||||
|
||||
/**
|
||||
* Module-Banner
|
||||
*/
|
||||
abstract class ModJemBannerHelper
|
||||
{
|
||||
/**
|
||||
* Method to get the events
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param (J)Registry &$params Reference to module's parameters
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getList(&$params)
|
||||
{
|
||||
mb_internal_encoding('UTF-8');
|
||||
|
||||
static $formats = array('year' => 'Y', 'month' => 'F', 'day' => 'j', 'weekday' => 'l');
|
||||
static $defaults = array('year' => ' ', 'month' => '', 'day' => '?', 'weekday' => '');
|
||||
|
||||
$db = Factory::getContainer()->get('DatabaseDriver');
|
||||
$user = JemFactory::getUser();
|
||||
$levels = $user->getAuthorisedViewLevels();
|
||||
|
||||
# Retrieve Eventslist model for the data
|
||||
$model = BaseDatabaseModel::getInstance('Eventslist', 'JemModel', array('ignore_request' => true));
|
||||
|
||||
# Set params for the model
|
||||
# has to go before the getItems function
|
||||
$model->setState('params', $params);
|
||||
|
||||
# filter published
|
||||
# 0: unpublished
|
||||
# 1: published
|
||||
# 2: archived
|
||||
# -2: trashed
|
||||
|
||||
# type:
|
||||
# 0: upcoming (not started) - dates,times > now+offset
|
||||
# 1: unfinished (not ended) - enddates,endtimes > now+offset
|
||||
# 2: archived - no limit, but from now back to the past
|
||||
# 3: running (today) - enddates,endtimes > today+offset AND dates,times < tomorrow+offset
|
||||
# 4: featured - ? (same as upcoming yet)
|
||||
# 5: open date - no limit
|
||||
$type = (int)$params->get('type');
|
||||
$offset_days = (int)($params->get('offset_hours', 0) / 24); // hours given must be multiple of 24, truncate to full days
|
||||
$offset_minutes = (int)($params->get('offset_hours', 0) * 60);
|
||||
$max_days = (int) $params->get('max_days', 0); // empty = unlimited
|
||||
$max_minutes = $max_days ? ($max_days * 24 * 60 + $offset_minutes) : false;
|
||||
$max_title_length = (int)$params->get('cuttitle', '25');
|
||||
$max_desc_length = (int)$params->get('descriptionlength', 300);
|
||||
$published = 1;
|
||||
$orderdir = 'ASC';
|
||||
$opendates = 0;
|
||||
$cal_from = false;
|
||||
$cal_to = false;
|
||||
|
||||
# date/time
|
||||
$dateFormat = $params->get('formatdate', '');
|
||||
$timeFormat = $params->get('formattime', '');
|
||||
$addSuffix = empty($timeFormat); // if we use component's default time format we can also add corresponding suffix
|
||||
|
||||
# count
|
||||
$count = min(max($params->get('count', '2'), 1), 100); // range 1..100, default 2
|
||||
|
||||
# shuffle
|
||||
$shuffle = (bool)$params->get('shuffle', 0);
|
||||
if ($shuffle) {
|
||||
$max_count = min(max((int)$params->get('shuffle_count', 20), $count), 100);
|
||||
} else {
|
||||
$max_count = $count;
|
||||
}
|
||||
|
||||
$model->setState('list.limit', $max_count);
|
||||
|
||||
# create type dependent filter rules
|
||||
switch ($type) {
|
||||
case 1: # unfinished events
|
||||
$cal_from = " (a.dates IS NULL OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > $offset_minutes) ";
|
||||
$cal_from .= " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > $offset_minutes)) ";
|
||||
$cal_to = $max_minutes ? " (a.dates IS NULL OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) < $max_minutes)) " : '';
|
||||
break;
|
||||
|
||||
case 2: # archived events
|
||||
$published = 2;
|
||||
$orderdir = 'DESC';
|
||||
break;
|
||||
|
||||
case 3: # running events (one day)
|
||||
$cal_from = " (DATEDIFF(IFNULL(a.enddates, a.dates), CURDATE()) >= $offset_days) ";
|
||||
$cal_to = " (DATEDIFF(a.dates, CURDATE()) < ".($offset_days + 1).") ";
|
||||
break;
|
||||
|
||||
case 5: # open date (only)
|
||||
$opendates = 2;
|
||||
break;
|
||||
|
||||
// case 4: # featured events
|
||||
// $model->setState('filter.featured', 1);
|
||||
// # fall through
|
||||
case 0: # upcoming events
|
||||
default:
|
||||
$cal_from = " (a.dates IS NULL OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > $offset_minutes)) ";
|
||||
$cal_to = $max_minutes ? " (a.dates IS NULL OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) < $max_minutes)) " : '';
|
||||
break;
|
||||
}
|
||||
|
||||
$model->setState('filter.published', $published);
|
||||
$model->setState('filter.orderby', array('a.dates '.$orderdir, 'a.times '.$orderdir, 'a.created '.$orderdir));
|
||||
if (!empty($cal_from)) {
|
||||
$model->setState('filter.calendar_from', $cal_from);
|
||||
}
|
||||
if (!empty($cal_to)) {
|
||||
$model->setState('filter.calendar_to', $cal_to);
|
||||
}
|
||||
$model->setState('filter.groupby', 'a.id');
|
||||
|
||||
# clean parameter data
|
||||
$catids = JemHelper::getValidIds($params->get('catid'));
|
||||
$venids = JemHelper::getValidIds($params->get('venid'));
|
||||
$eventids = JemHelper::getValidIds($params->get('eventid'));
|
||||
$stateloc = $params->get('stateloc');
|
||||
$stateloc_mode = $params->get('stateloc_mode', 0);
|
||||
|
||||
# Open date support
|
||||
if (!empty($eventids)) {
|
||||
// allow (also) open dates if limited to specific events
|
||||
$opendates = 1;
|
||||
}
|
||||
$model->setState('filter.opendates', $opendates);
|
||||
|
||||
# featured
|
||||
$featured = (bool)$params->get('featured_only', 0);
|
||||
if ($featured) {
|
||||
$model->setState('filter.featured', 1);
|
||||
}
|
||||
|
||||
# filter category's
|
||||
if ($catids) {
|
||||
$model->setState('filter.category_id', $catids);
|
||||
$model->setState('filter.category_id.include', true);
|
||||
}
|
||||
|
||||
# filter venue's
|
||||
if ($venids) {
|
||||
$model->setState('filter.venue_id', $venids);
|
||||
$model->setState('filter.venue_id.include', true);
|
||||
}
|
||||
|
||||
# filter event id's
|
||||
if ($eventids) {
|
||||
$model->setState('filter.event_id', $eventids);
|
||||
$model->setState('filter.event_id.include', true);
|
||||
}
|
||||
|
||||
# filter venue's state/province
|
||||
if ($stateloc) {
|
||||
$model->setState('filter.venue_state', $stateloc);
|
||||
$model->setState('filter.venue_state.mode', $stateloc_mode); // 0: exact, 1: partial
|
||||
}
|
||||
|
||||
####
|
||||
# Retrieve the available Events
|
||||
####
|
||||
$events = $model->getItems();
|
||||
|
||||
$color = $params->get('color');
|
||||
$fallback_color = $params->get('fallbackcolor', '#EEEEEE');
|
||||
$fallback_color_is_dark = self::_is_dark($fallback_color);
|
||||
|
||||
// Don't shuffle original array to keep ordering of remaining events intact.
|
||||
$indices = array_keys($events);
|
||||
if (count($events) > $count) {
|
||||
if ($shuffle) {
|
||||
shuffle($indices);
|
||||
}
|
||||
array_splice($indices, $count);
|
||||
}
|
||||
|
||||
# Loop through the result rows and prepare data
|
||||
$lists = array();
|
||||
$i = -1; // it's easier to increment first
|
||||
|
||||
foreach ($events as $key => $row)
|
||||
{
|
||||
if (!in_array($key, $indices)) {
|
||||
continue; // skip removed events
|
||||
}
|
||||
|
||||
# create thumbnails if needed and receive imagedata
|
||||
$dimage = $row->datimage ? JemImage::flyercreator($row->datimage, 'event') : null;
|
||||
$limage = $row->locimage ? JemImage::flyercreator($row->locimage, 'venue') : null;
|
||||
|
||||
#################
|
||||
## DEFINE LIST ##
|
||||
#################
|
||||
|
||||
$lists[++$i] = new stdClass(); // add new object
|
||||
|
||||
# check view access
|
||||
if (in_array($row->access, $levels)) {
|
||||
# We know that user has the privilege to view the event
|
||||
$lists[$i]->link = Route::_(JemHelperRoute::getEventRoute($row->slug));
|
||||
$lists[$i]->linkText = Text::_('MOD_JEM_BANNER_READMORE');
|
||||
} else {
|
||||
$lists[$i]->link = Route::_('index.php?option=com_users&view=login');
|
||||
$lists[$i]->linkText = Text::_('MOD_JEM_BANNER_READMORE_REGISTER');
|
||||
}
|
||||
|
||||
# cut title
|
||||
$fulltitle = htmlspecialchars($row->title, ENT_COMPAT, 'UTF-8');
|
||||
if (mb_strlen($fulltitle) > $max_title_length) {
|
||||
$title = mb_substr($fulltitle, 0, $max_title_length) . '…';
|
||||
} else {
|
||||
$title = $fulltitle;
|
||||
}
|
||||
|
||||
$lists[$i]->eventid = $row->id;
|
||||
$lists[$i]->title = $title;
|
||||
$lists[$i]->fulltitle = $fulltitle;
|
||||
$lists[$i]->venue = htmlspecialchars($row->venue ?? '', ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->catname = implode(", ", JemOutput::getCategoryList($row->categories, $params->get('linkcategory', 1)));
|
||||
$lists[$i]->state = htmlspecialchars($row->state ?? '', ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->street = htmlspecialchars($row->street ?? '', ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->postalCode = htmlspecialchars($row->postalCode ?? '', ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->city = htmlspecialchars($row->city ?? '', ENT_COMPAT, 'UTF-8');
|
||||
$lists[$i]->eventlink = $params->get('linkevent', 1) ? Route::_(JemHelperRoute::getEventRoute($row->slug)) : '';
|
||||
$lists[$i]->venuelink = $params->get('linkvenue', 1) ? Route::_(JemHelperRoute::getVenueRoute($row->venueslug)) : '';
|
||||
|
||||
# time/date
|
||||
/* depending on settongs we need:
|
||||
* showcalendar 1, datemethod 1 : month, weekday, day + time
|
||||
* showcalendar 1, datemethod 2 : month, weekday, day + relative date + time
|
||||
* showcalendar 0, datemethod 1 : (long) date + time
|
||||
* showcalendar 0, datemethod 2 : relative date + time
|
||||
*/
|
||||
$lists[$i]->startdate = empty($row->dates) ? $defaults : self::_format_date_fields($row->dates, $formats);
|
||||
$lists[$i]->enddate = empty($row->enddates) ? $defaults : self::_format_date_fields($row->enddates, $formats);
|
||||
list($lists[$i]->date,
|
||||
$lists[$i]->time) = self::_format_date_time($row, $params->get('datemethod', 1), $dateFormat, $timeFormat, $addSuffix);
|
||||
$lists[$i]->dateinfo = JemOutput::formatDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $dateFormat, $timeFormat, $addSuffix);
|
||||
$lists[$i]->dateschema = JEMOutput::formatSchemaOrgDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $showTime = true);
|
||||
|
||||
if ($dimage == null) {
|
||||
$lists[$i]->eventimage = '';
|
||||
$lists[$i]->eventimageorig = '';
|
||||
} else {
|
||||
$lists[$i]->eventimage = Uri::base(true).'/'.$dimage['thumb'];
|
||||
$lists[$i]->eventimageorig = Uri::base(true).'/'.$dimage['original'];
|
||||
}
|
||||
|
||||
if ($limage == null) {
|
||||
$lists[$i]->venueimage = '';
|
||||
$lists[$i]->venueimageorig = '';
|
||||
} else {
|
||||
$lists[$i]->venueimage = Uri::base(true).'/'.$limage['thumb'];
|
||||
$lists[$i]->venueimageorig = Uri::base(true).'/'.$limage['original'];
|
||||
}
|
||||
|
||||
# append <br /> tags on line breaking tags so they can be stripped below
|
||||
$description = preg_replace("'<(hr[^/>]*?/|/(div|h[1-6]|li|p|tr))>'si", "$0<br />", $row->introtext);
|
||||
|
||||
# strip html tags but leave <br /> tags
|
||||
$description = strip_tags($description, "<br>");
|
||||
|
||||
# switch <br /> tags to space character
|
||||
if ($params->get('br') == 0) {
|
||||
$description = mb_ereg_replace('<br[ /]*>',' ', $description);
|
||||
}
|
||||
|
||||
if (empty($description)) {
|
||||
$lists[$i]->eventdescription = Text::_('MOD_JEM_BANNER_NO_DESCRIPTION');
|
||||
} elseif (mb_strlen($description) > $max_desc_length) {
|
||||
$lists[$i]->eventdescription = mb_substr($description, 0, $max_desc_length) . '…';
|
||||
} else {
|
||||
$lists[$i]->eventdescription = $description;
|
||||
}
|
||||
|
||||
$lists[$i]->readmore = mb_strlen(trim($row->fulltext));
|
||||
|
||||
$lists[$i]->colorclass = $color;
|
||||
if (($color == 'alpha') || (($color == 'category') && empty($row->categories))) {
|
||||
$lists[$i]->color = $fallback_color;
|
||||
$lists[$i]->color_is_dark = $fallback_color_is_dark;
|
||||
}
|
||||
elseif (($color == 'category') && !empty($row->categories)) {
|
||||
$colors = array();
|
||||
foreach ($row->categories as $category) {
|
||||
if (!empty($category->color)) {
|
||||
$colors[$category->color] = $category->color;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($colors) == 1) {
|
||||
$lists[$i]->color = array_pop($colors);
|
||||
$lists[$i]->color_is_dark = self::_is_dark($lists[$i]->color);
|
||||
} else {
|
||||
$lists[$i]->color = $fallback_color;
|
||||
$lists[$i]->color_is_dark = $fallback_color_is_dark;
|
||||
}
|
||||
}
|
||||
|
||||
# provide custom fields
|
||||
for ($n = 1; $n <= 10; ++$n) {
|
||||
$var = 'custom'.$n;
|
||||
$lists[$i]->$var = htmlspecialchars($row->$var, ENT_COMPAT, 'UTF-8');
|
||||
}
|
||||
} // foreach ($events as $row)
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to decide if given color is dark.
|
||||
*
|
||||
* @access protected
|
||||
*
|
||||
* @param string $color color value in form '#rgb' or '#rrggbb'
|
||||
*
|
||||
* @return bool given color is dark (true) or not (false)
|
||||
*
|
||||
* @since 2.2.1
|
||||
*/
|
||||
protected static function _is_dark($color)
|
||||
{
|
||||
$gray = false;
|
||||
|
||||
# we understand '#rgb' or '#rrggbb' colors only
|
||||
# r:77, g:150, b:28
|
||||
if (strlen($color) < 5) {
|
||||
$scan = sscanf($color, '#%1x%1x%1x');
|
||||
if (is_array($scan) && count($scan) == 3) {
|
||||
$gray = (17 * $scan[0] * 77) / 255
|
||||
+ (17 * $scan[1] * 150) / 255
|
||||
+ (17 * $scan[2] * 28) / 255;
|
||||
}
|
||||
} else {
|
||||
$scan = sscanf($color, '#%2x%2x%2x');
|
||||
if (is_array($scan) && count($scan) == 3) {
|
||||
$gray = ($scan[0] * 77) / 255
|
||||
+ ($scan[1] * 150) / 255
|
||||
+ ($scan[2] * 28) / 255;
|
||||
}
|
||||
}
|
||||
|
||||
return ($gray <= 160) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* format days
|
||||
*
|
||||
* @deprecated since version 2.1.3
|
||||
*/
|
||||
protected static function _format_day($row, &$params)
|
||||
{
|
||||
//Get needed timestamps and format
|
||||
//setlocale (LC_TIME, 'de_DE.UTF8');
|
||||
$yesterday_stamp = mktime(0, 0, 0, date("m"), date("d")-1, date("Y"));
|
||||
$yesterday = date("Y-m-d", $yesterday_stamp);
|
||||
$today_stamp = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
|
||||
$today = date('Y-m-d');
|
||||
$tomorrow_stamp = mktime(0, 0, 0, date("m"), date("d")+1, date("Y"));
|
||||
$tomorrow = date("Y-m-d", $tomorrow_stamp);
|
||||
|
||||
$dates_stamp = strtotime($row->dates);
|
||||
$enddates_stamp = $row->enddates ? strtotime($row->enddates) : null;
|
||||
|
||||
//check if today or tomorrow or yesterday and no current running multiday event
|
||||
if (($row->dates == $today) && empty($enddates_stamp)) {
|
||||
$result = Text::_('MOD_JEM_BANNER_TODAY');
|
||||
} elseif ($row->dates == $tomorrow) {
|
||||
$result = Text::_('MOD_JEM_BANNER_TOMORROW');
|
||||
} elseif ($row->dates == $yesterday) {
|
||||
$result = Text::_('MOD_JEM_BANNER_YESTERDAY');
|
||||
} else {
|
||||
//if daymethod show day
|
||||
if ($params->get('daymethod', 1) == 1) {
|
||||
$date = date('l', strtotime($row->dates));
|
||||
$result = Text::sprintf('MOD_JEM_BANNER_ON_DATE', $date);
|
||||
|
||||
//Upcoming multidayevent (From 16.10.2010 Until 18.10.2010)
|
||||
if (($dates_stamp > $tomorrow_stamp) && $enddates_stamp) {
|
||||
$startdate = date('l', strtotime($row->dates));
|
||||
$result = Text::sprintf('MOD_JEM_BANNER_FROM', $startdate);
|
||||
}
|
||||
|
||||
//current multidayevent (Until 18.08.2008)
|
||||
if ($row->enddates && ($enddates_stamp > $today_stamp) && ($dates_stamp <= $today_stamp)) {
|
||||
//format date
|
||||
$enddate = date('l', strtotime($row->enddates));
|
||||
$result = Text::sprintf('MOD_JEM_BANNER_UNTIL', $enddate);
|
||||
}
|
||||
} else { // show day difference
|
||||
//the event has an enddate and it's earlier than yesterday
|
||||
if ($row->enddates && ($enddates_stamp < $yesterday_stamp)) {
|
||||
$days = round( ($today_stamp - $enddates_stamp) / 86400 );
|
||||
$result = Text::sprintf('MOD_JEM_BANNER_ENDED_DAYS_AGO', $days);
|
||||
|
||||
//the event has an enddate and it's later than today but the startdate is today or earlier than today
|
||||
//means a currently running event with startdate = today
|
||||
} elseif ($row->enddates && ($enddates_stamp > $today_stamp) && ($dates_stamp <= $today_stamp)) {
|
||||
$days = round( ($enddates_stamp - $today_stamp) / 86400 );
|
||||
$result = Text::sprintf('MOD_JEM_BANNER_DAYS_LEFT', $days);
|
||||
|
||||
//the events date is earlier than yesterday
|
||||
} elseif ($dates_stamp < $yesterday_stamp) {
|
||||
$days = round( ($today_stamp - $dates_stamp) / 86400 );
|
||||
$result = Text::sprintf('MOD_JEM_BANNER_DAYS_AGO', $days );
|
||||
|
||||
//the events date is later than tomorrow
|
||||
} elseif ($dates_stamp > $tomorrow_stamp) {
|
||||
$days = round( ($dates_stamp - $today_stamp) / 86400 );
|
||||
$result = Text::sprintf('MOD_JEM_BANNER_DAYS_AHEAD', $days);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to format date and time information
|
||||
*
|
||||
* @access protected
|
||||
*
|
||||
* @param object $row event as got from db
|
||||
* @param int $method 1 for absolute date, or 2 for relative date
|
||||
* @param string $dateFormat format string for date (optional)
|
||||
* @param string $timeFormat format string for time (optional)
|
||||
* @param bool $addSuffix show or hide (default) time suffix, e.g. 'h' (optional)
|
||||
*
|
||||
* @return array(string, string) returns date and time strings as array
|
||||
*/
|
||||
protected static function _format_date_time($row, $method, $dateFormat = '', $timeFormat = '', $addSuffix = false)
|
||||
{
|
||||
if (empty($row->dates)) {
|
||||
# open date
|
||||
$date = JemOutput::formatDateTime('', ''); // "Open date"
|
||||
$times = $row->times;
|
||||
$endtimes = $row->endtimes;
|
||||
} else {
|
||||
# Get needed timestamps and format
|
||||
$yesterday_stamp = mktime(0, 0, 0, date("m"), date("d")-1, date("Y"));
|
||||
$yesterday = date("Y-m-d", $yesterday_stamp);
|
||||
$today_stamp = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
|
||||
$today = date('Y-m-d');
|
||||
$tomorrow_stamp = mktime(0, 0, 0, date("m"), date("d")+1, date("Y"));
|
||||
$tomorrow = date("Y-m-d", $tomorrow_stamp);
|
||||
|
||||
$dates_stamp = $row->dates ? strtotime($row->dates) : null;
|
||||
$enddates_stamp = $row->enddates ? strtotime($row->enddates) : null;
|
||||
|
||||
$times = $row->times; // show starttime by default
|
||||
|
||||
# datemethod show day difference
|
||||
if ($method == 2) {
|
||||
# Check if today, tomorrow, or yesterday
|
||||
if ($row->dates == $today) {
|
||||
$date = Text::_('MOD_JEM_BANNER_TODAY');
|
||||
} elseif ($row->dates == $tomorrow) {
|
||||
$date = Text::_('MOD_JEM_BANNER_TOMORROW');
|
||||
} elseif ($row->dates == $yesterday) {
|
||||
$date = Text::_('MOD_JEM_BANNER_YESTERDAY');
|
||||
}
|
||||
# This one isn't very different from the DAYS AGO output but it seems
|
||||
# adequate to use different language strings here.
|
||||
#
|
||||
# The event has an enddate and it's earlier than yesterday
|
||||
elseif ($row->enddates && ($enddates_stamp < $yesterday_stamp)) {
|
||||
$days = round(($today_stamp - $enddates_stamp) / 86400);
|
||||
$date = Text::sprintf('MOD_JEM_BANNER_ENDED_DAYS_AGO', $days);
|
||||
# show endtime instead of starttime
|
||||
$times = false;
|
||||
$endtimes = $row->endtimes;
|
||||
}
|
||||
# The event has an enddate and it's later than today but the startdate is earlier than today
|
||||
# means a currently running event
|
||||
elseif ($row->dates && $row->enddates && ($enddates_stamp > $today_stamp) && ($dates_stamp < $today_stamp)) {
|
||||
$days = round(($today_stamp - $dates_stamp) / 86400);
|
||||
$date = Text::sprintf('MOD_JEM_BANNER_STARTED_DAYS_AGO', $days);
|
||||
}
|
||||
# The events date is earlier than yesterday
|
||||
elseif ($row->dates && ($dates_stamp < $yesterday_stamp)) {
|
||||
$days = round(($today_stamp - $dates_stamp) / 86400);
|
||||
$date = Text::sprintf('MOD_JEM_BANNER_DAYS_AGO', $days);
|
||||
}
|
||||
# The events date is later than tomorrow
|
||||
elseif ($row->dates && ($dates_stamp > $tomorrow_stamp)) {
|
||||
$days = round(($dates_stamp - $today_stamp) / 86400);
|
||||
$date = Text::sprintf('MOD_JEM_BANNER_DAYS_AHEAD', $days);
|
||||
}
|
||||
else {
|
||||
$date = JemOutput::formatDateTime('', ''); // Oops - say "Open date"
|
||||
}
|
||||
}
|
||||
# datemethod show date
|
||||
else {
|
||||
///@todo check date+time to be more acurate
|
||||
# Upcoming multidayevent (From 16.10.2008 Until 18.08.2008)
|
||||
if (($dates_stamp >= $today_stamp) && ($enddates_stamp > $dates_stamp)) {
|
||||
$startdate = JemOutput::formatdate($row->dates, $dateFormat);
|
||||
$enddate = JemOutput::formatdate($row->enddates, $dateFormat);
|
||||
$date = Text::sprintf('MOD_JEM_BANNER_FROM_UNTIL', $startdate, $enddate);
|
||||
# additionally show endtime
|
||||
$endtimes = $row->endtimes;
|
||||
}
|
||||
# Current multidayevent (Until 18.08.2008)
|
||||
elseif ($row->enddates && ($enddates_stamp >= $today_stamp) && ($dates_stamp < $today_stamp)) {
|
||||
$enddate = JEMOutput::formatdate($row->enddates, $dateFormat);
|
||||
$date = Text::sprintf('MOD_JEM_BANNER_UNTIL', $enddate);
|
||||
# show endtime instead of starttime
|
||||
$times = false;
|
||||
$endtimes = $row->endtimes;
|
||||
}
|
||||
# Single day event
|
||||
else {
|
||||
$startdate = JEMOutput::formatdate($row->dates, $dateFormat);
|
||||
$date = Text::sprintf('MOD_JEM_BANNER_ON_DATE', $startdate);
|
||||
# additionally show endtime, but on single day events only to prevent user confusion
|
||||
if (empty($row->enddates)) {
|
||||
$endtimes = $row->endtimes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$time = empty($times) ? '' : JemOutput::formattime($times, $timeFormat, $addSuffix);
|
||||
$time .= empty($endtimes) ? '' : (' - ' . JemOutput::formattime($row->endtimes, $timeFormat, $addSuffix));
|
||||
|
||||
return array($date, $time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to format different parts of a date as array
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param mixed date in form 'yyyy-mm-dd' or as Date object
|
||||
* @param array formats to get as assotiative array (e.g. 'day' => 'j'; see {@link PHP_MANUAL#date})
|
||||
*
|
||||
* @return mixed array of formatted date parts or false
|
||||
*/
|
||||
protected static function _format_date_fields($date, array $formats)
|
||||
{
|
||||
if (empty($formats)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$jdate = ($date instanceof Date) ? $date : new Date($date);
|
||||
|
||||
foreach ($formats as $k => $v) {
|
||||
$result[$k] = $jdate->format($v, false, true);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
1
modules/mod_jem_banner/index.html
Normal file
1
modules/mod_jem_banner/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
1
modules/mod_jem_banner/language/en-GB/index.html
Normal file
1
modules/mod_jem_banner/language/en-GB/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user