Skip to content

Commit b21d72e

Browse files
committed
code cleaning
standardizing class calls
1 parent e4a8645 commit b21d72e

38 files changed

Lines changed: 817 additions & 780 deletions

class/Files/Admin/AdminHeader.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,18 @@ private function getAdminHeader($moduleDirname)
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");
135-
136-
$ret .= $this->pc->getPhpCodeConditions($fileExists, '', '', $moduleadmin, $redirectHeader);
137-
$ret .= $this->pc->getPhpCodeBlankLine();
138-
$ret .= $this->xc->getXcXoopsCPHeader();
135+
$ret .= $this->pc->getPhpCodeConditions($fileExists, '', '', $moduleadmin, $redirectHeader);
136+
$ret .= $this->pc->getPhpCodeBlankLine();
137+
$ret .= $this->xc->getXcXoopsCPHeader();
139138
$ret .= $this->pc->getPhpCodeBlankLine();
140139
$ret .= $this->pc->getPhpCodeCommentLine('System icons path');
141140
$ret .= $this->xc->getXcXoopsTplAssign('sysPathIcon16', '$sysPathIcon16');
142141
$ret .= $this->xc->getXcXoopsTplAssign('sysPathIcon32', '$sysPathIcon32');
143142
$ret .= $this->xc->getXcXoopsTplAssign('modPathIcon16', '$modPathIcon16');
144143
$ret .= $this->xc->getXcXoopsTplAssign('modPathIcon32', '$modPathIcon32');
145144
$ret .= $this->pc->getPhpCodeBlankLine();
146-
$ret .= $this->xc->getXcEqualsOperator('$adminObject', '\Xmf\Module\Admin::getInstance()');
147-
$ret .= $this->getSimpleString("\$style = {$stuModuleDirname}_URL . '/assets/css/admin/style.css';");
145+
$ret .= $this->xc->getXcEqualsOperator('$adminObject', '\Xmf\Module\Admin::getInstance()');
146+
$ret .= $this->getSimpleString("\$style = {$stuModuleDirname}_URL . '/assets/css/admin/style.css';");
148147

149148
return $ret;
150149
}

class/Files/Admin/AdminIndex.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,8 @@ private function getAdminIndex($module)
130130
$boxLine .= $axc->getAxcAddConfigBoxLine("array(\$folder[\$i], '777')", 'chmod', '', "\t");
131131
$ret .= $pc->getPhpCodeForeach('folder', true, false, 'i', $boxLine, '') . PHP_EOL;
132132
}
133-
$ret .= $pc->getPhpCodeCommentLine('Render Index');
134-
$ret .= $xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('index.php')");
135-
133+
$ret .= $pc->getPhpCodeCommentLine('Render Index');
134+
$ret .= $xc->getXcXoopsTplAssign('navigation', "\$adminObject->displayNavigation('index.php')");
136135
$ret .= $pc->getPhpCodeCommentLine('Test Data');
137136
$condIf = $xc->getXcXoopsLoadLanguage('admin/modulesadmin',"\t", 'system');
138137
$condIf .= $pc->getPhpCodeIncludeDir('dirname(__DIR__)', 'testdata/index', true, '','',"\t");
@@ -142,12 +141,10 @@ private function getAdminIndex($module)
142141
$condIf .= $axc->getAdminDisplayButton('left', "\t");
143142
$cond = $xc->getXcGetConfig('displaySampleButton');
144143
$ret .= $pc->getPhpCodeConditions($cond, '', '', $condIf, false);
145-
146-
$ret .= $xc->getXcXoopsTplAssign('index', '$adminObject->displayIndex()');
147-
144+
$ret .= $xc->getXcXoopsTplAssign('index', '$adminObject->displayIndex()');
148145
$ret .= $pc->getPhpCodeCommentLine('End Test Data');
149146

150-
$ret .= $this->getInclude('footer');
147+
$ret .= $this->getInclude('footer');
151148

152149
return $ret;
153150
}

class/Files/Admin/AdminPermissions.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,10 @@ private function getPermissionsBody($module, $language)
228228
}
229229
}
230230

231-
$ret .= $pc->getPhpCodeUnset('permform');
232-
231+
$ret .= $pc->getPhpCodeUnset('permform');
233232
$elseInter = $xc->getXcRedirectHeader("'permissions.php'", '', '3', "{$language}NO_PERMISSIONS_SET", false, "\t");
234233
$elseInter .= $this->getSimpleString("exit();", "\t");
235-
$ret .= $pc->getPhpCodeConditions('$permFound', ' !== ', 'true', $elseInter, false);
234+
$ret .= $pc->getPhpCodeConditions('$permFound', ' !== ', 'true', $elseInter, false);
236235

237236
return $ret;
238237
}

class/Files/Classes/ClassFiles.php

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ public function write($module, $table, $tables, $filename)
8484
*/
8585
private function getInitVar($fieldName, $type = 'INT')
8686
{
87-
$cc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance();
87+
$cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance();
8888

89-
return $cc->getClassInitVar($fieldName, $type);
89+
return $cxc->getClassInitVar($fieldName, $type);
9090
}
9191

9292
/**
@@ -258,7 +258,7 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm)
258258
{
259259
$pc = Tdmcreate\Files\CreatePhpCode::getInstance();
260260
$xc = Tdmcreate\Files\CreateXoopsCode::getInstance();
261-
$cc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance();
261+
$cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance();
262262
$fe = ClassFormElements::getInstance();
263263
$moduleDirname = $module->getVar('mod_dirname');
264264
$tableName = $table->getVar('table_name');
@@ -272,10 +272,9 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm)
272272
$action = $xc->getXcEqualsOperator('$action', "\$_SERVER['REQUEST_URI']", null, "\t\t\t");
273273
$ucfModuleDirname = ucfirst($moduleDirname);
274274
$getForm = $xc->getXcGetInstance('helper', "\XoopsModules\\{$ucfModuleDirname}\Helper", "\t\t");
275-
//$getForm .= $pc->getPhpCodeConditions('$action', ' === ', 'false', $action, false, "\t\t");
276-
$getForm .= $pc->getPhpCodeConditions('false', ' === ', '$action', $action, false, "\t\t");
277-
$xUser = $pc->getPhpCodeGlobals('xoopsUser');
278-
$xModule = $pc->getPhpCodeGlobals('xoopsModule');
275+
$getForm .= $pc->getPhpCodeConditions('false', ' === ', '$action', $action, false, "\t\t");
276+
$xUser = $pc->getPhpCodeGlobals('xoopsUser');
277+
$xModule = $pc->getPhpCodeGlobals('xoopsModule');
279278
$permString = 'upload_groups';
280279
if (1 != $tableCategory/* && (1 == $tablePermissions)*/) {
281280
$getForm .= $pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t");
@@ -292,8 +291,8 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm)
292291
$getForm .= $pc->getPhpCodeTernaryOperator('title', '$this->isNew()', "sprintf({$language}{$stuTableSoleName}_ADD)", "sprintf({$language}{$stuTableSoleName}_EDIT)", "\t\t");
293292
$getForm .= $pc->getPhpCodeCommentLine('Get Theme', 'Form', "\t\t");
294293
$getForm .= $xc->getXcXoopsLoad('XoopsFormLoader', "\t\t");
295-
$getForm .= $cc->getClassXoopsThemeForm('form', 'title', 'form', 'action', 'post');
296-
$getForm .= $cc->getClassSetExtra('form', "'enctype=\"multipart/form-data\"'");
294+
$getForm .= $cxc->getClassXoopsThemeForm('form', 'title', 'form', 'action', 'post');
295+
$getForm .= $cxc->getClassSetExtra('form', "'enctype=\"multipart/form-data\"'");
297296
$getForm .= $fe->renderElements();
298297

299298
if (in_array(1, $fieldInForm)) {
@@ -303,9 +302,8 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm)
303302
}
304303
$getForm .= $pc->getPhpCodeCommentLine('To Save', '', "\t\t");
305304
//$hiddenSave = $cc->getClassXoopsFormHidden('', "'op'", "'save'", true, false);
306-
$getForm .= $cc->getClassAddElement('form', "new \XoopsFormHidden('op', 'save')");
307-
//$buttonSend = $cc->getClassXoopsFormButton('', '', 'submit', '_SUBMIT', 'submit', true);
308-
$getForm .= $cc->getClassAddElement('form', "new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)");
305+
$getForm .= $cxc->getClassAddElement('form', "new \XoopsFormHidden('op', 'save')");
306+
$getForm .= $cxc->getClassAddElement('form', "new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)");
309307
$getForm .= $this->getSimpleString('return $form;', "\t\t");
310308

311309
$ret .= $pc->getPhpCodeFunction('getForm' . $ucfTableName, '$action = false', $getForm, 'public ', false, "\t");
@@ -326,7 +324,7 @@ private function getPermissionsInForm($moduleDirname, $fieldId, $tableName)
326324
{
327325
$pc = Tdmcreate\Files\CreatePhpCode::getInstance();
328326
$xc = Tdmcreate\Files\CreateXoopsCode::getInstance();
329-
$cc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance();
327+
$cxc = Tdmcreate\Files\Classes\ClassXoopsCode::getInstance();
330328
$permissionApprove = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_APPROVE');
331329
$permissionSubmit = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_SUBMIT');
332330
$permissionView = $this->getLanguage($moduleDirname, 'AM', 'PERMISSIONS_VIEW');
@@ -339,28 +337,28 @@ private function getPermissionsInForm($moduleDirname, $fieldId, $tableName)
339337
$mId = $xc->getXcGetVar('', "GLOBALS['xoopsModule']", 'mid', true);
340338
$ifGroups = $xc->getXcGetGroupIds('groupsIdsApprove', 'grouppermHandler', "'{$moduleDirname}_approve_{$tableName}'", $fId, $mId, "\t\t\t");
341339
$ifGroups .= $pc->getPhpCodeArrayType('groupsIdsApprove', 'values', 'groupsIdsApprove', null, false, "\t\t\t");
342-
$ifGroups .= $cc->getClassXoopsFormCheckBox('groupsCanApproveCheckbox', $permissionApprove, "groups_approve_{$tableName}[]", '$groupsIdsApprove', false, "\t\t\t");
340+
$ifGroups .= $cxc->getClassXoopsFormCheckBox('groupsCanApproveCheckbox', $permissionApprove, "groups_approve_{$tableName}[]", '$groupsIdsApprove', false, "\t\t\t");
343341
$ifGroups .= $xc->getXcGetGroupIds('groupsIdsSubmit', 'grouppermHandler', "'{$moduleDirname}_submit_{$tableName}'", $fId, $mId, "\t\t\t");
344342
$ifGroups .= $pc->getPhpCodeArrayType('groupsIdsSubmit', 'values', 'groupsIdsSubmit', null, false, "\t\t\t");
345-
$ifGroups .= $cc->getClassXoopsFormCheckBox('groupsCanSubmitCheckbox', $permissionSubmit, "groups_submit_{$tableName}[]", '$groupsIdsSubmit', false, "\t\t\t");
343+
$ifGroups .= $cxc->getClassXoopsFormCheckBox('groupsCanSubmitCheckbox', $permissionSubmit, "groups_submit_{$tableName}[]", '$groupsIdsSubmit', false, "\t\t\t");
346344
$ifGroups .= $xc->getXcGetGroupIds('groupsIdsView', 'grouppermHandler', "'{$moduleDirname}_view_{$tableName}'", $fId, $mId, "\t\t\t");
347345
$ifGroups .= $pc->getPhpCodeArrayType('groupsIdsView', 'values', 'groupsIdsView', null, false, "\t\t\t");
348-
$ifGroups .= $cc->getClassXoopsFormCheckBox('groupsCanViewCheckbox', $permissionView, "groups_view_{$tableName}[]", '$groupsIdsView', false, "\t\t\t");
346+
$ifGroups .= $cxc->getClassXoopsFormCheckBox('groupsCanViewCheckbox', $permissionView, "groups_view_{$tableName}[]", '$groupsIdsView', false, "\t\t\t");
349347

350-
$else = $cc->getClassXoopsFormCheckBox('groupsCanApproveCheckbox', $permissionApprove, "groups_approve_{$tableName}[]", '$fullList', false, "\t\t\t");
351-
$else .= $cc->getClassXoopsFormCheckBox('groupsCanSubmitCheckbox', $permissionSubmit, "groups_submit_{$tableName}[]", '$fullList', false, "\t\t\t");
352-
$else .= $cc->getClassXoopsFormCheckBox('groupsCanViewCheckbox', $permissionView, "groups_view_{$tableName}[]", '$fullList', false, "\t\t\t");
348+
$else = $cxc->getClassXoopsFormCheckBox('groupsCanApproveCheckbox', $permissionApprove, "groups_approve_{$tableName}[]", '$fullList', false, "\t\t\t");
349+
$else .= $cxc->getClassXoopsFormCheckBox('groupsCanSubmitCheckbox', $permissionSubmit, "groups_submit_{$tableName}[]", '$fullList', false, "\t\t\t");
350+
$else .= $cxc->getClassXoopsFormCheckBox('groupsCanViewCheckbox', $permissionView, "groups_view_{$tableName}[]", '$fullList', false, "\t\t\t");
353351

354352
$ret .= $pc->getPhpCodeConditions('!$this->isNew()', null, null, $ifGroups, $else, "\t\t");
355353
$ret .= $pc->getPhpCodeCommentLine('To Approve', '', "\t\t");
356-
$ret .= $cc->getClassAddOptionArray('groupsCanApproveCheckbox', '$groupList');
357-
$ret .= $cc->getClassAddElement('form', '$groupsCanApproveCheckbox');
354+
$ret .= $cxc->getClassAddOptionArray('groupsCanApproveCheckbox', '$groupList');
355+
$ret .= $cxc->getClassAddElement('form', '$groupsCanApproveCheckbox');
358356
$ret .= $pc->getPhpCodeCommentLine('To Submit', '', "\t\t");
359-
$ret .= $cc->getClassAddOptionArray('groupsCanSubmitCheckbox', '$groupList');
360-
$ret .= $cc->getClassAddElement('form', '$groupsCanSubmitCheckbox');
357+
$ret .= $cxc->getClassAddOptionArray('groupsCanSubmitCheckbox', '$groupList');
358+
$ret .= $cxc->getClassAddElement('form', '$groupsCanSubmitCheckbox');
361359
$ret .= $pc->getPhpCodeCommentLine('To View', '', "\t\t");
362-
$ret .= $cc->getClassAddOptionArray('groupsCanViewCheckbox', '$groupList');
363-
$ret .= $cc->getClassAddElement('form', '$groupsCanViewCheckbox');
360+
$ret .= $cxc->getClassAddOptionArray('groupsCanViewCheckbox', '$groupList');
361+
$ret .= $cxc->getClassAddElement('form', '$groupsCanViewCheckbox');
364362

365363
return $ret;
366364
}

0 commit comments

Comments
 (0)