-
+ 370E551A54B2670AF752D93C0993BB3EF3E0C336DC5884D02B6EDF06CFBCF911A544D5AD9E82EF6C911F7DC557291FE4D6B8548DB6E453B46A88AB2BE7316FA9
mp-wp/wp-admin/update-links.php
(0 . 0)(1 . 56)
58220 <?php
58221 /**
58222 * Send blog links to pingomatic.com to update.
58223 *
58224 * You can disable this feature by deleting the option 'use_linksupdate' or
58225 * setting the option to false. If no links exist, then no links are sent.
58226 *
58227 * Snoopy is included, but is not used. Fsockopen() is used instead to send link
58228 * URLs.
58229 *
58230 * @package WordPress
58231 * @subpackage Administration
58232 */
58233
58234 /** Load WordPress Bootstrap */
58235 require_once('../wp-load.php');
58236
58237 if ( !get_option('use_linksupdate') )
58238 wp_die(__('Feature disabled.'));
58239
58240 $link_uris = $wpdb->get_col("SELECT link_url FROM $wpdb->links");
58241
58242 if ( !$link_uris )
58243 wp_die(__('No links'));
58244
58245 $link_uris = urlencode( join( $link_uris, "\n" ) );
58246
58247 $query_string = "uris=$link_uris";
58248
58249 $options = array();
58250 $options['timeout'] = 30;
58251 $options['body'] = $query_string;
58252
58253 $options['headers'] = array(
58254 'content-type' => 'application/x-www-form-urlencoded; charset='.get_option('blog_charset'),
58255 'content-length' => strlen( $query_string ),
58256 );
58257
58258 $response = wp_remote_get('http://api.pingomatic.com/updated-batch/', $options);
58259
58260 if ( is_wp_error( $response ) )
58261 wp_die(__('Request Failed.'));
58262
58263 if ( $response['response']['code'] != 200 )
58264 wp_die(__('Request Failed.'));
58265
58266 $body = str_replace(array("\r\n", "\r"), "\n", $response['body']);
58267 $returns = explode("\n", $body);
58268
58269 foreach ($returns as $return) :
58270 $time = substr($return, 0, 19);
58271 $uri = preg_replace('/(.*?) | (.*?)/', '$2', $return);
58272 $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_updated = %s WHERE link_url = %s", $time, $uri) );
58273 endforeach;
58274
58275 ?>