(60*15)) // 60*60 = 1 hours { update_option('last_Pingomatic_check_timestamp', time()); require_once( ABSPATH . 'wp-admin/update-links.php'); } # if there is no weblogs.com timestamp, create it with the current timestamp if (!$weblogscom_timestamp) { add_option('last_Weblogs_com_check_timestamp', time(), 'timestamp of last weblogs.com check for Blogroll-Update plugin'); } # check to see if it's been more than 5 minutes since weblogs.com was checked elseif ((time() - $weblogscom_timestamp) > (60*5-2)) // 60*5-2 = 5 minutes - 2 seconds { update_option('last_Weblogs_com_check_timestamp', time()); # create an array of stripped-down Blogroll urls $link_urls = $wpdb->get_col("SELECT link_url FROM $wpdb->links"); if (!$link_urls) die ('You should disable the blogroll_update plugin because you have no links in your blogroll'); for ($x = 0; $x < count($link_urls); $x++) { $link_urls[$x] = blogroll_update_strip_url($link_urls[$x]); } # load the list of weblogs.com changes from the last 5 minutes $changes = file("http://www.weblogs.com/shortChanges.xml"); if ($changes) { foreach ($changes as $line) { # find the base timestamp of the changes feed if (preg_match("/\s]/i", $line, $matches); $timestamp = strtotime($matches[1]); #print "

$timestamp

"; } if (preg_match("/query("update $wpdb->links set link_updated='$date' WHERE link_url LIKE '%$key%' AND link_updated < '$date' "); #print "$result, $key, $when\n"; } } } } } function blogroll_update_strip_url($url) { $url = strtolower($url); $search = array ("'www\.'", "'(?:index|default)\.[a-z]{2,}'i", "'/$'"); $replace = array ("", "", ""); $url = preg_replace($search, $replace, $url); return $url; } ?>