本文整理汇总了PHP中Html::openElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::openElement方法的具体用法?PHP Html::openElement怎么用?PHP Html::openElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::openElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($par)
{
$request = $this->getRequest();
$output = $this->getOutput();
$this->setHeaders();
$this->checkPermissions();
$output->addModules('ext.translate.special.pagemigration');
$output->addModuleStyles('jquery.uls.grid');
# Get request data from, e.g.
$param = $request->getText('param');
# Do stuff
# ...
$out = '';
$out .= Html::openElement('div', array('class' => 'grid'));
$out .= Html::openElement('div', array('class' => 'mw-tpm-sp-error row', 'id' => 'mw-tpm-sp-error-div'));
$out .= Html::element('div', array('class' => 'mw-tpm-sp-error__message five columns hide'));
$out .= Html::closeElement('div');
$out .= Html::openElement('form', array('class' => 'mw-tpm-sp-form row', 'id' => 'mw-tpm-sp-primary-form'));
$out .= Html::element('input', array('id' => 'pm-summary', 'type' => 'hidden', 'value' => $this->msg('pm-summary-import')->inContentLanguage()->text()));
$out .= Html::element('input', array('id' => 'title', 'class' => 'mw-searchInput', 'placeholder' => $this->msg('pm-pagename-placeholder')->text()));
$out .= Html::element('input', array('id' => 'language', 'type' => 'text', 'placeholder' => $this->msg('pm-langcode-placeholder')->text()));
$out .= Html::element('input', array('id' => 'action-import', 'class' => 'mw-ui-button mw-ui-primary', 'type' => 'button', 'value' => $this->msg('pm-import-button-label')->text()));
$out .= Html::element('input', array('id' => 'action-save', 'class' => 'mw-ui-button mw-ui-constructive hide', 'type' => 'button', 'value' => $this->msg('pm-savepages-button-label')->text()));
$out .= Html::element('input', array('id' => 'action-cancel', 'class' => 'mw-ui-button mw-ui-quiet hide', 'type' => 'button', 'value' => $this->msg('pm-cancel-button-label')->text()));
$out .= Html::closeElement('form');
$out .= Html::openElement('div', array('class' => 'mw-tpm-sp-unit-listing'));
$out .= Html::closeElement('div');
$out .= Html::closeElement('div');
$output->addHTML($out);
}
示例2: openElement
/**
* Returns the opening tag of an HTML element in a string.
*
* The advantage over Html::openElement is that any id attribute is ensured to be unique.
*
* @param string $tag
* @param array $attributes
*
* @return string
*/
public function openElement($tag, $attributes = array())
{
if (is_array($attributes) && isset($attributes['id'])) {
$attributes['id'] = $this->getId($attributes['id']);
}
return \Html::openElement($tag, $attributes);
}
示例3: getUserUploadsPageHtml
/**
* Generates HTML for the uploads page for the passed user.
*
* @param User $user
* @return string
*/
public function getUserUploadsPageHtml(User $user)
{
$uploadCount = $this->getUserUploadCount($user->getName());
$mobileContext = MobileContext::singleton();
$html = '';
$attrs = array();
if ($uploadCount !== false) {
$threshold = $this->getUploadCountThreshold();
// FIXME: Use Html class?
$html .= '<div class="content">';
if ($mobileContext->userCanUpload()) {
$html .= '<div class="ctaUploadPhoto"></div>';
}
if ($uploadCount > $threshold) {
$msg = $this->msg('mobile-frontend-photo-upload-user-count-over-limit')->text();
} else {
$msg = $this->msg('mobile-frontend-photo-upload-user-count')->numParams($uploadCount)->parse();
if ($uploadCount === 0) {
$attrs = array('style' => 'display:none');
}
}
$html .= Html::openElement('h2', $attrs) . $msg . Html::closeElement('h2');
$html .= '</div>';
}
return $html;
}
示例4: render
private function render($parser, $params)
{
if (count($params) > 1) {
$rating = $params[1];
} else {
$rating = 0;
}
if (count($params) > 2) {
$max = $params[2];
} else {
$max = $GLOBALS['SemanticRating_DefaultMax'];
}
$output = Html::openElement('span', array('style' => 'white-space:nowrap;'));
if ($rating < 0) {
$rating = 0;
} elseif ($rating > $max) {
$rating = $max;
}
$i = 1;
while ($i <= $rating) {
$output .= Html::element('img', array('src' => $this->imagepath . 'yellowstar.png'));
$i++;
}
if ($rating - $i + 1 != 0) {
$output .= Html::element('img', array('src' => $this->imagepath . 'halfstar.png'));
$i++;
}
while ($i <= $max) {
$output .= Html::element('img', array('src' => $this->imagepath . 'greystar.png'));
$i++;
}
$output .= Html::closeElement('span');
return $output;
}
示例5: execute
public function execute($par)
{
global $wgOut, $wgRequest;
$this->setHeaders();
$code = $wgRequest->getVal('verify');
if ($code !== null) {
$dbw = wfGetDB(DB_MASTER);
$row = $dbw->selectRow('email_capture', array('ec_verified'), array('ec_code' => $code), __METHOD__);
if ($row && !$row->ec_verified) {
$dbw->update('email_capture', array('ec_verified' => 1), array('ec_code' => $code), __METHOD__);
if ($dbw->affectedRows()) {
$wgOut->addWikiMsg('emailcapture-success');
} else {
$wgOut->addWikiMsg('emailcapture-failure');
}
} elseif ($row && $row->ec_verified) {
$wgOut->addWikiMsg('emailcapture-already-confirmed');
} else {
$wgOut->addWikiMsg('emailcapture-invalid-code');
}
} else {
// Show simple form for submitting verification code
$o = Html::openElement('form', array('action' => $this->getTitle()->getFullUrl(), 'method' => 'post'));
$o .= Html::element('p', array(), wfMsg('emailcapture-instructions'));
$o .= Html::openElement('blockquote');
$o .= Html::element('label', array('for' => 'emailcapture-verify'), wfMsg('emailcapture-verify')) . ' ';
$o .= Html::input('verify', '', 'text', array('id' => 'emailcapture-verify', 'size' => 32)) . ' ';
$o .= Html::input('submit', wfMsg('emailcapture-submit'), 'submit');
$o .= Html::closeElement('blockquote');
$o .= Html::closeElement('form');
$wgOut->addHtml($o);
}
}
示例6: executeWhenAvailable
/**
* Render the special page boddy
* @param string $par The username
*/
public function executeWhenAvailable($par = '')
{
$this->offset = $this->getRequest()->getVal('offset', false);
if ($par) {
// enter article history view
$this->user = User::newFromName($par, false);
if ($this->user && ($this->user->idForName() || User::isIP($par))) {
// set page title as on desktop site - bug 66656
$username = $this->user->getName();
$out = $this->getOutput();
$out->addModuleStyles(array('mobile.pagelist.styles', 'mobile.pagesummary.styles'));
$out->setHTMLTitle($this->msg('pagetitle', $this->msg('contributions-title', $username)->plain())->inContentLanguage());
if (User::isIP($par)) {
$this->renderHeaderBar($par);
} else {
$this->renderHeaderBar($this->user->getUserPage());
}
$res = $this->doQuery();
$out->addHtml(Html::openElement('div', array('class' => 'content-unstyled')));
$this->showContributions($res);
$out->addHtml(Html::closeElement('div'));
return;
}
}
$this->showPageNotFound();
}
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:30,代码来源:SpecialMobileContributions.php
示例7: showToolbar
protected function showToolbar() {
$langSelector = Xml::languageSelector( $this->lang );
$fontSelector = new XmlSelect();
$fontSelector->setAttribute( 'id', 'webfonts-font-chooser' );
$sizeSelector = new XmlSelect();
$sizeSelector->setAttribute( 'id', 'webfonts-size-chooser' );
for ( $size = 8; $size <= 28; $size += 2 ) {
$sizeSelector->addOption( $size , $size );
}
$sizeSelector->setDefault( 16 );
$bold = Html::Element( 'button', array( 'id' => 'webfonts-preview-bold' ) , 'B' );
$italic = Html::Element( 'button', array( 'id' => 'webfonts-preview-italic' ) , 'I' );
$underline = Html::Element( 'button', array( 'id' => 'webfonts-preview-underline' ) , 'U' );
$download = Html::Element( 'a', array( 'id' => 'webfonts-preview-download', 'href' => '#' ) ,
wfMsg( 'webfonts-preview-download' ) );
return Html::openElement( 'div', array( 'id' => 'webfonts-preview-toolbar' ) )
. $langSelector[1]
. $fontSelector->getHtml()
. $sizeSelector->getHtml()
. $bold
. $italic
. $underline
. $download
. Html::closeElement( 'div' );
}
示例8: showForm
protected function showForm()
{
global $wgScript;
# Explanatory text
$this->getOutput()->addWikiMsg('configuredpages-list', $this->getLang()->formatNum($this->pager->getNumRows()));
$fields = array();
# Namespace selector
if (count(FlaggedRevs::getReviewNamespaces()) > 1) {
$fields[] = FlaggedRevsXML::getNamespaceMenu($this->namespace, '');
}
# Default version selector
$fields[] = FlaggedRevsXML::getDefaultFilterMenu($this->override);
# Restriction level selector
if (FlaggedRevs::getRestrictionLevels()) {
$fields[] = FlaggedRevsXML::getRestrictionFilterMenu($this->autoreview);
}
$form = Html::openElement('form', array('name' => 'configuredpages', 'action' => $wgScript, 'method' => 'get'));
$form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey());
$form .= "<fieldset><legend>" . wfMsg('configuredpages') . "</legend>\n";
$form .= implode(' ', $fields) . '<br/>';
$form .= Xml::submitButton(wfMsg('go'));
$form .= "</fieldset>\n";
$form .= Html::closeElement('form') . "\n";
$this->getOutput()->addHTML($form);
}
示例9: execute
/**
* Show the special page
* @param string|null $par
*/
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->addModuleStyles('mediawiki.special');
$out->addHTML(\Html::openElement('table', array('class' => 'wikitable mw-listgrouprights-table')) . '<tr>' . \Html::element('th', null, $this->msg('listgrants-grant')->text()) . \Html::element('th', null, $this->msg('listgrants-rights')->text()) . '</tr>');
foreach ($this->getConfig()->get('GrantPermissions') as $grant => $rights) {
$descs = array();
$rights = array_filter($rights);
// remove ones with 'false'
foreach ($rights as $permission => $granted) {
$descs[] = $this->msg('listgrouprights-right-display', \User::getRightDescription($permission), '<span class="mw-listgrants-right-name">' . $permission . '</span>')->parse();
}
if (!count($descs)) {
$grantCellHtml = '';
} else {
sort($descs);
$grantCellHtml = '<ul><li>' . implode("</li>\n<li>", $descs) . '</li></ul>';
}
$id = \Sanitizer::escapeId($grant);
$out->addHTML(\Html::rawElement('tr', array('id' => $id), "<td>" . $this->msg("grant-{$grant}")->escaped() . "</td>" . "<td>" . $grantCellHtml . '</td>'));
}
$out->addHTML(\Html::closeElement('table'));
}
示例10: getLineHtml
/**
* Gets the HTML fragment for a watched page.
*
* @param MobilePage $mp a definition of the page to be rendered.
* @return string
*/
protected function getLineHtml(MobilePage $mp)
{
$thumb = $mp->getSmallThumbnailHtml();
$title = $mp->getTitle();
if (!$thumb) {
$thumb = MobilePage::getPlaceHolderThumbnailHtml('list-thumb-none', 'list-thumb-x');
}
$timestamp = $mp->getLatestTimestamp();
$user = $this->getUser();
$titleText = $title->getPrefixedText();
if ($timestamp) {
$lastModified = $this->msg('mobile-frontend-last-modified-date', $this->getLanguage()->userDate($timestamp, $user), $this->getLanguage()->userTime($timestamp, $user))->parse();
$edit = $mp->getLatestEdit();
$dataAttrs = array('data-timestamp' => $edit['timestamp'], 'data-user-name' => $edit['name'], 'data-user-gender' => $edit['gender']);
$className = 'title';
} else {
$className = 'title new';
$lastModified = '';
$dataAttrs = array();
}
$html = Html::openElement('li', array('class' => 'page-summary', 'title' => $titleText, 'data-id' => $title->getArticleId())) . Html::openElement('a', array('href' => $title->getLocalUrl(), 'class' => $className));
$html .= $thumb;
$html .= Html::element('h3', array(), $titleText);
if ($lastModified) {
$html .= Html::openElement('div', array('class' => 'info')) . Html::element('span', array_merge($dataAttrs, array('class' => 'modified-enhancement')), $lastModified) . Html::closeElement('div');
}
$html .= Html::closeElement('a') . Html::closeElement('li');
return $html;
}
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:35,代码来源:SpecialMobileEditWatchlist.php
示例11: showForm
public function showForm()
{
global $wgScript;
// Text to explain level select (if there are several levels)
if (FlaggedRevs::qualityVersions()) {
$this->getOutput()->addWikiMsg('reviewedpages-list', $this->getLanguage()->formatNum($this->pager->getNumRows()));
}
$form = Html::openElement('form', array('name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get'));
$form .= "<fieldset><legend>" . $this->msg('reviewedpages-leg')->escaped() . "</legend>\n";
// show/hide links
$showhide = array($this->msg('show')->escaped(), $this->msg('hide')->escaped());
$onoff = 1 - $this->hideRedirs;
$link = Linker::link($this->getPageTitle(), $showhide[$onoff], array(), array('hideredirs' => $onoff, 'namespace' => $this->namespace));
$showhideredirs = $this->msg('whatlinkshere-hideredirs')->rawParams($link)->escaped();
$fields = array();
$namespaces = FlaggedRevs::getReviewNamespaces();
if (count($namespaces) > 1) {
$fields[] = FlaggedRevsXML::getNamespaceMenu($this->namespace) . ' ';
}
if (FlaggedRevs::qualityVersions()) {
$fields[] = FlaggedRevsXML::getLevelMenu($this->type) . ' ';
}
$form .= implode(' ', $fields) . ' ';
$form .= $showhideredirs;
if (count($fields)) {
$form .= " " . Xml::submitButton($this->msg('go')->text());
}
$form .= Html::hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . "\n";
$form .= "</fieldset>";
$form .= Html::closeElement('form ') . "\n";
$this->getOutput()->addHTML($form);
}
示例12: renderMessageHtml
/**
* Render message box with system messages, e.g. errors or already logged-in notices
*
* @param string $action The type of action the page is used for ('login' or 'signup')
* @param bool $register Whether the user can register an account
*/
protected function renderMessageHtml($action, $register = false)
{
$msgBox = '';
// placeholder for displaying any login-related system messages (eg errors)
$message = $this->data['message'];
$messageType = $this->data['messagetype'];
// FIXME: Migrate this to a server-side Mustache template
// If there is a system message (error, warning, or success) display that
if ($message && $messageType) {
$msgBox .= Html::openElement('div', array('class' => $messageType . 'box'));
$msgBox .= $message;
$msgBox .= Html::closeElement('div');
// Render already logged-in notice
} elseif ($this->data['loggedin']) {
$msg = $register ? 'mobile-frontend-userlogin-loggedin-register' : 'userlogin-loggedin';
$msgBox .= Html::openElement('div', array('class' => 'warningbox'));
$msgBox .= wfMessage($msg)->params($this->data['loggedinuser'])->parse();
$msgBox .= Html::closeElement('div');
// Show default welcome message
} else {
// The warningbox class is used more for informational purposes than actual warnings.
$msgBox .= Html::openElement('div', array('class' => 'warningbox'));
$headerMsg = wfMessage('mobile-frontend-generic-login')->parse();
$msgBox .= Html::element('strong', array(), $headerMsg);
$msgBox .= Html::element('br');
$msgBox .= wfMessage("mobile-frontend-generic-{$action}-action")->plain();
$msgBox .= Html::closeElement('div');
$msgBox .= $this->getLogoHtml();
}
echo $msgBox;
}
开发者ID:GoProjectOwner,项目名称:mediawiki-extensions-MobileFrontend,代码行数:37,代码来源:UserLoginAndCreateTemplate.php
示例13: execute
public function execute($par)
{
$this->setHeaders();
$out = $this->getContext()->getOutput();
$out->addModules('ext.wikihiero.Special');
$out->addModuleStyles('ext.wikihiero.Special');
// apply CSS during slow load
$out->addWikiMsg('wikihiero-special-page-text');
$out->addHTML('<div id="hiero-result">');
$text = trim($this->getContext()->getRequest()->getVal('text', ''));
if ($text !== '') {
$hiero = new WikiHiero();
$out->addHTML('<table class="wikitable">' . '<tr><th>' . wfMsg('wikihiero-input') . '</th><th>' . wfMsg('wikihiero-result') . '</th></tr>' . '<tr><td><code><hiero>' . nl2br(htmlspecialchars($text)) . "</hiero></code></td><td>{$hiero->render($text)}</td></tr></table>");
}
$out->addHTML('</div>');
// id="hiero-result"
$out->addHTML(Html::openElement('form', array('method' => 'get', 'action' => $this->getTitle()->getLinkUrl())) . Html::element('textarea', array('id' => 'hiero-text', 'name' => 'text'), $text) . Html::element('input', array('type' => 'submit', 'id' => 'hiero-submit', 'name' => 'submit')) . Html::closeElement('form'));
$this->hiero = new WikiHiero();
$out->addHTML('<table><tr><td>');
$out->addHTML('<div class="mw-hiero-list">');
$out->addHTML($this->listHieroglyphs());
$out->addHTML('</div></td><td>');
$out->addHTML($this->getToc());
$out->addHTML('</td></tr></table>');
}
示例14: makeInputForm
/**
* Input form for entering a category
*/
function makeInputForm()
{
$form = '';
$form .= Html::openElement('form', array('name' => 'ajaxtest', 'method' => 'GET', 'action' => $this->getTitle()->getLocalUrl()));
$form .= Html::element('input', array('type' => 'text', 'name' => 'ajaxtest_text', 'id' => 'ajaxtest_text', 'value' => '', 'size' => '64')) . ' ';
$form .= Html::element('br');
$form .= Html::element('label', array('for' => 'usestring'), 'use string value');
$form .= Html::element('input', array('type' => 'checkbox', 'name' => 'usestring', 'id' => 'usestring'));
$form .= Html::element('br');
$form .= Html::element('label', array('for' => 'httpcache'), 'use http cache');
$form .= Html::element('input', array('type' => 'checkbox', 'name' => 'httpcache', 'id' => 'httpcache'));
$form .= Html::element('br');
$form .= Html::element('label', array('for' => 'lastmod'), 'use last modified');
$form .= Html::element('input', array('type' => 'checkbox', 'name' => 'lastmod', 'id' => 'lastmod'));
$form .= Html::element('br');
$form .= Html::element('label', array('for' => 'error'), 'trigger error');
$form .= Html::element('input', array('type' => 'checkbox', 'name' => 'error', 'id' => 'error'));
$form .= Html::element('br');
$form .= Html::openElement('select', array('name' => 'ajaxtest_target', 'id' => 'ajaxtest_target'));
$form .= Html::element('option', array('value' => 'function'), "function");
$form .= Html::element('option', array('value' => 'element'), "element");
$form .= Html::element('option', array('value' => 'input'), "input");
$form .= Html::closeElement('select');
$form .= Html::element('input', array('type' => 'button', 'onclick' => 'doAjaxTest();', 'value' => 'TEST'));
$form .= Html::element('input', array('type' => 'button', 'onclick' => 'clearAjaxTest();', 'value' => 'CLEAR'));
# $form .= Html::element( 'input', array( 'type' => 'button', 'onclick' => 'getElementById("ajaxtest_out").value= getElementById("ajaxtest_text").value;', 'value' => 'DUMMY' ) );
$form .= Html::closeElement('form');
$form .= Html::element('hr');
$form .= Html::element('input', array('type' => 'text', 'name' => 'ajaxtest_out', 'id' => 'ajaxtest_out', 'value' => '', 'size' => '64')) . ' ';
$form .= Html::element('p', array('id' => 'ajaxtest_area'));
$form .= Html::element('hr');
$form .= Html::element('p', array('id' => 'sajax_debug'));
return $form;
}
示例15: getHtml
/**
* Builds the HTML code for the main container
*
* @return String the HTML code
*/
public function getHtml()
{
$ret = $this->indent() . \Html::openElement('div', array('class' => $this->getClassString()));
$ret .= parent::getHtml();
$ret .= $this->indent(-1) . '</div>';
return $ret;
}