Skip to content

Commit 58df387

Browse files
committed
- renamed functions for better sorting
- translated next hard coded parts
1 parent 565f809 commit 58df387

38 files changed

Lines changed: 919 additions & 1001 deletions

class/Files/Admin/AdminHeader.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,19 @@ private function getAdminHeader($moduleDirname)
9595
$tables = $this->getTables();
9696
$ret = $this->pc->getPhpCodeIncludeDir('dirname(dirname(dirname(__DIR__)))', 'include/cp_header');
9797
$ret .= $this->pc->getPhpCodeIncludeDir('dirname(__DIR__)', 'include/common', true);
98-
$ret .= $this->pc->getBlankLine();
99-
$sysicons16 = $this->xc->getXcGetInfo('', 'sysicons16', true);
100-
$sysicons32 = $this->xc->getXcGetInfo('', 'sysicons32', true);
101-
$dirmoduleadmin = $this->xc->getXcGetInfo('', 'dirmoduleadmin', true);
102-
$modicons16 = $this->xc->getXcGetInfo('', 'modicons16', true);
103-
$modicons32 = $this->xc->getXcGetInfo('', 'modicons32', true);
98+
$ret .= $this->pc->getPhpCodeBlankLine();
99+
$sysicons16 = $this->xc->getXcXoopsModuleGetInfo('', 'sysicons16', true);
100+
$sysicons32 = $this->xc->getXcXoopsModuleGetInfo('', 'sysicons32', true);
101+
$dirmoduleadmin = $this->xc->getXcXoopsModuleGetInfo('', 'dirmoduleadmin', true);
102+
$modicons16 = $this->xc->getXcXoopsModuleGetInfo('', 'modicons16', true);
103+
$modicons32 = $this->xc->getXcXoopsModuleGetInfo('', 'modicons32', true);
104104
$ret .= $this->xc->getXcEqualsOperator('$sysPathIcon16 ', "'../' . {$sysicons16}");
105105
$ret .= $this->xc->getXcEqualsOperator('$sysPathIcon32 ', "'../' . {$sysicons32}");
106106
$ret .= $this->xc->getXcEqualsOperator('$pathModuleAdmin', $dirmoduleadmin);
107107
$ret .= $this->xc->getXcEqualsOperator('$modPathIcon16 ', "{$stuModuleDirname}_URL . '/' . {$modicons16} . '/'");
108108
$ret .= $this->xc->getXcEqualsOperator('$modPathIcon32 ', "{$stuModuleDirname}_URL . '/' . {$modicons32} . '/'");
109109
if (is_object($table) && '' != $table->getVar('table_name')) {
110-
$ret .= $this->pc->getBlankLine();
110+
$ret .= $this->pc->getPhpCodeBlankLine();
111111
$ret .= $this->pc->getPhpCodeCommentLine('Get instance of module');
112112
$ret .= $this->xc->getXcEqualsOperator("\$helper", "\XoopsModules\\{$ucfModuleDirname}\Helper::getInstance()");
113113
}
@@ -122,27 +122,27 @@ private function getAdminHeader($moduleDirname)
122122
$template = $this->pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/template', true, false, 'include', "\t");
123123
$template .= $this->xc->getXcEqualsOperator('$xoopsTpl', 'new \XoopsTpl()', null, false, "\t");
124124
$ret .= $this->pc->getPhpCodeConditions('!isset($xoopsTpl)', ' || ', '!is_object($xoopsTpl)', $template, false);
125-
$ret .= $this->pc->getBlankLine();
125+
$ret .= $this->pc->getPhpCodeBlankLine();
126126
$ret .= $this->pc->getPhpCodeCommentLine('Load languages');
127-
$ret .= $this->xc->getXcLoadLanguage('admin');
128-
$ret .= $this->xc->getXcLoadLanguage('modinfo');
129-
$ret .= $this->pc->getBlankLine();
127+
$ret .= $this->xc->getXcXoopsLoadLanguage('admin');
128+
$ret .= $this->xc->getXcXoopsLoadLanguage('modinfo');
129+
$ret .= $this->pc->getPhpCodeBlankLine();
130130
$ret .= $this->pc->getPhpCodeCommentLine('Local admin menu class');
131-
$xoopsPathCond = $this->xc->getXcPath('$pathModuleAdmin', 'moduleadmin', true);
131+
$xoopsPathCond = $this->xc->getXcXoopsPath('$pathModuleAdmin', 'moduleadmin', true);
132132
$fileExists = $this->pc->getPhpCodeFileExists($xoopsPathCond);
133133
$moduleadmin = $this->pc->getPhpCodeIncludeDir($xoopsPathCond, '', true, true, 'include', "\t");
134134
$redirectHeader = $this->xc->getXcRedirectHeader("'../../../admin.php'", '', '5', '_AM_MODULEADMIN_MISSING', false, "\t");
135135

136136
$ret .= $this->pc->getPhpCodeConditions($fileExists, '', '', $moduleadmin, $redirectHeader);
137-
$ret .= $this->pc->getBlankLine();
138-
$ret .= $this->xc->getXcCPHeader();
139-
$ret .= $this->pc->getBlankLine();
137+
$ret .= $this->pc->getPhpCodeBlankLine();
138+
$ret .= $this->xc->getXcXoopsCPHeader();
139+
$ret .= $this->pc->getPhpCodeBlankLine();
140140
$ret .= $this->pc->getPhpCodeCommentLine('System icons path');
141-
$ret .= $this->xc->getXcTplAssign('sysPathIcon16', '$sysPathIcon16');
142-
$ret .= $this->xc->getXcTplAssign('sysPathIcon32', '$sysPathIcon32');
143-
$ret .= $this->xc->getXcTplAssign('modPathIcon16', '$modPathIcon16');
144-
$ret .= $this->xc->getXcTplAssign('modPathIcon32', '$modPathIcon32');
145-
$ret .= $this->pc->getBlankLine();
141+
$ret .= $this->xc->getXcXoopsTplAssign('sysPathIcon16', '$sysPathIcon16');
142+
$ret .= $this->xc->getXcXoopsTplAssign('sysPathIcon32', '$sysPathIcon32');
143+
$ret .= $this->xc->getXcXoopsTplAssign('modPathIcon16', '$modPathIcon16');
144+
$ret .= $this->xc->getXcXoopsTplAssign('modPathIcon32', '$modPathIcon32');
145+
$ret .= $this->pc->getPhpCodeBlankLine();
146146
$ret .= $this->xc->getXcEqualsOperator('$adminObject', '\Xmf\Module\Admin::getInstance()');
147147
$ret .= $this->getSimpleString("\$style = {$stuModuleDirname}_URL . '/assets/css/admin/style.css';");
148148

class/Files/Admin/AdminIndex.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,18 @@ private function getAdminIndex($module)
8888
$ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Common']);
8989
$ret .= $pc->getPhpCodeIncludeDir('dirname(__DIR__)', 'preloads/autoloader', true);
9090
$ret .= $this->getInclude();
91-
$ret .= $pc->getBlankLine();
91+
$ret .= $pc->getPhpCodeBlankLine();
9292
$ret .= $pc->getPhpCodeCommentLine('Template Index');
9393
$ret .= $axc->getAdminTemplateMain((string)$moduleDirname, 'index');
94-
$ret .= $pc->getBlankLine();
94+
$ret .= $pc->getPhpCodeBlankLine();
9595
$ret .= $pc->getPhpCodeCommentLine('Count elements');
9696
$tableName = null;
9797
foreach (array_keys($tables) as $i) {
9898
$tableName = $tables[$i]->getVar('table_name');
9999
$ucfTableName = ucfirst($tableName);
100100
$ret .= $xc->getXcEqualsOperator("\$count{$ucfTableName}", "\${$tableName}Handler->getCount()");
101101
}
102-
$ret .= $pc->getBlankLine();
102+
$ret .= $pc->getPhpCodeBlankLine();
103103
$ret .= $pc->getPhpCodeCommentLine('InfoBox Statistics');
104104
$ret .= $axc->getAxcAddInfoBox($language . 'STATISTICS');
105105
$ret .= $pc->getPhpCodeCommentLine('Info elements');
@@ -117,7 +117,7 @@ private function getAdminIndex($module)
117117
}
118118

119119
if (is_array($tables) && in_array(1, $tableInstall)) {
120-
$ret .= $pc->getBlankLine();
120+
$ret .= $pc->getPhpCodeBlankLine();
121121
$ret .= $pc->getPhpCodeCommentLine('Upload Folders');
122122
$ret .= $xc->getXcEqualsOperator('$configurator', 'new Common\Configurator()');
123123
$cond = '$configurator->uploadFolders && is_array($configurator->uploadFolders)';
@@ -131,10 +131,10 @@ private function getAdminIndex($module)
131131
$ret .= $pc->getPhpCodeForeach('folder', true, false, 'i', $boxLine, '') . PHP_EOL;
132132
}
133133
$ret .= $pc->getPhpCodeCommentLine('Render Index');
134-
$ret .= $xc->getXcTplAssign('navigation', "\$adminObject->displayNavigation('index.php')");
134+
$ret .= $xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('index.php')");
135135

136136
$ret .= $pc->getPhpCodeCommentLine('Test Data');
137-
$condIf = $xc->getXcLoadLanguage('admin/modulesadmin',"\t", 'system');
137+
$condIf = $xc->getXcXoopsLoadLanguage('admin/modulesadmin',"\t", 'system');
138138
$condIf .= $pc->getPhpCodeIncludeDir('dirname(__DIR__)', 'testdata/index', true, '','',"\t");
139139
$condIf .= $axc->getAdminItemButton("constant('CO_' . \$moduleDirNameUpper . '_ADD_SAMPLEDATA')", '', '', $op = '__DIR__ . /../../testdata/index.php?op=load', $type = 'samplebutton', $t = "\t");
140140
$condIf .= $axc->getAdminItemButton("constant('CO_' . \$moduleDirNameUpper . '_SAVE_SAMPLEDATA')", '', '', $op = '__DIR__ . /../../testdata/index.php?op=save', $type = 'samplebutton', $t = "\t");
@@ -143,7 +143,7 @@ private function getAdminIndex($module)
143143
$cond = $xc->getXcGetConfig('displaySampleButton');
144144
$ret .= $pc->getPhpCodeConditions($cond, '', '', $condIf, false);
145145

146-
$ret .= $xc->getXcTplAssign('index', '$adminObject->displayIndex()');
146+
$ret .= $xc->getXcXoopsTplAssign('index', '$adminObject->displayIndex()');
147147

148148
$ret .= $pc->getPhpCodeCommentLine('End Test Data');
149149

class/Files/Admin/AdminPermissions.php

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,16 @@ private function getPermissionsHeader($module, $language)
101101
$ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname], '', '');
102102
$ret .= $pc->getPhpCodeUseNamespace(['XoopsModules', $moduleDirname, 'Constants']);
103103
$ret .= $this->getInclude('header');
104-
$ret .= $pc->getBlankLine();
104+
$ret .= $pc->getPhpCodeBlankLine();
105105
$ret .= $pc->getPhpCodeCommentLine('Template Index');
106106
$ret .= $axc->getAdminTemplateMain($moduleDirname, 'permissions');
107-
$ret .= $xc->getXcTplAssign('navigation', "\$adminObject->displayNavigation('permissions.php')");
108-
$ret .= $pc->getBlankLine();
107+
$ret .= $xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('permissions.php')");
108+
$ret .= $pc->getPhpCodeBlankLine();
109109
$ret .= $xc->getXcXoopsRequest('op', 'op', 'global');
110-
$ret .= $pc->getBlankLine();
110+
$ret .= $pc->getPhpCodeBlankLine();
111111
$ret .= $pc->getPhpCodeCommentLine('Get Form');
112112
$ret .= $pc->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/xoopsform/grouppermform', true);
113-
$ret .= $xc->getXcLoad('XoopsFormLoader');
113+
$ret .= $xc->getXcXoopsLoad('XoopsFormLoader');
114114
$optionsSelect['global'] = "{$language}PERMISSIONS_GLOBAL";
115115
foreach ($tableNames as $tableName) {
116116
$ucfTablename = ucfirst($tableName);
@@ -137,34 +137,35 @@ private function getPermissionsSwitch($module, $language)
137137

138138
$moduleDirname = $module->getVar('mod_dirname');
139139
$tables = $this->getTableTables($module->getVar('mod_id'));
140-
140+
$t = "\t\t";
141+
$n = "\n";
141142
$cases['global']= [
142-
"\$formTitle = {$language}PERMISSIONS_GLOBAL;",
143-
"\$permName = '{$moduleDirname}_ac';",
144-
"\$permDesc = {$language}PERMISSIONS_GLOBAL_DESC;",
145-
"\$globalPerms = array( '4' => {$language}PERMISSIONS_GLOBAL_4, '8' => {$language}PERMISSIONS_GLOBAL_8, '16' => {$language}PERMISSIONS_GLOBAL_16 );",
143+
"{$t}\$formTitle = {$language}PERMISSIONS_GLOBAL;{$n}",
144+
"{$t}\$permName = '{$moduleDirname}_ac';{$n}",
145+
"{$t}\$permDesc = {$language}PERMISSIONS_GLOBAL_DESC;{$n}",
146+
"{$t}\$globalPerms = array( '4' => {$language}PERMISSIONS_GLOBAL_4, '8' => {$language}PERMISSIONS_GLOBAL_8, '16' => {$language}PERMISSIONS_GLOBAL_16 );{$n}",
146147
];
147-
foreach (array_keys($tables) as $t) {
148-
if (1 == $tables[$t]->getVar('table_permissions')) {
149-
$tableName = $tables[$t]->getVar('table_name');
148+
foreach (array_keys($tables) as $i) {
149+
if (1 == $tables[$i]->getVar('table_permissions')) {
150+
$tableName = $tables[$i]->getVar('table_name');
150151
$ucfTablename = ucfirst($tableName);
151152
$cases["approve_{$tableName}"] = [
152-
"\$formTitle = {$language}PERMISSIONS_APPROVE;",
153-
"\$permName = '{$moduleDirname}_approve_{$tableName}';",
154-
"\$permDesc = {$language}PERMISSIONS_APPROVE_DESC . ' {$ucfTablename}';",
155-
"\$handler = \$helper->getHandler('{$tableName}');",
153+
"{$t}\$formTitle = {$language}PERMISSIONS_APPROVE;{$n}",
154+
"{$t}\$permName = '{$moduleDirname}_approve_{$tableName}';{$n}",
155+
"{$t}\$permDesc = {$language}PERMISSIONS_APPROVE_DESC . ' {$ucfTablename}';{$n}",
156+
"{$t}\$handler = \$helper->getHandler('{$tableName}');{$n}",
156157
];
157158
$cases["submit_{$tableName}"] = [
158-
"\$formTitle = {$language}PERMISSIONS_SUBMIT;",
159-
"\$permName = '{$moduleDirname}_submit_{$tableName}';",
160-
"\$permDesc = {$language}PERMISSIONS_SUBMIT_DESC . ' {$ucfTablename}';",
161-
"\$handler = \$helper->getHandler('{$tableName}');",
159+
"{$t}\$formTitle = {$language}PERMISSIONS_SUBMIT;{$n}",
160+
"{$t}\$permName = '{$moduleDirname}_submit_{$tableName}';{$n}",
161+
"{$t}\$permDesc = {$language}PERMISSIONS_SUBMIT_DESC . ' {$ucfTablename}';{$n}",
162+
"{$t}\$handler = \$helper->getHandler('{$tableName}');{$n}",
162163
];
163164
$cases["view_{$tableName}"] = [
164-
"\$formTitle = {$language}PERMISSIONS_VIEW;",
165-
"\$permName = '{$moduleDirname}_view_{$tableName}';",
166-
"\$permDesc = {$language}PERMISSIONS_VIEW_DESC . ' {$ucfTablename}';",
167-
"\$handler = \$helper->getHandler('{$tableName}');",
165+
"{$t}\$formTitle = {$language}PERMISSIONS_VIEW;{$n}",
166+
"{$t}\$permName = '{$moduleDirname}_view_{$tableName}';{$n}",
167+
"{$t}\$permDesc = {$language}PERMISSIONS_VIEW_DESC . ' {$ucfTablename}';{$n}",
168+
"{$t}\$handler = \$helper->getHandler('{$tableName}');{$n}",
168169
];
169170
}
170171
}
@@ -188,11 +189,11 @@ private function getPermissionsBody($module, $language)
188189
$tables = $this->getTableTables($module->getVar('mod_id'));
189190

190191
$ret = $xc->getXcGetVar('moduleId', 'xoopsModule', 'mid');
191-
$ret .= $xc->getXcGroupPermForm('permform', '$formTitle', '$moduleId', '$permName', '$permDesc', "'admin/permissions.php'");
192+
$ret .= $xc->getXcXoopsFormGroupPerm('permform', '$formTitle', '$moduleId', '$permName', '$permDesc', "'admin/permissions.php'");
192193
$ret .= $xc->getXcEqualsOperator('$permFound', 'false');
193194
$foreach1 = $xc->getXcAddItem('permform', '$gPermId', '$gPermName', "\t\t");
194195
$if1 = $pc->getPhpCodeForeach('globalPerms', false, 'gPermId', 'gPermName', $foreach1, "\t");
195-
$if1 .= $xc->getXcTplAssign('form', '$permform->render()', true, "\t");
196+
$if1 .= $xc->getXcXoopsTplAssign('form', '$permform->render()', true, "\t");
196197
$if1 .= $xc->getXcEqualsOperator('$permFound', 'true', null, false, "\t");
197198
$ret .= $pc->getPhpCodeConditions('$op', ' === ', "'global'", $if1, false);
198199

@@ -213,13 +214,13 @@ private function getPermissionsBody($module, $language)
213214
$fieldMain = $fieldName;
214215
}
215216
}
216-
$if_count = $xc->getXcObjHandlerAll($tableName, $fieldMain, 0, 0, "\t\t");
217+
$if_count = $xc->getXcHandlerAllObj($tableName, $fieldMain, 0, 0, "\t\t");
217218
$getVar1 = $xc->getXcGetVar('', "{$tableName}All[\$i]", $fieldId, true);
218219
$getVar2 = $xc->getXcGetVar('', "{$tableName}All[\$i]", $fieldMain, true);
219220
$fe_content = $xc->getXcAddItem('permform', $getVar1, $getVar2, "\t\t\t");
220-
$if_table = $xc->getXcObjHandlerCount($tableName, "\t");
221+
$if_table = $xc->getXcHandlerCountObj($tableName, "\t");
221222
$if_count .= $pc->getPhpCodeForeach("{$tableName}All", true, false, 'i', $fe_content, "\t\t");
222-
$if_count .= $xc->getXcTplAssign('form', '$permform->render()', true, "\t\t");
223+
$if_count .= $xc->getXcXoopsTplAssign('form', '$permform->render()', true, "\t\t");
223224
$if_table .= $pc->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $if_count, false, "\t");
224225
$if_table .= $xc->getXcEqualsOperator('$permFound', 'true', null, false, "\t");
225226
$cond = "\$op === 'approve_{$tableName}' || \$op === 'submit_{$tableName}' || \$op === 'view_{$tableName}'";

0 commit comments

Comments
 (0)