9 * assemble filepath of requested plugin
13 * @return string|false
15 function smarty_core_assemble_plugin_filepath($params, &$smarty)
18 $_plugin_filename = $params['type'] . '.' . $params['name'] . '.php';
21 foreach ((array)$smarty->plugins_dir
as $_plugin_dir) {
23 $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR
. $_plugin_filename;
25 // see if path is relative
26 if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
27 $_relative_paths[] = $_plugin_dir;
28 // relative path, see if it is in the SMARTY_DIR
29 if (@is_readable
(SMARTY_DIR
. $_plugin_filepath)) {
30 $_return = SMARTY_DIR
. $_plugin_filepath;
34 // try relative to cwd (or absolute)
35 if (@is_readable
($_plugin_filepath)) {
36 $_return = $_plugin_filepath;
41 if($_return === false) {
42 // still not found, try PHP include_path
43 if(isset($_relative_paths)) {
44 foreach ((array)$_relative_paths as $_plugin_dir) {
46 $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR
. $_plugin_filename;
48 $_params = array('file_path' => $_plugin_filepath);
49 require_once(SMARTY_DIR
. 'core' . DIRECTORY_SEPARATOR
. 'core.get_include_path.php');
50 if(smarty_core_get_include_path($_params, $smarty)) {
51 return $_params['new_file_path'];
60 /* vim: set expandtab: */
This page took 0.273207 seconds and 4 git commands to generate.