Completed
Push — master ( 3f0046...b1c777 )
by Gino
06:41 queued 03:19
created

TDMCreateArchitecture   F

Complexity

Total Complexity 54

Size/Duplication

Total Lines 577
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 70
Metric Value
wmc 54
lcom 1
cbo 70
dl 0
loc 577
rs 1.6712

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getInstance() 0 9 2
F setBaseFoldersFiles() 0 101 17
F setFilesToBuilding() 0 414 34

How to fix   Complexity   

Complex Class

Complex classes like TDMCreateArchitecture 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

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 TDMCreateArchitecture, and based on these observations, apply Extract Interface, too.

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 28 and the first side effect is on line 24.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
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: TDMCreateArchitecture.php 12258 2014-01-02 09:33:29Z timgno $
23
 */
24
include dirname(__DIR__).'/autoload.php';
25
/**
26
 * Class TDMCreateArchitecture.
27
 */
28
class TDMCreateArchitecture extends TDMCreateStructure
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 $tdmcreate = null;
34
35
    /*
36
    * @var mixed
37
    */
38
    private $tdmcfile = null;
39
40
    /*
41
    *  @public function constructor class
42
    *  @param null
43
    */
44
    /**
45
     *
46
     */
47
    public function __construct()
48
    {
49
        parent::__construct();
50
        $this->tdmcreate = TDMCreateHelper::getInstance();
51
        $this->tdmcfile = TDMCreateFile::getInstance();
52
        $this->setUploadPath(TDMC_UPLOAD_REPOSITORY_PATH);
53
    }
54
55
    /*
56
    *  @static function &getInstance
57
    *  @param null
58
    */
59
    /**
60
     * @return TDMCreateArchitecture
61
     */
62
    public static function &getInstance()
63
    {
64
        static $instance = false;
65
        if (!$instance) {
66
            $instance = new self();
67
        }
68
69
        return $instance;
70
    }
71
72
    /*
73
    *  @public function setBaseFoldersFiles
74
    *  @param string $module
75
    */
76
    /**
77
     * @param $module
78
     */
79
    public function setBaseFoldersFiles($module)
80
    {
81
        global $xoopsConfig;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
82
        // Module
83
        $modId = $module->getVar('mod_id');
84
        $language = $xoopsConfig['language'];
85
        // Id of tables
86
        $tables = $this->tdmcfile->getTableTables($modId);
87
        //
88
        $table = null;
89
        foreach (array_keys($tables) as $t) {
90
            $tableId = $tables[$t]->getVar('table_id');
91
            $tableName = $tables[$t]->getVar('table_name');
92
            $table = $this->tdmcreate->getHandler('tables')->get($tableId);
93
        }
94
        //
95
        $indexFile = XOOPS_UPLOAD_PATH.'/index.html';
96
        $stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author')));
97
        $this->setModuleName($module->getVar('mod_dirname'));
98
        $uploadPath = $this->getUploadPath();
99
        // Creation of "module" folder in the Directory repository
100
        $this->makeDir($uploadPath.'/'.$this->getModuleName());
101
        if (1 != $module->getVar('mod_user')) {
102
            // Copied of index.html file in "root module" folder
103
            $this->copyFile('', $indexFile, 'index.html');
104
        }
105
        if (1 == $module->getVar('mod_admin')) {
106
            // Creation of "admin" folder and index.html file
107
            $this->makeDirAndCopyFile('admin', $indexFile, 'index.html');
108
        }
109
        if (1 == $module->getVar('mod_blocks')) {
110
            // Creation of "blocks" folder and index.html file
111
            $this->makeDirAndCopyFile('blocks', $indexFile, 'index.html');
112
        }
113
        $copyFiles = array('class' => $indexFile, 'include' => $indexFile, 'language' => $indexFile, 'assets' => $indexFile, 'assets/css' => $indexFile,
114
                        'assets/icons' => $indexFile, 'assets/icons/16' => $indexFile, 'assets/icons/32' => $indexFile, 'docs' => $indexFile,
115
                        'assets/images' => $indexFile, 'assets/js' => $indexFile, 'language/english' => $indexFile, 'language/english/help' => $indexFile, );
116
        foreach ($copyFiles as $k => $v) {
117
            // Creation of folders and index.html file
118
            $this->makeDirAndCopyFile($k, $v, 'index.html');
119
        }
120
        //Copy the logo of the module
121
        $modImage = str_replace(' ', '', strtolower($module->getVar('mod_image')));
122
        $this->copyFile('assets/images', TDMC_UPLOAD_IMGMOD_PATH.'/'.$modImage, $modImage);
123
        // Copy of 'module_author_logo.gif' file in uploads dir
124
        $logoGifFrom = TDMC_UPLOAD_IMGMOD_PATH.'/'.$stlModuleAuthor.'_logo.gif';
125
        // If file exists
126
        if (!file_exists($logoGifFrom)) {
127
            // Rename file
128
            $copyFile = TDMC_IMAGES_LOGOS_URL.'/xoopsdevelopmentteam_logo.gif';
129
            $copyNewFile = $logoGifFrom;
130
            copy($copyFile, $copyNewFile);
131
        } else {
132
            // Copy file
133
            $copyFile = TDMC_IMAGES_LOGOS_URL.'/'.$stlModuleAuthor.'_logo.gif';
134
            $copyNewFile = $logoGifFrom;
135
            copy($copyFile, $copyNewFile);
136
        }
137
        // Creation of 'module_author_logo.gif' file
138
        $this->copyFile('assets/images', $copyNewFile, $stlModuleAuthor.'_logo.gif');
139
        $docs = array('/credits.txt' => 'credits.txt', '/install.txt' => 'install.txt',
140
                    '/lang_diff.txt' => 'lang_diff.txt', '/license.txt' => 'license.txt', '/readme.txt' => 'readme.txt', );
141
        foreach ($docs as $k => $v) {
142
            // Creation of folder docs and .txt files
143
            $this->makeDirAndCopyFile('docs', TDMC_DOCS_PATH.$k, $v);
144
        }
145
        // Creation of 'default english' folder
146
        if ($language != 'english') {
147
            // Creation of "language/local_language" folder and index.html file
148
            $this->makeDirAndCopyFile('language/'.$language, $indexFile, 'index.html');
149
            // Creation of "language/local_language/help" folder and index.html file
150
            $this->makeDirAndCopyFile('language/'.$language.'/help', $indexFile, 'index.html');
151
        }
152
        // Creation of "preloads" folder and index.html file
153
        $this->makeDirAndCopyFile('preloads', $indexFile, 'index.html');
154
        if (1 == $module->getVar('mod_admin')) {
155
            // Creation of "templates" folder and index.html file
156
            $this->makeDirAndCopyFile('templates', $indexFile, 'index.html');
157
        }
158
        if (1 == $module->getVar('mod_admin')) {
159
            // Creation of "templates/admin" folder and index.html file
160
            $this->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html');
161
        }
162
        if (!empty($tableName)) {
163
            if ((1 == $module->getVar('mod_blocks')) && (1 == $table->getVar('table_blocks'))) {
164
                // Creation of "templates/blocks" folder and index.html file
165
                $this->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.html');
166
            }
167
            // Creation of "sql" folder and index.html file
168
            $this->makeDirAndCopyFile('sql', $indexFile, 'index.html');
169
            if ((1 == $module->getVar('mod_notifications')) && (1 == $table->getVar('table_notifications'))) {
170
                if ($language != 'english') {
171
                    // Creation of "language/local_language/mail_template" folder and index.html file
172
                    $this->makeDirAndCopyFile('language/'.$language.'/mail_template', $indexFile, 'index.html');
173
                } else {
174
                    // Creation of "language/english/mail_template" folder and index.html file
175
                    $this->makeDirAndCopyFile('language/english/mail_template', $indexFile, 'index.html');
176
                }
177
            }
178
        }
179
    }
180
181
    /*
182
    *  @public function setFilesToBuilding
183
    *  @param string $module
184
    */
185
    /**
186
     * @param $module
187
     *
188
     * @return array
189
     */
190
    public function setFilesToBuilding($module)
191
    {
192
        // Module
193
        $modId = $module->getVar('mod_id');
194
        $moduleDirname = $module->getVar('mod_dirname');
195
        $icon32 = 'assets/icons/32';
196
        $tables = $this->tdmcfile->getTableTables($modId);
197
        $files = $this->tdmcfile->getTableMoreFiles($modId);
198
        $ret = array();
199
        //
200
        $table = array();
201
        $tableCategory = array();
202
        $tableName = array();
0 ignored issues
show
Unused Code introduced by
$tableName is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
203
        $tableAdmin = array();
204
        $tableUser = array();
205
        $tableBlocks = array();
206
        $tableSearch = array();
207
        $tableComments = array();
208
        $tableNotifications = array();
209
        $tablePermissions = array();
210
        $tableBroken = array();
211
        $tablePdf = array();
212
        $tablePrint = array();
213
        $tableRate = array();
214
        $tableRss = array();
215
        $tableSingle = array();
216
        $tableSubmit = array();
217
        $tableVisit = array();
218
        $tableTag = array();
219
        foreach (array_keys($tables) as $t) {
220
            $tableId = $tables[$t]->getVar('table_id');
221
            $tableName = $tables[$t]->getVar('table_name');
222
            $tableCategory[] = $tables[$t]->getVar('table_category');
223
            $tableImage = $tables[$t]->getVar('table_image');
224
            $tableAdmin[] = $tables[$t]->getVar('table_admin');
225
            $tableUser[] = $tables[$t]->getVar('table_user');
226
            $tableBlocks[] = $tables[$t]->getVar('table_blocks');
227
            $tableSearch[] = $tables[$t]->getVar('table_search');
228
            $tableComments[] = $tables[$t]->getVar('table_comments');
229
            $tableNotifications[] = $tables[$t]->getVar('table_notifications');
230
            $tablePermissions[] = $tables[$t]->getVar('table_permissions');
231
            $tableBroken[] = $tables[$t]->getVar('table_broken');
232
            $tablePdf[] = $tables[$t]->getVar('table_pdf');
233
            $tablePrint[] = $tables[$t]->getVar('table_print');
234
            $tableRate[] = $tables[$t]->getVar('table_rate');
235
            $tableRss[] = $tables[$t]->getVar('table_rss');
236
            $tableSingle[] = $tables[$t]->getVar('table_single');
237
            $tableSubmit[] = $tables[$t]->getVar('table_submit');
238
            $tableVisit[] = $tables[$t]->getVar('table_visit');
239
            $tableTag[] = $tables[$t]->getVar('table_tag');
240
            // Get Table Object
241
            $table = $this->tdmcreate->getHandler('tables')->get($tableId);
242
            // Copy of tables images file
243
            if (file_exists($uploadTableImage = TDMC_UPLOAD_IMGTAB_PATH.'/'.$tableImage)) {
244
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
245
            } elseif (file_exists($uploadTableImage = XOOPS_ICONS32_PATH.'/'.$tableImage)) {
246
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
247
            }
248
            // Creation of admin files
249
            if (in_array(1, $tableAdmin)) {
250
                // Admin Pages File
251
                $adminPages = AdminPages::getInstance();
252
                $adminPages->write($module, $table);
253
                $ret[] = $adminPages->renderFile($tableName.'.php');
254
                // Admin Templates File
255
                $adminTemplatesPages = TemplatesAdminPages::getInstance();
256
                $adminTemplatesPages->write($module, $table);
257
                $ret[] = $adminTemplatesPages->renderFile($moduleDirname.'_admin_'.$tableName.'.tpl');
258
            }
259
            // Creation of blocks
260
            if (in_array(1, $tableBlocks)) {
261
                // Blocks Files
262
                $blocksFiles = BlocksFiles::getInstance();
263
                $blocksFiles->write($module, $table);
264
                $ret[] = $blocksFiles->renderFile($tableName.'.php');
265
                // Templates Blocks Files
266
                $templatesBlocks = TemplatesBlocks::getInstance();
267
                $templatesBlocks->write($module, $table);
268
                $ret[] = $templatesBlocks->renderFile($moduleDirname.'_block_'.$tableName.'.tpl');
269
            }
270
            // Creation of classes
271
            if (in_array(1, $tableAdmin) || in_array(1, $tableUser)) {
272
                // Class Files
273
                $classFiles = ClassFiles::getInstance();
274
                $classFiles->write($module, $table, $tables);
275
                $ret[] = $classFiles->renderFile($tableName.'.php');
276
            }
277
            // Creation of user files
278
            if (in_array(1, $tableUser)) {
279
                // User Pages File
280
                $userPages = UserPages::getInstance();
281
                $userPages->write($module, $table, $tableName.'.php');
282
                $ret[] = $userPages->renderFile();
283
                if (in_array(0, $tableCategory)) {
284
                    // User Templates File
285
                    $userTemplatesPages = TemplatesUserPages::getInstance();
286
                    $userTemplatesPages->write($module, $table);
287
                    $ret[] = $userTemplatesPages->renderFile($moduleDirname.'_'.$tableName.'.tpl');
288
                    // User List Templates File
289
                    $userTemplatesPagesList = TemplatesUserPagesList::getInstance();
290
                    $userTemplatesPagesList->write($module, $table, $tables, $moduleDirname.'_'.$tableName.'_list'.'.tpl');
291
                    $ret[] = $userTemplatesPagesList->renderFile();
292
                }
293
                if (in_array(1, $tableCategory)) {
294
                    // User List Templates File
295
                    $userTemplatesCategories = TemplatesUserCategories::getInstance();
296
                    $userTemplatesCategories->write($module, $table);
297
                    $ret[] = $userTemplatesCategories->renderFile($moduleDirname.'_'.$tableName.'.tpl');
298
                    // User List Templates File
299
                    $userTemplatesCategoriesList = TemplatesUserCategoriesList::getInstance();
300
                    $userTemplatesCategoriesList->write($module, $table);
301
                    $ret[] = $userTemplatesCategoriesList->renderFile($moduleDirname.'_'.$tableName.'_list'.'.tpl');
302
                }
303
            }
304
        }
305
        foreach (array_keys($files) as $t) {
306
            $fileName = $files[$t]->getVar('file_name');
307
            $fileExtension = $files[$t]->getVar('file_extension');
308
            $fileInfolder = $files[$t]->getVar('file_infolder');
309
            // More File
310
            $moreFiles = TDMCreateMoreFiles::getInstance();
311
            $moreFiles->write($module, $fileName, $fileInfolder, $fileExtension);
312
            $ret[] = $moreFiles->render();
313
        }
314
        // Language Modinfo File
315
        $languageModinfo = LanguageModinfo::getInstance();
316
        $languageModinfo->write($module, $table, $tables, 'modinfo.php');
317
        $ret[] = $languageModinfo->render();
318
        if (1 == $module->getVar('mod_admin')) {
319
            // Admin Header File
320
            $adminHeader = AdminHeader::getInstance();
321
            $adminHeader->write($module, $table, $tables, 'header.php');
322
            $ret[] = $adminHeader->render();
323
            // Admin Index File
324
            $adminIndex = AdminIndex::getInstance();
325
            $adminIndex->write($module, $tables, 'index.php');
326
            $ret[] = $adminIndex->render();
327
            // Admin Menu File
328
            $adminMenu = AdminMenu::getInstance();
329
            $adminMenu->write($module, $tables, 'menu.php');
330
            $ret[] = $adminMenu->render();
331
            // Admin About File
332
            $adminAbout = AdminAbout::getInstance();
333
            $adminAbout->write($module, 'about.php');
334
            $ret[] = $adminAbout->render();
335
            // Admin Footer File
336
            $adminFooter = AdminFooter::getInstance();
337
            $adminFooter->write($module, 'footer.php');
338
            $ret[] = $adminFooter->render();
339
            // Templates Admin About File
340
            $adminTemplatesAbout = TemplatesAdminAbout::getInstance();
341
            $adminTemplatesAbout->write($module, $moduleDirname.'_admin_about.tpl');
342
            $ret[] = $adminTemplatesAbout->render();
343
            // Templates Admin Index File
344
            $adminTemplatesIndex = TemplatesAdminIndex::getInstance();
345
            $adminTemplatesIndex->write($module, $moduleDirname.'_admin_index.tpl');
346
            $ret[] = $adminTemplatesIndex->render();
347
            // Templates Admin Footer File
348
            $adminTemplatesFooter = TemplatesAdminFooter::getInstance();
349
            $adminTemplatesFooter->write($module, $moduleDirname.'_admin_footer.tpl');
350
            $ret[] = $adminTemplatesFooter->render();
351
            // Templates Admin Header File
352
            $adminTemplatesHeader = TemplatesAdminHeader::getInstance();
353
            $adminTemplatesHeader->write($module, $moduleDirname.'_admin_header.tpl');
354
            $ret[] = $adminTemplatesHeader->render();
355
            // Language Admin File
356
            $languageAdmin = LanguageAdmin::getInstance();
357
            $languageAdmin->write($module, $table, $tables, 'admin.php');
358
            $ret[] = $languageAdmin->render();
359
        }
360
        // Class Helper File
361
        $classHelper = ClassHelper::getInstance();
362
        $classHelper->write($module, 'helper.php');
363
        $ret[] = $classHelper->render();
364
        // Include Functions File
365
        $includeFunctions = IncludeFunctions::getInstance();
366
        $includeFunctions->write($module, $table, 'functions.php');
367
        $ret[] = $includeFunctions->render();
368
        // Creation of blocks language file
369
        if ($table->getVar('table_name') != null) {
370
            // Include Install File
371
            $includeInstall = IncludeInstall::getInstance();
372
            $includeInstall->write($module, $table, $tables, 'install.php');
373
            $ret[] = $includeInstall->render();
374
            if (in_array(1, $tableBlocks)) {
375
                // Language Blocks File
376
                $languageBlocks = LanguageBlocks::getInstance();
377
                $languageBlocks->write($module, $tables, 'blocks.php');
378
                $ret[] = $languageBlocks->render();
379
            }
380
            // Creation of admin permission files
381
            if (in_array(1, $tablePermissions)) {
382
                // Admin Permissions File
383
                $adminPermissions = AdminPermissions::getInstance();
384
                $adminPermissions->write($module, $tables, 'permissions.php');
385
                $ret[] = $adminPermissions->render();
386
                // Templates Admin Permissions File
387
                $adminTemplatesPermissions = TemplatesAdminPermissions::getInstance();
388
                $adminTemplatesPermissions->write($module, $moduleDirname.'_admin_permissions.tpl');
389
                $ret[] = $adminTemplatesPermissions->render();
390
            }
391
            // Creation of notifications files
392
            if (in_array(1, $tableNotifications)) {
393
                // Include Notifications File
394
                $includeNotifications = IncludeNotifications::getInstance();
395
                $includeNotifications->write($module, $table, 'notifications.inc.php');
396
                $ret[] = $includeNotifications->render();
397
                // Language Mail Template Category File
398
                $languageMailTpl = LanguageMailTpl::getInstance();
399
                $languageMailTpl->write($module, 'category_new_notify.tpl');
400
                $ret[] = $languageMailTpl->render();
401
            }
402
            // Creation of sql file
403
            if ($table->getVar('table_name') != null) {
404
                // Sql File
405
                $sqlFile = SqlFile::getInstance();
406
                $sqlFile->write($module, $tables, 'mysql.sql');
407
                $ret[] = $sqlFile->render();
408
                // Include Update File
409
                $includeUpdate = IncludeUpdate::getInstance();
410
                $includeUpdate->write($module, 'update.php');
411
                $ret[] = $includeUpdate->renderFile();
412
            }
413
            // Creation of search file
414
            if (in_array(1, $tableSearch)) {
415
                // Include Search File
416
                $includeSearch = IncludeSearch::getInstance();
417
                $includeSearch->write($module, $table, 'search.inc.php');
418
                $ret[] = $includeSearch->render();
419
            }
420
            // Creation of comments files
421
            if (in_array(1, $tableComments)) {
422
                // Include Comments File
423
                $includeComments = IncludeComments::getInstance();
424
                $includeComments->write($module, $table);
425
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_edit');
426
                // Include Comments File
427
                $includeComments = IncludeComments::getInstance();
428
                $includeComments->write($module, $table);
429
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_delete');
430
                // Include Comments File
431
                $includeComments = IncludeComments::getInstance();
432
                $includeComments->write($module, $table);
433
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_post');
434
                // Include Comments File
435
                $includeComments = IncludeComments::getInstance();
436
                $includeComments->write($module, $table);
437
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_reply');
438
                // Include Comments File
439
                $includeComments = IncludeComments::getInstance();
440
                $includeComments->write($module, $table);
441
                $ret[] = $includeComments->renderCommentsNew($module, 'comment_new');
442
                // Include Comment Functions File
443
                $includeCommentFunctions = IncludeCommentFunctions::getInstance();
444
                $includeCommentFunctions->write($module, $table, 'comment_functions.php');
445
                $ret[] = $includeCommentFunctions->renderFile();
446
            }
447
        }
448
        // Creation of admin files
449
        if (1 == $module->getVar('mod_admin')) {
450
            // Templates Index File
451
            $userTemplatesIndex = TemplatesUserIndex::getInstance();
452
            $userTemplatesIndex->write($module, $table, $tables, $moduleDirname.'_index.tpl');
453
            $ret[] = $userTemplatesIndex->render();
454
            // Templates Footer File
455
            $userTemplatesFooter = TemplatesUserFooter::getInstance();
456
            $userTemplatesFooter->write($module, $table, $moduleDirname.'_footer.tpl');
457
            $ret[] = $userTemplatesFooter->render();
458
            // Templates Header File
459
            $userTemplatesHeader = TemplatesUserHeader::getInstance();
460
            $userTemplatesHeader->write($module, $moduleDirname.'_header.tpl');
461
            $ret[] = $userTemplatesHeader->render();
462
        }
463
        // Creation of user files
464
        if ((1 == $module->getVar('mod_user')) && in_array(1, $tableUser)) {
465
            // User Footer File
466
            $userFooter = UserFooter::getInstance();
467
            $userFooter->write($module, 'footer.php');
468
            $ret[] = $userFooter->render();
469
            // User Header File
470
            $userHeader = UserHeader::getInstance();
471
            $userHeader->write($module, $table, $tables, 'header.php');
472
            $ret[] = $userHeader->render();
473
            // User Notification Update File
474
            if ((1 == $module->getVar('mod_notifications')) && in_array(1, $tableNotifications)) {
475
                $userNotificationUpdate = UserNotificationUpdate::getInstance();
476
                $userNotificationUpdate->write($module, 'notification_update.php');
477
                $ret[] = $userNotificationUpdate->render();
478
            }
479
            // User Broken File
480
            if (in_array(1, $tableBroken)) {
481
                $userBroken = UserBroken::getInstance();
482
                $userBroken->write($module, $table, 'broken.php');
483
                $ret[] = $userBroken->render();
484
                // User Templates Broken File
485
                $userTemplatesBroken = TemplatesUserBroken::getInstance();
486
                $userTemplatesBroken->write($module, $table);
487
                $ret[] = $userTemplatesBroken->renderFile($moduleDirname.'_broken.tpl');
488
            }
489
            // User Pdf File
490
            if (in_array(1, $tablePdf)) {
491
                $userPdf = UserPdf::getInstance();
492
                $userPdf->write($module, $table, 'pdf.php');
493
                $ret[] = $userPdf->render();
494
                // User Templates Pdf File
495
                $userTemplatesPdf = TemplatesUserPdf::getInstance();
496
                $userTemplatesPdf->write($module);
497
                $ret[] = $userTemplatesPdf->renderFile($moduleDirname.'_pdf.tpl');
498
            }
499
            // User Print File
500
            if (in_array(1, $tablePrint)) {
501
                $userPrint = UserPrint::getInstance();
502
                $userPrint->write($module, $table, 'print.php');
503
                $ret[] = $userPrint->render();
504
                // User Templates Print File
505
                $userTemplatesPrint = TemplatesUserPrint::getInstance();
506
                $userTemplatesPrint->write($module, $table);
507
                $ret[] = $userTemplatesPrint->renderFile($moduleDirname.'_print.tpl');
508
            }
509
            // User Rate File
510
            if (in_array(1, $tableRate)) {
511
                $userRate = UserRate::getInstance();
512
                $userRate->write($module, $table, 'rate.php');
513
                $ret[] = $userRate->render();
514
                // User Templates Rate File
515
                $userTemplatesRate = TemplatesUserRate::getInstance();
516
                $userTemplatesRate->write($module, $table);
517
                $ret[] = $userTemplatesRate->renderFile($moduleDirname.'_rate.tpl');
518
            }
519
            // User Rss File
520
            if (in_array(1, $tableRss)) {
521
                $userRss = UserRss::getInstance();
522
                $userRss->write($module, $table, 'rss.php');
523
                $ret[] = $userRss->render();
524
                // User Templates Rss File
525
                $userTemplatesRss = TemplatesUserRss::getInstance();
526
                $userTemplatesRss->write($module);
527
                $ret[] = $userTemplatesRss->renderFile($moduleDirname.'_rss.tpl');
528
            }
529
            // User Single File
530
            if (in_array(1, $tableSingle)) {
531
                $userSingle = UserSingle::getInstance();
532
                $userSingle->write($module, $table, 'single.php');
533
                $ret[] = $userSingle->render();
534
                // User Templates Single File
535
                $userTemplatesSingle = TemplatesUserSingle::getInstance();
536
                $userTemplatesSingle->write($module, $table);
537
                $ret[] = $userTemplatesSingle->renderFile($moduleDirname.'_single.tpl');
538
            }
539
            // User Submit File
540
            if (in_array(1, $tableSubmit)) {
541
                $userSubmit = UserSubmit::getInstance();
542
                $userSubmit->write($module, $table, 'submit.php');
543
                $ret[] = $userSubmit->render();
544
                // User Templates Submit File
545
                $userTemplatesSubmit = TemplatesUserSubmit::getInstance();
546
                $userTemplatesSubmit->write($module, $table);
547
                $ret[] = $userTemplatesSubmit->renderFile($moduleDirname.'_submit.tpl');
548
            }// User Visit File
549
            if (in_array(1, $tableVisit)) {
550
                $userVisit = UserVisit::getInstance();
551
                $userVisit->write($module, $table, 'visit.php');
552
                $ret[] = $userVisit->render();
553
            }
554
            // User Tag Files
555
            if (in_array(1, $tableTag)) {
556
                $userListTag = UserListTag::getInstance();
557
                $userListTag->write($module, 'list.tag.php');
558
                $ret[] = $userListTag->render();
559
                $userViewTag = UserViewTag::getInstance();
560
                $userViewTag->write($module, 'view.tag.php');
561
                $ret[] = $userViewTag->render();
562
            }
563
            // User Index File
564
            $userIndex = UserIndex::getInstance();
565
            $userIndex->write($module, $table, 'index.php');
566
            $ret[] = $userIndex->render();
567
            // Language Main File
568
            $languageMain = LanguageMain::getInstance();
569
            $languageMain->write($module, $tables, 'main.php');
570
            $ret[] = $languageMain->render();
571
            // User Templates Submit File
572
            $userTemplatesUserBreadcrumbs = TemplatesUserBreadcrumbs::getInstance();
573
            $userTemplatesUserBreadcrumbs->write($module, $moduleDirname.'_breadcrumbs.tpl');
574
            $ret[] = $userTemplatesUserBreadcrumbs->render();
575
        }
576
        // Css Styles File
577
        $cssStyles = CssStyles::getInstance();
578
        $cssStyles->write($module, 'style.css');
579
        $ret[] = $cssStyles->render();
580
        // Include Jquery File
581
        $JavascriptJQuery = JavascriptJQuery::getInstance();
582
        $JavascriptJQuery->write($module, 'functions.js');
583
        $ret[] = $JavascriptJQuery->render();
584
        // Include Common File
585
        $includeCommon = IncludeCommon::getInstance();
586
        $includeCommon->write($module, $table, 'common.php');
587
        $ret[] = $includeCommon->render();
588
        // Docs Changelog File
589
        $docsChangelog = DocsChangelog::getInstance();
590
        $docsChangelog->write($module, 'changelog.txt');
591
        $ret[] = $docsChangelog->render();
592
        // Language Help File
593
        $languageHelp = LanguageHelp::getInstance();
594
        $languageHelp->write($module, 'help.html');
595
        $ret[] = $languageHelp->render();
596
        // User Xoops Version File
597
        $userXoopsVersion = UserXoopsVersion::getInstance();
598
        $userXoopsVersion->write($module, $table, $tables, 'xoops_version.php');
599
        $ret[] = $userXoopsVersion->render();
600
601
        // Return Array
602
        return $ret;
603
    }
604
}
605