本文整理汇总了PHP中HTML函数的典型用法代码示例。如果您正苦于以下问题:PHP HTML函数的具体用法?PHP HTML怎么用?PHP HTML使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HTML函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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"));
}
示例2: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
$html = HTML();
if (empty($args['pages'])) {
return $html;
}
$include = new WikiPlugin_IncludePage();
if (is_string($args['exclude']) and !empty($args['exclude'])) {
$args['exclude'] = explodePageList($args['exclude']);
$argstr = preg_replace("/exclude=\\S*\\s/", "", $argstr);
} elseif (is_array($args['exclude'])) {
$argstr = preg_replace("/exclude=<\\?plugin-list.*?\\>/", "", $argstr);
}
if (is_string($args['pages']) and !empty($args['pages'])) {
$args['pages'] = explodePageList($args['pages']);
$argstr = preg_replace("/pages=\\S*\\s/", "", $argstr);
} elseif (is_array($args['pages'])) {
$argstr = preg_replace("/pages=<\\?plugin-list.*?\\>/", "", $argstr);
}
foreach ($args['pages'] as $page) {
if (empty($args['exclude']) or !in_array($page, $args['exclude'])) {
$html = HTML($html, $include->run($dbi, "page='{$page}' " . $argstr, $request, $basepage));
}
}
return $html;
}
示例3: chownPages
function chownPages(&$dbi, &$request, $pages, $newowner)
{
$ul = HTML::ul();
$count = 0;
foreach ($pages as $name) {
$page = $dbi->getPage($name);
if ($owner = $page->getOwner() and $newowner != $owner) {
if (!mayAccessPage('change', $name)) {
$ul->pushContent(HTML::li(fmt("Access denied to change page '%s'.", WikiLink($name))));
} else {
$page->set('owner', $newowner);
if ($page->get('owner') === $newowner) {
$ul->pushContent(HTML::li(fmt("Chown page '%s' to '%s'.", WikiLink($name), WikiLink($newowner))));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Couldn't chown page '%s' to '%s'.", WikiLink($name), $newowner)));
}
}
}
}
if ($count) {
$dbi->touch();
return HTML($ul, HTML::p(fmt("%s pages have been permanently changed.", $count)));
} else {
return HTML($ul, HTML::p(fmt("No pages changed.")));
}
}
示例4: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
extract($args);
$maincat = $dbi->getPage(_("CategoryCategory"));
$bi = $maincat->getBackLinks(false);
$bl = array();
while ($b = $bi->next()) {
$name = $b->getName();
if (preg_match("/^" . _("Template") . "/", $name)) {
continue;
}
$pages = $b->getBackLinks(false);
$bl[] = array('name' => $name, 'count' => $pages->count());
}
usort($bl, 'cmp_by_count');
$html = HTML::ul();
$i = 0;
foreach ($bl as $b) {
$i++;
$name = $b['name'];
$count = $b['count'];
if ($count < $mincount) {
break;
}
if ($i > $limit) {
break;
}
$wo = preg_replace("/^(" . _("Category") . "|" . _("Topic") . ")/", "", $name);
$wo = HTML(HTML::span($wo), HTML::raw(" "), HTML::small("(" . $count . ")"));
$link = WikiLink($name, 'auto', $wo);
$html->pushContent(HTML::li($link));
}
return $html;
}
示例5: run
function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
if ($numberlinks > 10 || $numberlinks < 0) {
$numberlinks = $this->def_numberlinks;
}
// Get name of the current page we are on
$thispage = $request->getArg('pagename');
$Pages = $request->session->get("PageTrail");
if (!is_array($Pages)) {
$Pages = array();
}
if (!isset($Pages[0]) or $duplicates || $thispage != $Pages[0]) {
array_unshift($Pages, $thispage);
$request->session->set("PageTrail", $Pages);
}
$numberlinks = min(count($Pages), $numberlinks);
if (!$invisible and $numberlinks) {
$html = HTML::div(array('class' => 'pagetrail'));
$html->pushContent(WikiLink($Pages[$numberlinks - 1], 'auto'));
for ($i = $numberlinks - 2; $i >= 0; $i--) {
if (!empty($Pages[$i])) {
$html->pushContent(PAGETRAIL_ARROW, WikiLink($Pages[$i], 'auto'));
}
}
return $html;
} else {
return HTML();
}
}
示例6: Textarea_Replace
function Textarea_Replace($textarea, $wikitext, $name = 'edit[content]')
{
$htmltextid = $this->_htmltextid;
$textarea->SetAttr('id', $htmltextid);
$out = HTML($textarea, HTML::div(array("id" => $this->_wikitextid, 'style' => 'display:none'), $wikitext), "\n");
return $out;
}
示例7: box
function box($args = false, $request = false, $basepage = false)
{
if (!$request) {
$request =& $GLOBALS['request'];
}
$stats = $this->getStats($request->_dbi, $request, 'summary');
return $this->makeBox(_("Who is online"), HTML(HTML::Raw('· '), WikiLink(_("WhoIsOnline"), 'auto', fmt("%d online users", $stats['NUM_USERS']))));
}
示例8: _flushLine
function _flushLine($new_tag)
{
$this->_flushGroup($new_tag);
if ($this->_line) {
$this->_lines[] = $this->_line;
}
$this->_line = HTML();
}
示例9: 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;
}
示例10: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
$pagename = $args['page'];
if (empty($args['s'])) {
if ($request->isPost()) {
if ($pagename != _("AppendText")) {
return HTML($request->redirect(WikiURL($pagename, false, 'absurl'), false));
}
}
return '';
}
$page = $dbi->getPage($pagename);
$message = HTML();
if (!$page->exists()) {
// We might want to create it?
$message->pushContent(sprintf(_("Page could not be updated. %s doesn't exist!\n"), $pagename));
return $message;
}
$current = $page->getCurrentRevision();
$oldtext = $current->getPackedContent();
$text = $args['s'];
// If a "before" or "after" is specified but not found, we simply append text to the end.
if (!empty($args['before'])) {
$before = preg_quote($args['before'], "/");
// Insert before
$newtext = preg_match("/\n{$before}/", $oldtext) ? preg_replace("/(\n{$before})/", "\n" . preg_quote($text, "/") . "\\1", $oldtext) : $this->_fallback($text, $oldtext, $args['before'], $message);
} elseif (!empty($args['after'])) {
// Insert after
$after = preg_quote($args['after'], "/");
$newtext = preg_match("/\n{$after}/", $oldtext) ? preg_replace("/(\n{$after})/", "\\1\n" . preg_quote($text, "/"), $oldtext) : $this->_fallback($text, $oldtext, $args['after'], $message);
} else {
// Append at the end
$newtext = $oldtext . "\n" . $text;
}
require_once "lib/loadsave.php";
$meta = $current->_data;
$meta['summary'] = sprintf(_("AppendText to %s"), $pagename);
if ($page->save($newtext, $current->getVersion() + 1, $meta)) {
$message->pushContent(_("Page successfully updated."), HTML::br());
}
// AppendText has been called from the same page that got modified
// so we directly show the page.
if ($request->getArg($pagename) == $pagename) {
// TODO: Just invalidate the cache, if AppendText didn't
// change anything before.
//
return $request->redirect(WikiURL($pagename, false, 'absurl'), false);
// The user asked to be redirected to the modified page
} elseif ($args['redirect']) {
return $request->redirect(WikiURL($pagename, false, 'absurl'), false);
} else {
$link = HTML::em(WikiLink($pagename));
$message->pushContent(HTML::Raw(sprintf(_("Go to %s."), $link->asXml())));
}
return $message;
}
示例11: 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"));
}
示例12: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if (!$args['pagename']) {
return $this->error(_("No pagename specified"));
}
// Get our form args.
$comment = $request->getArg("comment");
$request->setArg('comment', false);
if ($request->isPost() and !empty($comment['addcomment'])) {
$this->add($request, $comment, 'comment');
// noreturn
}
if ($args['jshide'] and isBrowserIE() and browserDetect("Mac")) {
//trigger_error(_("jshide set to 0 on Mac IE"), E_USER_NOTICE);
$args['jshide'] = 0;
}
// Now we display previous comments and/or provide entry box
// for new comments
$html = HTML();
if ($args['jshide']) {
$div = HTML::div(array('id' => 'comments', 'style' => 'display:none;'));
//$list->setAttr('style','display:none;');
$div->pushContent(Javascript("\nfunction togglecomments(a) {\n comments=document.getElementById('comments');\n if (comments.style.display=='none') {\n comments.style.display='block';\n a.title='" . _("Click to hide the comments") . "';\n } else {\n comments.style.display='none';\n a.title='" . _("Click to display all comments") . "';\n }\n}"));
$html->pushContent(HTML::h4(HTML::a(array('name' => 'comment-header', 'class' => 'wikiaction', 'title' => _("Click to display"), 'onclick' => "togglecomments(this)"), _("Comments"))));
} else {
$div = HTML::div(array('id' => 'comments'));
}
foreach (explode(',', $args['mode']) as $show) {
if (!empty($seen[$show])) {
continue;
}
$seen[$show] = 1;
switch ($show) {
case 'show':
$show = $this->showAll($request, $args, 'comment');
//if ($args['jshide']) $show->setAttr('style','display:none;');
$div->pushContent($show);
break;
case 'add':
global $WikiTheme;
if (!$WikiTheme->DUMP_MODE) {
$add = $this->showForm($request, $args, 'addcomment');
//if ($args['jshide']) $add->setAttr('style','display:none;');
$div->pushContent($add);
}
break;
default:
return $this->error(sprintf("Bad mode ('%s')", $show));
}
}
$html->pushContent($div);
return $html;
}
示例13: run
function run($dbi, $argstr, $request)
{
extract($this->getArgs($argstr, $request));
// Any text that is returned will not be further transformed,
// so use html where necessary.
if (empty($jid)) {
$html = HTML();
} else {
$html = HTML::img(array('src' => urlencode($scripturl) . '&jid=' . urlencode($jid) . '&type=' . urlencode($type) . '&iconset=' . $iconset));
}
return $html;
}
示例14: _DebugPrintArray
function _DebugPrintArray(&$array)
{
$html = HTML();
foreach ($array as $line) {
ob_start();
print_r($line);
$s = HTML::pre(ob_get_contents());
ob_end_clean();
$html->pushContent($s);
}
return $html;
}
示例15: Textarea
function Textarea($textarea, $wikitext, $name = 'edit[content]')
{
global $request;
$htmltextid = $this->_htmltextid;
$textarea->SetAttr('id', $htmltextid);
$iframe0 = new RawXml('<iframe id="iframe0" src="blank.htm" height="0" width="0" frameborder="0"></iframe>');
if ($request->getArg('mode') and $request->getArg('mode') == 'wysiwyg') {
$out = HTML(HTML::div(array('class' => 'hint'), _("Warning: This Wikiwyg editor has only Beta quality!")), $textarea, $iframe0, "\n");
} else {
$out = HTML($textarea, $iframe0, "\n");
}
return $out;
}