Skip to content

Commit e48e278

Browse files
[J4] Move helper classes to namespace
1 parent 6f20b2e commit e48e278

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+264
-225
lines changed

administrator/components/com_jtg/controller.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
// No direct access
1818
defined('_JEXEC') or die('Restricted access');
1919

20-
jimport('joomla.application.component.controller');
2120
use Joomla\CMS\Factory;
21+
use Joomla\CMS\MVC\Controller\BaseController;
22+
23+
use Jtg\Component\Jtg\Site\Helpers\JtgHelper;
2224

2325
/**
2426
* class JtgControllerfor the jtg component
@@ -27,7 +29,7 @@
2729
* @subpackage Frontend
2830
* @since 0.8
2931
*/
30-
class JtgController extends JControllerLegacy
32+
class JtgController extends BaseController
3133
{
3234
/**
3335
* function_description
@@ -53,8 +55,6 @@ public function display($cachable = false, $urlparams = false)
5355
{
5456
require_once JPATH_COMPONENT . '/helpers/jtg.php';
5557

56-
// JtgHelper::updateReset();
57-
5858
// Load the submenu.
5959
JtgHelper::addSubmenu($this->getTask());
6060

administrator/components/com_jtg/controllers/files.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
use Joomla\CMS\Uri\Uri;
2929
use Joomla\Utilities\ArrayHelper;
3030

31+
use Jtg\Component\Jtg\Site\Helpers\JtgHelper;
32+
3133
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_jtg/tables');
3234

3335
/**

administrator/components/com_jtg/jtg.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,8 @@
4343
$model = JPATH_COMPONENT . '/models/install.php';
4444

4545
// Require the base controller
46-
require_once JPATH_COMPONENT_SITE . '/helpers/helper.php';
47-
require_once JPATH_COMPONENT_SITE . '/helpers/maphelper.php';
4846
require_once JPATH_COMPONENT . '/controller.php';
4947

50-
// Load the GpsDataClass
51-
JLoader::import('components.com_jtg.helpers.gpsClass', JPATH_SITE, 'gpsClass');
52-
5348
// Initialize the controller
5449
$input = Factory::getApplication()->input;
5550
if ($controller = $input->getWord('controller'))

administrator/components/com_jtg/models/cat.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,20 @@
2222
use Joomla\CMS\Factory;
2323
use Joomla\CMS\Filesystem\File;
2424
use Joomla\CMS\Language\Text;
25+
use Joomla\CMS\Model\ItemModel;
2526
use Joomla\CMS\Session\Session;
2627
use Joomla\Utilities\ArrayHelper;
2728

29+
use Jtg\Component\Jtg\Site\Helpers\JtgHelper;
30+
2831
/**
2932
* Model Class Categorie
3033
*
3134
* @package Comjtg
3235
* @subpackage Frontend
3336
* @since 0.8
3437
*/
35-
class JtgModelCat extends JModelLegacy
38+
class JtgModelCat extends ItemModel
3639
{
3740
/**
3841
* function_description

administrator/components/com_jtg/models/cats.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818
// No direct access
1919
defined('_JEXEC') or die('Restricted access');
2020

21-
// Import Joomla! libraries
22-
jimport('joomla.application.component.model');
23-
2421
use Joomla\CMS\Factory;
2522
use Joomla\CMS\Filesystem\Folder;
2623
use Joomla\CMS\Language\Text;
24+
use Joomla\CMS\MVC\Model\ListModel;
2725

2826
/**
2927
* Model Class Categories
@@ -32,7 +30,7 @@
3230
* @subpackage Frontend
3331
* @since 0.8
3432
*/
35-
class JtgModelCats extends JModelLegacy
33+
class JtgModelCats extends ListModel
3634
{
3735
/**
3836
* Category Images array

administrator/components/com_jtg/models/comments.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@
1818
// No direct access
1919
defined('_JEXEC') or die('Restricted access');
2020

21-
// Import Joomla! libraries
22-
jimport('joomla.application.component.model');
23-
2421
use Joomla\CMS\Factory;
22+
use Joomla\CMS\MVC\Model\ListModel;
2523
use Joomla\Utilities\ArrayHelper;
24+
2625
/**
2726
* JtgModelComments class for the jtg component
2827
*
@@ -31,7 +30,7 @@
3130
* @since 0.8
3231
*/
3332

34-
class JtgModelComments extends JModelLegacy
33+
class JtgModelComments extends ListModel
3534
{
3635
/**
3736
* function_description

administrator/components/com_jtg/models/config.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@
1818
// No direct access
1919
defined('_JEXEC') or die('Restricted access');
2020

21-
// Import Joomla! libraries
22-
jimport('joomla.application.component.model');
23-
2421
use Joomla\CMS\Factory;
2522
use Joomla\CMS\Filesystem\Folder;
23+
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
2624
use Joomla\CMS\Session\Session;
2725

26+
use Jtg\Component\Jtg\Site\Helpers\JtgHelper;
27+
2828
/**
2929
* Model Class Configuration
3030
*
3131
* @package Comjtg
3232
* @subpackage Frontend
3333
* @since 0.8
3434
*/
35-
class JtgModelConfig extends JModelLegacy
35+
class JtgModelConfig extends BaseDatabaseModel
3636
{
3737
/**
3838
* function_description

administrator/components/com_jtg/models/fields/maptype.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717

1818
defined('JPATH_BASE') or die;
1919

20-
jimport('joomla.html.html');
2120
jimport('joomla.form.formfield');
2221
jimport('joomla.form.helper');
2322
JFormHelper::loadFieldClass('list');
2423

24+
use Jtg\Component\Jtg\Site\Helpers\JtgMapHelper;
25+
2526
/**
2627
* Custom Field class for the Joomla Framework.
2728
*

administrator/components/com_jtg/models/files.php

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
// No direct access
2020
defined('_JEXEC') or die('Restricted access');
2121

22-
// Import Joomla! libraries
23-
jimport('joomla.application.component.model');
24-
2522
use Joomla\CMS\HTML\HTMLHelper;
2623
use Joomla\CMS\Factory;
2724
use Joomla\CMS\Filesystem\File;
@@ -31,6 +28,9 @@
3128
use Joomla\CMS\Table\Table;
3229
use Joomla\Utilities\ArrayHelper;
3330

31+
use Jtg\Component\Jtg\Site\Helpers\GPSData;
32+
use Jtg\Component\Jtg\Site\Helpers\JtgHelper;
33+
3434
/**
3535
* Model Class Files
3636
*
@@ -74,10 +74,8 @@ function updateGeneratedValues()
7474
$id = Factory::getApplication()->input->get('id');
7575
$file = Factory::getApplication()->input->get('file');
7676
$cfg = JtgHelper::getConfig();
77-
jimport('joomla.filesystem.file');
78-
require_once '../components/com_jtg/helpers/gpsClass.php';
7977
$file = JPATH_SITE . '/images/jtrackgallery/uploaded_tracks/' . $file;
80-
$gpsData = new GpsDataClass($file, $file);
78+
$gpsData = new GPSData($file, $file);
8179

8280
if ($gpsData->displayErrors())
8381
{
@@ -837,9 +835,6 @@ function getAccess($id)
837835
function saveFiles()
838836
{
839837
$app = Factory::getApplication();
840-
jimport('joomla.filesystem.file');
841-
jimport('joomla.filesystem.folder');
842-
require_once '../components/com_jtg/helpers/gpsClass.php';
843838
$fileokay = true;
844839
$db = $this->getDbo();
845840
$user = Factory::getUser();
@@ -926,7 +921,7 @@ function saveFiles()
926921
$data['access'] = $input->getInt('access_' . $i);
927922

928923
// TODO use $target below!!
929-
$gpsData = new GpsDataClass($file, $filename);
924+
$gpsData = new GPSData($file, $filename);
930925
$errors = $gpsData->displayErrors();
931926

932927
if ($errors)
@@ -1037,9 +1032,6 @@ function getDefaultMaps()
10371032
function importFromJPT($track)
10381033
{
10391034
// TODO Deprecated, can be replacd by import from injooosm
1040-
jimport('joomla.filesystem.file');
1041-
jimport('joomla.filesystem.folder');
1042-
require_once '../components/com_jtg/helpers/gpsClass.php';
10431035
$db = $this->getDbo();
10441036
$fileokay = false;
10451037
$targetdir = JPATH_SITE . '/images/jtrackgallery/uploaded_tracks/';
@@ -1183,9 +1175,6 @@ function importFromJPT($track)
11831175
function saveFile()
11841176
{
11851177
$app = Factory::getApplication();
1186-
jimport('joomla.filesystem.file');
1187-
jimport('joomla.filesystem.folder');
1188-
require_once '../components/com_jtg/helpers/gpsClass.php';
11891178

11901179
$db = $this->getDbo();
11911180
$user = Factory::getUser();
@@ -1271,7 +1260,7 @@ function saveFile()
12711260

12721261
// Get the start coordinates
12731262
$file = $upload_dir . $target;
1274-
$gpsData = new GpsDataClass($file, $target);
1263+
$gpsData = new GPSData($file, $target);
12751264
$errors = $gpsData->displayErrors();
12761265

12771266
if ($errors)
@@ -1362,11 +1351,8 @@ function importJPTtracks()
13621351
{
13631352
/* under construction */
13641353
// TODO DEPRECATED
1365-
jimport('joomla.filesystem.file');
1366-
jimport('joomla.filesystem.folder');
13671354
$importfiles = $this->_fetchJPTfiles;
13681355
$app = Factory::getApplication();
1369-
require_once '../components/com_jtg/helpers/gpsClass.php';
13701356
$fileokay = true;
13711357
$db = $this->getDbo();
13721358
$user = Factory::getUser();
@@ -1557,9 +1543,6 @@ function getImageFiles($id)
15571543
function updateFile()
15581544
{
15591545
$app = Factory::getApplication();
1560-
jimport('joomla.filesystem.file');
1561-
jimport('joomla.filesystem.folder');
1562-
require_once '../components/com_jtg/helpers/gpsClass.php';
15631546

15641547
$db = $this->getDbo();
15651548
$user = Factory::getUser();

administrator/components/com_jtg/models/map.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
defined('_JEXEC') or die('Restricted access');
2020

2121
use Joomla\CMS\Factory;
22+
use Joomla\CMS\MVC\Model\ItemModel;
2223

2324
/**
2425
* Model Class Categorie
@@ -27,7 +28,7 @@
2728
* @subpackage Frontend
2829
* @since 0.8
2930
*/
30-
class JtgModelMAp extends JModelLegacy
31+
class JtgModelMap extends ItemModel
3132
{
3233
/**
3334
* function_description

0 commit comments

Comments
 (0)