Completed
Push — master ( 544d04...d95223 )
by Gino
05:38 queued 01:36
created

TDMCreateArchitecture::setBaseFoldersFiles()   F

Complexity

Conditions 15
Paths 1792

Size

Total Lines 123
Code Lines 67

Duplication

Lines 13
Ratio 10.57 %
Metric Value
dl 13
loc 123
rs 2
cc 15
eloc 67
nc 1792
nop 1

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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 29 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
defined('XOOPS_ROOT_PATH') || die('Restricted access');
25
include dirname(__DIR__).'/autoload.php';
26
/**
27
 * Class TDMCreateArchitecture.
28
 */
29
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...
30
{
31
    /*
32
    * @var mixed
33
    */
34
    private $tdmcreate;
35
36
    /*
37
    * @var mixed
38
    */
39
    private $tdmcfile;
40
41
    /*
42
    * @var mixed
43
    */
44
    private $structure;
0 ignored issues
show
Unused Code introduced by
The property $structure is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
45
46
    /*
47
    *  @public function constructor class
48
    *  @param null
49
    */
50
    /**
51
     *
52
     */
53
    public function __construct()
54
    {
55
        parent::__construct();
56
        $this->tdmcreate = TDMCreateHelper::getInstance();
57
        $this->tdmcfile = TDMCreateFile::getInstance();
58
        $this->setUploadPath(TDMC_UPLOAD_REPOSITORY_PATH);
59
    }
60
61
    /*
62
    *  @static function &getInstance
63
    *  @param null
64
    */
65
    /**
66
     * @return TDMCreateArchitecture
67
     */
68
    public static function &getInstance()
69
    {
70
        static $instance = false;
71
        if (!$instance) {
72
            $instance = new self();
73
        }
74
75
        return $instance;
76
    }
77
78
    /*
79
    *  @public function setBaseFoldersFiles
80
    *  @param string $module
81
    */
82
    /**
83
     * @param $module
84
     */
85
    public function setBaseFoldersFiles($module)
0 ignored issues
show
Coding Style introduced by
setBaseFoldersFiles uses the super-global variable $GLOBALS which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
86
    {
87
        // Module
88
        $modId = $module->getVar('mod_id');
89
        $language = $GLOBALS['xoopsConfig']['language'];
90
        // Id of tables
91
        $tables = $this->tdmcfile->getTableTables($modId);
92
        //
93
        $table = null;
94
        foreach (array_keys($tables) as $t) {
95
            $tableId = $tables[$t]->getVar('table_id');
96
            $tableName[] = $tables[$t]->getVar('table_name');
0 ignored issues
show
Coding Style Comprehensibility introduced by
$tableName was never initialized. Although not strictly required by PHP, it is generally a good practice to add $tableName = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
97
            $table = $this->tdmcreate->getHandler('tables')->get($tableId);
98
        }
99
        //
100
        $indexFile = XOOPS_UPLOAD_PATH.'/index.html';
101
        $stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author')));
102
        $this->setModuleName($module->getVar('mod_dirname'));
103
        $uploadPath = $this->getUploadPath();
104
        // Creation of "module" folder in the Directory repository
105
        $this->makeDir($uploadPath.'/'.$this->getModuleName());
106
        if (1 != $module->getVar('mod_user')) {
107
            // Copied of index.html file in "root module" folder
108
            $this->copyFile('', $indexFile, 'index.html');
109
        }
110
        if (1 == $module->getVar('mod_admin')) {
111
            // Creation of "admin" folder and index.html file
112
            $this->makeDirAndCopyFile('admin', $indexFile, 'index.html');
113
        }
114
        if (1 == $module->getVar('mod_blocks')) {
115
            // Creation of "blocks" folder and index.html file
116
            $this->makeDirAndCopyFile('blocks', $indexFile, 'index.html');
117
        }
118
        // Creation of "class" folder and index.html file
119
        $this->makeDirAndCopyFile('class', $indexFile, 'index.html');
120
        // Creation of "assets" folder and index.html file
121
        $this->makeDirAndCopyFile('assets', $indexFile, 'index.html');
122
        // Creation of "assets/css" folder and index.html file
123
        $this->makeDirAndCopyFile('assets/css', $indexFile, 'index.html');
124
        // Creation of "assets/icons" folder and index.html file
125
        $this->makeDirAndCopyFile('assets/icons', $indexFile, 'index.html');
126
        // Creation of "assets/icons/16" folder and index.html file
127
        $this->makeDirAndCopyFile('assets/icons/16', $indexFile, 'index.html');
128
        // Creation of "assets/icons/32" folder and index.html file
129
        $this->makeDirAndCopyFile('assets/icons/32', $indexFile, 'index.html');
130
        // Creation of "assets/images" folder and index.html file
131
        $this->makeDirAndCopyFile('assets/images', $indexFile, 'index.html');
132
        // Creation of "assets/js" folder and index.html file
133
        $this->makeDirAndCopyFile('assets/js', $indexFile, 'index.html');
134
        //Copy the logo of the module
135
        $modImage = str_replace(' ', '', strtolower($module->getVar('mod_image')));
136
        $this->copyFile('assets/images', TDMC_UPLOAD_IMGMOD_PATH.'/'.$modImage, $modImage);
137
        // Copy of 'module_author_logo.gif' file in uploads dir
138
        $logoGifFrom = TDMC_UPLOAD_IMGMOD_PATH.'/'.$stlModuleAuthor.'_logo.gif';
139
        // If file exists
140
        if (!file_exists($logoGifFrom)) {
141
            // Rename file
142
            $copyFile = TDMC_IMAGES_LOGOS_URL.'/xoopsdevelopmentteam_logo.gif';
143
            $copyNewFile = $logoGifFrom;
144
            copy($copyFile, $copyNewFile);
145
        } else {
146
            // Copy file
147
            $copyFile = TDMC_IMAGES_LOGOS_URL.'/'.$stlModuleAuthor.'_logo.gif';
148
            $copyNewFile = $logoGifFrom;
149
            copy($copyFile, $copyNewFile);
150
        }
151
        // Creation of 'module_author_logo.gif' file
152
        $this->copyFile('assets/images', $copyNewFile, $stlModuleAuthor.'_logo.gif');
153
        // Creation of 'docs' folder and index.html file
154
        $this->makeDirAndCopyFile('docs', $indexFile, 'index.html');
155
        // Creation of 'credits.txt' file
156
        $this->copyFile('docs', TDMC_DOCS_PATH.'/credits.txt', 'credits.txt');
157
        // Creation of 'install.txt' file
158
        $this->copyFile('docs', TDMC_DOCS_PATH.'/install.txt', 'install.txt');
159
        // Creation of 'lang_diff.txt' file
160
        $this->copyFile('docs', TDMC_DOCS_PATH.'/lang_diff.txt', 'lang_diff.txt');
161
        // Creation of 'license.txt' file
162
        $this->copyFile('docs', TDMC_DOCS_PATH.'/license.txt', 'license.txt');
163
        // Creation of 'readme.txt' file
164
        $this->copyFile('docs', TDMC_DOCS_PATH.'/readme.txt', 'readme.txt');
165
        // Creation of "include" folder and index.html file
166
        $this->makeDirAndCopyFile('include', $indexFile, 'index.html');
167
        // Creation of "language" folder and index.html file
168
        $this->makeDirAndCopyFile('language', $indexFile, 'index.html');
169
        // Creation of 'default english' folder
170 View Code Duplication
        if ($language != 'english') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
171
            // Creation of "language/local_language" folder and index.html file
172
            $this->makeDirAndCopyFile('language/'.$language, $indexFile, 'index.html');
173
            // Creation of "language/local_language/help" folder and index.html file
174
            $this->makeDirAndCopyFile('language/'.$language.'/help', $indexFile, 'index.html');
175
        }
176
        // Creation of "english" folder and index.html file
177
        $this->makeDirAndCopyFile('language/english', $indexFile, 'index.html');
178
        // Creation of "language/english/help" folder and index.html file
179
        $this->makeDirAndCopyFile('language/english/help', $indexFile, 'index.html');
180
        // Creation of "preloads" folder and index.html file
181
        $this->makeDirAndCopyFile('preloads', $indexFile, 'index.html');
182
        if (1 == $module->getVar('mod_admin')) {
183
            // Creation of "templates" folder and index.html file
184
            $this->makeDirAndCopyFile('templates', $indexFile, 'index.html');
185
        }
186
        if (1 == $module->getVar('mod_admin')) {
187
            // Creation of "templates/admin" folder and index.html file
188
            $this->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html');
189
        }
190
        if (!empty($tableName)) {
191
            if ((1 == $module->getVar('mod_blocks')) && (1 == $table->getVar('table_blocks'))) {
192
                // Creation of "templates/blocks" folder and index.html file
193
                $this->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.html');
194
            }
195
            // Creation of "sql" folder and index.html file
196
            $this->makeDirAndCopyFile('sql', $indexFile, 'index.html');
197
            if ((1 == $module->getVar('mod_notifications')) && (1 == $table->getVar('table_notifications'))) {
198 View Code Duplication
                if ($language != 'english') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
199
                    // Creation of "language/local_language/mail_template" folder and index.html file
200
                    $this->makeDirAndCopyFile('language/'.$language.'/mail_template', $indexFile, 'index.html');
201
                } else {
202
                    // Creation of "language/english/mail_template" folder and index.html file
203
                    $this->makeDirAndCopyFile('language/english/mail_template', $indexFile, 'index.html');
204
                }
205
            }
206
        }
207
    }
208
209
    /*
210
    *  @public function setFilesToBuilding
211
    *  @param string $module
212
    */
213
    /**
214
     * @param $module
215
     *
216
     * @return array
217
     */
218
    public function setFilesToBuilding($module)
219
    {
220
        // Module
221
        $modId = $module->getVar('mod_id');
222
        $moduleDirname = $module->getVar('mod_dirname');
223
        $icon32 = 'assets/icons/32';
224
        $tables = $this->tdmcfile->getTableTables($modId);
225
        $files = $this->tdmcfile->getTableMoreFiles($modId);
226
        $ret = array();
227
        //
228
        $table = array();
229
        $tableCategory = array();
230
        $tableImage = array();
0 ignored issues
show
Unused Code introduced by
$tableImage 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...
231
        $tableAdmin = array();
232
        $tableUser = array();
233
        $tableBlocks = array();
234
        $tableSearch = array();
235
        $tableComments = array();
236
        $tableNotifications = array();
237
        $tablePermissions = array();
238
        $tableBroken = array();
239
        $tablePdf = array();
240
        $tablePrint = array();
241
        $tableRate = array();
242
        $tableRss = array();
243
        $tableSingle = array();
244
        $tableSubmit = array();
245
        $tableVisit = array();
246
        $tableTag = array();
247
        foreach (array_keys($tables) as $t) {
248
            $tableMid = $tables[$t]->getVar('table_mid');
0 ignored issues
show
Unused Code introduced by
$tableMid 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...
249
            $tableId = $tables[$t]->getVar('table_id');
250
            $tableName = $tables[$t]->getVar('table_name');
251
            $tableCategory[] = $tables[$t]->getVar('table_category');
252
            $tableImage = $tables[$t]->getVar('table_image');
253
            $tableAdmin[] = $tables[$t]->getVar('table_admin');
254
            $tableUser[] = $tables[$t]->getVar('table_user');
255
            $tableBlocks[] = $tables[$t]->getVar('table_blocks');
256
            $tableSearch[] = $tables[$t]->getVar('table_search');
257
            $tableComments[] = $tables[$t]->getVar('table_comments');
258
            $tableNotifications[] = $tables[$t]->getVar('table_notifications');
259
            $tablePermissions[] = $tables[$t]->getVar('table_permissions');
260
            $tableBroken[] = $tables[$t]->getVar('table_broken');
261
            $tablePdf[] = $tables[$t]->getVar('table_pdf');
262
            $tablePrint[] = $tables[$t]->getVar('table_print');
263
            $tableRate[] = $tables[$t]->getVar('table_rate');
264
            $tableRss[] = $tables[$t]->getVar('table_rss');
265
            $tableSingle[] = $tables[$t]->getVar('table_single');
266
            $tableSubmit[] = $tables[$t]->getVar('table_submit');
267
            $tableVisit[] = $tables[$t]->getVar('table_visit');
268
            $tableTag[] = $tables[$t]->getVar('table_tag');
269
            // Get Table Object
270
            $table = $this->tdmcreate->getHandler('tables')->get($tableId);
271
            // Copy of tables images file
272
            if (file_exists($uploadTableImage = TDMC_UPLOAD_IMGTAB_PATH.'/'.$tableImage)) {
273
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
274
            } elseif (file_exists($uploadTableImage = XOOPS_ICONS32_PATH.'/'.$tableImage)) {
275
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
276
            }
277
            // Creation of admin files
278 View Code Duplication
            if (in_array(1, $tableAdmin)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
279
                // Admin Pages File
280
                $adminPages = AdminPages::getInstance();
281
                $adminPages->write($module, $table);
282
                $ret[] = $adminPages->renderFile($tableName.'.php');
283
                // Admin Templates File
284
                $adminTemplatesPages = TemplatesAdminPages::getInstance();
285
                $adminTemplatesPages->write($module, $table);
286
                $ret[] = $adminTemplatesPages->renderFile($moduleDirname.'_admin_'.$tableName.'.tpl');
287
            }
288
            // Creation of blocks
289 View Code Duplication
            if (in_array(1, $tableBlocks)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
290
                // Blocks Files
291
                $blocksFiles = BlocksFiles::getInstance();
292
                $blocksFiles->write($module, $table);
293
                $ret[] = $blocksFiles->renderFile($tableName.'.php');
294
                // Templates Blocks Files
295
                $templatesBlocks = TemplatesBlocks::getInstance();
296
                $templatesBlocks->write($module, $table);
297
                $ret[] = $templatesBlocks->renderFile($moduleDirname.'_block_'.$tableName.'.tpl');
298
            }
299
            // Creation of classes
300
            if (in_array(1, $tableAdmin) || in_array(1, $tableUser)) {
301
                // Class Files
302
                $classFiles = ClassFiles::getInstance();
303
                $classFiles->write($module, $table, $tables);
304
                $ret[] = $classFiles->renderFile($tableName.'.php');
305
            }
306
            // Creation of user files
307
            if (in_array(1, $tableUser)) {
308
                // User Pages File
309
                $userPages = UserPages::getInstance();
310
                $userPages->write($module, $table, $tableName.'.php');
311
                $ret[] = $userPages->renderFile();
312 View Code Duplication
                if (in_array(0, $tableCategory)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
313
                    // User Templates File
314
                    $userTemplatesPages = TemplatesUserPages::getInstance();
315
                    $userTemplatesPages->write($module, $table);
316
                    $ret[] = $userTemplatesPages->renderFile($moduleDirname.'_'.$tableName.'.tpl');
317
                    // User List Templates File
318
                    $userTemplatesPagesList = TemplatesUserPagesList::getInstance();
319
                    $userTemplatesPagesList->write($module, $table, $tables, $moduleDirname.'_'.$tableName.'_list'.'.tpl');
320
                    $ret[] = $userTemplatesPagesList->renderFile();
321
                }
322 View Code Duplication
                if (in_array(1, $tableCategory)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
323
                    // User List Templates File
324
                    $userTemplatesCategories = TemplatesUserCategories::getInstance();
325
                    $userTemplatesCategories->write($module, $table);
326
                    $ret[] = $userTemplatesCategories->renderFile($moduleDirname.'_'.$tableName.'.tpl');
327
                    // User List Templates File
328
                    $userTemplatesCategoriesList = TemplatesUserCategoriesList::getInstance();
329
                    $userTemplatesCategoriesList->write($module, $table);
330
                    $ret[] = $userTemplatesCategoriesList->renderFile($moduleDirname.'_'.$tableName.'_list'.'.tpl');
331
                }
332
            }
333
        }
334
        foreach (array_keys($files) as $t) {
335
            $fileName = $files[$t]->getVar('file_name');
336
            $fileExtension = $files[$t]->getVar('file_extension');
337
            $fileInfolder = $files[$t]->getVar('file_infolder');
338
            // More File
339
            $moreFiles = TDMCreateMoreFiles::getInstance();
340
            $moreFiles->write($module, $fileName, $fileInfolder, $fileExtension);
341
            $ret[] = $moreFiles->render();
342
        }
343
        // Language Modinfo File
344
        $languageModinfo = LanguageModinfo::getInstance();
345
        $languageModinfo->write($module, $table, $tables, 'modinfo.php');
346
        $ret[] = $languageModinfo->render();
347
        if (1 == $module->getVar('mod_admin')) {
348
            // Admin Header File
349
            $adminHeader = AdminHeader::getInstance();
350
            $adminHeader->write($module, $table, $tables, 'header.php');
351
            $ret[] = $adminHeader->render();
352
            // Admin Index File
353
            $adminIndex = AdminIndex::getInstance();
354
            $adminIndex->write($module, $tables, 'index.php');
355
            $ret[] = $adminIndex->render();
356
            // Admin Menu File
357
            $adminMenu = AdminMenu::getInstance();
358
            $adminMenu->write($module, $tables, 'menu.php');
359
            $ret[] = $adminMenu->render();
360
            // Admin About File
361
            $adminAbout = AdminAbout::getInstance();
362
            $adminAbout->write($module, 'about.php');
363
            $ret[] = $adminAbout->render();
364
            // Admin Footer File
365
            $adminFooter = AdminFooter::getInstance();
366
            $adminFooter->write($module, 'footer.php');
367
            $ret[] = $adminFooter->render();
368
            // Templates Admin About File
369
            $adminTemplatesAbout = TemplatesAdminAbout::getInstance();
370
            $adminTemplatesAbout->write($module, $moduleDirname.'_admin_about.tpl');
371
            $ret[] = $adminTemplatesAbout->render();
372
            // Templates Admin Index File
373
            $adminTemplatesIndex = TemplatesAdminIndex::getInstance();
374
            $adminTemplatesIndex->write($module, $moduleDirname.'_admin_index.tpl');
375
            $ret[] = $adminTemplatesIndex->render();
376
            // Templates Admin Footer File
377
            $adminTemplatesFooter = TemplatesAdminFooter::getInstance();
378
            $adminTemplatesFooter->write($module, $moduleDirname.'_admin_footer.tpl');
379
            $ret[] = $adminTemplatesFooter->render();
380
            // Templates Admin Header File
381
            $adminTemplatesHeader = TemplatesAdminHeader::getInstance();
382
            $adminTemplatesHeader->write($module, $moduleDirname.'_admin_header.tpl');
383
            $ret[] = $adminTemplatesHeader->render();
384
            // Language Admin File
385
            $languageAdmin = LanguageAdmin::getInstance();
386
            $languageAdmin->write($module, $table, $tables, 'admin.php');
387
            $ret[] = $languageAdmin->render();
388
        }
389
        // Class Helper File
390
        $classHelper = ClassHelper::getInstance();
391
        $classHelper->write($module, 'helper.php');
392
        $ret[] = $classHelper->render();
393
        // Include Functions File
394
        $includeFunctions = IncludeFunctions::getInstance();
395
        $includeFunctions->write($module, $table, 'functions.php');
396
        $ret[] = $includeFunctions->render();
397
        // Creation of blocks language file
398
        if ($table->getVar('table_name') != null) {
399
            // Include Install File
400
            $includeInstall = IncludeInstall::getInstance();
401
            $includeInstall->write($module, $table, $tables, 'install.php');
402
            $ret[] = $includeInstall->render();
403
            if (in_array(1, $tableBlocks)) {
404
                // Language Blocks File
405
                $languageBlocks = LanguageBlocks::getInstance();
406
                $languageBlocks->write($module, $tables, 'blocks.php');
407
                $ret[] = $languageBlocks->render();
408
            }
409
            // Creation of admin permission files
410
            if (in_array(1, $tablePermissions)) {
411
                // Admin Permissions File
412
                $adminPermissions = AdminPermissions::getInstance();
413
                $adminPermissions->write($module, $tables, 'permissions.php');
414
                $ret[] = $adminPermissions->render();
415
                // Templates Admin Permissions File
416
                $adminTemplatesPermissions = TemplatesAdminPermissions::getInstance();
417
                $adminTemplatesPermissions->write($module, $moduleDirname.'_admin_permissions.tpl');
418
                $ret[] = $adminTemplatesPermissions->render();
419
            }
420
            // Creation of notifications files
421 View Code Duplication
            if (in_array(1, $tableNotifications)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
422
                // Include Notifications File
423
                $includeNotifications = IncludeNotifications::getInstance();
424
                $includeNotifications->write($module, $table, 'notifications.inc.php');
425
                $ret[] = $includeNotifications->render();
426
                // Language Mail Template Category File
427
                $languageMailTpl = LanguageMailTpl::getInstance();
428
                $languageMailTpl->write($module);
429
                $ret[] = $languageMailTpl->renderFile('category_new_notify.tpl');
430
            }
431
            // Creation of sql file
432 View Code Duplication
            if ($table->getVar('table_name') != null) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
433
                // Sql File
434
                $sqlFile = SqlFile::getInstance();
435
                $sqlFile->write($module, $tables, 'mysql.sql');
436
                $ret[] = $sqlFile->render();
437
                // Include Update File
438
                $includeUpdate = IncludeUpdate::getInstance();
439
                $includeUpdate->write($module, 'update.php');
440
                $ret[] = $includeUpdate->renderFile();
441
            }
442
            // Creation of search file
443
            if (in_array(1, $tableSearch)) {
444
                // Include Search File
445
                $includeSearch = IncludeSearch::getInstance();
446
                $includeSearch->write($module, $table, 'search.inc.php');
447
                $ret[] = $includeSearch->render();
448
            }
449
            // Creation of comments files
450
            if (in_array(1, $tableComments)) {
451
                // Include Comments File
452
                $includeComments = IncludeComments::getInstance();
453
                $includeComments->write($module, $table);
454
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_edit');
455
                // Include Comments File
456
                $includeComments = IncludeComments::getInstance();
457
                $includeComments->write($module, $table);
458
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_delete');
459
                // Include Comments File
460
                $includeComments = IncludeComments::getInstance();
461
                $includeComments->write($module, $table);
462
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_post');
463
                // Include Comments File
464
                $includeComments = IncludeComments::getInstance();
465
                $includeComments->write($module, $table);
466
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_reply');
467
                // Include Comments File
468
                $includeComments = IncludeComments::getInstance();
469
                $includeComments->write($module, $table);
470
                $ret[] = $includeComments->renderCommentsNew($module, 'comment_new');
471
                // Include Comment Functions File
472
                $includeCommentFunctions = IncludeCommentFunctions::getInstance();
473
                $includeCommentFunctions->write($module, $table, 'comment_functions.php');
474
                $ret[] = $includeCommentFunctions->renderFile();
475
            }
476
        }
477
        // Creation of admin files
478
        if (1 == $module->getVar('mod_admin')) {
479
            // Templates Index File
480
            $userTemplatesIndex = TemplatesUserIndex::getInstance();
481
            $userTemplatesIndex->write($module, $table, $tables, $moduleDirname.'_index.tpl');
482
            $ret[] = $userTemplatesIndex->render();
483
            // Templates Footer File
484
            $userTemplatesFooter = TemplatesUserFooter::getInstance();
485
            $userTemplatesFooter->write($module, $table, $moduleDirname.'_footer.tpl');
486
            $ret[] = $userTemplatesFooter->render();
487
            // Templates Header File
488
            $userTemplatesHeader = TemplatesUserHeader::getInstance();
489
            $userTemplatesHeader->write($module, $moduleDirname.'_header.tpl');
490
            $ret[] = $userTemplatesHeader->render();
491
        }
492
        // Creation of user files
493
        if ((1 == $module->getVar('mod_user')) && in_array(1, $tableUser)) {
494
            // User Footer File
495
            $userFooter = UserFooter::getInstance();
496
            $userFooter->write($module, 'footer.php');
497
            $ret[] = $userFooter->render();
498
            // User Header File
499
            $userHeader = UserHeader::getInstance();
500
            $userHeader->write($module, $table, $tables, 'header.php');
501
            $ret[] = $userHeader->render();
502
            // User Notification Update File
503
            if ((1 == $module->getVar('mod_notifications')) && in_array(1, $tableNotifications)) {
504
                $userNotificationUpdate = UserNotificationUpdate::getInstance();
505
                $userNotificationUpdate->write($module, 'notification_update.php');
506
                $ret[] = $userNotificationUpdate->render();
507
            }
508
            // User Broken File
509 View Code Duplication
            if (in_array(1, $tableBroken)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
510
                $userBroken = UserBroken::getInstance();
511
                $userBroken->write($module, $table, 'broken.php');
512
                $ret[] = $userBroken->render();
513
                // User Templates Broken File
514
                $userTemplatesBroken = TemplatesUserBroken::getInstance();
515
                $userTemplatesBroken->write($module, $table);
516
                $ret[] = $userTemplatesBroken->renderFile($moduleDirname.'_broken.tpl');
517
            }
518
            // User Pdf File
519 View Code Duplication
            if (in_array(1, $tablePdf)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
520
                $userPdf = UserPdf::getInstance();
521
                $userPdf->write($module, $table, 'pdf.php');
522
                $ret[] = $userPdf->render();
523
                // User Templates Pdf File
524
                $userTemplatesPdf = TemplatesUserPdf::getInstance();
525
                $userTemplatesPdf->write($module);
526
                $ret[] = $userTemplatesPdf->renderFile($moduleDirname.'_pdf.tpl');
527
            }
528
            // User Print File
529 View Code Duplication
            if (in_array(1, $tablePrint)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
530
                $userPrint = UserPrint::getInstance();
531
                $userPrint->write($module, $table, 'print.php');
532
                $ret[] = $userPrint->render();
533
                // User Templates Print File
534
                $userTemplatesPrint = TemplatesUserPrint::getInstance();
535
                $userTemplatesPrint->write($module, $table);
536
                $ret[] = $userTemplatesPrint->renderFile($moduleDirname.'_print.tpl');
537
            }
538
            // User Rate File
539 View Code Duplication
            if (in_array(1, $tableRate)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
540
                $userRate = UserRate::getInstance();
541
                $userRate->write($module, $table, 'rate.php');
542
                $ret[] = $userRate->render();
543
                // User Templates Rate File
544
                $userTemplatesRate = TemplatesUserRate::getInstance();
545
                $userTemplatesRate->write($module, $table);
546
                $ret[] = $userTemplatesRate->renderFile($moduleDirname.'_rate.tpl');
547
            }
548
            // User Rss File
549 View Code Duplication
            if (in_array(1, $tableRss)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
550
                $userRss = UserRss::getInstance();
551
                $userRss->write($module, $table, 'rss.php');
552
                $ret[] = $userRss->render();
553
                // User Templates Rss File
554
                $userTemplatesRss = TemplatesUserRss::getInstance();
555
                $userTemplatesRss->write($module);
556
                $ret[] = $userTemplatesRss->renderFile($moduleDirname.'_rss.tpl');
557
            }
558
            // User Single File
559 View Code Duplication
            if (in_array(1, $tableSingle)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
560
                $userSingle = UserSingle::getInstance();
561
                $userSingle->write($module, $table, 'single.php');
562
                $ret[] = $userSingle->render();
563
                // User Templates Single File
564
                $userTemplatesSingle = TemplatesUserSingle::getInstance();
565
                $userTemplatesSingle->write($module, $table);
566
                $ret[] = $userTemplatesSingle->renderFile($moduleDirname.'_single.tpl');
567
            }
568
            // User Submit File
569 View Code Duplication
            if (in_array(1, $tableSubmit)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
570
                $userSubmit = UserSubmit::getInstance();
571
                $userSubmit->write($module, $table, 'submit.php');
572
                $ret[] = $userSubmit->render();
573
                // User Templates Submit File
574
                $userTemplatesSubmit = TemplatesUserSubmit::getInstance();
575
                $userTemplatesSubmit->write($module, $table);
576
                $ret[] = $userTemplatesSubmit->renderFile($moduleDirname.'_submit.tpl');
577
            }// User Visit File
578
            if (in_array(1, $tableVisit)) {
579
                $userVisit = UserVisit::getInstance();
580
                $userVisit->write($module, $table, 'visit.php');
581
                $ret[] = $userVisit->render();
582
            }
583
            // User Tag Files
584
            if (in_array(1, $tableTag)) {
585
                $userListTag = UserListTag::getInstance();
586
                $userListTag->write($module, 'list.tag.php');
587
                $ret[] = $userListTag->render();
588
                $userViewTag = UserViewTag::getInstance();
589
                $userViewTag->write($module, 'view.tag.php');
590
                $ret[] = $userViewTag->render();
591
            }
592
            // User Index File
593
            $userIndex = UserIndex::getInstance();
594
            $userIndex->write($module, $table, 'index.php');
595
            $ret[] = $userIndex->render();
596
            // Language Main File
597
            $languageMain = LanguageMain::getInstance();
598
            $languageMain->write($module, $tables, 'main.php');
599
            $ret[] = $languageMain->render();
600
            // User Templates Submit File
601
            $userTemplatesUserBreadcrumbs = TemplatesUserBreadcrumbs::getInstance();
602
            $userTemplatesUserBreadcrumbs->write($module, $moduleDirname.'_breadcrumbs.tpl');
603
            $ret[] = $userTemplatesUserBreadcrumbs->render();
604
        }
605
        // Css Styles File
606
        $cssStyles = CssStyles::getInstance();
607
        $cssStyles->write($module, 'style.css');
608
        $ret[] = $cssStyles->render();
609
        // Include Jquery File
610
        $JavascriptJQuery = JavascriptJQuery::getInstance();
611
        $JavascriptJQuery->write($module, 'functions.js');
612
        $ret[] = $JavascriptJQuery->render();
613
        // Include Common File
614
        $includeCommon = IncludeCommon::getInstance();
615
        $includeCommon->write($module, $table, 'common.php');
616
        $ret[] = $includeCommon->render();
617
        // Docs Changelog File
618
        $docsChangelog = DocsChangelog::getInstance();
619
        $docsChangelog->write($module, 'changelog.txt');
620
        $ret[] = $docsChangelog->render();
621
        // Language Help File
622
        $languageHelp = LanguageHelp::getInstance();
623
        $languageHelp->write($module, 'help.html');
624
        $ret[] = $languageHelp->render();
625
        // User Xoops Version File
626
        $userXoopsVersion = UserXoopsVersion::getInstance();
627
        $userXoopsVersion->write($module, $table, $tables, 'xoops_version.php');
628
        $ret[] = $userXoopsVersion->render();
629
630
        // Return Array
631
        return $ret;
632
    }
633
}
634