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


PHP Formatter::send_title方法代码示例

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


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

示例1: do_trackback

function do_trackback($formatter, $options)
{
    global $DBInfo, $_release;
    $entry = '';
    if (!$formatter->page->exists()) {
        $pos = strrpos($formatter->page->name, '/');
        if ($pos > 0) {
            $entry = substr($formatter->page->name, $pos + 1);
            $pagename = substr($formatter->page->name, 0, $pos);
            $page = new WikiPage($pagename);
            $formatter = new Formatter($page, $options);
            $options['page'] = $pagename;
        } else {
            $options['msg'] = _("Error: Page Not found !");
            send_error(1, $options['msg']);
        }
    }
    if (empty($options['url'])) {
        $anchor = '';
        if ($options['value']) {
            $anchor = '/' . $options['value'];
        }
        $formatter->send_header("", $options);
        if ($DBInfo->use_trackback) {
            $ping_url = qualifiedUrl($formatter->link_url($formatter->page->urlname . $anchor, "?action=trackback"));
        } else {
            $ping_url = _("TrackBack is not activated !");
        }
        $sendping_action = $formatter->link_tag($formatter->page->urlname, "?action=sendping&value={$options['value']}", _("send ping"));
        $tb_cache = new Cache_text('trackback');
        if ($tb_cache->exists($options['page'])) {
            $formatter->send_title(sprintf(_("TrackBack list of %s"), $options['page']), "", $options);
            $trackbacks = explode("\n", $tb_cache->fetch($options['page']));
            unset($trackbacks[sizeof($trackbacks) - 1]);
            # trim the last empty line
            print "<div class='trackback-hint'><b>" . _("TrackBack URL for this page:") . "</b><br />\n{$ping_url}<br /><br />\n";
            print "<b>" . _("Send TrackBack Ping to another Blog:") . "</b> {$sendping_action}</div>\n<br />";
            foreach ($trackbacks as $trackback) {
                list($dummy, $entry, $url, $date, $sitename, $title, $excerpt) = explode("\t", $trackback);
                if ($anchor and '/' . $entry != $anchor) {
                    continue;
                }
                $date[10] = " ";
                # 2003-07-11T12:08:33+09:00
                # $time=strtotime($date);
                $time = strtotime($date);
                $date = date("@ m-d [h:i a]", $time);
                print "<div class='blog'>\n";
                print "<div class='blog-title'><a href='{$url}'>{$title}</a></div>\n";
                print "<div class='blog-user'>Submitted by <a href='{$url}'>{$sitename}</a> {$date}</div>\n";
                print "<div class='blog-comment'>{$excerpt}</div>\n</div><br />\n";
            }
        } else {
            $formatter->send_title(sprintf(_("No TrackBack entry found for %s"), $options['page']), "", $options);
            print "<div class='trackback-hint'><b>" . _("TrackBack URL for this page:") . "</b><br />\n{$ping_url}<br /><br />\n";
            print "<b>" . _("Send TrackBack Ping to another Blog:") . "</b> {$sendping_action}</div>\n";
        }
        $formatter->send_footer("", $options);
        return;
    }
    if (!$DBInfo->use_trackback) {
        send_error(1, "TrackBack is not enabled");
    }
    if (empty($options['title']) or empty($options['excerpt']) or empty($options['blog_name']) or empty($options['url'])) {
        send_error(1, "Invalid TrackBack Ping");
    }
    # receivie Trackback ping
    # strip \n
    $title = strtr(_stripslashes($options['title']), "\t\n", " \r");
    $excerpt = strtr(_stripslashes($options['excerpt']), "\t\n", " \r");
    $blog_name = strtr(_stripslashes($options['blog_name']), "\t\n", " \r");
    $url = strtr(_stripslashes($options['url']), "\t\n", " \r");
    $timestamp = time();
    $date = gmdate("Y-m-d\\TH:i:s", $timestamp);
    $receive = $timestamp . "\t" . $entry . "\t" . $url . "\t" . $date . "\t" . $blog_name . "\t" . $title . "\t" . $excerpt . "\n";
    $tb_cache = new Cache_text('trackback');
    $old = $tb_cache->fetch($options['page']);
    $ret = $tb_cache->update($options['page'], $old . $receive, time());
    if ($ret === false) {
        send_error(0, "Can't update Trackback list. Please try again");
    }
    send_error(0, 'Successfully added');
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:83,代码来源:trackback.php


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