Back to index

php5  5.3.10
fopen_include_path.inc
Go to the documentation of this file.
00001 <?php
00002 $pwd = getcwd();
00003 $f = basename(__FILE__);
00004 $dir1 = $pwd."/".$f.".dir1";
00005 $dir2 = $pwd."/".$f.".dir2";
00006 $dir3 = $pwd."/".$f.".dir3";
00007 //invalid directory
00008 $dir4 = $pwd."/".$f.".dir4";
00009 $newdirs = array($dir1, $dir2, $dir3);
00010 
00011 $reldirs = array("dir1", "dir2", "dir3");
00012 
00013 function generate_next_rel_path() {
00014        global $reldirs;
00015        //create the include directory structure
00016        $pathSep = ":";
00017        $newIncludePath = "";
00018        if(substr(PHP_OS, 0, 3) == 'WIN' ) {
00019           $pathSep = ";";
00020        }
00021        foreach($reldirs as $newdir) {
00022           $newIncludePath .= $newdir.$pathSep;
00023        }
00024        return "dir4".$pathSep . $newIncludePath;
00025 }
00026 
00027 function generate_next_path() {
00028        global $newdirs, $dir4;
00029        //create the include directory structure
00030        $pathSep = ":";
00031        $newIncludePath = "";
00032        if(substr(PHP_OS, 0, 3) == 'WIN' ) {
00033           $pathSep = ";";
00034        }
00035        foreach($newdirs as $newdir) {
00036           $newIncludePath .= $newdir.$pathSep;
00037        }
00038        return $dir4.$pathSep . $newIncludePath;
00039 }
00040 
00041 
00042 function create_include_path() {
00043 
00044        global $newdirs;
00045        //create the include directory structure
00046        $pathSep = ":";
00047        $newIncludePath = "";
00048        if(substr(PHP_OS, 0, 3) == 'WIN' ) {
00049           $pathSep = ";";
00050        }
00051        foreach($newdirs as $newdir) {
00052           mkdir($newdir);
00053           $newIncludePath .= $newdir.$pathSep;
00054        }
00055        return $newIncludePath;
00056 }
00057 
00058 function relative_include_path() {
00059 
00060        global $reldirs;
00061        //create the include directory structure
00062        $pathSep = ":";
00063        $newIncludePath = "";
00064        if(substr(PHP_OS, 0, 3) == 'WIN' ) {
00065           $pathSep = ";";
00066        }
00067        foreach($reldirs as $newdir) {
00068           mkdir($newdir);
00069           $newIncludePath .= $newdir.$pathSep;
00070        }
00071        return $newIncludePath;
00072 }
00073 
00074 
00075 function teardown_include_path() {
00076 
00077        global $newdirs;
00078        // remove the directory structure
00079        foreach($newdirs as $newdir) {
00080           rmdir($newdir);
00081        }
00082 }
00083 
00084 function teardown_relative_path() {
00085 
00086        global $reldirs;
00087        // remove the directory structure
00088        foreach($reldirs as $newdir) {
00089           rmdir($newdir);
00090        }
00091 }
00092 ?>