PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/include/Savant/Savant2/tests/6_paths.php

https://github.com/radicaldesigns/amp
PHP | 52 lines | 34 code | 11 blank | 7 comment | 2 complexity | 3555fc29267eefa99235da10efbaf2ca MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, BSD-3-Clause, LGPL-2.0, CC-BY-SA-3.0, AGPL-1.0
  1. <?php
  2. /**
  3. *
  4. * Tests multiple-path directory searches
  5. *
  6. * @version $Id: 6_paths.php,v 1.1 2004/10/04 01:52:24 pmjones Exp $
  7. *
  8. */
  9. function preprint($val)
  10. {
  11. echo "<pre>\n";
  12. print_r($val);
  13. echo "</pre>\n";
  14. }
  15. error_reporting(E_ALL);
  16. require_once 'Savant2.php';
  17. $conf = array(
  18. 'template_path' => 'templates',
  19. 'resource_path' => 'resources'
  20. );
  21. $savant = new Savant2($conf);
  22. echo "<h1>Paths to begin with</h1>\n";
  23. preprint($savant->getPath('resource'));
  24. preprint($savant->getPath('template'));
  25. echo "<h1>Add a path</h1>\n";
  26. $savant->addPath('resource', 'no/such/path');
  27. preprint($savant->getPath('resource'));
  28. echo "<h1>Find an existing resource (non-default)</h1>\n";
  29. $file = $savant->findFile('resource', 'Savant2_Plugin_cycle.php');
  30. preprint($file);
  31. echo "<h1>Find an existing resource (default)</h1>\n";
  32. $file = $savant->findFile('resource', 'Savant2_Plugin_input.php');
  33. preprint($file);
  34. echo "<h1>Find a non-existent template</h1>\n";
  35. $file = $savant->findFile('template', 'no_such_template.tpl.php');
  36. if ($file) {
  37. preprint($file);
  38. } else {
  39. preprint("false or null");
  40. }
  41. ?>