本文整理汇总了PHP中HTML::a方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::a方法的具体用法?PHP HTML::a怎么用?PHP HTML::a使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::a方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_menu_link
/**
* Print a single menu link.
* @param string $uid Menu identifier
* @param string $text Override link text
* @param string $classes class="$classes"
* @param string $intag e.g. 'target="_blank"'
*/
function print_menu_link($uid, $text = null, $classes = null, $intag = null)
{
if (!($menu = get_menu_entry($uid))) {
return null;
}
echo HTML::a($menu->url, $text ? $text : $menu->name, $menu->get('title', $menu->name), $classes, $intag);
}
示例2: run
function run($dbi, $argstr, &$request, $basepage)
{
global $WikiTheme;
$args = $this->getArgs($argstr, $request);
extract($args);
if (!$src) {
return $this->error(fmt("%s parameter missing", "'src'"));
}
// FIXME: Better recursion detection.
// FIXME: Currently this doesnt work at all.
if ($src == $request->getURLtoSelf()) {
return $this->error(fmt("recursive inclusion of url %s", $src));
}
if (!IsSafeURL($src)) {
return $this->error(_("Bad url in src: remove all of <, >, \""));
}
$params = array('title' => _("Transcluded page"), 'src' => $src, 'width' => "100%", 'height' => $height, 'marginwidth' => 0, 'marginheight' => 0, 'class' => 'transclude', "onload" => "adjust_iframe_height(this);");
$noframe_msg[] = fmt("See: %s", HTML::a(array('href' => $src), $src));
$noframe_msg = HTML::div(array('class' => 'transclusion'), HTML::p(array(), $noframe_msg));
$iframe = HTML::div(HTML::iframe($params, $noframe_msg));
/* This doesn't work very well... maybe because CSS screws up NS4 anyway...
$iframe = new HtmlElement('ilayer', array('src' => $src), $iframe);
*/
return HTML(HTML::p(array('class' => 'transclusion-title'), fmt("Transcluded from %s", LinkURL($src))), $this->_js(), $iframe);
}
示例3: run
function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
$parser = new AtomParser();
assert(!empty($url));
$parser->parse_url($url);
$html = '';
$items = HTML::dl();
foreach ($parser->feed as $feed) {
$title = HTML::h3(HTML::a(array('href' => $feed["links"]["0"]["href"]), $feed["title"]));
$counter = 1;
foreach ($parser->entries as $entry) {
$item = HTML::dt(HTML::a(array('href' => $entry["links"]["0"]["href"]), $entry["title"]));
$items->pushContent($item);
if (!$titleonly) {
$description = HTML::dd(HTML::raw(html_entity_decode($entry["content"])));
} else {
$description = HTML::dd();
}
$items->pushContent($description);
if ($maxitem > 0 && $counter >= $maxitem) {
break;
}
$counter++;
}
$html = HTML::div(array('class' => 'rss'), $title);
$html->pushContent($items);
}
return $html;
}
示例4: __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);
}
示例5: getThumbCode
/**
* Генерирует код для миниатюры
*
* @param string $file
* @param string $preset
*/
public static function getThumbCode($file, $preset = 'image.medium')
{
$file = UPLOADS . $file;
$thumbnail = image_preset($preset, $file, TRUE);
$preset = str_replace('.', '-', $preset);
return HTML::a(File::pathToUri($file), self::getCode($thumbnail), array('class' => 'preset ' . $preset));
}
示例6: 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"));
}
示例7: showUsers
public static function showUsers($usuario_tipo)
{
$db = new DB();
$login = new ModelLogin();
if ($usuario_tipo == null) {
$query = DB::connect()->prepare("SELECT * FROM wm_usuarios");
} else {
$query = DB::connect()->prepare("SELECT * FROM wm_usuarios WHERE usuario_tipo=:usuario_tipo");
$query->bindValue(':usuario_tipo', $usuario_tipo, PDO::PARAM_STR);
}
$query->execute();
$result = $query->fetchAll();
switch ($usuario_tipo) {
case "musico":
foreach ($result as $row) {
echo "<tr>";
echo "<td>" . $row['usuario_id'] . "</td>";
echo "<td>" . $row['usuario_nombre'] . "</td>";
echo "<td>" . $row['usuario_nombre_usuario'] . "</td>";
echo "<td>" . $row['usuario_email'] . "</td>";
echo "<td>" . $db->getUserDataEstilo($login->getUserDataCampo($row['usuario_id'], "estilo_id")) . "</td>";
echo "<td>" . HTML::a(ROUTER::create_action_url("admin/edit&usuario_id=" . $row['usuario_id'] . "&usuario_tipo=" . $row['usuario_tipo'] . ""), "Editar") . "</td>";
echo "</tr>";
}
break;
case "local":
foreach ($result as $row) {
echo "<tr>";
echo "<td>" . $row['usuario_id'] . "</td>";
echo "<td>" . $row['usuario_nombre'] . "</td>";
echo "<td>" . $row['usuario_nombre_usuario'] . "</td>";
echo "<td>" . $row['usuario_email'] . "</td>";
echo "<td>" . $row['usuario_direccion'] . "</td>";
echo "<td>" . HTML::a(ROUTER::create_action_url("admin/edit&usuario_id=" . $row['usuario_id'] . "&usuario_tipo=" . $row['usuario_tipo'] . ""), "Editar") . "</td>";
echo "</tr>";
}
break;
case "fan":
foreach ($result as $row) {
echo "<tr>";
echo "<td>" . $row['usuario_id'] . "</td>";
echo "<td>" . $row['usuario_nombre'] . "</td>";
echo "<td>" . $row['usuario_apellido1'] . "</td>";
echo "<td>" . $row['usuario_apellido2'] . "</td>";
echo "<td>" . $row['usuario_nombre_usuario'] . "</td>";
echo "<td>" . $row['usuario_email'] . "</td>";
echo "<td>" . HTML::a(ROUTER::create_action_url("admin/edit&usuario_id=" . $row['usuario_id'] . "&usuario_tipo=" . $row['usuario_tipo'] . ""), "Editar") . "</td>";
echo "</tr>";
}
break;
default:
echo "Error en AdminPanel";
break;
}
}
示例8: 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;
}
示例9: index
public function index($action = NULL)
{
switch ($action) {
case 'file':
$tpl = new Template('Upload.file');
$tpl->show();
break;
case 'image':
$image = new Upload_Image('file', array('preset' => 'post', 'path' => UPLOADS . DS . 'posts' . DS . date('Y/m/d')));
if ($result = $image->upload()) {
exit(HTML::img($result));
}
break;
default:
append('content', HTML::a(Url::gear('upload') . '/file?iframe', t('Upload'), array('rel' => 'modal', 'class' => 'button')));
}
}
示例10: 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;
}
示例11: __construct
/**
* Prepare the DB object.
*
* @param type $username Database username
* @param type $password Database password
* @param type $location Database location
* @param type $database Database name
* @param type $prefix Table Prefix
*/
function __construct($username = null, $password = null, $location = null, $database = null, $prefix = '', $charset = 'utf8')
{
if (func_num_args() === 0) {
$username = @$GLOBALS['username'];
$password = @$GLOBALS['password'];
$location = @$GLOBALS['location'];
$database = @$GLOBALS['database'];
$prefix = @$GLOBALS['prefix'];
}
$this->prefix = $prefix;
@($this->mysqli = new mysqli($location, $username, $password, $database));
if ($this->errorConnection()) {
if (DEBUG) {
$password_shown = $password === '' ? _("nessuna") : sprintf(_("di %d caratteri"), strlen($password));
error_die(sprintf(_("Impossibile connettersi al database '%s' tramite l'utente '%s' e password (%s) sul server MySQL/MariaDB '%s'. Specifica correttamente queste informazioni nel file di configurazione del tuo progetto (usualmente '%s'). %s."), $database, $username, $password_shown, $location, 'load.php', HTML::a('https://github.com/valerio-bozzolan/boz-php-another-php-framework/blob/master/README.md#use-it', _("Documentazione"))));
} else {
error_die(_("Errore nello stabilire una connessione al database."));
}
}
@$this->mysqli->set_charset($charset);
}
示例12: 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 {
// 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"));
}
示例13: elseif
<?php
use yii\helpers\Html;
?>
<nav>
<div class="container">
<div class="row">
<div class="nav-inner">
<ul id="nav" class="hidden-xs">
<li id="nav-home" class="level0 parent drop-menu"><?php
echo HTML::a('<span>Trang chủ</span>', '/');
?>
</li>
<?php
$depth = 0;
foreach ($categories as $key => $category) {
if ($category->depth == $depth && $key != 0) {
echo '</li>';
} elseif ($category->depth > $depth) {
if ($depth == 0) {
echo '<div class="level0-wrapper dropdown-6col"><div class="level0-wrapper2"> <div class="nav-block nav-block-center grid13 itemgrid itemgrid-4col"><ul class="level0">';
} else {
echo '<ul class="level' . $depth . '">';
}
} else {
for ($i = $depth - $category->depth; $i; $i--) {
if ($i == 1 && $category->depth == 0) {
echo '</li></ul>';
echo '</div></div>';
echo '<div class="row"><div class="col-lg-4">' . Html::img('/uploads/demo/ads/cat-1.jpg', ['class' => 'img-responsive']) . '</div>
<div class="col-lg-4">' . Html::img('/uploads/demo/ads/cat-2.jpg', ['class' => 'img-responsive']) . '</div>
示例14: displayPage
function displayPage(&$request, $template = false)
{
global $WikiTheme, $pv;
$pagename = $request->getArg('pagename');
$version = $request->getArg('version');
$page = $request->getPage();
if ($version) {
$revision = $page->getRevision($version);
if (!$revision) {
NoSuchRevision($request, $page, $version);
}
} else {
$revision = $page->getCurrentRevision();
}
if (isSubPage($pagename)) {
$pages = explode(SUBPAGE_SEPARATOR, $pagename);
$last_page = array_pop($pages);
// deletes last element from array as side-effect
$pageheader = HTML::span(HTML::a(array('href' => WikiURL($pages[0]), 'class' => 'pagetitle'), $WikiTheme->maybeSplitWikiWord($pages[0] . SUBPAGE_SEPARATOR)));
$first_pages = $pages[0] . SUBPAGE_SEPARATOR;
array_shift($pages);
foreach ($pages as $p) {
if ($pv != 2) {
//Add the Backlink in page title
$pageheader->pushContent(HTML::a(array('href' => WikiURL($first_pages . $p), 'class' => 'backlinks'), $WikiTheme->maybeSplitWikiWord($p . SUBPAGE_SEPARATOR)));
} else {
// Remove Backlinks
$pageheader->pushContent(HTML::h1($pagename));
}
$first_pages .= $p . SUBPAGE_SEPARATOR;
}
if ($pv != 2) {
$backlink = HTML::a(array('href' => WikiURL($pagename, array('action' => _("BackLinks"))), 'class' => 'backlinks'), $WikiTheme->maybeSplitWikiWord($last_page));
$backlink->addTooltip(sprintf(_("BackLinks for %s"), $pagename));
} else {
$backlink = HTML::h1($pagename);
}
$pageheader->pushContent($backlink);
} else {
if ($pv != 2) {
$pageheader = HTML::a(array('href' => WikiURL($pagename, array('action' => _("BackLinks"))), 'class' => 'backlinks'), $WikiTheme->maybeSplitWikiWord($pagename));
$pageheader->addTooltip(sprintf(_("BackLinks for %s"), $pagename));
} else {
$pageheader = HTML::h1($pagename);
//Remove Backlinks
}
if ($request->getArg('frame')) {
$pageheader->setAttr('target', '_top');
}
}
// {{{ Codendi hook to insert stuff between navbar and header
$eM =& EventManager::instance();
$ref_html = '';
$crossref_fact = new CrossReferenceFactory($pagename, ReferenceManager::REFERENCE_NATURE_WIKIPAGE, GROUP_ID);
$crossref_fact->fetchDatas();
if ($crossref_fact->getNbReferences() > 0) {
$ref_html .= '<h3>' . $GLOBALS['Language']->getText('cross_ref_fact_include', 'references') . '</h3>';
$ref_html .= $crossref_fact->getHTMLDisplayCrossRefs();
}
$additional_html = false;
$eM->processEvent('wiki_before_content', array('html' => &$additional_html, 'group_id' => GROUP_ID, 'wiki_page' => $pagename));
if ($additional_html) {
$beforeHeader = HTML();
$beforeHeader->pushContent($additional_html);
$beforeHeader->pushContent(HTML::raw($ref_html));
$toks['BEFORE_HEADER'] = $beforeHeader;
} else {
$beforeHeader = HTML();
$beforeHeader->pushContent(HTML::raw($ref_html));
$toks['BEFORE_HEADER'] = $beforeHeader;
}
// }}} /Codendi hook
$pagetitle = SplitPagename($pagename);
if ($redirect_from = $request->getArg('redirectfrom')) {
$redirect_message = HTML::span(array('class' => 'redirectfrom'), fmt("(Redirected from %s)", RedirectorLink($redirect_from)));
// abuse the $redirected template var for some status update notice
} elseif ($request->getArg('errormsg')) {
$redirect_message = $request->getArg('errormsg');
$request->setArg('errormsg', false);
}
$request->appendValidators(array('pagerev' => $revision->getVersion(), '%mtime' => $revision->get('mtime')));
/*
// FIXME: This is also in the template...
if ($request->getArg('action') != 'pdf' and !headers_sent()) {
// FIXME: enable MathML/SVG/... support
if (ENABLE_XHTML_XML
and (!isBrowserIE()
and strstr($request->get('HTTP_ACCEPT'),'application/xhtml+xml')))
header("Content-Type: application/xhtml+xml; charset=" . $GLOBALS['charset']);
else
header("Content-Type: text/html; charset=" . $GLOBALS['charset']);
}
*/
$page_content = $revision->getTransformedContent();
// if external searchengine (google) referrer, highlight the searchterm
// FIXME: move that to the transformer?
// OR: add the searchhightplugin line to the content?
if ($result = isExternalReferrer($request)) {
if (DEBUG and !empty($result['query'])) {
//$GLOBALS['SearchHighlightQuery'] = $result['query'];
//.........这里部分代码省略.........
示例15:
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
<i class="fa fa-bars"></i>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navbar-collapse">
<ul class="nav navbar-nav">
<!--li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li-->
<li><?php
echo HTML::a('Перейти на сайт', Url::to('/', true), ['target' => '_blank']);
?>
</li>
<!--li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
<li class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li-->
</ul>