+
title, ENT_QUOTES, 'UTF-8'); ?>
diff --git a/components/com_content/src/View/Category/HtmlView.php b/components/com_content/src/View/Category/HtmlView.php
index cf1129a7dba96..90e31bf226918 100644
--- a/components/com_content/src/View/Category/HtmlView.php
+++ b/components/com_content/src/View/Category/HtmlView.php
@@ -140,10 +140,6 @@ public function display($tpl = null)
{
$this->link_items[] = $item;
}
- else
- {
- continue;
- }
}
}
diff --git a/components/com_users/src/Controller/DisplayController.php b/components/com_users/src/Controller/DisplayController.php
index a86ce49d3c295..0d29349d28cde 100644
--- a/components/com_users/src/Controller/DisplayController.php
+++ b/components/com_users/src/Controller/DisplayController.php
@@ -29,7 +29,7 @@ class DisplayController extends BaseController
* @param array|boolean $urlparams An array of safe URL parameters and their variable types,
* for valid values see {@link \Joomla\CMS\Filter\InputFilter::clean()}.
*
- * @return static This object to support chaining.
+ * @return void
*
* @since 1.5
* @throws \Exception
diff --git a/components/com_users/src/Controller/ProfileController.php b/components/com_users/src/Controller/ProfileController.php
index 6c67fbc33f0e1..e53fd9ef1d5c8 100644
--- a/components/com_users/src/Controller/ProfileController.php
+++ b/components/com_users/src/Controller/ProfileController.php
@@ -72,7 +72,7 @@ public function edit()
/**
* Method to save a user's profile data.
*
- * @return void
+ * @return void|boolean
*
* @since 1.6
* @throws \Exception
diff --git a/layouts/plugins/system/privacyconsent/label.php b/layouts/plugins/system/privacyconsent/label.php
index 7a0acc2323595..655f11905ca5f 100644
--- a/layouts/plugins/system/privacyconsent/label.php
+++ b/layouts/plugins/system/privacyconsent/label.php
@@ -91,6 +91,6 @@
}
// Add the label text and star.
-$label = $link . '
*';
+$label = $link . '
*';
echo $label;
diff --git a/layouts/plugins/user/terms/label.php b/layouts/plugins/user/terms/label.php
index 1fea2c1cd5746..1b4d3278a5b58 100644
--- a/layouts/plugins/user/terms/label.php
+++ b/layouts/plugins/user/terms/label.php
@@ -90,6 +90,6 @@
}
// Add the label text and star.
-$label = $link . '
*';
+$label = $link . '
*';
echo $label;
diff --git a/libraries/src/Access/Access.php b/libraries/src/Access/Access.php
index cb3cfb3d20ae0..c0d63b579988a 100644
--- a/libraries/src/Access/Access.php
+++ b/libraries/src/Access/Access.php
@@ -1045,7 +1045,7 @@ public static function getAuthorisedViewLevels($userId)
}
}
- return $authorised;
+ return array_unique($authorised);
}
// Get all groups that the user is mapped to recursively.
@@ -1070,7 +1070,7 @@ public static function getAuthorisedViewLevels($userId)
}
}
- return $authorised;
+ return array_unique($authorised);
}
/**
diff --git a/libraries/src/Adapter/Adapter.php b/libraries/src/Adapter/Adapter.php
index b315888544cdf..738777623b824 100644
--- a/libraries/src/Adapter/Adapter.php
+++ b/libraries/src/Adapter/Adapter.php
@@ -75,8 +75,8 @@ class Adapter extends CMSObject
public function __construct($basepath, $classprefix = null, $adapterfolder = null)
{
$this->_basepath = $basepath;
- $this->_classprefix = $classprefix ? $classprefix : 'J';
- $this->_adapterfolder = $adapterfolder ? $adapterfolder : 'adapters';
+ $this->_classprefix = $classprefix ?: 'J';
+ $this->_adapterfolder = $adapterfolder ?: 'adapters';
$this->_db = Factory::getDbo();
}
diff --git a/libraries/src/Application/ApplicationHelper.php b/libraries/src/Application/ApplicationHelper.php
index b244388d5f325..454e5978659d7 100644
--- a/libraries/src/Application/ApplicationHelper.php
+++ b/libraries/src/Application/ApplicationHelper.php
@@ -182,8 +182,6 @@ public static function getClientInfo($id = null, $byName = false)
}
}
}
-
- return;
}
/**
diff --git a/libraries/src/Application/CMSApplication.php b/libraries/src/Application/CMSApplication.php
index 4b70a394fd06c..93a741f8c272a 100644
--- a/libraries/src/Application/CMSApplication.php
+++ b/libraries/src/Application/CMSApplication.php
@@ -1137,8 +1137,6 @@ public function setUserState($key, $value)
{
return $registry->set($key, $value);
}
-
- return;
}
/**
diff --git a/libraries/src/Document/FeedDocument.php b/libraries/src/Document/FeedDocument.php
index 1c580a0a4f370..e90261af9cd72 100644
--- a/libraries/src/Document/FeedDocument.php
+++ b/libraries/src/Document/FeedDocument.php
@@ -203,7 +203,7 @@ public function render($cache = false, $params = array())
$type = CmsFactory::getApplication()->input->get('type', 'rss');
// Instantiate feed renderer and set the mime encoding
- $renderer = $this->loadRenderer(($type) ? $type : 'rss');
+ $renderer = $this->loadRenderer($type ?: 'rss');
if (!($renderer instanceof DocumentRenderer))
{
diff --git a/libraries/src/Document/HtmlDocument.php b/libraries/src/Document/HtmlDocument.php
index 1e07878b7e4b1..b097b459c3277 100644
--- a/libraries/src/Document/HtmlDocument.php
+++ b/libraries/src/Document/HtmlDocument.php
@@ -326,7 +326,7 @@ public function setHeadData($data)
*
* @param array $data The document head data in array form
*
- * @return HtmlDocument|null instance of $this to allow chaining or null for empty input data
+ * @return HtmlDocument|void instance of $this to allow chaining or void for empty input data
*
* @since 1.7.0
*/
diff --git a/libraries/src/Document/Renderer/Html/MetasRenderer.php b/libraries/src/Document/Renderer/Html/MetasRenderer.php
index 063028fb1d6f3..371437c0cde93 100644
--- a/libraries/src/Document/Renderer/Html/MetasRenderer.php
+++ b/libraries/src/Document/Renderer/Html/MetasRenderer.php
@@ -67,7 +67,7 @@ public function render($head, $params = array(), $content = null)
{
$prettyPrint = (JDEBUG && \defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : false);
$jsonOptions = json_encode($scriptOptions, $prettyPrint);
- $jsonOptions = $jsonOptions ? $jsonOptions : '{}';
+ $jsonOptions = $jsonOptions ?: '{}';
$wa->addInlineScript(
$jsonOptions,
diff --git a/libraries/src/Environment/Browser.php b/libraries/src/Environment/Browser.php
index b9164d05d90bc..0a3acdd115b61 100644
--- a/libraries/src/Environment/Browser.php
+++ b/libraries/src/Environment/Browser.php
@@ -902,8 +902,6 @@ public function getHTTPProtocol()
return substr($_SERVER['SERVER_PROTOCOL'], $pos + 1);
}
}
-
- return;
}
/**
diff --git a/libraries/src/Feed/FeedParser.php b/libraries/src/Feed/FeedParser.php
index 19a41df4a9027..9e727ddbf8441 100644
--- a/libraries/src/Feed/FeedParser.php
+++ b/libraries/src/Feed/FeedParser.php
@@ -63,7 +63,7 @@ abstract class FeedParser
public function __construct(\XMLReader $stream, InputFilter $inputFilter = null)
{
$this->stream = $stream;
- $this->inputFilter = $inputFilter ? $inputFilter : InputFilter::getInstance(array(), array(), 1, 1);
+ $this->inputFilter = $inputFilter ?: InputFilter::getInstance([], [], 1, 1);
}
/**
diff --git a/libraries/src/Filesystem/Folder.php b/libraries/src/Filesystem/Folder.php
index 3b2c4766e6bbf..f2ccf1340d6a1 100644
--- a/libraries/src/Filesystem/Folder.php
+++ b/libraries/src/Filesystem/Folder.php
@@ -489,7 +489,7 @@ public static function exists($path)
* @param array $excludeFilter Array of filter to exclude
* @param boolean $naturalSort False for asort, true for natsort
*
- * @return array Files in the given folder.
+ * @return array|boolean Files in the given folder.
*
* @since 1.7.0
*/
diff --git a/libraries/src/Filesystem/Stream.php b/libraries/src/Filesystem/Stream.php
index ac459fa1c8548..7c4629a8b81cd 100644
--- a/libraries/src/Filesystem/Stream.php
+++ b/libraries/src/Filesystem/Stream.php
@@ -894,7 +894,7 @@ public function chmod($filename = '', $mode = 0)
/**
* Get the stream metadata
*
- * @return array header/metadata
+ * @return array|boolean header/metadata
*
* @link https://www.php.net/manual/en/function.stream-get-meta-data.php
* @since 1.7.0
diff --git a/libraries/src/Form/Field/UserField.php b/libraries/src/Form/Field/UserField.php
index 0bf7e5a9ae2e6..e7574a08e77de 100644
--- a/libraries/src/Form/Field/UserField.php
+++ b/libraries/src/Form/Field/UserField.php
@@ -160,8 +160,6 @@ protected function getGroups()
{
return explode(',', $this->element['groups']);
}
-
- return;
}
/**
@@ -177,7 +175,5 @@ protected function getExcluded()
{
return explode(',', $this->element['exclude']);
}
-
- return;
}
}
diff --git a/libraries/src/Form/Form.php b/libraries/src/Form/Form.php
index e2959094070de..3a1cac1210f54 100644
--- a/libraries/src/Form/Form.php
+++ b/libraries/src/Form/Form.php
@@ -44,7 +44,7 @@ class Form
* @var array
* @since 1.7.0
*/
- protected $errors = array();
+ protected $errors = [];
/**
* The name of the form instance.
@@ -60,7 +60,7 @@ class Form
* @var array
* @since 1.7.0
*/
- protected $options = array();
+ protected $options = [];
/**
* The form XML definition.
@@ -76,7 +76,7 @@ class Form
* @var Form[]
* @since 1.7.0
*/
- protected static $forms = array();
+ protected static $forms = [];
/**
* Allows extensions to implement repeating elements
@@ -94,7 +94,7 @@ class Form
*
* @since 1.7.0
*/
- public function __construct($name, array $options = array())
+ public function __construct($name, array $options = [])
{
// Set the name for the form.
$this->name = $name;
@@ -277,7 +277,7 @@ public function getFieldAttribute($name, $attribute, $default = null, $group = n
*/
public function getFieldset($set = null)
{
- $fields = array();
+ $fields = [];
// Get all of the field elements in the fieldset.
if ($set)
@@ -302,7 +302,7 @@ public function getFieldset($set = null)
{
// Get the field groups for the element.
$attrs = $element->xpath('ancestor::fields[@name]/@name');
- $groups = array_map('strval', $attrs ? $attrs : array());
+ $groups = array_map('strval', $attrs ?: []);
$group = implode('.', $groups);
// If the field is successfully loaded add it to the result array.
@@ -326,8 +326,8 @@ public function getFieldset($set = null)
*/
public function getFieldsets($group = null)
{
- $fieldsets = array();
- $sets = array();
+ $fieldsets = [];
+ $sets = [];
// Make sure there is a valid Form XML document.
if (!($this->xml instanceof \SimpleXMLElement))
@@ -452,7 +452,7 @@ public function getFormControl()
*/
public function getGroup($group, $nested = false)
{
- $fields = array();
+ $fields = [];
// Get all of the field elements in the field group.
$elements = $this->findFieldsByGroup($group, $nested);
@@ -468,7 +468,7 @@ public function getGroup($group, $nested = false)
{
// Get the field groups for the element.
$attrs = $element->xpath('ancestor::fields[@name]/@name');
- $groups = array_map('strval', $attrs ? $attrs : array());
+ $groups = array_map('strval', $attrs ?: []);
$group = implode('.', $groups);
// If the field is successfully loaded add it to the result array.
@@ -574,7 +574,7 @@ public function getValue($name, $group = null, $default = null)
*
* @since 3.2.3
*/
- public function renderField($name, $group = null, $default = null, $options = array())
+ public function renderField($name, $group = null, $default = null, $options = [])
{
$field = $this->getField($name, $group, $default);
@@ -596,10 +596,10 @@ public function renderField($name, $group = null, $default = null, $options = ar
*
* @since 3.2.3
*/
- public function renderFieldset($name, $options = array())
+ public function renderFieldset($name, $options = [])
{
$fields = $this->getFieldset($name);
- $html = array();
+ $html = [];
foreach ($fields as $field)
{
@@ -670,7 +670,7 @@ public function load($data, $replace = true, $xpath = null)
}
// Get the XML elements to load.
- $elements = array();
+ $elements = [];
if ($xpath)
{
@@ -697,7 +697,7 @@ public function load($data, $replace = true, $xpath = null)
{
// Get the group names as strings for ancestor fields elements.
$attrs = $field->xpath('ancestor::fields[@name]/@name');
- $groups = array_map('strval', $attrs ? $attrs : array());
+ $groups = array_map('strval', $attrs ?: []);
// Check to see if the field exists in the current form.
if ($current = $this->findField((string) $field['name'], implode('.', $groups)))
@@ -1133,7 +1133,7 @@ public function filter($data, $group = null)
// Get the field groups for the element.
$attrs = $field->xpath('ancestor::fields[@name]/@name');
- $groups = array_map('strval', $attrs ? $attrs : array());
+ $groups = array_map('strval', $attrs ?: []);
$attrGroup = implode('.', $groups);
$key = $attrGroup ? $attrGroup . '.' . $name : $name;
@@ -1225,7 +1225,7 @@ public function validate($data, $group = null)
// Get the field groups for the element.
$attrs = $field->xpath('ancestor::fields[@name]/@name');
- $groups = array_map('strval', $attrs ? $attrs : array());
+ $groups = array_map('strval', $attrs ?: []);
$attrGroup = implode('.', $groups);
$key = $attrGroup ? $attrGroup . '.' . $name : $name;
@@ -1292,7 +1292,7 @@ public function postProcess($data, $group = null)
// Get the field groups for the element.
$attrs = $field->xpath('ancestor::fields[@name]/@name');
- $groups = array_map('strval', $attrs ? $attrs : array());
+ $groups = array_map('strval', $attrs ?: []);
$attrGroup = implode('.', $groups);
$key = $attrGroup ? $attrGroup . '.' . $name : $name;
@@ -1321,7 +1321,7 @@ public function postProcess($data, $group = null)
protected function findField($name, $group = null)
{
$element = false;
- $fields = array();
+ $fields = [];
// Make sure there is a valid Form XML document.
if (!($this->xml instanceof \SimpleXMLElement))
@@ -1358,7 +1358,7 @@ protected function findField($name, $group = null)
{
// Get the group names as strings for ancestor fields elements.
$attrs = $field->xpath('ancestor::fields[@name]/@name');
- $names = array_map('strval', $attrs ? $attrs : array());
+ $names = array_map('strval', $attrs ?: []);
// If the field is in the exact group use it and break out of the loop.
if ($names == (array) $groupNames)
@@ -1445,7 +1445,7 @@ protected function &findFieldsByFieldset($name)
protected function &findFieldsByGroup($group = null, $nested = false)
{
$false = false;
- $fields = array();
+ $fields = [];
// Make sure there is a valid Form XML document.
if (!($this->xml instanceof \SimpleXMLElement))
@@ -1480,7 +1480,7 @@ protected function &findFieldsByGroup($group = null, $nested = false)
{
// Get the names of the groups that the field is in.
$attrs = $field->xpath('ancestor::fields[@name]/@name');
- $names = array_map('strval', $attrs ? $attrs : array());
+ $names = array_map('strval', $attrs ?: []);
// If the field is in the specific group then add it to the return list.
if ($names == (array) $groupNames)
@@ -1518,8 +1518,8 @@ protected function &findFieldsByGroup($group = null, $nested = false)
protected function &findGroup($group)
{
$false = false;
- $groups = array();
- $tmp = array();
+ $groups = [];
+ $tmp = [];
// Make sure there is a valid Form XML document.
if (!($this->xml instanceof \SimpleXMLElement))
@@ -1550,7 +1550,7 @@ protected function &findGroup($group)
// Initialise some loop variables.
$validNames = \array_slice($group, 0, $i + 1);
$current = $tmp;
- $tmp = array();
+ $tmp = [];
// Check to make sure that there are no parent groups for each element.
foreach ($current as $element)
@@ -1563,7 +1563,7 @@ protected function &findGroup($group)
{
// Get the group names as strings for ancestor fields elements.
$attrs = $fields->xpath('ancestor-or-self::fields[@name]/@name');
- $names = array_map('strval', $attrs ? $attrs : array());
+ $names = array_map('strval', $attrs ?: []);
// If the group names for the fields element match the valid names at this
// level add the fields element.
@@ -1679,7 +1679,7 @@ protected function syncPaths()
// Get any addfieldpath attributes from the form definition.
$paths = $this->xml->xpath('//*[@addfieldpath]/@addfieldpath');
- $paths = array_map('strval', $paths ? $paths : array());
+ $paths = array_map('strval', $paths ?: []);
// Add the field paths.
foreach ($paths as $path)
@@ -1690,7 +1690,7 @@ protected function syncPaths()
// Get any addformpath attributes from the form definition.
$paths = $this->xml->xpath('//*[@addformpath]/@addformpath');
- $paths = array_map('strval', $paths ? $paths : array());
+ $paths = array_map('strval', $paths ?: []);
// Add the form paths.
foreach ($paths as $path)
@@ -1701,7 +1701,7 @@ protected function syncPaths()
// Get any addrulepath attributes from the form definition.
$paths = $this->xml->xpath('//*[@addrulepath]/@addrulepath');
- $paths = array_map('strval', $paths ? $paths : array());
+ $paths = array_map('strval', $paths ?: []);
// Add the rule paths.
foreach ($paths as $path)
@@ -1712,7 +1712,7 @@ protected function syncPaths()
// Get any addrulepath attributes from the form definition.
$paths = $this->xml->xpath('//*[@addfilterpath]/@addfilterpath');
- $paths = array_map('strval', $paths ? $paths : array());
+ $paths = array_map('strval', $paths ?: []);
// Add the rule paths.
foreach ($paths as $path)
@@ -1723,7 +1723,7 @@ protected function syncPaths()
// Get any addfieldprefix attributes from the form definition.
$prefixes = $this->xml->xpath('//*[@addfieldprefix]/@addfieldprefix');
- $prefixes = array_map('strval', $prefixes ? $prefixes : array());
+ $prefixes = array_map('strval', $prefixes ?: []);
// Add the field prefixes.
foreach ($prefixes as $prefix)
@@ -1733,7 +1733,7 @@ protected function syncPaths()
// Get any addformprefix attributes from the form definition.
$prefixes = $this->xml->xpath('//*[@addformprefix]/@addformprefix');
- $prefixes = array_map('strval', $prefixes ? $prefixes : array());
+ $prefixes = array_map('strval', $prefixes ?: []);
// Add the field prefixes.
foreach ($prefixes as $prefix)
@@ -1743,7 +1743,7 @@ protected function syncPaths()
// Get any addruleprefix attributes from the form definition.
$prefixes = $this->xml->xpath('//*[@addruleprefix]/@addruleprefix');
- $prefixes = array_map('strval', $prefixes ? $prefixes : array());
+ $prefixes = array_map('strval', $prefixes ?: []);
// Add the field prefixes.
foreach ($prefixes as $prefix)
@@ -1753,7 +1753,7 @@ protected function syncPaths()
// Get any addruleprefix attributes from the form definition.
$prefixes = $this->xml->xpath('//*[@addfilterprefix]/@addfilterprefix');
- $prefixes = array_map('strval', $prefixes ? $prefixes : array());
+ $prefixes = array_map('strval', $prefixes ?: []);
// Add the field prefixes.
foreach ($prefixes as $prefix)
@@ -1840,7 +1840,7 @@ public static function addFilterPath($new = null)
* @throws \InvalidArgumentException if no data provided.
* @throws \RuntimeException if the form could not be loaded.
*/
- public static function getInstance($name, $data = null, $options = array(), $replace = true, $xpath = false)
+ public static function getInstance($name, $data = null, $options = [], $replace = true, $xpath = false)
{
// Reference to array with form instances
$forms = &self::$forms;
diff --git a/libraries/src/Form/FormField.php b/libraries/src/Form/FormField.php
index 456bf6c5dee90..d328421e3bf69 100644
--- a/libraries/src/Form/FormField.php
+++ b/libraries/src/Form/FormField.php
@@ -489,8 +489,6 @@ public function __get($name)
return $this->dataAttributes[$name];
}
}
-
- return;
}
/**
@@ -749,11 +747,11 @@ protected function getId($fieldId, $fieldName)
// If we already have an id segment add the field id/name as another level.
if ($id)
{
- $id .= '_' . ($fieldId ? $fieldId : $fieldName);
+ $id .= '_' . ($fieldId ?: $fieldName);
}
else
{
- $id .= ($fieldId ? $fieldId : $fieldName);
+ $id .= ($fieldId ?: $fieldName);
}
// Clean up any invalid characters.
diff --git a/libraries/src/Helper/LibraryHelper.php b/libraries/src/Helper/LibraryHelper.php
index cc584f4d7c4b9..639e6a4958e6e 100644
--- a/libraries/src/Helper/LibraryHelper.php
+++ b/libraries/src/Helper/LibraryHelper.php
@@ -102,7 +102,7 @@ public static function getParams($element, $strict = false)
* @param string $element Element of the library in the extensions table.
* @param Registry $params Params to save
*
- * @return Registry A Registry object.
+ * @return Registry|boolean A Registry object.
*
* @see Registry
* @since 3.2
diff --git a/libraries/src/Installer/Adapter/LibraryAdapter.php b/libraries/src/Installer/Adapter/LibraryAdapter.php
index 498e9b393f014..8600e7d3e50c5 100644
--- a/libraries/src/Installer/Adapter/LibraryAdapter.php
+++ b/libraries/src/Installer/Adapter/LibraryAdapter.php
@@ -372,8 +372,8 @@ protected function setupUninstall()
// Set the library root path
$this->parent->setPath('extension_root', JPATH_PLATFORM . '/' . $manifest->libraryname);
- // Set the source path to the manifests directory so the manifest script may be found
- $this->parent->setPath('source', JPATH_MANIFESTS . '/libraries/' . $manifest->libraryname);
+ // Set the source path to the library root, the manifest script may be found
+ $this->parent->setPath('source', $this->parent->getPath('extension_root'));
$xml = simplexml_load_file($manifestFile);
diff --git a/libraries/src/Language/Language.php b/libraries/src/Language/Language.php
index abf4ba635bcc6..e44a4c859f80c 100644
--- a/libraries/src/Language/Language.php
+++ b/libraries/src/Language/Language.php
@@ -1022,12 +1022,10 @@ public function getPaths($extension = null)
return $this->paths[$extension];
}
- return;
- }
- else
- {
- return $this->paths;
+ return [];
}
+
+ return $this->paths;
}
/**
diff --git a/libraries/src/Log/LogEntry.php b/libraries/src/Log/LogEntry.php
index dc15a627b700e..ae08cc215e085 100644
--- a/libraries/src/Log/LogEntry.php
+++ b/libraries/src/Log/LogEntry.php
@@ -121,6 +121,6 @@ public function __construct($message, $priority = Log::INFO, $category = '', $da
$this->callStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
// Get the date as a Date object.
- $this->date = new Date($date ? $date : 'now');
+ $this->date = new Date($date ?: 'now');
}
}
diff --git a/libraries/src/MVC/Controller/BaseController.php b/libraries/src/MVC/Controller/BaseController.php
index 6b0a2a715f353..b7766baabad6c 100644
--- a/libraries/src/MVC/Controller/BaseController.php
+++ b/libraries/src/MVC/Controller/BaseController.php
@@ -380,8 +380,8 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
$this->redirect = null;
$this->taskMap = array();
- $this->app = $app ? $app : Factory::getApplication();
- $this->input = $input ? $input : $this->app->input;
+ $this->app = $app ?: Factory::getApplication();
+ $this->input = $input ?: $this->app->input;
if (\defined('JDEBUG') && JDEBUG)
{
diff --git a/libraries/src/MVC/Model/AdminModel.php b/libraries/src/MVC/Model/AdminModel.php
index 73373178010bd..23c5d049ecd94 100644
--- a/libraries/src/MVC/Model/AdminModel.php
+++ b/libraries/src/MVC/Model/AdminModel.php
@@ -1214,8 +1214,6 @@ public function publish(&$pks, $value = 1)
if (property_exists($table, $publishedColumnName) && $table->get($publishedColumnName, $value) == $value)
{
unset($pks[$i]);
-
- continue;
}
}
}
diff --git a/libraries/src/MVC/Model/ListModel.php b/libraries/src/MVC/Model/ListModel.php
index 11017826aa5b0..5d62f206ebd5b 100644
--- a/libraries/src/MVC/Model/ListModel.php
+++ b/libraries/src/MVC/Model/ListModel.php
@@ -14,6 +14,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Filter\InputFilter;
use Joomla\CMS\Form\Form;
+use Joomla\CMS\Form\FormFactoryAwareInterface;
use Joomla\CMS\Form\FormFactoryAwareTrait;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Pagination\Pagination;
@@ -24,7 +25,7 @@
*
* @since 1.6
*/
-class ListModel extends BaseDatabaseModel implements ListModelInterface
+class ListModel extends BaseDatabaseModel implements FormFactoryAwareInterface, ListModelInterface
{
use FormBehaviorTrait;
use FormFactoryAwareTrait;
diff --git a/libraries/src/Mail/MailHelper.php b/libraries/src/Mail/MailHelper.php
index a830380a5a2af..dc6b824b927a2 100644
--- a/libraries/src/Mail/MailHelper.php
+++ b/libraries/src/Mail/MailHelper.php
@@ -10,7 +10,9 @@
\defined('JPATH_PLATFORM') or die;
+use Joomla\CMS\Router\Route;
use Joomla\CMS\String\PunycodeHelper;
+use Joomla\CMS\Uri\Uri;
/**
* Email helper class, provides static methods to perform various tasks relevant
@@ -192,4 +194,88 @@ public static function isEmailAddress($email)
return true;
}
+
+ /**
+ * Convert relative (links, images sources) to absolute urls so that content is accessible in email
+ *
+ * @param string $content The content need to convert
+ *
+ * @return string The converted content which the relative urls are converted to absolute urls
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public static function convertRelativeToAbsoluteUrls($content)
+ {
+ $siteUrl = Uri::root();
+
+ // Replace none SEF URLs by absolute SEF URLs
+ if (strpos($content, 'href="index.php?') !== false)
+ {
+ preg_match_all('#href="index.php\?([^"]+)"#m', $content, $matches);
+
+ foreach ($matches[1] as $urlQueryString)
+ {
+ $content = str_replace(
+ 'href="index.php?' . $urlQueryString . '"',
+ 'href="' . Route::link('site', 'index.php?' . $urlQueryString, Route::TLS_IGNORE, true) . '"',
+ $content
+ );
+ }
+
+ self::checkContent($content);
+ }
+
+ // Replace relative links, image sources with absolute Urls
+ $protocols = '[a-zA-Z0-9\-]+:';
+ $attributes = array('href=', 'src=', 'poster=');
+
+ foreach ($attributes as $attribute)
+ {
+ if (strpos($content, $attribute) !== false)
+ {
+ $regex = '#\s' . $attribute . '"(?!/|' . $protocols . '|\#|\')([^"]*)"#m';
+
+ $content = preg_replace($regex, ' ' . $attribute . '"' . $siteUrl . '$1"', $content);
+
+ self::checkContent($content);
+ }
+ }
+
+ return $content;
+ }
+
+ /**
+ * Check the content after regular expression function call.
+ *
+ * @param string $content Content to be checked.
+ *
+ * @return void
+ *
+ * @throws \RuntimeException If there is an error in previous regular expression function call.
+ * @since __DEPLOY_VERSION__
+ */
+ private static function checkContent($content)
+ {
+ if ($content !== null)
+ {
+ return;
+ }
+
+ switch (preg_last_error())
+ {
+ case PREG_BACKTRACK_LIMIT_ERROR:
+ $message = 'PHP regular expression limit reached (pcre.backtrack_limit)';
+ break;
+ case PREG_RECURSION_LIMIT_ERROR:
+ $message = 'PHP regular expression limit reached (pcre.recursion_limit)';
+ break;
+ case PREG_BAD_UTF8_ERROR:
+ $message = 'Bad UTF8 passed to PCRE function';
+ break;
+ default:
+ $message = 'Unknown PCRE error calling PCRE function';
+ }
+
+ throw new \RuntimeException($message);
+ }
}
diff --git a/libraries/src/Mail/MailTemplate.php b/libraries/src/Mail/MailTemplate.php
index 994fc90f1adb8..59d314d0c8b5a 100644
--- a/libraries/src/Mail/MailTemplate.php
+++ b/libraries/src/Mail/MailTemplate.php
@@ -263,6 +263,8 @@ public function send()
$htmlBody = nl2br($plainBody, false);
}
+ $htmlBody = MailHelper::convertRelativeToAbsoluteUrls($htmlBody);
+
$this->mailer->setBody($htmlBody);
}
diff --git a/libraries/src/Table/User.php b/libraries/src/Table/User.php
index 42b97eea88319..8847c34e19ea7 100644
--- a/libraries/src/Table/User.php
+++ b/libraries/src/Table/User.php
@@ -542,7 +542,7 @@ public function setLastVisit($timeStamp = null, $userId = null)
}
}
- // If no timestamp value is passed to function, than current time is used.
+ // If no timestamp value is passed to function, then current time is used.
if ($timeStamp === null)
{
$timeStamp = 'now';
diff --git a/libraries/src/WebAsset/WebAssetManager.php b/libraries/src/WebAsset/WebAssetManager.php
index aced4c4e7ce38..b50e24c89784d 100644
--- a/libraries/src/WebAsset/WebAssetManager.php
+++ b/libraries/src/WebAsset/WebAssetManager.php
@@ -363,7 +363,7 @@ protected function usePresetItems($name): WebAssetManagerInterface
$depName = substr($dependency, 0, $pos);
}
- $depType = $depType ? $depType : 'preset';
+ $depType = $depType ?: 'preset';
// Make sure dependency exists
if (!$this->registry->exists($depType, $depName))
@@ -409,7 +409,7 @@ protected function disablePresetItems($name): WebAssetManagerInterface
$depName = substr($dependency, 0, $pos);
}
- $depType = $depType ? $depType : 'preset';
+ $depType = $depType ?: 'preset';
// Make sure dependency exists
if (!$this->registry->exists($depType, $depName))
diff --git a/libraries/src/Workflow/Workflow.php b/libraries/src/Workflow/Workflow.php
index c4583f84a9fb4..488f7d8ce5f09 100644
--- a/libraries/src/Workflow/Workflow.php
+++ b/libraries/src/Workflow/Workflow.php
@@ -179,8 +179,6 @@ public function getDefaultStageByCategory($catId = 0)
if ($workflow_id == 'inherit')
{
$workflow_id = 0;
-
- continue;
}
elseif ($workflow_id == 'use_default')
{
diff --git a/modules/mod_tags_popular/mod_tags_popular.xml b/modules/mod_tags_popular/mod_tags_popular.xml
index f0fe555d4f120..3e0d17d1cda89 100644
--- a/modules/mod_tags_popular/mod_tags_popular.xml
+++ b/modules/mod_tags_popular/mod_tags_popular.xml
@@ -35,13 +35,12 @@
getAuthorisedViewLevels();
$timeframe = $params->get('timeframe', 'alltime');
- $maximum = $params->get('maximum', 5);
+ $maximum = (int) $params->get('maximum', 5);
$order_value = $params->get('order_value', 'title');
$nowDate = Factory::getDate()->toSql();
$nullDate = $db->getNullDate();
@@ -127,7 +127,11 @@ public static function getList(&$params)
// Backup bound parameters array of the original query
$bounded = $query->getBounded();
- $query->setLimit($maximum);
+ if ($maximum > 0)
+ {
+ $query->setLimit($maximum);
+ }
+
$query->order($db->quoteName('count') . ' DESC');
$equery = $db->getQuery(true)
->select(
@@ -158,7 +162,11 @@ public static function getList(&$params)
}
}
- $query->setLimit($maximum, 0);
+ if ($maximum > 0)
+ {
+ $query->setLimit($maximum);
+ }
+
$db->setQuery($query);
try
diff --git a/modules/mod_tags_similar/mod_tags_similar.xml b/modules/mod_tags_similar/mod_tags_similar.xml
index 3551db24ece7b..119a6c49cea39 100644
--- a/modules/mod_tags_similar/mod_tags_similar.xml
+++ b/modules/mod_tags_similar/mod_tags_similar.xml
@@ -25,13 +25,12 @@