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 @@ -117,7 +117,7 @@
)
);

Factory::getDocument()->getWebAssetManager()
Factory::getApplication()->getDocument()->getWebAssetManager()
->useScript('com_joomgallery.field-category');
}
?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
)
);

Factory::getDocument()->getWebAssetManager()
Factory::getApplication()->getDocument()->getWebAssetManager()
->useScript('com_joomgallery.field-image');
}
?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
Text::script('JGLOBAL_SELECT_NO_RESULTS_MATCH');
Text::script('JGLOBAL_SELECT_PRESS_TO_SELECT');

Factory::getDocument()->getWebAssetManager()
Factory::getApplication()->getDocument()->getWebAssetManager()
->usePreset('choicesjs')
->useScript('webcomponent.field-fancy-select');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function duplicate()
$this->setMessage(Text::_('COM_JOOMGALLERY_ITEM_SUCCESS_DUPLICATED'));
}
}
catch (Exception $e)
catch (\Exception $e)
{
$this->component->addLog($e->getMessage(), 'warning', 'jerror');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ConfigsController extends JoomAdminController
*
* @return void
*
* @throws Exception
* @throws \Exception
*/
public function duplicate()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use \Joomla\CMS\Factory;
use \Joomla\Input\Input;
use \Joomla\CMS\Filesystem\Path;
use \Joomla\Filesystem\Path;
use \Joomla\CMS\Application\CMSApplication;
use \Joomla\CMS\MVC\Controller\BaseController;
use \Joomla\CMS\MVC\Factory\MVCFactoryInterface;
Expand Down Expand Up @@ -64,7 +64,7 @@ class DisplayController extends BaseController
*
* @since 4.0.0
*/
public function __construct($config = array(), MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
public function __construct($config = array(), ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// No direct access
\defined('_JEXEC') or die;

use \Joomla\CMS\Uri\Uri;
use \Joomla\CMS\Router\Route;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\Response\JsonResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ImagesController extends JoomAdminController
*
* @since 4.0.0
*/
public function __construct($config = array(), MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
public function __construct($config = array(), ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down Expand Up @@ -126,7 +126,7 @@ public function duplicate()
$this->component->addLog(Text::_('COM_JOOMGALLERY_ITEM_SUCCESS_DUPLICATED'), 'info', 'jerror');
}
}
catch (Exception $e)
catch (\Exception $e)
{
$this->component->addLog($e->getMessage(), 'warning', 'jerror');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
\defined('_JEXEC') or die;

use \Joomla\Input\Input;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\User\CurrentUserInterface;
use \Joomla\CMS\Application\CMSApplication;
use \Joomla\CMS\MVC\Factory\MVCFactoryInterface;
Expand Down Expand Up @@ -67,7 +66,7 @@ class JoomAdminController extends BaseAdminController
*
* @since 4.0.0
*/
public function __construct($config = array(), MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
public function __construct($config = array(), ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class JoomFormController extends BaseFormController
*
* @since 4.0.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null, FormFactoryInterface $formFactory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null, ?FormFactoryInterface $formFactory = null)
{
parent::__construct($config, $factory, $app, $input, $formFactory);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class MigrationController extends BaseController implements FormFactoryAwareInte
*
* @since 4.0.0
*/
public function __construct($config = [], MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null, FormFactoryInterface $formFactory = null)
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null, ?FormFactoryInterface $formFactory = null)
{
parent::__construct($config, $factory, $app, $input);

Expand Down Expand Up @@ -311,7 +311,7 @@ public function resume()

// Check if migration item is checked out
$user = Factory::getUser();
if(isset($item->checked_out) && !($item->checked_out == 0 || $item->checked_out == $user->get('id')))
if(isset($item->checked_out) && !($item->checked_out == 0 || $item->checked_out == $user->id))
{
// You are not allowed to resume the migration, since it is checked out by another user
$this->setMessage(Text::sprintf('COM_JOOMGALLERY_ERROR_CHECKED_OUT_BY_ANOTHER_USER', $user->get('name')), 'error');
Expand Down Expand Up @@ -397,7 +397,7 @@ public function delete()

// Check if migration item is checked out
$user = Factory::getUser();
if(isset($item->checked_out) && !($item->checked_out == 0 || $item->checked_out == $user->get('id')))
if(isset($item->checked_out) && !($item->checked_out == 0 || $item->checked_out == $user->id))
{
// You are not allowed to resume the migration, since it is checked out by another user
$this->setMessage(Text::sprintf('COM_JOOMGALLERY_ERROR_CHECKED_OUT_BY_ANOTHER_USER', $user->get('name')), 'error');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
\defined('_JEXEC') or die;

use \Joomla\CMS\Factory;
use \Joomla\CMS\Filesystem\Path;
use \Joomla\Filesystem\Path;
use \Joomla\CMS\Menu\AbstractMenu;
use \Psr\Container\ContainerInterface;
use \Joomla\CMS\Extension\MVCComponent;
Expand Down
14 changes: 7 additions & 7 deletions administrator/com_joomgallery/src/Extension/MessageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function msgFromSession()
*
* @since 4.0.0
*/
protected function addLogger(string $name = null)
protected function addLogger(?string $name = null)
{
if(!$this->log)
{
Expand All @@ -166,7 +166,7 @@ protected function addLogger(string $name = null)
*
* @since 4.0.0
*/
public function setLogger(string $name = null)
public function setLogger(?string $name = null)
{
$this->addLogger($name);
$this->logName = $name;
Expand All @@ -182,7 +182,7 @@ public function setLogger(string $name = null)
*
* @since 4.0.0
*/
public function addLog(string $txt, $priority = 8, string $name = null)
public function addLog(string $txt, $priority = 8, ?string $name = null)
{
$this->addLogger($name);

Expand Down Expand Up @@ -218,7 +218,7 @@ public function addLog(string $txt, $priority = 8, string $name = null)
*
* @since 4.0.0
*/
public function setLog(string $txt, $priority = 8, string $name = null)
public function setLog(string $txt, $priority = 8, ?string $name = null)
{
return $this->addLog($txt, $priority, $name);
}
Expand Down Expand Up @@ -643,7 +643,7 @@ protected function &selectMsgStorage($selection)
break;

default:
throw new Exception("Selected storage does not exist.");
throw new \Exception("Selected storage does not exist.");
return false;
}
}
Expand All @@ -656,7 +656,7 @@ protected function &selectMsgStorage($selection)
* @return string The selected session path
*
* @since 4.0.0
* @throws Exception
* @throws \Exception
*/
protected function selectMsgStoragePath($selection)
{
Expand All @@ -677,7 +677,7 @@ protected function selectMsgStoragePath($selection)
break;

default:
throw new Exception("Selected storage does not exist.");
throw new \Exception("Selected storage does not exist.");
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function getInput()
else
{
$this->component->addLog(Text::sprintf('COM_JOOMGALLERY_PLUGIN_ERROR_RETURN_VALUE', 'onJoomImgProcessorGetName', 'array', 'value, text, desc'), 'error', 'jerror');
throw new Exception(Text::sprintf('COM_JOOMGALLERY_PLUGIN_ERROR_RETURN_VALUE', 'onJoomImgProcessorGetName', 'array', 'value, text, desc'));
throw new \Exception(Text::sprintf('COM_JOOMGALLERY_PLUGIN_ERROR_RETURN_VALUE', 'onJoomImgProcessorGetName', 'array', 'value, text, desc'));
}
}

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\Form\Form;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\Event\AbstractEvent;
use \Joomgallery\Component\Joomgallery\Administrator\Helper\ConfigHelper;

Expand Down
1 change: 0 additions & 1 deletion administrator/com_joomgallery/src/Form/ConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ protected function &findFieldsByAttribute($attribute, $value)
* @return ConfigForm Form instance.
*
* @since 4.0.0
* @deprecated 5.0 Use the FormFactory service from the container
* @throws \InvalidArgumentException if no data provided.
* @throws \RuntimeException if the form could not be loaded.
*/
Expand Down
4 changes: 2 additions & 2 deletions administrator/com_joomgallery/src/Helper/ConfigHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use \Joomla\CMS\Form\Form;
use \Joomla\CMS\Language\Text;
use \Joomla\Registry\Registry;
use \Joomla\CMS\Filesystem\Folder;
use \Joomla\Filesystem\Folder;
use \Joomgallery\Component\Joomgallery\Administrator\Helper\JoomHelper;

/**
Expand Down Expand Up @@ -68,7 +68,7 @@ public static function getReplaceinfoOptions($form)
require JPATH_ADMINISTRATOR.'/components/'._JOOM_OPTION.'/includes/iptcarray.php';
require JPATH_ADMINISTRATOR.'/components/'._JOOM_OPTION.'/includes/exifarray.php';

$lang = Factory::getLanguage();
$lang = Factory::getApplication()->getLanguage();
$lang->load(_JOOM_OPTION.'.exif', JPATH_ADMINISTRATOR.'/components/'._JOOM_OPTION);
$lang->load(_JOOM_OPTION.'.iptc', JPATH_ADMINISTRATOR.'/components/'._JOOM_OPTION);

Expand Down
4 changes: 2 additions & 2 deletions administrator/com_joomgallery/src/Helper/JoomHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use \Joomla\CMS\Language\Text;
use \Joomla\Registry\Registry;
use \Joomla\CMS\Access\Access;
use \Joomla\CMS\Filesystem\Path;
use \Joomla\Filesystem\Path;
use \Joomla\CMS\Http\HttpFactory;
use \Joomla\CMS\Language\Multilanguage;
use \Joomla\Database\DatabaseInterface;
Expand Down Expand Up @@ -1120,7 +1120,7 @@ public static function checkFilesystems()
if(!$adapter)
{
// Plugin is not installed, not enabled or not correctly configured. Show warning message.
$lang = Factory::getLanguage();
$lang = Factory::getApplication()->getLanguage();

if(!$lang->getPaths($plugin_fullname))
{
Expand Down
2 changes: 1 addition & 1 deletion administrator/com_joomgallery/src/MVC/MVCFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getIdentity()
*
* @since 4.0.0
*/
public function loadIdentity(User $identity = null)
public function loadIdentity(?User $identity = null)
{
if(\is_null($identity))
{
Expand Down
4 changes: 2 additions & 2 deletions administrator/com_joomgallery/src/Model/CategoriesModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ protected function getStoreId($id = '')
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$db = $this->getDatabase();
$query = $db->getQuery(true);

// Select the required fields from the table.
Expand Down Expand Up @@ -403,7 +403,7 @@ public function getItems()
*/
protected function categoriesFilterQuery(&$query, $categoryId, $level=false, $exclude=false)
{
$db = $this->getDbo();
$db = $this->getDatabase();

$categoryId = ArrayHelper::toInteger($categoryId);
$categoryTable = $this->getMVCFactory()->createTable('Category', 'administrator');
Expand Down
19 changes: 9 additions & 10 deletions administrator/com_joomgallery/src/Model/CategoryModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use \Joomla\Utilities\ArrayHelper;
use \Joomla\CMS\Plugin\PluginHelper;
use \Joomla\CMS\Language\Multilanguage;
use \Joomla\CMS\User\UserFactoryInterface;
use \Joomgallery\Component\Joomgallery\Administrator\Helper\JoomHelper;

/**
Expand Down Expand Up @@ -764,18 +765,16 @@ public function saveorder($idArray = null, $lftArray = null)
*/
public function duplicate(&$pks)
{
$app = Factory::getApplication();
$user = Factory::getUser();
$task = $app->input->get('task');
$task = $this->app->input->get('task');

// Access checks.
if(!$user->authorise('core.create', _JOOM_OPTION))
if(!$this->user->authorise('core.create', _JOOM_OPTION))
{
throw new \Exception(Text::_('JERROR_CORE_CREATE_NOT_PERMITTED'));
}

// Set task to be save2copy
$app->input->set('task', 'save2copy');
$this->app->input->set('task', 'save2copy');

$table = $this->getTable();

Expand Down Expand Up @@ -806,19 +805,19 @@ public function duplicate(&$pks)
$data = (array) $table->getFieldsValues();

// Set the id of the origin category
$app->input->set('origin_id', $pk);
$this->app->input->set('origin_id', $pk);

// Save the copy
$this->save($data);
}
else
{
throw new \Exception($table->getError());
}
}
}

// Reset official task
$app->input->set('task', $task);
$this->app->input->set('task', $task);

// Clean cache
$this->cleanCache();
Expand All @@ -834,14 +833,14 @@ public function duplicate(&$pks)
*
* @return boolean True if successful.
*
* @throws Exception
* @throws \Exception
*/
public function fixChildrenPath($table, $old_table)
{
if(\is_null($table) || empty($table->id))
{
$this->component->addLog('To fix child category paths, table has to be loaded.', 'error', 'jerror');
throw new Exception('To fix child category paths, table has to be loaded.');
throw new \Exception('To fix child category paths, table has to be loaded.');
}

// Get a list of children ids
Expand Down
Loading