diff --git a/Smarty.class.php b/Smarty.class.php
index 58a6f521..c59be313 100644
--- a/Smarty.class.php
+++ b/Smarty.class.php
@@ -1672,25 +1672,36 @@ function _run_insert_handler($args)
$_plugin_filepath = $_plugin_dir . DIR_SEP . $_plugin_filename;
- if (@is_readable($_plugin_filepath)) {
- return $_plugin_filepath;
- }
-
- // didn't find it, see if path is relative
+ // see if path is relative
if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
+ $_relative = true;
// relative path, see if it is in the SMARTY_DIR
if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
return SMARTY_DIR . $_plugin_filepath;
}
- // didn't find it, try include path
+ } else {
+ // absolute path
+ $_relative = false;
+ }
+ // try relative to cwd (or absolute)
+ if (@is_readable($_plugin_filepath)) {
+ return $_plugin_filepath;
+ }
+ }
+
+ // still not found, try PHP include_path
+ if($_relative) {
+ foreach ((array)$this->plugins_dir as $_plugin_dir) {
+
+ $_plugin_filepath = $_plugin_dir . DIR_SEP . $_plugin_filename;
+
if ($this->_get_include_path($_plugin_filepath, $_include_filepath)) {
return $_include_filepath;
}
- }
-
-
- }
-
+ }
+ }
+
+
return false;
}
diff --git a/docs/appendixes.sgml b/docs/appendixes.sgml
index 9e8537ed..60f45e5d 100644
--- a/docs/appendixes.sgml
+++ b/docs/appendixes.sgml
@@ -359,9 +359,11 @@ Stock Name: {$ticker_name} Stock Price: {$ticker_price}
Do you ever wonder how your E-mail address gets on so many spam mailing
lists? One way spammers collect E-mail addresses is from web pages. To
- help combat this problem, you can make your E-mail address show up in a
- scrambled looking form in the HTML source, yet it it will look and work
- correctly in the browser. This is done with the escape modifier.
+ help combat this problem, you can make your E-mail address show up in
+ scrambled javascript in the HTML source, yet it it will look and work
+ correctly in the browser. This is done with the mailto plugin,
+ available from the plugin repository on the Smarty website. Download
+ the plugin and drop it into the plugins directory.
Example of Obfuscating an E-mail Address
@@ -371,26 +373,15 @@ index.tpl
---------
Send inquiries to
-<a href="mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>
-
-OUTPUT:
-
-Send inquiries to
-<a
-href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74">bob@me.net</a>
+{mailto address=$EmailAddress encode="javascript" subject="Hello"}
-
- Although this looks like a mess in the HTML source, it will render
- correctly in your browser, and the mailto: hyperlink will go to the correct
- address.
-
Technical Note
- This method isn't 100% foolproof. A spammer
- could conceivably program his e-mail collector to decode these values.
+ This method isn't 100% foolproof. A spammer could conceivably program his
+ e-mail collector to decode these values, but not likely.
@@ -398,7 +389,7 @@ href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74">bob&a
Resources
- Smarty's homepage is located at http://www.phpinsider.com/php/code/Smarty/.
+ Smarty's homepage is located at http://smarty.php.net/.
You can join the mailing list by sending an e-mail to
smarty-general-subscribe@lists.php.net. An archive of the mailing list can be
viewed at http://marc.theaimsgroup.com/?l=smarty&r=1&w=2
diff --git a/docs/designers.sgml b/docs/designers.sgml
index cc478539..68b943c7 100644
--- a/docs/designers.sgml
+++ b/docs/designers.sgml
@@ -3818,6 +3818,12 @@ OUTPUT:
root and supply the relative path to this file as the "src"
parameter to popup_init.
+
+popup_init
+
+{* popup_init must be called once at the top of the page *}
+{popup_init src="/javascripts/overlib.js"}
+
-
- Constants
-
-
-
- SMARTY_DIR
-
- This should be the full system path to the location of the Smarty
- class files. If this is not defined, then Smarty will attempt to
- determine the appropriate value automatically. If defined, the path
- must end with a slash.
-
-
- SMARTY_DIR
-
-// set path to Smarty directory
-define("SMARTY_DIR","/usr/local/lib/php/Smarty/");
-
-require_once(SMARTY_DIR."Smarty.class.php");
-
-
-
diff --git a/docs/programmers.sgml b/docs/programmers.sgml
index d1d5e3ed..aab8d379 100644
--- a/docs/programmers.sgml
+++ b/docs/programmers.sgml
@@ -1,5 +1,30 @@
Smarty For Programmers
+
+
+
+ Constants
+
+
+
+ SMARTY_DIR
+
+ This should be the full system path to the location of the Smarty
+ class files. If this is not defined, then Smarty will attempt to
+ determine the appropriate value automatically. If defined, the path
+ must end with a slash.
+
+
+ SMARTY_DIR
+
+// set path to Smarty directory
+define("SMARTY_DIR","/usr/local/lib/php/Smarty/");
+
+require_once(SMARTY_DIR."Smarty.class.php");
+
+
+
+
Variables
@@ -15,7 +40,7 @@
Technical Note
- It is not mandatory to put this directory under
+ It is not recommended to put this directory under
the web server document root.
@@ -39,7 +64,7 @@
Technical Note
- It is not mandatory to put this directory under
+ It is not recommended to put this directory under
the web server document root.
@@ -55,7 +80,7 @@
Technical Note
- It is not mandatory to put this directory under
+ It is not recommended to put this directory under
the web server document root.
@@ -63,11 +88,20 @@
$plugins_dir
- This is the directory where Smarty will look for the plugins that
- it needs. The directory must be relative to the directory where
- Smarty itself is installed. Default is "plugins". There can be
- only one plugins directory.
+ This is the directories where Smarty will look for the plugins that it
+ needs. Default is "plugins" under the SMARTY_DIR. If you supply a
+ relative path, Smarty will first look under the SMARTY_DIR, then
+ relative to the cwd (current working directory), then relative to each
+ entry in your PHP include path.
+
+ Technical Note
+
+ For best performance, do not setup your plugins_dir to have to use the
+ PHP include path. Use an absolute pathname, or a path relative to
+ SMARTY_DIR or the cwd.
+
+
$debugging
@@ -217,7 +251,7 @@ $smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
Technical Note
- It is not mandatory to put this directory under
+ It is not recommended to put this directory under
the web server document root.
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index 58a6f521..c59be313 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -1672,25 +1672,36 @@ function _run_insert_handler($args)
$_plugin_filepath = $_plugin_dir . DIR_SEP . $_plugin_filename;
- if (@is_readable($_plugin_filepath)) {
- return $_plugin_filepath;
- }
-
- // didn't find it, see if path is relative
+ // see if path is relative
if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
+ $_relative = true;
// relative path, see if it is in the SMARTY_DIR
if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
return SMARTY_DIR . $_plugin_filepath;
}
- // didn't find it, try include path
+ } else {
+ // absolute path
+ $_relative = false;
+ }
+ // try relative to cwd (or absolute)
+ if (@is_readable($_plugin_filepath)) {
+ return $_plugin_filepath;
+ }
+ }
+
+ // still not found, try PHP include_path
+ if($_relative) {
+ foreach ((array)$this->plugins_dir as $_plugin_dir) {
+
+ $_plugin_filepath = $_plugin_dir . DIR_SEP . $_plugin_filename;
+
if ($this->_get_include_path($_plugin_filepath, $_include_filepath)) {
return $_include_filepath;
}
- }
-
-
- }
-
+ }
+ }
+
+
return false;
}