本文整理汇总了PHP中HTML::span方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::span方法的具体用法?PHP HTML::span怎么用?PHP HTML::span使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::span方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGeneratingSpan
/**
* Test generating proper span
*
* @group laravel
*/
public function testGeneratingSpan()
{
$html1 = HTML::span('foo');
$html2 = HTML::span('foo', array('class' => 'badge'));
$this->assertEquals('<span>foo</span>', $html1);
$this->assertEquals('<span class="badge">foo</span>', $html2);
}
示例2: 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;
}
示例3: __construct
public function __construct(array $objects, $edit = null, $add = true, $delete = true)
{
$this->list = '';
foreach ($objects as $object) {
$properties = $this->getProperties($object);
$propertyList = '';
foreach ($properties as $class => $property) {
$propertyList .= HTML::span(['class' => $class], $property);
}
$id = $object->getId();
if ($edit) {
$properties = HTML::span(['class' => 'properties'], HTML::a(['href' => "/edit/{$edit}/{$id}"], $propertyList));
} else {
$properties = HTML::span(['class' => 'properties'], $propertyList);
}
if ($delete) {
$deleteLink = HTML::span(['class' => 'delete'], HTML::a(['href' => "/delete/{$edit}/{$id}"], 'x'));
} else {
$deleteLink = '';
}
$this->list .= HTML::div(['class' => 'objectRow'], $properties . $deleteLink);
}
if ($add && $edit) {
$this->list .= HTML::div(HTML::span(HTML::a(['href' => "/edit/{$edit}/"], 'add ' . $edit)));
}
$this->list = HTML::div(['class' => 'objectList'], $this->list);
}
示例4: linkUnknownWikiWord
function linkUnknownWikiWord($wikiword, $linktext = '')
{
global $request;
// Get rid of anchors on unknown wikiwords
if (isa($wikiword, 'WikiPageName')) {
$default_text = $wikiword->shortName;
$wikiword = $wikiword->name;
} else {
$default_text = $wikiword;
}
$url = WikiURL($wikiword, array('action' => 'create'));
//$link = HTML::span(HTML::a(array('href' => $url), '?'));
$button = $this->makeButton('?', $url);
$button->addTooltip(sprintf(_("Create: %s"), $wikiword));
$link = HTML::span($button);
if (!empty($linktext)) {
$link->unshiftContent(HTML::u($linktext));
$link->setAttr('class', 'named-wikiunknown');
} else {
$link->unshiftContent(HTML::u($this->maybeSplitWikiWord($default_text)));
$link->setAttr('class', 'wikiunknown');
}
if ($request->getArg('frame')) {
$link->setAttr('target', '_top');
}
return $link;
}
示例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: linkUnknownWikiWord
function linkUnknownWikiWord($wikiword, $linktext = '')
{
global $request;
if (isa($wikiword, 'WikiPageName')) {
$default_text = $wikiword->shortName;
$wikiword = $wikiword->name;
} else {
$default_text = $wikiword;
}
$url = WikiURL($wikiword, array('action' => 'create'));
$link = HTML::span(HTML::a(array('href' => $url, 'rel' => 'nofollow'), '?'));
if (!empty($linktext)) {
$link->unshiftContent(HTML::u($linktext));
$link->setAttr('class', 'named-wikiunknown');
} else {
$link->unshiftContent(HTML::u($this->maybeSplitWikiWord($default_text)));
$link->setAttr('class', 'wikiunknown');
}
return $link;
}
示例7: __toString
public function __toString()
{
$lbl_span = \HTML::span($this->label);
if (is_null($this->icon) or empty($this->icon) or !is_string($this->icon)) {
$icon = '';
} else {
if (strpos('<i', $this->icon) !== false) {
$icon = $this->icon;
} else {
$icon = '<i class="' . $this->icon . '"></i>';
}
}
$icon .= PHP_EOL;
if (is_null($this->action) or !is_string($this->action)) {
$button = '';
} else {
if ($this->action == static::BUTTON_FILE or $this->action == 'file') {
$input = '<input type="file" name="' . $this->fileInputName . '[]" multiple>';
$button = '<span class="' . $this->class . '"' . \HTML::attributes($this->attributes) . '>';
$button .= $icon . $lbl_span . $input;
$button .= '</span>';
} else {
if ($this->action == static::BUTTON_START) {
$type = 'submit';
} else {
if ($this->action == static::BUTTON_CANCEL) {
$type = 'reset';
} else {
//if ($this->action == static::BUTTON_DELETE)
$type = 'button';
}
}
$button = '<button type="' . $type . '" class="' . $this->class . '"' . \HTML::attributes($this->attributes) . '>';
$button .= $icon . $lbl_span;
$button .= '</button>';
}
}
return $button . PHP_EOL;
}
示例8: link
function link($link, $linktext = false)
{
global $WikiTheme;
list($moniker, $page) = explode(":", $link, 2);
if (!isset($this->_map[$moniker])) {
return HTML::span(array('class' => 'bad-interwiki'), $linktext ? $linktext : $link);
}
$url = $this->_map[$moniker];
// localize Upload:links for WIKIDUMP
if (!empty($WikiTheme->DUMP_MODE) and $moniker == 'Upload') {
global $request;
include_once "lib/config.php";
$url = getUploadFilePath();
// calculate to a relative local path to /uploads for pdf images.
$doc_root = $request->get("DOCUMENT_ROOT");
$ldir = NormalizeLocalFileName($url);
$wikiroot = NormalizeLocalFileName('');
if (isWindows()) {
$ldir = strtolower($ldir);
$doc_root = strtolower($doc_root);
$wikiroot = strtolower($wikiroot);
}
if (string_starts_with($ldir, $doc_root)) {
$link_prefix = substr($url, strlen($doc_root));
} elseif (string_starts_with($ldir, $wikiroot)) {
$link_prefix = NormalizeWebFileName(substr($url, strlen($wikiroot)));
}
}
// Urlencode page only if it's a query arg.
// FIXME: this is a somewhat broken heuristic.
if ($moniker == 'Upload') {
$page_enc = $page;
$page = rawurldecode($page);
} else {
$page_enc = strstr($url, '?') ? rawurlencode($page) : $page;
}
if (strstr($url, '%s')) {
$url = sprintf($url, $page_enc);
} else {
$url .= $page_enc;
}
$link = HTML::a(array('href' => $url));
if (!$linktext) {
$link->pushContent(PossiblyGlueIconToText('interwiki', "{$moniker}:"), HTML::span(array('class' => 'wikipage'), $page));
$link->setAttr('class', 'interwiki');
} else {
$link->pushContent(PossiblyGlueIconToText('interwiki', $linktext));
$link->setAttr('class', 'named-interwiki');
}
return $link;
}
示例9: navItem
function navItem($name, $page_id, $act_page_id)
{
return HTML::div('menu_item', HTML::span('menu_link', HTML::a('index.php?id=' . $page_id, $name)));
}
示例10: LinkPhpwikiURL
function LinkPhpwikiURL($url, $text = '', $basepage = false)
{
$args = array();
if (!preg_match('/^ phpwiki: ([^?]*) [?]? (.*) $/x', $url, $m)) {
return HTML::span(array('class' => 'error'), _("BAD phpwiki: URL"));
}
if ($m[1]) {
$pagename = urldecode($m[1]);
}
$qargs = $m[2];
if (empty($pagename) && preg_match('/^(diff|edit|links|info)=([^&]+)$/', $qargs, $m)) {
// Convert old style links (to not break diff links in
// RecentChanges).
$pagename = urldecode($m[2]);
$args = array("action" => $m[1]);
} else {
$args = SplitQueryArgs($qargs);
}
if (empty($pagename)) {
$pagename = $GLOBALS['request']->getArg('pagename');
}
if (isset($args['action']) && $args['action'] == 'browse') {
unset($args['action']);
}
/*FIXME:
if (empty($args['action']))
$class = 'wikilink';
else if (is_safe_action($args['action']))
$class = 'wikiaction';
*/
if (empty($args['action']) || is_safe_action($args['action'])) {
$class = 'wikiaction';
} else {
// Don't allow administrative links on unlocked pages.
$dbi = $GLOBALS['request']->getDbh();
$page = $dbi->getPage($basepage ? $basepage : $pagename);
if (!$page->get('locked')) {
return HTML::span(array('class' => 'wikiunsafe'), HTML::u(_("Lock page to enable link")));
}
$class = 'wikiadmin';
}
if (!$text) {
$text = HTML::span(array('class' => 'rawurl'), $url);
}
$wikipage = new WikiPageName($pagename);
if (!$wikipage->isValid()) {
global $WikiTheme;
return $WikiTheme->linkBadWikiWord($wikipage, $url);
}
return HTML::a(array('href' => WikiURL($pagename, $args), 'class' => $class), $text);
}
示例11: function
<?php
HTML::macro('glyph', function ($what, $class = '') {
$a = ['class' => "glyphicon glyphicon-{$what}"];
if (!empty($class)) {
$a['class'] .= ' ' . $class;
}
return HTML::span('', $a);
});
HTML::macro('pageHeader', function ($innards) {
return '<div class="page-header"><h1>' . $innards . '</h1></div>';
});
HTML::macro('label', function ($name, $value = null, $options = array(), $optional = false) {
if ($optional) {
return HTML::label_optional($name, $value, $options);
}
return Form::label($name, $value, $options);
});
HTML::macro('label_optional', function ($name, $value = null, $options = array()) {
$optional = ' <small><span class="text-muted label-optional">(optional)</span></small>';
return HTML::decode(Form::label($name, $value . $optional, $options));
});
HTML::macro('bootstrap_label', function ($what, $type = null, $attributes = null, $class = '') {
// default | primary | success | info | warning | danger
$type = is_null($type) ? 'default' : $type;
$class = !empty($class) ? ' ' . $class : $class;
return '<span class="label label-' . $type . $class . '"' . HTML::atts($attributes) . '>' . $what . '</span>';
});
示例12: range
/**
* Build a range of numeric pagination links.
*
* For the current page, an HTML span element will be generated instead of a link.
*
* @param int $start
* @param int $end
* @return string
*/
protected function range($start, $end)
{
$pages = array();
// To generate the range of page links, we will iterate through each page
// and, if the current page matches the page, we will generate a span,
// otherwise we will generate a link for the page. The span elements
// will be assigned the "current" CSS class for convenient styling.
for ($page = $start; $page <= $end; $page++) {
if ($this->page == $page) {
$pages[] = HTML::span($page, array('class' => 'current'));
} else {
$pages[] = $this->link($page, $page, null);
}
}
return implode(' ', $pages);
}
示例13: checkBox
function checkBox(&$post_args, $name, $msg)
{
$checkbox = HTML::input(array('type' => 'checkbox', 'name' => 'admin_rename[' . $name . ']', 'value' => 1));
if (!empty($post_args[$name])) {
$checkbox->setAttr('checked', 'checked');
}
return HTML::div($checkbox, ' ', HTML::span($msg));
}
示例14: run
//.........这里部分代码省略.........
}
//create url to display single larger version of image on page
$url = WikiURL($request->getPage(), array("p" => basename($value["name"]))) . "#" . basename($value["name"]);
$b_url = WikiURL($request->getPage(), array("h" => basename($value["name"]))) . "#" . basename($value["name"]);
$url_text = $link ? HTML::a(array("href" => "{$url}"), basename($value["desc"])) : basename($value["name"]);
if (!$p) {
if ($mode == 'normal' || $mode == 'slide') {
if (!@empty($params['location'])) {
$params['src'] = $params['location'];
}
unset($params['location'], $params['src_tile']);
$url_image = $link ? HTML::a(array("id" => basename($value["name"])), HTML::a(array("href" => "{$url}"), HTML::img($params))) : HTML::img($params);
} else {
$keep = $params;
if (!@empty($params['src_tile'])) {
$params['src'] = $params['src_tile'];
}
unset($params['location'], $params['src_tile']);
$url_image = $link ? HTML::a(array("id" => basename($value["name"])), HTML::a(array("href" => "{$url}"), ImageTile::image_tile($params))) : HTML::img($params);
$params = $keep;
unset($keep);
}
} else {
if (!@empty($params['location'])) {
$params['src'] = $params['location'];
}
unset($params['location'], $params['src_tile']);
$url_image = $link ? HTML::a(array("id" => basename($value["name"])), HTML::a(array("href" => "{$b_url}"), HTML::img($params))) : HTML::img($params);
}
if ($mode == 'list') {
$url_text = HTML::a(array("id" => basename($value["name"])), $url_text);
}
// here we use different modes
if ($mode == 'tiles') {
$row->pushContent(HTML::td($cell, HTML::table(array("cellpadding" => 1, "border" => 0), HTML::tr(HTML::td(array("valign" => "top", "rowspan" => 2), $url_image), HTML::td(array("valign" => "top", "nowrap" => 0), HTML::span(array('class' => 'boldsmall'), $url_text), HTML::br(), HTML::span(array('class' => 'gensmall'), $size[0] . " x " . $size[1] . " pixels"))))));
} elseif ($mode == 'list') {
$desc = $showdesc != 'none' ? $value["desc"] : '';
$row->pushContent(HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), HTML::span(array('class' => 'boldsmall'), $url_text)));
$row->pushContent(HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), HTML::span(array('class' => 'gensmall'), $size[0] . " x " . $size[1] . " pixels")));
if ($desc != '') {
$row->pushContent(HTML::td(array("valign" => "top", "nowrap" => 0, "bgcolor" => $color), HTML::span(array('class' => 'gensmall'), $desc)));
}
} elseif ($mode == 'thumbs') {
$desc = $showdesc != 'none' ? HTML::p(HTML::a(array("href" => "{$url}"), $url_text)) : '';
$row->pushContent(HTML::td($cell, $url_image, HTML::span(array('class' => 'gensmall'), $desc)));
} elseif ($mode == 'normal') {
$desc = $showdesc != 'none' ? HTML::p($value["desc"]) : '';
$row->pushContent(HTML::td($cell, $url_image, HTML::span(array('class' => 'gensmall'), $desc)));
} elseif ($mode == 'slide') {
if ($newwidth == 'auto' || !$newwidth) {
$newwidth = $this->newSize($size[0], $width);
}
if ($newwidth == 'auto' || !$newwidth) {
$newwidth = $size[0];
}
if ($newheight != 'auto') {
$newwidth = round($size[0] * $newheight / $size[1]);
}
$desc = $showdesc != 'none' ? HTML::p($value["desc"]) : '';
if ($count == 0) {
$cell = array('style' => 'display: block; ' . 'position: absolute; ' . 'left: 50% ; ' . 'margin-left: -' . round($newwidth / 2) . 'px;' . 'text-align: center; ' . 'vertical-align: top', 'name' => "wikislide" . $count);
} else {
$cell = array('style' => 'display: none; ' . 'position: absolute ;' . 'left: 50% ;' . 'margin-left: -' . round($newwidth / 2) . 'px;' . 'text-align: center; ' . 'vertical-align: top', 'name' => "wikislide" . $count);
}
if ($align == 'left' || $align == 'right') {
if ($count == 0) {
$cell = array('style' => 'display: block; ' . 'position: absolute; ' . $align . ': 50px; ' . 'vertical-align: top', 'name' => "wikislide" . $count);
} else {
$cell = array('style' => 'display: none; ' . 'position: absolute; ' . $align . ': 50px; ' . 'vertical-align: top', 'name' => "wikislide" . $count);
}
}
$row->pushContent(HTML::td($cell, $url_image, HTML::span(array('class' => 'gensmall'), $desc)));
$count++;
} elseif ($mode == 'row') {
$desc = $showdesc != 'none' ? HTML::p($value["desc"]) : '';
$row->pushContent(HTML::table(array("style" => "display: inline"), HTML::tr(HTML::td($url_image)), HTML::tr(HTML::td(array("class" => "gensmall", "style" => "text-align: center; " . "background-color: {$color}"), $desc))));
} else {
return $this->error(fmt("Invalid argument: %s=%s", 'mode', $mode));
}
// no more images in one row as defined by $numcols
if (($key + 1) % $numcols == 0 || $key + 1 == count($photos) || $p) {
if ($mode == 'row') {
$html->pushcontent(HTML::span($row));
} else {
$html->pushcontent(HTML::tr($row));
}
$row->setContent('');
}
}
//create main table
$table_attributes = array("border" => 0, "cellpadding" => 5, "cellspacing" => 2, "width" => $tablewidth);
if (!@empty($tableheight)) {
$table_attributes = array_merge($table_attributes, array("height" => $tableheight));
}
if ($mode != 'row') {
$html = HTML::table($table_attributes, $html);
}
// align all
return HTML::div(array("align" => $align), $html);
}
示例15: link
function link($link, $linktext = false)
{
list($moniker, $page) = split(":", $link, 2);
if (!isset($this->_map[$moniker])) {
return HTML::span(array('class' => 'bad-interwiki'), $linktext ? $linktext : $link);
}
$url = $this->_map[$moniker];
// Urlencode page only if it's a query arg.
// FIXME: this is a somewhat broken heuristic.
$page_enc = strstr($url, '?') ? rawurlencode($page) : $page;
if (strstr($url, '%s')) {
$url = sprintf($url, $page_enc);
} else {
$url .= $page_enc;
}
$link = HTML::a(array('href' => $url));
if (!$linktext) {
$link->pushContent(PossiblyGlueIconToText('interwiki', "{$moniker}:"), HTML::span(array('class' => 'wikipage'), $page));
$link->setAttr('class', 'interwiki');
} else {
$link->pushContent(PossiblyGlueIconToText('interwiki', $linktext));
$link->setAttr('class', 'named-interwiki');
}
return $link;
}