| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty read include path plugin | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |  * @subpackage PluginsInternal | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @author     Monte Ohrt | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty Internal Read Include Path Class | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |  * @package    Smarty | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |  * @subpackage PluginsInternal | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class Smarty_Internal_Get_Include_Path | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Return full file path from PHP include_path | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2014-06-06 02:40:04 +00:00
										 |  |  |      * @param  string $filepath filepath | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |      * @return string|boolean full filepath or false | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2013-07-15 18:18:28 +00:00
										 |  |  |     public static function getIncludePath($filepath) | 
					
						
							| 
									
										
										
										
											2013-07-14 22:15:45 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         static $_include_path = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (function_exists('stream_resolve_include_path')) { | 
					
						
							|  |  |  |             // available since PHP 5.3.2
 | 
					
						
							|  |  |  |             return stream_resolve_include_path($filepath); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if ($_include_path === null) { | 
					
						
							|  |  |  |             $_include_path = explode(PATH_SEPARATOR, get_include_path()); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         foreach ($_include_path as $_path) { | 
					
						
							|  |  |  |             if (file_exists($_path . DS . $filepath)) { | 
					
						
							|  |  |  |                 return $_path . DS . $filepath; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |