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 @@ -61,7 +61,6 @@ class JoomgalleryComponent extends MVCComponent implements BootableExtensionInte
use MessageTrait;
use AssociationServiceTrait;
use HTMLRegistryAwareTrait;
// use RouterServiceTrait;
use RouterServiceTrait {RouterServiceTrait::createRouter as traitCreateRouter;}

/**
Expand Down
27 changes: 27 additions & 0 deletions administrator/com_joomgallery/src/Helper/JoomHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1243,4 +1243,31 @@ public static function pluralize(string $word): string
// Default rule: add 's'
return $word . 's';
}

/**
* Returns a Table Object
*
* @param string $tableClass The name of the table (e.g '\\Joomla\\CMS\\Table\\Module')
*
* @return object|bool Table object on success, false otherwise.
*
* @since 4.2.0
* NOTE: Use Factory::getApplication()->bootComponent('...')->getMVCFactory()->createTable($name, $prefix, $config); instead
*/
public static function getTableInstance(string $tableClass)
{
if(!\class_exists($tableClass))
{
return false;
}

// Check for a possible service from the container otherwise manually instantiate the class
if(Factory::getContainer()->has($tableClass))
{
return Factory::getContainer()->get($tableClass);
}

// Instantiate a new table class and return it.
return new $tableClass(Factory::getContainer()->get(DatabaseInterface::class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Config;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;

/**
* Interface for the configuration classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Config;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;

/**
* The Config service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Config;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;

use \Joomgallery\Component\Joomgallery\Administrator\Service\Config\DefaultConfig;
use \Joomla\CMS\Component\ComponentHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Filesystem;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;

/**
* The Filesystem service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Filesystem;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;

use \Joomgallery\Component\Joomgallery\Administrator\Service\Filesystem\Filesystem;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

use \Joomla\CMS\Factory;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\User\UserFactoryInterface;
use \Joomla\CMS\Mail\MailTemplate;
use \Joomla\Database\DatabaseInterface;
use \Joomla\CMS\User\UserFactoryInterface;
use \Joomgallery\Component\Joomgallery\Administrator\Service\Messenger\Messenger;
use \Joomgallery\Component\Joomgallery\Administrator\Service\Messenger\MessengerInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Refresher;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Refresher;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;

/**
* The Refresher service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Refresher;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;

use \Joomgallery\Component\Joomgallery\Administrator\Service\Refresher\Refresher;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use \Joomla\CMS\Factory;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\Filesystem\File as JFile;
use \Joomla\CMS\Filesystem\Path as JPath;
use \Joomla\Filesystem\File as JFile;
use \Joomla\Filesystem\Path as JPath;

use \Joomgallery\Component\Joomgallery\Administrator\Service\Uploader\UploaderInterface;
use \Joomgallery\Component\Joomgallery\Administrator\Service\Uploader\Uploader as BaseUploader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use \Joomla\CMS\Factory;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\Filesystem\File as JFile;
use \Joomla\CMS\Filesystem\Path as JPath;
use \Joomla\Filesystem\File as JFile;
use \Joomla\Filesystem\Path as JPath;
use \Joomgallery\Component\Joomgallery\Administrator\Table\ImageTable;
use \Joomgallery\Component\Joomgallery\Administrator\Service\Uploader\UploaderInterface;
use \Joomgallery\Component\Joomgallery\Administrator\Service\Uploader\Uploader as BaseUploader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use \Joomla\CMS\Factory;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\Filesystem\File as JFile;
use \Joomla\CMS\Filesystem\Path as JPath;
use \Joomla\Filesystem\File as JFile;
use \Joomla\Filesystem\Path as JPath;

use \Joomgallery\Component\Joomgallery\Administrator\Service\Uploader\UploaderInterface;
use \Joomgallery\Component\Joomgallery\Administrator\Service\Uploader\Uploader as BaseUploader;
Expand Down
24 changes: 11 additions & 13 deletions administrator/com_joomgallery/src/Service/Uploader/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@

use \Joomla\CMS\Factory;
use \Joomla\CMS\Language\Text;
use \Joomla\CMS\Filesystem\File as JFile;
use \Joomla\CMS\Filesystem\Path as JPath;
use \Joomla\Filesystem\File as JFile;
use \Joomla\CMS\Filter\InputFilter;
use \Joomla\CMS\Filter\OutputFilter;
use \Joomla\CMS\Object\CMSObject;

use \Joomla\Database\DatabaseInterface;
use \Joomgallery\Component\Joomgallery\Administrator\Service\Uploader\UploaderInterface;
use \Joomgallery\Component\Joomgallery\Administrator\Extension\ServiceTrait;

Expand Down Expand Up @@ -264,7 +262,7 @@ public function overrideData(&$data): bool
require_once JPATH_ADMINISTRATOR.'/components/'._JOOM_OPTION.'/includes/iptcarray.php';
require_once JPATH_ADMINISTRATOR.'/components/'._JOOM_OPTION.'/includes/exifarray.php';

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

Expand Down Expand Up @@ -418,7 +416,7 @@ public function overrideData(&$data): bool
$data['title'] = $filter->clean($source_value, 'string');

// Recreate alias
if(Factory::getConfig()->get('unicodeslugs') == 1)
if($this->app->getConfig()->get('unicodeslugs') == 1)
{
$data['alias'] = OutputFilter::stringURLUnicodeSlug(trim($data['title']));
}
Expand Down Expand Up @@ -500,7 +498,7 @@ public function createImage($data_row): bool
$this->component->createMessenger($jg_filenamenumber);

// Get user
$user = Factory::getUser();
$user = $this->app->getIdentity();

// Get category
$cat = JoomHelper::getRecord('category', $data_row->catid, $this->component);
Expand Down Expand Up @@ -541,7 +539,7 @@ public function createImage($data_row): bool
/**
* Rollback an erroneous upload
*
* @param CMSObject $data_row Image object containing at least catid and filename (default: false)
* @param object $data_row Image object containing at least catid and filename (default: false)
*
* @return void
*
Expand Down Expand Up @@ -599,7 +597,7 @@ public function deleteTmp(): bool
*/
protected function getImageNumber($userid)
{
$db = Factory::getDbo();
$db = Factory::getContainer()->get(DatabaseInterface::class);

$query = $db->getQuery(true)
->select('COUNT(id)')
Expand Down Expand Up @@ -679,7 +677,7 @@ protected function resetUserStates()
*
* @param array $data The form data
*
* @return CMSObject
* @return object
*
* @since 4.0.0
*/
Expand All @@ -691,10 +689,10 @@ protected function tempImgObj($data)
throw new \Exception('Form data must have at least catid and filename');
}

$img = new CMSObject;
$img = new stdClass;

$img->set('catid', $data['catid']);
$img->set('filename', $data['filename']);
$img->catid = $data['catid'];
$img->filename = $data['filename'];

return $img;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Uploader;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;

use \Joomgallery\Component\Joomgallery\Administrator\Table\ImageTable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Uploader;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;

/**
* The Uploader service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Joomgallery\Component\Joomgallery\Administrator\Service\Uploader;

\defined('JPATH_PLATFORM') or die;
\defined('_JEXEC') or die;

use \Joomgallery\Component\Joomgallery\Administrator\Service\Uploader\HTMLUploader;
use \Joomgallery\Component\Joomgallery\Administrator\Service\Uploader\TUSUploader;
Expand Down
Loading