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


PHP GoogleSitemapGenerator::SendPing方法代码示例

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


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

示例1: HtmlShowOptionsPage


//.........这里部分代码省略.........
                            if (!current_user_can("administrator")) {
                                echo '<p>Please log in as admin</p>';
                                return;
                            }
                            echo <<<HTML
<html>
\t<head>
\t\t<style type="text/css">
\t\thtml {
\t\t\tbackground: #f1f1f1;
\t\t}

\t\tbody {
\t\t\tcolor: #444;
\t\t\tfont-family: "Open Sans", sans-serif;
\t\t\tfont-size: 13px;
\t\t\tline-height: 1.4em;
\t\t\tmin-width: 600px;
\t\t}

\t\th2 {
\t\t\tfont-size: 23px;
\t\t\tfont-weight: 400;
\t\t\tpadding: 9px 10px 4px 0;
\t\t\tline-height: 29px;
\t\t}
\t\t</style>
\t</head>
\t<body>
HTML;
                            echo "<h2>" . __('Notify Search Engines about all sitemaps', 'sitemap') . "</h2>";
                            echo "<p>" . __('The plugin is notifying the selected search engines about your main sitemap and all sub-sitemaps. This might take a minute or two.', 'sitemaps') . "</p>";
                            flush();
                            $results = $this->sg->SendPingAll();
                            echo "<ul>";
                            foreach ($results as $result) {
                                $sitemapUrl = $result["sitemap"];
                                /** @var $status GoogleSitemapGeneratorStatus */
                                $status = $result["status"];
                                echo "<li><a href=\"" . esc_url($sitemapUrl) . "\">" . $sitemapUrl . "</a><ul>";
                                $services = $status->GetUsedPingServices();
                                foreach ($services as $serviceId) {
                                    echo "<li>";
                                    echo $status->GetServiceName($serviceId) . ": " . ($status->GetPingResult($serviceId) == true ? "OK" : "ERROR");
                                    echo "</li>";
                                }
                                echo "</ul></li>";
                            }
                            echo "</ul>";
                            echo "<p>" . __('All done!', 'sitemap') . "</p>";
                            echo <<<HTML

\t</body>
HTML;
                            exit;
                        } else {
                            if (!empty($_GET["sm_ping_main"])) {
                                check_admin_referer('sitemap');
                                //Check again, just for the case that something went wrong before
                                if (!current_user_can("administrator")) {
                                    echo '<p>Please log in as admin</p>';
                                    return;
                                }
                                $this->sg->SendPing();
                                $message = __("Ping was executed, please see below for the result.", "sitemap");
                            }
开发者ID:popovdenis,项目名称:kmst,代码行数:67,代码来源:sitemap-ui.php


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