diff --git a/aggpxtrack-update4.xml b/aggpxtrack-update4.xml index cae74db..8721356 100644 --- a/aggpxtrack-update4.xml +++ b/aggpxtrack-update4.xml @@ -42,4 +42,25 @@ + + pkg_aggpxtrack + pkg_aggpxtrack + pkg_aggpxtrack + package + site + 4.0.2 + https://github.com/astridx/pkg_aggpxtrack/blob/v4.0.2/README.md + + https://github.com/astridx/pkg_aggpxtrack/releases/download/v4.0.2/pkg-aggpxtrack-4.0.2.zip + + + rc + stable + + Astrid Günther + https://astrid-guenther.de + + + + \ No newline at end of file diff --git a/j4/pkg_aggpxtrack/jorobo.ini b/j4/pkg_aggpxtrack/jorobo.ini index 915f070..8dd11d3 100644 --- a/j4/pkg_aggpxtrack/jorobo.ini +++ b/j4/pkg_aggpxtrack/jorobo.ini @@ -1,5 +1,5 @@ extension = aggpxtrack -version = 4.0.1 +version = 4.0.2 source = src target = package diff --git a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/aggpxtrack.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/aggpxtrack.php index 8a74b50..b5411fc 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/aggpxtrack.php +++ b/j4/pkg_aggpxtrack/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/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/controller.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/controller.php index e2fb7ee..8309720 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/controller.php +++ b/j4/pkg_aggpxtrack/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/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/controllers/file.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/controllers/file.php index b21947e..f72ccff 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/controllers/file.php +++ b/j4/pkg_aggpxtrack/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/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/models/gpxtracklist.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/models/gpxtracklist.php index 9671350..c594394 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/models/gpxtracklist.php +++ b/j4/pkg_aggpxtrack/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/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/script.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/script.php index 6137201..7783106 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/script.php +++ b/j4/pkg_aggpxtrack/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/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/aggpxtrack/view.html.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/aggpxtrack/view.html.php index 289fc64..6c3777d 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/aggpxtrack/view.html.php +++ b/j4/pkg_aggpxtrack/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/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/button/tmpl/default.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/button/tmpl/default.php index 10fd387..4f51838 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/button/tmpl/default.php +++ b/j4/pkg_aggpxtrack/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 @@
@@ -81,7 +77,8 @@
+ // This is for Mootools compatibility ?>onclick="" data-dismiss="modal">
@@ -100,7 +97,7 @@ - state->get('field.id')):?> + state->get('field.id')) :?>
diff --git a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/default_image.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/default_image.php index 509ecb4..743c1ae 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/default_image.php +++ b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/default_image.php @@ -14,7 +14,7 @@ $params = new Registry; $dispatcher = JEventDispatcher::getInstance(); -$dispatcher->trigger('onContentBeforeDisplay', array('com_aggpxtrack.file', &$this->_tmp_img, &$params)); +$dispatcher->trigger('onContentBeforeDisplay', ['com_aggpxtrack.file', &$this->_tmp_img, &$params]); ?>
  • @@ -29,4 +29,4 @@
  • trigger('onContentAfterDisplay', array('com_aggpxtrack.file', &$this->_tmp_img, &$params)); +$dispatcher->trigger('onContentAfterDisplay', ['com_aggpxtrack.file', &$this->_tmp_img, &$params]); diff --git a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/details.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/details.php index 2c9a3fe..b0f6c5f 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/details.php +++ b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/details.php @@ -12,11 +12,10 @@ $lang = JFactory::getLanguage(); -JHtml::_('stylesheet', 'media/popup-imagelist.css', array(), true); +JHtml::_('stylesheet', 'media/popup-imagelist.css', [], true); -if ($lang->isRtl()) -{ - JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array(), true); +if ($lang->isRtl()) { + JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', [], true); } JFactory::getDocument()->addScriptDeclaration("var ImageManager = window.parent.ImageManager;"); @@ -32,7 +31,6 @@ ); ?> images) > 0 || count($this->folders) > 0) : ?> -
    diff --git a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/details_image.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/details_image.php index 546112b..b4f5d7f 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/details_image.php +++ b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/details_image.php @@ -15,7 +15,7 @@ $params = JComponentHelper::getParams('com_aggpxtrack'); $dispatcher = JEventDispatcher::getInstance(); -$dispatcher->trigger('onContentBeforeDisplay', array('com_aggpxtrack.file', &$this->_tmp_img, &$params)); +$dispatcher->trigger('onContentBeforeDisplay', ['com_aggpxtrack.file', &$this->_tmp_img, &$params]); ?> @@ -41,4 +41,4 @@ trigger('onContentAfterDisplay', array('com_aggpxtrack.file', &$this->_tmp_img, &$params)); +$dispatcher->trigger('onContentAfterDisplay', ['com_aggpxtrack.file', &$this->_tmp_img, &$params]); diff --git a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/thumbs.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/thumbs.php index 9778dc8..2ffe39f 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/thumbs.php +++ b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/thumbs.php @@ -12,11 +12,10 @@ $lang = JFactory::getLanguage(); -JHtml::_('stylesheet', 'media/popup-imagelist.css', array(), true); +JHtml::_('stylesheet', 'media/popup-imagelist.css', [], true); -if ($lang->isRtl()) -{ - JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array(), true); +if ($lang->isRtl()) { + JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', [], true); } JFactory::getDocument()->addScriptDeclaration("var ImageManager = window.parent.ImageManager;"); diff --git a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/thumbs_image.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/thumbs_image.php index 62d7ca9..ade77c2 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/thumbs_image.php +++ b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/tmpl/thumbs_image.php @@ -15,7 +15,7 @@ $params = JComponentHelper::getParams('com_aggpxtrack'); $dispatcher = JEventDispatcher::getInstance(); -$dispatcher->trigger('onContentBeforeDisplay', array('com_aggpxtrack.file', &$this->_tmp_img, &$params)); +$dispatcher->trigger('onContentBeforeDisplay', ['com_aggpxtrack.file', &$this->_tmp_img, &$params]); ?>
  • @@ -30,4 +30,4 @@
  • trigger('onContentAfterDisplay', array('com_aggpxtrack.file', &$this->_tmp_img, &$params)); +$dispatcher->trigger('onContentAfterDisplay', ['com_aggpxtrack.file', &$this->_tmp_img, &$params]); diff --git a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/view.html.php b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/view.html.php index 08eda13..525a882 100644 --- a/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/view.html.php +++ b/j4/pkg_aggpxtrack/src/administrator/components/com_aggpxtrack/views/gpxtracklist/view.html.php @@ -55,12 +55,9 @@ public function display($tpl = null) */ public function setFolder($index = 0) { - if (isset($this->folders[$index])) - { + if (isset($this->folders[$index])) { $this->_tmp_folder = &$this->folders[$index]; - } - else - { + } else { $this->_tmp_folder = new JObject; } } @@ -76,12 +73,9 @@ public function setFolder($index = 0) */ public function setImage($index = 0) { - if (isset($this->images[$index])) - { + if (isset($this->images[$index])) { $this->_tmp_img = &$this->images[$index]; - } - else - { + } else { $this->_tmp_img = new JObject; } } diff --git a/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/aggpxtrack.php b/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/aggpxtrack.php index b856d90..c4bc23d 100644 --- a/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/aggpxtrack.php +++ b/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/aggpxtrack.php @@ -28,7 +28,7 @@ class PlgFieldsAggpxtrack extends \Joomla\Component\Fields\Administrator\Plugin\ * * @since 1.5 */ - public function __construct(& $subject, $config) + public function __construct(&$subject, $config) { parent::__construct($subject, $config); diff --git a/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/field/aggpxtrack.php b/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/field/aggpxtrack.php index 8dc9beb..bdb9214 100644 --- a/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/field/aggpxtrack.php +++ b/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/field/aggpxtrack.php @@ -46,10 +46,10 @@ protected function getLayoutPaths() { $template = JFactory::getApplication()->getTemplate(); - return array( + return [ JPATH_ADMINISTRATOR . '/templates/' . $template . '/html/layouts/plugins/system/stats', dirname(__DIR__) . '/layouts', JPATH_SITE . '/layouts' - ); + ]; } } diff --git a/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/field/falist.php b/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/field/falist.php index f67d27a..f98ceb3 100644 --- a/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/field/falist.php +++ b/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/field/falist.php @@ -43,7 +43,7 @@ protected function getInput() }'; $document->addStyleDeclaration($style); - $html = array(); + $html = []; $attr = ''; // Initialize some field attributes. @@ -55,8 +55,7 @@ protected function getInput() $attr .= ' style="font-family: \'FontAwesome\';" '; // To avoid user's confusion, readonly="true" should imply disabled="true". - if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1' || (string) $this->disabled == 'true') - { + if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1' || (string) $this->disabled == 'true') { $attr .= ' disabled="disabled"'; } @@ -67,30 +66,22 @@ protected function getInput() $options = (array) $this->getOptions(); // Create a read-only list (no name) with hidden input(s) to store the value(s). - if ((string) $this->readonly == '1' || (string) $this->readonly == 'true') - { + if ((string) $this->readonly == '1' || (string) $this->readonly == 'true') { $html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id); // E.g. form field type tag sends $this->value as array - if ($this->multiple && is_array($this->value)) - { - if (!count($this->value)) - { + if ($this->multiple && is_array($this->value)) { + if (!count($this->value)) { $this->value[] = ''; } - foreach ($this->value as $value) - { + foreach ($this->value as $value) { $html[] = ''; } - } - else - { + } else { $html[] = ''; } - } - else - // Create a regular list. + } else // Create a regular list. { $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); } @@ -108,7 +99,7 @@ protected function getInput() protected function getOptions() { $fieldname = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname); - $options = array(); + $options = []; $fontawesome_icons = [ "home" => "", @@ -904,16 +895,15 @@ protected function getOptions() "youtube-square" => "", ]; - foreach ($fontawesome_icons as $fontawesome_icon_key => $fontawesome_icon_value) - { - $tmp = array( + foreach ($fontawesome_icons as $fontawesome_icon_key => $fontawesome_icon_value) { + $tmp = [ 'value' => $fontawesome_icon_key, 'text' => $fontawesome_icon_value, 'disable' => 0, 'class' => '', 'selected' => 0, 'checked' => 0, - ); + ]; $options[] = (object) $tmp; } @@ -931,8 +921,7 @@ protected function getOptions() */ public function __get($name) { - if ($name == 'options') - { + if ($name == 'options') { return $this->getOptions(); } diff --git a/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/layouts/aggpxtrack.php b/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/layouts/aggpxtrack.php index 07dd0dd..e7c1d9b 100644 --- a/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/layouts/aggpxtrack.php +++ b/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/layouts/aggpxtrack.php @@ -110,7 +110,7 @@ ?> base-path="" root-folder="get('file_path', 'images'); ?>" url="" modal-container=".modal" modal-width="100%" modal-height="400px" input=".field-media-input" button-select=".button-select" button-clear=".button-clear" button-save-selected=".button-save-selected" preview="static" preview-container=".field-media-preview" preview-width="" preview-height="" supported-extensions=" $imagesAllowedExt, 'audios' => $audiosAllowedExt, 'videos' => $videosAllowedExt, 'documents' => $documentsAllowedExt])); ?>"> +?> base-path="" root-folder="get('file_path', 'images'); ?>" url="" modal-container=".modal" modal-width="100%" modal-height="400px" input=".field-media-input" button-select=".button-select" button-clear=".button-clear" button-save-selected=".button-save-selected" preview="static" preview-container=".field-media-preview" preview-width="" preview-height="" supported-extensions=" $imagesAllowedExt, 'audios' => $audiosAllowedExt, 'videos' => $videosAllowedExt, 'documents' => $documentsAllowedExt])); ?>">
    diff --git a/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/tmpl/aggpxtrack.php b/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/tmpl/aggpxtrack.php index 1760357..11b10e6 100644 --- a/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/tmpl/aggpxtrack.php +++ b/j4/pkg_aggpxtrack/src/plugins/fields/aggpxtrack/tmpl/aggpxtrack.php @@ -12,15 +12,13 @@ JHtml::_('bootstrap.framework'); -if ($field->value == '') -{ +if ($field->value == '') { return; } $class = $fieldParams->get('image_class'); -if ($class) -{ +if ($class) { $class = ' class="' . htmlentities($class, ENT_COMPAT, 'UTF-8', true) . '"'; } @@ -31,15 +29,11 @@ $document = JFactory::getDocument(); $jinput = JFactory::getApplication()->input; -if ($fieldParams->get('show_inactivefirst', 0) && !$jinput->get('aggpxtrackshow', '0')) -{ +if ($fieldParams->get('show_inactivefirst', 0) && !$jinput->get('aggpxtrackshow', '0')) { $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/js/site.js'); echo '' . JText::_('PLG_AGGPXTRACK_INHALT_AKTIVIEREN') . ''; -} -else -{ - if ($fieldParams->get('show_inactivefirst', 0)) - { +} else { + if ($fieldParams->get('show_inactivefirst', 0)) { $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/js/site.js'); echo '' . JText::_('PLG_AGGPXTRACK_INHALT_DEAKTIVIEREN') . ''; } @@ -51,54 +45,45 @@ $stylecolorlight = $fieldParams->get('stylecolorlight', '#cadea5'); $stylecolordark = $fieldParams->get('stylecolordark', '#86b827'); - if ($fieldParams->get('show_elevantioncontrol', 0)) - { + if ($fieldParams->get('show_elevantioncontrol', 0)) { $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/d3/d3.v3.min.js'); $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/Leaflet.Elevation-master/leaflet.elevation-0.0.4.src.js'); $document->addStyleSheet(JURI::root(true) . '/media/plg_fields_aggpxtrack/Leaflet.Elevation-master/leaflet.elevation-0.0.4.css'); } - if ($fieldParams->get('show_fullscreencontrol', 0)) - { + if ($fieldParams->get('show_fullscreencontrol', 0)) { $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/Leaflet.fullscreen/Leaflet.fullscreen.js'); $document->addStyleSheet(JURI::root(true) . '/media/plg_fields_aggpxtrack/Leaflet.fullscreen/leaflet.fullscreen.css'); } - if ($fieldParams->get('show_currentposition', 0)) - { + if ($fieldParams->get('show_currentposition', 0)) { $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/L.Control.Locate/L.Control.Locate.min.js'); $document->addStyleSheet(JURI::root(true) . '/media/plg_fields_aggpxtrack/L.Control.Locate/L.Control.Locate.css'); } - if ($fieldParams->get('show_currentposition', 0) || $fieldParams->get('custom_icons', 0) || $fieldParams->get('show_omnivore', 0)) - { + if ($fieldParams->get('show_currentposition', 0) || $fieldParams->get('custom_icons', 0) || $fieldParams->get('show_omnivore', 0)) { $document->addStyleSheet(JURI::root(true) . '/media/plg_fields_aggpxtrack/L.Control.Locate/font-awesome.min.css'); } - if ($fieldParams->get('custom_icons', 0) || $fieldParams->get('show_omnivore', 0)) - { + if ($fieldParams->get('custom_icons', 0) || $fieldParams->get('show_omnivore', 0)) { $document->addStyleSheet(JURI::root(true) . '/media/plg_fields_aggpxtrack/Leaflet.awesome-markers/leaflet.awesome-markers.css'); $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/Leaflet.awesome-markers/leaflet.awesome-markers.js'); } - if ($fieldParams->get('show_omnivore', 0)) - { + if ($fieldParams->get('show_omnivore', 0)) { $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/leaflet-omnivore/leaflet-omnivore.js'); } - if ($fieldParams->get('easyprint_position', 0)) - { + if ($fieldParams->get('easyprint_position', 0)) { $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/leaflet-easyPrint/bundle.js'); } - if ($fieldParams->get('show_panelLayers', 0)) - { + if ($fieldParams->get('show_panelLayers', 0)) { $document->addStyleSheet(JURI::root(true) . '/media/plg_fields_aggpxtrack/leaflet-panel-layers/leaflet-panel-layers.min.css'); $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/leaflet-panel-layers/leaflet-panel-layers.min.js'); } - if ($fieldParams->get('maptype', 'osm') == 'google') - { + if ($fieldParams->get('maptype', 'osm') == 'google') { $document->addScript('https://maps.googleapis.com/maps/api/js?key=' . $fieldParams->get('googlekey', '')); $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/GoogleMutant/Leaflet.GoogleMutant.js'); } @@ -106,8 +91,7 @@ $document->addScript(JURI::root(true) . '/media/plg_fields_aggpxtrack/js/aggpxtrack.js'); foreach ($value as $path) { - if (!$path) - { + if (!$path) { continue; } @@ -135,8 +119,7 @@ $skriptstring .= " data-googlemapstype='" . $fieldParams->get('googlemapstype', 'satellite') . "' "; $skriptstring .= " data-show_omnivore='" . $fieldParams->get('show_omnivore', 0) . "' "; - if ($fieldParams->get('show_omnivore', 0)) - { + if ($fieldParams->get('show_omnivore', 0)) { $skriptstring .= " data-omnivore_icon='" . $fieldParams->get('omnivore_icon', 'home') . "' "; $skriptstring .= " data-omnivore_markercolor='" . $fieldParams->get('omnivore_markercolor', 'red') . "' "; $skriptstring .= " data-omnivore_iconcolor='" . $fieldParams->get('omnivore_iconcolor', '#ffffff') . "' "; @@ -146,8 +129,7 @@ } $skriptstring .= " data-show_fullscreencontrol='" . $fieldParams->get('show_fullscreencontrol', 0) . "' "; - if ($fieldParams->get('show_fullscreencontrol', 0)) - { + if ($fieldParams->get('show_fullscreencontrol', 0)) { $skriptstring .= " data-fullscreencontrol_viewfullscreen='" . JText::_('PLG_AGGPXTRACK_VIEW_FULLSCREEN') . "' "; $skriptstring .= " data-fullscreencontrol_exitfullscreen='" . JText::_('PLG_AGGPXTRACK_EXIT_FULLSCREEN') . "' "; $skriptstring .= " data-fullscreencontrol_position='" . $fieldParams->get('fullscreencontrol_position', 'topleft') . "' "; @@ -188,8 +170,7 @@ $skriptstring .= " data-currentposition_position='" . $fieldParams->get('currentposition_position', 'topleft') . "' "; $skriptstring .= " data-currentposition_initialZoomLevel='" . $fieldParams->get('currentposition_initialZoomLevel', '17') . "' "; - if (null !== $fieldParams->get('scale')) - { + if (null !== $fieldParams->get('scale')) { $skriptstring .= " data-scale='" . count($fieldParams->get('scale')) . "' "; } @@ -197,8 +178,7 @@ $skriptstring .= " data-scale-imperial='" . in_array('imperial', $fieldParams->get('scale', $defaultArray)) . "' "; $skriptstring .= " data-show_elevantioncontrol='" . $fieldParams->get('show_elevantioncontrol', 0) . "' "; - if ($fieldParams->get('show_elevantioncontrol', 0)) - { + if ($fieldParams->get('show_elevantioncontrol', 0)) { $skriptstring .= " data-elevantioncontrol_collapsed='" . $fieldParams->get('elevantioncontrol_collapsed', false) . "' "; $skriptstring .= " data-elevantioncontrol_top='" . $fieldParams->get('elevantioncontrol_top', '10') . "' "; $skriptstring .= " data-elevantioncontrol_right='" . $fieldParams->get('elevantioncontrol_right', '20') . "' "; @@ -211,8 +191,7 @@ } $skriptstring .= " data-show_panelLayers='" . $fieldParams->get('show_panelLayers', 0) . "' "; - if ($fieldParams->get('show_panelLayers', 0)) - { + if ($fieldParams->get('show_panelLayers', 0)) { $skriptstring .= " data-panelLayers='" . htmlspecialchars(json_encode($fieldParams->get('panelLayers', null)), ENT_QUOTES, 'UTF-8') . "' "; } @@ -222,12 +201,17 @@ JText::script('PLG_AGGPXTRACK_CURRENTPOSITION_STRING'); $buffer .= sprintf( - $skriptstring, $class, htmlentities($path, ENT_COMPAT, 'UTF-8', true), htmlentities($startIconUrl, ENT_COMPAT, 'UTF-8', true), htmlentities($endIconUrl, ENT_COMPAT, 'UTF-8', true), htmlentities($shadowUrl, ENT_COMPAT, 'UTF-8', true), htmlentities($wptIconUrls, ENT_COMPAT, 'UTF-8', true) + $skriptstring, + $class, + htmlentities($path, ENT_COMPAT, 'UTF-8', true), + htmlentities($startIconUrl, ENT_COMPAT, 'UTF-8', true), + htmlentities($endIconUrl, ENT_COMPAT, 'UTF-8', true), + htmlentities($shadowUrl, ENT_COMPAT, 'UTF-8', true), + htmlentities($wptIconUrls, ENT_COMPAT, 'UTF-8', true) ); $buttonstyle = ''; - if ($fieldParams->get('show_downloadlink', 0) == 'text') - { + if ($fieldParams->get('show_downloadlink', 0) == 'text') { $buffer .= '

    ' . JText::_('PLG_AGGPXTRACK_DOWNLOAD_LABEL') . '' . '' . JText::_('PLG_AGGPXTRACK_DOWNLOAD_LINKTEXT') . '

    '; $buttonstyle .= '.agbutton_p' . $unique . ' {'; @@ -235,8 +219,7 @@ $buttonstyle .= '}'; $document->addStyleDeclaration($buttonstyle); } - if ($fieldParams->get('show_downloadlink', 0) == 'button') - { + if ($fieldParams->get('show_downloadlink', 0) == 'button') { $buffer .= '

    ' @@ -264,12 +247,11 @@ $buffer_info = ''; - if ($fieldParams->get('showinfo', 'no') != 'no') - { + if ($fieldParams->get('showinfo', 'no') != 'no') { $buffer_info = '

    '; - $infovalues = array( + $infovalues = [ "distance", "name", "start_time", @@ -286,11 +268,10 @@ "average_hr", "average_cadence", "average_temp" - ); + ]; foreach ($infovalues as $value) { - if ($fieldParams->get('show_' . $value, 0)) - { + if ($fieldParams->get('show_' . $value, 0)) { $buffer_info .= '' . '' . '
    ' @@ -310,8 +291,7 @@ $style = ''; - if ($fieldParams->get('infostyle', 'style') == 'style_1') - { + if ($fieldParams->get('infostyle', 'style') == 'style_1') { $style = '#gpx_info_' . $unique . ' tr:nth-child(even) td {'; $style .= 'background: ' . $stylecolorlight . ';'; $style .= '}'; @@ -333,8 +313,7 @@ $style .= '}'; } - if ($fieldParams->get('infostyle', 'style') == 'style_2') - { + if ($fieldParams->get('infostyle', 'style') == 'style_2') { $style = '#gpx_info_' . $unique . ' table tbody tr {'; $style .= 'border-top: 2px solid ' . $stylecolordark . ';'; $style .= '}'; @@ -378,14 +357,11 @@ $document->addStyleDeclaration($style); } - if ($fieldParams->get('showinfo', 'no') == 'before') - { + if ($fieldParams->get('showinfo', 'no') == 'before') { echo $buffer_info . $buffer; - } elseif ($fieldParams->get('showinfo', 'no') == 'after') - { + } else if ($fieldParams->get('showinfo', 'no') == 'after') { echo $buffer . $buffer_info; - } else - { + } else { echo $buffer; } }