Changeset 1672
- Timestamp:
- 09/16/2004 03:20:39 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc.php
r1671 r1672 114 114 // PingBack 115 115 'pingback.ping' => 'this:pingback_ping', 116 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks', 116 117 117 118 'demo.sayHello' => 'this:sayHello', … … 1017 1018 global $wpdb; 1018 1019 1019 $post_ID = intval($args [0]);1020 $post_ID = intval($args); 1020 1021 1021 1022 $actual_post = wp_get_single_post($post_ID, ARRAY_A); … … 1111 1112 1112 1113 // let's find which post is linked to 1114 // FIXME: does url_to_postid() cover all these cases already? 1115 // if so, then let's use it and drop the old code. 1113 1116 $urltest = parse_url($pagelinkedto); 1114 1117 if ($post_ID = url_to_postid($pagelinkedto)) { … … 1262 1265 return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)"; 1263 1266 } 1267 1268 1269 /* pingback.extensions.getPingbacks returns an array of URLs 1270 that pingbacked the given URL 1271 specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */ 1272 function pingback_extensions_getPingbacks($args) { 1273 1274 global $wpdb; 1275 1276 $url = $args; 1277 1278 $post_ID = url_to_postid($url); 1279 if (!$post_ID) { 1280 // We aren't sure that the resource is available and/or pingback enabled 1281 return '0x0021'; 1282 } 1283 1284 $actual_post = wp_get_single_post($post_ID, ARRAY_A); 1285 1286 if (!$actual_post) { 1287 // No such post = resource not found 1288 return '0x0020'; 1289 } 1290 1291 $comments = $wpdb->get_results("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = $post_ID"); 1292 1293 if (!$comments) { 1294 return array(); 1295 } 1296 1297 $pingbacks = array(); 1298 foreach($comments as $comment) { 1299 if ((strpos($comment->comment_content, '<pingback />') === 0) 1300 || ('pingback' == $comment->comment_type)) { 1301 $pingbacks[] = $comment->comment_author_url; 1302 } 1303 } 1304 1305 return $pingbacks; 1306 } 1264 1307 } 1265 1308
Note: See TracChangeset
for help on using the changeset viewer.