1
0
mirror of https://github.com/EGroupware/egroupware.git synced 2024-12-14 10:41:23 +01:00
egroupware_official/phpgwapi/inc/savant2/Savant2/tests/6_paths.php
Ralf Becker 232252475f patch fixing many depricated functions (eg. posix regular expressions) and features, which fill up the error_log under php5.3 (and will no longer be available under php6).
Patch is mostly created by script in egroupware/doc/fix_depricated.php in separate commit.
I do NOT advice to apply this patch to a production system (it's commited to trunk!), as the automatic modified regular expressions have a good change to break something ...
2009-06-08 16:21:14 +00:00

52 lines
1.0 KiB
PHP
Executable File

<?php
/**
*
* Tests multiple-path directory searches
*
* @version $Id$
*
*/
function preprint($val)
{
echo "<pre>\n";
print_r($val);
echo "</pre>\n";
}
error_reporting(E_ALL);
require_once 'Savant2.php';
$conf = array(
'template_path' => 'templates',
'resource_path' => 'resources'
);
$savant = new Savant2($conf);
echo "<h1>Paths to begin with</h1>\n";
preprint($savant->getPath('resource'));
preprint($savant->getPath('template'));
echo "<h1>Add a path</h1>\n";
$savant->addPath('resource', 'no/such/path');
preprint($savant->getPath('resource'));
echo "<h1>Find an existing resource (non-default)</h1>\n";
$file = $savant->findFile('resource', 'Savant2_Plugin_cycle.php');
preprint($file);
echo "<h1>Find an existing resource (default)</h1>\n";
$file = $savant->findFile('resource', 'Savant2_Plugin_input.php');
preprint($file);
echo "<h1>Find a non-existent template</h1>\n";
$file = $savant->findFile('template', 'no_such_template.tpl.php');
if ($file) {
preprint($file);
} else {
preprint("false or null");
}
?>