|
1
|
|
|
<?php namespace XoopsModules\Tdmcreate\Files\Docs; |
|
2
|
|
|
|
|
3
|
|
|
use XoopsModules\Tdmcreate; |
|
4
|
|
|
use XoopsModules\Tdmcreate\Files; |
|
5
|
|
|
|
|
6
|
|
|
/* |
|
7
|
|
|
You may not change or alter any portion of this comment or credits |
|
8
|
|
|
of supporting developers from this source code or any supporting source code |
|
9
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
10
|
|
|
|
|
11
|
|
|
This program is distributed in the hope that it will be useful, |
|
12
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
14
|
|
|
*/ |
|
15
|
|
|
/** |
|
16
|
|
|
* tdmcreate module. |
|
17
|
|
|
* |
|
18
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
19
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
20
|
|
|
* |
|
21
|
|
|
* @since 2.5.0 |
|
22
|
|
|
* |
|
23
|
|
|
* @author Txmod Xoops http://www.txmodxoops.org |
|
24
|
|
|
* |
|
25
|
|
|
* @version $Id: DocsFiles.php 12258 2014-01-02 09:33:29Z timgno $ |
|
26
|
|
|
*/ |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Class DocsFiles. |
|
30
|
|
|
*/ |
|
31
|
|
|
class DocsFiles extends Files\CreateFile |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* @public function constructor |
|
35
|
|
|
* @param null |
|
36
|
|
|
*/ |
|
37
|
|
|
|
|
38
|
|
|
public function __construct() |
|
39
|
|
|
{ |
|
40
|
|
|
parent::__construct(); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @static function getInstance |
|
45
|
|
|
* @param null |
|
46
|
|
|
*/ |
|
47
|
|
|
/** |
|
48
|
|
|
* @return DocsFiles |
|
49
|
|
|
*/ |
|
50
|
|
|
public static function getInstance() |
|
51
|
|
|
{ |
|
52
|
|
|
static $instance = false; |
|
53
|
|
|
if (!$instance) { |
|
54
|
|
|
$instance = new self(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
return $instance; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @public function write |
|
62
|
|
|
* @param string $module |
|
63
|
|
|
* @param string $filename |
|
64
|
|
|
*/ |
|
65
|
|
|
/** |
|
66
|
|
|
* @param $module |
|
67
|
|
|
* @param $filename |
|
68
|
|
|
*/ |
|
69
|
|
|
public function write($module, $filename) |
|
70
|
|
|
{ |
|
71
|
|
|
$this->setModule($module); |
|
72
|
|
|
$this->setFileName($filename); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @public function getChangeLogFile |
|
77
|
|
|
* @param string $moduleDirname |
|
78
|
|
|
* @param string $mod_version |
|
79
|
|
|
* @param string $mod_author |
|
80
|
|
|
*/ |
|
81
|
|
|
/** |
|
82
|
|
|
* @param $moduleDirname |
|
83
|
|
|
* @param $mod_version |
|
84
|
|
|
* @param $mod_author |
|
85
|
|
|
* |
|
86
|
|
|
* @return string |
|
87
|
|
|
*/ |
|
88
|
|
|
public function getChangeLogFile($moduleDirname, $mod_version, $mod_author) |
|
89
|
|
|
{ |
|
90
|
|
|
$date = date('Y/m/d G:i:s'); |
|
91
|
|
|
$ret = <<<EOT |
|
92
|
|
|
==================================== |
|
93
|
|
|
{$date} Version {$mod_version} |
|
94
|
|
|
==================================== |
|
95
|
|
|
- Original release {$moduleDirname} created with tdmcreate module by ({$mod_author}) |
|
96
|
|
|
EOT; |
|
97
|
|
|
|
|
98
|
|
|
return $ret; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* @public function getCreditsFile |
|
103
|
|
|
* @param $mod_author |
|
104
|
|
|
* @param $mod_credits |
|
105
|
|
|
* @param $mod_author_website_url |
|
106
|
|
|
* @param $mod_description |
|
107
|
|
|
* |
|
108
|
|
|
* @return string |
|
109
|
|
|
*/ |
|
110
|
|
|
public function getCreditsFile($mod_author, $mod_credits, $mod_author_website_url, $mod_description) |
|
111
|
|
|
{ |
|
112
|
|
|
$ret = <<<EOT |
|
113
|
|
|
Read Me First |
|
114
|
|
|
============= |
|
115
|
|
|
|
|
116
|
|
|
Originally created by the {$mod_author}. |
|
117
|
|
|
|
|
118
|
|
|
Modified by {$mod_credits} ({$mod_author_website_url}) |
|
119
|
|
|
|
|
120
|
|
|
Contributors: {$mod_credits} ({$mod_author_website_url}) |
|
121
|
|
|
|
|
122
|
|
|
{$mod_description} |
|
123
|
|
|
EOT; |
|
124
|
|
|
|
|
125
|
|
|
return $ret; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @public function getInstallFile |
|
130
|
|
|
* @param null |
|
131
|
|
|
* @return string |
|
132
|
|
|
*/ |
|
133
|
|
|
public function getInstallFile() |
|
134
|
|
|
{ |
|
135
|
|
|
$ret = <<<'EOT' |
|
136
|
|
|
Read Me First |
|
137
|
|
|
============= |
|
138
|
|
|
|
|
139
|
|
|
Install just like another XOOPS module |
|
140
|
|
|
EOT; |
|
141
|
|
|
|
|
142
|
|
|
return $ret; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @public function getReadmeFile |
|
147
|
|
|
* @param null |
|
148
|
|
|
* @return string |
|
149
|
|
|
*/ |
|
150
|
|
|
public function getReadmeFile() |
|
151
|
|
|
{ |
|
152
|
|
|
$ret = <<<'EOT' |
|
153
|
|
|
Read Me First |
|
154
|
|
|
============= |
|
155
|
|
|
|
|
156
|
|
|
Please make sure that you download the XOOPS Icon Set, and upload it to uploads/images directory |
|
157
|
|
|
Read the table in admin help for the accurate description of the functionality of this module |
|
158
|
|
|
EOT; |
|
159
|
|
|
|
|
160
|
|
|
return $ret; |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* @public function getLangDiffFile |
|
165
|
|
|
* @param $mod_version |
|
166
|
|
|
* |
|
167
|
|
|
* @return string |
|
168
|
|
|
*/ |
|
169
|
|
|
public function getLangDiffFile($mod_version) |
|
170
|
|
|
{ |
|
171
|
|
|
$ret = <<<EOT |
|
172
|
|
|
List of added language defines |
|
173
|
|
|
============= |
|
174
|
|
|
|
|
175
|
|
|
// {$mod_version} |
|
176
|
|
|
EOT; |
|
177
|
|
|
|
|
178
|
|
|
return $ret; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @public function render |
|
183
|
|
|
* @param null |
|
184
|
|
|
* @return bool|string |
|
185
|
|
|
*/ |
|
186
|
|
|
public function render() |
|
187
|
|
|
{ |
|
188
|
|
|
$module = $this->getModule(); |
|
189
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
|
190
|
|
|
$mod_author = $module->getVar('mod_author'); |
|
191
|
|
|
$mod_credits = $module->getVar('mod_credits'); |
|
192
|
|
|
$mod_author_website_url = $module->getVar('mod_author_website_url'); |
|
193
|
|
|
$mod_description = $module->getVar('mod_description'); |
|
194
|
|
|
switch ($filename = $this->getFileName()) { |
|
195
|
|
|
case 'changelog': |
|
196
|
|
|
$content = $this->getChangeLogFile($moduleDirname, $mod_version, $mod_author); |
|
|
|
|
|
|
197
|
|
|
break; |
|
198
|
|
|
case 'credits': |
|
199
|
|
|
$content = $this->getCreditsFile($mod_author, $mod_credits, $mod_author_website_url, $mod_description); |
|
200
|
|
|
break; |
|
201
|
|
|
case 'install': |
|
202
|
|
|
$content = $this->getInstallFile(); |
|
203
|
|
|
break; |
|
204
|
|
|
case 'readme': |
|
205
|
|
|
$content = $this->getReadmeFile(); |
|
206
|
|
|
break; |
|
207
|
|
|
case 'lang_diff': |
|
208
|
|
|
$content = $this->getLangDiffFile($mod_version); |
|
209
|
|
|
break; |
|
210
|
|
|
} |
|
211
|
|
|
$this->create($moduleDirname, 'docs', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED); |
|
|
|
|
|
|
212
|
|
|
|
|
213
|
|
|
return $this->renderFile(); |
|
214
|
|
|
} |
|
215
|
|
|
} |
|
216
|
|
|
|