[wp-cvs] wordpress/wp-includes functions-formatting.php, 1.32, 1.33 functions.php, 1.116, 1.117

Matthew Mullenweg saxmatt at users.sourceforge.net
Thu Jun 10 05:01:47 CDT 2004


Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10103/wp-includes

Modified Files:
	functions-formatting.php functions.php 
Log Message:
Gzip cleanup, debugged wacky options problem, some cleanup and reorg. We need to split up functions.php more logically, and kill some of the useless functions.

Index: functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/functions.php,v
retrieving revision 1.116
retrieving revision 1.117
diff -C2 -d -r1.116 -r1.117
*** functions.php	10 Jun 2004 08:42:25 -0000	1.116
--- functions.php	10 Jun 2004 10:01:45 -0000	1.117
***************
*** 13,24 ****
  }
  
- function popuplinks($text) {
- 	// Comment text in popup windows should be filtered through this.
- 	// Right now it's a moderately dumb function, ideally it would detect whether
- 	// a target or rel attribute was already there and adjust its actions accordingly.
- 	$text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
- 	return $text;
- }
- 
  function mysql2date($dateformatstring, $mysqlstring, $use_b2configmonthsdays = 1) {
  	global $month, $weekday;
--- 13,16 ----
***************
*** 301,319 ****
  function get_settings($setting) {
  	global $wpdb, $cache_settings;
! 	if ( strstr($_SERVER['REQUEST_URI'], 'install.php') || strstr($_SERVER['REQUEST_URI'], 'upgrade.php') ) {
  		return false;
- 	}
  
! 	if ( empty($cache_settings) ) {
  		$cache_settings = get_alloptions();
- 	}
  
  	if ('home' == $setting && '' == $cache_settings->home) return $cache_settings->siteurl;
  
! 	if (!isset($cache_settings->$setting)) {
! 		return $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
! 	} else {
  		return $cache_settings->$setting;
! 	}
  }
  
--- 293,308 ----
  function get_settings($setting) {
  	global $wpdb, $cache_settings;
! 	if ( strstr($_SERVER['REQUEST_URI'], 'install.php') || strstr($_SERVER['REQUEST_URI'], 'upgrade.php') )
  		return false;
  
! 	if ( empty($cache_settings) )
  		$cache_settings = get_alloptions();
  
  	if ('home' == $setting && '' == $cache_settings->home) return $cache_settings->siteurl;
  
! 	if ( isset($cache_settings->$setting) )
  		return $cache_settings->$setting;
! 	else
! 		return $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
  }
  
***************
*** 327,331 ****
  			if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
  			if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
- 
  			$all_options->{$option->option_name} = stripslashes($option->option_value);
  		}
--- 316,319 ----
***************
*** 440,463 ****
  
  function gzip_compression() {
! 	global $gzip_compressed;
! 	if (strstr($_SERVER['PHP_SELF'], 'wp-admin')) return true;
! 		if (!$gzip_compressed) {
! 		$phpver = phpversion(); //start gzip compression
! 		if($phpver >= "4.0.4pl1") {
! 			if(extension_loaded("zlib")) { 
! 				ob_start("ob_gzhandler"); 
! 			}
! 		} else if($phpver > "4.0") {
! 			if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
! 				if(extension_loaded("zlib")) { 
! 					$do_gzip_compress = TRUE; 
! 					ob_start(); 
! 					ob_implicit_flush(0); 
! 					header("Content-Encoding: gzip");
! 				}
! 			}
! 		} //end gzip compression - that piece of script courtesy of the phpBB dev team
! 		$gzip_compressed=1;
! 	}
  }
  
--- 428,436 ----
  
  function gzip_compression() {
! 	if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') ) return false;
! 	if ( !get_settings('gzipcompression') ) return false;
! 
! 	if( extension_loaded('zlib') )
! 		ob_start('ob_gzhandler'); 
  }
  
***************
*** 467,488 ****
  
  function timer_start() {
!     global $timestart;
!     $mtime = microtime();
!     $mtime = explode(" ",$mtime);
!     $mtime = $mtime[1] + $mtime[0];
!     $timestart = $mtime;
!     return true;
  }
  
! function timer_stop($display=0,$precision=3) { //if called like timer_stop(1), will echo $timetotal
!     global $timestart,$timeend;
!     $mtime = microtime();
!     $mtime = explode(" ",$mtime);
!     $mtime = $mtime[1] + $mtime[0];
!     $timeend = $mtime;
!     $timetotal = $timeend-$timestart;
!     if ($display)
!         echo number_format($timetotal,$precision);
!     return $timetotal;
  }
  
--- 440,461 ----
  
  function timer_start() {
! 	global $timestart;
! 	$mtime = microtime();
! 	$mtime = explode(' ',$mtime);
! 	$mtime = $mtime[1] + $mtime[0];
! 	$timestart = $mtime;
! 	return true;
  }
  
! function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
! 	global $timestart, $timeend;
! 	$mtime = microtime();
! 	$mtime = explode(' ',$mtime);
! 	$mtime = $mtime[1] + $mtime[0];
! 	$timeend = $mtime;
! 	$timetotal = $timeend-$timestart;
! 	if ($display)
! 		echo number_format($timetotal,$precision);
! 	return $timetotal;
  }
  

Index: functions-formatting.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/functions-formatting.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** functions-formatting.php	31 May 2004 17:02:09 -0000	1.32
--- functions-formatting.php	10 Jun 2004 10:01:45 -0000	1.33
***************
*** 446,448 ****
--- 446,456 ----
  }
  
+ function popuplinks($text) {
+ 	// Comment text in popup windows should be filtered through this.
+ 	// Right now it's a moderately dumb function, ideally it would detect whether
+ 	// a target or rel attribute was already there and adjust its actions accordingly.
+ 	$text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
+ 	return $text;
+ }
+ 
  ?>
\ No newline at end of file




More information about the cvs mailing list