Index: formatting.php
===================================================================
--- formatting.php	(revision 11179)
+++ formatting.php	(working copy)
@@ -26,7 +26,7 @@
  * @param string $text The text to be formatted
  * @return string The string replaced with html entities
  */
-function wptexturize($text) {
+function wptexturize( $text ) {
 	global $wp_cockneyreplace;
 	$next = true;
 	$has_pre_parent = false;
@@ -58,11 +58,11 @@
 			$curl = str_replace($static_characters, $static_replacements, $curl);
 			// regular expressions
 			$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
-		} elseif (strpos($curl, '<code') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) {
+		} elseif ( strpos($curl, '<code') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false ) {
 			$next = false;
-		} elseif (strpos($curl, '<pre') !== false) {
+		} elseif ( strpos($curl, '<pre') !== false ) {
 			$has_pre_parent = true;
-		} elseif (strpos($curl, '</pre>') !== false) {
+		} elseif ( strpos($curl, '</pre>') !== false ) {
 			$has_pre_parent = false;
 		} else {
 			$next = true;
@@ -86,7 +86,7 @@
  * @param array|string $matches The array or string
  * @return string The pre block without paragraph/line-break conversion.
  */
-function clean_pre($matches) {
+function clean_pre( $matches ) {
 	if ( is_array($matches) )
 		$text = $matches[1] . $matches[2] . "</pre>";
 	else
@@ -113,11 +113,13 @@
  * @param int|bool $br Optional. If set, this will convert all remaining line-breaks after paragraphing. Default true.
  * @return string Text which has been converted into correct paragraph tags.
  */
-function wpautop($pee, $br = 1) {
+function wpautop( $pee, $br = 1 ) {
 	if ( trim($pee) === '' )
 		return '';
+
 	$pee = $pee . "\n"; // just to make things a little easier, pad the end
 	$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
+
 	// Space things out a little
 	$allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)';
 	$pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
@@ -141,14 +143,14 @@
 	$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
 	$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
 	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
-	if ($br) {
+	if ( $br ) {
 		$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "<WPPreserveNewline />", $matches[0]);'), $pee);
 		$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
 		$pee = str_replace('<WPPreserveNewline />', "\n", $pee);
 	}
 	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
 	$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
-	if (strpos($pee, '<pre') !== false)
+	if ( strpos($pee, '<pre') !== false )
 		$pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
 	$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
 	$pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s', '$1', $pee); // don't auto-p wrap shortcodes that stand alone
@@ -166,18 +168,18 @@
  * @param string $Str The string to be checked
  * @return bool True if $Str fits a UTF-8 model, false otherwise.
  */
-function seems_utf8($Str) { # by bmorel at ssi dot fr
+function seems_utf8( $Str ) {
 	$length = strlen($Str);
-	for ($i=0; $i < $length; $i++) {
-		if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb
-		elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n=1; # 110bbbbb
-		elseif ((ord($Str[$i]) & 0xF0) == 0xE0) $n=2; # 1110bbbb
-		elseif ((ord($Str[$i]) & 0xF8) == 0xF0) $n=3; # 11110bbb
-		elseif ((ord($Str[$i]) & 0xFC) == 0xF8) $n=4; # 111110bb
-		elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n=5; # 1111110b
-		else return false; # Does not match any model
-		for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?
-			if ((++$i == $length) || ((ord($Str[$i]) & 0xC0) != 0x80))
+	for ( $i = 0; $i < $length; $i++ ) {
+		if ( ord($Str[$i] ) < 0x80) continue; // 0bbbbbbb
+		elseif ( (ord($Str[$i]) & 0xE0) == 0xC0 ) $n = 1; // 110bbbbb
+		elseif ( (ord($Str[$i]) & 0xF0) == 0xE0 ) $n = 2; // 1110bbbb
+		elseif ( (ord($Str[$i]) & 0xF8) == 0xF0 ) $n = 3; // 11110bbb
+		elseif ( (ord($Str[$i]) & 0xFC) == 0xF8 ) $n = 4; // 111110bb
+		elseif ( (ord($Str[$i]) & 0xFE) == 0xFC ) $n = 5; // 1111110b
+		else return false; // Does not match any model
+		for ( $j = 0; $j < $n; $j++ ) { // n bytes matching 10bbbbbb follow ?
+			if ( (++$i == $length) || ((ord($Str[$i]) & 0xC0) != 0x80) )
 			return false;
 		}
 	}
@@ -200,25 +202,21 @@
  * @param boolean $double_encode Optional. Whether or not to encode existing html entities. Default is false.
  * @return string The encoded text with HTML entities.
  */
-function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false )
-{
+function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
 	$string = (string) $string;
 
-	if ( 0 === strlen( $string ) ) {
+	if ( 0 === strlen( $string ) )
 		return '';
-	}
 
 	// Don't bother if there are no specialchars - saves some processing
-	if ( !preg_match( '/[&<>"\']/', $string ) ) {
+	if ( !preg_match( '/[&<>"\']/', $string ) )
 		return $string;
-	}
 
 	// Account for the previous behaviour of the function when the $quote_style is not an accepted value
-	if ( empty( $quote_style ) ) {
+	if ( empty( $quote_style ) )
 		$quote_style = ENT_NOQUOTES;
-	} elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
+	elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) )
 		$quote_style = ENT_QUOTES;
-	}
 
 	// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
 	if ( !$charset ) {
@@ -229,9 +227,8 @@
 		}
 		$charset = $_charset;
 	}
-	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
+	if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) )
 		$charset = 'UTF-8';
-	}
 
 	$_quote_style = $quote_style;
 
@@ -251,14 +248,12 @@
 	$string = @htmlspecialchars( $string, $quote_style, $charset );
 
 	// Handle double encoding ourselves
-	if ( !$double_encode ) {
+	if ( !$double_encode )
 		$string = str_replace( array( '|wp_entity|', '|/wp_entity|' ), array( '&', ';' ), $string );
-	}
 
 	// Backwards compatibility
-	if ( 'single' === $_quote_style ) {
+	if ( 'single' === $_quote_style )
 		$string = str_replace( "'", '&#039;', $string );
-	}
 
 	return $string;
 }
@@ -277,25 +272,21 @@
  * @param mixed $quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old wp_specialchars() values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
  * @return string The decoded text without HTML entities.
  */
-function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES )
-{
+function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
 	$string = (string) $string;
 
-	if ( 0 === strlen( $string ) ) {
+	if ( 0 === strlen( $string ) )
 		return '';
-	}
 
 	// Don't bother if there are no entities - saves a lot of processing
-	if ( strpos( $string, '&' ) === false ) {
+	if ( strpos( $string, '&' ) === false )
 		return $string;
-	}
 
 	// Match the previous behaviour of wp_specialchars() when the $quote_style is not an accepted value
-	if ( empty( $quote_style ) ) {
+	if ( empty( $quote_style ) )
 		$quote_style = ENT_NOQUOTES;
-	} elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
+	elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) )
 		$quote_style = ENT_QUOTES;
-	}
 
 	// More complete than get_html_translation_table( HTML_SPECIALCHARS )
 	$single = array( '&#039;'  => '\'', '&#x27;' => '\'' );
@@ -339,38 +330,32 @@
 {
 	$string = (string) $string;
 
-	if ( 0 === strlen( $string ) ) {
+	if ( 0 === strlen( $string ) )
 		return '';
-	}
 
 	// Store the site charset as a static to avoid multiple calls to get_option()
 	static $is_utf8;
-	if ( !isset( $is_utf8 ) ) {
+	if ( !isset( $is_utf8 ) )
 		$is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
-	}
-	if ( !$is_utf8 ) {
+	if ( !$is_utf8 )
 		return $string;
-	}
 
 	// Check for support for utf8 in the installed PCRE library once and store the result in a static
 	static $utf8_pcre;
-	if ( !isset( $utf8_pcre ) ) {
+	if ( !isset( $utf8_pcre ) )
 		$utf8_pcre = @preg_match( '/^./u', 'a' );
-	}
+
 	// We can't demand utf8 in the PCRE installation, so just return the string in those cases
-	if ( !$utf8_pcre ) {
+	if ( !$utf8_pcre )
 		return $string;
-	}
 
 	// preg_match fails when it encounters invalid UTF8 in $string
-	if ( 1 === @preg_match( '/^./us', $string ) ) {
+	if ( 1 === @preg_match( '/^./us', $string ) )
 		return $string;
-	}
 
 	// Attempt to strip the bad chars if requested (not recommended)
-	if ( $strip && function_exists( 'iconv' ) ) {
+	if ( $strip && function_exists( 'iconv' ) )
 		return iconv( 'utf-8', 'utf-8', $string );
-	}
 
 	return '';
 }
@@ -401,14 +386,15 @@
 			$unicode .= chr($value);
 			$unicode_length++;
 		} else {
-			if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
+			if ( count( $values ) == 0 )
+				$num_octets = ( $value < 224 ) ? 2 : 3;
 
 			$values[] = $value;
 
 			if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length )
 				break;
 			if ( count( $values ) == $num_octets ) {
-				if ($num_octets == 3) {
+				if ( $num_octets == 3 ) {
 					$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
 					$unicode_length += 9;
 				} else {
@@ -439,7 +425,7 @@
 	if ( !preg_match('/[\x80-\xff]/', $string) )
 		return $string;
 
-	if (seems_utf8($string)) {
+	if ( seems_utf8($string) ) {
 		$chars = array(
 		// Decompositions for Latin-1 Supplement
 		chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -637,7 +623,7 @@
  * @param string $fallback_title Optional. A title to use if $title is empty.
  * @return string The sanitized string.
  */
-function sanitize_title($title, $fallback_title = '') {
+function sanitize_title( $title, $fallback_title = '' ) {
 	$raw_title = $title;
 	$title = strip_tags($title);
 	$title = apply_filters('sanitize_title', $title, $raw_title);
@@ -659,7 +645,7 @@
  * @param string $title The title to be sanitized.
  * @return string The sanitized title.
  */
-function sanitize_title_with_dashes($title) {
+function sanitize_title_with_dashes( $title ) {
 	$title = strip_tags($title);
 	// Preserve escaped octets.
 	$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
@@ -669,10 +655,9 @@
 	$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
 
 	$title = remove_accents($title);
-	if (seems_utf8($title)) {
-		if (function_exists('mb_strtolower')) {
+	if ( seems_utf8($title) ) {
+		if ( function_exists('mb_strtolower') )
 			$title = mb_strtolower($title, 'UTF-8');
-		}
 		$title = utf8_uri_encode($title, 200);
 	}
 
@@ -718,7 +703,7 @@
  * @param string $deprecated Not used.
  * @return string Converted string.
  */
-function convert_chars($content, $deprecated = '') {
+function convert_chars( $content, $deprecated = '' ) {
 	// Translation of invalid Unicode references range to valid range
 	$wp_htmltranswinuni = array(
 	'&#128;' => '&#8364;', // the Euro sign
@@ -780,7 +765,7 @@
  * @param array $matches Single Match
  * @return string An HTML entity
  */
-function funky_javascript_callback($matches) {
+function funky_javascript_callback( $matches ) {
 	return "&#".base_convert($matches[1],16,10).";";
 }
 
@@ -796,14 +781,12 @@
  * @param string $text Text to be made safe.
  * @return string Fixed text.
  */
-function funky_javascript_fix($text) {
+function funky_javascript_fix( $text ) {
 	// Fixes for browsers' javascript bugs
 	global $is_macIE, $is_winIE;
 
 	if ( $is_winIE || $is_macIE )
-		$text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/",
-					       "funky_javascript_callback",
-					       $text);
+		$text =  preg_replace_callback("/\%u([0-9A-F]{4,4})/", "funky_javascript_callback", $text);
 
 	return $text;
 }
@@ -847,15 +830,15 @@
  */
 function force_balance_tags( $text ) {
 	$tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = '';
-	$single_tags = array('br', 'hr', 'img', 'input'); //Known single-entity/self-closing tags
-	$nestable_tags = array('blockquote', 'div', 'span'); //Tags that can be immediately nested within themselves
+	$single_tags = array('br', 'hr', 'img', 'input'); // Known single-entity/self-closing tags
+	$nestable_tags = array('blockquote', 'div', 'span'); // Tags that can be immediately nested within themselves
 
-	# WP bug fix for comments - in case you REALLY meant to type '< !--'
+	// WP bug fix for comments - in case you REALLY meant to type '< !--'
 	$text = str_replace('< !--', '<    !--', $text);
-	# WP bug fix for LOVE <3 (and other situations with '<' before a number)
+	// WP bug fix for LOVE <3 (and other situations with '<' before a number)
 	$text = preg_replace('#<([0-9]{1})#', '&lt;$1', $text);
 
-	while (preg_match("/<(\/?\w*)\s*([^>]*)>/",$text,$regex)) {
+	while ( preg_match("/<(\/?\w*)\s*([^>]*)>/",$text,$regex) ) {
 		$newtext .= $tagqueue;
 
 		$i = strpos($text,$regex[0]);
@@ -867,21 +850,21 @@
 		if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag
 			$tag = strtolower(substr($regex[1],1));
 			// if too many closing tags
-			if($stacksize <= 0) {
+			if( $stacksize <= 0 ) {
 				$tag = '';
 				//or close to be safe $tag = '/' . $tag;
 			}
 			// if stacktop value = tag close value then pop
-			else if ($tagstack[$stacksize - 1] == $tag) { // found closing tag
+			else if ( $tagstack[$stacksize - 1] == $tag ) { // found closing tag
 				$tag = '</' . $tag . '>'; // Close Tag
 				// Pop
 				array_pop ($tagstack);
 				$stacksize--;
 			} else { // closing tag not at top, search for it
-				for ($j=$stacksize-1;$j>=0;$j--) {
+				for ( $j = $stacksize-1; $j >= 0; $j-- ) {
 					if ($tagstack[$j] == $tag) {
 					// add tag to tagqueue
-						for ($k=$stacksize-1;$k>=$j;$k--){
+						for ( $k = $stacksize-1; $k >= $j; $k-- ){
 							$tagqueue .= '</' . array_pop ($tagstack) . '>';
 							$stacksize--;
 						}
@@ -896,14 +879,14 @@
 			// Tag Cleaning
 
 			// If self-closing or '', don't do anything.
-			if((substr($regex[2],-1) == '/') || ($tag == '')) {
+			if( (substr($regex[2],-1) == '/') || ($tag == '') ) {
 			}
 			// ElseIf it's a known single-entity tag but it doesn't close itself, do so
 			elseif ( in_array($tag, $single_tags) ) {
 				$regex[2] .= '/';
 			} else {	// Push the tag onto the stack
 				// If the top of the stack is the same as the tag we want to push, close previous tag
-				if (($stacksize > 0) && !in_array($tag, $nestable_tags) && ($tagstack[$stacksize - 1] == $tag)) {
+				if ( ($stacksize > 0) && !in_array($tag, $nestable_tags) && ($tagstack[$stacksize - 1] == $tag) ) {
 					$tagqueue = '</' . array_pop ($tagstack) . '>';
 					$stacksize--;
 				}
@@ -912,12 +895,12 @@
 
 			// Attributes
 			$attributes = $regex[2];
-			if($attributes) {
+			if( $attributes )
 				$attributes = ' '.$attributes;
-			}
+
 			$tag = '<'.$tag.$attributes.'>';
 			//If already queuing a close tag, then put this tag on, too
-			if ($tagqueue) {
+			if ( $tagqueue ) {
 				$tagqueue .= $tag;
 				$tag = '';
 			}
@@ -933,9 +916,8 @@
 	$newtext .= $text;
 
 	// Empty Stack
-	while($x = array_pop($tagstack)) {
+	while( $x = array_pop($tagstack) )
 		$newtext .= '</' . $x . '>'; // Add remaining tags to close
-	}
 
 	// WP fix for the bug with HTML comments
 	$newtext = str_replace("< !--","<!--",$newtext);
@@ -957,7 +939,7 @@
  * @param bool $richedit Whether or not the $content should pass through htmlspecialchars(). Default false.
  * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
  */
-function format_to_edit($content, $richedit = false) {
+function format_to_edit( $content, $richedit = false ) {
 	$content = apply_filters('format_to_edit', $content);
 	if (! $richedit )
 		$content = htmlspecialchars($content);
@@ -972,7 +954,7 @@
  * @param string $content The text to pass through the filter.
  * @return string Text returned from the 'format_to_post' filter.
  */
-function format_to_post($content) {
+function format_to_post( $content ) {
 	$content = apply_filters('format_to_post', $content);
 	return $content;
 }
@@ -994,8 +976,8 @@
  * @param int $threshold Digit places number needs to be to not have zeros added.
  * @return string Adds leading zeros to number if needed.
  */
-function zeroise($number, $threshold) {
-	return sprintf('%0'.$threshold.'s', $number);
+function zeroise( $number, $threshold ) {
+	return sprintf( '%0'.$threshold.'s', $number );
 }
 
 /**
@@ -1006,7 +988,7 @@
  * @param string $string Value to which backslashes will be added.
  * @return string String with backslashes inserted.
  */
-function backslashit($string) {
+function backslashit( $string ) {
 	$string = preg_replace('/^([0-9])/', '\\\\\\\\\1', $string);
 	$string = preg_replace('/([a-z])/i', '\\\\\1', $string);
 	return $string;
@@ -1027,8 +1009,8 @@
  * @param string $string What to add the trailing slash to.
  * @return string String with trailing slash added.
  */
-function trailingslashit($string) {
-	return untrailingslashit($string) . '/';
+function trailingslashit( $string ) {
+	return untrailingslashit( $string ) . '/';
 }
 
 /**
@@ -1042,8 +1024,8 @@
  * @param string $string What to remove the trailing slash from.
  * @return string String without the trailing slash.
  */
-function untrailingslashit($string) {
-	return rtrim($string, '/');
+function untrailingslashit( $string ) {
+	return rtrim( $string, '/' );
 }
 
 /**
@@ -1057,12 +1039,11 @@
  * @param string $gpc The string returned from HTTP request data.
  * @return string Returns a string escaped with slashes.
  */
-function addslashes_gpc($gpc) {
+function addslashes_gpc( $gpc ) {
 	global $wpdb;
 
-	if (get_magic_quotes_gpc()) {
+	if (get_magic_quotes_gpc())
 		$gpc = stripslashes($gpc);
-	}
 
 	return $wpdb->escape($gpc);
 }
@@ -1078,7 +1059,7 @@
  * @param array|string $value The array or string to be striped.
  * @return array|string Stripped array (or string in the callback).
  */
-function stripslashes_deep($value) {
+function stripslashes_deep( $value ) {
 	$value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
 	return $value;
 }
@@ -1094,7 +1075,7 @@
  * @param array|string $value The array or string to be encoded.
  * @return array|string $value The encoded array (or string from the callback).
  */
-function urlencode_deep($value) {
+function urlencode_deep( $value ) {
 	$value = is_array($value) ? array_map('urlencode_deep', $value) : urlencode($value);
 	return $value;
 }
@@ -1108,18 +1089,17 @@
  * @param int $mailto Optional. Range from 0 to 1. Used for encoding.
  * @return string Converted email address.
  */
-function antispambot($emailaddy, $mailto=0) {
+function antispambot( $emailaddy, $mailto = 0 ) {
 	$emailNOSPAMaddy = '';
-	srand ((float) microtime() * 1000000);
-	for ($i = 0; $i < strlen($emailaddy); $i = $i + 1) {
+	srand((float) microtime() * 1000000);
+	for ( $i = 0; $i < strlen($emailaddy); $i++ ) {
 		$j = floor(rand(0, 1+$mailto));
-		if ($j==0) {
+		if ( $j == 0 )
 			$emailNOSPAMaddy .= '&#'.ord(substr($emailaddy,$i,1)).';';
-		} elseif ($j==1) {
+		elseif ( $j == 1 )
 			$emailNOSPAMaddy .= substr($emailaddy,$i,1);
-		} elseif ($j==2) {
+		elseif ( $j == 2 )
 			$emailNOSPAMaddy .= '%'.zeroise(dechex(ord(substr($emailaddy, $i, 1))), 2);
-		}
 	}
 	$emailNOSPAMaddy = str_replace('@','&#64;',$emailNOSPAMaddy);
 	return $emailNOSPAMaddy;
@@ -1137,12 +1117,12 @@
  * @param array $matches Single Regex Match.
  * @return string HTML A element with URI address.
  */
-function _make_url_clickable_cb($matches) {
+function _make_url_clickable_cb( $matches ) {
 	$url = $matches[2];
 	$url = clean_url($url);
 	if ( empty($url) )
 		return $matches[0];
-	return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>";
+	return $matches[1] . '<a href="$url" rel="nofollow">$url</a>';
 }
 
 /**
@@ -1157,7 +1137,7 @@
  * @param array $matches Single Regex Match.
  * @return string HTML A element with URL address.
  */
-function _make_web_ftp_clickable_cb($matches) {
+function _make_web_ftp_clickable_cb( $matches ) {
 	$ret = '';
 	$dest = $matches[2];
 	$dest = 'http://' . $dest;
@@ -1169,7 +1149,7 @@
 		$ret = substr($dest, -1);
 		$dest = substr($dest, 0, strlen($dest)-1);
 	}
-	return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>" . $ret;
+	return $matches[1] . '<a href="$dest" rel="nofollow">$dest</a>' . $ret;
 }
 
 /**
@@ -1184,9 +1164,9 @@
  * @param array $matches Single Regex Match.
  * @return string HTML A element with email address.
  */
-function _make_email_clickable_cb($matches) {
+function _make_email_clickable_cb( $matches ) {
 	$email = $matches[2] . '@' . $matches[3];
-	return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
+	return $matches[1] . '<a href="mailto:$email">$email</a>';
 }
 
 /**
@@ -1200,7 +1180,7 @@
  * @param string $ret Content to convert URIs.
  * @return string Content with converted URIs.
  */
-function make_clickable($ret) {
+function make_clickable( $ret ) {
 	$ret = ' ' . $ret;
 	// in testing, using arrays here was found to be faster
 	$ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/\-=?@\[\](+]|[.,;:](?![\s<])|(?(1)\)(?![\s<])|\)))+)#is', '_make_url_clickable_cb', $ret);
@@ -1243,7 +1223,7 @@
 function wp_rel_nofollow_callback( $matches ) {
 	$text = $matches[1];
 	$text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text);
-	return "<a $text rel=\"nofollow\">";
+	return '<a $text rel="nofollow">';
 }
 
 
@@ -1259,12 +1239,11 @@
  * @param string $smiley Smiley code to convert to image.
  * @return string Image string for smiley.
  */
-function translate_smiley($smiley) {
+function translate_smiley( $smiley ) {
 	global $wpsmiliestrans;
 
-	if (count($smiley) == 0) {
+	if ( count($smiley) == 0 )
 		return '';
-	}
 
 	$siteurl = get_option( 'siteurl' );
 
@@ -1272,7 +1251,7 @@
 	$img = $wpsmiliestrans[$smiley];
 	$smiley_masked = attr($smiley);
 
-	return " <img src='$siteurl/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
+	return '<img src="$siteurl/wp-includes/images/smilies/$img" alt="$smiley_masked" class="wp-smiley" /> ';
 }
 
 
@@ -1288,18 +1267,17 @@
  * @param string $text Content to convert smilies from text.
  * @return string Converted content with text smilies replaced with images.
  */
-function convert_smilies($text) {
+function convert_smilies( $text ) {
 	global $wp_smiliessearch;
 	$output = '';
 	if ( get_option('use_smilies') && !empty($wp_smiliessearch) ) {
 		// HTML loop taken from texturize function, could possible be consolidated
 		$textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
 		$stop = count($textarr);// loop stuff
-		for ($i = 0; $i < $stop; $i++) {
+		for ( $i = 0; $i < $stop; $i++ ) {
 			$content = $textarr[$i];
-			if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
+			if ( (strlen($content) > 0) && ('<' != $content{0}) ) // If it's not a tag
 				$content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content);
-			}
 			$output .= $content;
 		}
 	} else {
@@ -1322,61 +1300,52 @@
  */
 function is_email( $email, $check_dns = false ) {
 	// Test for the minimum length the email can be
-	if ( strlen( $email ) < 3 ) {
+	if ( strlen( $email ) < 3 )
 		return apply_filters( 'is_email', false, $email, 'email_too_short' );
-	}
 
 	// Test for an @ character after the first position
-	if ( strpos( $email, '@', 1 ) === false ) {
+	if ( strpos( $email, '@', 1 ) === false )
 		return apply_filters( 'is_email', false, $email, 'email_no_at' );
-	}
 
 	// Split out the local and domain parts
 	list( $local, $domain ) = explode( '@', $email, 2 );
 
 	// LOCAL PART
 	// Test for invalid characters
-	if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) {
+	if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) )
 		return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
-	}
 
 	// DOMAIN PART
 	// Test for sequences of periods
-	if ( preg_match( '/\.{2,}/', $domain ) ) {
+	if ( preg_match( '/\.{2,}/', $domain ) )
 		return apply_filters( 'is_email', false, $email, 'domain_period_sequence' );
-	}
 
 	// Test for leading and trailing periods and whitespace
-	if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) {
+	if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain )
 		return apply_filters( 'is_email', false, $email, 'domain_period_limits' );
-	}
 
 	// Split the domain into subs
 	$subs = explode( '.', $domain );
 
 	// Assume the domain will have at least two subs
-	if ( 2 > count( $subs ) ) {
+	if ( 2 > count( $subs ) )
 		return apply_filters( 'is_email', false, $email, 'domain_no_periods' );
-	}
 
 	// Loop through each sub
 	foreach ( $subs as $sub ) {
 		// Test for leading and trailing hyphens and whitespace
-		if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) {
+		if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub )
 			return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' );
-		}
 
 		// Test for invalid characters
-		if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) {
+		if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) )
 			return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
-		}
 	}
 
 	// DNS
 	// Check the domain has a valid MX and A resource record
-	if ( $check_dns && function_exists( 'checkdnsrr' ) && !( checkdnsrr( $domain . '.', 'MX' ) || checkdnsrr( $domain . '.', 'A' ) ) ) {
+	if ( $check_dns && function_exists( 'checkdnsrr' ) && !( checkdnsrr( $domain . '.', 'MX' ) || checkdnsrr( $domain . '.', 'A' ) ) )
 		return apply_filters( 'is_email', false, $email, 'dns_no_rr' );
-	}
 
 	// Congratulations your email made it!
 	return apply_filters( 'is_email', $email, $email, null );
@@ -1391,9 +1360,9 @@
  * @param string $string Subject line
  * @return string Converted string to ASCII
  */
-function wp_iso_descrambler($string) {
+function wp_iso_descrambler( $string ) {
 	/* this may only work with iso-8859-1, I'm afraid */
-	if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
+	if ( !preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches) ) {
 		return $string;
 	} else {
 		$subject = str_replace('_', ' ', $matches[2]);
@@ -1414,7 +1383,7 @@
  * @param string $string The date to be converted.
  * @return string GMT version of the date provided.
  */
-function get_gmt_from_date($string) {
+function get_gmt_from_date( $string ) {
 	preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
 	$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 	$string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_option('gmt_offset') * 3600);
@@ -1432,7 +1401,7 @@
  * @param string $string The date to be converted.
  * @return string Formatted date relative to the GMT offset.
  */
-function get_date_from_gmt($string) {
+function get_date_from_gmt( $string ) {
 	preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
 	$string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 	$string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_option('gmt_offset')*3600);
@@ -1447,9 +1416,9 @@
  * @param string $timezone Either 'Z' for 0 offset or '±hhmm'.
  * @return int|float The offset in seconds.
  */
-function iso8601_timezone_to_offset($timezone) {
+function iso8601_timezone_to_offset( $timezone ) {
 	// $timezone is either 'Z' or '[+|-]hhmm'
-	if ($timezone == 'Z') {
+	if ( $timezone == 'Z' ) {
 		$offset = 0;
 	} else {
 		$sign    = (substr($timezone, 0, 1) == '+') ? 1 : -1;
@@ -1469,25 +1438,24 @@
  * @param string $timezone Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'.
  * @return string The date and time in MySQL DateTime format - Y-m-d H:i:s.
  */
-function iso8601_to_datetime($date_string, $timezone = 'user') {
+function iso8601_to_datetime( $date_string, $timezone = 'user' ) {
 	$timezone = strtolower($timezone);
 
-	if ($timezone == 'gmt') {
+	if ( $timezone == 'gmt' ) {
 
 		preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits);
 
-		if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset
+		if ( !empty($date_bits[7]) ) // we have a timezone, so let's compute an offset
 			$offset = iso8601_timezone_to_offset($date_bits[7]);
-		} else { // we don't have a timezone, so we assume user local timezone (not server's!)
+		else // we don't have a timezone, so we assume user local timezone (not server's!)
 			$offset = 3600 * get_option('gmt_offset');
-		}
 
 		$timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]);
 		$timestamp -= $offset;
 
 		return gmdate('Y-m-d H:i:s', $timestamp);
 
-	} else if ($timezone == 'user') {
+	} else if ( $timezone == 'user' ) {
 		return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string);
 	}
 }
@@ -1504,8 +1472,8 @@
  * @param string $text Content to replace links to open in a new window.
  * @return string Content that has filtered links.
  */
-function popuplinks($text) {
-	$text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
+function popuplinks( $text ) {
+	$text = preg_replace('/<a (.+?)>/i', '<a $1 target="_blank" rel="external">', $text);
 	return $text;
 }
 
@@ -1519,14 +1487,12 @@
  */
 function sanitize_email( $email ) {
 	// Test for the minimum length the email can be
-	if ( strlen( $email ) < 3 ) {
+	if ( strlen( $email ) < 3 )
 		return apply_filters( 'sanitize_email', '', $email, 'email_too_short' );
-	}
 
 	// Test for an @ character after the first position
-	if ( strpos( $email, '@', 1 ) === false ) {
+	if ( strpos( $email, '@', 1 ) === false )
 		return apply_filters( 'sanitize_email', '', $email, 'email_no_at' );
-	}
 
 	// Split out the local and domain parts
 	list( $local, $domain ) = explode( '@', $email, 2 );
@@ -1534,30 +1500,26 @@
 	// LOCAL PART
 	// Test for invalid characters
 	$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
-	if ( '' === $local ) {
+	if ( '' === $local )
 		return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
-	}
 
 	// DOMAIN PART
 	// Test for sequences of periods
 	$domain = preg_replace( '/\.{2,}/', '', $domain );
-	if ( '' === $domain ) {
+	if ( '' === $domain )
 		return apply_filters( 'sanitize_email', '', $email, 'domain_period_sequence' );
-	}
 
 	// Test for leading and trailing periods and whitespace
 	$domain = trim( $domain, " \t\n\r\0\x0B." );
-	if ( '' === $domain ) {
+	if ( '' === $domain )
 		return apply_filters( 'sanitize_email', '', $email, 'domain_period_limits' );
-	}
 
 	// Split the domain into subs
 	$subs = explode( '.', $domain );
 
 	// Assume the domain will have at least two subs
-	if ( 2 > count( $subs ) ) {
+	if ( 2 > count( $subs ) )
 		return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' );
-	}
 
 	// Create an array that will contain valid subs
 	$new_subs = array();
@@ -1571,15 +1533,13 @@
 		$sub = preg_replace( '/^[^a-z0-9-]+$/i', '', $sub );
 
 		// If there's anything left, add it to the valid subs
-		if ( '' !== $sub ) {
+		if ( '' !== $sub )
 			$new_subs[] = $sub;
-		}
 	}
 
 	// If there aren't 2 or more valid subs
-	if ( 2 > count( $new_subs ) ) {
+	if ( 2 > count( $new_subs ) )
 		return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' );
-	}
 
 	// Join valid subs into the new domain
 	$domain = join( '.', $new_subs );
@@ -1607,23 +1567,20 @@
 	if ( empty($to) )
 		$to = time();
 	$diff = (int) abs($to - $from);
-	if ($diff <= 3600) {
+	if ( $diff <= 3600 ) {
 		$mins = round($diff / 60);
-		if ($mins <= 1) {
+		if ( $mins <= 1 )
 			$mins = 1;
-		}
 		$since = sprintf(_n('%s min', '%s mins', $mins), $mins);
-	} else if (($diff <= 86400) && ($diff > 3600)) {
+	} else if ( ($diff <= 86400) && ($diff > 3600) ) {
 		$hours = round($diff / 3600);
-		if ($hours <= 1) {
+		if ( $hours <= 1 )
 			$hours = 1;
-		}
 		$since = sprintf(_n('%s hour', '%s hours', $hours), $hours);
-	} elseif ($diff >= 86400) {
+	} elseif ( $diff >= 86400 ) {
 		$days = round($diff / 86400);
-		if ($days <= 1) {
+		if ( $days <= 1 )
 			$days = 1;
-		}
 		$since = sprintf(_n('%s day', '%s days', $days), $days);
 	}
 	return $since;
@@ -1641,7 +1598,7 @@
  * @param string $text The exerpt. If set to empty an excerpt is generated.
  * @return string The excerpt.
  */
-function wp_trim_excerpt($text) {
+function wp_trim_excerpt( $text ) {
 	$raw_excerpt = $text;
 	if ( '' == $text ) {
 		$text = get_the_content('');
@@ -1653,7 +1610,7 @@
 		$text = strip_tags($text);
 		$excerpt_length = apply_filters('excerpt_length', 55);
 		$words = explode(' ', $text, $excerpt_length + 1);
-		if (count($words) > $excerpt_length) {
+		if ( count($words) > $excerpt_length ) {
 			array_pop($words);
 			array_push($words, '[...]');
 			$text = implode(' ', $words);
@@ -1670,7 +1627,7 @@
  * @param string $text The text within which entities will be converted.
  * @return string Text with converted entities.
  */
-function ent2ncr($text) {
+function ent2ncr( $text ) {
 	$to_ncr = array(
 		'&quot;' => '&#34;',
 		'&amp;' => '&#38;',
@@ -1945,9 +1902,10 @@
  * @param string $text The text to be formatted.
  * @return string The formatted text after filter is applied.
  */
-function wp_richedit_pre($text) {
+function wp_richedit_pre( $text ) {
 	// Filtering a blank results in an annoying <br />\n
-	if ( empty($text) ) return apply_filters('richedit_pre', '');
+	if ( empty($text) )
+		return apply_filters('richedit_pre', '');
 
 	$output = convert_chars($text);
 	$output = wpautop($output);
@@ -1967,7 +1925,7 @@
  * @param string $output The text to be formatted.
  * @return string Formatted text after filter applied.
  */
-function wp_htmledit_pre($output) {
+function wp_htmledit_pre( $output ) {
 	if ( !empty($output) )
 		$output = htmlspecialchars($output, ENT_NOQUOTES); // convert only < > &
 
@@ -1994,7 +1952,9 @@
 function clean_url( $url, $protocols = null, $context = 'display' ) {
 	$original_url = $url;
 
-	if ('' == $url) return $url;
+	if ( '' == $url )
+		return $url;
+
 	$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
 	$strip = array('%0d', '%0a');
 	$url = str_replace($strip, '', $url);
@@ -2003,8 +1963,7 @@
 	 * presume it needs http:// appended (unless a relative
 	 * link starting with / or a php file).
 	 */
-	if ( strpos($url, ':') === false &&
-		substr( $url, 0, 1 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
+	if ( strpos($url, ':') === false && substr( $url, 0, 1 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
 		$url = 'http://' . $url;
 
 	// Replace ampersands and single quotes only when displaying.
@@ -2046,7 +2005,7 @@
  * @param string $myHTML The text to be converted.
  * @return string Converted text.
  */
-function htmlentities2($myHTML) {
+function htmlentities2( $myHTML ) {
 	$translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
 	$translation_table[chr(38)] = '&';
 	return preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr($myHTML, $translation_table) );
@@ -2062,7 +2021,7 @@
  * @param string $text The text to be escaped.
  * @return string Escaped text.
  */
-function js_escape($text) {
+function js_escape( $text ) {
 	$safe_text = wp_check_invalid_utf8( $text );
 	$safe_text = wp_specialchars( $safe_text, ENT_COMPAT );
 	$safe_text = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $safe_text ) );
@@ -2107,7 +2066,7 @@
  * @param string $tag_name
  * @return string
  */
-function tag_escape($tag_name) {
+function tag_escape( $tag_name ) {
 	$safe_tag = strtolower( preg_replace('/[^a-zA-Z_:]/', '', $tag_name) );
 	return apply_filters('tag_escape', $safe_tag, $tag_name);
 }
@@ -2120,7 +2079,7 @@
  * @param string $text The text to be escaped.
  * @return string text, safe for inclusion in LIKE query.
  */
-function like_escape($text) {
+function like_escape( $text ) {
 	return str_replace(array("%", "_"), array("\\%", "\\_"), $text);
 }
 
@@ -2151,9 +2110,9 @@
  * @param string $value The unsanitised value.
  * @return string Sanitized value.
  */
-function sanitize_option($option, $value) {
+function sanitize_option( $option, $value ) {
 
-	switch ($option) {
+	switch ( $option ) {
 		case 'admin_email':
 			$value = sanitize_email($value);
 			break;
@@ -2181,14 +2140,16 @@
 		case 'posts_per_page':
 		case 'posts_per_rss':
 			$value = (int) $value;
-			if ( empty($value) ) $value = 1;
-			if ( $value < -1 ) $value = abs($value);
+			if ( empty($value) )
+				$value = 1;
+			if ( $value < -1 )
+				$value = abs($value);
 			break;
 
 		case 'default_ping_status':
 		case 'default_comment_status':
 			// Options that if not there have 0 value but need to be something like "closed"
-			if ( $value == '0' || $value == '')
+			if ( $value == '0' || $value == '' )
 				$value = 'closed';
 			break;
 
@@ -2358,7 +2319,7 @@
  * @param array $args List items to prepend to the content and replace '%l'.
  * @return string Localized list items and rest of the content.
  */
-function wp_sprintf_l($pattern, $args) {
+function wp_sprintf_l( $pattern, $args ) {
 	// Not a match
 	if ( substr($pattern, 0, 2) != '%l' )
 		return $pattern;
@@ -2445,13 +2406,9 @@
  * @param string $base The base URL to prefix to links.
  * @return string The processed link.
  */
-function _links_add_base($m, $base) {
+function _links_add_base( $m, $base ) {
 	//1 = attribute name  2 = quotation mark  3 = URL
-	return $m[1] . '=' . $m[2] .
-		(strpos($m[3], 'http://') === false ?
-			path_join($base, $m[3]) :
-			$m[3])
-		. $m[2];
+	return $m[1] . '=' . $m[2] . (strpos($m[3], 'http://') === false ? path_join($base, $m[3]) : $m[3]) . $m[2];
 }
 
 /**
@@ -2471,7 +2428,7 @@
  */
 function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
 	$tags = implode('|', (array)$tags);
-	return preg_replace_callback("!<($tags)(.+?)>!i",
+	return preg_replace_callback("!<($tags)(.+?)>!i", 
 			create_function('$m', 'return _links_add_target($m, "' . $target . '");'),
 			$content);
 }
