|
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: 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 |
|
|
|
|
|
|
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
|
|
|
// Module |
|
82
|
|
|
$modId = $module->getVar('mod_id'); |
|
83
|
|
|
// Id of tables |
|
84
|
|
|
$tables = $this->tdmcfile->getTableTables($modId); |
|
85
|
|
|
// |
|
86
|
|
|
$table = null; |
|
87
|
|
|
foreach (array_keys($tables) as $t) { |
|
88
|
|
|
$tableId = $tables[$t]->getVar('table_id'); |
|
89
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
|
90
|
|
|
$table = $this->tdmcreate->getHandler('tables')->get($tableId); |
|
91
|
|
|
} |
|
92
|
|
|
// |
|
93
|
|
|
$indexFile = XOOPS_UPLOAD_PATH.'/index.html'; |
|
94
|
|
|
$stlModuleAuthor = str_replace(' ', '', strtolower($module->getVar('mod_author'))); |
|
95
|
|
|
$this->setModuleName($module->getVar('mod_dirname')); |
|
96
|
|
|
$uploadPath = $this->getUploadPath(); |
|
97
|
|
|
// Creation of "module" folder in the Directory repository |
|
98
|
|
|
$this->makeDir($uploadPath.'/'.$this->getModuleName()); |
|
99
|
|
|
if (1 != $module->getVar('mod_user')) { |
|
100
|
|
|
// Copied of index.html file in "root module" folder |
|
101
|
|
|
$this->copyFile('', $indexFile, 'index.html'); |
|
102
|
|
|
} |
|
103
|
|
|
if (1 == $module->getVar('mod_admin')) { |
|
104
|
|
|
// Creation of "admin" folder and index.html file |
|
105
|
|
|
$this->makeDirAndCopyFile('admin', $indexFile, 'index.html'); |
|
106
|
|
|
} |
|
107
|
|
|
if (1 == $module->getVar('mod_blocks')) { |
|
108
|
|
|
// Creation of "blocks" folder and index.html file |
|
109
|
|
|
$this->makeDirAndCopyFile('blocks', $indexFile, 'index.html'); |
|
110
|
|
|
} |
|
111
|
|
|
$language = ($GLOBALS['xoopsConfig']['language'] != 'english') ? $GLOBALS['xoopsConfig']['language'] : 'english'; |
|
112
|
|
|
$copyFiles = array('class' => $indexFile, 'include' => $indexFile, 'language' => $indexFile, 'assets' => $indexFile, 'assets/css' => $indexFile, |
|
113
|
|
|
'assets/icons' => $indexFile, 'assets/icons/16' => $indexFile, 'assets/icons/32' => $indexFile, 'docs' => $indexFile, |
|
114
|
|
|
'assets/images' => $indexFile, 'assets/js' => $indexFile, 'language/'.$language => $indexFile, 'language/'.$language.'/help' => $indexFile, 'preloads' => $indexFile, ); |
|
115
|
|
|
foreach ($copyFiles as $k => $v) { |
|
116
|
|
|
// Creation of folders and index.html file |
|
117
|
|
|
$this->makeDirAndCopyFile($k, $v, 'index.html'); |
|
118
|
|
|
} |
|
119
|
|
|
//Copy the logo of the module |
|
120
|
|
|
$modImage = str_replace(' ', '', strtolower($module->getVar('mod_image'))); |
|
121
|
|
|
$this->copyFile('assets/images', TDMC_UPLOAD_IMGMOD_PATH.'/'.$modImage, $modImage); |
|
122
|
|
|
// Copy of 'module_author_logo.gif' file in uploads dir |
|
123
|
|
|
$logoGifFrom = TDMC_UPLOAD_IMGMOD_PATH.'/'.$stlModuleAuthor.'_logo.gif'; |
|
124
|
|
|
// If file exists |
|
125
|
|
|
if (!file_exists($logoGifFrom)) { |
|
126
|
|
|
// Rename file |
|
127
|
|
|
$copyFile = TDMC_IMAGES_LOGOS_URL.'/xoopsdevelopmentteam_logo.gif'; |
|
128
|
|
|
$copyNewFile = $logoGifFrom; |
|
129
|
|
|
copy($copyFile, $copyNewFile); |
|
130
|
|
|
} else { |
|
131
|
|
|
// Copy file |
|
132
|
|
|
$copyFile = TDMC_IMAGES_LOGOS_URL.'/'.$stlModuleAuthor.'_logo.gif'; |
|
133
|
|
|
$copyNewFile = $logoGifFrom; |
|
134
|
|
|
copy($copyFile, $copyNewFile); |
|
135
|
|
|
} |
|
136
|
|
|
// Creation of 'module_author_logo.gif' file |
|
137
|
|
|
$this->copyFile('assets/images', $copyNewFile, $stlModuleAuthor.'_logo.gif'); |
|
138
|
|
|
$docs = array('/credits.txt' => 'credits.txt', '/install.txt' => 'install.txt', |
|
139
|
|
|
'/lang_diff.txt' => 'lang_diff.txt', '/license.txt' => 'license.txt', '/readme.txt' => 'readme.txt', ); |
|
140
|
|
|
foreach ($docs as $k => $v) { |
|
141
|
|
|
// Creation of folder docs and .txt files |
|
142
|
|
|
$this->makeDirAndCopyFile('docs', TDMC_DOCS_PATH.$k, $v); |
|
143
|
|
|
} |
|
144
|
|
|
if (1 == $module->getVar('mod_admin')) { |
|
145
|
|
|
// Creation of "templates" folder and index.html file |
|
146
|
|
|
$this->makeDirAndCopyFile('templates', $indexFile, 'index.html'); |
|
147
|
|
|
} |
|
148
|
|
|
if (1 == $module->getVar('mod_admin')) { |
|
149
|
|
|
// Creation of "templates/admin" folder and index.html file |
|
150
|
|
|
$this->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html'); |
|
151
|
|
|
} |
|
152
|
|
|
if (!empty($tableName)) { |
|
153
|
|
|
if ((1 == $module->getVar('mod_blocks')) && (1 == $table->getVar('table_blocks'))) { |
|
154
|
|
|
// Creation of "templates/blocks" folder and index.html file |
|
155
|
|
|
$this->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.html'); |
|
156
|
|
|
} |
|
157
|
|
|
// Creation of "sql" folder and index.html file |
|
158
|
|
|
$this->makeDirAndCopyFile('sql', $indexFile, 'index.html'); |
|
159
|
|
|
if ((1 == $module->getVar('mod_notifications')) && (1 == $table->getVar('table_notifications'))) { |
|
160
|
|
|
// Creation of "language/local_language/mail_template" folder and index.html file |
|
161
|
|
|
$this->makeDirAndCopyFile('language/'.$language.'/mail_template', $indexFile, 'index.html'); |
|
162
|
|
|
} |
|
163
|
|
|
} |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
/* |
|
167
|
|
|
* @public function setFilesToBuilding |
|
168
|
|
|
* @param string $module |
|
169
|
|
|
*/ |
|
170
|
|
|
/** |
|
171
|
|
|
* @param $module |
|
172
|
|
|
* |
|
173
|
|
|
* @return array |
|
174
|
|
|
*/ |
|
175
|
|
|
public function setFilesToBuilding($module) |
|
176
|
|
|
{ |
|
177
|
|
|
// Module |
|
178
|
|
|
$modId = $module->getVar('mod_id'); |
|
179
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
|
180
|
|
|
$icon32 = 'assets/icons/32'; |
|
181
|
|
|
$tables = $this->tdmcfile->getTableTables($modId); |
|
182
|
|
|
$files = $this->tdmcfile->getTableMoreFiles($modId); |
|
183
|
|
|
$ret = array(); |
|
184
|
|
|
// |
|
185
|
|
|
$table = array(); |
|
186
|
|
|
$tableCategory = array(); |
|
187
|
|
|
$tableName = array(); |
|
|
|
|
|
|
188
|
|
|
$tableAdmin = array(); |
|
189
|
|
|
$tableUser = array(); |
|
190
|
|
|
$tableBlocks = array(); |
|
191
|
|
|
$tableSearch = array(); |
|
192
|
|
|
$tableComments = array(); |
|
193
|
|
|
$tableNotifications = array(); |
|
194
|
|
|
$tablePermissions = array(); |
|
195
|
|
|
$tableBroken = array(); |
|
196
|
|
|
$tablePdf = array(); |
|
197
|
|
|
$tablePrint = array(); |
|
198
|
|
|
$tableRate = array(); |
|
199
|
|
|
$tableRss = array(); |
|
200
|
|
|
$tableSingle = array(); |
|
201
|
|
|
$tableSubmit = array(); |
|
202
|
|
|
$tableVisit = array(); |
|
203
|
|
|
$tableTag = array(); |
|
204
|
|
|
foreach (array_keys($tables) as $t) { |
|
205
|
|
|
$tableId = $tables[$t]->getVar('table_id'); |
|
206
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
|
207
|
|
|
$tableCategory[] = $tables[$t]->getVar('table_category'); |
|
208
|
|
|
$tableImage = $tables[$t]->getVar('table_image'); |
|
209
|
|
|
$tableAdmin[] = $tables[$t]->getVar('table_admin'); |
|
210
|
|
|
$tableUser[] = $tables[$t]->getVar('table_user'); |
|
211
|
|
|
$tableBlocks[] = $tables[$t]->getVar('table_blocks'); |
|
212
|
|
|
$tableSearch[] = $tables[$t]->getVar('table_search'); |
|
213
|
|
|
$tableComments[] = $tables[$t]->getVar('table_comments'); |
|
214
|
|
|
$tableNotifications[] = $tables[$t]->getVar('table_notifications'); |
|
215
|
|
|
$tablePermissions[] = $tables[$t]->getVar('table_permissions'); |
|
216
|
|
|
$tableBroken[] = $tables[$t]->getVar('table_broken'); |
|
217
|
|
|
$tablePdf[] = $tables[$t]->getVar('table_pdf'); |
|
218
|
|
|
$tablePrint[] = $tables[$t]->getVar('table_print'); |
|
219
|
|
|
$tableRate[] = $tables[$t]->getVar('table_rate'); |
|
220
|
|
|
$tableRss[] = $tables[$t]->getVar('table_rss'); |
|
221
|
|
|
$tableSingle[] = $tables[$t]->getVar('table_single'); |
|
222
|
|
|
$tableSubmit[] = $tables[$t]->getVar('table_submit'); |
|
223
|
|
|
$tableVisit[] = $tables[$t]->getVar('table_visit'); |
|
224
|
|
|
$tableTag[] = $tables[$t]->getVar('table_tag'); |
|
225
|
|
|
// Get Table Object |
|
226
|
|
|
$table = $this->tdmcreate->getHandler('tables')->get($tableId); |
|
227
|
|
|
// Copy of tables images file |
|
228
|
|
|
if (file_exists($uploadTableImage = TDMC_UPLOAD_IMGTAB_PATH.'/'.$tableImage)) { |
|
229
|
|
|
$this->copyFile($icon32, $uploadTableImage, $tableImage); |
|
230
|
|
|
} elseif (file_exists($uploadTableImage = XOOPS_ICONS32_PATH.'/'.$tableImage)) { |
|
231
|
|
|
$this->copyFile($icon32, $uploadTableImage, $tableImage); |
|
232
|
|
|
} |
|
233
|
|
|
// Creation of admin files |
|
234
|
|
|
if (in_array(1, $tableAdmin)) { |
|
235
|
|
|
// Admin Pages File |
|
236
|
|
|
$adminPages = AdminPages::getInstance(); |
|
237
|
|
|
$adminPages->write($module, $table); |
|
238
|
|
|
$ret[] = $adminPages->renderFile($tableName.'.php'); |
|
239
|
|
|
// Admin Templates File |
|
240
|
|
|
$adminTemplatesPages = TemplatesAdminPages::getInstance(); |
|
241
|
|
|
$adminTemplatesPages->write($module, $table); |
|
242
|
|
|
$ret[] = $adminTemplatesPages->renderFile($moduleDirname.'_admin_'.$tableName.'.tpl'); |
|
243
|
|
|
} |
|
244
|
|
|
// Creation of blocks |
|
245
|
|
|
if (in_array(1, $tableBlocks)) { |
|
246
|
|
|
// Blocks Files |
|
247
|
|
|
$blocksFiles = BlocksFiles::getInstance(); |
|
248
|
|
|
$blocksFiles->write($module, $table); |
|
249
|
|
|
$ret[] = $blocksFiles->renderFile($tableName.'.php'); |
|
250
|
|
|
// Templates Blocks Files |
|
251
|
|
|
$templatesBlocks = TemplatesBlocks::getInstance(); |
|
252
|
|
|
$templatesBlocks->write($module, $table); |
|
253
|
|
|
$ret[] = $templatesBlocks->renderFile($moduleDirname.'_block_'.$tableName.'.tpl'); |
|
254
|
|
|
} |
|
255
|
|
|
// Creation of classes |
|
256
|
|
|
if (in_array(1, $tableAdmin) || in_array(1, $tableUser)) { |
|
257
|
|
|
// Class Files |
|
258
|
|
|
$classFiles = ClassFiles::getInstance(); |
|
259
|
|
|
$classFiles->write($module, $table, $tables); |
|
260
|
|
|
$ret[] = $classFiles->renderFile($tableName.'.php'); |
|
261
|
|
|
} |
|
262
|
|
|
// Creation of user files |
|
263
|
|
|
if (in_array(1, $tableUser)) { |
|
264
|
|
|
// User Pages File |
|
265
|
|
|
$userPages = UserPages::getInstance(); |
|
266
|
|
|
$userPages->write($module, $table, $tableName.'.php'); |
|
267
|
|
|
$ret[] = $userPages->renderFile(); |
|
268
|
|
|
if (in_array(0, $tableCategory)) { |
|
269
|
|
|
// User Templates File |
|
270
|
|
|
$userTemplatesPages = TemplatesUserPages::getInstance(); |
|
271
|
|
|
$userTemplatesPages->write($module, $table); |
|
272
|
|
|
$ret[] = $userTemplatesPages->renderFile($moduleDirname.'_'.$tableName.'.tpl'); |
|
273
|
|
|
// User List Templates File |
|
274
|
|
|
$userTemplatesPagesList = TemplatesUserPagesList::getInstance(); |
|
275
|
|
|
$userTemplatesPagesList->write($module, $table, $tables, $moduleDirname.'_'.$tableName.'_list'.'.tpl'); |
|
276
|
|
|
$ret[] = $userTemplatesPagesList->renderFile(); |
|
277
|
|
|
} |
|
278
|
|
|
if (in_array(1, $tableCategory)) { |
|
279
|
|
|
// User List Templates File |
|
280
|
|
|
$userTemplatesCategories = TemplatesUserCategories::getInstance(); |
|
281
|
|
|
$userTemplatesCategories->write($module, $table); |
|
282
|
|
|
$ret[] = $userTemplatesCategories->renderFile($moduleDirname.'_'.$tableName.'.tpl'); |
|
283
|
|
|
// User List Templates File |
|
284
|
|
|
$userTemplatesCategoriesList = TemplatesUserCategoriesList::getInstance(); |
|
285
|
|
|
$userTemplatesCategoriesList->write($module, $table); |
|
286
|
|
|
$ret[] = $userTemplatesCategoriesList->renderFile($moduleDirname.'_'.$tableName.'_list'.'.tpl'); |
|
287
|
|
|
} |
|
288
|
|
|
} |
|
289
|
|
|
} |
|
290
|
|
|
foreach (array_keys($files) as $t) { |
|
291
|
|
|
$fileName = $files[$t]->getVar('file_name'); |
|
292
|
|
|
$fileExtension = $files[$t]->getVar('file_extension'); |
|
293
|
|
|
$fileInfolder = $files[$t]->getVar('file_infolder'); |
|
294
|
|
|
// More File |
|
295
|
|
|
$moreFiles = TDMCreateMoreFiles::getInstance(); |
|
296
|
|
|
$moreFiles->write($module, $fileName, $fileInfolder, $fileExtension); |
|
297
|
|
|
$ret[] = $moreFiles->render(); |
|
298
|
|
|
} |
|
299
|
|
|
// Language Modinfo File |
|
300
|
|
|
$languageModinfo = LanguageModinfo::getInstance(); |
|
301
|
|
|
$languageModinfo->write($module, $table, $tables, 'modinfo.php'); |
|
302
|
|
|
$ret[] = $languageModinfo->render(); |
|
303
|
|
|
if (1 == $module->getVar('mod_admin')) { |
|
304
|
|
|
// Admin Header File |
|
305
|
|
|
$adminHeader = AdminHeader::getInstance(); |
|
306
|
|
|
$adminHeader->write($module, $table, $tables, 'header.php'); |
|
307
|
|
|
$ret[] = $adminHeader->render(); |
|
308
|
|
|
// Admin Index File |
|
309
|
|
|
$adminIndex = AdminIndex::getInstance(); |
|
310
|
|
|
$adminIndex->write($module, $tables, 'index.php'); |
|
311
|
|
|
$ret[] = $adminIndex->render(); |
|
312
|
|
|
// Admin Menu File |
|
313
|
|
|
$adminMenu = AdminMenu::getInstance(); |
|
314
|
|
|
$adminMenu->write($module, $tables, 'menu.php'); |
|
315
|
|
|
$ret[] = $adminMenu->render(); |
|
316
|
|
|
// Admin About File |
|
317
|
|
|
$adminAbout = AdminAbout::getInstance(); |
|
318
|
|
|
$adminAbout->write($module, 'about.php'); |
|
319
|
|
|
$ret[] = $adminAbout->render(); |
|
320
|
|
|
// Admin Footer File |
|
321
|
|
|
$adminFooter = AdminFooter::getInstance(); |
|
322
|
|
|
$adminFooter->write($module, 'footer.php'); |
|
323
|
|
|
$ret[] = $adminFooter->render(); |
|
324
|
|
|
// Templates Admin About File |
|
325
|
|
|
$adminTemplatesAbout = TemplatesAdminAbout::getInstance(); |
|
326
|
|
|
$adminTemplatesAbout->write($module, $moduleDirname.'_admin_about.tpl'); |
|
327
|
|
|
$ret[] = $adminTemplatesAbout->render(); |
|
328
|
|
|
// Templates Admin Index File |
|
329
|
|
|
$adminTemplatesIndex = TemplatesAdminIndex::getInstance(); |
|
330
|
|
|
$adminTemplatesIndex->write($module, $moduleDirname.'_admin_index.tpl'); |
|
331
|
|
|
$ret[] = $adminTemplatesIndex->render(); |
|
332
|
|
|
// Templates Admin Footer File |
|
333
|
|
|
$adminTemplatesFooter = TemplatesAdminFooter::getInstance(); |
|
334
|
|
|
$adminTemplatesFooter->write($module, $moduleDirname.'_admin_footer.tpl'); |
|
335
|
|
|
$ret[] = $adminTemplatesFooter->render(); |
|
336
|
|
|
// Templates Admin Header File |
|
337
|
|
|
$adminTemplatesHeader = TemplatesAdminHeader::getInstance(); |
|
338
|
|
|
$adminTemplatesHeader->write($module, $moduleDirname.'_admin_header.tpl'); |
|
339
|
|
|
$ret[] = $adminTemplatesHeader->render(); |
|
340
|
|
|
// Language Admin File |
|
341
|
|
|
$languageAdmin = LanguageAdmin::getInstance(); |
|
342
|
|
|
$languageAdmin->write($module, $table, $tables, 'admin.php'); |
|
343
|
|
|
$ret[] = $languageAdmin->render(); |
|
344
|
|
|
} |
|
345
|
|
|
// Class Helper File |
|
346
|
|
|
$classHelper = ClassHelper::getInstance(); |
|
347
|
|
|
$classHelper->write($module, 'helper.php'); |
|
348
|
|
|
$ret[] = $classHelper->render(); |
|
349
|
|
|
// Include Functions File |
|
350
|
|
|
$includeFunctions = IncludeFunctions::getInstance(); |
|
351
|
|
|
$includeFunctions->write($module, $table, 'functions.php'); |
|
352
|
|
|
$ret[] = $includeFunctions->render(); |
|
353
|
|
|
// Creation of blocks language file |
|
354
|
|
|
if ($table->getVar('table_name') != null) { |
|
355
|
|
|
// Include Install File |
|
356
|
|
|
$includeInstall = IncludeInstall::getInstance(); |
|
357
|
|
|
$includeInstall->write($module, $table, $tables, 'install.php'); |
|
358
|
|
|
$ret[] = $includeInstall->render(); |
|
359
|
|
|
if (in_array(1, $tableBlocks)) { |
|
360
|
|
|
// Language Blocks File |
|
361
|
|
|
$languageBlocks = LanguageBlocks::getInstance(); |
|
362
|
|
|
$languageBlocks->write($module, $tables, 'blocks.php'); |
|
363
|
|
|
$ret[] = $languageBlocks->render(); |
|
364
|
|
|
} |
|
365
|
|
|
// Creation of admin permission files |
|
366
|
|
|
if (in_array(1, $tablePermissions)) { |
|
367
|
|
|
// Admin Permissions File |
|
368
|
|
|
$adminPermissions = AdminPermissions::getInstance(); |
|
369
|
|
|
$adminPermissions->write($module, $tables, 'permissions.php'); |
|
370
|
|
|
$ret[] = $adminPermissions->render(); |
|
371
|
|
|
// Templates Admin Permissions File |
|
372
|
|
|
$adminTemplatesPermissions = TemplatesAdminPermissions::getInstance(); |
|
373
|
|
|
$adminTemplatesPermissions->write($module, $moduleDirname.'_admin_permissions.tpl'); |
|
374
|
|
|
$ret[] = $adminTemplatesPermissions->render(); |
|
375
|
|
|
} |
|
376
|
|
|
// Creation of notifications files |
|
377
|
|
|
if (in_array(1, $tableNotifications)) { |
|
378
|
|
|
// Include Notifications File |
|
379
|
|
|
$includeNotifications = IncludeNotifications::getInstance(); |
|
380
|
|
|
$includeNotifications->write($module, $table, 'notifications.inc.php'); |
|
381
|
|
|
$ret[] = $includeNotifications->render(); |
|
382
|
|
|
// Language Mail Template Category File |
|
383
|
|
|
$languageMailTpl = LanguageMailTpl::getInstance(); |
|
384
|
|
|
$languageMailTpl->write($module, 'category_new_notify.tpl'); |
|
385
|
|
|
$ret[] = $languageMailTpl->render(); |
|
386
|
|
|
} |
|
387
|
|
|
// Creation of sql file |
|
388
|
|
|
if ($table->getVar('table_name') != null) { |
|
389
|
|
|
// Sql File |
|
390
|
|
|
$sqlFile = SqlFile::getInstance(); |
|
391
|
|
|
$sqlFile->write($module, $tables, 'mysql.sql'); |
|
392
|
|
|
$ret[] = $sqlFile->render(); |
|
393
|
|
|
// Include Update File |
|
394
|
|
|
$includeUpdate = IncludeUpdate::getInstance(); |
|
395
|
|
|
$includeUpdate->write($module, 'update.php'); |
|
396
|
|
|
$ret[] = $includeUpdate->renderFile(); |
|
397
|
|
|
} |
|
398
|
|
|
// Creation of search file |
|
399
|
|
|
if (in_array(1, $tableSearch)) { |
|
400
|
|
|
// Include Search File |
|
401
|
|
|
$includeSearch = IncludeSearch::getInstance(); |
|
402
|
|
|
$includeSearch->write($module, $table, 'search.inc.php'); |
|
403
|
|
|
$ret[] = $includeSearch->render(); |
|
404
|
|
|
} |
|
405
|
|
|
// Creation of comments files |
|
406
|
|
|
if (in_array(1, $tableComments)) { |
|
407
|
|
|
// Include Comments File |
|
408
|
|
|
$includeComments = IncludeComments::getInstance(); |
|
409
|
|
|
$includeComments->write($module, $table); |
|
410
|
|
|
$ret[] = $includeComments->renderCommentsIncludes($module, 'comment_edit'); |
|
411
|
|
|
// Include Comments File |
|
412
|
|
|
$includeComments = IncludeComments::getInstance(); |
|
413
|
|
|
$includeComments->write($module, $table); |
|
414
|
|
|
$ret[] = $includeComments->renderCommentsIncludes($module, 'comment_delete'); |
|
415
|
|
|
// Include Comments File |
|
416
|
|
|
$includeComments = IncludeComments::getInstance(); |
|
417
|
|
|
$includeComments->write($module, $table); |
|
418
|
|
|
$ret[] = $includeComments->renderCommentsIncludes($module, 'comment_post'); |
|
419
|
|
|
// Include Comments File |
|
420
|
|
|
$includeComments = IncludeComments::getInstance(); |
|
421
|
|
|
$includeComments->write($module, $table); |
|
422
|
|
|
$ret[] = $includeComments->renderCommentsIncludes($module, 'comment_reply'); |
|
423
|
|
|
// Include Comments File |
|
424
|
|
|
$includeComments = IncludeComments::getInstance(); |
|
425
|
|
|
$includeComments->write($module, $table); |
|
426
|
|
|
$ret[] = $includeComments->renderCommentsNew($module, 'comment_new'); |
|
427
|
|
|
// Include Comment Functions File |
|
428
|
|
|
$includeCommentFunctions = IncludeCommentFunctions::getInstance(); |
|
429
|
|
|
$includeCommentFunctions->write($module, $table, 'comment_functions.php'); |
|
430
|
|
|
$ret[] = $includeCommentFunctions->renderFile(); |
|
431
|
|
|
} |
|
432
|
|
|
} |
|
433
|
|
|
// Creation of admin files |
|
434
|
|
|
if (1 == $module->getVar('mod_admin')) { |
|
435
|
|
|
// Templates Index File |
|
436
|
|
|
$userTemplatesIndex = TemplatesUserIndex::getInstance(); |
|
437
|
|
|
$userTemplatesIndex->write($module, $table, $tables, $moduleDirname.'_index.tpl'); |
|
438
|
|
|
$ret[] = $userTemplatesIndex->render(); |
|
439
|
|
|
// Templates Footer File |
|
440
|
|
|
$userTemplatesFooter = TemplatesUserFooter::getInstance(); |
|
441
|
|
|
$userTemplatesFooter->write($module, $table, $moduleDirname.'_footer.tpl'); |
|
442
|
|
|
$ret[] = $userTemplatesFooter->render(); |
|
443
|
|
|
// Templates Header File |
|
444
|
|
|
$userTemplatesHeader = TemplatesUserHeader::getInstance(); |
|
445
|
|
|
$userTemplatesHeader->write($module, $moduleDirname.'_header.tpl'); |
|
446
|
|
|
$ret[] = $userTemplatesHeader->render(); |
|
447
|
|
|
} |
|
448
|
|
|
// Creation of user files |
|
449
|
|
|
if ((1 == $module->getVar('mod_user')) && in_array(1, $tableUser)) { |
|
450
|
|
|
// User Footer File |
|
451
|
|
|
$userFooter = UserFooter::getInstance(); |
|
452
|
|
|
$userFooter->write($module, 'footer.php'); |
|
453
|
|
|
$ret[] = $userFooter->render(); |
|
454
|
|
|
// User Header File |
|
455
|
|
|
$userHeader = UserHeader::getInstance(); |
|
456
|
|
|
$userHeader->write($module, $table, $tables, 'header.php'); |
|
457
|
|
|
$ret[] = $userHeader->render(); |
|
458
|
|
|
// User Notification Update File |
|
459
|
|
|
if ((1 == $module->getVar('mod_notifications')) && in_array(1, $tableNotifications)) { |
|
460
|
|
|
$userNotificationUpdate = UserNotificationUpdate::getInstance(); |
|
461
|
|
|
$userNotificationUpdate->write($module, 'notification_update.php'); |
|
462
|
|
|
$ret[] = $userNotificationUpdate->render(); |
|
463
|
|
|
} |
|
464
|
|
|
// User Broken File |
|
465
|
|
|
if (in_array(1, $tableBroken)) { |
|
466
|
|
|
$userBroken = UserBroken::getInstance(); |
|
467
|
|
|
$userBroken->write($module, $table, 'broken.php'); |
|
468
|
|
|
$ret[] = $userBroken->render(); |
|
469
|
|
|
// User Templates Broken File |
|
470
|
|
|
$userTemplatesBroken = TemplatesUserBroken::getInstance(); |
|
471
|
|
|
$userTemplatesBroken->write($module, $table); |
|
472
|
|
|
$ret[] = $userTemplatesBroken->renderFile($moduleDirname.'_broken.tpl'); |
|
473
|
|
|
} |
|
474
|
|
|
// User Pdf File |
|
475
|
|
|
if (in_array(1, $tablePdf)) { |
|
476
|
|
|
$userPdf = UserPdf::getInstance(); |
|
477
|
|
|
$userPdf->write($module, $table, 'pdf.php'); |
|
478
|
|
|
$ret[] = $userPdf->render(); |
|
479
|
|
|
// User Templates Pdf File |
|
480
|
|
|
$userTemplatesPdf = TemplatesUserPdf::getInstance(); |
|
481
|
|
|
$userTemplatesPdf->write($module); |
|
482
|
|
|
$ret[] = $userTemplatesPdf->renderFile($moduleDirname.'_pdf.tpl'); |
|
483
|
|
|
} |
|
484
|
|
|
// User Print File |
|
485
|
|
|
if (in_array(1, $tablePrint)) { |
|
486
|
|
|
$userPrint = UserPrint::getInstance(); |
|
487
|
|
|
$userPrint->write($module, $table, 'print.php'); |
|
488
|
|
|
$ret[] = $userPrint->render(); |
|
489
|
|
|
// User Templates Print File |
|
490
|
|
|
$userTemplatesPrint = TemplatesUserPrint::getInstance(); |
|
491
|
|
|
$userTemplatesPrint->write($module, $table); |
|
492
|
|
|
$ret[] = $userTemplatesPrint->renderFile($moduleDirname.'_print.tpl'); |
|
493
|
|
|
} |
|
494
|
|
|
// User Rate File |
|
495
|
|
|
if (in_array(1, $tableRate)) { |
|
496
|
|
|
$userRate = UserRate::getInstance(); |
|
497
|
|
|
$userRate->write($module, $table, 'rate.php'); |
|
498
|
|
|
$ret[] = $userRate->render(); |
|
499
|
|
|
// User Templates Rate File |
|
500
|
|
|
$userTemplatesRate = TemplatesUserRate::getInstance(); |
|
501
|
|
|
$userTemplatesRate->write($module, $table); |
|
502
|
|
|
$ret[] = $userTemplatesRate->renderFile($moduleDirname.'_rate.tpl'); |
|
503
|
|
|
} |
|
504
|
|
|
// User Rss File |
|
505
|
|
|
if (in_array(1, $tableRss)) { |
|
506
|
|
|
$userRss = UserRss::getInstance(); |
|
507
|
|
|
$userRss->write($module, $table, 'rss.php'); |
|
508
|
|
|
$ret[] = $userRss->render(); |
|
509
|
|
|
// User Templates Rss File |
|
510
|
|
|
$userTemplatesRss = TemplatesUserRss::getInstance(); |
|
511
|
|
|
$userTemplatesRss->write($module); |
|
512
|
|
|
$ret[] = $userTemplatesRss->renderFile($moduleDirname.'_rss.tpl'); |
|
513
|
|
|
} |
|
514
|
|
|
// User Single File |
|
515
|
|
|
if (in_array(1, $tableSingle)) { |
|
516
|
|
|
$userSingle = UserSingle::getInstance(); |
|
517
|
|
|
$userSingle->write($module, $table, 'single.php'); |
|
518
|
|
|
$ret[] = $userSingle->render(); |
|
519
|
|
|
// User Templates Single File |
|
520
|
|
|
$userTemplatesSingle = TemplatesUserSingle::getInstance(); |
|
521
|
|
|
$userTemplatesSingle->write($module, $table); |
|
522
|
|
|
$ret[] = $userTemplatesSingle->renderFile($moduleDirname.'_single.tpl'); |
|
523
|
|
|
} |
|
524
|
|
|
// User Submit File |
|
525
|
|
|
if (in_array(1, $tableSubmit)) { |
|
526
|
|
|
$userSubmit = UserSubmit::getInstance(); |
|
527
|
|
|
$userSubmit->write($module, $table, 'submit.php'); |
|
528
|
|
|
$ret[] = $userSubmit->render(); |
|
529
|
|
|
// User Templates Submit File |
|
530
|
|
|
$userTemplatesSubmit = TemplatesUserSubmit::getInstance(); |
|
531
|
|
|
$userTemplatesSubmit->write($module, $table); |
|
532
|
|
|
$ret[] = $userTemplatesSubmit->renderFile($moduleDirname.'_submit.tpl'); |
|
533
|
|
|
}// User Visit File |
|
534
|
|
|
if (in_array(1, $tableVisit)) { |
|
535
|
|
|
$userVisit = UserVisit::getInstance(); |
|
536
|
|
|
$userVisit->write($module, $table, 'visit.php'); |
|
537
|
|
|
$ret[] = $userVisit->render(); |
|
538
|
|
|
} |
|
539
|
|
|
// User Tag Files |
|
540
|
|
|
if (in_array(1, $tableTag)) { |
|
541
|
|
|
$userListTag = UserListTag::getInstance(); |
|
542
|
|
|
$userListTag->write($module, 'list.tag.php'); |
|
543
|
|
|
$ret[] = $userListTag->render(); |
|
544
|
|
|
$userViewTag = UserViewTag::getInstance(); |
|
545
|
|
|
$userViewTag->write($module, 'view.tag.php'); |
|
546
|
|
|
$ret[] = $userViewTag->render(); |
|
547
|
|
|
} |
|
548
|
|
|
// User Index File |
|
549
|
|
|
$userIndex = UserIndex::getInstance(); |
|
550
|
|
|
$userIndex->write($module, $table, 'index.php'); |
|
551
|
|
|
$ret[] = $userIndex->render(); |
|
552
|
|
|
// Language Main File |
|
553
|
|
|
$languageMain = LanguageMain::getInstance(); |
|
554
|
|
|
$languageMain->write($module, $tables, 'main.php'); |
|
555
|
|
|
$ret[] = $languageMain->render(); |
|
556
|
|
|
// User Templates Submit File |
|
557
|
|
|
$userTemplatesUserBreadcrumbs = TemplatesUserBreadcrumbs::getInstance(); |
|
558
|
|
|
$userTemplatesUserBreadcrumbs->write($module, $moduleDirname.'_breadcrumbs.tpl'); |
|
559
|
|
|
$ret[] = $userTemplatesUserBreadcrumbs->render(); |
|
560
|
|
|
} |
|
561
|
|
|
// Css Styles File |
|
562
|
|
|
$cssStyles = CssStyles::getInstance(); |
|
563
|
|
|
$cssStyles->write($module, 'style.css'); |
|
564
|
|
|
$ret[] = $cssStyles->render(); |
|
565
|
|
|
// Include Jquery File |
|
566
|
|
|
$JavascriptJQuery = JavascriptJQuery::getInstance(); |
|
567
|
|
|
$JavascriptJQuery->write($module, 'functions.js'); |
|
568
|
|
|
$ret[] = $JavascriptJQuery->render(); |
|
569
|
|
|
// Include Common File |
|
570
|
|
|
$includeCommon = IncludeCommon::getInstance(); |
|
571
|
|
|
$includeCommon->write($module, $table, 'common.php'); |
|
572
|
|
|
$ret[] = $includeCommon->render(); |
|
573
|
|
|
// Docs Changelog File |
|
574
|
|
|
$docsChangelog = DocsChangelog::getInstance(); |
|
575
|
|
|
$docsChangelog->write($module, 'changelog.txt'); |
|
576
|
|
|
$ret[] = $docsChangelog->render(); |
|
577
|
|
|
// Language Help File |
|
578
|
|
|
$languageHelp = LanguageHelp::getInstance(); |
|
579
|
|
|
$languageHelp->write($module, 'help.html'); |
|
580
|
|
|
$ret[] = $languageHelp->render(); |
|
581
|
|
|
// User Xoops Version File |
|
582
|
|
|
$userXoopsVersion = UserXoopsVersion::getInstance(); |
|
583
|
|
|
$userXoopsVersion->write($module, $table, $tables, 'xoops_version.php'); |
|
584
|
|
|
$ret[] = $userXoopsVersion->render(); |
|
585
|
|
|
|
|
586
|
|
|
// Return Array |
|
587
|
|
|
return $ret; |
|
588
|
|
|
} |
|
589
|
|
|
} |
|
590
|
|
|
|
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.