当前位置: 首页>>代码示例>>PHP>>正文


PHP XML_RPC_Message::parseResponse方法代码示例

本文整理汇总了PHP中XML_RPC_Message::parseResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP XML_RPC_Message::parseResponse方法的具体用法?PHP XML_RPC_Message::parseResponse怎么用?PHP XML_RPC_Message::parseResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XML_RPC_Message的用法示例。


在下文中一共展示了XML_RPC_Message::parseResponse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: switch


//.........这里部分代码省略.........
&nbsp;&nbsp;</label><br />
<?php 
                    }
                    ?>
                            <input onclick="<?php 
                    echo $noneclick;
                    ?>
" class="input_checkbox" style="margin: 0px; padding: 0px; vertical-align: bottom;" type="checkbox" value="none" id="serendipity[announce_entries_none]" />
                                <label title="<?php 
                    echo NONE;
                    ?>
" style="vertical-align: bottom; margin: 0px; padding: 0px;" for="serendipity[announce_entries_none]">&nbsp;<?php 
                    echo NONE;
                    ?>
&nbsp;&nbsp;</label><br />
                    </fieldset>
<?php 
                    return true;
                    break;
                case 'backend_publish':
                    if (!class_exists('XML_RPC_Base')) {
                        include_once S9Y_PEAR_PATH . "XML/RPC.php";
                    }
                    // First cycle through list of services to remove superseding services which may have been checked
                    foreach ($this->services as $index => $service) {
                        if (!empty($service['supersedes']) && isset($serendipity['POST']['announce_entries_' . $service['name']])) {
                            $supersedes = explode(', ', $service['supersedes']);
                            foreach ($supersedes as $sid => $servicename) {
                                // A service has been checked that is superseded by another checked meta-service. Remove that service from the list of services to be ping'd
                                unset($serendipity['POST']['announce_entries_' . $servicename]);
                            }
                        }
                    }
                    foreach ($this->services as $index => $service) {
                        if (isset($serendipity['POST']['announce_entries_' . $service['name']]) || defined('SERENDIPITY_IS_XMLRPC') && serendipity_db_bool($this->get_config($service['name']))) {
                            if (!defined('SERENDIPITY_IS_XMLRPC') || defined('SERENDIPITY_XMLRPC_VERBOSE')) {
                                printf(PLUGIN_EVENT_WEBLOGPING_SENDINGPING . '...', $service['host']);
                            }
                            flush();
                            # XXX append $serendipity['indexFile'] to baseURL?
                            $args = array(new XML_RPC_Value($serendipity['blogTitle'], 'string'), new XML_RPC_Value($serendipity['baseURL'], 'string'));
                            if ($service['extended']) {
                                # the checkUrl: for when the main page is not really the main page
                                $args[] = new XML_RPC_Value('', 'string');
                                # the rssUrl
                                $args[] = new XML_RPC_Value($serendipity['baseURL'] . 'rss.php?version=2.0', 'string');
                            }
                            $message = new XML_RPC_Message($service['extended'] ? 'weblogUpdates.extendedPing' : 'weblogUpdates.ping', $args);
                            $client = new XML_RPC_Client(trim($service['path']), trim($service['host']));
                            # 15 second timeout may not be long enough for weblogs.com
                            $message->createPayload();
                            $options = array();
                            serendipity_plugin_api::hook_event('backend_http_request', $options, 'weblogping');
                            serendipity_request_start();
                            $req = new HTTP_Request("http://" . $service['host'] . $service['path'], $options);
                            $req->setMethod(HTTP_REQUEST_METHOD_POST);
                            $req->addHeader("Content-Type", "text/xml");
                            if (strtoupper(LANG_CHARSET) != 'UTF-8') {
                                $payload = utf8_encode($message->payload);
                            } else {
                                $payload = $message->payload;
                            }
                            $req->addRawPostData($payload);
                            $http_result = $req->sendRequest();
                            $http_response = $req->getResponseBody();
                            $xmlrpc_result = $message->parseResponse($http_response);
                            if ($xmlrpc_result->faultCode()) {
                                $out = sprintf(PLUGIN_EVENT_WEBLOGPING_SEND_FAILURE . "<br />", htmlspecialchars($xmlrpc_result->faultString()));
                            } else {
                                $out = PLUGIN_EVENT_WEBLOGPING_SEND_SUCCESS . "<br />";
                            }
                            serendipity_request_end();
                            if (!defined('SERENDIPITY_IS_XMLRPC') || defined('SERENDIPITY_XMLRPC_VERBOSE')) {
                                echo $out;
                            }
                        }
                    }
                    return true;
                    break;
                case 'external_plugin':
                    if ($eventData == 'xmlrpc_ping') {
                        echo "XMLRPC START\n";
                        @define('SERENDIPITY_IS_XMLRPC', true);
                        @define('SERENDIPITY_XMLRPC_VERBOSE', true);
                        $this->event_hook('backend_publish', $bag, $eventData);
                        echo "XMLRPC DONE\n";
                    }
                    return true;
                case 'frontend_display':
                case 'backend_insert':
                case 'backend_update':
                case 'backend_draft':
                default:
                    return false;
                    break;
            }
        } else {
            return false;
        }
    }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:101,代码来源:serendipity_event_weblogping.php


注:本文中的XML_RPC_Message::parseResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。