[lilina-svn] [lilina] r470 committed - Strip tags even if the string is already short enough.

codesite-noreply at google.com codesite-noreply at google.com
Fri Sep 25 15:01:14 EST 2009


Revision: 470
Author: ryan at getlilina.org
Date: Thu Sep 24 22:00:50 2009
Log: Strip tags even if the string is already short enough.
http://code.google.com/p/lilina/source/detail?r=470

Modified:
  /trunk/lilina/inc/core/misc-functions.php

=======================================
--- /trunk/lilina/inc/core/misc-functions.php	Fri Apr 17 03:14:32 2009
+++ /trunk/lilina/inc/core/misc-functions.php	Thu Sep 24 22:00:50 2009
@@ -304,7 +304,7 @@
  			die('GLOBALS overwrite attempt detected');

  		// Variables that shouldn't be unset
-		$keep =  
array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
+		$keep =  
array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES');

  		$input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES,  
isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
  		foreach ( $input as $k => $v ) {
@@ -332,6 +332,8 @@
   * @return string Shortened string
   */
  function shorten($string, $length) {
+	$string = strip_tags($string);
+
  	/** Short-circuit if no shortening is needed */
  	if(!isset($string[$length + 1])) return $string;

@@ -340,7 +342,7 @@

  	// Convert 'smart' punctuation to 'dumb' punctuation, strip the HTML tags,
  	// and convert all tabs and line-break characters to single spaces.
-	$short_desc = trim(str_replace(array("\r","\n", "\t"), ' ',  
strip_tags($string)));
+	$short_desc = trim(str_replace(array("\r","\n", "\t"), ' ', $string));

  	// Cut the string to the requested length, and strip any extraneous spaces
  	// from the beginning and end.



More information about the lilina-svn mailing list