/** * Send outbound pings for a post */ function send_outbound_pings() { global $Plugins, $baseurl, $Messages; load_funcs('xmlrpc/model/_xmlrpc.funcs.php'); $this->load_Blog(); $ping_plugins = array_unique(explode(',', $this->Blog->get_setting('ping_plugins'))); if (preg_match('#^http://localhost[/:]#', $baseurl) || preg_match('~^\\w+://[^/]+\\.local/~', $baseurl)) { $Messages->add(T_('Skipping pings (Running on localhost).'), 'note'); } else { foreach ($ping_plugins as $plugin_code) { $Plugin =& $Plugins->get_by_code($plugin_code); if ($Plugin) { $Messages->add(sprintf(T_('Pinging %s...'), $Plugin->ping_service_name), 'note'); $params = array('Item' => &$this, 'xmlrpcresp' => NULL, 'display' => false); $r = $Plugin->ItemSendPing($params); if (isset($params['xmlrpcresp']) && is_a($params['xmlrpcresp'], 'xmlrpcresp')) { // dh> TODO: let xmlrpc_displayresult() handle $Messages (e.g. "error", but should be connected/after the "Pinging %s..." from above) ob_start(); xmlrpc_displayresult($params['xmlrpcresp'], true); $Messages->add(ob_get_contents(), 'note'); ob_end_clean(); } } } } }
/** * Send outbound pings for a post * * @param boolean give more info messages (we want to avoid that when we save & continue editing) */ function send_outbound_pings($verbose = true) { global $Plugins, $baseurl, $Messages, $evonetsrv_host, $test_pings_for_real; load_funcs('xmlrpc/model/_xmlrpc.funcs.php'); $this->load_Blog(); $ping_plugins = trim($this->Blog->get_setting('ping_plugins')); $ping_plugins = empty($ping_plugins) ? array() : array_unique(explode(',', $this->Blog->get_setting('ping_plugins'))); // init result $r = true; if ((preg_match('#^http://localhost[/:]#', $baseurl) || preg_match('~^\\w+://[^/]+\\.local/~', $baseurl)) && $evonetsrv_host != 'localhost' && empty($test_pings_for_real)) { if ($verbose) { $Messages->add(T_('Skipping pings (Running on localhost).'), 'note'); } return false; } else { foreach ($ping_plugins as $plugin_code) { $Plugin =& $Plugins->get_by_code($plugin_code); if ($Plugin) { $ping_messages = array(); $ping_messages[] = sprintf(T_('Pinging %s...'), $Plugin->ping_service_name); $params = array('Item' => &$this, 'xmlrpcresp' => NULL, 'display' => false); $r = $r && $Plugin->ItemSendPing($params); if (!empty($params['xmlrpcresp'])) { if (is_a($params['xmlrpcresp'], 'xmlrpcresp')) { // dh> TODO: let xmlrpc_displayresult() handle $Messages (e.g. "error", but should be connected/after the "Pinging %s..." from above) ob_start(); xmlrpc_displayresult($params['xmlrpcresp'], true); $ping_messages[] = ob_get_contents(); ob_end_clean(); } else { $ping_messages[] = $params['xmlrpcresp']; } } $Messages->add(implode('<br />', $ping_messages), 'note'); } } } return $r; }
if (empty($delete_post2)) { echo 'no post2 to delete yet. run again.'; } else { $client->debug = false; $message = new xmlrpcmsg('blogger.deletePost', array(new xmlrpcval($bloggerAPIappkey), new xmlrpcval($delete_post2), new xmlrpcval($test_user), new xmlrpcval($test_pass), new xmlrpcval(0, 'boolean'))); $result = $client->send($message); $ret = xmlrpc_displayresult($result); // pre_dump( $ret ); if ($ret == 1) { echo "OK<br/>\n"; } else { die('ERROR'); } } if (empty($delete_post3)) { echo 'no post3 to delete yet. run again.'; } else { $client->debug = false; $message = new xmlrpcmsg('blogger.deletePost', array(new xmlrpcval($bloggerAPIappkey), new xmlrpcval($delete_post3), new xmlrpcval($test_user), new xmlrpcval($test_pass), new xmlrpcval(0, 'boolean'))); $result = $client->send($message); $ret = xmlrpc_displayresult($result); // pre_dump( $ret ); if ($ret == 1) { echo "OK<br/>\n"; } else { die('ERROR'); } } // ---------------------------------------------------------------------------------------------------- // Missing tests: // metaWeblog.newMediaObject