File tree Expand file tree Collapse file tree 5 files changed +102
-18
lines changed
administrator/modules/mod_version Expand file tree Collapse file tree 5 files changed +102
-18
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1111 <description >MOD_VERSION_XML_DESCRIPTION</description >
1212 <namespace path =" src" >Joomla\Module\Version</namespace >
1313 <files >
14- <filename module =" mod_version" >mod_version.php</ filename >
14+ <folder module =" mod_version" >services</ folder >
1515 <folder >src</folder >
1616 <folder >tmpl</folder >
1717 </files >
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * @package Joomla.Administrator
5+ * @subpackage mod_version
6+ *
7+ * @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
8+ * @license GNU General Public License version 2 or later; see LICENSE.txt
9+ */
10+
11+ \defined ('_JEXEC ' ) or die;
12+
13+ use Joomla \CMS \Extension \Service \Provider \HelperFactory ;
14+ use Joomla \CMS \Extension \Service \Provider \Module ;
15+ use Joomla \CMS \Extension \Service \Provider \ModuleDispatcherFactory ;
16+ use Joomla \DI \Container ;
17+ use Joomla \DI \ServiceProviderInterface ;
18+
19+ return new class () implements ServiceProviderInterface {
20+ /**
21+ * Registers the service provider with a DI container.
22+ *
23+ * @param Container $container The DI container.
24+ *
25+ * @return void
26+ *
27+ * @since __DEPLOY_VERSION__
28+ */
29+ public function register (Container $ container )
30+ {
31+ $ container ->registerServiceProvider (new ModuleDispatcherFactory ('\\Joomla \\Module \\Version ' ));
32+ $ container ->registerServiceProvider (new HelperFactory ('\\Joomla \\Module \\Version \\Administrator \\Helper ' ));
33+
34+ $ container ->registerServiceProvider (new Module ());
35+ }
36+ };
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * @package Joomla.Administrator
5+ * @subpackage mod_version
6+ *
7+ * @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
8+ * @license GNU General Public License version 2 or later; see LICENSE.txt
9+ */
10+
11+ namespace Joomla \Module \Version \Administrator \Dispatcher ;
12+
13+ use Joomla \CMS \Dispatcher \AbstractModuleDispatcher ;
14+ use Joomla \CMS \Helper \HelperFactoryAwareInterface ;
15+ use Joomla \CMS \Helper \HelperFactoryAwareTrait ;
16+
17+ // phpcs:disable PSR1.Files.SideEffects
18+ \defined ('_JEXEC ' ) or die;
19+ // phpcs:enable PSR1.Files.SideEffects
20+
21+ /**
22+ * Dispatcher class for mod_version
23+ *
24+ * @since __DEPLOY_VERSION__
25+ */
26+ class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
27+ {
28+ use HelperFactoryAwareTrait;
29+
30+ /**
31+ * Returns the layout data.
32+ *
33+ * @return array
34+ *
35+ * @since __DEPLOY_VERSION__
36+ */
37+ protected function getLayoutData ()
38+ {
39+ $ data = parent ::getLayoutData ();
40+
41+ $ data ['version ' ] = $ this ->getHelperFactory ()->getHelper ('VersionHelper ' )->getVersionString ();
42+
43+ return $ data ;
44+ }
45+ }
Original file line number Diff line number Diff line change 2121 *
2222 * @since 1.6
2323 */
24- abstract class VersionHelper
24+ class VersionHelper
2525{
2626 /**
2727 * Get the Joomla version number.
2828 *
2929 * @return string String containing the current Joomla version.
30+ *
31+ * @since __DEPLOY_VERSION__
3032 */
31- public static function getVersion ()
33+ public function getVersionString ()
3234 {
3335 $ version = new Version ();
3436
3537 return '‎ ' . $ version ->getShortVersion ();
3638 }
39+
40+ /**
41+ * Get the Joomla version number.
42+ *
43+ * @return string String containing the current Joomla version.
44+ *
45+ * @deprecated __DEPLOY_VERSION__ will be removed in 6.0
46+ * Use the non-static method getVersionString
47+ * Example: Factory::getApplication()->bootModule('mod_version', 'administrator')
48+ * ->getHelper('VersionHelper')
49+ * ->getVersionString()
50+ */
51+ public static function getVersion ()
52+ {
53+ return (new self ())->getVersionString ();
54+ }
3755}
You can’t perform that action at this time.
0 commit comments