summaryrefslogtreecommitdiff
path: root/libs/sysplugins/smarty_internal_get_include_path.php
diff options
context:
space:
mode:
authoruwe.tews@googlemail.com <uwe.tews@googlemail.com>2010-12-13 22:05:27 +0000
committeruwe.tews@googlemail.com <uwe.tews@googlemail.com>2010-12-13 22:05:27 +0000
commitf0c95ab79cdf11aea50bae5093c071dddef65df2 (patch)
tree74ecf169f1ce84718e1faffb26486f56e0f429d2 /libs/sysplugins/smarty_internal_get_include_path.php
parent73bd60cad518bcfd162ca5d03d636fe8562fc5d1 (diff)
downloadsmarty-f0c95ab79cdf11aea50bae5093c071dddef65df2.tar.gz
smarty-f0c95ab79cdf11aea50bae5093c071dddef65df2.tar.bz2
smarty-f0c95ab79cdf11aea50bae5093c071dddef65df2.zip
- bugfix {$smarty.template} in child template did not return right content
- bugfix Smarty3 did not search the PHP include_path for template files
Diffstat (limited to 'libs/sysplugins/smarty_internal_get_include_path.php')
-rw-r--r--libs/sysplugins/smarty_internal_get_include_path.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/libs/sysplugins/smarty_internal_get_include_path.php b/libs/sysplugins/smarty_internal_get_include_path.php
new file mode 100644
index 00000000..b9f19316
--- /dev/null
+++ b/libs/sysplugins/smarty_internal_get_include_path.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Smarty read include path plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Monte Ohrt
+ */
+
+/**
+ * Smarty Internal Read Include Path Class
+ */
+class Smarty_Internal_Get_Include_Path {
+ /**
+ * Return full file path from PHP include_path
+ *
+ * @param string $filepath filepath
+ * @return mixed full filepath or false
+ */
+ public static function getIncludePath($filepath)
+ {
+ static $_path_array = null;
+
+ if(!isset($_path_array)) {
+ $_ini_include_path = ini_get('include_path');
+
+ if(strstr($_ini_include_path,';')) {
+ // windows pathnames
+ $_path_array = explode(';',$_ini_include_path);
+ } else {
+ $_path_array = explode(':',$_ini_include_path);
+ }
+ }
+ foreach ($_path_array as $_include_path) {
+ if (file_exists($_include_path . DS . $filepath)) {
+ return $_include_path . DS . $filepath;
+ }
+ }
+ return false;
+ }
+}
+
+?> \ No newline at end of file