| 109 | | # Set the include_path |
| 110 | | ini_set("include_path", |
| 111 | | ".".self::$path_seperator. # current directory |
| 112 | | TRAX_LIB_ROOT.self::$path_seperator. # trax libs (vendor/trax or server trax libs) |
| 113 | | PHP_LIB_ROOT.self::$path_seperator. # php libs dir (ex: /usr/local/lib/php) |
| 114 | | self::$lib_path.self::$path_seperator. # app specific libs extra libs to include |
| 115 | | ini_get("include_path") # tack on the old include_path to the end |
| 116 | | ); |
| | 111 | # Get the include_path so we know what the original path was |
| | 112 | self::$server_default_include_path = ini_get("include_path"); |
| | 113 | # Set the include_paths |
| | 114 | self::set_default_include_paths(); |
| | 130 | } |
| | 131 | |
| | 132 | function add_include_path($path, $prepend = false, $use_trax_root = false) { |
| | 133 | if(is_array($path)) { |
| | 134 | foreach($path as $new_path) { |
| | 135 | if(!in_array($new_path, self::$include_paths)) { |
| | 136 | $new_paths[] = $use_trax_root ? TRAX_ROOT."/".$new_path : $new_path; |
| | 137 | } |
| | 138 | } |
| | 139 | } elseif(!in_array($path, self::$include_paths)) { |
| | 140 | $new_paths[] = $use_trax_root ? TRAX_ROOT."/".$path : $path; |
| | 141 | } |
| | 142 | if(is_array($new_paths) && is_array(self::$include_paths)) { |
| | 143 | foreach($new_paths as $path) { |
| | 144 | if($prepend) { |
| | 145 | array_unshift(self::$include_paths, $path); |
| | 146 | } else { |
| | 147 | array_push(self::$include_paths, $path); |
| | 148 | } |
| | 149 | } |
| | 150 | ini_set("include_path", implode(self::$path_seperator, self::$include_paths)); |
| | 151 | } |
| | 152 | } |
| | 153 | |
| | 154 | function set_default_include_paths() { |
| | 155 | # first clear out all the current paths |
| | 156 | self::$include_paths = array(); |
| | 157 | # now add the default paths |
| | 158 | self::add_include_path(array( |
| | 159 | ".", # current directory |
| | 160 | TRAX_LIB_ROOT, # trax libs (vendor/trax or server trax libs) |
| | 161 | PHP_LIB_ROOT, # php libs dir (ex: /usr/local/lib/php) |
| | 162 | self::$lib_path, # app specific libs extra libs to include |
| | 163 | self::$server_default_include_path # tack on the old include_path to the end |
| | 164 | )); |