Skip to content

Commit fe52585

Browse files
authored
Merge pull request #12 from mambax7/master
2.31 RC-2, PHP 8
2 parents cb7af7d + 9554611 commit fe52585

Some content is hidden

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

70 files changed

+859
-525
lines changed

.gitattributes

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
*.cs diff=csharp
66

77
# Standard to msysgit
8-
*.doc diff=astextplain
9-
*.DOC diff=astextplain
8+
*.doc diff=astextplain
9+
*.DOC diff=astextplain
1010
*.docx diff=astextplain
1111
*.DOCX diff=astextplain
1212
*.dot diff=astextplain
1313
*.DOT diff=astextplain
1414
*.pdf diff=astextplain
15-
*.PDF diff=astextplain
16-
*.rtf diff=astextplain
17-
*.RTF diff=astextplain
15+
*.PDF diff=astextplain
16+
*.rtf diff=astextplain
17+
*.RTF diff=astextplain

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png)
22
# Contributing to [XOOPS CMS](https://xoops.org)
33
[![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org)
4-
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html)
4+
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](https://www.gnu.org/licenses/gpl-2.0.html)
55

66
Contributions are **welcome** and will be fully **credited**.
77

8-
We accept contributions via Pull Requests on [Github](https://github.com/XoopsModules25x/xoopseditors).
8+
We accept contributions via Pull Requests on [Github](https://github.com/XoopsModules25x/xlanguage).
99

1010
## Pull Requests
1111

1212
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
13-
- **Add tests!** - We encourage to provide tests for your contributions.
14-
- **Document any change in behavior** - Make sure the `/docs/changelog.txt` and any other relevant documentation are kept up-to-date.
13+
- **Add tests!** - We encourage providing tests for your contributions.
14+
- **Document any change in behavior** - Make sure the `/docs/changelog.txt` and any other relevant documentation are up-to-date.
1515
- **Consider our release cycle** - We try to follow [Semantic Versioning v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
1616
- **Create feature branches** - Don't ask us to pull from your master branch.
1717
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
1818
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
1919

20-
**Happy coding, and _May the Source be with You_!**
20+
Happy coding, and **_May the Source be with You_**!

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png)
2-
## xLanguage module for [XOOPS CMS 2.5.9+](https://xoops.org)
1+
![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp8_400.png)
2+
## xLanguage module for [XOOPS CMS 2.5.10+](https://xoops.org)
33
[![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org)
4-
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html)
4+
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](https://www.gnu.org/licenses/gpl-2.0.html)
55

66
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/XoopsModules25x/xlanguage.svg?style=flat)](https://scrutinizer-ci.com/g/XoopsModules25x/xlanguage/?branch=master)
77
[![Codacy Badge](https://api.codacy.com/project/badge/grade/177664bcc7874ab7bddc1192c59e480d)](https://www.codacy.com/app/mambax7/xlanguage_2)
@@ -19,5 +19,5 @@ To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/
1919

2020
Please visit us on [https://xoops.org](https://xoops.org)
2121

22-
Current and upcoming "next generation" versions of XOOPS CMS are being crafted on GitHub at: https://github.com/XOOPS
22+
Current and upcoming "next generation" versions of XOOPS CMS are crafted on GitHub at: https://github.com/XOOPS
2323

admin/about.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* xLanguage module
45
*
@@ -10,12 +11,15 @@
1011
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1112
*
1213
* @copyright XOOPS Project (https://xoops.org)
13-
* @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
14+
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
1415
* @package xlanguage
1516
* @since 2.0
1617
* @author XOOPS Development Team
1718
**/
18-
require_once __DIR__ . '/admin_header.php';
19+
use Xmf\Module\Admin;
20+
/** @var Admin $adminObject */
21+
22+
require __DIR__ . '/admin_header.php';
1923
xoops_cp_header();
2024

2125
$adminObject->displayNavigation(basename(__FILE__));

admin/admin_footer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22

3-
$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32);
3+
use Xmf\Module\Admin;
4+
5+
$pathIcon32 = Admin::iconUrl('', 32);
46
echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>';
57

68
xoops_cp_footer();

admin/admin_header.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,32 @@
1010
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1111
*
1212
* @copyright XOOPS Project (https://xoops.org)
13-
* @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
13+
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
1414
* @package xlanguage
1515
* @since 2.0
1616
* @author XOOPS Development Team
1717
**/
1818

1919
//use XoopsModules\Xlanguage;
20-
include dirname(__DIR__) . '/preloads/autoloader.php';
20+
use Xmf\Module\Admin;
21+
use XoopsModules\Xlanguage\{
22+
Helper
23+
};
24+
/** @var Helper $helper */
25+
/** @var Admin $adminObject */
2126

22-
require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
27+
require dirname(__DIR__) . '/preloads/autoloader.php';
28+
29+
require_once dirname(__DIR__, 3) . '/include/cp_header.php';
2330
//require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php');
2431

2532
// require_once dirname(__DIR__) . '/class/Utility.php';
26-
require_once dirname(__DIR__) . '/include/common.php';
33+
require_once dirname(__DIR__) . '/include/common.php';
2734

2835
$moduleDirName = basename(dirname(__DIR__));
2936

30-
/** @var \XoopsModules\Xlanguage\Helper $helper */
31-
$helper = \XoopsModules\Xlanguage\Helper::getInstance();
32-
33-
/** @var \Xmf\Module\Admin $adminObject */
34-
$adminObject = \Xmf\Module\Admin::getInstance();
37+
$helper = Helper::getInstance();
38+
$adminObject = Admin::getInstance();
3539

3640
//$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16);
3741
//$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32);
@@ -45,7 +49,7 @@
4549

4650
//$myts = \MyTextSanitizer::getInstance();
4751
//
48-
//if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
52+
//if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
4953
// require_once $GLOBALS['xoops']->path('class/template.php');
5054
// $xoopsTpl = new \XoopsTpl();
5155
//}

admin/index.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1111
*
1212
* @copyright XOOPS Project (https://xoops.org)
13-
* @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
13+
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
1414
* @package xlanguage
1515
* @since 2.0
1616
* @author XOOPS Team
1717
**/
1818

19+
use Xmf\Module\Admin;
20+
1921
require_once __DIR__ . '/admin_header.php';
2022
xoops_cp_header();
2123

22-
$adminObject = \Xmf\Module\Admin::getInstance();
24+
$adminObject = Admin::getInstance();
2325

2426
$adminObject->displayNavigation(basename(__FILE__));
2527
$adminObject->displayIndex();

admin/langform.inc.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* xLanguage module (eXtensible Language Management For XOOPS)
45
*
@@ -10,7 +11,7 @@
1011
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1112
*
1213
* @copyright XOOPS Project (https://xoops.org)
13-
* @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
14+
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
1415
* @package xlanguage
1516
* @since 2.0
1617
* @author D.J.(phppp) php_pp@hotmail.com
@@ -20,7 +21,7 @@
2021

2122
if ($isBase) {
2223
$lang_select = new \XoopsFormSelect(_AM_XLANGUAGE_NAME, 'lang_name', $lang_name);
23-
$lang_select->addOptionArray($xlanguageHandler->getXoopsLangList());
24+
$lang_select->addOptionArray($languageHandler->getXoopsLangList());
2425
$sform->addElement($lang_select, true);
2526
} else {
2627
$sform->addElement(new \XoopsFormText(_AM_XLANGUAGE_NAME, 'lang_name', 50, 255, $lang_name), true);
@@ -39,7 +40,7 @@
3940
$sform->addElement($lang_charset, true);
4041

4142
if (!$isBase) {
42-
$baseList = $xlanguageHandler->getAll();
43+
$baseList = $languageHandler->getAll();
4344
$base_list = [];
4445
foreach ($baseList as $base => $baselang) {
4546
$base_list[$base] = $base;

admin/main.php

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,23 @@
1010
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1111
*
1212
* @copyright XOOPS Project (https://xoops.org)
13-
* @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
13+
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
1414
* @package xlanguage
1515
* @since 2.0
1616
* @author D.J.(phppp) php_pp@hotmail.com
1717
**/
1818

19-
use XoopsModules\Xlanguage;
19+
use Xmf\Module\Admin;
20+
use Xmf\Request;
21+
use XoopsModules\Xlanguage\{
22+
Helper,
23+
LanguageHandler,
24+
Utility
25+
};
26+
/** @var Helper $helper */
27+
/** @var LanguageHandler $languageHandler */
28+
/** @var Utility $utility */
29+
/** @var Admin $adminObject */
2030

2131
require_once __DIR__ . '/admin_header.php';
2232

@@ -36,27 +46,25 @@
3646

3747
define('XLANG_CONFIG_LINK', "<a href='main.php' target='_self'>" . _AM_XLANGUAGE_CONFIG . '</a>');
3848

39-
/** @var \XoopsModules\Xlanguage\Helper $helper */
40-
$helper = \XoopsModules\Xlanguage\Helper::getInstance();
41-
/** @var \XoopsModules\Xlanguage\LanguageHandler $xlanguageHandler */
42-
$xlanguageHandler = $helper->getHandler('Language');
43-
$xlanguageHandler->loadConfig();
49+
$helper = Helper::getInstance();
50+
$languageHandler = $helper->getHandler('Language');
51+
$languageHandler->loadConfig();
4452

4553
switch ($op) {
4654
case 'del':
4755
if (!isset($_POST['ok']) || 1 != $_POST['ok']) {
4856
xoops_cp_header();
49-
$aboutAdmin = \Xmf\Module\Admin::getInstance();
57+
$aboutAdmin = Admin::getInstance();
5058
$adminObject->displayNavigation(basename(__FILE__));
5159
// echo "<h4>" . XLANG_CONFIG_LINK . "</h4>";
52-
xoops_confirm(['op' => 'del', 'type' => \Xmf\Request::getString('type', 0, 'GET'), 'lang_id' => \Xmf\Request::getInt('lang_id', 0, 'GET'), 'ok' => 1], 'main.php', _AM_XLANGUAGE_DELETE_CFM);
60+
xoops_confirm(['op' => 'del', 'type' => Request::getString('type', 0, 'GET'), 'lang_id' => Request::getInt('lang_id', 0, 'GET'), 'ok' => 1], 'main.php', _AM_XLANGUAGE_DELETE_CFM);
5361
} else {
5462
$isBase = true;
5563
if (isset($type) && 'ext' === $type) {
5664
$isBase = false;
5765
}
58-
$lang = $xlanguageHandler->get($lang_id, $isBase);
59-
$xlanguageHandler->delete($lang);
66+
$lang = $languageHandler->get($lang_id, $isBase);
67+
$languageHandler->delete($lang);
6068
redirect_header('main.php', 2, _AM_XLANGUAGE_DELETED);
6169
}
6270
break;
@@ -66,9 +74,9 @@
6674
$isBase = false;
6775
}
6876
if (isset($lang_id) && $lang_id > 0) {
69-
$lang = $xlanguageHandler->get($lang_id, $isBase);
77+
$lang = $languageHandler->get($lang_id, $isBase);
7078
} else {
71-
$lang = $xlanguageHandler->create(true, $isBase);
79+
$lang = $languageHandler->create(true, $isBase);
7280
}
7381
$lang_name = preg_replace("/[^a-zA-Z0-9\_\-]/", '', $lang_name);
7482

@@ -81,12 +89,12 @@
8189
$lang->setVar('lang_base', $lang_base);
8290
}
8391
$lang->setVar('weight', $weight);
84-
$xlanguageHandler->insert($lang);
92+
$languageHandler->insert($lang);
8593
redirect_header('main.php', 2, _AM_XLANGUAGE_SAVED);
8694
break;
8795
case 'edit':
8896
xoops_cp_header();
89-
$aboutAdmin = \Xmf\Module\Admin::getInstance();
97+
$aboutAdmin = Admin::getInstance();
9098
$adminObject->displayNavigation(basename(__FILE__));
9199
// echo "<h4>" . XLANG_CONFIG_LINK . "</h4>";
92100
// echo "<br>";
@@ -96,11 +104,11 @@
96104
$isBase = false;
97105
}
98106
if (isset($lang_id) && $lang_id > 0) {
99-
$lang = $xlanguageHandler->get($lang_id, $isBase);
107+
$lang = $languageHandler->get($lang_id, $isBase);
100108
} elseif (isset($lang_name)) {
101-
$lang = $xlanguageHandler->getByName($lang_name, $isBase);
109+
$lang = $languageHandler->getByName($lang_name, $isBase);
102110
} else {
103-
$lang = $xlanguageHandler->create(true, $isBase);
111+
$lang = $languageHandler->create(true, $isBase);
104112
}
105113
$lang_name = $lang->getVar('lang_name');
106114
$lang_desc = $lang->getVar('lang_desc');
@@ -115,7 +123,7 @@
115123
break;
116124
case 'add':
117125
xoops_cp_header();
118-
$aboutAdmin = \Xmf\Module\Admin::getInstance();
126+
$aboutAdmin = Admin::getInstance();
119127
// echo "<h4>" . XLANG_CONFIG_LINK . "</h4>";
120128
// echo "<br>";
121129
// echo "<h4>" . _AM_XLANGUAGE_ADDLANG . "</h4>";
@@ -136,14 +144,14 @@
136144
require_once __DIR__ . '/langform.inc.php';
137145
break;
138146
case 'createconfig':
139-
Xlanguage\Utility::createConfig();
147+
Utility::createConfig();
140148
redirect_header('main.php', 1, _AM_XLANGUAGE_CREATED);
141149

142150
break;
143151
case 'default':
144152
default:
145153
xoops_cp_header();
146-
$adminObject = \Xmf\Module\Admin::getInstance();
154+
$adminObject = Admin::getInstance();
147155
$adminObject->displayNavigation(basename(__FILE__));
148156

149157
// if (TDMDownloads_checkModuleAdmin()) {
@@ -156,28 +164,28 @@
156164
// }
157165

158166
// echo "<h4>" . XLANG_CONFIG_LINK . "</h4>";
159-
languageList($xlanguageHandler);
160-
$configfile_status = (@is_readable(XLANGUAGE_CONFIG_FILE)) ? _AM_XLANGUAGE_CONFIGOK : _AM_XLANGUAGE_CONFIGNOTOK;
167+
languageList($languageHandler);
168+
$configfile_status = (@is_readable(\XLANGUAGE_CONFIG_FILE)) ? _AM_XLANGUAGE_CONFIGOK : _AM_XLANGUAGE_CONFIGNOTOK;
161169
echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\"><br>";
162170
// echo " - <b><a href='index.php?op=add&amp;type=base'>" . _AM_XLANGUAGE_ADDBASE . "</a></b><br><br>\n";
163171
// echo " - <b><a href='index.php?op=add&amp;type=ext'>" . _AM_XLANGUAGE_ADDEXT . "</a></b><br><br>\n";
164-
echo '<b>' . $configfile_status . '</b>: ' . XLANGUAGE_CONFIG_FILE . " (<a href='main.php?op=createconfig' title='" . _AM_XLANGUAGE_CREATECONFIG . "'>" . _AM_XLANGUAGE_CREATECONFIG . "</a>)<br><br>\n";
172+
echo '<b>' . $configfile_status . '</b>: ' . \XLANGUAGE_CONFIG_FILE . " (<a href='main.php?op=createconfig' title='" . _AM_XLANGUAGE_CREATECONFIG . "'>" . _AM_XLANGUAGE_CREATECONFIG . "</a>)<br><br>\n";
165173
// echo " - <b><a href='about.php'>" . _AM_XLANGUAGE_ABOUT . "</a></b>";
166174
echo '</td></tr></table>';
167175
break;
168176
}
169177
xoops_cp_footer();
170178

171179
/**
172-
* @param \XoopsModules\Xlanguage\LanguageHandler $xlanguageHandler
180+
* @param LanguageHandler $languageHandler
173181
*/
174-
function languageList(Xlanguage\LanguageHandler $xlanguageHandler)
182+
function languageList(LanguageHandler $languageHandler)
175183
{
176-
// global $xlanguageHandler, $xoopsModule;
184+
// global $languageHandler, $xoopsModule;
177185

178186
global $pathIcon16;
179187

180-
$lang_list = $xlanguageHandler->getAllList();
188+
$lang_list = $languageHandler->getAllList();
181189

182190
if ($lang_list && is_array($lang_list)) {
183191
echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">";

admin/menu.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@
1010
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1111
*
1212
* @copyright XOOPS Project (https://xoops.org)
13-
* @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
13+
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
1414
* @package xlanguage
1515
* @since 2.0
1616
* @author D.J.(phppp) php_pp@hotmail.com
1717
**/
1818

19+
use Xmf\Module\Admin;
1920
use XoopsModules\Xlanguage;
2021

2122
// require_once dirname(__DIR__) . '/class/Helper.php';
2223
//require_once dirname(__DIR__) . '/include/common.php';
2324
/** @var Xlanguage\Helper $helper */
2425
$helper = Xlanguage\Helper::getInstance();
26+
$helper->loadLanguage('common');
27+
$helper->loadLanguage('feedback');
2528

26-
$pathIcon32 = \Xmf\Module\Admin::menuIconPath('');
29+
$pathIcon32 = Admin::menuIconPath('');
2730
if (is_object($helper->getModule())) {
2831
$pathModIcon32 = $helper->getModule()->getInfo('modicons32');
2932
}

0 commit comments

Comments
 (0)