cvs: smarty /libs/plugins function.counter.php function.fetch.php function.popup_init.php modifier.capitalize.php modifier.cat.php modifier.date_format.php modifier.debug_print_var.php modifier.escape.php modifier.indent.php modifier.lower.php modifier.nl2br.php modifier.strip.php modifier.upper.php modifier.wordwrap.php outputfilter.trimwhitespace.php shared.escape_special_chars.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1071854336@cvsserver> |
messju Fri Dec 19 12:18:56 2003 EDT
Modified files:
/smarty/libs/plugins function.counter.php function.fetch.php
function.popup_init.php
modifier.capitalize.php modifier.cat.php
modifier.date_format.php
modifier.debug_print_var.php
modifier.escape.php modifier.indent.php
modifier.lower.php modifier.nl2br.php
modifier.strip.php modifier.upper.php
modifier.wordwrap.php
outputfilter.trimwhitespace.php
shared.escape_special_chars.php
Log:
removed tabs. fixed indentiation.
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
messju-20031219121856.txt
(text/plain, 26.7 KB)
Index: smarty/libs/plugins/function.counter.php
diff -u smarty/libs/plugins/function.counter.php:1.11 smarty/libs/plugins/function.counter.php:1.12
--- smarty/libs/plugins/function.counter.php:1.11 Fri Dec 19 03:49:17 2003
+++ smarty/libs/plugins/function.counter.php Fri Dec 19 12:18:56 2003
@@ -53,9 +53,9 @@
if ($print) {
$retval = $counter['count'];
- } else {
- $retval = null;
- }
+ } else {
+ $retval = null;
+ }
if (isset($params['skip'])) {
$counter['skip'] = $params['skip'];
@@ -69,9 +69,9 @@
$counter['count'] -= $counter['skip'];
else
$counter['count'] += $counter['skip'];
-
- return $retval;
-
+
+ return $retval;
+
}
/* vim: set expandtab: */
Index: smarty/libs/plugins/function.fetch.php
diff -u smarty/libs/plugins/function.fetch.php:1.15 smarty/libs/plugins/function.fetch.php:1.16
--- smarty/libs/plugins/function.fetch.php:1.15 Sat Jun 21 13:35:15 2003
+++ smarty/libs/plugins/function.fetch.php Fri Dec 19 12:18:56 2003
@@ -27,182 +27,182 @@
}
if ($smarty->security && !preg_match('!^(http|ftp)://!i', $params['file'])) {
- $_params = array('resource_type' => 'file', 'resource_name' => $params['file']);
- require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.is_secure.php');
- if(!smarty_core_is_secure($_params, $smarty)) {
+ $_params = array('resource_type' => 'file', 'resource_name' => $params['file']);
+ require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.is_secure.php');
+ if(!smarty_core_is_secure($_params, $smarty)) {
$smarty->_trigger_fatal_error('[plugin] (secure mode) fetch \'' . $params['file'] . '\' is not allowed');
- return;
- }
-
- // fetch the file
- if($fp = @fopen($params['file'],'r')) {
- while(!feof($fp)) {
- $content .= fgets ($fp,4096);
- }
- fclose($fp);
- } else {
+ return;
+ }
+
+ // fetch the file
+ if($fp = @fopen($params['file'],'r')) {
+ while(!feof($fp)) {
+ $content .= fgets ($fp,4096);
+ }
+ fclose($fp);
+ } else {
$smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] . '\'');
- return;
- }
+ return;
+ }
} else {
- // not a local file
- if(preg_match('!^http://!i',$params['file'])) {
- // http fetch
- if($uri_parts = parse_url($params['file'])) {
- // set defaults
- $host = $server_name = $uri_parts['host'];
- $timeout = 30;
- $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
- $agent = "Smarty Template Engine ".$smarty->_version;
- $referer = "";
- $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/';
- $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : '';
- $_is_proxy = false;
- if(empty($uri_parts['port'])) {
- $port = 80;
- } else {
- $port = $uri_parts['port'];
- }
- if(empty($uri_parts['user'])) {
- $user = '';
- }
- // loop through parameters, setup headers
- foreach($params as $param_key => $param_value) {
- switch($param_key) {
- case "file":
- case "assign":
- case "assign_headers":
- break;
- case "user":
- if(!empty($param_value)) {
- $user = $param_value;
- }
- break;
- case "pass":
- if(!empty($param_value)) {
- $pass = $param_value;
- }
- break;
- case "accept":
- if(!empty($param_value)) {
- $accept = $param_value;
- }
- break;
- case "header":
- if(!empty($param_value)) {
- if(!preg_match('![\w\d-]+: .+!',$param_value)) {
- $smarty->_trigger_fatal_error("[plugin] invalid header format '".$param_value."'");
- return;
- } else {
- $extra_headers[] = $param_value;
- }
- }
- break;
- case "proxy_host":
- if(!empty($param_value)) {
- $proxy_host = $param_value;
- }
- break;
- case "proxy_port":
- if(!preg_match('!\D!', $param_value)) {
- $proxy_port = (int) $param_value;
- } else {
- $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'");
- return;
- }
- break;
- case "agent":
- if(!empty($param_value)) {
- $agent = $param_value;
- }
- break;
- case "referer":
- if(!empty($param_value)) {
- $referer = $param_value;
- }
- break;
- case "timeout":
- if(!preg_match('!\D!', $param_value)) {
- $timeout = (int) $param_value;
- } else {
- $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'");
- return;
- }
- break;
- default:
- $smarty->_trigger_fatal_error("[plugin] unrecognized attribute '".$param_key."'");
- return;
- }
- }
- if(!empty($proxy_host) && !empty($proxy_port)) {
- $_is_proxy = true;
- $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout);
- } else {
- $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout);
- }
-
- if(!$fp) {
- $smarty->_trigger_fatal_error("[plugin] unable to fetch: $errstr ($errno)");
- return;
- } else {
- if($_is_proxy) {
- fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n");
- } else {
- fputs($fp, "GET $uri HTTP/1.0\r\n");
- }
- if(!empty($host)) {
- fputs($fp, "Host: $host\r\n");
- }
- if(!empty($accept)) {
- fputs($fp, "Accept: $accept\r\n");
- }
- if(!empty($agent)) {
- fputs($fp, "User-Agent: $agent\r\n");
- }
- if(!empty($referer)) {
- fputs($fp, "Referer: $referer\r\n");
- }
- if(isset($extra_headers) && is_array($extra_headers)) {
- foreach($extra_headers as $curr_header) {
- fputs($fp, $curr_header."\r\n");
- }
- }
- if(!empty($user) && !empty($pass)) {
- fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n");
- }
-
- $content = '';
- fputs($fp, "\r\n");
- while(!feof($fp)) {
- $content .= fgets($fp,4096);
- }
- fclose($fp);
- $csplit = split("\r\n\r\n",$content,2);
-
- $content = $csplit[1];
-
- if(!empty($params['assign_headers'])) {
- $smarty->assign($params['assign_headers'],split("\r\n",$csplit[0]));
- }
- }
- } else {
- $smarty->_trigger_fatal_error("[plugin] unable to parse URL, check syntax");
- return;
- }
- } else {
- // ftp fetch
- if($fp = @fopen($params['file'],'r')) {
- while(!feof($fp)) {
- $content .= fgets ($fp,4096);
- }
- fclose($fp);
- } else {
- $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] .'\'');
- return;
- }
- }
-
- }
+ // not a local file
+ if(preg_match('!^http://!i',$params['file'])) {
+ // http fetch
+ if($uri_parts = parse_url($params['file'])) {
+ // set defaults
+ $host = $server_name = $uri_parts['host'];
+ $timeout = 30;
+ $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
+ $agent = "Smarty Template Engine ".$smarty->_version;
+ $referer = "";
+ $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/';
+ $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : '';
+ $_is_proxy = false;
+ if(empty($uri_parts['port'])) {
+ $port = 80;
+ } else {
+ $port = $uri_parts['port'];
+ }
+ if(empty($uri_parts['user'])) {
+ $user = '';
+ }
+ // loop through parameters, setup headers
+ foreach($params as $param_key => $param_value) {
+ switch($param_key) {
+ case "file":
+ case "assign":
+ case "assign_headers":
+ break;
+ case "user":
+ if(!empty($param_value)) {
+ $user = $param_value;
+ }
+ break;
+ case "pass":
+ if(!empty($param_value)) {
+ $pass = $param_value;
+ }
+ break;
+ case "accept":
+ if(!empty($param_value)) {
+ $accept = $param_value;
+ }
+ break;
+ case "header":
+ if(!empty($param_value)) {
+ if(!preg_match('![\w\d-]+: .+!',$param_value)) {
+ $smarty->_trigger_fatal_error("[plugin] invalid header format '".$param_value."'");
+ return;
+ } else {
+ $extra_headers[] = $param_value;
+ }
+ }
+ break;
+ case "proxy_host":
+ if(!empty($param_value)) {
+ $proxy_host = $param_value;
+ }
+ break;
+ case "proxy_port":
+ if(!preg_match('!\D!', $param_value)) {
+ $proxy_port = (int) $param_value;
+ } else {
+ $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'");
+ return;
+ }
+ break;
+ case "agent":
+ if(!empty($param_value)) {
+ $agent = $param_value;
+ }
+ break;
+ case "referer":
+ if(!empty($param_value)) {
+ $referer = $param_value;
+ }
+ break;
+ case "timeout":
+ if(!preg_match('!\D!', $param_value)) {
+ $timeout = (int) $param_value;
+ } else {
+ $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'");
+ return;
+ }
+ break;
+ default:
+ $smarty->_trigger_fatal_error("[plugin] unrecognized attribute '".$param_key."'");
+ return;
+ }
+ }
+ if(!empty($proxy_host) && !empty($proxy_port)) {
+ $_is_proxy = true;
+ $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout);
+ } else {
+ $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout);
+ }
+
+ if(!$fp) {
+ $smarty->_trigger_fatal_error("[plugin] unable to fetch: $errstr ($errno)");
+ return;
+ } else {
+ if($_is_proxy) {
+ fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n");
+ } else {
+ fputs($fp, "GET $uri HTTP/1.0\r\n");
+ }
+ if(!empty($host)) {
+ fputs($fp, "Host: $host\r\n");
+ }
+ if(!empty($accept)) {
+ fputs($fp, "Accept: $accept\r\n");
+ }
+ if(!empty($agent)) {
+ fputs($fp, "User-Agent: $agent\r\n");
+ }
+ if(!empty($referer)) {
+ fputs($fp, "Referer: $referer\r\n");
+ }
+ if(isset($extra_headers) && is_array($extra_headers)) {
+ foreach($extra_headers as $curr_header) {
+ fputs($fp, $curr_header."\r\n");
+ }
+ }
+ if(!empty($user) && !empty($pass)) {
+ fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n");
+ }
+
+ $content = '';
+ fputs($fp, "\r\n");
+ while(!feof($fp)) {
+ $content .= fgets($fp,4096);
+ }
+ fclose($fp);
+ $csplit = split("\r\n\r\n",$content,2);
+
+ $content = $csplit[1];
+
+ if(!empty($params['assign_headers'])) {
+ $smarty->assign($params['assign_headers'],split("\r\n",$csplit[0]));
+ }
+ }
+ } else {
+ $smarty->_trigger_fatal_error("[plugin] unable to parse URL, check syntax");
+ return;
+ }
+ } else {
+ // ftp fetch
+ if($fp = @fopen($params['file'],'r')) {
+ while(!feof($fp)) {
+ $content .= fgets ($fp,4096);
+ }
+ fclose($fp);
+ } else {
+ $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] .'\'');
+ return;
+ }
+ }
+
+ }
if (!empty($params['assign'])) {
Index: smarty/libs/plugins/function.popup_init.php
diff -u smarty/libs/plugins/function.popup_init.php:1.8 smarty/libs/plugins/function.popup_init.php:1.9
--- smarty/libs/plugins/function.popup_init.php:1.8 Sun Apr 20 17:12:03 2003
+++ smarty/libs/plugins/function.popup_init.php Fri Dec 19 12:18:56 2003
@@ -20,14 +20,14 @@
*/
function smarty_function_popup_init($params, &$smarty)
{
- $zindex = 1000;
-
+ $zindex = 1000;
+
if (!empty($params['zindex'])) {
- $zindex = $params['zindex'];
- }
-
+ $zindex = $params['zindex'];
+ }
+
if (!empty($params['src'])) {
- return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n"
+ return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n"
. '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n";
} else {
$smarty->trigger_error("popup_init: missing src parameter");
Index: smarty/libs/plugins/modifier.capitalize.php
diff -u smarty/libs/plugins/modifier.capitalize.php:1.2 smarty/libs/plugins/modifier.capitalize.php:1.3
--- smarty/libs/plugins/modifier.capitalize.php:1.2 Sun Apr 20 17:12:03 2003
+++ smarty/libs/plugins/modifier.capitalize.php Fri Dec 19 12:18:56 2003
@@ -19,7 +19,7 @@
*/
function smarty_modifier_capitalize($string)
{
- return ucwords($string);
+ return ucwords($string);
}
?>
Index: smarty/libs/plugins/modifier.cat.php
diff -u smarty/libs/plugins/modifier.cat.php:1.2 smarty/libs/plugins/modifier.cat.php:1.3
--- smarty/libs/plugins/modifier.cat.php:1.2 Sun Apr 20 17:12:05 2003
+++ smarty/libs/plugins/modifier.cat.php Fri Dec 19 12:18:56 2003
@@ -17,7 +17,7 @@
* Example: {$var|cat:"foo"}
* @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
* (Smarty online manual)
- * @author Monte Ohrt <[email protected]>
+ * @author Monte Ohrt <[email protected]>
* @version 1.0
* @param string
* @param string
@@ -25,7 +25,7 @@
*/
function smarty_modifier_cat($string, $cat)
{
- return $string . $cat;
+ return $string . $cat;
}
/* vim: set expandtab: */
Index: smarty/libs/plugins/modifier.date_format.php
diff -u smarty/libs/plugins/modifier.date_format.php:1.9 smarty/libs/plugins/modifier.date_format.php:1.10
--- smarty/libs/plugins/modifier.date_format.php:1.9 Sat Jun 21 23:13:25 2003
+++ smarty/libs/plugins/modifier.date_format.php Fri Dec 19 12:18:56 2003
@@ -11,7 +11,7 @@
require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
/**
* Smarty date_format modifier plugin
- *
+ *
* Type: modifier<br>
* Name: date_format<br>
* Purpose: format datestamps via strftime<br>
@@ -29,13 +29,13 @@
*/
function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null)
{
- if($string != '') {
- return strftime($format, smarty_make_timestamp($string));
- } elseif (isset($default_date) && $default_date != '') {
- return strftime($format, smarty_make_timestamp($default_date));
- } else {
- return;
- }
+ if($string != '') {
+ return strftime($format, smarty_make_timestamp($string));
+ } elseif (isset($default_date) && $default_date != '') {
+ return strftime($format, smarty_make_timestamp($default_date));
+ } else {
+ return;
+ }
}
/* vim: set expandtab: */
Index: smarty/libs/plugins/modifier.debug_print_var.php
diff -u smarty/libs/plugins/modifier.debug_print_var.php:1.10 smarty/libs/plugins/modifier.debug_print_var.php:1.11
--- smarty/libs/plugins/modifier.debug_print_var.php:1.10 Thu Nov 27 12:39:06 2003
+++ smarty/libs/plugins/modifier.debug_print_var.php Fri Dec 19 12:18:56 2003
@@ -21,7 +21,7 @@
*/
function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
{
- $_replace = array("\n"=>'<i>\n</i>', "\r"=>'<i>\r</i>', "\t"=>'<i>\t</i>');
+ $_replace = array("\n"=>'<i>\n</i>', "\r"=>'<i>\r</i>', "\t"=>'<i>\t</i>');
if (is_array($var)) {
$results = "<b>Array (".count($var).")</b>";
foreach ($var as $curr_key => $curr_val) {
Index: smarty/libs/plugins/modifier.escape.php
diff -u smarty/libs/plugins/modifier.escape.php:1.10 smarty/libs/plugins/modifier.escape.php:1.11
--- smarty/libs/plugins/modifier.escape.php:1.10 Mon Aug 25 09:37:27 2003
+++ smarty/libs/plugins/modifier.escape.php Fri Dec 19 12:18:56 2003
@@ -34,20 +34,20 @@
// escape unescaped single quotes
return preg_replace("%(?<!\\\\)'%", "\\'", $string);
- case 'hex':
- // escape every character into hex
- $return = '';
- for ($x=0; $x < strlen($string); $x++) {
- $return .= '%' . bin2hex($string[$x]);
- }
- return $return;
+ case 'hex':
+ // escape every character into hex
+ $return = '';
+ for ($x=0; $x < strlen($string); $x++) {
+ $return .= '%' . bin2hex($string[$x]);
+ }
+ return $return;
- case 'hexentity':
- $return = '';
- for ($x=0; $x < strlen($string); $x++) {
- $return .= '&#x' . bin2hex($string[$x]) . ';';
- }
- return $return;
+ case 'hexentity':
+ $return = '';
+ for ($x=0; $x < strlen($string); $x++) {
+ $return .= '&#x' . bin2hex($string[$x]) . ';';
+ }
+ return $return;
case 'javascript':
// escape quotes and backslashes and newlines
Index: smarty/libs/plugins/modifier.indent.php
diff -u smarty/libs/plugins/modifier.indent.php:1.2 smarty/libs/plugins/modifier.indent.php:1.3
--- smarty/libs/plugins/modifier.indent.php:1.2 Sun Apr 20 17:12:08 2003
+++ smarty/libs/plugins/modifier.indent.php Fri Dec 19 12:18:56 2003
@@ -21,7 +21,7 @@
*/
function smarty_modifier_indent($string,$chars=4,$char=" ")
{
- return preg_replace('!^!m',str_repeat($char,$chars),$string);
+ return preg_replace('!^!m',str_repeat($char,$chars),$string);
}
?>
Index: smarty/libs/plugins/modifier.lower.php
diff -u smarty/libs/plugins/modifier.lower.php:1.2 smarty/libs/plugins/modifier.lower.php:1.3
--- smarty/libs/plugins/modifier.lower.php:1.2 Sun Apr 20 17:12:08 2003
+++ smarty/libs/plugins/modifier.lower.php Fri Dec 19 12:18:56 2003
@@ -19,7 +19,7 @@
*/
function smarty_modifier_lower($string)
{
- return strtolower($string);
+ return strtolower($string);
}
?>
Index: smarty/libs/plugins/modifier.nl2br.php
diff -u smarty/libs/plugins/modifier.nl2br.php:1.2 smarty/libs/plugins/modifier.nl2br.php:1.3
--- smarty/libs/plugins/modifier.nl2br.php:1.2 Sun Apr 20 17:12:08 2003
+++ smarty/libs/plugins/modifier.nl2br.php Fri Dec 19 12:18:56 2003
@@ -21,7 +21,7 @@
* @link http://smarty.php.net/manual/en/language.modifier.nl2br.php
* nl2br (Smarty online manual)
* @version 1.0
- * @author Monte Ohrt <[email protected]>
+ * @author Monte Ohrt <[email protected]>
* @param string
* @return string
*/
Index: smarty/libs/plugins/modifier.strip.php
diff -u smarty/libs/plugins/modifier.strip.php:1.2 smarty/libs/plugins/modifier.strip.php:1.3
--- smarty/libs/plugins/modifier.strip.php:1.2 Sun Apr 20 17:12:11 2003
+++ smarty/libs/plugins/modifier.strip.php Fri Dec 19 12:18:56 2003
@@ -25,7 +25,7 @@
*/
function smarty_modifier_strip($text, $replace = ' ')
{
- return preg_replace('!\s+!', $replace, $text);
+ return preg_replace('!\s+!', $replace, $text);
}
/* vim: set expandtab: */
Index: smarty/libs/plugins/modifier.upper.php
diff -u smarty/libs/plugins/modifier.upper.php:1.2 smarty/libs/plugins/modifier.upper.php:1.3
--- smarty/libs/plugins/modifier.upper.php:1.2 Sun Apr 20 17:12:12 2003
+++ smarty/libs/plugins/modifier.upper.php Fri Dec 19 12:18:56 2003
@@ -19,7 +19,7 @@
*/
function smarty_modifier_upper($string)
{
- return strtoupper($string);
+ return strtoupper($string);
}
?>
Index: smarty/libs/plugins/modifier.wordwrap.php
diff -u smarty/libs/plugins/modifier.wordwrap.php:1.2 smarty/libs/plugins/modifier.wordwrap.php:1.3
--- smarty/libs/plugins/modifier.wordwrap.php:1.2 Sun Apr 20 17:12:12 2003
+++ smarty/libs/plugins/modifier.wordwrap.php Fri Dec 19 12:18:56 2003
@@ -22,7 +22,7 @@
*/
function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false)
{
- return wordwrap($string,$length,$break,$cut);
+ return wordwrap($string,$length,$break,$cut);
}
?>
Index: smarty/libs/plugins/outputfilter.trimwhitespace.php
diff -u smarty/libs/plugins/outputfilter.trimwhitespace.php:1.6 smarty/libs/plugins/outputfilter.trimwhitespace.php:1.7
--- smarty/libs/plugins/outputfilter.trimwhitespace.php:1.6 Sun Apr 20 17:12:12 2003
+++ smarty/libs/plugins/outputfilter.trimwhitespace.php Fri Dec 19 12:18:56 2003
@@ -16,7 +16,7 @@
* template source after it gets interpreted, cleaning
* up code and saving bandwidth. Does not affect
* <<PRE>></PRE> and <SCRIPT></SCRIPT> blocks.<br>
- * Install: Drop into the plugin directory, call
+ * Install: Drop into the plugin directory, call
* <code>$smarty->load_filter('output','trimwhitespace');</code>
* from application.
* @author Monte Ohrt <[email protected]>
@@ -25,51 +25,51 @@
* @param string
* @param Smarty
*/
- function smarty_outputfilter_trimwhitespace($source, &$smarty)
- {
+function smarty_outputfilter_trimwhitespace($source, &$smarty)
+{
// Pull out the script blocks
preg_match_all("!<script[^>]+>.*?</script>!is", $source, $match);
$_script_blocks = $match[0];
$source = preg_replace("!<script[^>]+>.*?</script>!is",
- '@@@SMARTY:TRIM:SCRIPT@@@', $source);
+ '@@@SMARTY:TRIM:SCRIPT@@@', $source);
// Pull out the pre blocks
preg_match_all("!<pre>.*?</pre>!is", $source, $match);
$_pre_blocks = $match[0];
$source = preg_replace("!<pre>.*?</pre>!is",
- '@@@SMARTY:TRIM:PRE@@@', $source);
+ '@@@SMARTY:TRIM:PRE@@@', $source);
// Pull out the textarea blocks
preg_match_all("!<textarea[^>]+>.*?</textarea>!is", $source, $match);
$_textarea_blocks = $match[0];
$source = preg_replace("!<textarea[^>]+>.*?</textarea>!is",
- '@@@SMARTY:TRIM:TEXTAREA@@@', $source);
+ '@@@SMARTY:TRIM:TEXTAREA@@@', $source);
- // remove all leading spaces, tabs and carriage returns NOT
- // preceeded by a php close tag.
- $source = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source));
+ // remove all leading spaces, tabs and carriage returns NOT
+ // preceeded by a php close tag.
+ $source = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source));
- // replace script blocks
- smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source);
+ // replace script blocks
+ smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source);
- // replace pre blocks
- smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:PRE@@@",$_pre_blocks, $source);
+ // replace pre blocks
+ smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:PRE@@@",$_pre_blocks, $source);
// replace textarea blocks
- smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source);
+ smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source);
- return $source;
- }
+ return $source;
+}
function smarty_outputfilter_trimwhitespace_replace($search_str, $replace, &$subject) {
- $_len = strlen($search_str);
- $_pos = 0;
- for ($_i=0, $_count=count($replace); $_i<$_count; $_i++)
- if (($_pos=strpos($subject, $search_str, $_pos))!==false)
- $subject = substr_replace($subject, $replace[$_i], $_pos, $_len);
- else
- break;
-
+ $_len = strlen($search_str);
+ $_pos = 0;
+ for ($_i=0, $_count=count($replace); $_i<$_count; $_i++)
+ if (($_pos=strpos($subject, $search_str, $_pos))!==false)
+ $subject = substr_replace($subject, $replace[$_i], $_pos, $_len);
+ else
+ break;
+
}
?>
Index: smarty/libs/plugins/shared.escape_special_chars.php
diff -u smarty/libs/plugins/shared.escape_special_chars.php:1.3 smarty/libs/plugins/shared.escape_special_chars.php:1.4
--- smarty/libs/plugins/shared.escape_special_chars.php:1.3 Sun Apr 20 17:12:12 2003
+++ smarty/libs/plugins/shared.escape_special_chars.php Fri Dec 19 12:18:56 2003
@@ -17,12 +17,12 @@
*/
function smarty_function_escape_special_chars($string)
{
- if(!is_array($string)) {
- $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
- $string = htmlspecialchars($string);
- $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string);
- }
- return $string;
+ if(!is_array($string)) {
+ $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
+ $string = htmlspecialchars($string);
+ $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string);
+ }
+ return $string;
}
/* vim: set expandtab: */