Редакция 2 | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 2 | Редакция 10 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | /**
|
2 | /**
|
3 | * Smarty plugin
|
3 | * Smarty plugin
|
4 | * @package Smarty
|
4 | * @package Smarty
|
5 | * @subpackage plugins
|
5 | * @subpackage plugins
|
6 | */
|
6 | */
|
7 | 7 | ||
8 | /**
|
8 | /**
|
9 | * Get path to file from include_path
|
9 | * Get path to file from include_path
|
10 | *
|
10 | *
|
11 | * @param string $file_path
|
11 | * @param string $file_path
|
12 | * @param string $new_file_path
|
12 | * @param string $new_file_path
|
13 | * @return boolean
|
13 | * @return boolean
|
14 | * @staticvar array|null
|
14 | * @staticvar array|null
|
15 | */
|
15 | */
|
16 | 16 | ||
17 | // $file_path, &$new_file_path
|
17 | // $file_path, &$new_file_path
|
18 | 18 | ||
19 | function smarty_core_get_include_path(&$params, &$smarty) |
19 | function smarty_core_get_include_path(&$params, &$smarty) |
20 | {
|
20 | {
|
21 | static $_path_array = null; |
21 | static $_path_array = null; |
22 | 22 | ||
23 | if(!isset($_path_array)) { |
23 | if(!isset($_path_array)) { |
24 | $_ini_include_path = ini_get('include_path'); |
24 | $_ini_include_path = ini_get('include_path'); |
25 | 25 | ||
26 | if(strstr($_ini_include_path,';')) { |
26 | if(strstr($_ini_include_path,';')) { |
27 | // windows pathnames
|
27 | // windows pathnames
|
28 | $_path_array = explode(';',$_ini_include_path); |
28 | $_path_array = explode(';',$_ini_include_path); |
29 | } else { |
29 | } else { |
30 | $_path_array = explode(':',$_ini_include_path); |
30 | $_path_array = explode(':',$_ini_include_path); |
31 | }
|
31 | }
|
32 | }
|
32 | }
|
33 | foreach ($_path_array as $_include_path) { |
33 | foreach ($_path_array as $_include_path) { |
34 | if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) { |
34 | if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) { |
35 | $params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path']; |
35 | $params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path']; |
36 | return true; |
36 | return true; |
37 | }
|
37 | }
|
38 | }
|
38 | }
|
39 | return false; |
39 | return false; |
40 | }
|
40 | }
|
41 | 41 | ||
42 | /* vim: set expandtab: */
|
42 | /* vim: set expandtab: */
|
43 | 43 | ||
44 | ?>
|
44 | ?>
|
45 | 45 |