@@ -130,7 +130,7 @@ |
||
130 | 130 | * duplicate of method in documentParser class |
131 | 131 | * |
132 | 132 | * @param string $propertyString |
133 | - * @return array |
|
133 | + * @return string |
|
134 | 134 | */ |
135 | 135 | function parseProperties($propertyString) { |
136 | 136 | $parameter= array (); |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | |
720 | 720 | /** |
721 | 721 | * @param string $string |
722 | - * @return bool|string |
|
722 | + * @return string|false |
|
723 | 723 | */ |
724 | 724 | function removeLastPath($string) |
725 | 725 | { |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | |
735 | 735 | /** |
736 | 736 | * @param string $string |
737 | - * @return bool|string |
|
737 | + * @return string|false |
|
738 | 738 | */ |
739 | 739 | function getExtension($string) |
740 | 740 | { |
@@ -344,7 +344,7 @@ |
||
344 | 344 | |
345 | 345 | /** |
346 | 346 | * @param string $filepath |
347 | - * @return bool|string |
|
347 | + * @return null|string |
|
348 | 348 | */ |
349 | 349 | function getFileContent($filepath) { |
350 | 350 | global $_lang; |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('import_static')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // Files to upload |
10 | 10 | $allowedfiles = array( |
11 | - 'html', |
|
12 | - 'htm', |
|
13 | - 'shtml', |
|
14 | - 'xml' |
|
11 | + 'html', |
|
12 | + 'htm', |
|
13 | + 'shtml', |
|
14 | + 'xml' |
|
15 | 15 | ); |
16 | 16 | ?> |
17 | 17 | <script language="javascript"> |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | <div class="tab-page"> |
44 | 44 | <div class="container container-body"> |
45 | 45 | <?php |
46 | - if(!isset($_POST['import'])) { |
|
47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
48 | - ?> |
|
46 | + if(!isset($_POST['import'])) { |
|
47 | + echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
48 | + ?> |
|
49 | 49 | <form action="index.php" method="post" name="importFrm"> |
50 | 50 | <input type="hidden" name="import" value="import" /> |
51 | 51 | <input type="hidden" name="a" value="95" /> |
@@ -85,18 +85,18 @@ discard block |
||
85 | 85 | <a href="javascript:;" class="btn btn-primary" onclick="window.importFrm.submit();"><i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang["import_site_start"] ?></a> |
86 | 86 | </form> |
87 | 87 | <?php |
88 | - } else { |
|
89 | - run(); |
|
90 | - $modx->clearCache('full'); |
|
91 | - ?> |
|
88 | + } else { |
|
89 | + run(); |
|
90 | + $modx->clearCache('full'); |
|
91 | + ?> |
|
92 | 92 | <a href="javascript:;" class="btn btn-primary" onclick="window.location.href='index.php?a=2';"><i class="<?= $_style["actions_close"] ?>"></i> <?= $_lang["close"] ?></a> |
93 | 93 | <script type="text/javascript"> |
94 | 94 | top.mainMenu.reloadtree(); |
95 | 95 | parent.tree.ca = 'open'; |
96 | 96 | </script> |
97 | 97 | <?php |
98 | - } |
|
99 | - ?> |
|
98 | + } |
|
99 | + ?> |
|
100 | 100 | </div> |
101 | 101 | </div> |
102 | 102 | |
@@ -105,64 +105,64 @@ discard block |
||
105 | 105 | * @return string |
106 | 106 | */ |
107 | 107 | function run() { |
108 | - global $modx, $_lang; |
|
108 | + global $modx, $_lang; |
|
109 | 109 | |
110 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
111 | - $output = ''; |
|
112 | - $maxtime = $_POST['maxtime']; |
|
110 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
111 | + $output = ''; |
|
112 | + $maxtime = $_POST['maxtime']; |
|
113 | 113 | |
114 | - if(!is_numeric($maxtime)) { |
|
115 | - $maxtime = 30; |
|
116 | - } |
|
114 | + if(!is_numeric($maxtime)) { |
|
115 | + $maxtime = 30; |
|
116 | + } |
|
117 | 117 | |
118 | - @set_time_limit($maxtime); |
|
118 | + @set_time_limit($maxtime); |
|
119 | 119 | |
120 | - $mtime = microtime(); |
|
121 | - $mtime = explode(' ', $mtime); |
|
122 | - $mtime = $mtime[1] + $mtime[0]; |
|
123 | - $importstart = $mtime; |
|
120 | + $mtime = microtime(); |
|
121 | + $mtime = explode(' ', $mtime); |
|
122 | + $mtime = $mtime[1] + $mtime[0]; |
|
123 | + $importstart = $mtime; |
|
124 | 124 | |
125 | - if($_POST['reset'] == 'on') { |
|
126 | - $modx->db->truncate($tbl_site_content); |
|
127 | - $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
|
128 | - } |
|
125 | + if($_POST['reset'] == 'on') { |
|
126 | + $modx->db->truncate($tbl_site_content); |
|
127 | + $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
|
128 | + } |
|
129 | 129 | |
130 | - $parent = (int)$_POST['parent']; |
|
130 | + $parent = (int)$_POST['parent']; |
|
131 | 131 | |
132 | - if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
133 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
134 | - } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
135 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
136 | - } else { |
|
132 | + if(is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
133 | + $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
134 | + } elseif(is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
135 | + $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
136 | + } else { |
|
137 | 137 | $filedir = ''; |
138 | 138 | } |
139 | 139 | |
140 | - $filesfound = 0; |
|
140 | + $filesfound = 0; |
|
141 | 141 | |
142 | - $files = getFiles($filedir); |
|
143 | - $files = pop_index($files); |
|
142 | + $files = getFiles($filedir); |
|
143 | + $files = pop_index($files); |
|
144 | 144 | |
145 | - // no. of files to import |
|
146 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
145 | + // no. of files to import |
|
146 | + $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
147 | 147 | |
148 | - // import files |
|
149 | - if(0 < count($files)) { |
|
150 | - $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
151 | - importFiles($parent, $filedir, $files, 'root'); |
|
152 | - } |
|
148 | + // import files |
|
149 | + if(0 < count($files)) { |
|
150 | + $modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'"); |
|
151 | + importFiles($parent, $filedir, $files, 'root'); |
|
152 | + } |
|
153 | 153 | |
154 | - $mtime = microtime(); |
|
155 | - $mtime = explode(' ', $mtime); |
|
156 | - $mtime = $mtime[1] + $mtime[0]; |
|
157 | - $importend = $mtime; |
|
158 | - $totaltime = ($importend - $importstart); |
|
159 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
154 | + $mtime = microtime(); |
|
155 | + $mtime = explode(' ', $mtime); |
|
156 | + $mtime = $mtime[1] + $mtime[0]; |
|
157 | + $importend = $mtime; |
|
158 | + $totaltime = ($importend - $importstart); |
|
159 | + $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
160 | 160 | |
161 | - if($_POST['convert_link'] == 'on') { |
|
162 | - convertLink(); |
|
163 | - } |
|
161 | + if($_POST['convert_link'] == 'on') { |
|
162 | + convertLink(); |
|
163 | + } |
|
164 | 164 | |
165 | - return $output; |
|
165 | + return $output; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -172,144 +172,144 @@ discard block |
||
172 | 172 | * @param string $mode |
173 | 173 | */ |
174 | 174 | function importFiles($parent, $filedir, $files, $mode) { |
175 | - global $modx; |
|
176 | - global $_lang, $allowedfiles; |
|
177 | - global $search_default, $cache_default, $publish_default; |
|
178 | - |
|
179 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
180 | - $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
181 | - |
|
182 | - $createdby = $modx->getLoginUserID(); |
|
183 | - if(!is_array($files)) { |
|
184 | - return; |
|
185 | - } |
|
186 | - if($_POST['object'] === 'all') { |
|
187 | - $modx->config['default_template'] = '0'; |
|
188 | - $richtext = '0'; |
|
189 | - } else { |
|
190 | - $richtext = '1'; |
|
191 | - } |
|
192 | - |
|
193 | - foreach($files as $id => $value) { |
|
194 | - if(is_array($value)) { |
|
195 | - // create folder |
|
196 | - $alias = $id; |
|
197 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
198 | - $field = array(); |
|
199 | - $field['type'] = 'document'; |
|
200 | - $field['contentType'] = 'text/html'; |
|
201 | - $field['published'] = $publish_default; |
|
202 | - $field['parent'] = $parent; |
|
203 | - $field['alias'] = $modx->stripAlias($alias); |
|
204 | - $field['richtext'] = $richtext; |
|
205 | - $field['template'] = $modx->config['default_template']; |
|
206 | - $field['searchable'] = $search_default; |
|
207 | - $field['cacheable'] = $cache_default; |
|
208 | - $field['createdby'] = $createdby; |
|
209 | - $field['isfolder'] = 1; |
|
210 | - $field['menuindex'] = 1; |
|
211 | - $find = false; |
|
212 | - foreach(array( |
|
213 | - 'index.html', |
|
214 | - 'index.htm' |
|
215 | - ) as $filename) { |
|
216 | - $filepath = $filedir . $alias . '/' . $filename; |
|
217 | - if($find === false && file_exists($filepath)) { |
|
218 | - $file = getFileContent($filepath); |
|
219 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
220 | - |
|
221 | - $date = filemtime($filepath); |
|
222 | - $field['pagetitle'] = $pagetitle; |
|
223 | - $field['longtitle'] = $pagetitle; |
|
224 | - $field['description'] = $description; |
|
225 | - $field['content'] = $modx->db->escape($content); |
|
226 | - $field['createdon'] = $date; |
|
227 | - $field['editedon'] = $date; |
|
228 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
229 | - if($newid) { |
|
230 | - $find = true; |
|
231 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
232 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
233 | - } else { |
|
234 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
235 | - exit; |
|
236 | - } |
|
237 | - } |
|
238 | - } |
|
239 | - if($find === false) { |
|
240 | - $date = time(); |
|
241 | - $field['pagetitle'] = '---'; |
|
242 | - $field['content'] = ''; |
|
243 | - $field['createdon'] = $date; |
|
244 | - $field['editedon'] = $date; |
|
245 | - $field['hidemenu'] = '1'; |
|
246 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
247 | - if($newid) { |
|
248 | - $find = true; |
|
249 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
250 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
251 | - } else { |
|
252 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
253 | - exit; |
|
254 | - } |
|
255 | - } |
|
256 | - } else { |
|
257 | - // create document |
|
258 | - if($mode == 'sub' && $value == 'index.html') { |
|
259 | - continue; |
|
260 | - } |
|
261 | - $filename = $value; |
|
262 | - $fparts = explode('.', $value); |
|
263 | - $alias = $fparts[0]; |
|
264 | - $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
265 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
266 | - |
|
267 | - if(!in_array($ext, $allowedfiles)) { |
|
268 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
269 | - } else { |
|
270 | - $filepath = $filedir . $filename; |
|
271 | - $file = getFileContent($filepath); |
|
272 | - list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
273 | - |
|
274 | - $date = filemtime($filepath); |
|
275 | - $field = array(); |
|
276 | - $field['type'] = 'document'; |
|
277 | - $field['contentType'] = 'text/html'; |
|
278 | - $field['pagetitle'] = $pagetitle; |
|
279 | - $field['longtitle'] = $pagetitle; |
|
280 | - $field['description'] = $description; |
|
281 | - $field['alias'] = $modx->stripAlias($alias); |
|
282 | - $field['published'] = $publish_default; |
|
283 | - $field['parent'] = $parent; |
|
284 | - $field['content'] = $modx->db->escape($content); |
|
285 | - $field['richtext'] = $richtext; |
|
286 | - $field['template'] = $modx->config['default_template']; |
|
287 | - $field['searchable'] = $search_default; |
|
288 | - $field['cacheable'] = $cache_default; |
|
289 | - $field['createdby'] = $createdby; |
|
290 | - $field['createdon'] = $date; |
|
291 | - $field['editedon'] = $date; |
|
292 | - $field['isfolder'] = 0; |
|
293 | - $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
294 | - $newid = $modx->db->insert($field, $tbl_site_content); |
|
295 | - if($newid) { |
|
296 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
297 | - } else { |
|
298 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
299 | - exit; |
|
300 | - } |
|
301 | - |
|
302 | - $is_site_start = false; |
|
303 | - if($filename == 'index.html') { |
|
304 | - $is_site_start = true; |
|
305 | - } |
|
306 | - if($is_site_start == true && $_POST['reset'] == 'on') { |
|
307 | - $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
308 | - $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
309 | - } |
|
310 | - } |
|
311 | - } |
|
312 | - } |
|
175 | + global $modx; |
|
176 | + global $_lang, $allowedfiles; |
|
177 | + global $search_default, $cache_default, $publish_default; |
|
178 | + |
|
179 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
180 | + $tbl_system_settings = $modx->getFullTableName('system_settings'); |
|
181 | + |
|
182 | + $createdby = $modx->getLoginUserID(); |
|
183 | + if(!is_array($files)) { |
|
184 | + return; |
|
185 | + } |
|
186 | + if($_POST['object'] === 'all') { |
|
187 | + $modx->config['default_template'] = '0'; |
|
188 | + $richtext = '0'; |
|
189 | + } else { |
|
190 | + $richtext = '1'; |
|
191 | + } |
|
192 | + |
|
193 | + foreach($files as $id => $value) { |
|
194 | + if(is_array($value)) { |
|
195 | + // create folder |
|
196 | + $alias = $id; |
|
197 | + printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
198 | + $field = array(); |
|
199 | + $field['type'] = 'document'; |
|
200 | + $field['contentType'] = 'text/html'; |
|
201 | + $field['published'] = $publish_default; |
|
202 | + $field['parent'] = $parent; |
|
203 | + $field['alias'] = $modx->stripAlias($alias); |
|
204 | + $field['richtext'] = $richtext; |
|
205 | + $field['template'] = $modx->config['default_template']; |
|
206 | + $field['searchable'] = $search_default; |
|
207 | + $field['cacheable'] = $cache_default; |
|
208 | + $field['createdby'] = $createdby; |
|
209 | + $field['isfolder'] = 1; |
|
210 | + $field['menuindex'] = 1; |
|
211 | + $find = false; |
|
212 | + foreach(array( |
|
213 | + 'index.html', |
|
214 | + 'index.htm' |
|
215 | + ) as $filename) { |
|
216 | + $filepath = $filedir . $alias . '/' . $filename; |
|
217 | + if($find === false && file_exists($filepath)) { |
|
218 | + $file = getFileContent($filepath); |
|
219 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
220 | + |
|
221 | + $date = filemtime($filepath); |
|
222 | + $field['pagetitle'] = $pagetitle; |
|
223 | + $field['longtitle'] = $pagetitle; |
|
224 | + $field['description'] = $description; |
|
225 | + $field['content'] = $modx->db->escape($content); |
|
226 | + $field['createdon'] = $date; |
|
227 | + $field['editedon'] = $date; |
|
228 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
229 | + if($newid) { |
|
230 | + $find = true; |
|
231 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
232 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
233 | + } else { |
|
234 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
235 | + exit; |
|
236 | + } |
|
237 | + } |
|
238 | + } |
|
239 | + if($find === false) { |
|
240 | + $date = time(); |
|
241 | + $field['pagetitle'] = '---'; |
|
242 | + $field['content'] = ''; |
|
243 | + $field['createdon'] = $date; |
|
244 | + $field['editedon'] = $date; |
|
245 | + $field['hidemenu'] = '1'; |
|
246 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
247 | + if($newid) { |
|
248 | + $find = true; |
|
249 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
250 | + importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
251 | + } else { |
|
252 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
253 | + exit; |
|
254 | + } |
|
255 | + } |
|
256 | + } else { |
|
257 | + // create document |
|
258 | + if($mode == 'sub' && $value == 'index.html') { |
|
259 | + continue; |
|
260 | + } |
|
261 | + $filename = $value; |
|
262 | + $fparts = explode('.', $value); |
|
263 | + $alias = $fparts[0]; |
|
264 | + $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
|
265 | + printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
266 | + |
|
267 | + if(!in_array($ext, $allowedfiles)) { |
|
268 | + echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
269 | + } else { |
|
270 | + $filepath = $filedir . $filename; |
|
271 | + $file = getFileContent($filepath); |
|
272 | + list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
|
273 | + |
|
274 | + $date = filemtime($filepath); |
|
275 | + $field = array(); |
|
276 | + $field['type'] = 'document'; |
|
277 | + $field['contentType'] = 'text/html'; |
|
278 | + $field['pagetitle'] = $pagetitle; |
|
279 | + $field['longtitle'] = $pagetitle; |
|
280 | + $field['description'] = $description; |
|
281 | + $field['alias'] = $modx->stripAlias($alias); |
|
282 | + $field['published'] = $publish_default; |
|
283 | + $field['parent'] = $parent; |
|
284 | + $field['content'] = $modx->db->escape($content); |
|
285 | + $field['richtext'] = $richtext; |
|
286 | + $field['template'] = $modx->config['default_template']; |
|
287 | + $field['searchable'] = $search_default; |
|
288 | + $field['cacheable'] = $cache_default; |
|
289 | + $field['createdby'] = $createdby; |
|
290 | + $field['createdon'] = $date; |
|
291 | + $field['editedon'] = $date; |
|
292 | + $field['isfolder'] = 0; |
|
293 | + $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
|
294 | + $newid = $modx->db->insert($field, $tbl_site_content); |
|
295 | + if($newid) { |
|
296 | + echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
297 | + } else { |
|
298 | + echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
299 | + exit; |
|
300 | + } |
|
301 | + |
|
302 | + $is_site_start = false; |
|
303 | + if($filename == 'index.html') { |
|
304 | + $is_site_start = true; |
|
305 | + } |
|
306 | + if($is_site_start == true && $_POST['reset'] == 'on') { |
|
307 | + $modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'"); |
|
308 | + $modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'"); |
|
309 | + } |
|
310 | + } |
|
311 | + } |
|
312 | + } |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -319,27 +319,27 @@ discard block |
||
319 | 319 | * @return array |
320 | 320 | */ |
321 | 321 | function getFiles($directory, $listing = array(), $count = 0) { |
322 | - global $_lang; |
|
323 | - global $filesfound; |
|
324 | - $dummy = $count; |
|
325 | - if( ! empty($directory) && $files = scandir($directory)) { |
|
326 | - foreach($files as $file) { |
|
327 | - if($file == '.' || $file == '..') { |
|
328 | - continue; |
|
329 | - } elseif($h = @opendir($directory . $file . "/")) { |
|
330 | - closedir($h); |
|
331 | - $count = -1; |
|
332 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
333 | - } elseif(strpos($file, '.htm') !== false) { |
|
334 | - $listing[$dummy] = $file; |
|
335 | - $dummy = $dummy + 1; |
|
336 | - $filesfound++; |
|
337 | - } |
|
338 | - } |
|
339 | - } else { |
|
340 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
341 | - } |
|
342 | - return ($listing); |
|
322 | + global $_lang; |
|
323 | + global $filesfound; |
|
324 | + $dummy = $count; |
|
325 | + if( ! empty($directory) && $files = scandir($directory)) { |
|
326 | + foreach($files as $file) { |
|
327 | + if($file == '.' || $file == '..') { |
|
328 | + continue; |
|
329 | + } elseif($h = @opendir($directory . $file . "/")) { |
|
330 | + closedir($h); |
|
331 | + $count = -1; |
|
332 | + $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
333 | + } elseif(strpos($file, '.htm') !== false) { |
|
334 | + $listing[$dummy] = $file; |
|
335 | + $dummy = $dummy + 1; |
|
336 | + $filesfound++; |
|
337 | + } |
|
338 | + } |
|
339 | + } else { |
|
340 | + echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
341 | + } |
|
342 | + return ($listing); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | /** |
@@ -347,13 +347,13 @@ discard block |
||
347 | 347 | * @return bool|string |
348 | 348 | */ |
349 | 349 | function getFileContent($filepath) { |
350 | - global $_lang; |
|
351 | - // get the file |
|
352 | - if(!$buffer = file_get_contents($filepath)) { |
|
353 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
354 | - } else { |
|
355 | - return $buffer; |
|
356 | - } |
|
350 | + global $_lang; |
|
351 | + // get the file |
|
352 | + if(!$buffer = file_get_contents($filepath)) { |
|
353 | + echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
354 | + } else { |
|
355 | + return $buffer; |
|
356 | + } |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -361,20 +361,20 @@ discard block |
||
361 | 361 | * @return array |
362 | 362 | */ |
363 | 363 | function pop_index($array) { |
364 | - $new_array = array(); |
|
365 | - foreach($array as $k => $v) { |
|
366 | - if($v !== 'index.html' && $v !== 'index.htm') { |
|
367 | - $new_array[$k] = $v; |
|
368 | - } else { |
|
369 | - array_unshift($new_array, $v); |
|
370 | - } |
|
371 | - } |
|
372 | - foreach($array as $k => $v) { |
|
373 | - if(is_array($v)) { |
|
374 | - $new_array[$k] = $v; |
|
375 | - } |
|
376 | - } |
|
377 | - return $new_array; |
|
364 | + $new_array = array(); |
|
365 | + foreach($array as $k => $v) { |
|
366 | + if($v !== 'index.html' && $v !== 'index.htm') { |
|
367 | + $new_array[$k] = $v; |
|
368 | + } else { |
|
369 | + array_unshift($new_array, $v); |
|
370 | + } |
|
371 | + } |
|
372 | + foreach($array as $k => $v) { |
|
373 | + if(is_array($v)) { |
|
374 | + $new_array[$k] = $v; |
|
375 | + } |
|
376 | + } |
|
377 | + return $new_array; |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
@@ -384,108 +384,108 @@ discard block |
||
384 | 384 | * @return array |
385 | 385 | */ |
386 | 386 | function treatContent($src, $filename, $alias) { |
387 | - global $modx; |
|
388 | - |
|
389 | - $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
390 | - |
|
391 | - if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
392 | - $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
393 | - $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
394 | - } else { |
|
395 | - $pagetitle = $alias; |
|
396 | - } |
|
397 | - if(!$pagetitle) { |
|
398 | - $pagetitle = $alias; |
|
399 | - } |
|
400 | - |
|
401 | - if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
402 | - $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
403 | - $description = str_replace('[*description*]', '', $description); |
|
404 | - } else { |
|
405 | - $description = ''; |
|
406 | - } |
|
407 | - |
|
408 | - if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
409 | - $content = $matches[1]; |
|
410 | - } else { |
|
411 | - $content = $src; |
|
412 | - $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
413 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
414 | - $content = preg_replace($s, $r, $content); |
|
415 | - $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
416 | - } |
|
417 | - $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
418 | - $content = trim($content); |
|
419 | - $pagetitle = $modx->db->escape($pagetitle); |
|
420 | - return array( |
|
421 | - $pagetitle, |
|
422 | - $content, |
|
423 | - $description |
|
424 | - ); |
|
387 | + global $modx; |
|
388 | + |
|
389 | + $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
|
390 | + |
|
391 | + if(preg_match("@<title>(.*)</title>@i", $src, $matches)) { |
|
392 | + $pagetitle = ($matches[1] !== '') ? $matches[1] : $filename; |
|
393 | + $pagetitle = str_replace('[*pagetitle*]', '', $pagetitle); |
|
394 | + } else { |
|
395 | + $pagetitle = $alias; |
|
396 | + } |
|
397 | + if(!$pagetitle) { |
|
398 | + $pagetitle = $alias; |
|
399 | + } |
|
400 | + |
|
401 | + if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) { |
|
402 | + $description = ($matches[1] !== '') ? $matches[1] : $filename; |
|
403 | + $description = str_replace('[*description*]', '', $description); |
|
404 | + } else { |
|
405 | + $description = ''; |
|
406 | + } |
|
407 | + |
|
408 | + if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') { |
|
409 | + $content = $matches[1]; |
|
410 | + } else { |
|
411 | + $content = $src; |
|
412 | + $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
|
413 | + $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
414 | + $content = preg_replace($s, $r, $content); |
|
415 | + $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
|
416 | + } |
|
417 | + $content = str_replace('[*content*]', '[ *content* ]', $content); |
|
418 | + $content = trim($content); |
|
419 | + $pagetitle = $modx->db->escape($pagetitle); |
|
420 | + return array( |
|
421 | + $pagetitle, |
|
422 | + $content, |
|
423 | + $description |
|
424 | + ); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | /** |
428 | 428 | * @return void |
429 | 429 | */ |
430 | 430 | function convertLink() { |
431 | - global $modx; |
|
432 | - $tbl_site_content = $modx->getFullTableName('site_content'); |
|
431 | + global $modx; |
|
432 | + $tbl_site_content = $modx->getFullTableName('site_content'); |
|
433 | 433 | |
434 | - $rs = $modx->db->select('id,content', $tbl_site_content); |
|
435 | - $p = array(); |
|
434 | + $rs = $modx->db->select('id,content', $tbl_site_content); |
|
435 | + $p = array(); |
|
436 | 436 | $target = array(); |
437 | - $dir = ''; |
|
438 | - while($row = $modx->db->getRow($rs)) { |
|
439 | - $id = $row['id']; |
|
440 | - $array = explode('<a href=', $row['content']); |
|
441 | - $c = 0; |
|
442 | - foreach($array as $v) { |
|
443 | - if($v[0] === '"') { |
|
444 | - $v = substr($v, 1); |
|
445 | - list($href, $v) = explode('"', $v, 2); |
|
446 | - $_ = $href; |
|
447 | - if(strpos($_, $modx->config['site_url']) !== false) { |
|
448 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
449 | - } |
|
450 | - if($_[0] === '/') { |
|
451 | - $_ = substr($_, 1); |
|
452 | - } |
|
453 | - $_ = str_replace('/index.html', '.html', $_); |
|
454 | - $level = substr_count($_, '../'); |
|
455 | - if(1 < $level) { |
|
456 | - if(!isset($p[$id])) { |
|
457 | - $p[$id] = $modx->getParentIds($id); |
|
458 | - } |
|
459 | - $k = array_keys($p[$id]); |
|
460 | - while(0 < $level) { |
|
461 | - $dir = array_shift($k); |
|
462 | - $level--; |
|
463 | - } |
|
464 | - if($dir != '') { |
|
465 | - $dir .= '/'; |
|
466 | - } |
|
467 | - } else { |
|
468 | - $dir = ''; |
|
469 | - } |
|
470 | - |
|
471 | - $_ = trim($_, './'); |
|
472 | - if(strpos($_, '/') !== false) { |
|
473 | - $_ = substr($_, strrpos($_, '/')); |
|
474 | - } |
|
475 | - $_ = $dir . str_replace('.html', '', $_); |
|
476 | - if(!isset($target[$_])) { |
|
477 | - $target[$_] = $modx->getIdFromAlias($_); |
|
478 | - } |
|
479 | - $target[$_] = trim($target[$_]); |
|
480 | - if(!empty($target[$_])) { |
|
481 | - $href = '[~' . $target[$_] . '~]'; |
|
482 | - } |
|
483 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
484 | - } |
|
485 | - $c++; |
|
486 | - } |
|
487 | - $content = implode('', $array); |
|
488 | - $f['content'] = $modx->db->escape($content); |
|
489 | - $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
490 | - } |
|
437 | + $dir = ''; |
|
438 | + while($row = $modx->db->getRow($rs)) { |
|
439 | + $id = $row['id']; |
|
440 | + $array = explode('<a href=', $row['content']); |
|
441 | + $c = 0; |
|
442 | + foreach($array as $v) { |
|
443 | + if($v[0] === '"') { |
|
444 | + $v = substr($v, 1); |
|
445 | + list($href, $v) = explode('"', $v, 2); |
|
446 | + $_ = $href; |
|
447 | + if(strpos($_, $modx->config['site_url']) !== false) { |
|
448 | + $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
449 | + } |
|
450 | + if($_[0] === '/') { |
|
451 | + $_ = substr($_, 1); |
|
452 | + } |
|
453 | + $_ = str_replace('/index.html', '.html', $_); |
|
454 | + $level = substr_count($_, '../'); |
|
455 | + if(1 < $level) { |
|
456 | + if(!isset($p[$id])) { |
|
457 | + $p[$id] = $modx->getParentIds($id); |
|
458 | + } |
|
459 | + $k = array_keys($p[$id]); |
|
460 | + while(0 < $level) { |
|
461 | + $dir = array_shift($k); |
|
462 | + $level--; |
|
463 | + } |
|
464 | + if($dir != '') { |
|
465 | + $dir .= '/'; |
|
466 | + } |
|
467 | + } else { |
|
468 | + $dir = ''; |
|
469 | + } |
|
470 | + |
|
471 | + $_ = trim($_, './'); |
|
472 | + if(strpos($_, '/') !== false) { |
|
473 | + $_ = substr($_, strrpos($_, '/')); |
|
474 | + } |
|
475 | + $_ = $dir . str_replace('.html', '', $_); |
|
476 | + if(!isset($target[$_])) { |
|
477 | + $target[$_] = $modx->getIdFromAlias($_); |
|
478 | + } |
|
479 | + $target[$_] = trim($target[$_]); |
|
480 | + if(!empty($target[$_])) { |
|
481 | + $href = '[~' . $target[$_] . '~]'; |
|
482 | + } |
|
483 | + $array[$c] = '<a href="' . $href . '"' . $v; |
|
484 | + } |
|
485 | + $c++; |
|
486 | + } |
|
487 | + $content = implode('', $array); |
|
488 | + $f['content'] = $modx->db->escape($content); |
|
489 | + $modx->db->update($f, $tbl_site_content, "id='{$id}'"); |
|
490 | + } |
|
491 | 491 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php" |
257 | 257 | * $extname - extension name in lowercase |
258 | 258 | * |
259 | - * @param $extname |
|
259 | + * @param string $extname |
|
260 | 260 | * @param bool $reload |
261 | 261 | * @return bool |
262 | 262 | */ |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param int $count_attempts |
300 | 300 | * @param string $type $type |
301 | 301 | * @param string $responseCode |
302 | - * @return bool|null |
|
302 | + * @return false|null |
|
303 | 303 | * @global string $base_url |
304 | 304 | * @global string $site_url |
305 | 305 | */ |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | /** |
1003 | - * @param $contents |
|
1003 | + * @param string $contents |
|
1004 | 1004 | * @return mixed |
1005 | 1005 | */ |
1006 | 1006 | public function RecoveryEscapedTags($contents) |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | /** |
1027 | - * @param $tstart |
|
1027 | + * @param double $tstart |
|
1028 | 1028 | * @return array |
1029 | 1029 | */ |
1030 | 1030 | public function getTimerStats($tstart) |
@@ -1776,7 +1776,7 @@ discard block |
||
1776 | 1776 | |
1777 | 1777 | /** |
1778 | 1778 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
1779 | - * @param $content |
|
1779 | + * @param string $content |
|
1780 | 1780 | * @param string $left |
1781 | 1781 | * @param string $right |
1782 | 1782 | * @return mixed |
@@ -1949,7 +1949,7 @@ discard block |
||
1949 | 1949 | /** |
1950 | 1950 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
1951 | 1951 | * |
1952 | - * @param $content |
|
1952 | + * @param string $content |
|
1953 | 1953 | * @return string |
1954 | 1954 | * @internal param string $documentSource |
1955 | 1955 | */ |
@@ -2981,7 +2981,7 @@ discard block |
||
2981 | 2981 | |
2982 | 2982 | /** |
2983 | 2983 | * @param $templateID |
2984 | - * @return mixed |
|
2984 | + * @return string |
|
2985 | 2985 | */ |
2986 | 2986 | public function _getTemplateCodeFromDB($templateID) |
2987 | 2987 | { |
@@ -3022,9 +3022,9 @@ discard block |
||
3022 | 3022 | } |
3023 | 3023 | |
3024 | 3024 | /** |
3025 | - * @param $id |
|
3025 | + * @param integer $id |
|
3026 | 3026 | * @param int $top |
3027 | - * @return mixed |
|
3027 | + * @return string |
|
3028 | 3028 | */ |
3029 | 3029 | public function getUltimateParentId($id, $top = 0) |
3030 | 3030 | { |
@@ -3355,7 +3355,7 @@ discard block |
||
3355 | 3355 | * |
3356 | 3356 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3357 | 3357 | * @param int $id Element- / Resource-id |
3358 | - * @return bool |
|
3358 | + * @return false|null |
|
3359 | 3359 | */ |
3360 | 3360 | public function lockElement($type, $id) |
3361 | 3361 | { |
@@ -3377,7 +3377,7 @@ discard block |
||
3377 | 3377 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3378 | 3378 | * @param int $id Element- / Resource-id |
3379 | 3379 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
3380 | - * @return bool |
|
3380 | + * @return false|null |
|
3381 | 3381 | */ |
3382 | 3382 | public function unlockElement($type, $id, $includeAllUsers = false) |
3383 | 3383 | { |
@@ -3485,7 +3485,7 @@ discard block |
||
3485 | 3485 | * @param array $params |
3486 | 3486 | * @param string $msg |
3487 | 3487 | * @param array $files |
3488 | - * @return mixed |
|
3488 | + * @return boolean |
|
3489 | 3489 | */ |
3490 | 3490 | public function sendmail($params = array(), $msg = '', $files = array()) |
3491 | 3491 | { |
@@ -3981,7 +3981,7 @@ discard block |
||
3981 | 3981 | * |
3982 | 3982 | * @param string $type |
3983 | 3983 | * @param bool $report |
3984 | - * @return bool |
|
3984 | + * @return boolean|null |
|
3985 | 3985 | */ |
3986 | 3986 | public function clearCache($type = '', $report = false) |
3987 | 3987 | { |
@@ -4348,7 +4348,7 @@ discard block |
||
4348 | 4348 | * - Placeholders prefix. Default: '{'. |
4349 | 4349 | * @param string $suffix {string} |
4350 | 4350 | * - Placeholders suffix. Default: '}'. |
4351 | - * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4351 | + * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4352 | 4352 | * - Parsed chunk or false if $chunkArr is not array. |
4353 | 4353 | */ |
4354 | 4354 | public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}') |
@@ -5324,7 +5324,7 @@ discard block |
||
5324 | 5324 | * Remove event listener - only for use within the current execution cycle |
5325 | 5325 | * |
5326 | 5326 | * @param string $evtName |
5327 | - * @return boolean |
|
5327 | + * @return false|null |
|
5328 | 5328 | */ |
5329 | 5329 | public function removeEventListener($evtName) |
5330 | 5330 | { |
@@ -5348,7 +5348,7 @@ discard block |
||
5348 | 5348 | * |
5349 | 5349 | * @param string $evtName |
5350 | 5350 | * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value. |
5351 | - * @return boolean|array |
|
5351 | + * @return false|null |
|
5352 | 5352 | */ |
5353 | 5353 | public function invokeEvent($evtName, $extParams = array()) |
5354 | 5354 | { |
@@ -5947,7 +5947,7 @@ discard block |
||
5947 | 5947 | |
5948 | 5948 | /** |
5949 | 5949 | * @param string $str |
5950 | - * @return bool|mixed|string |
|
5950 | + * @return string |
|
5951 | 5951 | */ |
5952 | 5952 | public function atBindFileContent($str = '') |
5953 | 5953 | { |
@@ -5998,8 +5998,8 @@ discard block |
||
5998 | 5998 | } |
5999 | 5999 | |
6000 | 6000 | /** |
6001 | - * @param $str |
|
6002 | - * @return bool|string |
|
6001 | + * @param string $str |
|
6002 | + * @return false|string |
|
6003 | 6003 | */ |
6004 | 6004 | public function getExtFromFilename($str) |
6005 | 6005 | { |
@@ -6027,7 +6027,7 @@ discard block |
||
6027 | 6027 | * @param string $text Error message |
6028 | 6028 | * @param string $file File where the error was detected |
6029 | 6029 | * @param string $line Line number within $file |
6030 | - * @return boolean |
|
6030 | + * @return boolean|null |
|
6031 | 6031 | */ |
6032 | 6032 | public function phpError($nr, $text, $file, $line) |
6033 | 6033 | { |
@@ -6079,7 +6079,7 @@ discard block |
||
6079 | 6079 | * @param string $text |
6080 | 6080 | * @param string $line |
6081 | 6081 | * @param string $output |
6082 | - * @return bool |
|
6082 | + * @return null|boolean |
|
6083 | 6083 | */ |
6084 | 6084 | public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '') |
6085 | 6085 | { |
@@ -6501,7 +6501,7 @@ discard block |
||
6501 | 6501 | |
6502 | 6502 | /** |
6503 | 6503 | * @param string $str |
6504 | - * @return bool|mixed|string |
|
6504 | + * @return string |
|
6505 | 6505 | */ |
6506 | 6506 | public function atBindInclude($str = '') |
6507 | 6507 | { |
@@ -6552,7 +6552,7 @@ discard block |
||
6552 | 6552 | * @param $str |
6553 | 6553 | * @param int $flags |
6554 | 6554 | * @param string $encode |
6555 | - * @return mixed |
|
6555 | + * @return string |
|
6556 | 6556 | */ |
6557 | 6557 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
6558 | 6558 | { |
@@ -6561,7 +6561,7 @@ discard block |
||
6561 | 6561 | } |
6562 | 6562 | |
6563 | 6563 | /** |
6564 | - * @param $string |
|
6564 | + * @param string $string |
|
6565 | 6565 | * @param bool $returnData |
6566 | 6566 | * @return bool|mixed |
6567 | 6567 | */ |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
243 | - * @param string|array $fields |
|
244 | - * @param string|array $from |
|
245 | - * @param string|array $where |
|
243 | + * @param string $fields |
|
244 | + * @param string $from |
|
245 | + * @param string $where |
|
246 | 246 | * @param string $orderBy |
247 | 247 | * @param string $limit |
248 | 248 | * @return bool|mysqli_result |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @param string $fromtable |
327 | 327 | * @param string $where |
328 | 328 | * @param string $limit |
329 | - * @return mixed |
|
329 | + * @return null|integer |
|
330 | 330 | */ |
331 | 331 | public function insert($fields, $intotable, $fromfields = "*", $fromtable = "", $where = "", $limit = "") |
332 | 332 | { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | |
436 | 436 | /** |
437 | 437 | * @param null|mysqli $conn |
438 | - * @return mixed |
|
438 | + * @return integer |
|
439 | 439 | */ |
440 | 440 | public function getInsertId($conn = null) |
441 | 441 | { |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
516 | - * @param $name |
|
516 | + * @param string $name |
|
517 | 517 | * @param mysqli_result|string $dsq |
518 | 518 | * @return array |
519 | 519 | */ |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | /** |
574 | 574 | * @param string $table |
575 | - * @return array |
|
575 | + * @return boolean |
|
576 | 576 | */ |
577 | 577 | public function getTableMetaData($table) |
578 | 578 | { |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
622 | - * @param string|mysqli_result $rs |
|
622 | + * @param string $rs |
|
623 | 623 | * @param bool $index |
624 | 624 | * @return array |
625 | 625 | */ |
@@ -278,8 +278,7 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * Sets the width attribute of each column in the array. |
280 | 280 | * |
281 | - * @param array $value An Array of column widths in the order of the keys in the |
|
282 | - * source table array. |
|
281 | + * @param string[] $widthArray |
|
283 | 282 | */ |
284 | 283 | public function setColumnWidths($widthArray) |
285 | 284 | { |
@@ -289,7 +288,6 @@ discard block |
||
289 | 288 | /** |
290 | 289 | * An optional array of values that can be preselected when using |
291 | 290 | * |
292 | - * @param array $value Indicates the INPUT form element type attribute. |
|
293 | 291 | */ |
294 | 292 | public function setSelectedValues($valueArray) |
295 | 293 | { |
@@ -326,7 +324,7 @@ discard block |
||
326 | 324 | /** |
327 | 325 | * Determines what class the current row should have applied. |
328 | 326 | * |
329 | - * @param int $value The position of the current row being rendered. |
|
327 | + * @param integer $position |
|
330 | 328 | * @return string |
331 | 329 | */ |
332 | 330 | public function determineRowClass($position) |
@@ -353,7 +351,6 @@ discard block |
||
353 | 351 | * Generates an onclick action applied to the current cell, to execute |
354 | 352 | * any specified cell actions. |
355 | 353 | * |
356 | - * @param string $value Indicates the INPUT form element type attribute. |
|
357 | 354 | * @return string |
358 | 355 | */ |
359 | 356 | public function getCellAction($currentActionFieldValue) |
@@ -395,7 +392,7 @@ discard block |
||
395 | 392 | /** |
396 | 393 | * Function to prepare a link generated in the table cell/link actions. |
397 | 394 | * |
398 | - * @param string $value Indicates the INPUT form element type attribute. |
|
395 | + * @param string $link |
|
399 | 396 | * @return string |
400 | 397 | */ |
401 | 398 | public function prepareLink($link) |
@@ -414,7 +411,7 @@ discard block |
||
414 | 411 | * |
415 | 412 | * @param array $fieldsArray The associative array representing the table rows |
416 | 413 | * and columns. |
417 | - * @param array $fieldHeadersArray An optional array of values for providing |
|
414 | + * @param string[] $fieldHeadersArray An optional array of values for providing |
|
418 | 415 | * alternative field headers; this is an associative arrays of keys from |
419 | 416 | * the $fieldsArray where the values represent the alt heading content |
420 | 417 | * for each column. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | /** |
96 | 96 | * @param string $mode |
97 | 97 | * @param string $modifiers |
98 | - * @return bool|string |
|
98 | + * @return false|string |
|
99 | 99 | */ |
100 | 100 | public function _getDelim($mode,$modifiers) { |
101 | 101 | $c = substr($modifiers,0,1); |
@@ -132,6 +132,14 @@ discard block |
||
132 | 132 | return $opt; |
133 | 133 | } |
134 | 134 | } |
135 | + |
|
136 | + /** |
|
137 | + * @param string $mode |
|
138 | + * @param false|string $delim |
|
139 | + * @param string $modifiers |
|
140 | + * |
|
141 | + * @return string |
|
142 | + */ |
|
135 | 143 | public function _getRemainModifiers($mode,$delim,$modifiers) { |
136 | 144 | if($delim) { |
137 | 145 | if($mode=='(') |
@@ -159,6 +167,9 @@ discard block |
||
159 | 167 | return substr($string,strpos($string, $delim)+$len); |
160 | 168 | } |
161 | 169 | |
170 | + /** |
|
171 | + * @param string $modifiers |
|
172 | + */ |
|
162 | 173 | public function splitEachModifiers($modifiers) { |
163 | 174 | global $modx; |
164 | 175 | |
@@ -228,6 +239,9 @@ discard block |
||
228 | 239 | return $result; |
229 | 240 | } |
230 | 241 | |
242 | + /** |
|
243 | + * @param string $key |
|
244 | + */ |
|
231 | 245 | public function parsePhx($key,$value,$modifiers) |
232 | 246 | { |
233 | 247 | global $modx; |
@@ -294,6 +308,9 @@ discard block |
||
294 | 308 | else return true; |
295 | 309 | } |
296 | 310 | |
311 | + /** |
|
312 | + * @param string $cmd |
|
313 | + */ |
|
297 | 314 | public function getValueFromPreset($key, $value, $cmd, $opt) |
298 | 315 | { |
299 | 316 | global $modx; |
@@ -979,6 +996,9 @@ discard block |
||
979 | 996 | return $value; |
980 | 997 | } |
981 | 998 | |
999 | + /** |
|
1000 | + * @param string $cmd |
|
1001 | + */ |
|
982 | 1002 | public function includeMdfFile($cmd) { |
983 | 1003 | global $modx; |
984 | 1004 | $key = $this->key; |
@@ -1134,6 +1154,10 @@ discard block |
||
1134 | 1154 | } |
1135 | 1155 | |
1136 | 1156 | // Sets a placeholder variable which can only be access by Modifiers |
1157 | + |
|
1158 | + /** |
|
1159 | + * @param string $value |
|
1160 | + */ |
|
1137 | 1161 | public function setModifiersVariable($key, $value) { |
1138 | 1162 | if ($key != 'phx' && $key != 'dummy') $this->placeholders[$key] = $value; |
1139 | 1163 | } |
@@ -149,7 +149,7 @@ |
||
149 | 149 | /** |
150 | 150 | * This function returns the current page number. |
151 | 151 | * |
152 | - * @return int |
|
152 | + * @return string |
|
153 | 153 | */ |
154 | 154 | public function getCurrentPage() |
155 | 155 | { |
@@ -16,7 +16,7 @@ |
||
16 | 16 | // sanitize array |
17 | 17 | if (!function_exists('modx_sanitize_gpc')) { |
18 | 18 | /** |
19 | - * @param array|string $values |
|
19 | + * @param string $values |
|
20 | 20 | * @param int $depth |
21 | 21 | * @return array|string |
22 | 22 | */ |