[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-cvs
Subject:    [SMARTY-CVS] cvs: smarty / Smarty.class.php  /docs appendixes.sgml designers.sgml getting-started.sg
From:       "Monte Ohrt" <monte () ispi ! net>
Date:       2002-06-26 21:17:29
[Download RAW message or body]

mohrt		Wed Jun 26 17:17:29 2002 EDT

  Modified files:              
    /smarty	Smarty.class.php 
    /smarty/docs	appendixes.sgml designers.sgml getting-started.sgml 
                	programmers.sgml 
  Log:
  update plugin loading logic, look in SMARTY_DIR, then cwd. If all fail, then retry \
all with include_path  
  


["mohrt-20020626171729.txt" (text/plain)]

Index: smarty/Smarty.class.php
diff -u smarty/Smarty.class.php:1.291 smarty/Smarty.class.php:1.292
--- smarty/Smarty.class.php:1.291	Wed Jun 26 12:08:24 2002
+++ smarty/Smarty.class.php	Wed Jun 26 17:17:26 2002
@@ -1672,25 +1672,36 @@
 
             $_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
-        		if ($this->_get_include_path($_plugin_filepath, $_include_filepath)) {
-            		return $_include_filepath;
-        		}
+			} 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;
     }
 
Index: smarty/docs/appendixes.sgml
diff -u smarty/docs/appendixes.sgml:1.8 smarty/docs/appendixes.sgml:1.9
--- smarty/docs/appendixes.sgml:1.8	Mon Jun  3 12:05:33 2002
+++ smarty/docs/appendixes.sgml	Wed Jun 26 17:17:27 2002
@@ -359,9 +359,11 @@
 		<para>
 		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.
 		</para>
 <example>
 <title>Example of Obfuscating an E-mail Address</title>
@@ -371,26 +373,15 @@
 ---------
 
 Send inquiries to
-&lt;a href="mailto:{$EmailAddress|escape:"hex"}"&gt;{$EmailAddress|escape:"hexentity"}&lt;/a&gt;
                
-
-OUTPUT:
-
-Send inquiries to 
-&lt;a
-href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74"&gt;&amp;#x62;&amp;#x6f;&amp;#x62;&amp;#x40;&amp;#x6d;&amp;#x65;&amp;#x2e;&amp;#x6e;&amp;#x65;&amp;#x74;&lt;/a&gt;
 +{mailto address=$EmailAddress encode="javascript" subject="Hello"}
 
 </programlisting>
 </example>
-	<para>
-	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.
-	</para>
 	<note>
 	<title>Technical Note</title>
 	<para>
-    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.
 	</para>
 	</note>
 	</sect1>
@@ -398,7 +389,7 @@
 <chapter id="resources">
 	<title>Resources</title>
 	<para>
-	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&amp;r=1&amp;w=2
Index: smarty/docs/designers.sgml
diff -u smarty/docs/designers.sgml:1.34 smarty/docs/designers.sgml:1.35
--- smarty/docs/designers.sgml:1.34	Wed Jun 19 10:43:55 2002
+++ smarty/docs/designers.sgml	Wed Jun 26 17:17:27 2002
@@ -3818,6 +3818,12 @@
 			root and supply the relative path to this file as the "src"
 			parameter to popup_init.
 			</para>
+<example>
+<title>popup_init</title>
+<programlisting>
+{* popup_init must be called once at the top of the page *}
+{popup_init src="/javascripts/overlib.js"}</programlisting>
+</example>
 		</sect1>
 		<sect1 id="language.function.popup">
 			<title>popup</title>
Index: smarty/docs/getting-started.sgml
diff -u smarty/docs/getting-started.sgml:1.10 smarty/docs/getting-started.sgml:1.11
--- smarty/docs/getting-started.sgml:1.10	Tue Jun 25 19:02:52 2002
+++ smarty/docs/getting-started.sgml	Wed Jun 26 17:17:27 2002
@@ -153,8 +153,9 @@
 
 	<para>
 	You can either place these library files within your PHP include_path, or
-	in any directory as long as you define that with the SMARTY_DIR constant.
-	We'll show an example of both.
+	in any directory as long as you define that with the <link
+	linkend="constant.smarty.dir">SMARTY_DIR</link> constant. We'll show an
+	example of both.
 	</para>
 	<para>
 	Here is how you create an instance of Smarty in your PHP scripts:
@@ -169,8 +170,9 @@
 
 	<para>
 	If the library files are outside of your PHP include_path, you must define
-	the absolute path with the SMARTY_DIR constant. SMARTY_DIR must end with a
-	slash. Lets say we place our Smarty library files in
+	the absolute path with the <link
+	linkend="constant.smarty.dir">SMARTY_DIR</link> constant. SMARTY_DIR must
+	end with a slash. Lets say we place our Smarty library files in
 	"/usr/local/lib/php/Smarty/".
 	</para>
 
@@ -238,11 +240,11 @@
 	<example>
      <title>Example file structure</title>
      <screen>
-/php/includes/Smarty/Smarty.class.php
-/php/includes/Smarty/Smarty_Compiler.class.php
-/php/includes/Smarty/Config_File.class.php
-/php/includes/Smarty/debug.tpl
-/php/includes/Smarty/plugins/*.php
+/usr/local/lib/php/Smarty/Smarty.class.php
+/usr/local/lib/php/Smarty/Smarty_Compiler.class.php
+/usr/local/lib/php/Smarty/Config_File.class.php
+/usr/local/lib/php/Smarty/debug.tpl
+/usr/local/lib/php/Smarty/plugins/*.php
 
 /web/www.mydomain.com/smarty/guestbook/templates/
 /web/www.mydomain.com/smarty/guestbook/templates_c/
@@ -420,27 +422,5 @@
    
   </sect1>
 
-  <sect1 id="smarty.constants">
-   <title>Constants</title>
-   <para></para>
-
-   <sect2 id="constant.smarty.dir">
-    <title>SMARTY_DIR</title>
-    <para>
-     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.
-    </para>
-    <example>
-     <title>SMARTY_DIR</title>
-     <programlisting>
-// set path to Smarty directory
-define("SMARTY_DIR","/usr/local/lib/php/Smarty/");
-
-require_once(SMARTY_DIR."Smarty.class.php");</programlisting>
-    </example>
-   </sect2>
-  </sect1>
  </chapter>
 </part>
Index: smarty/docs/programmers.sgml
diff -u smarty/docs/programmers.sgml:1.14 smarty/docs/programmers.sgml:1.15
--- smarty/docs/programmers.sgml:1.14	Tue Jun 25 19:02:58 2002
+++ smarty/docs/programmers.sgml	Wed Jun 26 17:17:27 2002
@@ -1,5 +1,30 @@
   <part id="smarty.for.programmers">
    <title>Smarty For Programmers</title>
+
+
+	<chapter id="smarty.constants">
+	 <title>Constants</title>
+	 <para></para>
+
+	 <sect1 id="constant.smarty.dir">
+      <title>SMARTY_DIR</title>
+      <para>
+       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.
+      </para>
+      <example>
+       <title>SMARTY_DIR</title>
+       <programlisting>
+// set path to Smarty directory
+define("SMARTY_DIR","/usr/local/lib/php/Smarty/");
+
+require_once(SMARTY_DIR."Smarty.class.php");</programlisting>
+      </example>
+	 </sect1>
+	</chapter>
+
     <chapter id="api.variables">
      <title>Variables</title>
 
@@ -15,7 +40,7 @@
 	   <note>
 		   <title>Technical Note</title>
 		   <para>
-    	   It is not mandatory to put this directory under
+    	   It is not recommended to put this directory under
     	   the web server document root.
     	   </para>
 	  </note>
@@ -39,7 +64,7 @@
 	 <note>
 	 <title>Technical Note</title>
 	 <para>
-       It is not mandatory to put this directory under
+       It is not recommended to put this directory under
        the web server document root.
       </para>
 	 </note>
@@ -55,7 +80,7 @@
 	 <note>
 	 <title>Technical Note</title>
 	 <para>
-       It is not mandatory to put this directory under
+       It is not recommended to put this directory under
        the web server document root.
       </para>
 	 </note>
@@ -63,11 +88,20 @@
      <sect1 id="variable.plugins.dir">
       <title>$plugins_dir</title>
       <para>
-       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.
       </para>
+	  <note>
+	  <title>Technical Note</title>
+	  <para>
+	  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.
+	  </para>
+	  </note>
      </sect1>
      <sect1 id="variable.debugging">
       <title>$debugging</title>
@@ -217,7 +251,7 @@
 	  <note>
 		  <title>Technical Note</title>
 		  <para>
-    	   It is not mandatory to put this directory under
+    	   It is not recommended to put this directory under
     	   the web server document root.
     	  </para>
 	  </note>



-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic