@@ -1022,7 +1022,7 @@ |
||
| 1022 | 1022 | */ |
| 1023 | 1023 | private function getXoopsVersionNotificationCategory($language, $type, $name, $title, $from, $item, $allow) |
| 1024 | 1024 | { |
| 1025 | - $title = strtoupper($title);//{$from} |
|
| 1025 | + $title = strtoupper($title); //{$from} |
|
| 1026 | 1026 | $ret = " |
| 1027 | 1027 | \$modversion['notification']['{$type}'][] = array( |
| 1028 | 1028 | 'name' => '{$name}', |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * @param $module |
| 71 | 71 | * @param $tables |
| 72 | - * @param $filename |
|
| 72 | + * @param string $filename |
|
| 73 | 73 | */ |
| 74 | 74 | public function write($module, $tables, $filename) |
| 75 | 75 | { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param null |
| 147 | 147 | */ |
| 148 | 148 | /** |
| 149 | - * @return bool|string |
|
| 149 | + * @return null|string |
|
| 150 | 150 | */ |
| 151 | 151 | public function render() |
| 152 | 152 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param $module |
| 70 | 70 | * @param $table |
| 71 | 71 | * @param $tables |
| 72 | - * @param $filename |
|
| 72 | + * @param string $filename |
|
| 73 | 73 | */ |
| 74 | 74 | public function write($module, $tables, $filename) |
| 75 | 75 | { |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | * @param integer $menu |
| 132 | 132 | */ |
| 133 | 133 | /** |
| 134 | - * @param $language |
|
| 135 | - * @param $menu |
|
| 134 | + * @param string $language |
|
| 135 | + * @param integer $menu |
|
| 136 | 136 | * |
| 137 | 137 | * @return string |
| 138 | 138 | */ |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * @param null |
| 218 | 218 | */ |
| 219 | 219 | /** |
| 220 | - * @return bool|string |
|
| 220 | + * @return null|string |
|
| 221 | 221 | */ |
| 222 | 222 | public function render() |
| 223 | 223 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * @param $module |
| 71 | 71 | * @param $tables |
| 72 | - * @param $filename |
|
| 72 | + * @param string $filename |
|
| 73 | 73 | */ |
| 74 | 74 | public function write($module, $tables, $filename) |
| 75 | 75 | { |
@@ -85,6 +85,10 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @return string |
| 87 | 87 | */ |
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @param string $language |
|
| 91 | + */ |
|
| 88 | 92 | private function getPermissionsHeader($module, $language) |
| 89 | 93 | { |
| 90 | 94 | $moduleDirname = $module->getVar('mod_dirname'); |
@@ -117,6 +121,10 @@ discard block |
||
| 117 | 121 | * |
| 118 | 122 | * @return string |
| 119 | 123 | */ |
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * @param string $language |
|
| 127 | + */ |
|
| 120 | 128 | private function getPermissionsSwitch($moduleDirname, $language) |
| 121 | 129 | { |
| 122 | 130 | $cases = array('global' => array("\$formTitle = {$language}PERMISSIONS_GLOBAL;", |
@@ -145,7 +153,7 @@ discard block |
||
| 145 | 153 | */ |
| 146 | 154 | /** |
| 147 | 155 | * @param $module |
| 148 | - * @param $language |
|
| 156 | + * @param string $language |
|
| 149 | 157 | * |
| 150 | 158 | * @return string |
| 151 | 159 | */ |
@@ -200,7 +208,7 @@ discard block |
||
| 200 | 208 | * @param null |
| 201 | 209 | */ |
| 202 | 210 | /** |
| 203 | - * @return bool|string |
|
| 211 | + * @return null|string |
|
| 204 | 212 | */ |
| 205 | 213 | public function render() |
| 206 | 214 | { |
@@ -95,17 +95,17 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | $ret = $this->getInclude('header'); |
| 98 | - $ret .= $this->phpcode->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/xoopsform/grouppermform', true); |
|
| 98 | + $ret .= $this->phpcode->getPhpCodeIncludeDir('XOOPS_ROOT_PATH', 'class/xoopsform/grouppermform', true); |
|
| 99 | 99 | $ret .= $this->xoopscode->getXoopsHandlerLine($moduleDirname, $tableName); |
| 100 | - $ret .= $this->getCommentLine('Check admin have access to this page'); |
|
| 101 | - $ret .= $this->adminxoopscode->getAdminTemplateMain($moduleDirname, 'permissions'); |
|
| 102 | - $ret .= $this->xoopscode->getXoopsCodeTplAssign('navigation', "\$adminMenu->addNavigation('permissions.php')"); |
|
| 103 | - $ret .= $this->xoopscode->getXoopsCodeXoopsRequest('op', 'op', 'global'); |
|
| 104 | - $ret .= $this->xoopscode->getXoopsCodeLoad('XoopsFormLoader'); |
|
| 105 | - $optionsSelect = array('global' => "{$language}PERMISSIONS_GLOBAL", 'approve' => "{$language}PERMISSIONS_GLOBAL", |
|
| 106 | - 'submit' => "{$language}PERMISSIONS_GLOBAL", 'view' => "{$language}PERMISSIONS_GLOBAL"); |
|
| 107 | - $formSelect = $this->xoopscode->getXoopsFormSelect('formSelect', '\'\'', 'op', $optionsSelect, 'onchange="document.fselperm.submit()"'); |
|
| 108 | - $ret .= $this->xoopscode->getXoopsSimpleForm('permTableForm', 'formSelect', $formSelect, '\'\'', 'fselperm', 'permissions'); |
|
| 100 | + $ret .= $this->getCommentLine('Check admin have access to this page'); |
|
| 101 | + $ret .= $this->adminxoopscode->getAdminTemplateMain($moduleDirname, 'permissions'); |
|
| 102 | + $ret .= $this->xoopscode->getXoopsCodeTplAssign('navigation', "\$adminMenu->addNavigation('permissions.php')"); |
|
| 103 | + $ret .= $this->xoopscode->getXoopsCodeXoopsRequest('op', 'op', 'global'); |
|
| 104 | + $ret .= $this->xoopscode->getXoopsCodeLoad('XoopsFormLoader'); |
|
| 105 | + $optionsSelect = array('global' => "{$language}PERMISSIONS_GLOBAL", 'approve' => "{$language}PERMISSIONS_GLOBAL", |
|
| 106 | + 'submit' => "{$language}PERMISSIONS_GLOBAL", 'view' => "{$language}PERMISSIONS_GLOBAL"); |
|
| 107 | + $formSelect = $this->xoopscode->getXoopsFormSelect('formSelect', '\'\'', 'op', $optionsSelect, 'onchange="document.fselperm.submit()"'); |
|
| 108 | + $ret .= $this->xoopscode->getXoopsSimpleForm('permTableForm', 'formSelect', $formSelect, '\'\'', 'fselperm', 'permissions'); |
|
| 109 | 109 | |
| 110 | 110 | return $ret; |
| 111 | 111 | } |
@@ -119,23 +119,23 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | private function getPermissionsSwitch($moduleDirname, $language) |
| 121 | 121 | { |
| 122 | - $cases = array('global' => array("\$formTitle = {$language}PERMISSIONS_GLOBAL;", |
|
| 123 | - "\$permName = '{$moduleDirname}_ac';", |
|
| 124 | - "\$permDesc = {$language}PERMISSIONS_GLOBAL_DESC;", |
|
| 125 | - "\$globalPerms = array( '4' => {$language}PERMISSIONS_GLOBAL_4, '8' => {$language}PERMISSIONS_GLOBAL_8, '16' => {$language}PERMISSIONS_GLOBAL_16 );"), |
|
| 126 | - 'approve' => array("\$formTitle = {$language}PERMISSIONS_APPROVE;", |
|
| 127 | - "\$permName = '{$moduleDirname}_approve';", |
|
| 128 | - "\$permDesc = {$language}PERMISSIONS_APPROVE_DESC;"), |
|
| 129 | - 'submit' => array("\$formTitle = {$language}PERMISSIONS_SUBMIT;", |
|
| 130 | - "\$permName = '{$moduleDirname}_submit';", |
|
| 131 | - "\$permDesc = {$language}PERMISSIONS_SUBMIT_DESC;"), |
|
| 132 | - 'view' => array("\$formTitle = {$language}PERMISSIONS_VIEW;", |
|
| 133 | - "\$permName = '{$moduleDirname}_view';", |
|
| 134 | - "\$permDesc = {$language}PERMISSIONS_VIEW_DESC;")); |
|
| 122 | + $cases = array('global' => array("\$formTitle = {$language}PERMISSIONS_GLOBAL;", |
|
| 123 | + "\$permName = '{$moduleDirname}_ac';", |
|
| 124 | + "\$permDesc = {$language}PERMISSIONS_GLOBAL_DESC;", |
|
| 125 | + "\$globalPerms = array( '4' => {$language}PERMISSIONS_GLOBAL_4, '8' => {$language}PERMISSIONS_GLOBAL_8, '16' => {$language}PERMISSIONS_GLOBAL_16 );"), |
|
| 126 | + 'approve' => array("\$formTitle = {$language}PERMISSIONS_APPROVE;", |
|
| 127 | + "\$permName = '{$moduleDirname}_approve';", |
|
| 128 | + "\$permDesc = {$language}PERMISSIONS_APPROVE_DESC;"), |
|
| 129 | + 'submit' => array("\$formTitle = {$language}PERMISSIONS_SUBMIT;", |
|
| 130 | + "\$permName = '{$moduleDirname}_submit';", |
|
| 131 | + "\$permDesc = {$language}PERMISSIONS_SUBMIT_DESC;"), |
|
| 132 | + 'view' => array("\$formTitle = {$language}PERMISSIONS_VIEW;", |
|
| 133 | + "\$permName = '{$moduleDirname}_view';", |
|
| 134 | + "\$permDesc = {$language}PERMISSIONS_VIEW_DESC;")); |
|
| 135 | 135 | |
| 136 | - $contentSwitch = $this->phpcode->getPhpCodeCaseSwitch($cases, true); |
|
| 136 | + $contentSwitch = $this->phpcode->getPhpCodeCaseSwitch($cases, true); |
|
| 137 | 137 | |
| 138 | - return $this->phpcode->getPhpCodeSwitch('op', $contentSwitch); |
|
| 138 | + return $this->phpcode->getPhpCodeSwitch('op', $contentSwitch); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /* |
@@ -173,26 +173,26 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - $ret = $this->xoopscode->getXoopsCodeGetVar('moduleId', 'xoopsModule', 'mid'); |
|
| 177 | - $ret .= $this->xoopscode->getXoopsCodeGroupPermForm('permform', '$formTitle', '$moduleId', '$permName', '$permDesc', "'admin/permissions.php'"); |
|
| 178 | - $foreach1 = "\t".$this->xoopscode->getXoopsCodeAddItem('permform', '$gPermId', '$gPermName'); |
|
| 176 | + $ret = $this->xoopscode->getXoopsCodeGetVar('moduleId', 'xoopsModule', 'mid'); |
|
| 177 | + $ret .= $this->xoopscode->getXoopsCodeGroupPermForm('permform', '$formTitle', '$moduleId', '$permName', '$permDesc', "'admin/permissions.php'"); |
|
| 178 | + $foreach1 = "\t".$this->xoopscode->getXoopsCodeAddItem('permform', '$gPermId', '$gPermName'); |
|
| 179 | 179 | $if1 = $this->phpcode->getPhpCodeForeach('globalPerms', false, 'gPermId', 'gPermName', $foreach1); |
| 180 | - $if1 .= "\t".$this->xoopscode->getXoopsCodeTplAssign('form', '$permform->render()'); |
|
| 181 | - $else = $this->xoopscode->getXoopsCodeObjHandlerCount($tableName); |
|
| 182 | - $else .= $this->xoopscode->getXoopsCodeObjHandlerAll($tableName, $fieldMain); |
|
| 183 | - $getVar1 = $this->xoopscode->getXoopsCodeGetVar('', "{$tableName}All[\$i]", $fieldId, true); |
|
| 184 | - $getVar2 = $this->xoopscode->getXoopsCodeGetVar('', "{$tableName}All[\$i]", $fieldMain, true); |
|
| 185 | - $foreach2 = $this->xoopscode->getXoopsCodeAddItem('permform', $getVar1, $getVar2); |
|
| 186 | - $else .= $this->phpcode->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach2); |
|
| 187 | - $if2 = $this->xoopscode->getXoopsCodeTplAssign('form', '$permform->render()'); |
|
| 188 | - $elseInter = $this->xoopscode->getXoopsCodeRedirectHeader($tableName, '?op=new', '3', "{$language}NO_PERMISSIONS_SET"); |
|
| 189 | - $elseInter .= $this->getSimpleString("\texit();"); |
|
| 190 | - $else .= "\t".$this->phpcode->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $if2, $elseInter); |
|
| 180 | + $if1 .= "\t".$this->xoopscode->getXoopsCodeTplAssign('form', '$permform->render()'); |
|
| 181 | + $else = $this->xoopscode->getXoopsCodeObjHandlerCount($tableName); |
|
| 182 | + $else .= $this->xoopscode->getXoopsCodeObjHandlerAll($tableName, $fieldMain); |
|
| 183 | + $getVar1 = $this->xoopscode->getXoopsCodeGetVar('', "{$tableName}All[\$i]", $fieldId, true); |
|
| 184 | + $getVar2 = $this->xoopscode->getXoopsCodeGetVar('', "{$tableName}All[\$i]", $fieldMain, true); |
|
| 185 | + $foreach2 = $this->xoopscode->getXoopsCodeAddItem('permform', $getVar1, $getVar2); |
|
| 186 | + $else .= $this->phpcode->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach2); |
|
| 187 | + $if2 = $this->xoopscode->getXoopsCodeTplAssign('form', '$permform->render()'); |
|
| 188 | + $elseInter = $this->xoopscode->getXoopsCodeRedirectHeader($tableName, '?op=new', '3', "{$language}NO_PERMISSIONS_SET"); |
|
| 189 | + $elseInter .= $this->getSimpleString("\texit();"); |
|
| 190 | + $else .= "\t".$this->phpcode->getPhpCodeConditions("\${$tableName}Count", ' > ', '0', $if2, $elseInter); |
|
| 191 | 191 | |
| 192 | - $ret .= "\t".$this->phpcode->getPhpCodeConditions('$op', ' == ', "'global'", $if1, $else); |
|
| 193 | - $ret .= $this->phpcode->getPhpCodeUnset('permform'); |
|
| 192 | + $ret .= "\t".$this->phpcode->getPhpCodeConditions('$op', ' == ', "'global'", $if1, $else); |
|
| 193 | + $ret .= $this->phpcode->getPhpCodeUnset('permform'); |
|
| 194 | 194 | |
| 195 | - return $ret; |
|
| 195 | + return $ret; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /* |
@@ -183,7 +183,7 @@ |
||
| 183 | 183 | $getVar1 = $this->xoopscode->getXoopsCodeGetVar('', "{$tableName}All[\$i]", $fieldId, true); |
| 184 | 184 | $getVar2 = $this->xoopscode->getXoopsCodeGetVar('', "{$tableName}All[\$i]", $fieldMain, true); |
| 185 | 185 | $foreach2 = $this->xoopscode->getXoopsCodeAddItem('permform', $getVar1, $getVar2); |
| 186 | - $else .= $this->phpcode->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach2); |
|
| 186 | + $else .= $this->phpcode->getPhpCodeForeach("{$tableName}All", true, false, 'i', $foreach2); |
|
| 187 | 187 | $if2 = $this->xoopscode->getXoopsCodeTplAssign('form', '$permform->render()'); |
| 188 | 188 | $elseInter = $this->xoopscode->getXoopsCodeRedirectHeader($tableName, '?op=new', '3', "{$language}NO_PERMISSIONS_SET"); |
| 189 | 189 | $elseInter .= $this->getSimpleString("\texit();"); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | public function getPhpCodeForeach($array = '', $arrayKey = false, $key = false, $value = false, $content = '') |
| 186 | 186 | { |
| 187 | 187 | $vars = ''; |
| 188 | - if ((false === $arrayKey) && (false === $key)) { |
|
| 188 | + if ((false === $arrayKey) && (false === $key)) { |
|
| 189 | 189 | $vars = "\${$array} as \${$value}"; |
| 190 | 190 | } elseif ((false === $arrayKey) && (false !== $key)) { |
| 191 | 191 | $vars = "\${$array} as \${$key} => \${$value}"; |
@@ -266,35 +266,35 @@ discard block |
||
| 266 | 266 | /** |
| 267 | 267 | * @public function getPhpCodeCaseSwitch |
| 268 | 268 | * @param $cases |
| 269 | - * @param $defaultAfterCase |
|
| 270 | - * @param $default |
|
| 269 | + * @param $defaultAfterCase |
|
| 270 | + * @param $default |
|
| 271 | 271 | * |
| 272 | 272 | * @return string |
| 273 | 273 | */ |
| 274 | 274 | public function getPhpCodeCaseSwitch($cases = array(), $defaultAfterCase = false, $default = false) |
| 275 | 275 | { |
| 276 | 276 | $ret = ''; |
| 277 | - $def = "\tdefault:\n"; |
|
| 277 | + $def = "\tdefault:\n"; |
|
| 278 | 278 | foreach($cases as $case => $value) { |
| 279 | - $case = is_string($case) ? "'{$case}'" : $case; |
|
| 280 | - if (!empty($case)) { |
|
| 281 | - $ret .= "\tcase {$case}:\n"; |
|
| 282 | - if($defaultAfterCase != false){ |
|
| 283 | - $ret .= $def; |
|
| 284 | - } |
|
| 285 | - if (is_array($value)) { |
|
| 286 | - foreach($value as $content) { |
|
| 287 | - $ret .= "\t\t{$content}\n"; |
|
| 288 | - } |
|
| 289 | - } |
|
| 290 | - $ret .= "\tbreak;\n"; |
|
| 291 | - } |
|
| 292 | - $defaultAfterCase = false; |
|
| 293 | - } |
|
| 279 | + $case = is_string($case) ? "'{$case}'" : $case; |
|
| 280 | + if (!empty($case)) { |
|
| 281 | + $ret .= "\tcase {$case}:\n"; |
|
| 282 | + if($defaultAfterCase != false){ |
|
| 283 | + $ret .= $def; |
|
| 284 | + } |
|
| 285 | + if (is_array($value)) { |
|
| 286 | + foreach($value as $content) { |
|
| 287 | + $ret .= "\t\t{$content}\n"; |
|
| 288 | + } |
|
| 289 | + } |
|
| 290 | + $ret .= "\tbreak;\n"; |
|
| 291 | + } |
|
| 292 | + $defaultAfterCase = false; |
|
| 293 | + } |
|
| 294 | 294 | if ($default !== false) { |
| 295 | 295 | $ret .= $def; |
| 296 | - $ret .= "\t\t{$default}\n"; |
|
| 297 | - $ret .= "\tbreak;\n"; |
|
| 296 | + $ret .= "\t\t{$default}\n"; |
|
| 297 | + $ret .= "\tbreak;\n"; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | return $ret; |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | return "isset(\${$var})"; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - /* |
|
| 313 | + /* |
|
| 314 | 314 | * @public function getPhpCodeUnset |
| 315 | 315 | * @param $var |
| 316 | 316 | * @return string |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | return "rawurlencode({$var})"; |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - /* |
|
| 375 | + /* |
|
| 376 | 376 | * @public function getPhpCodePregReplace |
| 377 | 377 | * @param $return |
| 378 | 378 | * @param $exp |
@@ -384,15 +384,15 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | public function getPhpCodePregReplace($return, $exp, $str, $val, $isParam = false) |
| 386 | 386 | { |
| 387 | - if ($isParam === false) { |
|
| 388 | - $ret = "\${$return} = preg_replace( '{$exp}' , '{$str}' , {$val});\n"; |
|
| 389 | - } else { |
|
| 390 | - $ret = "preg_replace( '{$exp}' , '{$str}' , {$val})"; |
|
| 391 | - } |
|
| 392 | - return $ret; |
|
| 387 | + if ($isParam === false) { |
|
| 388 | + $ret = "\${$return} = preg_replace( '{$exp}' , '{$str}' , {$val});\n"; |
|
| 389 | + } else { |
|
| 390 | + $ret = "preg_replace( '{$exp}' , '{$str}' , {$val})"; |
|
| 391 | + } |
|
| 392 | + return $ret; |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - /* |
|
| 395 | + /* |
|
| 396 | 396 | * @public function getPhpCodeStrReplace |
| 397 | 397 | * @param $left |
| 398 | 398 | * @param $var |
@@ -405,14 +405,14 @@ discard block |
||
| 405 | 405 | public function getPhpCodeStrReplace($left, $var, $str, $value, $isParam = false) |
| 406 | 406 | { |
| 407 | 407 | if ($isParam === false) { |
| 408 | - $ret = "\${$left} = str_replace( '{$var}' , '{$str}' , {$value});\n"; |
|
| 409 | - } else { |
|
| 410 | - $ret = "str_replace( '{$var}' , '{$str}' , {$value})"; |
|
| 411 | - } |
|
| 412 | - return $ret; |
|
| 408 | + $ret = "\${$left} = str_replace( '{$var}' , '{$str}' , {$value});\n"; |
|
| 409 | + } else { |
|
| 410 | + $ret = "str_replace( '{$var}' , '{$str}' , {$value})"; |
|
| 411 | + } |
|
| 412 | + return $ret; |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - /* |
|
| 415 | + /* |
|
| 416 | 416 | * @public function getPhpCodeStripTags |
| 417 | 417 | * @param $left |
| 418 | 418 | * @param $value |
@@ -423,11 +423,11 @@ discard block |
||
| 423 | 423 | public function getPhpCodeStripTags($left, $value, $isParam = false) |
| 424 | 424 | { |
| 425 | 425 | if ($isParam === false) { |
| 426 | - $ret = "\${$left} = strip_tags({$value});\n"; |
|
| 427 | - } else { |
|
| 428 | - $ret = "strip_tags({$value})"; |
|
| 429 | - } |
|
| 430 | - return $ret; |
|
| 426 | + $ret = "\${$left} = strip_tags({$value});\n"; |
|
| 427 | + } else { |
|
| 428 | + $ret = "strip_tags({$value})"; |
|
| 429 | + } |
|
| 430 | + return $ret; |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | /* |
@@ -275,15 +275,15 @@ |
||
| 275 | 275 | { |
| 276 | 276 | $ret = ''; |
| 277 | 277 | $def = "\tdefault:\n"; |
| 278 | - foreach($cases as $case => $value) { |
|
| 278 | + foreach ($cases as $case => $value) { |
|
| 279 | 279 | $case = is_string($case) ? "'{$case}'" : $case; |
| 280 | 280 | if (!empty($case)) { |
| 281 | 281 | $ret .= "\tcase {$case}:\n"; |
| 282 | - if($defaultAfterCase != false){ |
|
| 282 | + if ($defaultAfterCase != false) { |
|
| 283 | 283 | $ret .= $def; |
| 284 | 284 | } |
| 285 | 285 | if (is_array($value)) { |
| 286 | - foreach($value as $content) { |
|
| 286 | + foreach ($value as $content) { |
|
| 287 | 287 | $ret .= "\t\t{$content}\n"; |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | return $ret; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - /* |
|
| 82 | + /* |
|
| 83 | 83 | * @private function getXoopsCodeSwitch |
| 84 | 84 | * @param $op |
| 85 | 85 | * @param $listCases |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function getXoopsCodeSwitch($op = 'op', $listCases = array(), $defaultList = false) |
| 91 | 91 | { |
| 92 | - $switch = $this->phpcode->getPhpCodeCaseSwitch(array($listCases), $defaultList); |
|
| 92 | + $switch = $this->phpcode->getPhpCodeCaseSwitch(array($listCases), $defaultList); |
|
| 93 | 93 | |
| 94 | - return $this->phpcode->getPhpCodeSwitch($op, $switch); |
|
| 94 | + return $this->phpcode->getPhpCodeSwitch($op, $switch); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /* |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | return "xoops_load('{$var}');\n"; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - /** |
|
| 129 | + /** |
|
| 130 | 130 | * @public function getXoopsCodeLoadLanguage |
| 131 | 131 | * |
| 132 | 132 | * @param $lang |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | return "\${$tableName}Obj->setVar('{$fieldName}', {$var});\n"; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - /* |
|
| 153 | + /* |
|
| 154 | 154 | * @public function getXoopsCodeGetVar |
| 155 | 155 | * @param string $varLeft |
| 156 | 156 | * @param string $handle |
@@ -162,15 +162,15 @@ discard block |
||
| 162 | 162 | public function getXoopsCodeGetVar($varLeft = '', $handle = '', $var = '', $isParam = false) |
| 163 | 163 | { |
| 164 | 164 | if($isParam === false) { |
| 165 | - $ret = "\${$varLeft} = \${$handle}->getVar('{$var}');\n"; |
|
| 166 | - } else { |
|
| 167 | - $ret = "\${$handle}->getVar('{$var}')"; |
|
| 168 | - } |
|
| 165 | + $ret = "\${$varLeft} = \${$handle}->getVar('{$var}');\n"; |
|
| 166 | + } else { |
|
| 167 | + $ret = "\${$handle}->getVar('{$var}')"; |
|
| 168 | + } |
|
| 169 | 169 | |
| 170 | - return $ret; |
|
| 170 | + return $ret; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - /* |
|
| 173 | + /* |
|
| 174 | 174 | * @public function getXoopsCodeGroupPermForm |
| 175 | 175 | * @param string $varLeft |
| 176 | 176 | * @param string $formTitle |
@@ -183,10 +183,10 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public function getXoopsCodeGroupPermForm($varLeft = '', $formTitle = '', $moduleId = '', $permName = '', $permDesc = '', $filename = '') |
| 185 | 185 | { |
| 186 | - return "\${$varLeft} = new XoopsGroupPermForm({$formTitle}, {$moduleId}, {$permName}, {$permDesc}, {$filename});\n"; |
|
| 186 | + return "\${$varLeft} = new XoopsGroupPermForm({$formTitle}, {$moduleId}, {$permName}, {$permDesc}, {$filename});\n"; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - /* |
|
| 189 | + /* |
|
| 190 | 190 | * @public function getXoopsCodeAddItem |
| 191 | 191 | * @param string $varLeft |
| 192 | 192 | * @param string $paramLeft |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function getXoopsCodeAddItem($varLeft = '', $paramLeft = '', $paramRight = '') |
| 198 | 198 | { |
| 199 | - return "\${$varLeft}->addItem({$paramLeft}, {$paramRight});\n"; |
|
| 199 | + return "\${$varLeft}->addItem({$paramLeft}, {$paramRight});\n"; |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /* |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | return "\${$lpFieldName}['{$rpFieldName}'] = \${$tableName}All[\$i]->getVar('{$fieldName}');\n"; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - /* |
|
| 260 | + /* |
|
| 261 | 261 | * @public function getXoopsHandlerLine |
| 262 | 262 | * @param $moduleDirname |
| 263 | 263 | * @param $tableName |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | return "\${$tableName}Handler =& \${$moduleDirname}->getHandler('{$tableName}');\n"; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - /* |
|
| 271 | + /* |
|
| 272 | 272 | * @public function getXoopsSimpleForm |
| 273 | 273 | * @param $left |
| 274 | 274 | * @param $element |
@@ -283,16 +283,16 @@ discard block |
||
| 283 | 283 | public function getXoopsSimpleForm($left = '', $element = '', $elementsContent = '', $caption = '', $var = '', $filename = '', $type = 'post') |
| 284 | 284 | { |
| 285 | 285 | $ret = "\${$left} = new XoopsSimpleForm({$caption}, '{$var}', '{$filename}.php', '{$type}');\n"; |
| 286 | - if(!empty($elementsContent)) { |
|
| 287 | - $ret .= "{$elementsContent}"; |
|
| 288 | - } |
|
| 289 | - $ret .= "\${$left}->addElement(\${$element})\n"; |
|
| 290 | - $ret .= "\${$left}->display();\n"; |
|
| 286 | + if(!empty($elementsContent)) { |
|
| 287 | + $ret .= "{$elementsContent}"; |
|
| 288 | + } |
|
| 289 | + $ret .= "\${$left}->addElement(\${$element})\n"; |
|
| 290 | + $ret .= "\${$left}->display();\n"; |
|
| 291 | 291 | |
| 292 | - return $ret; |
|
| 292 | + return $ret; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - /* |
|
| 295 | + /* |
|
| 296 | 296 | * @public function getXoopsFormSelect |
| 297 | 297 | * @param $varSelect |
| 298 | 298 | * @param $caption |
@@ -302,17 +302,17 @@ discard block |
||
| 302 | 302 | * |
| 303 | 303 | * @return string |
| 304 | 304 | */ |
| 305 | - public function getXoopsFormSelect($varSelect = '', $caption = '', $var = '', $options = array(), $setExtra = true) |
|
| 305 | + public function getXoopsFormSelect($varSelect = '', $caption = '', $var = '', $options = array(), $setExtra = true) |
|
| 306 | 306 | { |
| 307 | 307 | $ret = "\${$varSelect} = new XoopsFormSelect({$caption}, '{$var}', \${$var});\n"; |
| 308 | - if(false !== $setExtra) { |
|
| 309 | - $ret .= "\${$varSelect}->setExtra('{$setExtra}');\n"; |
|
| 310 | - } |
|
| 311 | - foreach($options as $key => $value) { |
|
| 312 | - $ret .= "\${$varSelect}->addOption('{$key}', {$value});\n"; |
|
| 313 | - } |
|
| 308 | + if(false !== $setExtra) { |
|
| 309 | + $ret .= "\${$varSelect}->setExtra('{$setExtra}');\n"; |
|
| 310 | + } |
|
| 311 | + foreach($options as $key => $value) { |
|
| 312 | + $ret .= "\${$varSelect}->addOption('{$key}', {$value});\n"; |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - return $ret; |
|
| 315 | + return $ret; |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /* |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | return $ret; |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | - /** |
|
| 694 | + /** |
|
| 695 | 695 | * @public function getXoopsCodeObjHandlerCount |
| 696 | 696 | * |
| 697 | 697 | * @param string $tableName |
@@ -701,23 +701,23 @@ discard block |
||
| 701 | 701 | public function getXoopsCodeObjHandlerCount($tableName) |
| 702 | 702 | { |
| 703 | 703 | $ucfTableName = ucfirst($tableName); |
| 704 | - $ret = "\${$tableName}Count = \${$tableName}Handler->getCount{$ucfTableName}();\n"; |
|
| 704 | + $ret = "\${$tableName}Count = \${$tableName}Handler->getCount{$ucfTableName}();\n"; |
|
| 705 | 705 | |
| 706 | 706 | return $ret; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - /** |
|
| 709 | + /** |
|
| 710 | 710 | * @public function getXoopsCodeObjHandlerAll |
| 711 | 711 | * |
| 712 | 712 | * @param string $tableName |
| 713 | - * @param string $fieldMain |
|
| 713 | + * @param string $fieldMain |
|
| 714 | 714 | * |
| 715 | 715 | * @return string |
| 716 | 716 | */ |
| 717 | 717 | public function getXoopsCodeObjHandlerAll($tableName, $fieldMain) |
| 718 | 718 | { |
| 719 | 719 | $ucfTableName = ucfirst($tableName); |
| 720 | - $ret = "\${$tableName}All = \${$tableName}Handler->getAll{$ucfTableName}(0, 0, '{$fieldMain}');\n"; |
|
| 720 | + $ret = "\${$tableName}All = \${$tableName}Handler->getAll{$ucfTableName}(0, 0, '{$fieldMain}');\n"; |
|
| 721 | 721 | |
| 722 | 722 | return $ret; |
| 723 | 723 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function getXoopsCodeGetVar($varLeft = '', $handle = '', $var = '', $isParam = false) |
| 163 | 163 | { |
| 164 | - if($isParam === false) { |
|
| 164 | + if ($isParam === false) { |
|
| 165 | 165 | $ret = "\${$varLeft} = \${$handle}->getVar('{$var}');\n"; |
| 166 | 166 | } else { |
| 167 | 167 | $ret = "\${$handle}->getVar('{$var}')"; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | public function getXoopsSimpleForm($left = '', $element = '', $elementsContent = '', $caption = '', $var = '', $filename = '', $type = 'post') |
| 284 | 284 | { |
| 285 | 285 | $ret = "\${$left} = new XoopsSimpleForm({$caption}, '{$var}', '{$filename}.php', '{$type}');\n"; |
| 286 | - if(!empty($elementsContent)) { |
|
| 286 | + if (!empty($elementsContent)) { |
|
| 287 | 287 | $ret .= "{$elementsContent}"; |
| 288 | 288 | } |
| 289 | 289 | $ret .= "\${$left}->addElement(\${$element})\n"; |
@@ -305,10 +305,10 @@ discard block |
||
| 305 | 305 | public function getXoopsFormSelect($varSelect = '', $caption = '', $var = '', $options = array(), $setExtra = true) |
| 306 | 306 | { |
| 307 | 307 | $ret = "\${$varSelect} = new XoopsFormSelect({$caption}, '{$var}', \${$var});\n"; |
| 308 | - if(false !== $setExtra) { |
|
| 308 | + if (false !== $setExtra) { |
|
| 309 | 309 | $ret .= "\${$varSelect}->setExtra('{$setExtra}');\n"; |
| 310 | 310 | } |
| 311 | - foreach($options as $key => $value) { |
|
| 311 | + foreach ($options as $key => $value) { |
|
| 312 | 312 | $ret .= "\${$varSelect}->addOption('{$key}', {$value});\n"; |
| 313 | 313 | } |
| 314 | 314 | |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | $ret .= $this->xoopscode->getXoopsCodeEqualsOperator("\${$ccFieldId}", "XoopsRequest::getInt('{$fieldId}')"); |
| 95 | 95 | |
| 96 | 96 | |
| 97 | - // This must be removed |
|
| 98 | - $ret .= $this->getCommentLine('Switch options'); |
|
| 99 | - $ret .= $this->getSimpleString('switch($op)'); |
|
| 97 | + // This must be removed |
|
| 98 | + $ret .= $this->getCommentLine('Switch options'); |
|
| 99 | + $ret .= $this->getSimpleString('switch($op)'); |
|
| 100 | 100 | $ret .= $this->getSimpleString('{'); |
| 101 | 101 | |
| 102 | 102 | return $ret; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - /* |
|
| 105 | + /* |
|
| 106 | 106 | * @private function getAdminPagesSwitch |
| 107 | 107 | * @param $moduleDirname |
| 108 | 108 | * @param $language |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | private function getAdminPagesSwitch($moduleDirname, $language) |
| 113 | 113 | { |
| 114 | - $cases = array('list' => array(), 'new' => array(), 'save' => array(), 'edit' => array(), 'update' => array()); |
|
| 114 | + $cases = array('list' => array(), 'new' => array(), 'save' => array(), 'edit' => array(), 'update' => array()); |
|
| 115 | 115 | |
| 116 | - $contentSwitch = $this->phpcode->getPhpCodeCaseSwitch($cases, true); |
|
| 116 | + $contentSwitch = $this->phpcode->getPhpCodeCaseSwitch($cases, true); |
|
| 117 | 117 | |
| 118 | - return $this->phpcode->getPhpCodeSwitch('op', $contentSwitch); |
|
| 118 | + return $this->phpcode->getPhpCodeSwitch('op', $contentSwitch); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /* |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | */ |
| 112 | 112 | private function getAdminPagesSwitch($moduleDirname, $language) |
| 113 | 113 | { |
| 114 | - $cases = array('list' => array(), 'new' => array(), 'save' => array(), 'edit' => array(), 'update' => array()); |
|
| 114 | + $cases = array('list' => array(), 'new' => array(), 'save' => array(), 'edit' => array(), 'update' => array()); |
|
| 115 | 115 | |
| 116 | 116 | $contentSwitch = $this->phpcode->getPhpCodeCaseSwitch($cases, true); |
| 117 | 117 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * @param $module |
| 71 | 71 | * @param $tables |
| 72 | - * @param $filename |
|
| 72 | + * @param string $filename |
|
| 73 | 73 | */ |
| 74 | 74 | public function write($module, $tables, $filename) |
| 75 | 75 | { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param null |
| 147 | 147 | */ |
| 148 | 148 | /** |
| 149 | - * @return bool|string |
|
| 149 | + * @return null|string |
|
| 150 | 150 | */ |
| 151 | 151 | public function render() |
| 152 | 152 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * @param $module |
| 71 | 71 | * @param $tables |
| 72 | - * @param $filename |
|
| 72 | + * @param string $filename |
|
| 73 | 73 | */ |
| 74 | 74 | public function write($module, $tables, $filename) |
| 75 | 75 | { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param null |
| 147 | 147 | */ |
| 148 | 148 | /** |
| 149 | - * @return bool|string |
|
| 149 | + * @return null|string |
|
| 150 | 150 | */ |
| 151 | 151 | public function render() |
| 152 | 152 | { |