gzopen_include_path.inc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. $pwd = getcwd();
  3. $f = basename(__FILE__);
  4. $dir1 = $pwd."/".$f.".dir1";
  5. $dir2 = $pwd."/".$f.".dir2";
  6. $dir3 = $pwd."/".$f.".dir3";
  7. //invalid directory
  8. $dir4 = $pwd."/".$f.".dir4";
  9. $newdirs = array($dir1, $dir2, $dir3);
  10. $reldirs = array("dir1", "dir2", "dir3");
  11. function generate_next_rel_path() {
  12. global $reldirs;
  13. //create the include directory structure
  14. $pathSep = ":";
  15. $newIncludePath = "";
  16. if(substr(PHP_OS, 0, 3) == 'WIN' ) {
  17. $pathSep = ";";
  18. }
  19. foreach($reldirs as $newdir) {
  20. $newIncludePath .= $newdir.$pathSep;
  21. }
  22. return "dir4".$pathSep . $newIncludePath;
  23. }
  24. function generate_next_path() {
  25. global $newdirs, $dir4;
  26. //create the include directory structure
  27. $pathSep = ":";
  28. $newIncludePath = "";
  29. if(substr(PHP_OS, 0, 3) == 'WIN' ) {
  30. $pathSep = ";";
  31. }
  32. foreach($newdirs as $newdir) {
  33. $newIncludePath .= $newdir.$pathSep;
  34. }
  35. return $dir4.$pathSep . $newIncludePath;
  36. }
  37. function create_include_path() {
  38. global $newdirs;
  39. //create the include directory structure
  40. $pathSep = ":";
  41. $newIncludePath = "";
  42. if(substr(PHP_OS, 0, 3) == 'WIN' ) {
  43. $pathSep = ";";
  44. }
  45. foreach($newdirs as $newdir) {
  46. mkdir($newdir);
  47. $newIncludePath .= $newdir.$pathSep;
  48. }
  49. return $newIncludePath;
  50. }
  51. function relative_include_path() {
  52. global $reldirs;
  53. //create the include directory structure
  54. $pathSep = ":";
  55. $newIncludePath = "";
  56. if(substr(PHP_OS, 0, 3) == 'WIN' ) {
  57. $pathSep = ";";
  58. }
  59. foreach($reldirs as $newdir) {
  60. mkdir($newdir);
  61. $newIncludePath .= $newdir.$pathSep;
  62. }
  63. return $newIncludePath;
  64. }
  65. function teardown_include_path() {
  66. global $newdirs;
  67. // remove the directory structure
  68. foreach($newdirs as $newdir) {
  69. rmdir($newdir);
  70. }
  71. }
  72. function teardown_relative_path() {
  73. global $reldirs;
  74. // remove the directory structure
  75. foreach($reldirs as $newdir) {
  76. rmdir($newdir);
  77. }
  78. }
  79. ?>