本文整理汇总了PHP中HTML::p方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::p方法的具体用法?PHP HTML::p怎么用?PHP HTML::p使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::p方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
extract($args);
if (empty($page)) {
return '';
}
$backend =& $dbi->_backend;
$html = HTML(HTML::h3(fmt("Querying backend directly for '%s'", $page)));
$table = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0));
$pagedata = $backend->get_pagedata($page);
if (!$pagedata) {
// FIXME: invalid HTML
$html->pushContent(HTML::p(fmt("No pagedata for %s", $page)));
} else {
$this->_fixupData($pagedata);
$table->pushContent($this->_showhash("get_pagedata('{$page}')", $pagedata));
}
for ($version = $backend->get_latest_version($page); $version; $version = $backend->get_previous_version($page, $version)) {
$vdata = $backend->get_versiondata($page, $version, true);
$this->_fixupData($vdata);
$table->pushContent(HTML::tr(HTML::td(array('colspan' => 2))));
$table->pushContent($this->_showhash("get_versiondata('{$page}',{$version})", $vdata));
}
$html->pushContent($table);
return $html;
}
示例2: displayLongDescription
/**
* Display long description
*/
protected function displayLongDescription()
{
echo HTML::p(__('This plugin lists all your races. It shows you a summary of all your races and ' . 'your personal bests (over all distances with at least two results).'));
echo HTML::p(__('In addition, it plots the trend of your results over a specific distance.' . 'If you run a race just for fun, you can mark it as a \'fun race\' to ignore it in the plot.'));
echo HTML::info(__('You can define the activity type for races in your configuration.'));
echo HTML::warning(__('Make sure that your activities hold the correct distance.' . 'Only races with exactly 10.00 km will be considered as a race over 10 kilometers.'));
}
示例3: PurgePage
function PurgePage(&$request)
{
global $WikiTheme;
$page = $request->getPage();
$pagelink = WikiLink($page);
if ($request->getArg('cancel')) {
$request->redirect(WikiURL($page));
// noreturn
}
$current = $page->getCurrentRevision();
if (!$current or !($version = $current->getVersion())) {
$html = HTML::p(array('class' => 'error'), _("Sorry, this page does not exist."));
} elseif (!$request->isPost() || !$request->getArg('verify')) {
$purgeB = Button('submit:verify', _("Purge Page"), 'wikiadmin');
$cancelB = Button('submit:cancel', _("Cancel"), 'button');
// use generic wiki button look
$fieldset = HTML::fieldset(HTML::p(fmt("You are about to purge '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'purge')), HTML::div(array('class' => 'toolbar'), $purgeB, $WikiTheme->getButtonSeparator(), $cancelB)));
$sample = HTML::div(array('class' => 'transclusion'));
// simple and fast preview expanding only newlines
foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
$sample->pushContent($s, HTML::br());
}
$html = HTML($fieldset, HTML::div(array('class' => 'wikitext'), $sample));
} elseif ($request->getArg('currentversion') != $version) {
$html = HTML(HTML::p(array('class' => 'error'), _("Someone has edited the page!")), HTML::p(fmt("Since you started the purge process, someone has saved a new version of %s. Please check to make sure you still want to permanently purge the page from the database.", $pagelink)));
} else {
// Real purge.
$pagename = $page->getName();
$dbi = $request->getDbh();
$dbi->purgePage($pagename);
$dbi->touch();
$html = HTML::div(array('class' => 'feedback'), fmt("Purged page '%s' successfully.", $pagename));
}
GeneratePage($html, _("Purge Page"));
}
示例4: displayLongDescription
/**
* Display long description
*/
protected function displayLongDescription()
{
echo HTML::p(__('This plugin tracks your distances for chosen time ranges.'));
echo HTML::p(__('You can set a goal (value > 0) for every time range. If it is set, you will see how much you have to run to reach it.'));
echo HTML::p(__('A virtual Pace Bunny <em>reaches</em> the goal with a steady performance - you can see how far you are ahead or behind.'));
echo HTML::p(__('Note: "Saison" refers to the current season in the german "kmspiel".'));
}
示例5: run
function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
$rss_parser = new RSSParser();
if (!empty($url)) {
$rss_parser->parse_url($url, $debug);
}
if (!empty($rss_parser->channel['title'])) {
$feed = $rss_parser->channel['title'];
}
if (!empty($rss_parser->channel['link'])) {
$url = $rss_parser->channel['link'];
}
if (!empty($rss_parser->channel['description'])) {
$description = $rss_parser->channel['description'];
}
if (!empty($feed)) {
if (!empty($url)) {
$titre = HTML::span(HTML::a(array('href' => $rss_parser->channel['link']), $rss_parser->channel['title']));
} else {
$titre = HTML::span($rss_parser->channel['title']);
}
$th = HTML::div(array('class' => 'feed'), $titre);
if (!empty($description)) {
$th->pushContent(HTML::p(array('class' => 'chandesc'), HTML::raw($description)));
}
} else {
$th = HTML();
}
if (!empty($rss_parser->channel['date'])) {
$th->pushContent(HTML::raw("<!--" . $rss_parser->channel['date'] . "-->"));
}
$html = HTML::div(array('class' => 'rss'), $th);
if ($rss_parser->items) {
// only maxitem's
if ($maxitem > 0) {
$rss_parser->items = array_slice($rss_parser->items, 0, $maxitem);
}
foreach ($rss_parser->items as $item) {
$cell = HTML::div(array('class' => 'rssitem'));
if ($item['link'] and empty($item['title'])) {
$item['title'] = $item['link'];
}
$cell_title = HTML::div(array('class' => 'itemname'), HTML::a(array('href' => $item['link']), HTML::raw($item['title'])));
$cell->pushContent($cell_title);
if (!empty($item['description'])) {
$cell->pushContent(HTML::div(array('class' => 'itemdesc'), HTML::raw($item['description'])));
}
$html->pushContent($cell);
}
} else {
$html = HTML::div(array('class' => 'rss'), HTML::em(_("no RSS items")));
}
if (!check_php_version(5)) {
$rss_parser->__destruct();
}
return $html;
}
示例6: displayLongDescription
/**
* Display long description
*/
protected function displayLongDescription()
{
echo HTML::p(__('There are different models that can be used to predict your race performances:'));
echo HTML::fileBlock('<strong>Jack Daniels (VDOT, \'Running formula\')</strong><br>' . __('Your current VDOT is estimated based on the ratio of heart rate and pace. ' . 'This value is equivalent to specific performances.'));
echo HTML::fileBlock('<strong>Robert Bock (CPP, \'Competitive Performance Predictor\')</strong><br>' . __('Robert Bock uses an individual coefficient for your fatigue over time/distance. ' . 'This model uses your two best results.') . '<br>' . '<small>see <a href="http://www.robert-bock.de/Sport_0/lauf_7/cpp/cpp.html">http://www.robert-bock.de/Sport_0/lauf_7/cpp/cpp.html</a></small>');
echo HTML::fileBlock('<strong>Herbert Steffny (\'Das große Laufbuch\')</strong><br>' . __('Herbert Steffny uses fixed factors to transform performances from one distance to another. ' . 'This model uses your best result.'));
echo HTML::fileBlock('<strong>David Cameron</strong><br>' . __('David Cameron uses a fixed coefficient for the fatigue over time/distance and slightly different formulas than Robert Bock. ' . 'This model uses your best result.') . '<br>' . '<small>see <a href="http://www.infobarrel.com/Runners_Math_How_to_Predict_Your_Race_Time">http://www.infobarrel.com/Runners_Math_How_to_Predict_Your_Race_Time</a></small>');
echo HTML::info(__('The VDOT model is the only one which considers your current shape. ' . 'The other models are based on your previous race results.'));
}
示例7: RemovePage
function RemovePage(&$request)
{
global $WikiTheme;
$page = $request->getPage();
$pagelink = WikiLink($page);
if ($request->getArg('cancel')) {
$request->redirect(WikiURL($page));
// noreturn
}
$current = $page->getCurrentRevision();
if (!$current or !($version = $current->getVersion())) {
$html = HTML(HTML::h2(_("Already deleted")), HTML::p(_("Sorry, this page is not in the database.")));
} elseif (!$request->isPost() || !$request->getArg('verify')) {
$removeB = Button('submit:verify', _("Remove Page"), 'wikiadmin');
$cancelB = Button('submit:cancel', _("Cancel"), 'button');
// use generic wiki button look
$html = HTML(HTML::h2(fmt("You are about to remove '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'remove')), HTML::div(array('class' => 'toolbar'), $removeB, $WikiTheme->getButtonSeparator(), $cancelB)), HTML::hr());
$sample = HTML::div(array('class' => 'transclusion'));
// simple and fast preview expanding only newlines
foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
$sample->pushContent($s, HTML::br());
}
$html->pushContent(HTML::div(array('class' => 'wikitext'), $sample));
} elseif ($request->getArg('currentversion') != $version) {
$html = HTML(HTML::h2(_("Someone has edited the page!")), HTML::p(fmt("Since you started the deletion process, someone has saved a new version of %s. Please check to make sure you still want to permanently remove the page from the database.", $pagelink)));
} else {
// Codendi specific: remove the deleted wiki page from ProjectWantedPages
$projectPageName = 'ProjectWantedPages';
$pagename = $page->getName();
$dbi = $request->getDbh();
require_once PHPWIKI_DIR . "/lib/loadsave.php";
$pagehandle = $dbi->getPage($projectPageName);
if ($pagehandle->exists()) {
// don't replace default contents
$current = $pagehandle->getCurrentRevision();
$version = $current->getVersion();
$text = $current->getPackedContent();
$meta = $current->_data;
}
$text = str_replace("* [{$pagename}]", "", $text);
$meta['summary'] = $GLOBALS['Language']->getText('wiki_lib_wikipagewrap', 'page_added', array($pagename));
$meta['author'] = user_getname();
$pagehandle->save($text, $version + 1, $meta);
//Codendi specific: remove permissions for this page @codenditodo: may be transferable otherwhere.
require_once 'common/wiki/lib/WikiPage.class.php';
$wiki_page = new WikiPage(GROUP_ID, $_REQUEST['pagename']);
$wiki_page->resetPermissions();
// Real delete.
//$pagename = $page->getName();
$dbi = $request->getDbh();
$dbi->deletePage($pagename);
$dbi->touch();
$link = HTML::a(array('href' => 'javascript:history.go(-2)'), _("Back to the previous page."));
$html = HTML(HTML::h2(fmt("Removed page '%s' successfully.", $pagename)), HTML::div($link), HTML::hr());
}
GeneratePage($html, _("Remove Page"));
}
示例8: displayExporterList
/**
* Display list
*/
protected function displayExporterList()
{
$ListView = new ExporterListView();
$ListView->display();
$this->displayPrivacyInfo();
echo HTML::p('');
$this->displayExportedFiles();
Filesystem::checkWritePermissions('inc/export/files/');
}
示例9: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
extract($args);
if (empty($page)) {
return $this->error("page missing");
}
$backend =& $dbi->_backend;
$this->chunk_split = true;
$this->readonly_pagemeta = array();
$this->hidden_pagemeta = array('_cached_html');
$html = HTML(HTML::h3(fmt("Querying backend directly for '%s'", $page)));
$table = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0));
$pagedata = $backend->get_pagedata($page);
if (!$pagedata) {
// FIXME: invalid HTML
$html->pushContent(HTML::p(fmt("No pagedata for %s", $page)));
} else {
$this->_fixupData($pagedata);
$table->pushContent($this->_showhash("get_pagedata('{$page}')", $pagedata));
}
if (!$notallversions) {
$version = $backend->get_latest_version($page);
$vdata = $backend->get_versiondata($page, $version, true);
$this->_fixupData($vdata);
$table->pushContent(HTML::tr(HTML::td(array('colspan' => 2))));
$table->pushContent($this->_showhash("get_versiondata('{$page}',{$version})", $vdata));
} else {
for ($version = $backend->get_latest_version($page); $version; $version = $backend->get_previous_version($page, $version)) {
$vdata = $backend->get_versiondata($page, $version, true);
$this->_fixupData($vdata);
$table->pushContent(HTML::tr(HTML::td(array('colspan' => 2))));
$table->pushContent($this->_showhash("get_versiondata('{$page}',{$version})", $vdata));
}
}
$linkdata = $backend->get_links($page, false);
if ($linkdata->count()) {
$table->pushContent($this->_showhash("get_links('{$page}')", $linkdata->asArray()));
}
$relations = $backend->get_links($page, false, false, false, false, false, true);
if ($relations->count()) {
$table->pushContent($this->_showhash("get_relations('{$page}')", array()));
while ($rel = $relations->next()) {
$table->pushContent($this->_showhash(false, $rel));
}
}
$linkdata = $backend->get_links($page, true);
if ($linkdata->count()) {
$table->pushContent($this->_showhash("get_backlinks('{$page}')", $linkdata->asArray()));
}
$html->pushContent($table);
return $html;
}
示例10: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if ($args['basepage']) {
$pagename = $args['basepage'];
} else {
$pagename = $request->getArg('pagename');
}
// FIXME: explodePageList from stdlib doesn't seem to work as
// expected when there are no subpages. (see also
// UnfoldSubPages plugin)
$subpages = explodePageList($pagename . SUBPAGE_SEPARATOR . '*');
if (!$subpages) {
return $this->error(_("The current page has no subpages defined."));
}
extract($args);
$content = HTML();
//$subpages = array_reverse($subpages); // TODO: why?
if ($maxpages) {
$subpages = array_slice($subpages, 0, $maxpages);
}
$descrip = fmt("SubPages of %s:", WikiLink($pagename, 'auto'));
if ($info) {
$info = explode(",", $info);
if (in_array('count', $info)) {
$args['types']['count'] = new _PageList_Column_ListSubpages_count('count', _("#"), 'center');
}
}
$pagelist = new PageList($info, $exclude, $args);
if (!$noheader) {
$pagelist->setCaption($descrip);
}
foreach ($subpages as $page) {
// A page cannot include itself. Avoid doublettes.
static $included_pages = array();
if (in_array($page, $included_pages)) {
$content->pushContent(HTML::p(sprintf(_("recursive inclusion of page %s ignored"), $page)));
continue;
}
array_push($included_pages, $page);
//if ($relative) {
// TODO: add relative subpage name display to PageList class
//}
$pagelist->addPage($page);
array_pop($included_pages);
}
$content->pushContent($pagelist);
return $content;
}
示例11: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
extract($args);
$output = HTML(HTML::h1("Group Info"));
$group = WikiGroup::getGroup();
$allGroups = $group->getAllGroupsIn();
foreach ($allGroups as $g) {
$members = $group->getMembersOf($g);
$output->pushContent(HTML::h3($g . " - members: " . sizeof($members) . " - isMember: " . ($group->isMember($g) ? "yes" : "no")));
foreach ($members as $m) {
$output->pushContent($m);
$output->pushContent(HTML::br());
}
}
$output->pushContent(HTML::p("--- the end ---"));
return $output;
}
示例12: run
function run($dbi, $argstr, &$request, $basepage)
{
global $WikiTheme;
$args = $this->getArgs($argstr, $request, false);
$page =& $args['page'];
if (ENABLE_AJAX) {
if ($args['state']) {
$html = WikiPlugin_IncludePage::run($dbi, $argstr, $request, $basepage);
} else {
$html = HTML(HTML::p(array('class' => 'transclusion-title'), fmt(" %s :", WikiLink($page))), HTML::div(array('class' => 'transclusion'), ''));
}
$ajaxuri = WikiURL($page, array('format' => 'xml'));
} else {
$html = WikiPlugin_IncludePage::run($dbi, $argstr, $request, $basepage);
}
$header = $html->_content[0];
$body = $html->_content[1];
$id = 'DynInc-' . MangleXmlIdentifier($page);
$body->setAttr('id', $id . '-body');
$png = $WikiTheme->_findData('images/folderArrow' . ($args['state'] ? 'Open' : 'Closed') . '.png');
$icon = HTML::img(array('id' => $id . '-img', 'src' => $png, 'onclick' => ENABLE_AJAX ? "showHideAsync('" . $ajaxuri . "','{$id}')" : "showHideFolder('{$id}')", 'alt' => _("Click to hide/show"), 'title' => _("Click to hide/show")));
$header = HTML::p(array('class' => 'transclusion-title', 'style' => "text-decoration: none;"), $icon, fmt(" %s :", WikiLink($page)));
if ($args['state']) {
// show base
$body->setAttr('style', 'display:block');
return HTML($header, $body);
} else {
// do not show base
$body->setAttr('style', 'display:none');
if (ENABLE_AJAX) {
return HTML($header, $body);
} else {
return HTML($header, $body);
}
// sync (load but display:none)
}
}
示例13: run
function run($dbi, $argstr, &$request, $basepage)
{
$this->allowed_extensions = explode("\n", "7z\navi\nbmp\nbz2\nc\ncfg\ndiff\ndoc\ndocx\nflv\ngif\nh\nics\nini\njpeg\njpg\nkmz\nmp3\nodg\nodp\nods\nodt\nogg\npatch\npdf\npng\nppt\npptx\nrar\nsvg\ntar\ntar.gz\ntxt\nxls\nxlsx\nxml\nxsd\nzip");
$this->disallowed_extensions = explode("\n", "ad[ep]\nasd\nba[st]\nchm\ncmd\ncom\ncgi\ncpl\ncrt\ndll\neml\nexe\nhlp\nhta\nin[fs]\nisp\njse?\nlnk\nmd[betw]\nms[cipt]\nnws\nocx\nops\npcd\np[ir]f\nphp\\d?\nphtml\npl\npy\nreg\nsc[frt]\nsh[bsm]?\nswf\nurl\nvb[esx]?\nvxd\nws[cfh]");
//removed "\{[[:xdigit:]]{8}(?:-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}\}"
$args = $this->getArgs($argstr, $request);
extract($args);
$file_dir = getUploadFilePath();
$file_dir .= "/";
$form = HTML::form(array('action' => $request->getPostURL(), 'enctype' => 'multipart/form-data', 'method' => 'post'));
$contents = HTML::div(array('class' => 'wikiaction'));
$contents->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => MAX_UPLOAD_SIZE)));
$contents->pushContent(HTML::input(array('name' => 'userfile', 'type' => 'file', 'size' => $size)));
if ($mode == 'edit') {
$contents->pushContent(HTML::input(array('name' => 'action', 'type' => 'hidden', 'value' => 'edit')));
$contents->pushContent(HTML::raw(" "));
$contents->pushContent(HTML::input(array('value' => _("Upload"), 'name' => 'edit[upload]', 'type' => 'submit')));
} else {
$contents->pushContent(HTML::raw(" "));
$contents->pushContent(HTML::input(array('value' => _("Upload"), 'type' => 'submit')));
}
$form->pushContent($contents);
$message = HTML();
if ($request->isPost() and $this->only_authenticated) {
// Make sure that the user is logged in.
$user = $request->getUser();
if (!$user->isAuthenticated()) {
if (defined('FUSIONFORGE') and FUSIONFORGE) {
$message->pushContent(HTML::div(array('class' => 'error'), HTML::p(_("You cannot upload files.")), HTML::ul(HTML::li(_("Check you are logged in.")), HTML::li(_("Check you are in the right project.")), HTML::li(_("Check you are a member of the current project.")))));
} else {
$message->pushContent(HTML::div(array('class' => 'error'), HTML::p(_("ACCESS DENIED: You must log in to upload files."))));
}
$result = HTML();
$result->pushContent($form);
$result->pushContent($message);
return $result;
}
}
$userfile = $request->getUploadedFile('userfile');
if ($userfile) {
$userfile_name = $userfile->getName();
$userfile_name = trim(basename($userfile_name));
if (UPLOAD_USERDIR) {
$file_dir .= $request->_user->_userid;
if (!file_exists($file_dir)) {
mkdir($file_dir, 0775);
}
$file_dir .= "/";
$u_userfile = $request->_user->_userid . "/" . $userfile_name;
} else {
$u_userfile = $userfile_name;
}
$u_userfile = preg_replace("/ /", "%20", $u_userfile);
$userfile_tmpname = $userfile->getTmpName();
$err_header = HTML::div(array('class' => 'error'), HTML::p(fmt("ERROR uploading '%s'", $userfile_name)));
if (preg_match("/(\\." . join("|\\.", $this->disallowed_extensions) . ")(\\.|\$)/i", $userfile_name)) {
$message->pushContent($err_header);
$message->pushContent(HTML::p(fmt("Files with extension %s are not allowed.", join(", ", $this->disallowed_extensions))));
} elseif (!DISABLE_UPLOAD_ONLY_ALLOWED_EXTENSIONS and !preg_match("/(\\." . join("|\\.", $this->allowed_extensions) . ")\$/i", $userfile_name)) {
$message->pushContent($err_header);
$message->pushContent(HTML::p(fmt("Only files with the extension %s are allowed.", join(", ", $this->allowed_extensions))));
} elseif (preg_match("/[^._a-zA-Z0-9- ]/", strip_accents($userfile_name))) {
$message->pushContent($err_header);
$message->pushContent(HTML::p(_("Invalid filename. File names may only contain alphanumeric characters and dot, underscore, space or dash.")));
} elseif (file_exists($file_dir . $userfile_name)) {
$message->pushContent($err_header);
$message->pushContent(HTML::p(fmt("There is already a file with name %s uploaded.", $u_userfile)));
} elseif ($userfile->getSize() > MAX_UPLOAD_SIZE) {
$message->pushContent($err_header);
$message->pushContent(HTML::p(_("Sorry but this file is too big.")));
} elseif (move_uploaded_file($userfile_tmpname, $file_dir . $userfile_name) or IsWindows() and rename($userfile_tmpname, $file_dir . $userfile_name)) {
$interwiki = new PageType_interwikimap();
$link = $interwiki->link("Upload:{$u_userfile}");
$message->pushContent(HTML::div(array('class' => 'feedback'), HTML::p(_("File successfully uploaded.")), HTML::p($link)));
// the upload was a success and we need to mark this event in the "upload log"
if ($logfile) {
$upload_log = $file_dir . basename($logfile);
$this->log($userfile, $upload_log, $message);
}
if ($autolink) {
require_once "lib/loadsave.php";
$pagehandle = $dbi->getPage($page);
if ($pagehandle->exists()) {
// don't replace default contents
$current = $pagehandle->getCurrentRevision();
$version = $current->getVersion();
$text = $current->getPackedContent();
$newtext = $text . "\n* Upload:{$u_userfile}";
// don't inline images
$meta = $current->_data;
$meta['summary'] = sprintf(_("uploaded %s"), $u_userfile);
$pagehandle->save($newtext, $version + 1, $meta);
}
}
} else {
$message->pushContent($err_header);
$message->pushContent(HTML::br(), _("Uploading failed."), HTML::br());
}
} else {
$message->pushContent(HTML::br(), _("No file selected. Please select one."), HTML::br());
//.........这里部分代码省略.........
示例14: format
function format($changes)
{
include_once 'lib/InlineParser.php';
$last_date = '';
$first = true;
$html = HTML();
$counter = 1;
$sp = HTML::Raw("\n · ");
while ($rev = $changes->next()) {
// enforce view permission
if (mayAccessPage('view', $rev->_pagename)) {
if ($link = $this->pageLink($rev)) {
// some entries may be empty
// (/Blog/.. interim pages)
$html->pushContent($sp, $link, HTML::br());
}
if ($first) {
$this->setValidators($rev);
}
$first = false;
}
}
if ($first) {
$html->pushContent(HTML::p(array('class' => 'rc-empty'), $this->empty_message()));
}
return $html;
}
示例15: run
function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
if (is_array($versions)) {
// Version selection from pageinfo.php display:
rsort($versions);
list($version, $previous) = $versions;
}
// abort if page doesn't exist
$page = $request->getPage($pagename);
$current = $page->getCurrentRevision();
if ($current->getVersion() < 1) {
$html = HTML(HTML::p(fmt("I'm sorry, there is no such page as %s.", WikiLink($pagename, 'unknown'))));
return $html;
//early return
}
if ($version) {
if (!($new = $page->getRevision($version))) {
NoSuchRevision($request, $page, $version);
}
$new_version = fmt("version %d", $version);
} else {
$new = $current;
$new_version = _("current version");
}
if (preg_match('/^\\d+$/', $previous)) {
if (!($old = $page->getRevision($previous))) {
NoSuchRevision($request, $page, $previous);
}
$old_version = fmt("version %d", $previous);
$others = array('major', 'minor', 'author');
} else {
switch ($previous) {
case 'author':
$old = $new;
while ($old = $page->getRevisionBefore($old)) {
if ($old->get('author') != $new->get('author')) {
break;
}
}
$old_version = _("revision by previous author");
$others = array('major', 'minor');
break;
case 'minor':
$previous = 'minor';
$old = $page->getRevisionBefore($new);
$old_version = _("previous revision");
$others = array('major', 'author');
break;
case 'major':
default:
$old = $new;
while ($old && $old->get('is_minor_edit')) {
$old = $page->getRevisionBefore($old);
}
if ($old) {
$old = $page->getRevisionBefore($old);
}
$old_version = _("predecessor to the previous major change");
$others = array('minor', 'author');
break;
}
}
$new_link = WikiLink($new, '', $new_version);
$old_link = $old ? WikiLink($old, '', $old_version) : $old_version;
$page_link = WikiLink($page);
$html = HTML(HTML::p(fmt("Differences between %s and %s of %s.", $new_link, $old_link, $page_link)));
$otherdiffs = HTML::p(_("Other diffs:"));
$label = array('major' => _("Previous Major Revision"), 'minor' => _("Previous Revision"), 'author' => _("Previous Author"));
foreach ($others as $other) {
$args = array('pagename' => $pagename, 'previous' => $other);
if ($version) {
$args['version'] = $version;
}
if (count($otherdiffs->getContent()) > 1) {
$otherdiffs->pushContent(", ");
} else {
$otherdiffs->pushContent(" ");
}
$otherdiffs->pushContent(Button($args, $label[$other]));
}
$html->pushContent($otherdiffs);
if ($old and $old->getVersion() == 0) {
$old = false;
}
$html->pushContent(HTML::Table($this->PageInfoRow(_("Newer page:"), $new, $request), $this->PageInfoRow(_("Older page:"), $old, $request)));
if ($new && $old) {
$diff = new Diff($old->getContent(), $new->getContent());
if ($diff->isEmpty()) {
$html->pushContent(HTML::hr(), HTML::p('[', _("Versions are identical"), ']'));
} else {
// New CSS formatted unified diffs (ugly in NS4).
$fmt = new HtmlUnifiedDiffFormatter();
// Use this for old table-formatted diffs.
//$fmt = new TableUnifiedDiffFormatter;
$html->pushContent($fmt->format($diff));
}
}
//$html = HTML::tt(fmt('%s: %s', $salutation, WikiLink($name, 'auto')),
// THE_END);
//.........这里部分代码省略.........