Completed
Pull Request — master (#101)
by Gino
03:22
created

getXoopsVersionNotificationTableName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 11
rs 9.4285
cc 1
eloc 8
nc 1
nop 8

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
/**
13
 * tdmcreate module.
14
 *
15
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 *
18
 * @since           2.5.0
19
 *
20
 * @author          Txmod Xoops http://www.txmodxoops.org
21
 *
22
 * @version         $Id: UserXoopsVersion.php 12258 2014-01-02 09:33:29Z timgno $
23
 */
24
25
/**
26
 * Class UserXoopsVersion.
27
 */
28
class UserXoopsVersion extends TDMCreateFile
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
29
{
30
    /*
31
    * @var mixed
32
    */
33
    private $xc = null;
34
35
    /*
36
    * @var mixed
37
    */
38
    private $uc = null;
39
40
    /*
41
    * @var array
42
    */
43
    private $kw = array();
44
45
    /*
46
    *  @public function constructor
47
    *  @param null
48
    */
49
    /**
50
     *
51
     */
52
    public function __construct()
53
    {
54
        parent::__construct();
55
        $this->phpcode = TDMCreatePhpCode::getInstance();
0 ignored issues
show
Documentation Bug introduced by
It seems like \TDMCreatePhpCode::getInstance() of type object<TDMCreatePhpCode> is incompatible with the declared type string of property $phpcode.

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..

Loading history...
56
        $this->xc = TDMCreateXoopsCode::getInstance();
57
        $this->uc = UserXoopsCode::getInstance();
58
    }
59
60
    /*
61
    *  @static function &getInstance
62
    *  @param null
63
    */
64
    /**
65
     * @return UserXoopsVersion
66
     */
67
    public static function &getInstance()
68
    {
69
        static $instance = false;
70
        if (!$instance) {
71
            $instance = new self();
72
        }
73
74
        return $instance;
75
    }
76
77
    /*
78
    *  @public function write
79
    *  @param $module
80
    *  @param mixed $table
81
    *  @param mixed $tables
82
    *  @param $filename
83
    */
84
    /**
85
     * @param $module
86
     * @param $table
87
     * @param $tables
88
     * @param $filename
89
     */
90
    public function write($module, $table, $tables, $filename)
91
    {
92
        $this->setModule($module);
93
        $this->setTable($table);
94
        $this->setTables($tables);
95
        $this->setFileName($filename);
96
        foreach (array_keys($tables) as $t) {
97
            $tableName = $tables[$t]->getVar('table_name');
98
            $this->setKeywords($tableName);
99
        }
100
    }
101
102
    /*
103
    *  @public function setKeywords
104
    *  @param mixed $keywords
105
    */
106
    /**
107
     * @param $keywords
108
     */
109
    public function setKeywords($keywords)
110
    {
111
        if (is_array($keywords)) {
112
            $this->kw = $keywords;
113
        } else {
114
            $this->kw[] = $keywords;
115
        }
116
    }
117
118
    /*
119
    *  @public function getKeywords
120
    *  @param null
121
    */
122
    /**
123
     * @return array
124
     */
125
    public function getKeywords()
126
    {
127
        return $this->kw;
128
    }
129
130
    /*
131
     * @private function getXoopsVersionHeader
132
     * @param $module
133
     * @param $language
134
     *
135
     * @return string
136
     */
137
    private function getXoopsVersionHeader($module, $language)
138
    {
139
        $date = date(_DBDATESTRING);
140
        $ret = $this->getSimpleString('');
141
        $ret .= $this->phpcode->getPhpCodeCommentLine();
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
142
        $ret .= $this->xc->getXcEqualsOperator('$dirname ', 'basename(__DIR__)');
143
        $ret .= $this->getDashComment('Informations');
144
        $ha = (1 == $module->getVar('mod_admin')) ? 1 : 0;
145
        $hm = (1 == $module->getVar('mod_user')) ? 1 : 0;
146
147
        $descriptions = array('name' => "{$language}NAME", 'version' => "{$module->getVar('mod_version')}", 'description' => "{$language}DESC",
148
                            'author' => "'{$module->getVar('mod_author')}'", 'author_mail' => "'{$module->getVar('mod_author_mail')}'", 'author_website_url' => "'{$module->getVar('mod_author_website_url')}'",
149
                            'author_website_name' => "'{$module->getVar('mod_author_website_name')}'",'credits' => "'{$module->getVar('mod_credits')}'",'license' => "'{$module->getVar('mod_license')}'",
150
                            'license_url' => "'www.gnu.org/licenses/gpl-2.0.html/'", 'help' => "'page=help'", 'release_info' => "'{$module->getVar('mod_release_info')}'",
151
                            'release_file' => "XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_release_file')}'", 'release_date' => "'{$date}'",
152
                            'manual' => "'{$module->getVar('mod_manual')}'", 'manual_file' => "XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_manual_file')}'",
153
                            'min_php' => "'{$module->getVar('mod_min_php')}'", 'min_xoops' => "'{$module->getVar('mod_min_xoops')}'", 'min_admin' => "'{$module->getVar('mod_min_admin')}'",
154
                            'min_db' => "array('mysql' => '{$module->getVar('mod_min_mysql')}', 'mysqli' => '{$module->getVar('mod_min_mysql')}')", 'image' => "'assets/images/{$module->getVar('mod_image')}'",
155
                            'dirname' => 'basename(__DIR__)', 'dirmoduleadmin' => "'Frameworks/moduleclasses/moduleadmin'", 'sysicons16' => "'../../Frameworks/moduleclasses/icons/16'",
156
                            'sysicons32' => "'../../Frameworks/moduleclasses/icons/32'", 'modicons16' => "'assets/icons/16'", 'modicons32' => "'assets/icons/32'",
157
                            'demo_site_url' => "'{$module->getVar('mod_demo_site_url')}'", 'demo_site_name' => "'{$module->getVar('mod_demo_site_name')}'", 'support_url' => "'{$module->getVar('mod_support_url')}'",
158
                            'support_name' => "'{$module->getVar('mod_support_name')}'", 'module_website_url' => "'{$module->getVar('mod_website_url')}'", 'module_website_name' => "'{$module->getVar('mod_website_name')}'", 'release' => "'{$module->getVar('mod_release')}'", 'module_status' => "'{$module->getVar('mod_status')}'",
159
                            'system_menu' => '1', 'hasAdmin' => $ha, 'hasMain' => $hm, 'adminindex' => "'admin/index.php'", 'adminmenu' => "'admin/menu.php'",
160
                            'onInstall' => "'include/install.php'", 'onUpdate' => "'include/update.php'", );
161
162
        $ret .= $this->uc->getUserModVersion(1, $descriptions);
163
164
        return $ret;
165
    }
166
167
    /*
168
    *  @private function getXoopsVersionMySQL
169
    *  @param $moduleDirname
170
    *  @param $table
171
    */
172
    /**
173
     * @param $moduleDirname
174
     * @param $table
175
     *
176
     * @return string
177
     */
178
    private function getXoopsVersionMySQL($moduleDirname, $table, $tables)
179
    {
180
        $tableName = $table->getVar('table_name');
181
        $n = 1;
182
        $ret = '';
183
        if (!empty($tableName)) {
184
            $ret .= $this->getDashComment('Mysql');
185
            $ret .= $this->uc->getUserModVersion(2, "'sql/mysql.sql'", 'sqlfile', "'mysql'");
186
            $ret .= $this->phpcode->getPhpCodeCommentLine('Tables');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
187
188
            foreach (array_keys($tables) as $t) {
189
                $ret .= $this->uc->getUserModVersion(2, "'{$moduleDirname}_{$tables[$t]->getVar('table_name')}'", 'tables', $n);
190
                ++$n;
191
            }
192
            unset($n);
193
        }
194
195
        return $ret;
196
    }
197
198
    /*
199
    *  @private function getXoopsVersionSearch
200
    *  @param $moduleDirname
201
    */
202
    /**
203
     * @param $moduleDirname
204
     *
205
     * @return string
206
     */
207
    private function getXoopsVersionSearch($moduleDirname)
208
    {
209
        $ret = $this->getDashComment('Search');
210
        $ret .= $this->uc->getUserModVersion(1, 1, 'hasSearch');
211
        $ret .= $this->uc->getUserModVersion(2, "'include/search.inc.php'", 'search', "'file'");
212
        $ret .= $this->uc->getUserModVersion(2, "'{$moduleDirname}_search'", 'search', "'func'");
213
214
        return $ret;
215
    }
216
217
    /*
218
    *  @private function getXoopsVersionComments
219
    *  @param $moduleDirname
220
    */
221
    /**
222
     * @param $moduleDirname
223
     *
224
     * @return string
225
     */
226
    private function getXoopsVersionComments($moduleDirname)
227
    {
228
        $ret = $this->getDashComment('Comments');
229
        $ret .= $this->uc->getUserModVersion(2, "'comments.php'", 'comments', "'pageName'");
230
        $ret .= $this->uc->getUserModVersion(2, "'com_id'", 'comments', "'itemName'");
231
        $ret .= $this->phpcode->getPhpCodeCommentLine('Comment callback functions');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
232
        $ret .= $this->uc->getUserModVersion(2, "'include/comment_functions.php'", 'comments', "'callbackFile'");
233
        $descriptions = array('approve' => "'{$moduleDirname}CommentsApprove'", 'update' => "'{$moduleDirname}CommentsUpdate'");
234
        $ret .= $this->uc->getUserModVersion(3, $descriptions, 'comments', "'callback'");
235
236
        return $ret;
237
    }
238
239
    /*
240
    *  @private function getXoopsVersionTemplatesAdmin
241
    *  @param $moduleDirname
242
    */
243
    /**
244
     * @param $moduleDirname
245
     * @param $tables
246
     *
247
     * @return string
248
     */
249
    private function getXoopsVersionTemplatesAdmin($moduleDirname, $tables)
250
    {
251
        $ret = $this->getDashComment('Templates');
252
        $ret .= $this->phpcode->getPhpCodeCommentLine('Admin');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
253
254
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'about', '', true);
255
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'header', '', true);
256
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'index', '', true);
257
        $tablePermissions = array();
258
        foreach (array_keys($tables) as $t) {
259
            $tableName = $tables[$t]->getVar('table_name');
260
            $tablePermissions[] = $tables[$t]->getVar('table_permissions');
261
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, '', true);
262
        }
263
        if (in_array(1, $tablePermissions)) {
264
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'permissions', '', true);
265
        }
266
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer', '', true);
267
268
        return $ret;
269
    }
270
271
    /*
272
    *  @private function getXoopsVersionTemplatesLine
273
    *  @param $moduleDirname
274
    */
275
    /**
276
     * @param $moduleDirname
277
     *
278
     * @return string
279
     */
280
    private function getXoopsVersionTemplatesLine($moduleDirname, $type, $extra = '', $isAdmin = false)
281
    {
282
        $ret = '';
283
        $desc = "'description' => ''";
284
        $arrayFile = "array('file' =>";
285
        if ($isAdmin) {
286
            $ret .= $this->uc->getUserModVersion(2, "{$arrayFile} '{$moduleDirname}_admin_{$type}.tpl', {$desc}, 'type' => 'admin')", 'templates', '');
287
        } else {
288
            if ($extra !== '') {
289
                $ret .= $this->uc->getUserModVersion(2, "{$arrayFile} '{$moduleDirname}_{$type}_{$extra}.tpl', {$desc})", 'templates', '');
290
            } else {
291
                $ret .= $this->uc->getUserModVersion(2, "{$arrayFile} '{$moduleDirname}_{$type}.tpl', {$desc})", 'templates', '');
292
            }
293
        }
294
295
        return $ret;
296
    }
297
298
    /*
299
    *  @private function getXoopsVersionTemplatesUser
300
    *  @param $moduleDirname
301
    */
302
    /**
303
     * @param $moduleDirname
304
     *
305
     * @return string
306
     */
307
    private function getXoopsVersionTemplatesUser($moduleDirname, $tables)
308
    {
309
        $ret = $this->phpcode->getPhpCodeCommentLine('User');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
310
311
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'header', '');
312
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'index', '');
313
        $tableBroken = array();
314
        $tablePdf = array();
315
        $tablePrint = array();
316
        $tableRate = array();
317
        $tableRss = array();
318
        $tableSearch = array();
319
        $tableSingle = array();
320
        $tableSubmit = array();
321
        foreach (array_keys($tables) as $t) {
322
            $tableName = $tables[$t]->getVar('table_name');
323
            $tableBroken[] = $tables[$t]->getVar('table_broken');
324
            $tablePdf[] = $tables[$t]->getVar('table_pdf');
325
            $tablePrint[] = $tables[$t]->getVar('table_print');
326
            $tableRate[] = $tables[$t]->getVar('table_rate');
327
            $tableRss[] = $tables[$t]->getVar('table_rss');
328
            $tableSearch[] = $tables[$t]->getVar('table_search');
329
            $tableSingle[] = $tables[$t]->getVar('table_single');
330
            $tableSubmit[] = $tables[$t]->getVar('table_submit');
331
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, '');
332
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, 'list');
333
        }
334
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'breadcrumbs', '');
335
        if (in_array(1, $tableBroken)) {
336
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'broken', '');
337
        }
338
        if (in_array(1, $tablePdf)) {
339
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'pdf', '');
340
        }
341
        if (in_array(1, $tablePrint)) {
342
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'print', '');
343
        }
344
        if (in_array(1, $tableRate)) {
345
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'rate', '');
346
        }
347
        if (in_array(1, $tableRss)) {
348
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'rss', '');
349
        }
350
        if (in_array(1, $tableSearch)) {
351
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'search', '');
352
        }
353
        if (in_array(1, $tableSingle)) {
354
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'single', '');
355
        }
356
        if (in_array(1, $tableSubmit)) {
357
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'submit', '');
358
        }
359
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer', '');
360
361
        return $ret;
362
    }
363
364
    /*
365
    *  @private function getXoopsVersionSubmenu
366
    *  @param $language
367
    */
368
    /**
369
     * @param $language
370
     *
371
     * @return string
372
     */
373
    private function getXoopsVersionSubmenu($language, $tables)
374
    {
375
        $ret = $this->getDashComment('Submenu');
376
        $i = 1;
377
        $tableSubmit = array();
378
        foreach (array_keys($tables) as $t) {
379
            $tableName = $tables[$t]->getVar('table_name');
380
            $tableSubmit[] = $tables[$t]->getVar('table_submit');
381
            if (1 == $tables[$t]->getVar('table_submenu')) {
382
                $ret .= $this->phpcode->getPhpCodeCommentLine('Sub', $tableName);
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
383
                $tname = array('name' => "{$language}SMNAME{$i}", 'url' => "'{$tableName}.php'");
384
                $ret .= $this->uc->getUserModVersion(3, $tname, 'sub', $i);
385
            }
386
            ++$i;
387
        }
388
        if (in_array(1, $tableSubmit)) {
389
            $ret .= $this->phpcode->getPhpCodeCommentLine('Sub', 'Submit');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
390
            $submit = array('name' => "{$language}SMNAME{$i}", 'url' => "'submit.php'");
391
            $ret .= $this->uc->getUserModVersion(3, $submit, 'sub', $i);
392
        }
393
        unset($i);
394
395
        return $ret;
396
    }
397
398
    /*
399
    *  @private function getXoopsVersionBlocks
400
    *  @param $moduleDirname
401
    *  @param $language
402
    */
403
    /**
404
     * @param $moduleDirname
405
     * @param $language
406
     *
407
     * @return string
408
     */
409
    private function getXoopsVersionBlocks($moduleDirname, $tables, $language)
410
    {
411
        $ret = $this->getDashComment('Blocks');
412
        $ret .= $this->getSimpleString('$b = 1;');
413
        $tableCategory = array();
414
        foreach (array_keys($tables) as $i) {
415
            $tableName = $tables[$i]->getVar('table_name');
416
            $tableFieldName = $tables[$i]->getVar('table_fieldname');
417
            $tableSoleName = $tables[$i]->getVar('table_solename');
418
            $stuTableSoleName = strtoupper($tableSoleName);
419
            $tableCategory[] = $tables[$i]->getVar('table_category');
420
            if (in_array(1, $tableCategory)) {
421
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTableSoleName, $language, $tableFieldName);
422
            } else {
423
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'LAST', $language, 'last');
424
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'NEW', $language, 'new');
425
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'HITS', $language, 'hits');
426
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'TOP', $language, 'top');
427
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'RANDOM', $language, 'random');
428
            }
429
        }
430
        $ret .= $this->getSimpleString('unset($b);');
431
432
        return $ret;
433
    }
434
435
    /*
436
    *  @private function getXoopsVersionTypeBlocks
437
    *  @param $moduleDirname
438
    *  @param $language
439
    */
440
    /**
441
     * @param $moduleDirname
442
     * @param $language
443
     *
444
     * @return string
445
     */
446
    private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTableSoleName, $language, $type)
447
    {
448
        $stuTableName = strtoupper($tableName);
449
        $ucfTableName = ucfirst($tableName);
450
        $ret = $this->phpcode->getPhpCodeCommentLine("{$ucfTableName}");
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
451
        $blocks = array('file' => "'{$tableName}.php'", 'name' => "{$language}{$stuTableName}_BLOCK_{$stuTableSoleName}", 'description' => "{$language}{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC",
452
                        'show_func' => "'b_{$moduleDirname}_{$tableName}_show'", 'edit_func' => "'b_{$moduleDirname}_{$tableName}_edit'",
453
                        'template' => "'{$moduleDirname}_block_{$tableName}.tpl'", 'options' => "'{$type}|5|25|0'", );
454
        $ret .= $this->uc->getUserModVersion(3, $blocks, 'blocks', '$b');
455
        $ret .= $this->getSimpleString('++$b;');
456
457
        return $ret;
458
    }
459
460
    /*
461
    *  @private function getXoopsVersionConfig
462
    *  @param $moduleDirname
463
    *  @param $language
464
    */
465
    /**
466
     * @param $module
467
     * @param $table
468
     * @param $language
469
     *
470
     * @return string
471
     */
472
    private function getXoopsVersionConfig($module, $table, $language)
473
    {
474
        $moduleDirname = $module->getVar('mod_dirname');
475
        $ret = $this->getDashComment('Config');
476
        $ret .= $this->getSimpleString('$c = 1;');
477
        $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'));
478
        foreach (array_keys($fields) as $f) {
479
            if ($fields[$f]->getVar('field_element') == 4) {
480
                $fieldName = $fields[$f]->getVar('field_name');
481
                $rpFieldName = $this->getRightString($fieldName);
482
                $ucfFieldName = ucfirst($rpFieldName);
483
                $stuFieldName = strtoupper($rpFieldName);
484
                $ret .= $this->phpcode->getPhpCodeCommentLine('Editor', $rpFieldName);
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
485
                $ret .= $this->xc->getXcLoad('xoopseditorhandler');
486
                $ret .= $this->xc->getXcEqualsOperator('$editorHandler'.$ucfFieldName, 'XoopsEditorHandler::getInstance()');
487
                $editor = array('name' => "'{$moduleDirname}_editor_{$rpFieldName}'", 'title' => "'{$language}EDITOR_{$stuFieldName}'", 'description' => "'{$language}EDITOR_{$stuFieldName}_DESC'",
488
                        'formtype' => "'select'", 'valuetype' => "'text'", 'default' => "'dhtml'", 'options' => 'array_flip($editorHandler'.$ucfFieldName.'->getList())', );
489
                $ret .= $this->uc->getUserModVersion(3, $editor, 'config', '$c');
490
                $ret .= $this->getSimpleString('++$c;');
491
            }
492
        }
493
494
        if (1 == $table->getVar('table_permissions')) {
495
            $ret .= $this->phpcode->getPhpCodeCommentLine('Get groups');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
496
            $ret .= $this->xc->getXcEqualsOperator('$memberHandler ', "xoops_gethandler('member')", true);
497
            $ret .= $this->xc->getXcEqualsOperator('$xoopsGroups ', '$memberHandler->getGroupList()');
498
            $group = $this->xc->getXcEqualsOperator('$groups[$group] ', '$key');
499
            $ret .= $this->phpcode->getPhpCodeForeach('xoopsGroups', false, 'key', 'group', $group);
0 ignored issues
show
Bug introduced by
The method getPhpCodeForeach cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
500
            $groups = array('name' => "'groups'", 'title' => "'{$language}GROUPS'", 'description' => "'{$language}GROUPS_DESC'",
501
                        'formtype' => "'select_multi'", 'valuetype' => "'array'", 'default' => '$groups', 'options' => '$groups', );
502
            $ret .= $this->uc->getUserModVersion(3, $groups, 'config', '$c');
503
            $ret .= $this->getSimpleString('++$c;');
504
            $ret .= $this->phpcode->getPhpCodeCommentLine('Get Admin groups');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
505
            $ret .= $this->xc->getXcEqualsOperator('$criteria ', 'new CriteriaCompo()');
506
            $ret .= $this->getSimpleString("\$criteria->add( new Criteria( 'group_type', 'Admin' ) );");
507
            $ret .= $this->xc->getXcEqualsOperator('$memberHandler ', "xoops_gethandler('member')", true);
508
            $ret .= $this->xc->getXcEqualsOperator('$adminXoopsGroups ', '$memberHandler->getGroupList($criteria)');
509
            $adminGroup = $this->xc->getXcEqualsOperator('$adminGroups[$adminGroup] ', '$key');
510
            $ret .= $this->phpcode->getPhpCodeForeach('adminXoopsGroups', false, 'key', 'adminGroup', $adminGroup);
0 ignored issues
show
Bug introduced by
The method getPhpCodeForeach cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
511
            $adminGroups = array('name' => "'admin_groups'", 'title' => "'{$language}GROUPS'", 'description' => "'{$language}GROUPS_DESC'",
512
                        'formtype' => "'select_multi'", 'valuetype' => "'array'", 'default' => '$adminGroups', 'options' => '$adminGroups', );
513
            $ret .= $this->uc->getUserModVersion(3, $adminGroups, 'config', '$c');
514
            $ret .= $this->getSimpleString('++$c;');
515
        }
516
        $keyword = implode(', ', $this->getKeywords());
517
        $ret .= $this->phpcode->getPhpCodeCommentLine('Keywords');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
518
        $arrayKeyword = array('name' => "'keywords'", 'title' => "'{$language}KEYWORDS'", 'description' => "'{$language}KEYWORDS_DESC'",
519
                        'formtype' => "'textbox'", 'valuetype' => "'text'", 'default' => "'{$moduleDirname}, {$keyword}'", );
520
        $ret .= $this->uc->getUserModVersion(3, $arrayKeyword, 'config', '$c');
521
        $ret .= $this->getSimpleString('++$c;');
522
        unset($this->keywords);
523
        $fieldElement = array();
524
        foreach (array_keys($fields) as $f) {
525
            $fieldElement[] = $fields[$f]->getVar('field_element');
526
        }
527
        if (in_array(10, $fieldElement) || in_array(11, $fieldElement) || in_array(12, $fieldElement) || in_array(13, $fieldElement) || in_array(14, $fieldElement)) {
528
            $ret .= $this->phpcode->getPhpCodeCommentLine('Uploads : maxsize of image');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
529
            $maxsize = array('name' => "'maxsize'", 'title' => "'{$language}MAXSIZE'", 'description' => "'{$language}MAXSIZE_DESC'",
530
                'formtype' => "'textbox'", 'valuetype' => "'int'", 'default' => '5000000', );
531
            $ret .= $this->uc->getUserModVersion(3, $maxsize, 'config', '$c');
532
            $ret .= $this->phpcode->getPhpCodeCommentLine('Uploads : mimetypes of image');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
533
            $ret .= $this->getSimpleString('++$c;');
534
            $mimetypes = array('name' => "'mimetypes'", 'title' => "'{$language}MIMETYPES'", 'description' => "'{$language}MIMETYPES_DESC'",
535
                'formtype' => "'select_multi'", 'valuetype' => "'array'", 'default' => "array('image/gif', 'image/jpeg', 'image/png')",
536
                'options' => "array('bmp' => 'image/bmp','gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png')", );
537
            $ret .= $this->uc->getUserModVersion(3, $mimetypes, 'config', '$c');
538
            $ret .= $this->getSimpleString('++$c;');
539
        }
540
        if (1 == $table->getVar('table_admin')) {
541
            $ret .= $this->phpcode->getPhpCodeCommentLine('Admin pager');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
542
            $adminPager = array('name' => "'adminpager'", 'title' => "'{$language}ADMIN_PAGER'", 'description' => "'{$language}ADMIN_PAGER_DESC'",
543
                    'formtype' => "'textbox'", 'valuetype' => "'int'", 'default' => '10', );
544
            $ret .= $this->uc->getUserModVersion(3, $adminPager, 'config', '$c');
545
            $ret .= $this->getSimpleString('++$c;');
546
        }
547
        if (1 == $table->getVar('table_user')) {
548
            $ret .= $this->phpcode->getPhpCodeCommentLine('User pager');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
549
            $userPager = array('name' => "'userpager'", 'title' => "'{$language}USER_PAGER'", 'description' => "'{$language}USER_PAGER_DESC'",
550
                    'formtype' => "'textbox'", 'valuetype' => "'int'", 'default' => '10', );
551
            $ret .= $this->uc->getUserModVersion(3, $userPager, 'config', '$c');
552
            $ret .= $this->getSimpleString('++$c;');
553
        }
554
        if (1 == $table->getVar('table_tag')) {
555
            $ret .= $this->phpcode->getPhpCodeCommentLine('Use tag');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
556
            $useTag = array('name' => "'usetag'", 'title' => "'{$language}USE_TAG'", 'description' => "'{$language}USE_TAG_DESC'",
557
                    'formtype' => "'yesno'", 'valuetype' => "'int'", 'default' => '0', );
558
            $ret .= $this->uc->getUserModVersion(3, $useTag, 'config', '$c');
559
            $ret .= $this->getSimpleString('++$c;');
560
        }
561
        $ret .= $this->phpcode->getPhpCodeCommentLine('Number column');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
562
        $numbCol = array('name' => "'numb_col'", 'title' => "'{$language}NUMB_COL'", 'description' => "'{$language}NUMB_COL_DESC'",
563
                        'formtype' => "'select'", 'valuetype' => "'int'", 'default' => '1', 'options' => "array(1 => '1', 2 => '2', 3 => '3', 4 => '4')", );
564
        $ret .= $this->uc->getUserModVersion(3, $numbCol, 'config', '$c');
565
        $ret .= $this->getSimpleString('++$c;');
566
        $ret .= $this->phpcode->getPhpCodeCommentLine('Divide by');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
567
        $divideby = array('name' => "'divideby'", 'title' => "'{$language}DIVIDEBY'", 'description' => "'{$language}DIVIDEBY_DESC'",
568
                        'formtype' => "'select'", 'valuetype' => "'int'", 'default' => '1', 'options' => "array(1 => '1', 2 => '2', 3 => '3', 4 => '4')", );
569
        $ret .= $this->uc->getUserModVersion(3, $divideby, 'config', '$c');
570
        $ret .= $this->getSimpleString('++$c;');
571
        $ret .= $this->phpcode->getPhpCodeCommentLine('Table type');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
572
        $tableType = array('name' => "'table_type'", 'title' => "'{$language}DIVIDEBY'", 'description' => "'{$language}DIVIDEBY_DESC'",
573
                        'formtype' => "'select'", 'valuetype' => "'int'", 'default' => "'bordered'", 'options' => "array('bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed')", );
574
        $ret .= $this->uc->getUserModVersion(3, $tableType, 'config', '$c');
575
        $ret .= $this->getSimpleString('++$c;');
576
        $ret .= $this->phpcode->getPhpCodeCommentLine('Panel by');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
577
        $panelType = array('name' => "'panel_type'", 'title' => "'{$language}PANEL_TYPE'", 'description' => "'{$language}PANEL_TYPE_DESC'",
578
                        'formtype' => "'select'", 'valuetype' => "'text'", 'default' => "'default'", 'options' => "array('default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger')", );
579
        $ret .= $this->uc->getUserModVersion(3, $panelType, 'config', '$c');
580
        $ret .= $this->getSimpleString('++$c;');
581
        $ret .= $this->phpcode->getPhpCodeCommentLine('Panel by');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
582
        $advertise = array('name' => "'advertise'", 'title' => "'{$language}ADVERTISE'", 'description' => "'{$language}ADVERTISE_DESC'",
583
                        'formtype' => "'textarea'", 'valuetype' => "'text'", 'default' => "''", );
584
        $ret .= $this->uc->getUserModVersion(3, $advertise, 'config', '$c');
585
        $ret .= $this->getSimpleString('++$c;');
586
        $ret .= $this->phpcode->getPhpCodeCommentLine('Panel by');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
587
        $bookmarks = array('name' => "'bookmarks'", 'title' => "'{$language}BOOKMARKS'", 'description' => "'{$language}BOOKMARKS_DESC'",
588
                        'formtype' => "'yesno'", 'valuetype' => "'int'", 'default' => '0', );
589
        $ret .= $this->uc->getUserModVersion(3, $bookmarks, 'config', '$c');
590
        $ret .= $this->getSimpleString('++$c;');
591
        $ret .= $this->phpcode->getPhpCodeCommentLine('Facebook Comments');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
592
        $facebookComments = array('name' => "'facebook_comments'", 'title' => "'{$language}FACEBOOK_COMMENTS'", 'description' => "'{$language}FACEBOOK_COMMENTS_DESC'",
593
                        'formtype' => "'yesno'", 'valuetype' => "'int'", 'default' => '0', );
594
        $ret .= $this->uc->getUserModVersion(3, $facebookComments, 'config', '$c');
595
        $ret .= $this->getSimpleString('++$c;');
596
        $ret .= $this->phpcode->getPhpCodeCommentLine('Disqus Comments');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
597
        $disqusComments = array('name' => "'disqus_comments'", 'title' => "'{$language}DISQUS_COMMENTS'", 'description' => "'{$language}DISQUS_COMMENTS_DESC'",
598
                        'formtype' => "'yesno'", 'valuetype' => "'int'", 'default' => '0', );
599
        $ret .= $this->uc->getUserModVersion(3, $disqusComments, 'config', '$c');
600
        $ret .= $this->getSimpleString('++$c;');
601
        $ret .= $this->phpcode->getPhpCodeCommentLine('Maintained by');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
602
        $maintainedby = array('name' => "'maintainedby'", 'title' => "'{$language}MAINTAINEDBY'", 'description' => "'{$language}MAINTAINEDBY_DESC'",
603
                        'formtype' => "'textbox'", 'valuetype' => "'text'", 'default' => "'{$module->getVar('mod_support_url')}'", );
604
        $ret .= $this->uc->getUserModVersion(3, $maintainedby, 'config', '$c');
605
        $ret .= $this->getSimpleString('unset($c);');
606
607
        return $ret;
608
    }
609
610
    /*
611
    *  @private function getNotificationsType
612
    *  @param $language
613
    *  @param $type
614
    *  @param $tableName
615
    *  @param $item
616
    *  @param $typeOfNotify
617
    */
618
    /**
619
     * @param $language
620
     * @param $type
621
     * @param $tableName
622
     * @param $notifyFile
623
     * @param $item
624
     * @param $typeOfNotify
625
     *
626
     * @return string
627
     */
628
    private function getNotificationsType($language, $type = 'category', $tableName, $notifyFile, $item, $typeOfNotify)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
629
    {
630
        $stuTableName = strtoupper($tableName);
631
        $stuTypeOfNotify = strtoupper($typeOfNotify);
632
        $notifyFile = explode(', ', $notifyFile);
633
        $notifyFile = implode(', ', $notifyFile);
634
        $ret = '';
635
        switch ($type) {
636
            case 'category':
637
                $ret .= $this->phpcode->getPhpCodeCommentLine('Category Notify');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
638
                $category = array('name' => "'category'", 'title' => "'{$language}{$stuTableName}_NOTIFY'", 'description' => "'{$language}{$stuTableName}_NOTIFY_DESC'",
639
                                    'subscribe_from' => "array('index.php',{$notifyFile})", 'item_name' => "'{$item}'", "'allow_bookmark'" => '1', );
640
                $ret .= $this->uc->getUserModVersion(3, $category, 'notification', "'{$type}'");
641
                break;
642
            case 'event':
643
                $ret .= $this->phpcode->getPhpCodeCommentLine('Event Notify');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
644
                $event = array('name' => "'{$typeOfNotify}'", 'category' => "'{$tableName}'", 'admin_only' => '1', "'title'" => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY'",
645
                                'caption' => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY_CAPTION'", 'description' => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY_DESC'",
646
                                'mail_template' => "'{$tableName}_{$typeOfNotify}_notify'", 'mail_subject' => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY_SUBJECT'", );
647
                $ret .= $this->uc->getUserModVersion(3, $event, 'notification', "'{$type}'");
648
                break;
649
        }
650
651
        return $ret;
652
    }
653
654
    /*
655
    *  @private function getXoopsVersionNotifications
656
    *  @param $moduleDirname
657
    *  @param $language
658
    */
659
    /**
660
     * @param $moduleDirname
661
     * @param $language
662
     *
663
     * @return string
664
     */
665
    private function getXoopsVersionNotifications($module, $language)
666
    {
667
        $moduleDirname = $module->getVar('mod_dirname');
668
        $ret = $this->getDashComment('Notifications');
669
        $ret .= $this->uc->getUserModVersion(1, 1, 'hasNotification');
670
        $notifications = array("'lookup_file'" => "'include/notification.inc.php'", "'lookup_func'" => "'{$moduleDirname}_notify_iteminfo'");
671
        $ret .= $this->uc->getUserModVersion(2, $notifications, 'notification');
672
673
        $notifyFiles = array();
674
        $single = 'single';
675
        $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order');
676
        $tableCategory = array();
677
        $tableBroken = array();
678
        $tableSubmit = array();
679
        $tableId = null;
680
        $tableMid = null;
681
        foreach (array_keys($tables) as $t) {
682
            $tableId = $tables[$t]->getVar('table_id');
683
            $tableMid = $tables[$t]->getVar('table_mid');
684
            $tableName = $tables[$t]->getVar('table_name');
685
            $tableCategory[] = $tables[$t]->getVar('table_category');
686
            $tableBroken[] = $tables[$t]->getVar('table_broken');
687
            $tableSubmit[] = $tables[$t]->getVar('table_submit');
688
            if (1 == $tables[$t]->getVar('table_notifications')) {
689
                if ($t <= count($tableName)) {
690
                    $notifyFiles[] = $tables[$t]->getVar('table_name');
691
                }
692
            }
693
            if (1 == $tables[$t]->getVar('table_single')) {
694
                $single = $tableName;
695
            }
696
        }
697
        $fields = $this->getTableFields($tableMid, $tableId);
698
        $fieldId = null;
699
        $fieldParent = null;
700
        foreach (array_keys($fields) as $f) {
701
            $fieldName = $fields[$f]->getVar('field_name');
702
            $fieldElement = $fields[$f]->getVar('field_element');
703
            if (0 == $f) {
704
                $fieldId = $fieldName;
705
            }
706
            if ($fieldElement > 15) {
707
                $fieldParent = $fieldName;
708
            }
709
        }
710
711
        $num = 1;
712
        $ret .= $this->getXoopsVersionNotificationGlobal($language, 'category', 'global', 'global', $notifyFiles, $num);
713
        ++$num;
714
        $ret .= $this->getXoopsVersionNotificationCategory($language, 'category', 'category', 'category', $notifyFiles, $fieldParent, '1', $num);
715
        ++$num;
716
        $ret .= $this->getXoopsVersionNotificationTableName($language, 'category', 'file', 'file', $single, $fieldId, 1, $num);
717
        unset($num);
718
        $num = 1;
719
        if (in_array(1, $tableCategory)) {
720
            $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'new_category', 'global', 0, 'global', 'newcategory', 'global_newcategory_notify', $num);
721
            ++$num;
722
        }
723
        $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'file_modify', 'global', 1, 'global', 'filemodify', 'global_filemodify_notify', $num);
724
        if (in_array(1, $tableBroken)) {
725
            ++$num;
726
            $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'file_broken', 'global', 1, 'global', 'filebroken', 'global_filebroken_notify', $num);
727
        }
728
        if (in_array(1, $tableSubmit)) {
729
            ++$num;
730
            $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'file_submit', 'global', 1, 'global', 'filesubmit', 'global_filesubmit_notify', $num);
731
        }
732
        ++$num;
733
        $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'new_file', 'global', 0, 'global', 'newfile', 'global_newfile_notify', $num);
734
        if (in_array(1, $tableCategory)) {
735
            ++$num;
736
            $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'file_submit', 'category', 1, 'category', 'filesubmit', 'category_filesubmit_notify', $num);
737
            ++$num;
738
            $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'new_file', 'category', 0, 'category', 'newfile', 'category_newfile_notify', $num);
739
        }
740
        ++$num;
741
        $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'approve', 'file', 1, 'file', 'approve', 'file_approve_notify', $num);
742
        unset($num);
743
744
        return $ret;
745
    }
746
747
    /*
748
    *  @private function getXoopsVersionNotificationGlobal
749
    */
750
    /**
751
     * @param $language
752
     * @param $type
753
     * @param $name
754
     * @param $title
755
     * @param $from
756
     *
757
     * @return string
758
     */
759
    private function getXoopsVersionNotificationGlobal($language, $type, $name, $title, $from, $num)
760
    {
761
        $title = strtoupper($title);
762
        $implodeFrom = implode(".php', '", $from);
763
        $ret = $this->phpcode->getPhpCodeCommentLine('Global Notify');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
764
        $global = array('name' => "'{$name}'", 'title' => "{$language}{$title}_NOTIFY", 'description' => "{$language}{$title}_NOTIFY_DESC",
765
                        'subscribe_from' => "array('index.php', '{$implodeFrom}.php')", );
766
        $ret .= $this->uc->getUserModVersion(4, $global, 'notification', "'{$type}'", $num);
767
768
        return $ret;
769
    }
770
771
    /*
772
    *  @private function getXoopsVersionNotificationCategory
773
    */
774
    /**
775
     * @param $language
776
     * @param $type
777
     * @param $name
778
     * @param $title
779
     * @param $from
780
     *
781
     * @return string
782
     */
783
    private function getXoopsVersionNotificationCategory($language, $type, $name, $title, $file, $item, $allow, $num)
784
    {
785
        $title = strtoupper($title);
786
        $impFile = implode(".php', '", $file);
787
        $ret = $this->phpcode->getPhpCodeCommentLine('Category Notify');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
788
        $global = array('name' => "'{$name}'", 'title' => "{$language}{$title}_NOTIFY", 'description' => "{$language}{$title}_NOTIFY_DESC",
789
                        'subscribe_from' => "array('{$impFile}.php')", 'item_name' => "'{$item}'", 'allow_bookmark' => "{$allow}", );
790
        $ret .= $this->uc->getUserModVersion(4, $global, 'notification', "'{$type}'", $num);
791
792
        return $ret;
793
    }
794
795
    /*
796
    *  @private function getXoopsVersionNotificationTableName
797
    */
798
    /**
799
     * @param $language
800
     * @param $type
801
     * @param $name
802
     * @param $title
803
     * @param $file
804
     * @param $item
805
     * @param $allow
806
     *
807
     * @return string
808
     */
809
    private function getXoopsVersionNotificationTableName($language, $type, $name, $title, $file, $item = 'cid', $allow = 1, $num)
810
    {
811
        $stuTitle = strtoupper($title);
812
        $ucfTitle = ucfirst($title);
813
        $ret = $this->phpcode->getPhpCodeCommentLine($ucfTitle.' Notify');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
814
        $table = array('name' => "'{$name}'", 'title' => "{$language}{$stuTitle}_NOTIFY", 'description' => "{$language}{$stuTitle}_NOTIFY_DESC",
815
                        'subscribe_from' => "'{$file}.php'", 'item_name' => "'{$item}'", 'allow_bookmark' => "{$allow}", );
816
        $ret .= $this->uc->getUserModVersion(4, $table, 'notification', "'{$type}'", $num);
817
818
        return $ret;
819
    }
820
821
    /*
822
    *  @private function getXoopsVersionNotifications
823
    */
824
    /**
825
     * @param $language
826
     * @param $type
827
     * @param $name
828
     * @param $title
829
     * @param $from
830
     * @param $item
831
     * @param $mail
832
     *
833
     * @return string
834
     */
835
    private function getXoopsVersionNotificationCodeComplete($language, $type, $name, $category, $admin = 1, $title, $table, $mail, $num)
836
    {
837
        $title = strtoupper($title);
838
        $table = strtoupper($table);
839
        $ucfTitle = ucfirst($title);
840
        $ret = $this->phpcode->getPhpCodeCommentLine($ucfTitle.' Notify');
0 ignored issues
show
Bug introduced by
The method getPhpCodeCommentLine cannot be called on $this->phpcode (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
841
        $event = array('name' => "'{$name}'", 'category' => "'{$category}'", 'admin_only' => "{$admin}", 'title' => "{$language}{$title}_{$table}_NOTIFY",
842
                        'caption' => "{$language}{$title}_{$table}_NOTIFY_CAPTION", 'description' => "{$language}{$title}_{$table}_NOTIFY_DESC",
843
                        'mail_template' => "'{$mail}'", 'mail_subject' => "{$language}{$title}_{$table}_NOTIFY_SUBJECT", );
844
        $ret .= $this->uc->getUserModVersion(4, $event, 'notification', "'{$type}'", $num);
845
846
        return $ret;
847
    }
848
849
    /*
850
    *  @public function render
851
    *  @param null
852
    */
853
    /**
854
     * @return bool|string
855
     */
856
    public function render()
857
    {
858
        $module = $this->getModule();
859
        $table = $this->getTable();
860
        $tables = $this->getTables();
861
        $filename = $this->getFileName();
862
        $moduleDirname = $module->getVar('mod_dirname');
863
        $language = $this->getLanguage($moduleDirname, 'MI');
864
        $content = $this->getHeaderFilesComments($module, $filename);
865
        $content .= $this->getXoopsVersionHeader($module, $language);
866
        if (1 == $module->getVar('mod_admin')) {
867
            $content .= $this->getXoopsVersionTemplatesAdmin($moduleDirname, $tables);
868
        }
869
        if (1 == $module->getVar('mod_user')) {
870
            $content .= $this->getXoopsVersionTemplatesUser($moduleDirname, $tables);
871
        }
872
        $content .= $this->getXoopsVersionMySQL($moduleDirname, $table, $tables);
873
        $tableSearch = array();
874
        $tableComments = array();
875
        $tableSubmenu = array();
876
        $tableBlocks = array();
877
        $tableNotifications = array();
878
        foreach (array_keys($tables) as $t) {
879
            $tableSearch[] = $tables[$t]->getVar('table_search');
880
            $tableComments[] = $tables[$t]->getVar('table_comments');
881
            $tableSubmenu[] = $tables[$t]->getVar('table_submenu');
882
            $tableBlocks[] = $tables[$t]->getVar('table_blocks');
883
            $tableNotifications[] = $tables[$t]->getVar('table_notifications');
884
        }
885
        if (in_array(1, $tableSearch)) {
886
            $content .= $this->getXoopsVersionSearch($moduleDirname);
887
        }
888
        if (in_array(1, $tableComments)) {
889
            $content .= $this->getXoopsVersionComments($moduleDirname);
890
        }
891
        if (in_array(1, $tableSubmenu)) {
892
            $content .= $this->getXoopsVersionSubmenu($language, $tables);
893
        }
894
        if (in_array(1, $tableBlocks)) {
895
            $content .= $this->getXoopsVersionBlocks($moduleDirname, $tables, $language);
896
        }
897
        $content .= $this->getXoopsVersionConfig($module, $table, $language);
898
        if (in_array(1, $tableNotifications)) {
899
            $content .= $this->getXoopsVersionNotifications($module, $language);
900
        }
901
        $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
902
903
        return $this->renderFile();
904
    }
905
}
906