Changeset 2085883
- Timestamp:
- 05/11/2019 12:05:50 PM (7 years ago)
- Location:
- super-host-speed-benchmark/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
shsb.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
super-host-speed-benchmark/trunk/readme.txt
r2085361 r2085883 51 51 0.6.2 Change to speed formula 52 52 0.6.3 Report version number and stats 53 0.6.4 Added ttfb calculation (calculated on latest blog post url) 53 54 54 -
super-host-speed-benchmark/trunk/shsb.php
r2085361 r2085883 4 4 * Plugin URI: https://superhostspeed.com/ 5 5 * Description: Test and benchmark the speed of your hosting provider, based on the speed of their mysql database, which tends to be the main cause of Wordpress being slow on some hosts. A score of less than 40 is bad and a score of more than 100 is very good. Scores will be reported to our server in future versions so you can compare speeds with others. See Tools/Speed Benchmark 6 * Version: 0.6. 36 * Version: 0.6.4 7 7 * License: GPL2+ 8 8 * Copyright 2019 Anthony Walker … … 131 131 function shsb_calculate_score() 132 132 { 133 global $wpdb ;133 global $wpdb,$ttfb; 134 134 $charset_collate = $wpdb->get_charset_collate(); 135 135 //$wpdb->show_errors(); … … 209 209 $options = get_option( 'shsb_settings' ); 210 210 211 212 //get_admin_url 213 214 215 216 217 global $post; 218 $placeholder = $post; 219 $args = array( 220 'numberposts' => 1, 221 'offset' => 0, 222 'orderby' => 'post_date', 223 'order' => 'DESC', 224 'post_status' => 'publish' ); 225 $sorted_posts = get_posts( $args ); 226 $url = get_permalink($sorted_posts[0]->ID); 227 228 $ttfb=shsb_get_ttfb($url); 229 echo " | ttfb: $ttfb"; 230 231 211 232 if ($options['shsb_checkbox_field_2']==0) 212 233 { 213 234 $plugin_data = get_plugin_data( __FILE__ ); 214 235 $v = $plugin_data['Version']; 215 $url="https://superhostspeed.com/benchmark.php?score=$score&h=".urlencode($options['shsb_text_field_0'])."&o=".urlencode($options['shsb_text_field_1'])."&host=".gethostname()."&ip=".$_SERVER['SERVER_ADDR']."&httphost=".$_SERVER['HTTP_HOST']."&version=$v&w=$ictr&r=$rctr ";236 $url="https://superhostspeed.com/benchmark.php?score=$score&h=".urlencode($options['shsb_text_field_0'])."&o=".urlencode($options['shsb_text_field_1'])."&host=".gethostname()."&ip=".$_SERVER['SERVER_ADDR']."&httphost=".$_SERVER['HTTP_HOST']."&version=$v&w=$ictr&r=$rctr&ttfb=$ttfb"; 216 237 //echo $url; 217 238 $r=file_get_contents($url); … … 229 250 } 230 251 // shsb_tools_page() displays the page content for the Test Tools submenu 252 253 function shsb_get_ttfb($url) 254 { 255 256 if (!function_exists('curl_version')) return 99999; 257 258 259 $ch = curl_init(); 260 curl_setopt($ch, CURLOPT_URL, $url); 261 curl_setopt($ch, CURLOPT_HEADER, 0); 262 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); 263 curl_setopt($ch, CURLOPT_NOBODY, 1); 264 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); 265 266 curl_exec($ch); 267 $info = curl_getinfo($ch); 268 curl_close($ch); 269 //var_dump($info); 270 //echo "<hr>\n"; 271 return $info['starttransfer_time']; 272 } 273 231 274 function shsb_tools_page() { 232 275 … … 250 293 } 251 294 295 252 296 $purl= plugins_url(); 253 297 echo <<<EOT 298 254 299 <script src='$purl/super-host-speed-benchmark/gauge.min.js'></script> 255 300 … … 314 359 315 360 </script> 361 362 <h2> 363 <a href='https://superhostspeed.com/' style="color:blue;text-align:center" target='_blank'>View ranking table<a> 364 </h2> 365 316 366 EOT; 317 367
Note: See TracChangeset
for help on using the changeset viewer.