From 98dbe6f0d2edfff3a1f5785504504b4a6e5dd4eb Mon Sep 17 00:00:00 2001
From: "ctrlaltca@gmail.com" <>
Date: Sat, 19 Nov 2011 11:33:31 +0000
Subject: updating phpDocumentor, part 2: add new version
---
.../libs/plugins/outputfilter.trimwhitespace.php | 75 ++++++++++++++++++++++
1 file changed, 75 insertions(+)
create mode 100644 buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/outputfilter.trimwhitespace.php
(limited to 'buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/outputfilter.trimwhitespace.php')
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/outputfilter.trimwhitespace.php b/buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/outputfilter.trimwhitespace.php
new file mode 100644
index 00000000..e82acc1c
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/outputfilter.trimwhitespace.php
@@ -0,0 +1,75 @@
+
+ * Type: outputfilter
+ * Name: trimwhitespace
+ * Date: Jan 25, 2003
+ * Purpose: trim leading white space and blank lines from
+ * template source after it gets interpreted, cleaning
+ * up code and saving bandwidth. Does not affect
+ * <
>and blocks.
$smarty->load_filter('output','trimwhitespace');
+ * from application.
+ * @author Monte Ohrt .*?!is", $source, $match); + $_pre_blocks = $match[0]; + $source = preg_replace("!
.*?!is", + '@@@SMARTY:TRIM:PRE@@@', $source); + + // Pull out the textarea blocks + preg_match_all("!!is", $source, $match); + $_textarea_blocks = $match[0]; + $source = preg_replace("!!is", + '@@@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)); + + // 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 textarea blocks + smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $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; + +} + +?> -- cgit v1.2.3