PageRenderTime 45ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/yet-another-photoblog/lib/Savant2-2.4.3/Savant2/tests/6_paths.php

https://github.com/Mercedes/ratonesytortillas
PHP | 52 lines | 34 code | 11 blank | 7 comment | 2 complexity | 6e2bbce66f43ab96832a30285e29a1a6 MD5 | raw file
  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. ?>