本文整理汇总了PHP中HTML::li方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::li方法的具体用法?PHP HTML::li怎么用?PHP HTML::li使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::li方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: ActionButton
function ActionButton($action, $label = false, $page_or_rev = false, $options = false)
{
global $WikiTheme;
global $request;
if (is_array($action)) {
$attr = $action;
$act = isset($attr['action']) ? $attr['action'] : 'browse';
} else {
$act = $action;
}
$class = is_safe_action($act) ? 'named-wiki' : 'wikiadmin';
/* if selected action is current then prepend selected */
$curract = $request->getArg("action");
if ($curract == $act and $curract != 'browse') {
$class = "selected {$class}";
}
if (!empty($options['class'])) {
if ($curract == 'browse') {
$class = "{$class} " . $options['class'];
} else {
$class = $options['class'];
}
}
return HTML::li(array('class' => $class), $WikiTheme->makeActionButton($action, $label, $page_or_rev, $options));
}
示例3: purgePages
function purgePages(&$request, $pages)
{
$result = HTML::div();
$ul = HTML::ul();
$dbi = $request->getDbh();
$count = 0;
foreach ($pages as $name) {
$name = str_replace(array('%5B', '%5D'), array('[', ']'), $name);
if (mayAccessPage('purge', $name)) {
$dbi->purgePage($name);
$ul->pushContent(HTML::li(fmt("Purged page '%s' successfully.", $name)));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Didn't purge page '%s'. Access denied.", $name)));
}
}
if ($count) {
$dbi->touch();
$result->setAttr('class', 'feedback');
if ($count == 1) {
$result->pushContent(HTML::p("One page has been permanently purged:"));
} else {
$result->pushContent(HTML::p(fmt("%s pages have been permanently purged:", $count)));
}
$result->pushContent($ul);
return $result;
} else {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p("No pages purged."));
return $result;
}
}
示例4: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
extract($args);
include_once "lib/imdb.php";
$imdb = new imdb();
if (method_exists($imdb, $query)) {
$SqlResult = $imdb->{$query}($title ? $title : $name);
} else {
$SqlResult = array();
}
// if ($limit) ; // TODO: fill paging vars (see PageList)
if ($ordered) {
$html = HTML::ol(array('class' => 'sqlresult'));
foreach ($SqlResult as $row) {
$html->pushContent(HTML::li(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'), $row[0]));
}
} else {
$html = HTML::table(array('class' => 'sqlresult'));
$i = 0;
foreach ($SqlResult as $row) {
$tr = HTML::tr(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'));
foreach ($row as $col) {
$tr->pushContent(HTML::td($col));
}
$html->pushContent($tr);
}
}
// if ($limit) ; // do paging via pagelink template
return $html;
}
示例5: renamePages
function renamePages(&$dbi, &$request, $pages, $from, $to, $updatelinks = false)
{
$ul = HTML::ul();
$count = 0;
$post_args = $request->getArg('admin_rename');
$options = array('regex' => @$post_args['regex'], 'icase' => @$post_args['icase']);
foreach ($pages as $name) {
if ($newname = $this->renameHelper($name, $from, $to, $options) and $newname != $name) {
if ($dbi->isWikiPage($newname)) {
$ul->pushContent(HTML::li(fmt("Page %s already exists. Ignored.", WikiLink($newname))));
} elseif (!mayAccessPage('change', $name)) {
$ul->pushContent(HTML::li(fmt("Access denied to change page '%s'.", WikiLink($name))));
} elseif ($dbi->renamePage($name, $newname, $updatelinks)) {
/* not yet implemented for all backends */
$ul->pushContent(HTML::li(fmt("Renamed page '%s' to '%s'.", $name, WikiLink($newname))));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Couldn't rename page '%s' to '%s'.", $name, $newname)));
}
} else {
$ul->pushContent(HTML::li(fmt("Couldn't rename page '%s' to '%s'.", $name, $newname)));
}
}
if ($count) {
$dbi->touch();
return HTML($ul, HTML::p(fmt("%s pages have been permanently renamed.", $count)));
} else {
return HTML($ul, HTML::p(fmt("No pages renamed.")));
}
}
示例6: 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.")));
}
}
示例7: Wordpress_RC_revision_formatter
function Wordpress_RC_revision_formatter(&$fmt, &$rev)
{
$class = 'rc-' . $fmt->importance($rev);
$time = $fmt->time($rev);
if ($rev->get('is_minor_edit')) {
$minor_flag = HTML::small("(" . _("minor edit") . ")");
} else {
$time = HTML::strong($time);
$minor_flag = '';
}
return HTML::li(array('class' => $class), $fmt->diffLink($rev), ' ', $fmt->pageLink($rev), ' ', $time, ' ', $minor_flag, ' ', " . . . ", $fmt->summaryAsHTML($rev), ' ', " . . . ", $fmt->authorLink($rev));
}
示例8: chmarkupPages
function chmarkupPages(&$dbi, &$request, $pages, $newmarkup)
{
$result = HTML::div();
$ul = HTML::ul();
$count = 0;
foreach ($pages as $name) {
$page = $dbi->getPage($name);
$current = $page->getCurrentRevision();
$markup = $current->get('markup');
if (!$markup or $newmarkup != $markup) {
if (!mayAccessPage('change', $name)) {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p(fmt("Access denied to change page '%s'.", WikiLink($name))));
} else {
$version = $current->getVersion();
$meta = $current->_data;
$meta['markup'] = $newmarkup;
// convert text?
$text = $current->getPackedContent();
$meta['summary'] = sprintf(_("Change markup type from %s to %s"), $markup, $newmarkup);
$meta['is_minor_edit'] = 1;
$meta['author'] = $request->_user->UserName();
unset($meta['mtime']);
// force new date
$page->save($text, $version + 1, $meta);
$current = $page->getCurrentRevision();
if ($current->get('markup') === $newmarkup) {
$ul->pushContent(HTML::li(fmt("change page '%s' to markup type '%s'.", WikiLink($name), $newmarkup)));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Couldn't change page '%s' to markup type '%s'.", WikiLink($name), $newmarkup)));
}
}
}
}
if ($count) {
$dbi->touch();
$result->setAttr('class', 'feedback');
if ($count == 1) {
$result->pushContent(HTML::p("One page has been permanently changed:"));
} else {
$result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count)));
}
$result->pushContent($ul);
return $result;
} else {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p("No pages changed."));
return $result;
}
}
示例9: chownPages
function chownPages(&$dbi, &$request, $pages, $newowner)
{
$result = HTML::div();
$ul = HTML::ul();
$count = 0;
foreach ($pages as $name) {
$page = $dbi->getPage($name);
$current = $page->getCurrentRevision();
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 {
$version = $current->getVersion();
$meta = $current->_data;
$text = $current->getPackedContent();
$meta['summary'] = "Change page owner from '" . $owner . "' to '" . $newowner . "'";
$meta['is_minor_edit'] = 1;
$meta['author'] = $request->_user->UserName();
unset($meta['mtime']);
// force new date
$page->set('owner', $newowner);
$page->save($text, $version + 1, $meta);
if ($page->get('owner') === $newowner) {
$ul->pushContent(HTML::li(fmt("Change owner of page '%s' to '%s'.", WikiLink($name), WikiLink($newowner))));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Could not change owner of page '%s' to '%s'.", WikiLink($name), $newowner)));
}
}
}
}
if ($count) {
$dbi->touch();
$result->setAttr('class', 'feedback');
if ($count == 1) {
$result->pushContent(HTML::p("One page has been permanently changed:"));
} else {
$result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count)));
}
$result->pushContent($ul);
return $result;
} else {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p("No pages changed."));
return $result;
}
}
示例10: setExternalPages
function setExternalPages(&$dbi, &$request, $pages)
{
$result = HTML::div();
$ul = HTML::ul();
$count = 0;
foreach ($pages as $name) {
$page = $dbi->getPage($name);
$current = $page->getCurrentRevision();
$external = $current->get('external');
if (!$external) {
$external = 0;
}
$external = (bool) $external;
if (!$external) {
if (!mayAccessPage('change', $name)) {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p(fmt("Access denied to change page '%s'.", WikiLink($name))));
} else {
$version = $current->getVersion();
$page->set('external', (bool) 1);
$ul->pushContent(HTML::li(fmt("change page '%s' to external.", WikiLink($name))));
$count++;
}
}
}
if ($count) {
$dbi->touch();
$result->setAttr('class', 'feedback');
if ($count == 1) {
$result->pushContent(HTML::p("One page has been permanently changed:"));
} else {
$result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count)));
}
$result->pushContent($ul);
return $result;
} else {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p("No pages changed."));
return $result;
}
}
示例11: format_revision
function format_revision($rev)
{
static $doublettes = array();
if (isset($doublettes[$rev->getPageName()])) {
return;
}
$doublettes[$rev->getPageName()] = 1;
$args =& $this->_args;
$class = 'rc-' . $this->importance($rev);
$time = $this->time($rev);
if (!$rev->get('is_minor_edit')) {
$time = HTML::strong(array('class' => 'pageinfo-majoredit'), $time);
}
$line = HTML::li(array('class' => $class));
if ($args['difflinks']) {
$line->pushContent($this->diffLink($rev), ' ');
}
if ($args['historylinks']) {
$line->pushContent($this->historyLink($rev), ' ');
}
$line->pushContent($this->pageLink($rev), ' ', $time, ' ', ' . . . . ', _("latest comment by "), $this->authorLink($rev));
return $line;
}
示例12: chmarkupPages
function chmarkupPages(&$dbi, &$request, $pages, $newmarkup)
{
$ul = HTML::ul();
$count = 0;
foreach ($pages as $name) {
$page = $dbi->getPage($name);
$current = $page->getCurrentRevision();
$markup = $current->get('markup');
if (!$markup or $newmarkup != $markup) {
if (!mayAccessPage('change', $name)) {
$ul->pushContent(HTML::li(fmt("Access denied to change page '%s'.", WikiLink($name))));
} else {
$version = $current->getVersion();
$meta = $current->_data;
$meta['markup'] = $newmarkup;
// convert text?
$text = $current->getPackedContent();
$meta['summary'] = sprintf(_("WikiAdminMarkup from %s to %s"), $markup, $newmarkup);
$page->save($text, $version + 1, $meta);
$current = $page->getCurrentRevision();
if ($current->get('markup') === $newmarkup) {
$ul->pushContent(HTML::li(fmt("change page '%s' to markup type '%s'.", WikiLink($name), $newmarkup)));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Couldn't change page '%s' to markup type '%s'.", WikiLink($name), $newmarkup)));
}
}
}
}
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.")));
}
}
示例13: chmodPages
function chmodPages(&$dbi, &$request, $pages, $permstring)
{
$ul = HTML::ul();
$count = 0;
$acl = chmodHelper($permstring);
if ($perm = new PagePermission($acl)) {
foreach ($pages as $name) {
if ($perm->store($dbi->getPage($name))) {
$ul->pushContent(HTML::li(fmt("chmod page '%s' to '%s'.", $name, $permstring)));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Couldn't chmod page '%s' to '%s'.", $name, $permstring)));
}
}
} else {
$ul->pushContent(HTML::li(fmt("Invalid chmod string")));
}
if ($count) {
$dbi->touch();
return HTML($ul, HTML::p(fmt("%s pages have been changed.", $count)));
} else {
return HTML($ul, HTML::p(fmt("No pages changed.")));
}
}
示例14: run
function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
if ($exclude) {
if (!is_array($exclude)) {
$exclude = explode(',', $exclude);
}
}
if ($page == _("WantedPages")) {
$page = "";
}
// The PageList class can't handle the 'count' column needed
// for this table
$this->pagelist = array();
// There's probably a more memory-efficient way to do this (eg
// a tailored SQL query via the backend, but this gets the job
// done.
if (!$page) {
$include_empty = false;
$allpages_iter = $dbi->getAllPages($include_empty, $sortby, $limit);
while ($page_handle = $allpages_iter->next()) {
$name = $page_handle->getName();
if ($name == _("InterWikiMap")) {
continue;
}
if (!in_array($name, $exclude)) {
$this->_iterateLinks($page_handle, $dbi);
}
}
} else {
if ($page && ($pageisWikiPage = $dbi->isWikiPage($page))) {
//only get WantedPages links for one page
$page_handle = $dbi->getPage($page);
$this->_iterateLinks($page_handle, $dbi);
if (!$request->getArg('count')) {
$args['count'] = count($this->pagelist);
} else {
$args['count'] = $request->getArg('count');
}
}
}
ksort($this->pagelist);
arsort($this->pagelist);
$this->_rows = HTML();
$caption = false;
$this->_messageIfEmpty = _("<none>");
if ($page) {
// link count always seems to be 1 for a single page so
// omit count column
foreach ($this->pagelist as $key => $val) {
$row = HTML::li(WikiLink((string) $key, 'unknown'));
$this->_rows->pushContent($row);
}
if (!$noheader) {
if ($pageisWikiPage) {
$pagelink = WikiLink($page);
} else {
$pagelink = WikiLink($page, 'unknown');
}
$c = count($this->pagelist);
$caption = fmt("Wanted Pages for %s (%d total):", $pagelink, $c);
}
return $this->_generateList($caption);
} else {
$spacer = new RawXml(" ");
// Clicking on the number in the links column does a
// FullTextSearch for the citations of the WantedPage
// link.
foreach ($this->pagelist as $key => $val) {
$key = (string) $key;
// TODO: Not sure why, but this
// string cast type-coersion
// does seem necessary here.
// Enclose any FullTextSearch keys containing a space
// with quotes in oder to request a defnitive search.
$searchkey = strstr($key, ' ') === false ? $key : "\"{$key}\"";
$row = HTML::tr(HTML::td(array('align' => 'right'), Button(array('s' => $searchkey), $val, _("FullTextSearch")), HTML::td(HTML($spacer, WikiLink($key, 'unknown')))));
$this->_rows->pushContent($row);
}
$c = count($this->pagelist);
if (!$noheader) {
$caption = sprintf(_("Wanted Pages in this wiki (%d total):"), $c);
}
$this->_columns = array(_("Count"), _("Page Name"));
if ($c > 0) {
return $this->_generateTable($caption);
} else {
return HTML(HTML::p($caption), HTML::p($messageIfEmpty));
}
}
}
示例15: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
// if (empty($args['s']))
// return '';
$html = HTML();
extract($args);
// prevent from dump
if ($q and $request->isPost()) {
require_once "lib/Google.php";
$google = new Google();
if (!$google) {
return '';
}
switch ($mode) {
case 'search':
$result = $google->doGoogleSearch($q);
break;
case 'cache':
$result = $google->doGetCachedPage($q);
break;
case 'spell':
$result = $google->doSpellingSuggestion($q);
break;
default:
trigger_error("Invalid mode");
}
if (isa($result, 'HTML')) {
$html->pushContent($result);
}
if (isa($result, 'GoogleSearchResults')) {
//TODO: result template
if (!empty($result->resultElements)) {
$list = HTML::ol();
foreach ($result->resultElements as $res) {
$li = HTML::li(LinkURL($res['URL'], $res['directoryTitle']), HTML::br(), $res['directoryTitle'] ? HTML(HTML::raw(' '), HTML::em($res['summary']), ' -- ', LinkURL($res['URL'])) : '');
$list->pushContent($li);
}
$html->pushContent($list);
} else {
return _("Nothing found");
}
}
if (is_string($result)) {
// cache content also?
$html->pushContent(HTML::blockquote(HTML::raw($result)));
}
}
if ($formsize < 1) {
$formsize = 30;
}
// todo: template
$form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), HiddenInputs(array('pagename' => $basepage, 'mode' => $mode)));
$form->pushContent(HTML::input(array('type' => 'text', 'value' => $q, 'name' => 'q', 'size' => $formsize)));
$form->pushContent(HTML::input(array('type' => 'submit', 'class' => 'button', 'value' => gettext($mode))));
return HTML($html, $form);
}