]> git.mxchange.org Git - friendica.git/blob - vendor/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php
Add Smarty to Composer
[friendica.git] / vendor / smarty / smarty / libs / sysplugins / smarty_internal_testinstall.php
1 <?php
2 /**
3  * Smarty Internal TestInstall
4  * Test Smarty installation
5  *
6  * @package    Smarty
7  * @subpackage Utilities
8  * @author     Uwe Tews
9  */
10
11 /**
12  * TestInstall class
13  *
14  * @package    Smarty
15  * @subpackage Utilities
16  */
17 class Smarty_Internal_TestInstall
18 {
19     /**
20      * diagnose Smarty setup
21      * If $errors is secified, the diagnostic report will be appended to the array, rather than being output.
22      *
23      * @param \Smarty $smarty
24      * @param  array  $errors array to push results into rather than outputting them
25      *
26      * @return bool status, true if everything is fine, false else
27      */
28     public static function testInstall(Smarty $smarty, &$errors = null)
29     {
30         $status = true;
31
32         if ($errors === null) {
33             echo "<PRE>\n";
34             echo "Smarty Installation test...\n";
35             echo "Testing template directory...\n";
36         }
37
38         $_stream_resolve_include_path = function_exists('stream_resolve_include_path');
39
40         // test if all registered template_dir are accessible
41         foreach ($smarty->getTemplateDir() as $template_dir) {
42             $_template_dir = $template_dir;
43             $template_dir = realpath($template_dir);
44             // resolve include_path or fail existence
45             if (!$template_dir) {
46                 if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_template_dir)) {
47                     // try PHP include_path
48                     if ($_stream_resolve_include_path) {
49                         $template_dir = stream_resolve_include_path($_template_dir);
50                     } else {
51                         $template_dir = $smarty->ext->_getIncludePath->getIncludePath($_template_dir, null, $smarty);
52                     }
53
54                     if ($template_dir !== false) {
55                         if ($errors === null) {
56                             echo "$template_dir is OK.\n";
57                         }
58
59                         continue;
60                     } else {
61                         $status = false;
62                         $message =
63                             "FAILED: $_template_dir does not exist (and couldn't be found in include_path either)";
64                         if ($errors === null) {
65                             echo $message . ".\n";
66                         } else {
67                             $errors[ 'template_dir' ] = $message;
68                         }
69
70                         continue;
71                     }
72                 } else {
73                     $status = false;
74                     $message = "FAILED: $_template_dir does not exist";
75                     if ($errors === null) {
76                         echo $message . ".\n";
77                     } else {
78                         $errors[ 'template_dir' ] = $message;
79                     }
80
81                     continue;
82                 }
83             }
84
85             if (!is_dir($template_dir)) {
86                 $status = false;
87                 $message = "FAILED: $template_dir is not a directory";
88                 if ($errors === null) {
89                     echo $message . ".\n";
90                 } else {
91                     $errors[ 'template_dir' ] = $message;
92                 }
93             } elseif (!is_readable($template_dir)) {
94                 $status = false;
95                 $message = "FAILED: $template_dir is not readable";
96                 if ($errors === null) {
97                     echo $message . ".\n";
98                 } else {
99                     $errors[ 'template_dir' ] = $message;
100                 }
101             } else {
102                 if ($errors === null) {
103                     echo "$template_dir is OK.\n";
104                 }
105             }
106         }
107
108         if ($errors === null) {
109             echo "Testing compile directory...\n";
110         }
111
112         // test if registered compile_dir is accessible
113         $__compile_dir = $smarty->getCompileDir();
114         $_compile_dir = realpath($__compile_dir);
115         if (!$_compile_dir) {
116             $status = false;
117             $message = "FAILED: {$__compile_dir} does not exist";
118             if ($errors === null) {
119                 echo $message . ".\n";
120             } else {
121                 $errors[ 'compile_dir' ] = $message;
122             }
123         } elseif (!is_dir($_compile_dir)) {
124             $status = false;
125             $message = "FAILED: {$_compile_dir} is not a directory";
126             if ($errors === null) {
127                 echo $message . ".\n";
128             } else {
129                 $errors[ 'compile_dir' ] = $message;
130             }
131         } elseif (!is_readable($_compile_dir)) {
132             $status = false;
133             $message = "FAILED: {$_compile_dir} is not readable";
134             if ($errors === null) {
135                 echo $message . ".\n";
136             } else {
137                 $errors[ 'compile_dir' ] = $message;
138             }
139         } elseif (!is_writable($_compile_dir)) {
140             $status = false;
141             $message = "FAILED: {$_compile_dir} is not writable";
142             if ($errors === null) {
143                 echo $message . ".\n";
144             } else {
145                 $errors[ 'compile_dir' ] = $message;
146             }
147         } else {
148             if ($errors === null) {
149                 echo "{$_compile_dir} is OK.\n";
150             }
151         }
152
153         if ($errors === null) {
154             echo "Testing plugins directory...\n";
155         }
156
157         // test if all registered plugins_dir are accessible
158         // and if core plugins directory is still registered
159         $_core_plugins_dir = realpath(dirname(__FILE__) . '/../plugins');
160         $_core_plugins_available = false;
161         foreach ($smarty->getPluginsDir() as $plugin_dir) {
162             $_plugin_dir = $plugin_dir;
163             $plugin_dir = realpath($plugin_dir);
164             // resolve include_path or fail existence
165             if (!$plugin_dir) {
166                 if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
167                     // try PHP include_path
168                     if ($_stream_resolve_include_path) {
169                         $plugin_dir = stream_resolve_include_path($_plugin_dir);
170                     } else {
171                         $plugin_dir = $smarty->ext->_getIncludePath->getIncludePath($_plugin_dir, null, $smarty);
172                     }
173
174                     if ($plugin_dir !== false) {
175                         if ($errors === null) {
176                             echo "$plugin_dir is OK.\n";
177                         }
178
179                         continue;
180                     } else {
181                         $status = false;
182                         $message = "FAILED: $_plugin_dir does not exist (and couldn't be found in include_path either)";
183                         if ($errors === null) {
184                             echo $message . ".\n";
185                         } else {
186                             $errors[ 'plugins_dir' ] = $message;
187                         }
188
189                         continue;
190                     }
191                 } else {
192                     $status = false;
193                     $message = "FAILED: $_plugin_dir does not exist";
194                     if ($errors === null) {
195                         echo $message . ".\n";
196                     } else {
197                         $errors[ 'plugins_dir' ] = $message;
198                     }
199
200                     continue;
201                 }
202             }
203
204             if (!is_dir($plugin_dir)) {
205                 $status = false;
206                 $message = "FAILED: $plugin_dir is not a directory";
207                 if ($errors === null) {
208                     echo $message . ".\n";
209                 } else {
210                     $errors[ 'plugins_dir' ] = $message;
211                 }
212             } elseif (!is_readable($plugin_dir)) {
213                 $status = false;
214                 $message = "FAILED: $plugin_dir is not readable";
215                 if ($errors === null) {
216                     echo $message . ".\n";
217                 } else {
218                     $errors[ 'plugins_dir' ] = $message;
219                 }
220             } elseif ($_core_plugins_dir && $_core_plugins_dir == realpath($plugin_dir)) {
221                 $_core_plugins_available = true;
222                 if ($errors === null) {
223                     echo "$plugin_dir is OK.\n";
224                 }
225             } else {
226                 if ($errors === null) {
227                     echo "$plugin_dir is OK.\n";
228                 }
229             }
230         }
231         if (!$_core_plugins_available) {
232             $status = false;
233             $message = "WARNING: Smarty's own libs/plugins is not available";
234             if ($errors === null) {
235                 echo $message . ".\n";
236             } elseif (!isset($errors[ 'plugins_dir' ])) {
237                 $errors[ 'plugins_dir' ] = $message;
238             }
239         }
240
241         if ($errors === null) {
242             echo "Testing cache directory...\n";
243         }
244
245         // test if all registered cache_dir is accessible
246         $__cache_dir = $smarty->getCacheDir();
247         $_cache_dir = realpath($__cache_dir);
248         if (!$_cache_dir) {
249             $status = false;
250             $message = "FAILED: {$__cache_dir} does not exist";
251             if ($errors === null) {
252                 echo $message . ".\n";
253             } else {
254                 $errors[ 'cache_dir' ] = $message;
255             }
256         } elseif (!is_dir($_cache_dir)) {
257             $status = false;
258             $message = "FAILED: {$_cache_dir} is not a directory";
259             if ($errors === null) {
260                 echo $message . ".\n";
261             } else {
262                 $errors[ 'cache_dir' ] = $message;
263             }
264         } elseif (!is_readable($_cache_dir)) {
265             $status = false;
266             $message = "FAILED: {$_cache_dir} is not readable";
267             if ($errors === null) {
268                 echo $message . ".\n";
269             } else {
270                 $errors[ 'cache_dir' ] = $message;
271             }
272         } elseif (!is_writable($_cache_dir)) {
273             $status = false;
274             $message = "FAILED: {$_cache_dir} is not writable";
275             if ($errors === null) {
276                 echo $message . ".\n";
277             } else {
278                 $errors[ 'cache_dir' ] = $message;
279             }
280         } else {
281             if ($errors === null) {
282                 echo "{$_cache_dir} is OK.\n";
283             }
284         }
285
286         if ($errors === null) {
287             echo "Testing configs directory...\n";
288         }
289
290         // test if all registered config_dir are accessible
291         foreach ($smarty->getConfigDir() as $config_dir) {
292             $_config_dir = $config_dir;
293             // resolve include_path or fail existence
294             if (!$config_dir) {
295                 if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_config_dir)) {
296                     // try PHP include_path
297                     if ($_stream_resolve_include_path) {
298                         $config_dir = stream_resolve_include_path($_config_dir);
299                     } else {
300                         $config_dir = $smarty->ext->_getIncludePath->getIncludePath($_config_dir, null, $smarty);
301                     }
302
303                     if ($config_dir !== false) {
304                         if ($errors === null) {
305                             echo "$config_dir is OK.\n";
306                         }
307
308                         continue;
309                     } else {
310                         $status = false;
311                         $message = "FAILED: $_config_dir does not exist (and couldn't be found in include_path either)";
312                         if ($errors === null) {
313                             echo $message . ".\n";
314                         } else {
315                             $errors[ 'config_dir' ] = $message;
316                         }
317
318                         continue;
319                     }
320                 } else {
321                     $status = false;
322                     $message = "FAILED: $_config_dir does not exist";
323                     if ($errors === null) {
324                         echo $message . ".\n";
325                     } else {
326                         $errors[ 'config_dir' ] = $message;
327                     }
328
329                     continue;
330                 }
331             }
332
333             if (!is_dir($config_dir)) {
334                 $status = false;
335                 $message = "FAILED: $config_dir is not a directory";
336                 if ($errors === null) {
337                     echo $message . ".\n";
338                 } else {
339                     $errors[ 'config_dir' ] = $message;
340                 }
341             } elseif (!is_readable($config_dir)) {
342                 $status = false;
343                 $message = "FAILED: $config_dir is not readable";
344                 if ($errors === null) {
345                     echo $message . ".\n";
346                 } else {
347                     $errors[ 'config_dir' ] = $message;
348                 }
349             } else {
350                 if ($errors === null) {
351                     echo "$config_dir is OK.\n";
352                 }
353             }
354         }
355
356         if ($errors === null) {
357             echo "Testing sysplugin files...\n";
358         }
359         // test if sysplugins are available
360         $source = SMARTY_SYSPLUGINS_DIR;
361         if (is_dir($source)) {
362             $expectedSysplugins = array('smartycompilerexception.php' => true, 'smartyexception.php' => true,
363                                         'smarty_cacheresource.php' => true, 'smarty_cacheresource_custom.php' => true,
364                                         'smarty_cacheresource_keyvaluestore.php' => true, 'smarty_data.php' => true,
365                                         'smarty_internal_block.php' => true,
366                                         'smarty_internal_cacheresource_file.php' => true,
367                                         'smarty_internal_compilebase.php' => true,
368                                         'smarty_internal_compile_append.php' => true,
369                                         'smarty_internal_compile_assign.php' => true,
370                                         'smarty_internal_compile_block.php' => true,
371                                         'smarty_internal_compile_block_child.php' => true,
372                                         'smarty_internal_compile_block_parent.php' => true,
373                                         'smarty_internal_compile_break.php' => true,
374                                         'smarty_internal_compile_call.php' => true,
375                                         'smarty_internal_compile_capture.php' => true,
376                                         'smarty_internal_compile_config_load.php' => true,
377                                         'smarty_internal_compile_continue.php' => true,
378                                         'smarty_internal_compile_debug.php' => true,
379                                         'smarty_internal_compile_eval.php' => true,
380                                         'smarty_internal_compile_extends.php' => true,
381                                         'smarty_internal_compile_for.php' => true,
382                                         'smarty_internal_compile_foreach.php' => true,
383                                         'smarty_internal_compile_function.php' => true,
384                                         'smarty_internal_compile_if.php' => true,
385                                         'smarty_internal_compile_include.php' => true,
386                                         'smarty_internal_compile_include_php.php' => true,
387                                         'smarty_internal_compile_insert.php' => true,
388                                         'smarty_internal_compile_ldelim.php' => true,
389                                         'smarty_internal_compile_make_nocache.php' => true,
390                                         'smarty_internal_compile_nocache.php' => true,
391                                         'smarty_internal_compile_private_block_plugin.php' => true,
392                                         'smarty_internal_compile_private_foreachsection.php' => true,
393                                         'smarty_internal_compile_private_function_plugin.php' => true,
394                                         'smarty_internal_compile_private_modifier.php' => true,
395                                         'smarty_internal_compile_private_object_block_function.php' => true,
396                                         'smarty_internal_compile_private_object_function.php' => true,
397                                         'smarty_internal_compile_private_php.php' => true,
398                                         'smarty_internal_compile_private_print_expression.php' => true,
399                                         'smarty_internal_compile_private_registered_block.php' => true,
400                                         'smarty_internal_compile_private_registered_function.php' => true,
401                                         'smarty_internal_compile_private_special_variable.php' => true,
402                                         'smarty_internal_compile_rdelim.php' => true,
403                                         'smarty_internal_compile_section.php' => true,
404                                         'smarty_internal_compile_setfilter.php' => true,
405                                         'smarty_internal_compile_shared_inheritance.php' => true,
406                                         'smarty_internal_compile_while.php' => true,
407                                         'smarty_internal_configfilelexer.php' => true,
408                                         'smarty_internal_configfileparser.php' => true,
409                                         'smarty_internal_config_file_compiler.php' => true,
410                                         'smarty_internal_data.php' => true, 'smarty_internal_debug.php' => true,
411                                         'smarty_internal_extension_handler.php' => true,
412                                         'smarty_internal_method_addautoloadfilters.php' => true,
413                                         'smarty_internal_method_adddefaultmodifiers.php' => true,
414                                         'smarty_internal_method_append.php' => true,
415                                         'smarty_internal_method_appendbyref.php' => true,
416                                         'smarty_internal_method_assignbyref.php' => true,
417                                         'smarty_internal_method_assignglobal.php' => true,
418                                         'smarty_internal_method_clearallassign.php' => true,
419                                         'smarty_internal_method_clearallcache.php' => true,
420                                         'smarty_internal_method_clearassign.php' => true,
421                                         'smarty_internal_method_clearcache.php' => true,
422                                         'smarty_internal_method_clearcompiledtemplate.php' => true,
423                                         'smarty_internal_method_clearconfig.php' => true,
424                                         'smarty_internal_method_compileallconfig.php' => true,
425                                         'smarty_internal_method_compilealltemplates.php' => true,
426                                         'smarty_internal_method_configload.php' => true,
427                                         'smarty_internal_method_createdata.php' => true,
428                                         'smarty_internal_method_getautoloadfilters.php' => true,
429                                         'smarty_internal_method_getconfigvariable.php' => true,
430                                         'smarty_internal_method_getconfigvars.php' => true,
431                                         'smarty_internal_method_getdebugtemplate.php' => true,
432                                         'smarty_internal_method_getdefaultmodifiers.php' => true,
433                                         'smarty_internal_method_getglobal.php' => true,
434                                         'smarty_internal_method_getregisteredobject.php' => true,
435                                         'smarty_internal_method_getstreamvariable.php' => true,
436                                         'smarty_internal_method_gettags.php' => true,
437                                         'smarty_internal_method_gettemplatevars.php' => true,
438                                         'smarty_internal_method_loadfilter.php' => true,
439                                         'smarty_internal_method_loadplugin.php' => true,
440                                         'smarty_internal_method_mustcompile.php' => true,
441                                         'smarty_internal_method_registercacheresource.php' => true,
442                                         'smarty_internal_method_registerclass.php' => true,
443                                         'smarty_internal_method_registerdefaultconfighandler.php' => true,
444                                         'smarty_internal_method_registerdefaultpluginhandler.php' => true,
445                                         'smarty_internal_method_registerdefaulttemplatehandler.php' => true,
446                                         'smarty_internal_method_registerfilter.php' => true,
447                                         'smarty_internal_method_registerobject.php' => true,
448                                         'smarty_internal_method_registerplugin.php' => true,
449                                         'smarty_internal_method_registerresource.php' => true,
450                                         'smarty_internal_method_setautoloadfilters.php' => true,
451                                         'smarty_internal_method_setdebugtemplate.php' => true,
452                                         'smarty_internal_method_setdefaultmodifiers.php' => true,
453                                         'smarty_internal_method_unloadfilter.php' => true,
454                                         'smarty_internal_method_unregistercacheresource.php' => true,
455                                         'smarty_internal_method_unregisterfilter.php' => true,
456                                         'smarty_internal_method_unregisterobject.php' => true,
457                                         'smarty_internal_method_unregisterplugin.php' => true,
458                                         'smarty_internal_method_unregisterresource.php' => true,
459                                         'smarty_internal_nocache_insert.php' => true,
460                                         'smarty_internal_parsetree.php' => true,
461                                         'smarty_internal_parsetree_code.php' => true,
462                                         'smarty_internal_parsetree_dq.php' => true,
463                                         'smarty_internal_parsetree_dqcontent.php' => true,
464                                         'smarty_internal_parsetree_tag.php' => true,
465                                         'smarty_internal_parsetree_template.php' => true,
466                                         'smarty_internal_parsetree_text.php' => true,
467                                         'smarty_internal_resource_eval.php' => true,
468                                         'smarty_internal_resource_extends.php' => true,
469                                         'smarty_internal_resource_file.php' => true,
470                                         'smarty_internal_resource_php.php' => true,
471                                         'smarty_internal_resource_registered.php' => true,
472                                         'smarty_internal_resource_stream.php' => true,
473                                         'smarty_internal_resource_string.php' => true,
474                                         'smarty_internal_runtime_cachemodify.php' => true,
475                                         'smarty_internal_runtime_cacheresourcefile.php' => true,
476                                         'smarty_internal_runtime_capture.php' => true,
477                                         'smarty_internal_runtime_codeframe.php' => true,
478                                         'smarty_internal_runtime_filterhandler.php' => true,
479                                         'smarty_internal_runtime_foreach.php' => true,
480                                         'smarty_internal_runtime_getincludepath.php' => true,
481                                         'smarty_internal_runtime_inheritance.php' => true,
482                                         'smarty_internal_runtime_make_nocache.php' => true,
483                                         'smarty_internal_runtime_tplfunction.php' => true,
484                                         'smarty_internal_runtime_updatecache.php' => true,
485                                         'smarty_internal_runtime_updatescope.php' => true,
486                                         'smarty_internal_runtime_writefile.php' => true,
487                                         'smarty_internal_smartytemplatecompiler.php' => true,
488                                         'smarty_internal_template.php' => true,
489                                         'smarty_internal_templatebase.php' => true,
490                                         'smarty_internal_templatecompilerbase.php' => true,
491                                         'smarty_internal_templatelexer.php' => true,
492                                         'smarty_internal_templateparser.php' => true,
493                                         'smarty_internal_testinstall.php' => true,
494                                         'smarty_internal_undefined.php' => true, 'smarty_resource.php' => true,
495                                         'smarty_resource_custom.php' => true, 'smarty_resource_recompiled.php' => true,
496                                         'smarty_resource_uncompiled.php' => true, 'smarty_security.php' => true,
497                                         'smarty_template_cached.php' => true, 'smarty_template_compiled.php' => true,
498                                         'smarty_template_config.php' => true,
499                                         'smarty_template_resource_base.php' => true,
500                                         'smarty_template_source.php' => true, 'smarty_undefined_variable.php' => true,
501                                         'smarty_variable.php' => true,);
502             $iterator = new DirectoryIterator($source);
503             foreach ($iterator as $file) {
504                 if (!$file->isDot()) {
505                     $filename = $file->getFilename();
506                     if (isset($expectedSysplugins[ $filename ])) {
507                         unset($expectedSysplugins[ $filename ]);
508                     }
509                 }
510             }
511             if ($expectedSysplugins) {
512                 $status = false;
513                 $message = "FAILED: files missing from libs/sysplugins: " . join(', ', array_keys($expectedSysplugins));
514                 if ($errors === null) {
515                     echo $message . ".\n";
516                 } else {
517                     $errors[ 'sysplugins' ] = $message;
518                 }
519             } elseif ($errors === null) {
520                 echo "... OK\n";
521             }
522         } else {
523             $status = false;
524             $message = "FAILED: " . SMARTY_SYSPLUGINS_DIR . ' is not a directory';
525             if ($errors === null) {
526                 echo $message . ".\n";
527             } else {
528                 $errors[ 'sysplugins_dir_constant' ] = $message;
529             }
530         }
531
532         if ($errors === null) {
533             echo "Testing plugin files...\n";
534         }
535         // test if core plugins are available
536         $source = SMARTY_PLUGINS_DIR;
537         if (is_dir($source)) {
538             $expectedPlugins =
539                 array('block.textformat.php' => true, 'function.counter.php' => true, 'function.cycle.php' => true,
540                       'function.fetch.php' => true, 'function.html_checkboxes.php' => true,
541                       'function.html_image.php' => true, 'function.html_options.php' => true,
542                       'function.html_radios.php' => true, 'function.html_select_date.php' => true,
543                       'function.html_select_time.php' => true, 'function.html_table.php' => true,
544                       'function.mailto.php' => true, 'function.math.php' => true, 'modifier.capitalize.php' => true,
545                       'modifier.date_format.php' => true, 'modifier.debug_print_var.php' => true,
546                       'modifier.escape.php' => true, 'modifier.regex_replace.php' => true,
547                       'modifier.replace.php' => true, 'modifier.spacify.php' => true, 'modifier.truncate.php' => true,
548                       'modifiercompiler.cat.php' => true, 'modifiercompiler.count_characters.php' => true,
549                       'modifiercompiler.count_paragraphs.php' => true, 'modifiercompiler.count_sentences.php' => true,
550                       'modifiercompiler.count_words.php' => true, 'modifiercompiler.default.php' => true,
551                       'modifiercompiler.escape.php' => true, 'modifiercompiler.from_charset.php' => true,
552                       'modifiercompiler.indent.php' => true, 'modifiercompiler.lower.php' => true,
553                       'modifiercompiler.noprint.php' => true, 'modifiercompiler.string_format.php' => true,
554                       'modifiercompiler.strip.php' => true, 'modifiercompiler.strip_tags.php' => true,
555                       'modifiercompiler.to_charset.php' => true, 'modifiercompiler.unescape.php' => true,
556                       'modifiercompiler.upper.php' => true, 'modifiercompiler.wordwrap.php' => true,
557                       'outputfilter.trimwhitespace.php' => true, 'shared.escape_special_chars.php' => true,
558                       'shared.literal_compiler_param.php' => true, 'shared.make_timestamp.php' => true,
559                       'shared.mb_str_replace.php' => true, 'shared.mb_unicode.php' => true,
560                       'shared.mb_wordwrap.php' => true, 'variablefilter.htmlspecialchars.php' => true,);
561             $iterator = new DirectoryIterator($source);
562             foreach ($iterator as $file) {
563                 if (!$file->isDot()) {
564                     $filename = $file->getFilename();
565                     if (isset($expectedPlugins[ $filename ])) {
566                         unset($expectedPlugins[ $filename ]);
567                     }
568                 }
569             }
570             if ($expectedPlugins) {
571                 $status = false;
572                 $message = "FAILED: files missing from libs/plugins: " . join(', ', array_keys($expectedPlugins));
573                 if ($errors === null) {
574                     echo $message . ".\n";
575                 } else {
576                     $errors[ 'plugins' ] = $message;
577                 }
578             } elseif ($errors === null) {
579                 echo "... OK\n";
580             }
581         } else {
582             $status = false;
583             $message = "FAILED: " . SMARTY_PLUGINS_DIR . ' is not a directory';
584             if ($errors === null) {
585                 echo $message . ".\n";
586             } else {
587                 $errors[ 'plugins_dir_constant' ] = $message;
588             }
589         }
590
591         if ($errors === null) {
592             echo "Tests complete.\n";
593             echo "</PRE>\n";
594         }
595
596         return $status;
597     }
598 }