Total Complexity | 91 |
Total Lines | 1173 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like UserXoopsVersion often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use UserXoopsVersion, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
32 | class UserXoopsVersion extends Files\CreateFile |
||
33 | { |
||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | private $kw = []; |
||
38 | |||
39 | /** |
||
40 | * @var mixed |
||
41 | */ |
||
42 | private $uxc = null; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | private $xc = null; |
||
48 | |||
49 | /** |
||
50 | * @var string |
||
51 | */ |
||
52 | private $pc = null; |
||
53 | |||
54 | /** |
||
55 | * @public function constructor |
||
56 | * @param null |
||
57 | */ |
||
58 | public function __construct() |
||
59 | { |
||
60 | parent::__construct(); |
||
61 | $this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); |
||
|
|||
62 | $this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); |
||
63 | $this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @static function getInstance |
||
68 | * @param null |
||
69 | * @return UserXoopsVersion |
||
70 | */ |
||
71 | public static function getInstance() |
||
72 | { |
||
73 | static $instance = false; |
||
74 | if (!$instance) { |
||
75 | $instance = new self(); |
||
76 | } |
||
77 | |||
78 | return $instance; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * @public function write |
||
83 | * @param $module |
||
84 | * @param mixed $table |
||
85 | * @param mixed $tables |
||
86 | * @param $filename |
||
87 | */ |
||
88 | public function write($module, $table, $tables, $filename) |
||
89 | { |
||
90 | $this->setModule($module); |
||
91 | $this->setTable($table); |
||
92 | $this->setTables($tables); |
||
93 | $this->setFileName($filename); |
||
94 | foreach (array_keys($tables) as $t) { |
||
95 | $tableName = $tables[$t]->getVar('table_name'); |
||
96 | $this->setKeywords($tableName); |
||
97 | } |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * @public function setKeywords |
||
102 | * @param mixed $keywords |
||
103 | */ |
||
104 | public function setKeywords($keywords) |
||
105 | { |
||
106 | if (is_array($keywords)) { |
||
107 | $this->kw = $keywords; |
||
108 | } else { |
||
109 | $this->kw[] = $keywords; |
||
110 | } |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * @public function getKeywords |
||
115 | * @param null |
||
116 | * @return array |
||
117 | */ |
||
118 | public function getKeywords() |
||
119 | { |
||
120 | return $this->kw; |
||
121 | } |
||
122 | |||
123 | /** |
||
124 | * @private function getXoopsVersionHeader |
||
125 | * @param $module |
||
126 | * @param $language |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | private function getXoopsVersionHeader($module, $language) |
||
131 | { |
||
132 | $date = date('Y/m/d'); |
||
133 | $ret = $this->getSimpleString(''); |
||
134 | $ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine(); |
||
135 | $ret .= $this->xc->getXcEqualsOperator('$moduleDirName ', 'basename(__DIR__)'); |
||
136 | $ret .= $this->xc->getXcEqualsOperator('$moduleDirNameUpper', 'mb_strtoupper($moduleDirName)'); |
||
137 | $ret .= $this->getDashComment('Informations'); |
||
138 | $ha = (1 == $module->getVar('mod_admin')) ? 1 : 0; |
||
139 | $hm = (1 == $module->getVar('mod_user')) ? 1 : 0; |
||
140 | |||
141 | $descriptions = [ |
||
142 | 'name' => "{$language}NAME", |
||
143 | 'version' => (string)$module->getVar('mod_version'), |
||
144 | 'description' => "{$language}DESC", |
||
145 | 'author' => "'{$module->getVar('mod_author')}'", |
||
146 | 'author_mail' => "'{$module->getVar('mod_author_mail')}'", |
||
147 | 'author_website_url' => "'{$module->getVar('mod_author_website_url')}'", |
||
148 | 'author_website_name' => "'{$module->getVar('mod_author_website_name')}'", |
||
149 | 'credits' => "'{$module->getVar('mod_credits')}'", |
||
150 | 'license' => "'{$module->getVar('mod_license')}'", |
||
151 | 'license_url' => "'http://www.gnu.org/licenses/gpl-3.0.en.html'", |
||
152 | 'help' => "'page=help'", |
||
153 | 'release_info' => "'{$module->getVar('mod_release_info')}'", |
||
154 | 'release_file' => "XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_release_file')}'", |
||
155 | 'release_date' => "'{$date}'", |
||
156 | 'manual' => "'{$module->getVar('mod_manual')}'", |
||
157 | 'manual_file' => "XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_manual_file')}'", |
||
158 | 'min_php' => "'{$module->getVar('mod_min_php')}'", |
||
159 | 'min_xoops' => "'{$module->getVar('mod_min_xoops')}'", |
||
160 | 'min_admin' => "'{$module->getVar('mod_min_admin')}'", |
||
161 | 'min_db' => "array('mysql' => '{$module->getVar('mod_min_mysql')}', 'mysqli' => '{$module->getVar('mod_min_mysql')}')", |
||
162 | 'image' => "'assets/images/logoModule.png'", |
||
163 | 'dirname' => 'basename(__DIR__)', |
||
164 | 'dirmoduleadmin' => "'Frameworks/moduleclasses/moduleadmin'", |
||
165 | 'sysicons16' => "'../../Frameworks/moduleclasses/icons/16'", |
||
166 | 'sysicons32' => "'../../Frameworks/moduleclasses/icons/32'", |
||
167 | 'modicons16' => "'assets/icons/16'", |
||
168 | 'modicons32' => "'assets/icons/32'", |
||
169 | 'demo_site_url' => "'{$module->getVar('mod_demo_site_url')}'", |
||
170 | 'demo_site_name' => "'{$module->getVar('mod_demo_site_name')}'", |
||
171 | 'support_url' => "'{$module->getVar('mod_support_url')}'", |
||
172 | 'support_name' => "'{$module->getVar('mod_support_name')}'", |
||
173 | 'module_website_url' => "'{$module->getVar('mod_website_url')}'", |
||
174 | 'module_website_name' => "'{$module->getVar('mod_website_name')}'", |
||
175 | 'release' => "'{$module->getVar('mod_release')}'", |
||
176 | 'module_status' => "'{$module->getVar('mod_status')}'", |
||
177 | 'system_menu' => '1', |
||
178 | 'hasAdmin' => $ha, |
||
179 | 'hasMain' => $hm, |
||
180 | 'adminindex' => "'admin/index.php'", |
||
181 | 'adminmenu' => "'admin/menu.php'", |
||
182 | 'onInstall' => "'include/install.php'", |
||
183 | 'onUninstall' => "'include/uninstall.php'", |
||
184 | 'onUpdate' => "'include/update.php'", |
||
185 | ]; |
||
186 | |||
187 | $ret .= $this->uxc->getUserModVersionArray(0, $descriptions); |
||
188 | |||
189 | return $ret; |
||
190 | } |
||
191 | |||
192 | /** |
||
193 | * @private function getXoopsVersionMySQL |
||
194 | * @param $moduleDirname |
||
195 | * @param $table |
||
196 | * @param $tables |
||
197 | * @return string |
||
198 | */ |
||
199 | private function getXoopsVersionMySQL($moduleDirname, $table, $tables) |
||
200 | { |
||
201 | $tableName = $table->getVar('table_name'); |
||
202 | $n = 1; |
||
203 | $ret = ''; |
||
204 | $items = []; |
||
205 | if (!empty($tableName)) { |
||
206 | $ret .= $this->getDashComment('Mysql'); |
||
207 | $description = "'sql/mysql.sql'"; |
||
208 | $ret .= $this->uxc->getUserModVersionText(2, $description, 'sqlfile', "'mysql'"); |
||
209 | $ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Tables'); |
||
210 | |||
211 | foreach (array_keys($tables) as $t) { |
||
212 | $items[] = "'{$moduleDirname}_{$tables[$t]->getVar('table_name')}'"; |
||
213 | ++$n; |
||
214 | } |
||
215 | $ret .= $this->uxc->getUserModVersionArray(11, $items, 'tables', $n); |
||
216 | unset($n); |
||
217 | } |
||
218 | |||
219 | return $ret; |
||
220 | } |
||
221 | |||
222 | /** |
||
223 | * @private function getXoopsVersionSearch |
||
224 | * @param $moduleDirname |
||
225 | * |
||
226 | * @return string |
||
227 | */ |
||
228 | private function getXoopsVersionSearch($moduleDirname) |
||
236 | } |
||
237 | |||
238 | /** |
||
239 | * @private function getXoopsVersionComments |
||
240 | * @param $moduleDirname |
||
241 | * |
||
242 | * @param $tables |
||
243 | * @return string |
||
244 | */ |
||
245 | private function getXoopsVersionComments($moduleDirname, $tables) |
||
246 | { |
||
247 | $tableName = ''; |
||
248 | $fieldId = ''; |
||
249 | foreach (array_keys($tables) as $t) { |
||
250 | if (1 == $tables[$t]->getVar('table_comments')) { |
||
251 | $tableName = $tables[$t]->getVar('table_name'); |
||
252 | $fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id')); |
||
253 | foreach (array_keys($fields) as $f) { |
||
254 | $fieldName = $fields[$f]->getVar('field_name'); |
||
255 | if (0 == $f) { |
||
256 | $fieldId = $fieldName; |
||
257 | } |
||
258 | } |
||
259 | } |
||
260 | } |
||
261 | $ret = $this->getDashComment('Comments'); |
||
262 | $ret .= $this->uxc->getUserModVersionText(1, "1", 'hasComments'); |
||
263 | $ret .= $this->uxc->getUserModVersionText(2, "'{$tableName}.php'", 'comments', "'pageName'"); |
||
264 | $ret .= $this->uxc->getUserModVersionText(2, "'{$fieldId}'", 'comments', "'itemName'"); |
||
265 | $ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Comment callback functions'); |
||
266 | $ret .= $this->uxc->getUserModVersionText(2, "'include/comment_functions.php'", 'comments', "'callbackFile'"); |
||
267 | $descriptions = ['approve' => "'{$moduleDirname}CommentsApprove'", 'update' => "'{$moduleDirname}CommentsUpdate'"]; |
||
268 | $ret .= $this->uxc->getUserModVersionArray(2, $descriptions, 'comments', "'callback'"); |
||
269 | |||
270 | return $ret; |
||
271 | } |
||
272 | |||
273 | /** |
||
274 | * @private function getXoopsVersionTemplatesAdminUser |
||
275 | * @param $moduleDirname |
||
276 | * @param $tables |
||
277 | * |
||
278 | * @param $admin |
||
279 | * @param $user |
||
280 | * @return string |
||
281 | */ |
||
282 | private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $admin, $user) |
||
359 | } |
||
360 | |||
361 | /** |
||
362 | * @private function getXoopsVersionTemplatesLine |
||
363 | * @param $moduleDirname |
||
364 | * @param $type |
||
365 | * @param string $extra |
||
366 | * @param bool $isAdmin |
||
367 | * @return string |
||
368 | */ |
||
369 | private function getXoopsVersionTemplatesLine($moduleDirname, $type, $extra = '', $isAdmin = false) |
||
370 | { |
||
371 | $ret = ''; |
||
372 | $desc = "'description' => ''"; |
||
373 | $arrayFile = "['file' =>"; |
||
374 | if ($isAdmin) { |
||
375 | $ret .= "{$arrayFile} '{$moduleDirname}_admin_{$type}.tpl', {$desc}, 'type' => 'admin']"; |
||
376 | } else { |
||
377 | if ('' !== $extra) { |
||
378 | $ret .= "{$arrayFile} '{$moduleDirname}_{$type}_{$extra}.tpl', {$desc}]"; |
||
379 | } else { |
||
380 | $ret .= "{$arrayFile} '{$moduleDirname}_{$type}.tpl', {$desc}]"; |
||
381 | } |
||
382 | } |
||
383 | |||
384 | return $ret; |
||
385 | } |
||
386 | |||
387 | /** |
||
388 | * @private function getXoopsVersionSubmenu |
||
389 | * @param $language |
||
390 | * @param $tables |
||
391 | * @return string |
||
392 | */ |
||
393 | private function getXoopsVersionSubmenu($language, $tables) |
||
394 | { |
||
395 | $ret = $this->getDashComment('Menu'); |
||
396 | $xModule = $this->pc->getPhpCodeGlobals('xoopsModule'); |
||
397 | $cond = 'isset(' . $xModule . ') && is_object(' . $xModule . ')'; |
||
398 | $one = $this->pc->getPhpCodeGlobals('xoopsModule') . "->getVar('dirname')"; |
||
399 | $ret .= $this->pc->getPhpCodeTernaryOperator('currdirname ', $cond, $one, "'system'"); |
||
400 | |||
401 | $i = 1; |
||
402 | $descriptions = [ |
||
403 | 'name' => "{$language}SMNAME{$i}", |
||
404 | 'url' => "'index.php'", |
||
405 | ]; |
||
406 | $contentIf = $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); |
||
407 | |||
408 | $tableSearch = []; |
||
409 | foreach (array_keys($tables) as $t) { |
||
410 | $tableName = $tables[$t]->getVar('table_name'); |
||
411 | $tableSearch[] = $tables[$t]->getVar('table_search'); |
||
412 | if (1 == $tables[$t]->getVar('table_submenu')) { |
||
413 | $contentIf .= $this->pc->getPhpCodeCommentLine('Sub', $tableName, "\t"); |
||
414 | $descriptions = [ |
||
415 | 'name' => "{$language}SMNAME{$i}", |
||
416 | 'url' => "'{$tableName}.php'", |
||
417 | ]; |
||
418 | $contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); |
||
419 | unset($item); |
||
420 | } |
||
421 | ++$i; |
||
422 | if (1 == $tables[$t]->getVar('table_submit')) { |
||
423 | $contentIf .= $this->pc->getPhpCodeCommentLine('Sub', 'Submit', "\t"); |
||
424 | $descriptions = [ |
||
425 | 'name' => "{$language}SMNAME{$i}", |
||
426 | 'url' => "'{$tableName}.php?op=new'", |
||
427 | ]; |
||
428 | $contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); |
||
429 | ++$i; |
||
430 | } |
||
431 | } |
||
432 | |||
433 | //TODO: after finalizing creation of search.php by User/UserSearch.php this sub menu item can be activated |
||
434 | /* |
||
435 | if (in_array(1, $tableSearch)) { |
||
436 | $contentIf .= $cpc->getPhpCodeCommentLine('Sub', 'Search', "\t"); |
||
437 | $descriptions = [ |
||
438 | 'name' => "{$language}SMNAME{$i}", |
||
439 | 'url' => "'search.php'", |
||
440 | ]; |
||
441 | $contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); |
||
442 | } |
||
443 | */ |
||
444 | unset($i); |
||
445 | |||
446 | $ret .= $this->pc->getPhpCodeConditions('$moduleDirName', ' == ', '$currdirname', $contentIf); |
||
447 | |||
448 | return $ret; |
||
449 | } |
||
450 | |||
451 | /** |
||
452 | * @private function getXoopsVersionBlocks |
||
453 | * @param $moduleDirname |
||
454 | * @param $tables |
||
455 | * @param $language |
||
456 | * @return string |
||
457 | */ |
||
458 | private function getXoopsVersionBlocks($moduleDirname, $tables, $language) |
||
459 | { |
||
460 | $ret = $this->getDashComment('Blocks'); |
||
461 | $tableCategory = []; |
||
462 | foreach (array_keys($tables) as $i) { |
||
463 | $tableName = $tables[$i]->getVar('table_name'); |
||
464 | $tableCategory[] = $tables[$i]->getVar('table_category'); |
||
465 | if (0 == $tables[$i]->getVar('table_category')) { |
||
466 | $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'LAST', $language, 'last'); |
||
467 | $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'NEW', $language, 'new'); |
||
468 | $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'HITS', $language, 'hits'); |
||
469 | $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'TOP', $language, 'top'); |
||
470 | $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'RANDOM', $language, 'random'); |
||
471 | } |
||
472 | } |
||
473 | |||
474 | return $ret; |
||
475 | } |
||
476 | |||
477 | /** |
||
478 | * @private function getXoopsVersionTypeBlocks |
||
479 | * @param $moduleDirname |
||
480 | * @param $tableName |
||
481 | * @param $stuTableSoleName |
||
482 | * @param $language |
||
483 | * @param $type |
||
484 | * @return string |
||
485 | */ |
||
486 | private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTableSoleName, $language, $type) |
||
487 | { |
||
488 | $stuTableName = mb_strtoupper($tableName); |
||
489 | $ucfTableName = ucfirst($tableName); |
||
490 | $ret = $this->pc->getPhpCodeCommentLine($ucfTableName . ' ' . $type); |
||
491 | $blocks = [ |
||
492 | 'file' => "'{$tableName}.php'", |
||
493 | 'name' => "{$language}{$stuTableName}_BLOCK_{$stuTableSoleName}", |
||
494 | 'description' => "{$language}{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", |
||
495 | 'show_func' => "'b_{$moduleDirname}_{$tableName}_show'", |
||
496 | 'edit_func' => "'b_{$moduleDirname}_{$tableName}_edit'", |
||
497 | 'template' => "'{$moduleDirname}_block_{$tableName}.tpl'", |
||
498 | 'options' => "'{$type}|5|25|0'", |
||
499 | ]; |
||
500 | $ret .= $this->uxc->getUserModVersionArray(2, $blocks, 'blocks'); |
||
501 | |||
502 | return $ret; |
||
503 | } |
||
504 | |||
505 | /** |
||
506 | * @private function getXoopsVersionConfig |
||
507 | * @param $module |
||
508 | * @param $tables |
||
509 | * @param $language |
||
510 | * |
||
511 | * @return string |
||
512 | */ |
||
513 | private function getXoopsVersionConfig($module, $tables, $language) |
||
514 | { |
||
515 | $moduleDirname = $module->getVar('mod_dirname'); |
||
516 | $ret = $this->getDashComment('Config'); |
||
517 | |||
518 | $table_editors = 0; |
||
519 | $table_permissions = 0; |
||
520 | $table_admin = 0; |
||
521 | $table_user = 0; |
||
522 | $table_tag = 0; |
||
523 | $table_uploadimage = 0; |
||
524 | $table_uploadfile = 0; |
||
525 | foreach ($tables as $table) { |
||
526 | $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); |
||
527 | foreach (array_keys($fields) as $f) { |
||
528 | $fieldElement = (int)$fields[$f]->getVar('field_element'); |
||
529 | switch ($fieldElement) { |
||
530 | case 3: |
||
531 | $table_editors = 1; |
||
532 | break; |
||
533 | case 4: |
||
534 | $table_editors = 1; |
||
535 | break; |
||
536 | case 10: |
||
537 | case 11: |
||
538 | case 12: |
||
539 | case 13: |
||
540 | $table_uploadimage = 1; |
||
541 | break; |
||
542 | case 14: |
||
543 | $table_uploadfile = 1; |
||
544 | break; |
||
545 | case 'else': |
||
546 | default: |
||
547 | break; |
||
548 | } |
||
549 | } |
||
550 | if (1 == $table->getVar('table_permissions')) { |
||
551 | $table_permissions = 1; |
||
552 | } |
||
553 | if (1 == $table->getVar('table_admin')) { |
||
554 | $table_admin = 1; |
||
555 | } |
||
556 | if (1 == $table->getVar('table_user')) { |
||
557 | $table_user = 1; |
||
558 | } |
||
559 | if (1 == $table->getVar('table_tag')) { |
||
560 | $table_tag = 1; |
||
561 | } |
||
562 | } |
||
563 | if (1 === $table_editors) { |
||
564 | $ret .= $this->pc->getPhpCodeCommentLine('Editor Admin', ''); |
||
565 | $ret .= $this->xc->getXcXoopsLoad('xoopseditorhandler'); |
||
566 | $ret .= $this->xc->getXcEqualsOperator('$editorHandler', 'XoopsEditorHandler::getInstance()'); |
||
567 | $editor = [ |
||
568 | 'name' => "'editor_admin'", |
||
569 | 'title' => "'{$language}EDITOR_ADMIN'", |
||
570 | 'description' => "'{$language}EDITOR_ADMIN_DESC'", |
||
571 | 'formtype' => "'select'", |
||
572 | 'valuetype' => "'text'", |
||
573 | 'default' => "'dhtml'", |
||
574 | 'options' => 'array_flip($editorHandler->getList())', |
||
575 | ]; |
||
576 | $ret .= $this->uxc->getUserModVersionArray(2, $editor, 'config'); |
||
577 | $ret .= $this->pc->getPhpCodeCommentLine('Editor User', ''); |
||
578 | $ret .= $this->xc->getXcXoopsLoad('xoopseditorhandler'); |
||
579 | $ret .= $this->xc->getXcEqualsOperator('$editorHandler', 'XoopsEditorHandler::getInstance()'); |
||
580 | $editor = [ |
||
581 | 'name' => "'editor_user'", |
||
582 | 'title' => "'{$language}EDITOR_USER'", |
||
583 | 'description' => "'{$language}EDITOR_USER_DESC'", |
||
584 | 'formtype' => "'select'", |
||
585 | 'valuetype' => "'text'", |
||
586 | 'default' => "'dhtml'", |
||
587 | 'options' => 'array_flip($editorHandler->getList())', |
||
588 | ]; |
||
589 | $ret .= $this->uxc->getUserModVersionArray(2, $editor, 'config'); |
||
590 | $ret .= $this->pc->getPhpCodeCommentLine('Editor : max characters admin area'); |
||
591 | $maxsize_image = [ |
||
592 | 'name' => "'editor_maxchar'", |
||
593 | 'title' => "'{$language}EDITOR_MAXCHAR'", |
||
594 | 'description' => "'{$language}EDITOR_MAXCHAR_DESC'", |
||
595 | 'formtype' => "'textbox'", |
||
596 | 'valuetype' => "'int'", |
||
597 | 'default' => '50', |
||
598 | ]; |
||
599 | $ret .= $this->uxc->getUserModVersionArray(2, $maxsize_image, 'config'); |
||
600 | } |
||
601 | if (1 === $table_permissions) { |
||
602 | $ret .= $this->pc->getPhpCodeCommentLine('Get groups'); |
||
603 | $ret .= $this->xc->getXcXoopsHandler('member'); |
||
604 | $ret .= $this->xc->getXcEqualsOperator('$xoopsGroups ', '$memberHandler->getGroupList()'); |
||
605 | $ret .= $this->xc->getXcEqualsOperator('$groups', '[]'); |
||
606 | $group = $this->xc->getXcEqualsOperator('$groups[$group] ', '$key', null, "\t"); |
||
607 | $ret .= $this->pc->getPhpCodeForeach('xoopsGroups', false, 'key', 'group', $group); |
||
608 | $ret .= $this->pc->getPhpCodeCommentLine('General access groups'); |
||
609 | $groups = [ |
||
610 | 'name' => "'groups'", |
||
611 | 'title' => "'{$language}GROUPS'", |
||
612 | 'description' => "'{$language}GROUPS_DESC'", |
||
613 | 'formtype' => "'select_multi'", |
||
614 | 'valuetype' => "'array'", |
||
615 | 'default' => '$groups', |
||
616 | 'options' => '$groups', |
||
617 | ]; |
||
618 | $ret .= $this->uxc->getUserModVersionArray(2, $groups, 'config'); |
||
619 | $ret .= $this->pc->getPhpCodeCommentLine('Upload groups'); |
||
620 | $uplgroups = [ |
||
621 | 'name' => "'upload_groups'", |
||
622 | 'title' => "'{$language}UPLOAD_GROUPS'", |
||
623 | 'description' => "'{$language}UPLOAD_GROUPS_DESC'", |
||
624 | 'formtype' => "'select_multi'", |
||
625 | 'valuetype' => "'array'", |
||
626 | 'default' => '$groups', |
||
627 | 'options' => '$groups', |
||
628 | ]; |
||
629 | $ret .= $this->uxc->getUserModVersionArray(2, $uplgroups, 'config'); |
||
630 | |||
631 | $ret .= $this->pc->getPhpCodeCommentLine('Get Admin groups'); |
||
632 | $ret .= $this->xc->getXcCriteriaCompo('crGroups'); |
||
633 | $crit = $this->xc->getXcCriteria('', "'group_type'", "'Admin'", '', true); |
||
634 | $ret .= $this->xc->getXcCriteriaAdd('crGroups', $crit, '', "\n"); |
||
635 | $ret .= $this->xc->getXcXoopsHandler('member'); |
||
636 | $ret .= $this->xc->getXcEqualsOperator('$adminXoopsGroups ', '$memberHandler->getGroupList($crGroups)'); |
||
637 | $ret .= $this->xc->getXcEqualsOperator('$adminGroups', '[]'); |
||
638 | $adminGroup = $this->xc->getXcEqualsOperator('$adminGroups[$adminGroup] ', '$key', null, "\t"); |
||
639 | $ret .= $this->pc->getPhpCodeForeach('adminXoopsGroups', false, 'key', 'adminGroup', $adminGroup); |
||
640 | $adminGroups = [ |
||
641 | 'name' => "'admin_groups'", |
||
642 | 'title' => "'{$language}ADMIN_GROUPS'", |
||
643 | 'description' => "'{$language}ADMIN_GROUPS_DESC'", |
||
644 | 'formtype' => "'select_multi'", |
||
645 | 'valuetype' => "'array'", |
||
646 | 'default' => '$adminGroups', |
||
647 | 'options' => '$adminGroups', |
||
648 | ]; |
||
649 | $ret .= $this->uxc->getUserModVersionArray(2, $adminGroups, 'config'); |
||
650 | $ret .= $this->pc->getPhpCodeUnset('crGroups'); |
||
651 | } |
||
652 | $keyword = implode(', ', $this->getKeywords()); |
||
653 | $ret .= $this->pc->getPhpCodeCommentLine('Keywords'); |
||
654 | $arrayKeyword = [ |
||
655 | 'name' => "'keywords'", |
||
656 | 'title' => "'{$language}KEYWORDS'", |
||
657 | 'description' => "'{$language}KEYWORDS_DESC'", |
||
658 | 'formtype' => "'textbox'", |
||
659 | 'valuetype' => "'text'", |
||
660 | 'default' => "'{$moduleDirname}, {$keyword}'", |
||
661 | ]; |
||
662 | $ret .= $this->uxc->getUserModVersionArray(2, $arrayKeyword, 'config'); |
||
663 | unset($this->keywords); |
||
664 | |||
665 | if (1 === $table_uploadimage || 1 === $table_uploadfile) { |
||
666 | $ret .= $this->getXoopsVersionSelectSizeMB($moduleDirname); |
||
667 | } |
||
668 | if (1 === $table_uploadimage) { |
||
669 | $ret .= $this->pc->getPhpCodeCommentLine('Uploads : maxsize of image'); |
||
670 | $maxsize_image = [ |
||
671 | 'name' => "'maxsize_image'", |
||
672 | 'title' => "'{$language}MAXSIZE_IMAGE'", |
||
673 | 'description' => "'{$language}MAXSIZE_IMAGE_DESC'", |
||
674 | 'formtype' => "'select'", |
||
675 | 'valuetype' => "'int'", |
||
676 | 'default' => '3145728', |
||
677 | 'options' => '$optionMaxsize', |
||
678 | ]; |
||
679 | $ret .= $this->uxc->getUserModVersionArray(2, $maxsize_image, 'config'); |
||
680 | $ret .= $this->pc->getPhpCodeCommentLine('Uploads : mimetypes of image'); |
||
681 | $mimetypes_image = [ |
||
682 | 'name' => "'mimetypes_image'", |
||
683 | 'title' => "'{$language}MIMETYPES_IMAGE'", |
||
684 | 'description' => "'{$language}MIMETYPES_IMAGE_DESC'", |
||
685 | 'formtype' => "'select_multi'", |
||
686 | 'valuetype' => "'array'", |
||
687 | 'default' => "['image/gif', 'image/jpeg', 'image/png']", |
||
688 | 'options' => "['bmp' => 'image/bmp','gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png']", |
||
689 | ]; |
||
690 | $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_image, 'config'); |
||
691 | $maxwidth_image = [ |
||
692 | 'name' => "'maxwidth_image'", |
||
693 | 'title' => "'{$language}MAXWIDTH_IMAGE'", |
||
694 | 'description' => "'{$language}MAXWIDTH_IMAGE_DESC'", |
||
695 | 'formtype' => "'textbox'", |
||
696 | 'valuetype' => "'int'", |
||
697 | 'default' => '8000', |
||
698 | ]; |
||
699 | $ret .= $this->uxc->getUserModVersionArray(2, $maxwidth_image, 'config'); |
||
700 | $maxheight_image = [ |
||
701 | 'name' => "'maxheight_image'", |
||
702 | 'title' => "'{$language}MAXHEIGHT_IMAGE'", |
||
703 | 'description' => "'{$language}MAXHEIGHT_IMAGE_DESC'", |
||
704 | 'formtype' => "'textbox'", |
||
705 | 'valuetype' => "'int'", |
||
706 | 'default' => '8000', |
||
707 | ]; |
||
708 | $ret .= $this->uxc->getUserModVersionArray(2, $maxheight_image, 'config'); |
||
709 | } |
||
710 | if (1 === $table_uploadfile) { |
||
711 | $ret .= $this->pc->getPhpCodeCommentLine('Uploads : maxsize of file'); |
||
712 | $maxsize_file = [ |
||
713 | 'name' => "'maxsize_file'", |
||
714 | 'title' => "'{$language}MAXSIZE_FILE'", |
||
715 | 'description' => "'{$language}MAXSIZE_FILE_DESC'", |
||
716 | 'formtype' => "'select'", |
||
717 | 'valuetype' => "'int'", |
||
718 | 'default' => '3145728', |
||
719 | 'options' => '$optionMaxsize', |
||
720 | ]; |
||
721 | $ret .= $this->uxc->getUserModVersionArray(2, $maxsize_file, 'config'); |
||
722 | $ret .= $this->pc->getPhpCodeCommentLine('Uploads : mimetypes of file'); |
||
723 | $mimetypes_file = [ |
||
724 | 'name' => "'mimetypes_file'", |
||
725 | 'title' => "'{$language}MIMETYPES_FILE'", |
||
726 | 'description' => "'{$language}MIMETYPES_FILE_DESC'", |
||
727 | 'formtype' => "'select_multi'", |
||
728 | 'valuetype' => "'array'", |
||
729 | 'default' => "['application/pdf', 'application/zip', 'text/comma-separated-values', 'text/plain', 'image/gif', 'image/jpeg', 'image/png']", |
||
730 | 'options' => "['gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png', 'pdf' => 'application/pdf','zip' => 'application/zip','csv' => 'text/comma-separated-values', 'txt' => 'text/plain', 'xml' => 'application/xml', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document']", |
||
731 | ]; |
||
732 | $ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_file, 'config'); |
||
733 | } |
||
734 | if (1 === $table_admin) { |
||
735 | $ret .= $this->pc->getPhpCodeCommentLine('Admin pager'); |
||
736 | $adminPager = [ |
||
737 | 'name' => "'adminpager'", |
||
738 | 'title' => "'{$language}ADMIN_PAGER'", |
||
739 | 'description' => "'{$language}ADMIN_PAGER_DESC'", |
||
740 | 'formtype' => "'textbox'", |
||
741 | 'valuetype' => "'int'", |
||
742 | 'default' => '10', |
||
743 | ]; |
||
744 | $ret .= $this->uxc->getUserModVersionArray(2, $adminPager, 'config'); |
||
745 | } |
||
746 | if (1 === $table_user) { |
||
747 | $ret .= $this->pc->getPhpCodeCommentLine('User pager'); |
||
748 | $userPager = [ |
||
749 | 'name' => "'userpager'", |
||
750 | 'title' => "'{$language}USER_PAGER'", |
||
751 | 'description' => "'{$language}USER_PAGER_DESC'", |
||
752 | 'formtype' => "'textbox'", |
||
753 | 'valuetype' => "'int'", |
||
754 | 'default' => '10', |
||
755 | ]; |
||
756 | $ret .= $this->uxc->getUserModVersionArray(2, $userPager, 'config'); |
||
757 | } |
||
758 | if (1 === $table_tag) { |
||
759 | $ret .= $this->pc->getPhpCodeCommentLine('Use tag'); |
||
760 | $useTag = [ |
||
761 | 'name' => "'usetag'", |
||
762 | 'title' => "'{$language}USE_TAG'", |
||
763 | 'description' => "'{$language}USE_TAG_DESC'", |
||
764 | 'formtype' => "'yesno'", |
||
765 | 'valuetype' => "'int'", |
||
766 | 'default' => '0', |
||
767 | ]; |
||
768 | $ret .= $this->uxc->getUserModVersionArray(2, $useTag, 'config'); |
||
769 | } |
||
770 | $ret .= $this->pc->getPhpCodeCommentLine('Number column'); |
||
771 | $numbCol = [ |
||
772 | 'name' => "'numb_col'", |
||
773 | 'title' => "'{$language}NUMB_COL'", |
||
774 | 'description' => "'{$language}NUMB_COL_DESC'", |
||
775 | 'formtype' => "'select'", |
||
776 | 'valuetype' => "'int'", |
||
777 | 'default' => '1', |
||
778 | 'options' => "[1 => '1', 2 => '2', 3 => '3', 4 => '4']", |
||
779 | ]; |
||
780 | $ret .= $this->uxc->getUserModVersionArray(2, $numbCol, 'config'); |
||
781 | |||
782 | $ret .= $this->pc->getPhpCodeCommentLine('Divide by'); |
||
783 | $divideby = [ |
||
784 | 'name' => "'divideby'", |
||
785 | 'title' => "'{$language}DIVIDEBY'", |
||
786 | 'description' => "'{$language}DIVIDEBY_DESC'", |
||
787 | 'formtype' => "'select'", |
||
788 | 'valuetype' => "'int'", |
||
789 | 'default' => '1', |
||
790 | 'options' => "[1 => '1', 2 => '2', 3 => '3', 4 => '4']", |
||
791 | ]; |
||
792 | $ret .= $this->uxc->getUserModVersionArray(2, $divideby, 'config'); |
||
793 | |||
794 | $ret .= $this->pc->getPhpCodeCommentLine('Table type'); |
||
795 | $tableType = [ |
||
796 | 'name' => "'table_type'", |
||
797 | 'title' => "'{$language}TABLE_TYPE'", |
||
798 | 'description' => "'{$language}DIVIDEBY_DESC'", |
||
799 | 'formtype' => "'select'", |
||
800 | 'valuetype' => "'int'", |
||
801 | 'default' => "'bordered'", |
||
802 | 'options' => "['bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed']", |
||
803 | ]; |
||
804 | $ret .= $this->uxc->getUserModVersionArray(2, $tableType, 'config'); |
||
805 | |||
806 | $ret .= $this->pc->getPhpCodeCommentLine('Panel by'); |
||
807 | $panelType = [ |
||
808 | 'name' => "'panel_type'", |
||
809 | 'title' => "'{$language}PANEL_TYPE'", |
||
810 | 'description' => "'{$language}PANEL_TYPE_DESC'", |
||
811 | 'formtype' => "'select'", |
||
812 | 'valuetype' => "'text'", |
||
813 | 'default' => "'default'", |
||
814 | 'options' => "['default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger']", |
||
815 | ]; |
||
816 | $ret .= $this->uxc->getUserModVersionArray(2, $panelType, 'config'); |
||
817 | |||
818 | $ret .= $this->pc->getPhpCodeCommentLine('Advertise'); |
||
819 | $advertise = [ |
||
820 | 'name' => "'advertise'", |
||
821 | 'title' => "'{$language}ADVERTISE'", |
||
822 | 'description' => "'{$language}ADVERTISE_DESC'", |
||
823 | 'formtype' => "'textarea'", |
||
824 | 'valuetype' => "'text'", |
||
825 | 'default' => "''", |
||
826 | ]; |
||
827 | $ret .= $this->uxc->getUserModVersionArray(2, $advertise, 'config'); |
||
828 | |||
829 | $ret .= $this->pc->getPhpCodeCommentLine('Bookmarks'); |
||
830 | $bookmarks = [ |
||
831 | 'name' => "'bookmarks'", |
||
832 | 'title' => "'{$language}BOOKMARKS'", |
||
833 | 'description' => "'{$language}BOOKMARKS_DESC'", |
||
834 | 'formtype' => "'yesno'", |
||
835 | 'valuetype' => "'int'", |
||
836 | 'default' => '0', |
||
837 | ]; |
||
838 | $ret .= $this->uxc->getUserModVersionArray(2, $bookmarks, 'config'); |
||
839 | |||
840 | /* |
||
841 | * removed, as there are no system templates in xoops core for fb or disqus comments |
||
842 | * modulebuilder currently is also not creatings tpl files for this |
||
843 | $ret .= $this->pc->getPhpCodeCommentLine('Facebook Comments'); |
||
844 | $facebookComments = [ |
||
845 | 'name' => "'facebook_comments'", |
||
846 | 'title' => "'{$language}FACEBOOK_COMMENTS'", |
||
847 | 'description' => "'{$language}FACEBOOK_COMMENTS_DESC'", |
||
848 | 'formtype' => "'yesno'", |
||
849 | 'valuetype' => "'int'", |
||
850 | 'default' => '0', |
||
851 | ]; |
||
852 | $ret .= $this->uxc->getUserModVersion(3, $facebookComments, 'config', '$c'); |
||
853 | $ret .= $this->getSimpleString('++$c;'); |
||
854 | $ret .= $this->pc->getPhpCodeCommentLine('Disqus Comments'); |
||
855 | $disqusComments = [ |
||
856 | 'name' => "'disqus_comments'", |
||
857 | 'title' => "'{$language}DISQUS_COMMENTS'", |
||
858 | 'description' => "'{$language}DISQUS_COMMENTS_DESC'", |
||
859 | 'formtype' => "'yesno'", |
||
860 | 'valuetype' => "'int'", |
||
861 | 'default' => '0', |
||
862 | ]; |
||
863 | $ret .= $this->uxc->getUserModVersion(3, $disqusComments, 'config', '$c'); |
||
864 | $ret .= $this->getSimpleString('++$c;'); |
||
865 | */ |
||
866 | |||
867 | $ret .= $this->pc->getPhpCodeCommentLine('Make Sample button visible?'); |
||
868 | $maintainedby = [ |
||
869 | 'name' => "'displaySampleButton'", |
||
870 | 'title' => "'CO_' . \$moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON'", |
||
871 | 'description' => "'CO_' . \$moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC'", |
||
872 | 'formtype' => "'yesno'", |
||
873 | 'valuetype' => "'int'", |
||
874 | 'default' => '1', |
||
875 | ]; |
||
876 | $ret .= $this->uxc->getUserModVersionArray(2, $maintainedby, 'config'); |
||
877 | |||
878 | $ret .= $this->pc->getPhpCodeCommentLine('Maintained by'); |
||
879 | $maintainedby = [ |
||
880 | 'name' => "'maintainedby'", |
||
881 | 'title' => "'{$language}MAINTAINEDBY'", |
||
882 | 'description' => "'{$language}MAINTAINEDBY_DESC'", |
||
883 | 'formtype' => "'textbox'", |
||
884 | 'valuetype' => "'text'", |
||
885 | 'default' => "'{$module->getVar('mod_support_url')}'", |
||
886 | ]; |
||
887 | $ret .= $this->uxc->getUserModVersionArray(2, $maintainedby, 'config'); |
||
888 | |||
889 | return $ret; |
||
890 | } |
||
891 | |||
892 | /** |
||
893 | * @private function getNotificationsType |
||
894 | * @param $language |
||
895 | * @param $type |
||
896 | * @param $tableName |
||
897 | * @param $notifyFile |
||
898 | * @param $item |
||
899 | * @param $typeOfNotify |
||
900 | * |
||
901 | * @return string |
||
902 | */ |
||
903 | private function getNotificationsType($language, $type, $tableName, $notifyFile, $item, $typeOfNotify) |
||
940 | } |
||
941 | |||
942 | /** |
||
943 | * @private function getXoopsVersionNotifications |
||
944 | * @param $module |
||
945 | * @param $language |
||
946 | * @return string |
||
947 | */ |
||
948 | private function getXoopsVersionNotifications($module, $language) |
||
949 | { |
||
950 | $moduleDirname = $module->getVar('mod_dirname'); |
||
951 | $ret = $this->getDashComment('Notifications'); |
||
952 | $ret .= $this->uxc->getUserModVersionText(1, 1, 'hasNotification'); |
||
953 | $notifications = ['lookup_file' => "'include/notification.inc.php'", 'lookup_func' => "'{$moduleDirname}_notify_iteminfo'"]; |
||
954 | $ret .= $this->uxc->getUserModVersionArray(1, $notifications, 'notification'); |
||
955 | |||
956 | $notifyFiles = []; |
||
957 | $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); |
||
958 | $tableCategory = []; |
||
959 | $tableBroken = []; |
||
960 | $tableComments = []; |
||
961 | $tableSubmit = []; |
||
962 | $tableId = null; |
||
963 | $tableMid = null; |
||
964 | $notifyCategory = ''; |
||
965 | $notifyEventGlobal = $this->pc->getPhpCodeCommentLine('Global events notification'); |
||
966 | $notifyEventTable = $this->pc->getPhpCodeCommentLine('Event notifications for items'); |
||
967 | |||
968 | //global events |
||
969 | $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_new', 'global', 0, 'global_new', 'global_new_notify'); |
||
970 | $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_modify', 'global', 0, 'global_modify', 'global_modify_notify'); |
||
971 | $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_delete', 'global', 0, 'global_delete', 'global_delete_notify'); |
||
972 | $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_approve', 'global', 0, 'global_approve', 'global_approve_notify'); |
||
973 | foreach (array_keys($tables) as $t) { |
||
974 | $tableBroken[] = $tables[$t]->getVar('table_broken'); |
||
975 | $tableComments[] = $tables[$t]->getVar('table_comments'); |
||
976 | } |
||
977 | if (in_array(1, $tableBroken)) { |
||
978 | $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_broken', 'global', 0, 'global_broken', 'global_broken_notify'); |
||
979 | } |
||
980 | if (in_array(1, $tableComments)) { |
||
981 | $notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_comment', 'global', 0, 'global_comment', 'global_comment_notify'); |
||
982 | } |
||
983 | |||
984 | foreach (array_keys($tables) as $t) { |
||
985 | $tableId = $tables[$t]->getVar('table_id'); |
||
986 | $tableMid = $tables[$t]->getVar('table_mid'); |
||
987 | $tableName = $tables[$t]->getVar('table_name'); |
||
988 | $tableSoleName = $tables[$t]->getVar('table_solename'); |
||
989 | $tableCategory[] = $tables[$t]->getVar('table_category'); |
||
990 | $tableSubmit[] = $tables[$t]->getVar('table_submit'); |
||
991 | $fields = $this->getTableFields($tableMid, $tableId); |
||
992 | $fieldId = 0; |
||
993 | foreach (array_keys($fields) as $f) { |
||
994 | $fieldName = $fields[$f]->getVar('field_name'); |
||
995 | if (0 == $f) { |
||
996 | $fieldId = $fieldName; |
||
997 | } |
||
998 | } |
||
999 | if (1 == $tables[$t]->getVar('table_notifications')) { |
||
1000 | $notifyFiles[] = $tableName; |
||
1001 | $notifyCategory .= $this->getXoopsVersionNotificationTableName($language, 'category', $tableName, $tableSoleName, $tableName, $fieldId, 1); |
||
1002 | //$notifyEvent .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_new', $tableName, 0, $tableSoleName, $tableSoleName . '_new_notify'); |
||
1003 | $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_modify', $tableName, 0, $tableSoleName . '_modify', $tableSoleName . '_modify_notify'); |
||
1004 | $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_delete', $tableName, 0, $tableSoleName . '_delete', $tableSoleName . '_delete_notify'); |
||
1005 | $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_approve', $tableName, 0, $tableSoleName . '_approve', $tableSoleName . '_approve_notify'); |
||
1006 | if (1 == $tables[$t]->getVar('table_broken')) { |
||
1007 | $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_broken', $tableName, 0, $tableSoleName . '_broken', $tableSoleName . '_broken_notify'); |
||
1008 | } |
||
1009 | /*event will be added by xoops |
||
1010 | if (1 == $tables[$t]->getVar('table_comments')) { |
||
1011 | $notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_comment', $tableName, 0, $tableSoleName . '_comment', $tableSoleName . '_comment_notify'); |
||
1012 | }*/ |
||
1013 | } |
||
1014 | } |
||
1015 | $ret .= $this->pc->getPhpCodeCommentLine('Categories of notification'); |
||
1016 | $ret .= $this->getXoopsVersionNotificationGlobal($language, 'category', 'global', 'global', $notifyFiles); |
||
1017 | |||
1018 | //$ret .= $this->getXoopsVersionNotificationCategory($language, 'category', 'category', 'category', $notifyFiles, $fieldParent, '1'); |
||
1019 | |||
1020 | $ret .= $notifyCategory . $notifyEventGlobal . $notifyEventTable; |
||
1021 | |||
1022 | |||
1023 | return $ret; |
||
1024 | } |
||
1025 | |||
1026 | /** |
||
1027 | * @private function getXoopsVersionNotificationGlobal |
||
1028 | * @param $language |
||
1029 | * @param $type |
||
1030 | * @param $name |
||
1031 | * @param $title |
||
1032 | * @param $from |
||
1033 | * |
||
1034 | * @return string |
||
1035 | */ |
||
1036 | private function getXoopsVersionNotificationGlobal($language, $type, $name, $title, $from) |
||
1037 | { |
||
1038 | $title = mb_strtoupper($title); |
||
1039 | $implodeFrom = implode(".php', '", $from); |
||
1040 | $ret = $this->pc->getPhpCodeCommentLine('Global Notify'); |
||
1041 | $global = [ |
||
1042 | 'name' => "'{$name}'", |
||
1043 | 'title' => "{$language}NOTIFY_{$title}", |
||
1044 | 'description' => "''", |
||
1045 | 'subscribe_from' => "['index.php', '{$implodeFrom}.php']", |
||
1046 | ]; |
||
1047 | $ret .= $this->uxc->getUserModVersionArray(3, $global, 'notification', "'{$type}'"); |
||
1048 | |||
1049 | return $ret; |
||
1050 | } |
||
1051 | |||
1052 | |||
1053 | /** |
||
1054 | * @private function getXoopsVersionNotificationTableName |
||
1055 | * @param $language |
||
1056 | * @param $type |
||
1057 | * @param $name |
||
1058 | * @param $title |
||
1059 | * @param $file |
||
1060 | * @param $item |
||
1061 | * @param $allow |
||
1062 | * |
||
1063 | * @return string |
||
1064 | */ |
||
1065 | private function getXoopsVersionNotificationTableName($language, $type, $name, $title, $file, $item, $allow) |
||
1066 | { |
||
1067 | $stuTitle = mb_strtoupper($title); |
||
1068 | $ucfTitle = ucfirst($title); |
||
1069 | $ret = $this->pc->getPhpCodeCommentLine($ucfTitle . ' Notify'); |
||
1070 | $table = [ |
||
1071 | 'name' => "'{$name}'", |
||
1072 | 'title' => "{$language}NOTIFY_{$stuTitle}", |
||
1073 | 'description' => "''", |
||
1074 | 'subscribe_from' => "'{$file}.php'", |
||
1075 | 'item_name' => "'{$item}'", |
||
1076 | 'allow_bookmark' => (string)$allow, |
||
1077 | ]; |
||
1078 | $ret .= $this->uxc->getUserModVersionArray(3, $table, 'notification', "'{$type}'"); |
||
1079 | |||
1080 | return $ret; |
||
1081 | } |
||
1082 | |||
1083 | /** |
||
1084 | * @private function getXoopsVersionNotifications |
||
1085 | * @param $language |
||
1086 | * @param $type |
||
1087 | * @param $name |
||
1088 | * @param $category |
||
1089 | * @param $admin |
||
1090 | * @param $title |
||
1091 | * @param $mail |
||
1092 | * |
||
1093 | * @return string |
||
1094 | */ |
||
1095 | private function getXoopsVersionNotificationCodeComplete($language, $type, $name, $category, $admin, $title, $mail) |
||
1096 | { |
||
1097 | $title = mb_strtoupper($title); |
||
1098 | $ucfTitle = ucfirst($title); |
||
1099 | $ret = $this->pc->getPhpCodeCommentLine($ucfTitle . ' Notify'); |
||
1100 | $event = [ |
||
1101 | 'name' => "'{$name}'", |
||
1102 | 'category' => "'{$category}'", |
||
1103 | 'admin_only' => (string)$admin, |
||
1104 | 'title' => "{$language}NOTIFY_{$title}", |
||
1105 | 'caption' => "{$language}NOTIFY_{$title}_CAPTION", |
||
1106 | 'description' => "''", |
||
1107 | 'mail_template' => "'{$mail}'", |
||
1108 | 'mail_subject' => "{$language}NOTIFY_{$title}_SUBJECT", |
||
1109 | ]; |
||
1110 | $ret .= $this->uxc->getUserModVersionArray(3, $event, 'notification', "'{$type}'"); |
||
1111 | |||
1112 | return $ret; |
||
1113 | } |
||
1114 | |||
1115 | /** |
||
1116 | * @private function getXoopsVersionNotifications |
||
1117 | * @param $moduleDirname |
||
1118 | * @param string $t |
||
1119 | * @return string |
||
1120 | */ |
||
1121 | private function getXoopsVersionSelectSizeMB($moduleDirname, $t = '') |
||
1122 | { |
||
1123 | $ucModuleDirname = mb_strtoupper($moduleDirname); |
||
1124 | |||
1125 | $ret = $this->pc->getPhpCodeCommentLine('create increment steps for file size'); |
||
1126 | $ret .= $this->pc->getPhpCodeIncludeDir("__DIR__ . '/include/xoops_version.inc.php'", '',true,true); |
||
1127 | $ret .= $this->xc->getXcEqualsOperator('$iniPostMaxSize ', "{$moduleDirname}ReturnBytes(ini_get('post_max_size'))"); |
||
1128 | $ret .= $this->xc->getXcEqualsOperator('$iniUploadMaxFileSize', "{$moduleDirname}ReturnBytes(ini_get('upload_max_filesize'))"); |
||
1129 | $ret .= $this->xc->getXcEqualsOperator('$maxSize ', "min(\$iniPostMaxSize, \$iniUploadMaxFileSize)"); |
||
1130 | $cond = $this->xc->getXcEqualsOperator('$increment', '500', null, $t . "\t"); |
||
1131 | $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' > ', '10000 * 1048576', $cond, false, $t); |
||
1132 | $cond = $this->xc->getXcEqualsOperator('$increment', '200', null, $t . "\t"); |
||
1133 | $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '10000 * 1048576', $cond, false, $t); |
||
1134 | $cond = $this->xc->getXcEqualsOperator('$increment', '100', null, $t . "\t"); |
||
1135 | $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '5000 * 1048576', $cond, false, $t); |
||
1136 | $cond = $this->xc->getXcEqualsOperator('$increment', '50', null, $t . "\t"); |
||
1137 | $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '2500 * 1048576', $cond, false, $t); |
||
1138 | $cond = $this->xc->getXcEqualsOperator('$increment', '10', null, $t . "\t"); |
||
1139 | $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '1000 * 1048576', $cond, false, $t); |
||
1140 | $cond = $this->xc->getXcEqualsOperator('$increment', '5', null, $t . "\t"); |
||
1141 | $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '500 * 1048576', $cond, false, $t); |
||
1142 | $cond = $this->xc->getXcEqualsOperator('$increment', '2', null, $t . "\t"); |
||
1143 | $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '100 * 1048576', $cond, false, $t); |
||
1144 | $cond = $this->xc->getXcEqualsOperator('$increment', '1', null, $t . "\t"); |
||
1145 | $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '50 * 1048576', $cond, false, $t); |
||
1146 | $cond = $this->xc->getXcEqualsOperator('$increment', '0.5', null, $t . "\t"); |
||
1147 | $ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '25 * 1048576', $cond, false, $t); |
||
1148 | $ret .= $this->xc->getXcEqualsOperator('$optionMaxsize', '[]'); |
||
1149 | $ret .= $this->xc->getXcEqualsOperator('$i', '$increment'); |
||
1150 | $while = $this->xc->getXcEqualsOperator("\$optionMaxsize[\$i . ' ' . _MI_{$ucModuleDirname}_SIZE_MB]", '$i * 1048576', null, $t . "\t"); |
||
1151 | $while .= $this->xc->getXcEqualsOperator('$i', '$increment', '+',$t . "\t"); |
||
1152 | $ret .= $this->pc->getPhpCodeWhile('i * 1048576', $while, '$maxSize', ' <= '); |
||
1153 | |||
1154 | return $ret; |
||
1155 | } |
||
1156 | |||
1157 | /** |
||
1158 | * @public function render |
||
1159 | * @param null |
||
1160 | * @return bool|string |
||
1161 | */ |
||
1162 | public function render() |
||
1205 | } |
||
1206 | } |
||
1207 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..