+ // stolen from Indentation.class.php
+ private static function lines($lines) {
+ if(is_string($lines)) $lines = explode("\n",str_replace("\r\n","\n",$lines));
+ return $lines;
+ }
+
+ // stolen from Indentation.class.php
+ private static function unindent($lines) {
+ $lines = self::lines($lines);
+ if(!$lines) return '';
+
+ $first = array_shift($lines);
+ $min = PHP_INT_MAX;
+
+ foreach($lines as $l) { # find smallest indentation
+ $ind = strlen($l) - strlen(ltrim($l));
+ if($ind < $min)$min = $ind;
+ }
+ foreach($lines as $idx=>$l) $lines[$idx] = substr($l,$min);
+ return trim($first."\n".implode("\n",$lines));
+ }
+