Skip to content

Commit ef0dcb6

Browse files
authored
Merge pull request #145 from mambax7/master
strict types
2 parents 12ef849 + a2ea0a4 commit ef0dcb6

271 files changed

Lines changed: 2364 additions & 2592 deletions

File tree

Some content is hidden

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

.atoum.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<?php
1+
<?php declare(strict_types=1);
2+
23
//.atoum.php
34

45
use mageekguy\atoum;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png)
22

3-
![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp8.png)
3+
![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp81.png)
44

55
# Support
66

admin/about.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
/*
44
You may not change or alter any portion of this comment or credits
@@ -18,7 +18,7 @@
1818
*
1919
* @since 2.5.0
2020
*
21-
* @author Txmod Xoops https://xoops.org
21+
* @author Txmod Xoops https://xoops.org
2222
* Goffy https://myxoops.org
2323
*/
2424
require __DIR__ . '/header.php';

admin/building.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
/*
44
You may not change or alter any portion of this comment or credits
@@ -9,6 +9,7 @@
99
but WITHOUT ANY WARRANTY; without even the implied warranty of
1010
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1111
*/
12+
1213
/**
1314
* modulebuilder module.
1415
*
@@ -17,14 +18,13 @@
1718
*
1819
* @since 2.5.0
1920
*
20-
* @author Txmod Xoops https://xoops.org
21+
* @author Txmod Xoops https://xoops.org
2122
* Goffy https://myxoops.org
22-
*
2323
*/
2424

25+
use Xmf\Request;
2526
use XoopsModules\Modulebuilder;
2627
use XoopsModules\Modulebuilder\Files;
27-
use Xmf\Request;
2828

2929
$templateMain = 'modulebuilder_building.tpl';
3030

@@ -36,7 +36,7 @@
3636
$checkData = Request::hasVar('check_data');
3737
$moduleObj = $helper->getHandler('Modules')->get($mid);
3838

39-
$cachePath = \XOOPS_VAR_PATH . '/caches/modulebuilder_cache_';
39+
$cachePath = \XOOPS_VAR_PATH . '/caches/modulebuilder_cache_';
4040
if (!\is_dir($cachePath)) {
4141
if (!\mkdir($cachePath, 0777) && !\is_dir($cachePath)) {
4242
throw new \RuntimeException(\sprintf('Directory "%s" was not created', $cachePath));
@@ -59,7 +59,7 @@
5959
case 'check_data':
6060
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('building.php'));
6161
$GLOBALS['xoopsTpl']->assign('modPathIcon16', TDMC_URL . '/' . $modPathIcon16);
62-
$checkdata = Modulebuilder\Files\CheckData::getInstance();
62+
$checkdata = Modulebuilder\Files\CheckData::getInstance();
6363

6464
// check data for inconsistences
6565
$checkResults = [];
@@ -85,7 +85,7 @@
8585
//save test data of selected module before building new version
8686
if (1 === $testdataRestore) {
8787
// Directories for copy from
88-
$fromDir = \XOOPS_ROOT_PATH . '/modules/' . \mb_strtolower($moduleDirname) . '/testdata';
88+
$fromDir = \XOOPS_ROOT_PATH . '/modules/' . \mb_strtolower($moduleDirname) . '/testdata';
8989
if (\is_dir($fromDir)) {
9090
// Directories for copy to
9191
$toDir = TDMC_UPLOAD_TEMP_PATH . '/' . \mb_strtolower($moduleDirname);
@@ -132,14 +132,14 @@
132132
unset($build);
133133

134134
// Get common files
135-
$resCommon = $architecture->setCommonFiles($moduleObj);
135+
$resCommon = $architecture->setCommonFiles($moduleObj);
136136
$build['list'] = \_AM_MODULEBUILDER_BUILDING_COMMON;
137137
$GLOBALS['xoopsTpl']->append('builds', $build);
138138
unset($build);
139139

140140
// Directory to saved all files
141-
$building_directory = \sprintf(\_AM_MODULEBUILDER_BUILDING_DIRECTORY, $moduleDirname);
142-
141+
$building_directory = \sprintf(\_AM_MODULEBUILDER_BUILDING_DIRECTORY, $moduleDirname);
142+
143143
// Copy this module in root modules
144144
if (1 === $inrootCopy) {
145145
if (isset($moduleDirname)) {
@@ -152,7 +152,7 @@
152152
}
153153
}
154154
$building->copyDir($fromDir, $toDir);
155-
$building_directory .= \sprintf(\_AM_MODULEBUILDER_BUILDING_DIRECTORY_INROOT, $toDir);
155+
$building_directory .= \sprintf(\_AM_MODULEBUILDER_BUILDING_DIRECTORY_INROOT, $toDir);
156156
}
157157
if (1 === $testdataRestore) {
158158
// Directories for copy from to

admin/devtools.php

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
/*
44
You may not change or alter any portion of this comment or credits
@@ -19,7 +19,6 @@
1919
* @since 2.5.5
2020
*
2121
* @author Goffy https://myxoops.org
22-
*
2322
*/
2423

2524
use Xmf\Request;
@@ -33,27 +32,27 @@
3332

3433
require __DIR__ . '/header.php';
3534
// Recovered value of argument op in the URL $
36-
$op = Request::getString('op', 'list');
35+
$op = Request::getString('op', 'list');
3736

3837
switch ($op) {
3938
case 'fq':
4039
$fqModule = Request::getString('fq_module');
4140
$src_path = \XOOPS_ROOT_PATH . '/modules/' . $fqModule;
4241
$dst_path = TDMC_UPLOAD_PATH . '/devtools/fq/' . $fqModule;
4342

44-
$patKeys = [];
43+
$patKeys = [];
4544
$patValues = [];
4645
//Devtools::cloneFileFolder($src_path, $dst_path, $patKeys, $patValues);
4746
Devtools::function_qualifier($src_path, $dst_path, $fqModule);
4847
\redirect_header('devtools.php', 3, \_AM_MODULEBUILDER_DEVTOOLS_FQ_SUCCESS);
4948
break;
5049
case 'check_lang':
5150
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('devtools.php'));
52-
$clModuleName = Request::getString('cl_module');
51+
$clModuleName = Request::getString('cl_module');
5352
$clModuleNameUpper = \mb_strtoupper($clModuleName);
5453

5554
//scan language files
56-
$src_path = \XOOPS_ROOT_PATH . '/modules/' . $clModuleName . '/language/english/';
55+
$src_path = \XOOPS_ROOT_PATH . '/modules/' . $clModuleName . '/language/english/';
5756
$langfiles = [];
5857
foreach (scandir($src_path) as $scan) {
5958
if (is_file($src_path . $scan) && 'index.html' !== $scan) {
@@ -69,19 +68,19 @@
6968
}
7069
$constantsAfterInclude = getUserDefinedConstants();
7170
foreach ($constantsAfterInclude as $constKey => $constValue) {
72-
if (strpos($constKey, '_' . $clModuleNameUpper . '_') > 0) {
71+
if (mb_strpos($constKey, '_' . $clModuleNameUpper . '_') > 0) {
7372
$moduleConstants[$constKey] = $constKey;
7473
}
7574
}
7675

7776
//get all php and tpl files from module
7877
$check_path = \XOOPS_ROOT_PATH . '/modules/' . $clModuleName;
79-
$Directory = new RecursiveDirectoryIterator($check_path);
80-
$Iterator = new RecursiveIteratorIterator($Directory);
78+
$Directory = new RecursiveDirectoryIterator($check_path);
79+
$Iterator = new RecursiveIteratorIterator($Directory);
8180
$regexFiles = new RegexIterator($Iterator, '/^.+\.(php|tpl)$/i', RecursiveRegexIterator::GET_MATCH);
8281
//$files = new RegexIterator($flattened, '#^(?:[A-Z]:)?(?:/(?!\.Trash)[^/]+)+/[^/]+\.(?:php|html)$#Di');
8382
$modfiles = [];
84-
foreach($regexFiles as $regexFiles) {
83+
foreach ($regexFiles as $regexFiles) {
8584
$file = str_replace('\\', '/', $regexFiles[0]);
8685
if (!\in_array($file, $langfiles)) {
8786
$modfiles[] = $file;
@@ -91,50 +90,50 @@
9190
//check all constants in all files
9291
$resultCheck = [];
9392
foreach ($moduleConstants as $constKey) {
94-
$foundMod = 0;
95-
$first = '';
93+
$foundMod = 0;
94+
$first = '';
9695
$foundLang = 'not defined';
9796
//search for complete string
98-
foreach($modfiles as $modfile) {
99-
if( strpos(file_get_contents($modfile),$constKey) !== false) {
97+
foreach ($modfiles as $modfile) {
98+
if (mb_strpos(file_get_contents($modfile), $constKey) !== false) {
10099
$foundMod = 1;
101-
$first = $modfile;
100+
$first = $modfile;
102101
break;
103102
}
104103
}
105104
if (0 == $foundMod) {
106105
//search for concatenated string
107106
$needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey);
108-
foreach($modfiles as $modfile) {
109-
if( strpos(file_get_contents($modfile),$needle) !== false) {
107+
foreach ($modfiles as $modfile) {
108+
if (mb_strpos(file_get_contents($modfile), $needle) !== false) {
110109
$foundMod = 1;
111-
$first = $modfile;
110+
$first = $modfile;
112111
break;
113112
}
114113
}
115114
}
116115
if (0 == $foundMod) {
117116
//search for concatenated string
118117
$needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey);
119-
foreach($modfiles as $modfile) {
120-
if( strpos(file_get_contents($modfile),$needle) !== false) {
118+
foreach ($modfiles as $modfile) {
119+
if (mb_strpos(file_get_contents($modfile), $needle) !== false) {
121120
$foundMod = 1;
122-
$first = $modfile;
121+
$first = $modfile;
123122
break;
124123
}
125124
}
126125
}
127-
foreach($langfiles as $langfile) {
128-
if( strpos(file_get_contents($langfile),$constKey) !== false) {
126+
foreach ($langfiles as $langfile) {
127+
if (mb_strpos(file_get_contents($langfile), $constKey) !== false) {
129128
$foundLang = $langfile;
130129
break;
131130
}
132131
}
133132
if ('' == $foundLang) {
134133
//search for concatenated string
135134
$needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_", $constKey);
136-
foreach($langfiles as $langfile) {
137-
if( strpos(file_get_contents($langfile),$needle) !== false) {
135+
foreach ($langfiles as $langfile) {
136+
if (mb_strpos(file_get_contents($langfile), $needle) !== false) {
138137
$foundLang = $langfile;
139138
break;
140139
}
@@ -143,8 +142,8 @@
143142
if ('' == $foundLang) {
144143
//search for concatenated string
145144
$needle = str_replace('_' . $clModuleNameUpper . '_', "_' . \$moduleDirNameUpper . '_' . '", $constKey);
146-
foreach($langfiles as $langfile) {
147-
if( strpos(file_get_contents($langfile),$needle) !== false) {
145+
foreach ($langfiles as $langfile) {
146+
if (mb_strpos(file_get_contents($langfile), $needle) !== false) {
148147
$foundLang = $langfile;
149148
break;
150149
}
@@ -158,8 +157,8 @@
158157
break;
159158
case 'tab_replacer':
160159
$tabModule = Request::getString('tab_module');
161-
$src_path = \XOOPS_ROOT_PATH . '/modules/' . $tabModule;
162-
$dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/';
160+
$src_path = \XOOPS_ROOT_PATH . '/modules/' . $tabModule;
161+
$dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/';
163162
@\mkdir($dst_path);
164163
$dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/' . $tabModule;
165164
@\mkdir($dst_path);
@@ -171,27 +170,25 @@
171170
default:
172171
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('devtools.php'));
173172
$dst_path = TDMC_UPLOAD_PATH . '/devtools/fq/';
174-
$GLOBALS['xoopsTpl']->assign('fq_desc',\str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_FQ_DESC));
173+
$GLOBALS['xoopsTpl']->assign('fq_desc', \str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_FQ_DESC));
175174
$fq_form = Devtools::getFormModulesFq();
176175
$GLOBALS['xoopsTpl']->assign('fq_form', $fq_form->render());
177176
$cl_form = Devtools::getFormModulesCl();
178177
$GLOBALS['xoopsTpl']->assign('cl_form', $cl_form->render());
179178
$tab_form = Devtools::getFormModulesTab();
180179
$GLOBALS['xoopsTpl']->assign('tab_form', $tab_form->render());
181180
$dst_path = TDMC_UPLOAD_PATH . '/devtools/tab/';
182-
$GLOBALS['xoopsTpl']->assign('tab_desc',\str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_TAB_DESC));
183-
$GLOBALS['xoopsTpl']->assign('devtools_list',true);
181+
$GLOBALS['xoopsTpl']->assign('tab_desc', \str_replace('%s', $dst_path, \_AM_MODULEBUILDER_DEVTOOLS_TAB_DESC));
182+
$GLOBALS['xoopsTpl']->assign('devtools_list', true);
184183

185184
break;
186185
}
187186

188-
function getUserDefinedConstants() {
187+
function getUserDefinedConstants()
188+
{
189189
$constants = get_defined_constants(true);
190-
return (isset($constants['user']) ? $constants['user'] : []);
190+
191+
return ($constants['user'] ?? []);
191192
}
192193

193194
require __DIR__ . '/footer.php';
194-
195-
196-
197-

admin/feedback.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
You may not change or alter any portion of this comment or credits
44
of supporting developers from this source code or any supporting source code
@@ -13,8 +13,8 @@
1313
* Feedback plugin for xoops modules
1414
*
1515
* @copyright XOOPS Project (https://xoops.org)
16-
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
17-
* @author Michael Beck <mambax7@gmailc.com>
16+
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
17+
* @author Michael Beck <mambax7@gmail.com>
1818
* @author Wedega - Email:<webmaster@wedega.com>
1919
* @author Fernando Santos (topet05) <fernando@mastop.com.br>
2020
*/

admin/fields.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
/*
44
You may not change or alter any portion of this comment or credits
@@ -27,9 +27,8 @@
2727
*
2828
* @since 2.5.0
2929
*
30-
* @author Txmod Xoops https://xoops.org
30+
* @author Txmod Xoops https://xoops.org
3131
* Goffy https://myxoops.org
32-
*
3332
*/
3433

3534
// Define main template

admin/footer.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
/*
44
You may not change or alter any portion of this comment or credits
@@ -18,9 +18,8 @@
1818
*
1919
* @since 2.5.0
2020
*
21-
* @author Txmod Xoops https://xoops.org
21+
* @author Txmod Xoops https://xoops.org
2222
* Goffy https://myxoops.org
23-
*
2423
*/
2524
$pathIcon32 = Xmf\Module\Admin::iconUrl();
2625

admin/header.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
You may not change or alter any portion of this comment or credits
44
of supporting developers from this source code or any supporting source code
@@ -17,9 +17,8 @@
1717
*
1818
* @since 2.5.0
1919
*
20-
* @author Txmod Xoops https://xoops.org
20+
* @author Txmod Xoops https://xoops.org
2121
* Goffy https://myxoops.org
22-
*
2322
*/
2423
require \dirname(__DIR__) . '/preloads/autoloader.php';
2524

0 commit comments

Comments
 (0)