コード例 #1
0
 public function admin_menu()
 {
     load_plugin_textdomain('plugin_warm_cache', '/wp-content/plugins/warm-cache/language/');
     $warm_cache_admin = new warm_cache();
     $warm_cache_admin->plugin_title = 'Warm cache';
     if (!$warm_cache_admin->configuration_check()) {
     } else {
         $warm_cache_admin->content_start();
         $stats = $warm_cache_admin->get_stats();
         if (!$stats['crawl']) {
             $msg = 'Ok, we have detected your sitemap url but it has not been visited by the plugin\'s crawler.<br/>';
             $warm_cache_api_url = trailingslashit(get_bloginfo('url')) . '?warm_cache=' . get_option('plugin_warm_cache_api');
             $msg .= 'The url you should call from a cronjob is: ' . $warm_cache_api_url . '<br/>';
             $msg .= 'To re-set the key, visit this url: ' . admin_url('plugins.php?page=warm-cache/warm-cache.php&resetkey=true') . '<br/>';
             $msg .= 'If you are in need of an external cronjob service, you might like to use Easycron.com (affiliate link) <a href="http://www.easycron.com/?ref=12201">http://www.easycron.com/?ref=12201</a> or <a href="https://webshop.mijnpress.nl/shop/cronjob-for-warm-cache">buy our cronjob service</a>';
             $msg .= '<br/><a href="https://www.managedwphosting.nl/contact/offerte-op-maat/">I offer paid WordPress speed-optimisation consultancy and Varnish & memcached WordPress webhosting & servers.</a>';
             $warm_cache_admin->show_message($msg);
             echo '<br/><br/>';
         } else {
             $msg = 'Crawled in total ' . $stats['stats_pages'] . ' pages in a total of ' . $stats['stats_times'] . ' seconds (based on the last 75 crawls)<br/>';
             if ($stats['stats_pages']) {
                 $msg .= 'Average page to load a page in seconds: ' . $stats['stats_times'] / $stats['stats_pages'];
             }
             $msg .= '<br/><a href="https://www.managedwphosting.nl/contact/offerte-op-maat/">I offer paid WordPress speed-optimisation consultancy and Varnish & memcached WordPress webhosting & servers.</a>';
             $warm_cache_admin->show_message($msg);
         }
         echo '<table class="widefat">';
         echo '<tr><th class="manage-column" style="width: 150px;">Crawled at</th><th class="manage-column">Time needed</th><th class="manage-column" style="width: 120px;">Number of pages</th><th class="manage-column">Average load time per page</th><th class="manage-column">Pages</th></tr>';
         echo $stats['table_string'];
         echo '</table>';
         $warm_cache_admin->content_end();
     }
 }