本文整理汇总了PHP中xml::label方法的典型用法代码示例。如果您正苦于以下问题:PHP xml::label方法的具体用法?PHP xml::label怎么用?PHP xml::label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml
的用法示例。
在下文中一共展示了xml::label方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActionSelector
/**
* Drop down menu for selection of actions that can be used to filter the log
* @param array $types
* @param string $action
* @return string
* @since 1.27
*/
private function getActionSelector($types, $action)
{
if ($this->allowedActions === null || !count($this->allowedActions)) {
return '';
}
$html = '';
$html .= xml::label(wfMessage('log-action-filter-' . $types[0])->text(), 'action-filter-' . $types[0]) . "\n";
$select = new XmlSelect('subtype');
$select->addOption(wfMessage('log-action-filter-all')->text(), '');
foreach ($this->allowedActions as $value) {
$msgKey = 'log-action-filter-' . $types[0] . '-' . $value;
$select->addOption(wfMessage($msgKey)->text(), $value);
}
$select->setDefault($action);
$html .= $select->getHtml();
return $html;
}
示例2: showForm
public function showForm($err = null)
{
$out = $this->getOutput();
$form = $this->form;
// convenience
$title = $this->form->getPage();
$oldConfig = $form->getOldConfig();
$s = '';
// form HTML string
# Add any error messages
if ("" != $err) {
$out->setSubtitle(wfMsgHtml('formerror'));
$out->addHTML("<p class='error'>{$err}</p>\n");
}
# Add header text
if (!$form->isAllowed()) {
$s .= wfMsgExt('stabilization-perm', 'parse', $title->getPrefixedText());
} else {
$s .= wfMsgExt('stabilization-text', 'parse', $title->getPrefixedText());
}
# Borrow some protection messages for dropdowns
$reasonDropDown = Xml::listDropDown('wpReasonSelection', wfMsgForContent('protect-dropdown'), wfMsgForContent('protect-otherreason-op'), $form->getReasonSelection(), 'mwStabilize-reason', 4);
$scExpiryOptions = wfMsgForContent('protect-expiry-options');
$showProtectOptions = $scExpiryOptions !== '-' && $form->isAllowed();
$dropdownOptions = array();
// array of <label,value>
# Add the current expiry as a dropdown option
if ($oldConfig['expiry'] && $oldConfig['expiry'] != Block::infinity()) {
$timestamp = $this->getLang()->timeanddate($oldConfig['expiry']);
$d = $this->getLang()->date($oldConfig['expiry']);
$t = $this->getLang()->time($oldConfig['expiry']);
$dropdownOptions[] = array(wfMsg('protect-existing-expiry', $timestamp, $d, $t), 'existing');
}
# Add "other time" expiry dropdown option
$dropdownOptions[] = array(wfMsg('protect-othertime-op'), 'othertime');
# Add custom expiry dropdown options (from MediaWiki message)
foreach (explode(',', $scExpiryOptions) as $option) {
if (strpos($option, ":") === false) {
$show = $value = $option;
} else {
list($show, $value) = explode(":", $option);
}
$dropdownOptions[] = array($show, $value);
}
# Actually build the options HTML...
$expiryFormOptions = '';
foreach ($dropdownOptions as $option) {
$show = htmlspecialchars($option[0]);
$value = htmlspecialchars($option[1]);
$expiryFormOptions .= Xml::option($show, $value, $form->getExpirySelection() === $value) . "\n";
}
# Build up the form...
$s .= Xml::openElement('form', array('name' => 'stabilization', 'action' => $this->getTitle()->getLocalUrl(), 'method' => 'post'));
# Add stable version override and selection options
$s .= Xml::fieldset(wfMsg('stabilization-def'), false) . "\n" . Xml::radioLabel(wfMsg('stabilization-def1'), 'wpStableconfig-override', 1, 'default-stable', 1 == $form->getOverride(), $this->disabledAttr()) . '<br />' . "\n" . Xml::radioLabel(wfMsg('stabilization-def2'), 'wpStableconfig-override', 0, 'default-current', 0 == $form->getOverride(), $this->disabledAttr()) . "\n" . Xml::closeElement('fieldset');
# Add autoreview restriction select
$s .= Xml::fieldset(wfMsg('stabilization-restrict'), false) . $this->buildSelector($form->getAutoreview()) . Xml::closeElement('fieldset') . Xml::fieldset(wfMsg('stabilization-leg'), false) . Xml::openElement('table');
# Add expiry dropdown to form...
if ($showProtectOptions && $form->isAllowed()) {
$s .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('stabilization-expiry'), 'mwStabilizeExpirySelection') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::tags('select', array('id' => 'mwStabilizeExpirySelection', 'name' => 'wpExpirySelection', 'onchange' => 'onFRChangeExpiryDropdown()') + $this->disabledAttr(), $expiryFormOptions) . "</td>\n\t\t\t\t</tr>";
}
# Add custom expiry field to form...
$attribs = array('id' => "mwStabilizeExpiryOther", 'onkeyup' => 'onFRChangeExpiryField()') + $this->disabledAttr();
$s .= "\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('stabilization-othertime'), 'mwStabilizeExpiryOther') . '</td>
<td class="mw-input">' . Xml::input("mwStabilize-expiry", 50, $form->getExpiryCustom(), $attribs) . '</td>
</tr>';
# Add comment input and submit button
if ($form->isAllowed()) {
$watchLabel = wfMsgExt('watchthis', 'parseinline');
$watchAttribs = array('accesskey' => wfMsg('accesskey-watch'), 'id' => 'wpWatchthis');
$watchChecked = $this->getUser()->getOption('watchdefault') || $title->userIsWatching();
$reviewLabel = wfMsgExt('stabilization-review', 'parseinline');
$s .= ' <tr>
<td class="mw-label">' . xml::label(wfMsg('stabilization-comment'), 'wpReasonSelection') . '</td>
<td class="mw-input">' . $reasonDropDown . '</td>
</tr>
<tr>
<td class="mw-label">' . Xml::label(wfMsg('stabilization-otherreason'), 'wpReason') . '</td>
<td class="mw-input">' . Xml::input('wpReason', 70, $form->getReasonExtra(), array('id' => 'wpReason', 'maxlength' => 255)) . '</td>
</tr>
<tr>
<td></td>
<td class="mw-input">' . Xml::check('wpReviewthis', $form->getReviewThis(), array('id' => 'wpReviewthis')) . "<label for='wpReviewthis'>{$reviewLabel}</label>" . '     ' . Xml::check('wpWatchthis', $watchChecked, $watchAttribs) . " <label for='wpWatchthis' " . Xml::expandAttributes(array('title' => Linker::titleAttrib('watch', 'withaccess'))) . ">{$watchLabel}</label>" . '</td>
</tr>
<tr>
<td></td>
<td class="mw-submit">' . Xml::submitButton(wfMsg('stabilization-submit')) . '</td>
</tr>' . Xml::closeElement('table') . Html::hidden('title', $this->getTitle()->getPrefixedDBKey()) . Html::hidden('page', $title->getPrefixedText()) . Html::hidden('wpEditToken', $this->getUser()->editToken());
} else {
$s .= Xml::closeElement('table');
}
$s .= Xml::closeElement('fieldset') . Xml::closeElement('form');
$out->addHTML($s);
$out->addHTML(Xml::element('h2', null, htmlspecialchars(LogPage::logName('stable'))));
LogEventsList::showLogExtract($out, 'stable', $title->getPrefixedText(), '', array('lim' => 25));
# Add some javascript for expiry dropdowns
$out->addScript("<script type=\"text/javascript\">\n\t\t\t\tfunction onFRChangeExpiryDropdown() {\n\t\t\t\t\tdocument.getElementById('mwStabilizeExpiryOther').value = '';\n\t\t\t\t}\n\t\t\t\tfunction onFRChangeExpiryField() {\n\t\t\t\t\tdocument.getElementById('mwStabilizeExpirySelection').value = 'othertime';\n\t\t\t\t}\n\t\t\t</script>");
}