本文整理汇总了PHP中HTML::ul方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::ul方法的具体用法?PHP HTML::ul怎么用?PHP HTML::ul使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::ul方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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.")));
}
}
示例2: renamePages
function renamePages(&$dbi, &$request, $pages, $from, $to, $updatelinks = false, $createredirect = false)
{
$result = HTML::div();
$ul = HTML::ul();
$count = 0;
$post_args = $request->getArg('admin_rename');
$options = array('regex' => isset($post_args['regex']) ? $post_args['regex'] : null, 'icase' => isset($post_args['icase']) ? $post_args['icase'] : null);
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('edit', $name)) {
$ul->pushContent(HTML::li(fmt("Access denied to rename page '%s'.", WikiLink($name))));
} elseif ($dbi->renamePage($name, $newname, $updatelinks)) {
/* not yet implemented for all backends */
$page = $dbi->getPage($newname);
$current = $page->getCurrentRevision();
$version = $current->getVersion();
$meta = $current->_data;
$text = $current->getPackedContent();
$meta['summary'] = sprintf(_("Renamed page from '%s' to '%s'"), $name, $newname);
$meta['is_minor_edit'] = 1;
$meta['author'] = $request->_user->UserName();
unset($meta['mtime']);
// force new date
$page->save($text, $version + 1, $meta);
if ($createredirect) {
$page = $dbi->getPage($name);
$text = "<<RedirectTo page=\"" . $newname . "\">>";
$meta['summary'] = sprintf(_("Renaming created redirect page from '%s' to '%s'"), $name, $newname);
$meta['is_minor_edit'] = 0;
$meta['author'] = $request->_user->UserName();
$page->save($text, 1, $meta);
}
$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();
$result->setAttr('class', 'feedback');
if ($count == 1) {
$result->pushContent(HTML::p("One page has been permanently renamed:"));
} else {
$result->pushContent(HTML::p(fmt("%s pages have been permanently renamed:", $count)));
}
$result->pushContent($ul);
return $result;
} else {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p(fmt("No pages renamed.")));
$result->pushContent($ul);
return $result;
}
}
示例3: 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.")));
}
}
示例4: removePages
function removePages(&$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('remove', $name)) {
$dbi->deletePage($name);
$ul->pushContent(HTML::li(fmt("Removed page '%s' successfully.", $name)));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Didn't remove 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 removed:"));
} else {
$result->pushContent(HTML::p(fmt("%s pages have been permanently removed:", $count)));
}
$result->pushContent($ul);
return $result;
} else {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p("No pages removed."));
return $result;
}
}
示例5: 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;
}
示例6: setaclPages
function setaclPages(&$request, $pages, $acl)
{
$ul = HTML::ul();
$count = 0;
$dbi =& $request->_dbi;
// check new_group and new_perm
if (isset($acl['_add_group'])) {
//add groups with perm
foreach ($acl['_add_group'] as $access => $dummy) {
$group = $acl['_new_group'][$access];
$acl[$access][$group] = isset($acl['_new_perm'][$access]) ? 1 : 0;
}
unset($acl['_add_group']);
}
unset($acl['_new_group']);
unset($acl['_new_perm']);
if (isset($acl['_del_group'])) {
//del groups with perm
foreach ($acl['_del_group'] as $access => $del) {
while (list($group, $dummy) = each($del)) {
unset($acl[$access][$group]);
}
}
unset($acl['_del_group']);
}
if ($perm = new PagePermission($acl)) {
$perm->sanify();
foreach ($pages as $pagename) {
// check if unchanged? we need a deep array_equal
$page = $dbi->getPage($pagename);
$oldperm = getPagePermissions($page);
if ($oldperm) {
$oldperm->sanify();
}
if ($oldperm and $perm->equal($oldperm->perm)) {
// (serialize($oldperm->perm) == serialize($perm->perm))
$ul->pushContent(HTML::li(fmt("ACL not changed for page '%s'.", $pagename)));
} elseif (mayAccessPage('change', $pagename)) {
setPagePermissions($page, $perm);
$ul->pushContent(HTML::li(fmt("ACL changed for page '%s'.", $pagename)));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Access denied to change page '%s'.", $pagename)));
}
}
} else {
$ul->pushContent(HTML::li(fmt("Invalid ACL")));
}
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.")));
}
}
示例7: 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;
}
}
示例8: 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;
}
}
示例9: revertPages
function revertPages(&$request, $pages)
{
$ul = HTML::ul();
$dbi = $request->getDbh();
$count = 0;
foreach ($pages as $name) {
$name = str_replace(array('%5B', '%5D'), array('[', ']'), $name);
if (mayAccessPage('remove', $name)) {
$version = $dbi->revertPage($name);
$ul->pushContent(HTML::li(fmt("Reverted page '%s' to version '%s'.", $name, $version)));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Didn't revert page '%s'. Access denied.", $name)));
}
}
if ($count) {
$dbi->touch();
}
return HTML($ul, HTML::p(fmt("%d pages have been reverted.", $count)));
}
示例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: 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.")));
}
}
示例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: testGeneratingListing
/**
* Test generating proper listing
*
* @group laravel
*/
public function testGeneratingListing()
{
$list = array('foo', 'foobar' => array('hello', 'hello world'));
$html1 = HTML::ul($list);
$html2 = HTML::ul($list, array('class' => 'nav'));
$html3 = HTML::ol($list);
$html4 = HTML::ol($list, array('class' => 'nav'));
$this->assertEquals('<ul><li>foo</li><li>foobar<ul><li>hello</li><li>hello world</li></ul></li></ul>', $html1);
$this->assertEquals('<ul class="nav"><li>foo</li><li>foobar<ul><li>hello</li><li>hello world</li></ul></li></ul>', $html2);
$this->assertEquals('<ol><li>foo</li><li>foobar<ol><li>hello</li><li>hello world</li></ol></li></ol>', $html3);
$this->assertEquals('<ol class="nav"><li>foo</li><li>foobar<ol><li>hello</li><li>hello world</li></ol></li></ol>', $html4);
}
示例14: _getDetail
function _getDetail($count = 0)
{
// Codendi : don't display notices
//if ($this->isNotice()) return;
if (!$count) {
$count = $this->_count;
}
$dir = defined('PHPWIKI_DIR') ? PHPWIKI_DIR : substr(dirname(__FILE__), 0, -4);
if (substr(PHP_OS, 0, 3) == 'WIN') {
$dir = str_replace('/', '\\', $dir);
$this->errfile = str_replace('/', '\\', $this->errfile);
$dir .= "\\";
} else {
$dir .= '/';
}
$errfile = preg_replace('|^' . preg_quote($dir) . '|', '', $this->errfile);
if (is_string($this->errstr)) {
$lines = explode("\n", $this->errstr);
} elseif (is_object($this->errstr)) {
$lines = array($this->errstr->asXML());
}
$errtype = DEBUG & _DEBUG_VERBOSE ? sprintf("%s[%d]", $this->getDescription(), $this->errno) : sprintf("%s", $this->getDescription());
$msg = sprintf("%s:%d: %s: %s %s", $errfile, $this->errline, $errtype, array_shift($lines), $count > 1 ? sprintf(" (...repeated %d times)", $count) : "");
$html = HTML::div(array('class' => $this->getHtmlClass()), HTML::p($msg));
if ($lines) {
$list = HTML::ul();
foreach ($lines as $line) {
$list->pushContent(HTML::li($line));
}
$html->pushContent($list);
}
return $html;
}
示例15: shifts
<div class="row">
<div class="col-lg-12">
<h2>My Thoughts</h2>
<p>
Over all pretty simple and straight forward challenge, no tricks or anything like that.
The only real issue I ran into was dumbing down the built in Yii2 ActiveController actions.
By default the ActiveController offers all the basic CRUD options and the challenge states only the provided User Stories be exposed.
I could have created my own class to handle the API curling but I just decided to use Guzzle instead.
</p>
<p>
It seemed logical, so I combined stories 1 and 4.
</p>
<p>
I like these types of "real world" challenges rather than "trick puzzles".
</p>
<p>
<span class="text-primary"><strong>TODO:</strong></span>
<? echo HTML::ul([
"Need to add authentication to the User API request",
"Story 1,2, and 4 currently retrieve all shifts (past & future) for the employee.
By default it should search future shifts only but if a start and/or end date is supplied use that range instead.",
"Combine 2 with 1 & 4?",
]); ?>
</p>
</div>
</div>
</div>