Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -11,6 +11,7 @@

\defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\Component\Media\Administrator\Adapter\AdapterInterface;

/**
Expand Down Expand Up @@ -96,7 +97,7 @@ public function getProvider($id)
{
if (!isset($this->providers[$id]))
{
throw new \Exception("Media Provider not found");
throw new \Exception(Text::_('COM_MEDIA_ERROR_MEDIA_PROVIDER_NOT_FOUND'));
}

return $this->providers[$id];
Expand All @@ -119,14 +120,14 @@ public function getAdapter($name)

if ($account == null)
{
throw new \Exception('Account was not set');
throw new \Exception(Text::_('COM_MEDIA_ERROR_ACCOUNT_NOT_SET'));
}

$adapters = $this->getProvider($provider)->getAdapters();

if (!isset($adapters[$account]))
{
throw new \Exception("The account was not found");
throw new \Exception(Text::_('COM_MEDIA_ERROR_ACCOUNT_NOT_FOUND'));
}

return $adapters[$account];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Component\Media\Administrator\Adapter\AdapterInterface;
use Joomla\Component\Media\Administrator\Event\MediaProviderEvent;
Expand Down Expand Up @@ -117,7 +118,7 @@ protected function resolveAdapterAndPath(String $path): array

if (!$this->getDefaultAdapterName())
{
throw new \InvalidArgumentException('No adapter found');
throw new \InvalidArgumentException(Text::_('COM_MEDIA_ERROR_NO_ADAPTER_FOUND'));
}

// If we have less than 2 parts, we return a default adapter name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function display($tpl = null)
if (empty($this->file->content))
{
// @todo error handling controller redirect files
throw new \Exception('No content available!');
throw new \Exception(Text::_('COM_MEDIA_ERROR_NO_CONTENT_AVAILABLE'));
}

$this->addToolbar();
Expand Down
5 changes: 5 additions & 0 deletions administrator/language/en-GB/com_media.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ COM_MEDIA_DELETE_SUCCESS="Item deleted."
COM_MEDIA_DROP_FILE="Drop file(s) to Upload"
COM_MEDIA_EDIT="Media Edit"
COM_MEDIA_ERROR="An error occurred."
COM_MEDIA_ERROR_ACCOUNT_NOT_FOUND="The account was not found"
COM_MEDIA_ERROR_ACCOUNT_NOT_SET="Account was not set"
COM_MEDIA_ERROR_MEDIA_PROVIDER_NOT_FOUND="Media Provider not found"
COM_MEDIA_ERROR_NO_ADAPTER_FOUND="No adapter found"
COM_MEDIA_ERROR_NO_CONTENT_AVAILABLE="No content available!"
COM_MEDIA_ERROR_NO_PROVIDERS="No filesystem providers have been found. Please enable at least one <a href=\"%s\">filesystem plugin</a>."
COM_MEDIA_ERROR_NOT_AUTHENTICATED="You are not authenticated. Please login."
COM_MEDIA_ERROR_NOT_AUTHORIZED="You are not authorised"
Expand Down