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


PHP Formatter::send_page方法代码示例

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


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

示例1: processor_folding

function processor_folding($formatter, $value = "", $options = array())
{
    // unique id of the folding area
    $id = isset($GLOBALS['_folding_id_']) ? $GLOBALS['_folding_id_'] : 0;
    $id++;
    $GLOBALS['_folding_id_'] = $id;
    if ($value[0] == '#' and $value[1] == '!') {
        list($line, $value) = explode("\n", $value, 2);
    }
    $init_state = 'none';
    $title = _("More");
    $class = '';
    $opened = '';
    // parse args
    if (isset($line[0]) and ($p = strpos($line, ' ')) !== false) {
        $tag = substr($line, 0, $p);
        $args = substr($line, $p + 1);
        if (preg_match("/^(?:(open|\\+))?(?(1)[ ]*,[ ]*)?((?:(?:[a-zA-Z][a-z0-9_-]+)[ ]*)*)?(?(2)[ ]*,[ ]*)?/", $args, $matches)) {
            $class = isset($matches[2][0]) ? ' ' . $matches[2] : '';
            $tmp = substr($args, strlen($matches[0]));
            if (isset($tmp[0])) {
                $title = $tmp;
            }
            if ($matches[1] == 'open' or $matches[1] == '+') {
                $init_state = 'block';
                $opened = ' class="opened"';
            }
        }
    }
    // FIXME footnote prefix
    $fn_prefix = 'fn' . substr(md5(substr($value, 0, 32)), 0, 3);
    // allow wiki syntax in folding content
    ob_start();
    $params = array('notoc' => 1);
    $params['nosisters'] = 1;
    $f = new Formatter($formatter->page, $params);
    $f->foot_prefix = $fn_prefix;
    $f->get_javascripts();
    // trash default javascripts
    $f->pi['#linenum'] = 0;
    // do not use linenum
    $f->send_page($value, $params);
    $out = ob_get_contents();
    ob_end_clean();
    $onclick = " onclick=\"var f=document.getElementById('folding_{$id}');var s=f.style.display=='block';" . "f.style.display=s?'none':'block';this.className=s?'':'opened';\"";
    return <<<HERE
<div class="folding-area{$class}">
<dl class="folding">
<dt{$onclick}{$opened}>{$title}</dt>
<dd id="folding_{$id}" style="display:{$init_state};">{$out}</dd>
</dl>
</div>
HERE;
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:54,代码来源:folding.php

示例2: do_new

function do_new($formatter, $options)
{
    global $DBInfo;
    if (!$options['value']) {
        $title = _("Create a new page");
        $formatter->send_header("", $options);
        $formatter->send_title($title, "", $options);
        $url = $formatter->link_url($formatter->page->urlname);
        if ($DBInfo->hasPage('MyNewPage')) {
            $p = $DBInfo->getPage('MyNewPage');
            $f = new Formatter($p, $options);
            $f->use_rating = 0;
            $f->send_page('', $options);
        }
        $msg = _("Page Name");
        $fixname = _("Normalize this page name");
        $btn = _("Create a new page");
        print <<<FORM
<div class='addPage'>
<form method='get' action='{$url}'>
<table style='border:0'><tr><th class='addLabel'><labe>{$msg}: </label></th><td><input type='hidden' name='action' value='new' />
    <input name='value' size='30' /></td></tr>
<tr><th class='addLabel'><input type='checkbox' name='fixname' checked='checked' /></th><td>{$fixname}</td></tr>
<td></td><td><input type='submit' value='{$btn}' /></td>
</tr></table>
    </form>
</div>
FORM;
        $formatter->send_footer();
    } else {
        $pgname = $options['value'];
        if ($options['fixname']) {
            $pgname = normalize($pgname);
        }
        $options['page'] = $pgname;
        $page = new WikiPage($pgname);
        $f = new Formatter($page, $options);
        do_edit($f, $options);
        return true;
    }
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:41,代码来源:new.php

示例3: generate_item

function generate_item($formatter, $log)
{
    global $DBInfo;
    list($page, $user, $date, $title, $summary) = $log;
    if (!$title) {
        return "";
    }
    $url = qualifiedUrl($formatter->link_url(_urlencode($page)));
    /* perma link */
    $tag = md5($user . ' ' . $date . ' ' . $title);
    /* RFC 822 date format for RSS 2.0 */
    $date[10] = ' ';
    $pubDate = gmdate('D, j M Y H:i:s T', strtotime(substr($date, 0, 19) . ' GMT'));
    /* description */
    if ($summary) {
        $p = new WikiPage($page);
        $f = new Formatter($p);
        $summary = str_replace('\\}}}', '}}}', $summary);
        ob_start();
        $f->send_page($summary, array('fixpath' => 1, 'nojavascript' => 1));
        $description = '<description><![CDATA[' . ob_get_contents() . ']]></description>';
        ob_end_clean();
    }
    /* convert special characters into HTML entities */
    $title = htmlspecialchars($title);
    return <<<ITEM
<item>
  <title>{$title}</title>
  <link>{$url}#{$tag}</link>
  <guid isPermaLink="true">{$url}#{$tag}</guid>
  {$description}
  <pubDate>{$pubDate}</pubDate>
  <author>{$user}</author>
  <category domain="{$url}">{$page}</category>
  <comments><![CDATA[{$url}?action=blog&value={$tag}#BlogComment]]></comments>
</item>

ITEM;
}
开发者ID:NessunKim,项目名称:MW_Skins,代码行数:39,代码来源:rss_blog.php

示例4: macro_Include


//.........这里部分代码省略.........
                // check some built-in vars
                // set style or class
                if (in_array($key, array('style', 'class', 'debug'))) {
                    if (empty($val)) {
                        continue;
                    }
                    if ($key == 'style') {
                        $styles[] = $val;
                    } else {
                        if ($key == 'class') {
                            $class .= ' ' . $val;
                        } else {
                            $debug = true;
                        }
                    }
                    continue;
                }
                if (empty($key) and $i < 3) {
                    if ($i == 1) {
                        $title = $val;
                    } else {
                        $level = intval($val);
                    }
                    $i++;
                    continue;
                }
                if (!empty($key)) {
                    $vars[$key] = $val;
                } else {
                    $vars[$i] = $val;
                }
                $i++;
            } else {
                break;
            }
        }
    }
    if (!isset($pagename[0])) {
        return '';
    }
    // empty page
    // out debug msg;
    $msg = '';
    if ($debug) {
        ob_start();
        var_dump($vars);
        $msg = ob_get_contents();
        ob_end_clean();
    }
    // set title
    if (isset($title[0]) && $title[0] != '=') {
        if (empty($level) || $level > 5) {
            $level = 3;
        }
        $tag = str_repeat('=', $level);
        $title = $tag . ' ' . $title . ' ' . $tag;
    }
    if ($DBInfo->hasPage($pagename)) {
        // default class for template
        if (!empty($vars)) {
            $class .= ' template';
        }
        // add some default variables
        if (!isset($vars['pagename'])) {
            $vars['pagename'] = $formatter->page->name;
        }
        $repl = new _localDict($vars);
        $page = $DBInfo->getPage($pagename);
        $f = new Formatter($page);
        // for recursion detect
        $f->recursion = isset($formatter->recursion) ? $formatter->recursion + 1 : 1;
        $body = $page->_get_raw_body();
        // get raw body
        // mediawiki like replace variables
        // @foo@ or @foo[separator]default value@ are accepted
        // the separator can be space , and |
        $body = $repl->replace('/@([a-z0-9_-]+)(?:(?:,|\\|)((?!\\s)(?:[^@]|@@)*(?!\\s)))?@/', $body);
        if (isset($title[0])) {
            $body = $title . "\n" . $body;
        }
        $params['nosisters'] = 1;
        $f->get_javascripts();
        // trash default javascripts
        ob_start();
        $f->pi['#linenum'] = 0;
        // FIXME
        $f->send_page($body, $params);
        $out = ob_get_contents();
        ob_end_clean();
        if (!empty($class)) {
            $class = ' class="' . $class . '"';
        }
        if (!empty($styles)) {
            $style = ' style="' . implode(';', $styles) . '"';
        }
        return '<div' . $class . $style . '>' . $msg . $out . '</div>';
    } else {
        return $formatter->link_repl($pagename);
    }
}
开发者ID:NessunKim,项目名称:MW_Skins,代码行数:101,代码来源:Include.php

示例5: do_rss_rc


//.........这里部分代码省略.........
    }
    foreach ($lines as $line) {
        $parts = explode("\t", $line);
        $page_name = $DBInfo->keyToPagename($parts[0]);
        // hide log
        if (!empty($members) && !in_array($options['id'], $members) && !empty($Config['ruleset']['hidelog'])) {
            if (in_array($page_name, $Config['ruleset']['hidelog'])) {
                continue;
            }
        }
        $addr = $parts[1];
        $ed_time = $parts[2];
        $user = $parts[4];
        $log = _stripslashes($parts[5]);
        $act = rtrim($parts[6]);
        #    if ($ed_time < $time_cutoff)
        #      break;
        $url = qualifiedUrl($formatter->link_url(_rawurlencode($page_name)));
        $diff_url = qualifiedUrl($formatter->link_url(_rawurlencode($page_name), '?action=diff'));
        $extra = "<br /><a href='{$diff_url}'>" . _("show changes") . "</a>\n";
        if (!$DBInfo->hasPage($page_name)) {
            $status = 'deleted';
            $html = '<![CDATA[' . "<a href='{$url}'>" . $page_name . "</a> is deleted" . ']]>' . "\n";
        } else {
            $status = 'updated';
            if (!empty($options['diffs'])) {
                $p = new WikiPage($page_name);
                $f = new Formatter($p);
                $options['raw'] = 1;
                $options['nomsg'] = 1;
                $html = $f->macro_repl('Diff', '', $options);
                if (!$html) {
                    ob_start();
                    $f->send_page('', array('fixpath' => 1));
                    #$f->send_page('');
                    $html = ob_get_contents();
                    ob_end_clean();
                    $extra = '';
                }
                $html = str_replace(']', '&#93;', $html);
                $html = "<![CDATA[" . $html . $extra . "]]>";
                #$html=strtr($html.$extra,array('&'=>'&amp;','<'=>'&lt;'));
            } else {
                if (!empty($options['summary'])) {
                    $p = new WikiPage($page_name);
                    $f = new Formatter($p);
                    $f->section_edit = 0;
                    $f->sister_on = 0;
                    $f->perma_icon = '';
                    $options['nomsg'] = 1;
                    $b = $p->_get_raw_body();
                    $chunks = preg_split('/\\n#{4,}/', $b);
                    # summary breaker is ####
                    ob_start();
                    if ($chunks) {
                        $f->send_page($chunks[0], array('fixpath' => 1));
                    } else {
                        $f->send_page('', array('fixpath' => 1));
                    }
                    #$f->send_page('');
                    $html = ob_get_contents();
                    ob_end_clean();
                    $chunks = preg_split('/<!-- break -->/', $html);
                    # <!-- break -->
                    if ($chunks[0]) {
                        $html = $chunks[0];
开发者ID:ahastudio,项目名称:moniwiki,代码行数:67,代码来源:rss_rc.php

示例6: do_rdf_blog

function do_rdf_blog($formatter, $options)
{
    global $DBInfo;
    #  if (!$options['date'] or !preg_match('/^\d+$/',$date)) $date=date('Ym');
    #  else $date=$options['date'];
    $date = $options['date'];
    if ($options['all']) {
        # check error and set default value
        $blog_rss = new Cache_text('blogrss');
        #    $blog_mtime=filemtime($DBInfo->cache_dir."/blog");
        #    if ($blog_rss->exists($date'.xml') and ($blog_rss->mtime($date.'.xml') > $blog_mtime)) {
        #      print $blog_rss->fetch($date.'.xml');
        #      return;
        #    }
        $blogs = Blog_cache::get_rc_blogs($date);
        $logs = Blog_cache::get_summary($blogs, $date);
        $rss_name = $DBInfo->sitename . ': ' . _("Blog Changes");
    } else {
        $blogs = array($DBInfo->pageToKeyname($formatter->page->name));
        $logs = Blog_cache::get_summary($blogs, $date);
        $rss_name = $formatter->page->name;
    }
    usort($logs, 'BlogCompare');
    $time_current = time();
    $URL = qualifiedURL($formatter->prefix);
    $img_url = qualifiedURL($DBInfo->logo_img);
    $url = qualifiedUrl($formatter->link_url("BlogChanges"));
    $desc = sprintf(_("BlogChanges at %s"), $DBInfo->sitename);
    $channel = <<<CHANNEL
<channel rdf:about="{$URL}">
  <title>{$rss_name}</title>
  <link>{$url}</link>
  <description>{$desc}</description>
  <image rdf:resource="{$img_url}"/>
  <items>
  <rdf:Seq>
CHANNEL;
    $items = "";
    #          print('<description>'."[$data] :".$chg["action"]." ".$chg["pageName"].$comment.'</description>'."\n");
    #          print('</rdf:li>'."\n");
    #        }
    $ratchet_day = FALSE;
    if (!$logs) {
        $logs = array();
    }
    foreach ($logs as $log) {
        #print_r($log);
        list($page, $user, $date, $title, $summary) = $log;
        $url = qualifiedUrl($formatter->link_url(_urlencode($page)));
        if (!$title) {
            continue;
        }
        #$tag=md5("#!blog ".$line);
        $tag = md5($user . " " . $date . " " . $title);
        #$tag=_rawurlencode(normalize($title));
        $channel .= "    <rdf:li rdf:resource=\"{$url}#{$tag}\"/>\n";
        $items .= "     <item rdf:about=\"{$url}#{$tag}\">\n";
        $items .= "     <title>{$title}</title>\n";
        $items .= "     <link>{$url}#{$tag}</link>\n";
        if ($summary) {
            $p = new WikiPage($page);
            $f = new Formatter($p);
            ob_start();
            #$f->send_page($summary);
            $f->send_page($summary, array('fixpath' => 1));
            #$summary=_html_escape(ob_get_contents());
            $summary = '<![CDATA[' . ob_get_contents() . ']]>';
            ob_end_clean();
            $items .= "     <description>{$summary}</description>\n";
        }
        $items .= "     <dc:date>{$date}+00:00</dc:date>\n";
        $items .= "     <dc:contributor>\n<rdf:Description>\n" . "<rdf:value>{$user}</rdf:value>\n" . "</rdf:Description>\n</dc:contributor>\n";
        $items .= "     </item>\n";
    }
    $url = qualifiedUrl($formatter->link_url($DBInfo->frontpage));
    $channel .= <<<FOOT
    </rdf:Seq>
  </items>
</channel>
<image rdf:about="{$img_url}">
<title>{$DBInfo->sitename}</title>
<link>{$url}</link>
<url>{$img_url}</url>
</image>
FOOT;
    $url = qualifiedUrl($formatter->link_url("FindPage"));
    $form = <<<FORM
<textinput>
<title>Search</title>
<link>{$url}</link>
<name>goto</name>
</textinput>
FORM;
    $new = "";
    if ($options['oe'] and strtolower($options['oe']) != $DBInfo->charset) {
        $charset = $options['oe'];
        if (function_exists('iconv')) {
            $out = $head . $channel . $items . $form;
            $new = iconv($DBInfo->charset, $charset, $out);
            if (!$new) {
//.........这里部分代码省略.........
开发者ID:ahastudio,项目名称:moniwiki,代码行数:101,代码来源:rdf_blog.php

示例7: render

function render($pagename, $type, $params = array())
{
    global $DBInfo;
    $p = $DBInfo->getPage($pagename);
    $opts = array();
    // parameters for mdict
    if ($type == 'mdict') {
        $opts = array('prefix' => 'entry:/');
    }
    $formatter = new Formatter($p, $opts);
    if (isset($params['filters'])) {
        $formatter->filters = $params['filters'];
    }
    // trash javascripts
    $formatter->get_javascripts();
    // init wordrule
    if (empty($formatter->wordrule)) {
        $formatter->set_wordrule();
    }
    // render
    ob_start();
    $formatter->send_page();
    flush();
    $out = ob_get_contents();
    ob_end_clean();
    // filter for mdict
    if ($type == 'mdict') {
        return $formatter->postfilter_repl('mdict', $out);
    } else {
        return $out;
    }
}
开发者ID:sedrion,项目名称:moniwiki,代码行数:32,代码来源:render.php

示例8: do_atom

function do_atom($formatter, $options)
{
    global $DBInfo;
    global $_release;
    define('ATOM_DEFAULT_DAYS', 7);
    $days = $DBInfo->rc_days ? $DBInfo->rc_days : ATOM_DEFAULT_DAYS;
    $options['quick'] = 1;
    if ($options['c']) {
        $options['items'] = $options['c'];
    }
    $lines = $DBInfo->editlog_raw_lines($days, $options);
    $time_current = time();
    #  $secs_per_day= 60*60*24;
    #  $days_to_show= 30;
    #  $time_cutoff= $time_current - ($days_to_show * $secs_per_day);
    $URL = qualifiedURL($formatter->prefix);
    $img_url = qualifiedURL($DBInfo->logo_img);
    $url = qualifiedUrl($formatter->link_url($DBInfo->frontpage));
    $surl = qualifiedUrl($formatter->link_url($options['page'] . '?action=atom'));
    $channel = <<<CHANNEL
  <title>{$DBInfo->sitename}</title>
  <link href="{$url}"></link>
  <link rel="self" type="application/atom+xml" href="{$surl}" />
  <subtitle>RecentChanges at {$DBInfo->sitename}</subtitle>
  <generator version="{$_release}">MoniWiki Atom feeder</generator>

CHANNEL;
    $items = "";
    $ratchet_day = FALSE;
    if (!$lines) {
        $lines = array();
    }
    foreach ($lines as $line) {
        $parts = explode("\t", $line);
        $page_name = $DBInfo->keyToPagename($parts[0]);
        $addr = $parts[1];
        $ed_time = $parts[2];
        $user = $parts[4];
        $user_uri = '';
        if ($DBInfo->hasPage($user)) {
            $user_uri = $formatter->link_url(_rawurlencode($user), "", $user);
            $user_uri = '<uri>' . $user_uri . '</uri>';
        }
        $log = _stripslashes($parts[5]);
        $act = rtrim($parts[6]);
        $url = qualifiedUrl($formatter->link_url(_rawurlencode($page_name)));
        $diff_url = qualifiedUrl($formatter->link_url(_rawurlencode($page_name), '?action=diff'));
        $extra = "<br /><a href='{$diff_url}'>" . _("show changes") . "</a>\n";
        $content = '';
        if (!$DBInfo->hasPage($page_name)) {
            $status = 'deleted';
            $content = "<content type='html'><a href='{$url}'>{$page_name}</a> is deleted</content>\n";
        } else {
            $status = 'updated';
            if ($options['diffs']) {
                $p = new WikiPage($page_name);
                $f = new Formatter($p);
                $options['raw'] = 1;
                $options['nomsg'] = 1;
                $html = $f->macro_repl('Diff', '', $options);
                if (!$html) {
                    ob_start();
                    $f->send_page('', array('fixpath' => 1));
                    #$f->send_page('');
                    $html = ob_get_contents();
                    ob_end_clean();
                    $extra = '';
                }
                $content = "  <content type='xhtml'><div xmlns='http://www.w3.org/1999/xhtml'>{$html}</content>\n";
            } else {
                if ($log) {
                    $html = str_replace('&', '&amp;', $log);
                    $content = "<content type='text'>" . $html . "</content>\n";
                } else {
                    $content = "<content type='text'>updated</content>\n";
                }
            }
        }
        $zone = '+00:00';
        $date = gmdate("Y-m-d\\TH:i:s", $ed_time) . $zone;
        if (!isset($updated)) {
            $updated = $date;
        }
        #$datetag = gmdate("YmdHis",$ed_time);
        $valid_page_name = str_replace('&', '&amp;', $page_name);
        $items .= "<entry>\n";
        $items .= "  <title>{$valid_page_name}</title>\n";
        $items .= "  <link href='{$url}'></link>\n";
        $items .= '  ' . $content;
        $items .= "  <author><name>{$user}</name>{$user_uri}</author>\n";
        $items .= "  <updated>{$date}</updated>\n";
        $items .= "  <contributor><name>{$user}</name>{$user_uri}</contributor>\n";
        $items .= "</entry>\n";
    }
    $updated = "  <updated>{$updated}</updated>\n";
    $new = "";
    if ($options['oe'] and strtolower($options['oe']) != $DBInfo->charset) {
        $charset = $options['oe'];
        if (function_exists('iconv')) {
            $out = $head . $channel . $items . $form;
//.........这里部分代码省略.........
开发者ID:NessunKim,项目名称:MW_Skins,代码行数:101,代码来源:atom.php

示例9: do_atom


//.........这里部分代码省略.........
        // hide log
        if (!empty($members) && !in_array($options['id'], $members) && !empty($Config['ruleset']['hidelog'])) {
            if (in_array($page_name, $Config['ruleset']['hidelog'])) {
                continue;
            }
        }
        $addr = $parts[1];
        $ed_time = $parts[2];
        $user = $parts[4];
        $user_uri = '';
        if ($user != 'Anonymous' && $DBInfo->hasPage($user)) {
            $user_uri = $formatter->link_url(_rawurlencode($user), "", $user);
            $user_uri = '<uri>' . $user_uri . '</uri>';
        }
        $log = _stripslashes($parts[5]);
        $act = rtrim($parts[6]);
        $url = qualifiedUrl($formatter->link_url(_rawurlencode($page_name)));
        $diff_url = qualifiedUrl($formatter->link_url(_rawurlencode($page_name), '?action=diff'));
        $extra = "<br /><a href='{$diff_url}'>" . _("show changes") . "</a>\n";
        $content = '';
        if (!$DBInfo->hasPage($page_name)) {
            $status = 'deleted';
            $content = "<content type='html'><a href='{$url}'>{$page_name}</a> is deleted</content>\n";
        } else {
            $status = 'updated';
            if ($options['diffs']) {
                $p = new WikiPage($page_name);
                $f = new Formatter($p);
                $options['raw'] = 1;
                $options['nomsg'] = 1;
                $html = $f->macro_repl('Diff', '', $options);
                if (!$html) {
                    ob_start();
                    $f->send_page('', array('fixpath' => 1));
                    #$f->send_page('');
                    $html = ob_get_contents();
                    ob_end_clean();
                    $extra = '';
                }
                $content = "  <content type='xhtml'><div xmlns='http://www.w3.org/1999/xhtml'>{$html}</content>\n";
            } else {
                if ($log) {
                    $html = str_replace('&', '&amp;', $log);
                    $content = "<content type='text'>" . $html . "</content>\n";
                } else {
                    $content = "<content type='text'>updated</content>\n";
                }
            }
        }
        $zone = '+00:00';
        $date = gmdate("Y-m-d\\TH:i:s", $ed_time) . $zone;
        if (!isset($updated)) {
            $updated = $date;
        }
        #$datetag = gmdate("YmdHis",$ed_time);
        $valid_page_name = str_replace('&', '&amp;', $page_name);
        $items .= "<entry>\n";
        $items .= "  <title>{$valid_page_name}</title>\n";
        $items .= "  <link href='{$url}'></link>\n";
        $items .= '  ' . $content;
        $items .= "  <author><name>{$user}</name>{$user_uri}</author>\n";
        $items .= "  <updated>{$date}</updated>\n";
        $items .= "  <contributor><name>{$user}</name>{$user_uri}</contributor>\n";
        $items .= "</entry>\n";
    }
    $updated = "  <updated>{$updated}</updated>\n";
开发者ID:ahastudio,项目名称:moniwiki,代码行数:67,代码来源:atom.php


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