public static function admin_notices() { $warm_cache_admin = new warm_cache(); $sitemap_url = $warm_cache_admin->get_sitemap_url(); if (!$sitemap_url) { // No override post? if (!isset($_POST['update_sitemap']) || !$_POST['update_sitemap']) { echo '<div class="error"><p>A notice from plugin Warm-cache: Your configured sitemap url is not configured, I cannot crawl your pages. <a href="' . admin_url('plugins.php?page=warm-cache%2Fwarm-cache.php') . '">Update your sitemap url now</a>.</p></div>'; } } else { // Check sitemap validity $key = 'warm-cache-sitemapcheck'; if (false === ($sitemapSyntaxOK = get_transient($key))) { $sitemapSyntaxOK = true; $response = wp_remote_get($sitemap_url); if (!is_array($response)) { $errormsg = print_r($response, true); $sitemapSyntaxOK = false; } else { $xmldata = wp_remote_retrieve_body($response); if (substr_count($xmldata, '<?xml') == 0) { $sitemapSyntaxOK = false; $errormsg = 'No xml opening tag'; } else { if (substr_count($xmldata, '<urlset') == 0 && substr_count($xmldata, '<sitemap') == 0) { $sitemapSyntaxOK = false; $errormsg = 'Urlset or sitemap tag'; } } } if ($sitemapSyntaxOK) { // If it's OK, we will re-check in 12 hours set_transient($key, $sitemapSyntaxOK, 12 * HOUR_IN_SECONDS); } else { // If it's NOT OK, we will re-check in 2 minutes (sooner could induce more server load) set_transient($key, $sitemapSyntaxOK, 2 * MINUTE_IN_SECONDS); } } if (!$sitemapSyntaxOK) { echo '<div class="error"><p>A notice from plugin Warm-cache: Your configured sitemap url ( <a href="' . $sitemap_url . '">' . $sitemap_url . '</a> ) is configured, but does not appear to contain an xml opening tag, or a combination of urlset or sitemap, I cannot crawl your pages. Please check your sitemap plugin to fix your currupt sitemap.<br/>Note: this check will be cached for 2 minutes. So if you fix the problem, this notice might still be present for 2 minutes.</p> <p>Error detail: ' . $errormsg . '</p></div>'; } } }
$warm_cache->google_sitemap_generator_options = get_option("sm_options"); $useflush = get_option("plugin_warm_cache_lb_flush"); $limit = apply_filters('mp_warm_cache_limit_filters', get_option('plugin_warm_cache_limit', 20)); $start = get_option('plugin_warm_cache_start', 0); echo "Start at item {$start} {$limit}"; $mtime = microtime(); $mtime = explode(' ', $mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; @set_time_limit(0); ob_start(); if (file_exists('./wp-load.php')) { require_once './wp-load.php'; } // Get url $sitemap_url = $warm_cache->get_sitemap_url(); // Override here if needed // For stats $statdata = get_option('plugin_warm_cache_statdata'); if (!isset($statdata) || !is_array($statdata)) { add_option('plugin_warm_cache_statdata', array(), NULL, 'no'); } $newvalue = array(); $totalcount = 0; $hits = 0; $newvalue['url'] = $sitemap_url; $newvalue['time_start'] = $newtime; $newvalue['pages'] = array(); function mp_process_sitemap($sitemap_url) { global $newvalue, $totalcount, $limit, $start, $hits, $useflush, $pid_lock;