Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Joomla\CMS\Date\Date;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Router\Route;
use Joomla\Filesystem\Path;
use Joomla\String\StringHelper;
Expand Down Expand Up @@ -232,7 +231,7 @@ public static function getHumanReadableLogMessage($log, $generateLinks = true)
* @param string $contentType
* @param integer $id
* @param string $urlVar
* @param CMSObject $object
* @param \stdClass $object
*
* @return string Link to the content item
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Log\Log;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Component\Guidedtours\Administrator\Helper\GuidedtoursHelper;
use Joomla\Database\ParameterType;
Expand Down Expand Up @@ -221,9 +220,9 @@ public function getItem($pk = null)
return false;
}

// Convert to the CMSObject before adding other data.
// Convert to an object before adding other data.
$properties = $table->getProperties(1);
$item = ArrayHelper::toObject($properties, CMSObject::class);
$item = ArrayHelper::toObject($properties);

if (property_exists($item, 'params')) {
$registry = new Registry($item->params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Guidedtours\Administrator\Model\StepModel;
use Joomla\Registry\Registry;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
Expand Down Expand Up @@ -53,7 +54,7 @@ class HtmlView extends BaseHtmlView
/**
* The actions the user is authorised to perform
*
* @var \Joomla\CMS\Object\CMSObject
* @var Registry
*/
protected $canDo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Object\CMSObject;
use Joomla\Database\DatabaseInterface;
use Joomla\Database\ParameterType;

Expand Down Expand Up @@ -233,19 +232,19 @@ public static function getInstallationXML(
/**
* Get the download key of an extension going through their installation xml
*
* @param CMSObject $extension element of an extension
* @param \stdClass $extension element of an extension
*
* @return array An array with the prefix, suffix and value of the download key
*
* @since 4.0.0
*/
public static function getDownloadKey(CMSObject $extension): array
public static function getDownloadKey(\stdClass $extension): array
{
$installXmlFile = self::getInstallationXML(
$extension->get('element'),
$extension->get('type'),
$extension->get('client_id'),
$extension->get('folder')
$extension->element,
$extension->type,
$extension->client_id,
$extension->folder
);

if (!$installXmlFile) {
Expand All @@ -264,7 +263,7 @@ public static function getDownloadKey(CMSObject $extension): array

$prefix = (string) $installXmlFile->dlid['prefix'];
$suffix = (string) $installXmlFile->dlid['suffix'];
$value = substr($extension->get('extra_query'), \strlen($prefix));
$value = substr($extension->extra_query ?? '', \strlen($prefix));

if ($suffix) {
$value = substr($value, 0, -\strlen($suffix));
Expand Down Expand Up @@ -309,7 +308,7 @@ public static function getExtensionDownloadKey(
];
}

// Try to retrieve the extension information as a CMSObject
// Try to retrieve the extension information
$query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
Expand All @@ -323,7 +322,7 @@ public static function getExtensionDownloadKey(
$query->bind(':folder', $folder, ParameterType::STRING);

try {
$extension = new CMSObject($db->setQuery($query)->loadAssoc());
$extension = $db->setQuery($query)->loadObject();
} catch (\Exception $e) {
return [
'supported' => false,
Expand Down Expand Up @@ -355,15 +354,15 @@ public static function getDownloadKeySupportedSites($onlyEnabled = false): array

$extensions = self::getUpdateSitesInformation($onlyEnabled);

$filterClosure = function (CMSObject $extension) {
$filterClosure = function ($extension) {
$dlidInfo = self::getDownloadKey($extension);

return $dlidInfo['supported'];
};
$extensions = array_filter($extensions, $filterClosure);

$mapClosure = function (CMSObject $extension) {
return $extension->get('update_site_id');
$mapClosure = function ($extension) {
return $extension->update_site_id ?? null;
};

return array_map($mapClosure, $extensions);
Expand Down Expand Up @@ -391,7 +390,7 @@ public static function getDownloadKeyExistsSites(bool $exists = true, $onlyEnabl
$extensions = self::getUpdateSitesInformation($onlyEnabled);

// Filter the extensions by what supports Download Keys
$filterClosure = function (CMSObject $extension) use ($exists) {
$filterClosure = function ($extension) use ($exists) {
$dlidInfo = self::getDownloadKey($extension);

if (!$dlidInfo['supported']) {
Expand All @@ -403,8 +402,8 @@ public static function getDownloadKeyExistsSites(bool $exists = true, $onlyEnabl
$extensions = array_filter($extensions, $filterClosure);

// Return only the update site IDs
$mapClosure = function (CMSObject $extension) {
return $extension->get('update_site_id');
$mapClosure = function ($extension) {
return $extension->update_site_id ?? null;
};

return array_map($mapClosure, $extensions);
Expand All @@ -416,7 +415,7 @@ public static function getDownloadKeyExistsSites(bool $exists = true, $onlyEnabl
*
* @param bool $onlyEnabled Only return enabled update sites
*
* @return CMSObject[] List of update site and linked extension information
* @return \stdClass[] List of update site and linked extension information
* @since 4.0.0
*/
protected static function getUpdateSitesInformation(bool $onlyEnabled): array
Expand Down Expand Up @@ -473,14 +472,9 @@ protected static function getUpdateSitesInformation(bool $onlyEnabled): array

// Try to get all of the update sites, including related extension information
try {
$items = [];
$db->setQuery($query);

foreach ($db->getIterator() as $item) {
$items[] = new CMSObject($item);
}

return $items;
return $db->loadObjectList();
} catch (\Exception $e) {
return [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use Joomla\CMS\Form\Form;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Object\CMSObject;
use Joomla\Component\Installer\Administrator\Helper\InstallerHelper;
use Joomla\Database\ParameterType;

Expand Down Expand Up @@ -87,7 +86,7 @@ public function getItem($pk = null)
$item = parent::getItem($pk);

$db = $this->getDatabase();
$updateSiteId = (int) $item->get('update_site_id');
$updateSiteId = (int) $item->update_site_id ?? 0;
$query = $db->getQuery(true)
->select(
$db->quoteName(
Expand Down Expand Up @@ -116,13 +115,13 @@ public function getItem($pk = null)
->bind(':updatesiteid', $updateSiteId, ParameterType::INTEGER);

$db->setQuery($query);
$extension = new CMSObject($db->loadAssoc());
$extension = $db->loadObject();

$downloadKey = InstallerHelper::getDownloadKey($extension);

$item->set('extra_query', $downloadKey['value'] ?? '');
$item->set('downloadIdPrefix', $downloadKey['prefix'] ?? '');
$item->set('downloadIdSuffix', $downloadKey['suffix'] ?? '');
$item->extra_query = $downloadKey['value'] ?? '';
$item->downloadIdPrefix = $downloadKey['prefix'] ?? '';
$item->downloadIdSuffix = $downloadKey['suffix'] ?? '';

return $item;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Table\UpdateSite as UpdateSiteTable;
Expand Down Expand Up @@ -444,8 +443,7 @@ public function getItems()
array_walk(
$items,
static function ($item) {
$data = new CMSObject($item);
$item->downloadKey = InstallerHelper::getDownloadKey($data);
$item->downloadKey = InstallerHelper::getDownloadKey($item);
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Object\CMSObject;
use Joomla\Component\Installer\Administrator\Helper\InstallerHelper as CmsInstallerHelper;
use Joomla\Component\Installer\Administrator\Model\UpdateModel;
use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault;
Expand All @@ -32,7 +31,7 @@ class HtmlView extends InstallerViewDefault
/**
* List of update items.
*
* @var array
* @var \stdClass[]
*/
protected $items;

Expand Down Expand Up @@ -105,7 +104,7 @@ public function display($tpl = null)
}

$mappingCallback = function ($item) {
$dlkeyInfo = CmsInstallerHelper::getDownloadKey(new CMSObject($item));
$dlkeyInfo = CmsInstallerHelper::getDownloadKey($item);
$item->isMissingDownloadKey = $dlkeyInfo['supported'] && !$dlkeyInfo['valid'];

if ($item->isMissingDownloadKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Table\Language;
use Joomla\CMS\Table\Table;
Expand Down Expand Up @@ -128,7 +127,7 @@ public function getItem($langId = null)
}

$properties = $table->getProperties(1);
$value = ArrayHelper::toObject($properties, CMSObject::class);
$value = ArrayHelper::toObject($properties);

return $value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Joomla\CMS\Language\LanguageHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Table\Table;
use Joomla\Filesystem\Path;
use Joomla\Registry\Registry;
Expand Down Expand Up @@ -176,9 +175,9 @@ public function getItem($pk = null)
}
}

// Convert to the CMSObject before adding other data.
// Convert to an object before adding other data.
$properties = $table->getProperties(1);
$item = ArrayHelper::toObject($properties, CMSObject::class);
$item = ArrayHelper::toObject($properties);

if (property_exists($item, 'params')) {
$registry = new Registry($item->params);
Expand Down Expand Up @@ -222,9 +221,9 @@ public function getMaster($pk = null)
}
}

// Convert to the CMSObject before adding other data.
// Convert to an object before adding other data.
$properties = $table->getProperties(1);
$item = ArrayHelper::toObject($properties, CMSObject::class);
$item = ArrayHelper::toObject($properties);

if (property_exists($item, 'params')) {
$registry = new Registry($item->params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Mails\Administrator\Helper\MailsHelper;
use Joomla\Component\Mails\Administrator\Model\TemplateModel;
Expand Down Expand Up @@ -62,7 +60,7 @@ class HtmlView extends BaseHtmlView
/**
* Master data for the mail template
*
* @var CMSObject
* @var \stdClass
*/
protected $master;

Expand Down
18 changes: 7 additions & 11 deletions administrator/components/com_media/helpers/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
* @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
*/

use Joomla\CMS\Object\CMSObject;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
Expand All @@ -26,26 +24,24 @@ abstract class MediaHelper
/**
* Generates the URL to the object in the action logs component
*
* @param string $contentType The content type
* @param integer $id The integer id
* @param CMSObject $mediaObject The media object being uploaded
* @param string $contentType The content type
* @param integer $id The integer id
* @param \stdClass $mediaObject The media object being uploaded
*
* @return string The link for the action log
*
* @since 3.9.27
*/
public static function getContentTypeLink($contentType, $id, CMSObject $mediaObject)
public static function getContentTypeLink($contentType, $id, \stdClass $mediaObject)
{
if ($contentType === 'com_media.file') {
return '';
}

$link = 'index.php?option=com_media';
$adapter = $mediaObject->get('adapter');
$uploadedPath = $mediaObject->get('path');
$link = 'index.php?option=com_media';

if (!empty($adapter) && !empty($uploadedPath)) {
$link .= '&path=' . $adapter . ':' . $uploadedPath;
if (!empty($mediaObject->adapter) && !empty($mediaObject->path)) {
$link .= '&path=' . $mediaObject->adapter . ':' . $mediaObject->path;
}

return $link;
Expand Down
5 changes: 2 additions & 3 deletions administrator/components/com_menus/src/Model/MenuModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Table\Table;
use Joomla\Registry\Registry;
Expand Down Expand Up @@ -121,7 +120,7 @@ protected function populateState()
*
* @param integer $itemId The id of the menu item to get.
*
* @return mixed Menu item data object on success, false on failure.
* @return \stdClass|false Menu item data object on success, false on failure.
*
* @since 1.6
*/
Expand All @@ -143,7 +142,7 @@ public function getItem($itemId = null)
}

$properties = $table->getProperties(1);
$value = ArrayHelper::toObject($properties, CMSObject::class);
$value = ArrayHelper::toObject($properties);

return $value;
}
Expand Down
Loading