diff --git a/src/administrator/components/com_aggpxtrack/aggpxtrack.php b/src/administrator/components/com_aggpxtrack/aggpxtrack.php
index 8a74b50..b5411fc 100644
--- a/src/administrator/components/com_aggpxtrack/aggpxtrack.php
+++ b/src/administrator/components/com_aggpxtrack/aggpxtrack.php
@@ -16,6 +16,6 @@
define('COM_MEDIA_BASE', JPATH_ROOT . '/' . $params->get($path, 'images'));
define('COM_MEDIA_BASEURL', JUri::root() . $params->get($path, 'images'));
-$controller = JControllerLegacy::getInstance('Aggpxtrack', array('base_path' => JPATH_COMPONENT_ADMINISTRATOR));
+$controller = JControllerLegacy::getInstance('Aggpxtrack', ['base_path' => JPATH_COMPONENT_ADMINISTRATOR]);
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
diff --git a/src/administrator/components/com_aggpxtrack/controller.php b/src/administrator/components/com_aggpxtrack/controller.php
index e2fb7ee..8309720 100644
--- a/src/administrator/components/com_aggpxtrack/controller.php
+++ b/src/administrator/components/com_aggpxtrack/controller.php
@@ -30,7 +30,7 @@ class AggpxtrackController extends JControllerLegacy
*
* @since 1.5
*/
- public function display($cacheable = false, $urlparams = array())
+ public function display($cacheable = false, $urlparams = [])
{
return parent::display();
}
diff --git a/src/administrator/components/com_aggpxtrack/controllers/file.php b/src/administrator/components/com_aggpxtrack/controllers/file.php
index b21947e..f72ccff 100644
--- a/src/administrator/components/com_aggpxtrack/controllers/file.php
+++ b/src/administrator/components/com_aggpxtrack/controllers/file.php
@@ -47,24 +47,19 @@ public function upload()
$this->folder = $this->input->get('folder', '', 'path');
// Don't redirect to an external URL.
- if (!JUri::isInternal($return))
- {
+ if (!JUri::isInternal($return)) {
$return = '';
}
// Set the redirect
- if ($return)
- {
+ if ($return) {
$this->setRedirect($return . '&folder=' . $this->folder);
- }
- else
- {
+ } else {
$this->setRedirect('index.php?option=com_aggpxtrack&folder=' . $this->folder);
}
// Authorize the user
- if (!$this->authoriseUser('create'))
- {
+ if (!$this->authoriseUser('create')) {
return false;
}
@@ -81,8 +76,7 @@ public function upload()
// Check for the total size of post back data.
if (($postMaxSize > 0 && $contentLength > $postMaxSize)
- || ($memoryLimit != -1 && $contentLength > $memoryLimit))
- {
+ || ($memoryLimit != -1 && $contentLength > $memoryLimit)) {
$app->enqueueMessage(JText::_('COM_AGGPXTRACK_ERROR_WARNUPLOADTOOLARGE'), 'warning');
return false;
@@ -92,32 +86,28 @@ public function upload()
$uploadMaxFileSize = $mediaHelper->toBytes(ini_get('upload_max_filesize'));
// Perform basic checks on file info before attempting anything
- foreach ($files as &$file)
- {
+ foreach ($files as &$file) {
$file['name'] = JFile::makeSafe($file['name']);
$file['name'] = str_replace(' ', '-', $file['name']);
- $file['filepath'] = JPath::clean(implode(DIRECTORY_SEPARATOR, array(COM_MEDIA_BASE, $this->folder, $file['name'])));
+ $file['filepath'] = JPath::clean(implode(DIRECTORY_SEPARATOR, [COM_MEDIA_BASE, $this->folder, $file['name']]));
if (($file['error'] == 1)
|| ($uploadMaxSize > 0 && $file['size'] > $uploadMaxSize)
- || ($uploadMaxFileSize > 0 && $file['size'] > $uploadMaxFileSize))
- {
+ || ($uploadMaxFileSize > 0 && $file['size'] > $uploadMaxFileSize)) {
// File size exceed either 'upload_max_filesize' or 'upload_maxsize'.
$app->enqueueMessage(JText::_('COM_AGGPXTRACK_ERROR_WARNFILETOOLARGE'), 'warning');
return false;
}
- if (JFile::exists($file['filepath']))
- {
+ if (JFile::exists($file['filepath'])) {
// A file with this name already exists
$app->enqueueMessage(JText::_('COM_AGGPXTRACK_ERROR_FILE_EXISTS'), 'warning');
return false;
}
- if (!isset($file['name']))
- {
+ if (!isset($file['name'])) {
// No filename (after the name was cleaned by JFile::makeSafe)
$this->setRedirect('index.php', JText::_('COM_AGGPXTRACK_INVALID_REQUEST'), 'error');
@@ -130,13 +120,11 @@ public function upload()
JPluginHelper::importPlugin('content');
$dispatcher = JEventDispatcher::getInstance();
- foreach ($files as &$file)
- {
+ foreach ($files as &$file) {
// The request is valid
$ext = 'com_media';
- if (!$mediaHelper->canUpload($file, $ext))
- {
+ if (!$mediaHelper->canUpload($file, $ext)) {
// The file can't be uploaded
return false;
@@ -144,10 +132,9 @@ public function upload()
// Trigger the onContentBeforeSave event.
$object_file = new JObject($file);
- $result = $dispatcher->trigger('onContentBeforeSave', array('com_aggpxtrack.file', &$object_file, true));
+ $result = $dispatcher->trigger('onContentBeforeSave', ['com_aggpxtrack.file', &$object_file, true]);
- if (in_array(false, $result, true))
- {
+ if (in_array(false, $result, true)) {
// There are some errors in the plugins
$app->enqueueMessage(
JText::plural('COM_AGGPXTRACK_ERROR_BEFORE_SAVE', count($errors = $object_file->getErrors()), implode('
', $errors)),
@@ -157,8 +144,7 @@ public function upload()
return false;
}
- if (!JFile::upload($object_file->tmp_name, $object_file->filepath))
- {
+ if (!JFile::upload($object_file->tmp_name, $object_file->filepath)) {
// Error in upload
$app->enqueueMessage(JText::_('COM_AGGPXTRACK_ERROR_UNABLE_TO_UPLOAD_FILE'), 'warning');
@@ -166,7 +152,7 @@ public function upload()
}
// Trigger the onContentAfterSave event.
- $dispatcher->trigger('onContentAfterSave', array('com_aggpxtrack.file', &$object_file, true));
+ $dispatcher->trigger('onContentAfterSave', ['com_aggpxtrack.file', &$object_file, true]);
$this->setMessage(JText::sprintf('COM_AGGPXTRACK_UPLOAD_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}
@@ -184,8 +170,7 @@ public function upload()
*/
protected function authoriseUser($action)
{
- if (!JFactory::getUser()->authorise('core.' . strtolower($action), 'com_aggpxtrack'))
- {
+ if (!JFactory::getUser()->authorise('core.' . strtolower($action), 'com_aggpxtrack')) {
// User is not authorised
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_' . strtoupper($action) . '_NOT_PERMITTED'), 'warning');
diff --git a/src/administrator/components/com_aggpxtrack/models/gpxtracklist.php b/src/administrator/components/com_aggpxtrack/models/gpxtracklist.php
index 9671350..c594394 100644
--- a/src/administrator/components/com_aggpxtrack/models/gpxtracklist.php
+++ b/src/administrator/components/com_aggpxtrack/models/gpxtracklist.php
@@ -34,8 +34,7 @@ public function getState($property = null, $default = null)
{
static $set;
- if (!$set)
- {
+ if (!$set) {
$input = JFactory::getApplication()->input;
$folder = $input->get('folder', '', 'path');
$this->setState('folder', $folder);
@@ -89,8 +88,7 @@ public function getList()
static $list;
// Only process the list once per request
- if (is_array($list))
- {
+ if (is_array($list)) {
return $list;
}
@@ -100,26 +98,22 @@ public function getList()
$basePath = COM_MEDIA_BASE . ((strlen($current) > 0) ? '/' . $current : '');
$mediaBase = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE . '/');
- $images = array ();
- $folders = array ();
+ $images = [];
+ $folders = [];
$fileList = false;
$folderList = false;
- if (file_exists($basePath))
- {
+ if (file_exists($basePath)) {
// Get the list of files and folders from the given folder
$fileList = array_reverse(JFolder::files($basePath));
$folderList = JFolder::folders($basePath);
}
// Iterate over the files if they exist
- if ($fileList !== false)
- {
- foreach ($fileList as $file)
- {
- if (is_file($basePath . '/' . $file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html')
- {
+ if ($fileList !== false) {
+ foreach ($fileList as $file) {
+ if (is_file($basePath . '/' . $file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html') {
$tmp = new JObject;
$tmp->name = $file;
$tmp->path = str_replace(DIRECTORY_SEPARATOR, '/', JPath::clean($basePath . '/' . $file));
@@ -129,8 +123,7 @@ public function getList()
$file_extension = strtolower(JFile::getExt($file));
- if ($file_extension == 'gpx')
- {
+ if ($file_extension == 'gpx') {
$images[] = $tmp;
}
}
@@ -138,10 +131,8 @@ public function getList()
}
// Iterate over the folders if they exist
- if ($folderList !== false)
- {
- foreach ($folderList as $folder)
- {
+ if ($folderList !== false) {
+ foreach ($folderList as $folder) {
$tmp = new JObject;
$tmp->name = basename($folder);
$tmp->path = str_replace(DIRECTORY_SEPARATOR, '/', JPath::clean($basePath . '/' . $folder));
@@ -156,16 +147,15 @@ public function getList()
}
// Sortiert nach Datum
- $date = array();
+ $date = [];
- foreach ($images as $key => $row)
- {
+ foreach ($images as $key => $row) {
$date[$key] = $row->date;
}
array_multisort($date, SORT_DESC, $images);
- $list = array('folders' => $folders, 'images' => $images);
+ $list = ['folders' => $folders, 'images' => $images];
return $list;
}
diff --git a/src/administrator/components/com_aggpxtrack/script.php b/src/administrator/components/com_aggpxtrack/script.php
index 6137201..7783106 100644
--- a/src/administrator/components/com_aggpxtrack/script.php
+++ b/src/administrator/components/com_aggpxtrack/script.php
@@ -83,10 +83,8 @@ public function copyFiles()
// Now we read all png files and put them in an array.
$gpx_files = JFolder::files($pathsearch, '.gpx');
- foreach ($gpx_files as $file)
- {
- if (!file_exists($path . $file))
- {
+ foreach ($gpx_files as $file) {
+ if (!file_exists($path . $file)) {
JFile::copy($pathsearch . $file, $path . $file);
}
}
diff --git a/src/administrator/components/com_aggpxtrack/views/aggpxtrack/view.html.php b/src/administrator/components/com_aggpxtrack/views/aggpxtrack/view.html.php
index 289fc64..6c3777d 100644
--- a/src/administrator/components/com_aggpxtrack/views/aggpxtrack/view.html.php
+++ b/src/administrator/components/com_aggpxtrack/views/aggpxtrack/view.html.php
@@ -30,6 +30,5 @@ public function display($tpl = null)
{
$url = JUri::base() . $url;
header('Location: ' . $url . 'index.php?option=com_config');
-
}
}
diff --git a/src/administrator/components/com_aggpxtrack/views/button/tmpl/default.php b/src/administrator/components/com_aggpxtrack/views/button/tmpl/default.php
index 10fd387..4f51838 100644
--- a/src/administrator/components/com_aggpxtrack/views/button/tmpl/default.php
+++ b/src/administrator/components/com_aggpxtrack/views/button/tmpl/default.php
@@ -21,16 +21,15 @@
JHtml::_('formbehavior.chosen', 'select');
// Load tooltip instance without HTML support because we have a HTML tag in the tip
-JHtml::_('bootstrap.tooltip', '.noHtmlTip', array('html' => false));
+JHtml::_('bootstrap.tooltip', '.noHtmlTip', ['html' => false]);
// Include jQuery
JHtml::_('jquery.framework');
JHtml::_('script', 'com_aggpxtrack/popup-manager.js', false, true, false, false, true);
-JHtml::_('stylesheet', 'media/popup-imagemanager.css', array(), true);
+JHtml::_('stylesheet', 'media/popup-imagemanager.css', [], true);
-if ($lang->isRtl())
-{
- JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array(), true);
+if ($lang->isRtl()) {
+ JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', [], true);
}
JFactory::getDocument()->addScriptDeclaration(
@@ -47,14 +46,11 @@
*
* This should be removed when mootools won't be shipped by Joomla.
*/
-if (!empty($fieldInput)) // Media Form Field
-{
- if ($isMoo)
- {
+if (!empty($fieldInput)) { // Media Form Field
+ if ($isMoo) {
$onClick = "window.parent.jInsertFieldValue(document.getElementById('f_url').value, '" . $fieldInput . "');window.parent.jModalClose();window.parent.jQuery('.modal.in').modal('hide');";
}
-}
-else // XTD Image plugin
+} else // XTD Image plugin
{
$onClick = 'ImageManager.onok();window.parent.jModalClose();';
}
@@ -64,7 +60,7 @@