Changeset 1404 for trunk/wp-includes/functions.php
- Timestamp:
- 06/10/2004 10:01:45 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r1401 r1404 11 11 return ((float) $string); 12 12 } 13 }14 15 function popuplinks($text) {16 // Comment text in popup windows should be filtered through this.17 // Right now it's a moderately dumb function, ideally it would detect whether18 // a target or rel attribute was already there and adjust its actions accordingly.19 $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);20 return $text;21 13 } 22 14 … … 301 293 function get_settings($setting) { 302 294 global $wpdb, $cache_settings; 303 if ( strstr($_SERVER['REQUEST_URI'], 'install.php') || strstr($_SERVER['REQUEST_URI'], 'upgrade.php') ) {295 if ( strstr($_SERVER['REQUEST_URI'], 'install.php') || strstr($_SERVER['REQUEST_URI'], 'upgrade.php') ) 304 296 return false; 305 } 306 307 if ( empty($cache_settings) ) { 297 298 if ( empty($cache_settings) ) 308 299 $cache_settings = get_alloptions(); 309 }310 300 311 301 if ('home' == $setting && '' == $cache_settings->home) return $cache_settings->siteurl; 312 302 313 if (!isset($cache_settings->$setting)) { 303 if ( isset($cache_settings->$setting) ) 304 return $cache_settings->$setting; 305 else 314 306 return $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'"); 315 } else {316 return $cache_settings->$setting;317 }318 307 } 319 308 … … 327 316 if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); 328 317 if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value); 329 330 318 $all_options->{$option->option_name} = stripslashes($option->option_value); 331 319 } … … 440 428 441 429 function gzip_compression() { 442 global $gzip_compressed; 443 if (strstr($_SERVER['PHP_SELF'], 'wp-admin')) return true; 444 if (!$gzip_compressed) { 445 $phpver = phpversion(); //start gzip compression 446 if($phpver >= "4.0.4pl1") { 447 if(extension_loaded("zlib")) { 448 ob_start("ob_gzhandler"); 449 } 450 } else if($phpver > "4.0") { 451 if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) { 452 if(extension_loaded("zlib")) { 453 $do_gzip_compress = TRUE; 454 ob_start(); 455 ob_implicit_flush(0); 456 header("Content-Encoding: gzip"); 457 } 458 } 459 } //end gzip compression - that piece of script courtesy of the phpBB dev team 460 $gzip_compressed=1; 461 } 430 if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') ) return false; 431 if ( !get_settings('gzipcompression') ) return false; 432 433 if( extension_loaded('zlib') ) 434 ob_start('ob_gzhandler'); 462 435 } 463 436 … … 467 440 468 441 function timer_start() { 469 470 471 $mtime = explode(" ",$mtime);472 473 474 475 } 476 477 function timer_stop($display =0,$precision=3) { //if called like timer_stop(1), will echo $timetotal478 global $timestart,$timeend;479 480 $mtime = explode(" ",$mtime);481 482 483 484 485 486 442 global $timestart; 443 $mtime = microtime(); 444 $mtime = explode(' ',$mtime); 445 $mtime = $mtime[1] + $mtime[0]; 446 $timestart = $mtime; 447 return true; 448 } 449 450 function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal 451 global $timestart, $timeend; 452 $mtime = microtime(); 453 $mtime = explode(' ',$mtime); 454 $mtime = $mtime[1] + $mtime[0]; 455 $timeend = $mtime; 456 $timetotal = $timeend-$timestart; 457 if ($display) 458 echo number_format($timetotal,$precision); 459 return $timetotal; 487 460 } 488 461
Note: See TracChangeset
for help on using the changeset viewer.