本文整理汇总了PHP中XML::option方法的典型用法代码示例。如果您正苦于以下问题:PHP XML::option方法的具体用法?PHP XML::option怎么用?PHP XML::option使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML
的用法示例。
在下文中一共展示了XML::option方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($par)
{
global $wgOut, $wgUser;
$this->setHeaders();
if (!$wgUser->isAllowed('stafflog')) {
throw new PermissionsError('stafflog');
}
$pager = new StaffLoggerPager("");
$sTypesDropDown = XML::openElement('select', array('name' => 'type', 'id' => 'StaffLogFilterType'));
foreach ($this->aTypes as $k => $v) {
$sTypesDropDown .= XML::option($v, $k, $k == $this->request->getText('type', ''));
}
$sTypesDropDown .= XML::closeElement('select');
$wgOut->addHTML(XML::openElement('form', array('method' => 'get', 'action' => $this->getTitle()->getLocalURL())) . XML::openElement('fieldset') . XML::element('legend', null, wfMsg('stafflog-filter-label'), false) . XML::inputLabel(wfMsg('stafflog-filter-user'), 'user', 'StaffLogFilterUser', false, htmlspecialchars($this->request->getText('user', ''), ENT_QUOTES, 'UTF-8')) . XML::label(wfMsg('stafflog-filter-type'), 'StaffLogFilterType') . ' ' . $sTypesDropDown . ' ' . XML::submitButton(wfMsg('stafflog-filter-apply')) . XML::closeElement('fieldset') . XML::closeElement('form') . XML::openElement('div', array('class' => 'mw-spcontent')) . $pager->getNavigationBar() . '<ul>' . $pager->getBody() . '</ul>' . $pager->getNavigationBar() . XML::closeElement('div'));
}
示例2: showInfo
/**
* Retrieves and shows the gathered info to the user
* @param $target Mixed: user whose info we're looking up
*/
function showInfo($target, $emailUser = "")
{
global $wgOut, $wgLang, $wgScript, $wgEnableWallExt, $wgEnableUserLoginExt;
//Small Stuff Week - adding table from Special:LookupContribs --nAndy
global $wgExtensionsPath, $wgJsMimeType, $wgResourceBasePath, $wgEnableLookupContribsExt;
/**
* look for @ in username
*/
$count = 0;
$aUsers = array();
$userTarget = "";
if (strpos($target, '@') !== false) {
/**
* find username by email
*/
$emailUser = htmlspecialchars($emailUser);
$dbr = wfGetDB(DB_SLAVE);
$oRes = $dbr->select("user", "user_name", array("user_email" => $target), __METHOD__);
$loop = 0;
while ($oRow = $dbr->fetchObject($oRes)) {
if ($loop === 0) {
$userTarget = $oRow->user_name;
}
if (!empty($emailUser) && $emailUser == $oRow->user_name) {
$userTarget = $emailUser;
}
$aUsers[] = $oRow->user_name;
$loop++;
}
$count = $loop;
}
$user = User::newFromName(!empty($userTarget) ? $userTarget : $target);
$tempUser = false;
if ($user == null || $user->getId() == 0) {
// Check if a temporary user is at this name
if (!empty($wgEnableUserLoginExt)) {
$tempUser = TempUser::getTempUserFromName(!empty($userTarget) ? $userTarget : $target);
}
if ($tempUser) {
$user = $tempUser->mapTempUserToUser(false);
} else {
$wgOut->addWikiText('<span class="error">' . wfMsg('lookupuser-nonexistent', $target) . '</span>');
return;
}
}
if ($count > 1) {
$options = array();
if (!empty($aUsers) && is_array($aUsers)) {
foreach ($aUsers as $id => $userName) {
$options[] = XML::option($userName, $userName, $userName == $userTarget);
}
}
$selectForm = Xml::openElement('select', array('id' => 'email_user', 'name' => "email_user"));
$selectForm .= "\n" . implode("\n", $options) . "\n";
$selectForm .= Xml::closeElement('select');
$selectForm .= "({$count})";
$wgOut->addHTML(Xml::openElement('fieldset') . "\n" . Xml::openElement('form', array('method' => 'get', 'action' => $wgScript)) . "\n" . Html::hidden('title', $this->getTitle()->getPrefixedText()) . "\n" . Html::hidden('target', $target) . "\n" . Xml::openElement('table', array('border' => '0')) . "\n" . Xml::openElement('tr') . "\n" . Xml::openElement('td', array('align' => 'right')) . wfMsgHtml('lookupuser-foundmoreusers') . Xml::closeElement('td') . "\n" . Xml::openElement('td', array('align' => 'left')) . "\n" . $selectForm . Xml::closeElement('td') . "\n" . Xml::openElement('td', array('colspan' => '2', 'align' => 'center')) . Xml::submitButton(wfMsgHtml('go')) . Xml::closeElement('td') . "\n" . Xml::closeElement('tr') . "\n" . Xml::closeElement('table') . "\n" . Xml::closeElement('form') . "\n" . Xml::closeElement('fieldset'));
}
$authTs = $user->getEmailAuthenticationTimestamp();
if ($authTs) {
$authenticated = wfMsg('lookupuser-authenticated', $wgLang->timeanddate($authTs));
} else {
$authenticated = wfMsg('lookupuser-not-authenticated');
}
$optionsString = '';
foreach ($user->getOptions() as $name => $value) {
$optionsString .= "{$name} = {$value} <br />";
}
$name = $user->getName();
if ($user->getEmail()) {
$email = $user->getEmail();
$email_output = wfMsg('lookupuser-email', $email, $name);
} else {
$email_output = wfMsg('lookupuser-no-email');
}
if ($user->getRegistration()) {
$registration = $wgLang->timeanddate($user->getRegistration());
} else {
$registration = wfMsg('lookupuser-no-registration');
}
$wgOut->addWikiText('*' . wfMsg('username') . ' [[User:' . $name . '|' . $name . ']] (' . $wgLang->pipeList(array('<span id="lu-tools">[[' . (!empty($wgEnableWallExt) ? 'Message Wall:' . $name . '|' . wfMsg('wall-message-wall-shorten') : 'User talk:' . $name . '|' . wfMsg('talkpagelinktext')) . ']]', '[[Special:Contributions/' . $name . '|' . wfMsg('contribslink') . ']]</span>)')));
$wgOut->addWikiText('*' . wfMsgForContent('lookupuser-toollinks', $name, urlencode($name)));
$wgOut->addWikiText('*' . wfMsg('lookupuser-id', $user->getId()));
if (!empty($tempUser)) {
$userStatus = wfMsg('lookupuser-account-status-tempuser');
} else {
$userStatus = wfMsg('lookupuser-account-status-realuser');
}
$wgOut->addWikiText('*' . wfMsg('lookupuser-account-status') . $userStatus);
$wgOut->addWikiText('*' . $email_output);
$wgOut->addWikiText('*' . wfMsg('lookupuser-realname', $user->getRealName()));
$wgOut->addWikiText('*' . wfMsg('lookupuser-registration', $registration));
$wgOut->addWikiText('*' . wfMsg('lookupuser-touched', $wgLang->timeanddate($user->mTouched)));
$wgOut->addWikiText('*' . wfMsg('lookupuser-info-authenticated', $authenticated));
//Begin: Small Stuff Week - adding table from Special:LookupContribs --nAndy
if (!empty($wgEnableLookupContribsExt)) {
//.........这里部分代码省略.........