本文整理汇总了PHP中Xml::element方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::element方法的具体用法?PHP Xml::element怎么用?PHP Xml::element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::element方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
function showForm($err = '')
{
global $wgOut, $wgUser, $wgLang;
$wgOut->setPagetitle(wfMsg("makesysoptitle"));
$wgOut->addWikiText(wfMsg("makesysoptext"));
$titleObj = Title::makeTitle(NS_SPECIAL, "Makesysop");
$action = $titleObj->getLocalUrl("action=submit");
if ($wgUser->isAllowed('userrights')) {
$wgOut->addWikiText(wfMsg('makesysop-see-userrights'));
}
if ("" != $err) {
$wgOut->setSubtitle(wfMsg("formerror"));
$wgOut->addHTML("<p class='error'>{$err}</p>\n");
}
$namedesc = wfMsg("makesysopname");
if (!is_null($this->mUser)) {
$encUser = htmlspecialchars($this->mUser);
} else {
$encUser = "";
}
$reason = htmlspecialchars(wfMsg("userrights-reason"));
$makebureaucrat = wfMsg("setbureaucratflag");
$mss = wfMsg("set_user_rights");
$wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $action, 'id' => 'makesysop')) . Xml::openElement('fieldset') . Xml::element('legend', array(), wfMsg('makesysoptitle')) . "<table border='0'>\n\t\t\t<tr>\n\t\t\t\t<td align='right'>{$namedesc}</td>\n\t\t\t\t<td align='left'>" . Xml::input('wpMakesysopUser', 40, $encUser) . "</td>\n\t\t\t</tr><tr>\n\t\t\t\t<td align='right'>{$reason}</td>\n\t\t\t\t<td align='left'>" . Xml::input('wpMakesysopReason', 40, $this->mReason, array('maxlength' => 255)) . "</td>\n\t\t\t</tr><tr>\n\t\t\t\t<td> </td>\n\t\t\t\t<td align='left'>" . Xml::checkLabel($makebureaucrat, 'wpSetBureaucrat', 'wpSetBureaucrat', $this->mSetBureaucrat) . "</td>\n\t\t\t</tr><tr>\n\t\t\t\t<td> </td>\n\t\t\t\t<td align='left'>" . Xml::submitButton($mss, array('name' => 'wpMakesysopSubmit')) . "</td>\n\t\t\t</tr>\n\t\t\t</table>" . Xml::hidden('wpEditToken', $wgUser->editToken()) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
}
示例2: execute
public function execute($par)
{
global $wgCooperationStatsGoogleCharts, $wgOut;
$nb_of_revuser = wfMsg('cooperationstatistics-limit-few-revisors');
$nbpages = $this->getNbOfPages($nb_of_revuser, '<=');
if (!$this->mIncluding) {
$this->OutputTableRaw($nbpages, $nb_of_revuser, 'init');
}
$retval = array();
$retval[$nb_of_revuser] = $this->getNbOfPages($nb_of_revuser, '=');
$nb_of_revuser++;
$range = 1 + wfMsg('cooperationstatistics-limit-many-revisors') - $nb_of_revuser;
for ($j = 0; $j < $range; $j++) {
$nbpages = $this->getNbOfPages($nb_of_revuser, '=');
if (!$this->mIncluding) {
$this->OutputTableRaw($nbpages, $nb_of_revuser, '=');
}
$retval[$nb_of_revuser] = $nbpages;
$nb_of_revuser++;
}
$nbpages = $this->getNbOfPages($nb_of_revuser, '>=');
if (!$this->mIncluding) {
$this->OutputTableRaw($nbpages, $nb_of_revuser, 'end');
}
$retval[$nb_of_revuser] = $nbpages;
if ($wgCooperationStatsGoogleCharts == True) {
$wgOut->addHTML(Xml::element('img', array('src' => $this->getGoogleChartBarParams($retval))) . Xml::element('img', array('src' => $this->getGoogleChartParams($retval))));
}
}
示例3: formatValue
/**
* Format a table cell. The return value should be HTML, but use an empty
* string not   for empty cells. Do not include the <td> and </td>.
*
* The current result row is available as $this->mCurrentRow, in case you
* need more context.
*
* @param $name String: the database field name
* @param $value String: the value retrieved from the database
*/
function formatValue($name, $value)
{
global $wgLang;
switch ($name) {
case 'wpp_name':
return SpecialSubscriptions::getLinkNew($value, 'wpp-' . $value);
case 'wpp_period_months':
return wfMessage('wp-period', $value);
case 'wpp_nb_wikiplaces':
case 'wpp_nb_wikiplace_pages':
return wfFormatNumber($value);
case 'wpp_monthly_bandwidth':
case 'wpp_diskspace':
return wfFormatSizeMB($value);
case 'wpp_price':
$cur = ' ' . $this->mCurrentRow->wpp_currency;
if ($cur == ' EUR') {
$cur = ' ' . wfMessage('cur-euro')->text();
}
$cur = Xml::element('span', array('class' => 'currency'), $cur);
return $wgLang->formatNum($value) . $cur;
case 'wpp_end_date':
return $wgLang->date($value, true);
case 'hard_quotas':
return $this->formatHardQuotas();
case 'monthly_quotas':
return $this->formatMonthlyQuotas();
default:
return htmlspecialchars($value);
}
}
示例4: show
function show($params)
{
global $wgOut, $wgUser, $wgLang;
$dqi = DeleteQueueItem::newFromId($params[1]);
if (!$dqi) {
$wgOut->setPageTitle(wfMsg('deletequeue-case-no-case-title'));
$wgOut->addWikiMsg('deletequeue-case-no-case', $params[1]);
return;
}
$wgOut->setPageTitle(wfMsg('deletequeue-case-title'));
$wgOut->addWikiMsg('deletequeue-case-intro');
if (wfTimestamp(TS_UNIX, $dqi->getExpiry()) < time() && $wgUser->isAllowed($dqi->getQueue() . '-review')) {
$wgOut->addWikiMsg('deletequeue-case-needs-review', $this->getTitle("case/" . $params[1] . "/review"));
}
// Show basic data
$sk = $wgUser->getSkin();
$fields = array();
$fields['deletequeue-case-page'] = $sk->link($this->getTitle());
$fields['deletequeue-case-reason'] = DeleteQueueInterface::formatReason(null, $dqi->getReason());
$expiry = $dqi->getExpiry();
if ($expiry) {
$fields['deletequeue-case-expiry'] = $wgLang->timeanddate($expiry);
}
$fields['deletequeue-case-votes'] = $dqi->formatVoteCount();
$wgOut->addHTML(Xml::element('h2', null, wfMsg('deletequeue-case-details')) . Xml::buildForm($fields) . Xml::element('h2', null, wfMsg('deletequeue-case-votes')));
$article = $dqi->getArticle();
$this->showVotes($article, $dqi);
}
示例5: show
function show()
{
global $wgOut, $wgUser;
// Header
$wgOut->setSubTitle(wfMsg('abusefilter-tools-subtitle'));
$wgOut->addWikiMsg('abusefilter-tools-text');
// Expression evaluator
$eval = '';
$eval .= AbuseFilter::buildEditBox('', 'wpTestExpr');
// Only let users with permission actually test it
if ($wgUser->isAllowed('abusefilter-modify')) {
$eval .= Xml::tags('p', null, Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-submitexpr', 'onclick' => 'doExprSubmit();', 'value' => wfMsg('abusefilter-tools-submitexpr'))));
$eval .= Xml::element('p', array('id' => 'mw-abusefilter-expr-result'), ' ');
}
$eval = Xml::fieldset(wfMsg('abusefilter-tools-expr'), $eval);
$wgOut->addHTML($eval);
// Associated script
$exprScript = file_get_contents(dirname(__FILE__) . '/tools.js');
$wgOut->addInlineScript($exprScript);
global $wgUser;
if ($wgUser->isAllowed('abusefilter-modify')) {
// Hacky little box to re-enable autoconfirmed if it got disabled
$rac = '';
$rac .= Xml::inputLabel(wfMsg('abusefilter-tools-reautoconfirm-user'), 'wpReAutoconfirmUser', 'reautoconfirm-user', 45);
$rac .= ' ';
$rac .= Xml::element('input', array('type' => 'button', 'id' => 'mw-abusefilter-reautoconfirmsubmit', 'onclick' => 'doReautoSubmit();', 'value' => wfMsg('abusefilter-tools-reautoconfirm-submit')));
$rac = Xml::fieldset(wfMsg('abusefilter-tools-reautoconfirm'), $rac);
$wgOut->addHTML($rac);
}
}
示例6: deleteForm
function deleteForm($query, $reason)
{
$title = $this->getTitle();
$output = $this->getOutput();
$pages = $this->getPages($query);
$count = count($pages);
if ($count == 0) {
$output->addWikiText($this->msg('nukedpl-nopages', $query)->text());
return $this->queryForm();
}
$output->addWikiText($this->msg('nukedpl-list', $count, $query)->text());
$output->addHTML(Xml::element('form', array('action' => $title->getLocalURL('action=delete'), 'method' => 'post'), null));
$output->addHTML(Xml::element('input', array('type' => 'submit', 'value' => $this->msg('nukedpl-nuke')->text())));
$output->addHTML('<div>' . $this->msg('deletecomment')->escaped() . '</div>');
$output->addHTML(Xml::element('input', array('name' => 'reason', 'value' => $reason, 'size' => 60)));
$output->addHTML('<ol>');
foreach ($pages as $page) {
$page = Title::newFromText($page);
if ($page and $page->isKnown()) {
$output->addHTML('<li>');
$output->addHTML(Xml::element('input', array('type' => 'checkbox', 'name' => 'ids[]', 'value' => $page->getArticleID(), 'checked' => 'checked')));
$output->addHTML(Linker::makeKnownLinkObj($page));
$output->addHTML('</li>');
}
}
$output->addHTML('</ol>');
$output->addHTML(Xml::element('input', array('type' => 'submit', 'value' => $this->msg('nukedpl-nuke')->text())));
$output->addHTML('</form>');
}
示例7: doTagRow
function doTagRow($tag, $hitcount)
{
static $sk = null, $doneTags = array();
if (!$sk) {
global $wgUser;
$sk = $wgUser->getSkin();
}
if (in_array($tag, $doneTags)) {
return '';
}
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsg('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $disp);
$desc = wfMsgExt("tag-{$tag}-description", 'parseinline');
$desc = wfEmptyMsg("tag-{$tag}-description", $desc) ? '' : $desc;
$desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsg('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $desc);
$hitcount = wfMsg('tags-hitcount', $hitcount);
$hitcount = $sk->link(SpecialPage::getTitleFor('RecentChanges'), $hitcount, array(), array('tagfilter' => $tag));
$newRow .= Xml::tags('td', null, $hitcount);
$doneTags[] = $tag;
return Xml::tags('tr', null, $newRow) . "\n";
}
示例8: showList
function showList($conds = array('af_deleted' => 0), $optarray = array())
{
global $wgAbuseFilterCentralDB, $wgAbuseFilterIsCentral;
$output = '';
$output .= Xml::element('h2', null, $this->msg('abusefilter-list')->parse());
$pager = new AbuseFilterPager($this, $conds);
$deleted = $optarray['deleted'];
$hidedisabled = $optarray['hidedisabled'];
$scope = $optarray['scope'];
# Options form
$fields = array();
$fields['abusefilter-list-options-deleted'] = Xml::radioLabel($this->msg('abusefilter-list-options-deleted-show')->text(), 'deletedfilters', 'show', 'mw-abusefilter-deletedfilters-show', $deleted == 'show') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-hide')->text(), 'deletedfilters', 'hide', 'mw-abusefilter-deletedfilters-hide', $deleted == 'hide') . Xml::radioLabel($this->msg('abusefilter-list-options-deleted-only')->text(), 'deletedfilters', 'only', 'mw-abusefilter-deletedfilters-only', $deleted == 'only');
if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral) {
$fields['abusefilter-list-options-scope'] = Xml::radioLabel($this->msg('abusefilter-list-options-scope-local')->text(), 'rulescope', 'local', 'mw-abusefilter-rulescope-local', $scope == 'local') . Xml::radioLabel($this->msg('abusefilter-list-options-scope-global')->text(), 'rulescope', 'global', 'mw-abusefilter-rulescope-global', $scope == 'global');
}
$fields['abusefilter-list-options-disabled'] = Xml::checkLabel($this->msg('abusefilter-list-options-hidedisabled')->text(), 'hidedisabled', 'mw-abusefilter-disabledfilters-hide', $hidedisabled);
$fields['abusefilter-list-limit'] = $pager->getLimitSelect();
$options = Xml::buildForm($fields, 'abusefilter-list-options-submit');
$options .= Html::hidden('title', $this->getTitle()->getPrefixedText());
$options = Xml::tags('form', array('method' => 'get', 'action' => $this->getTitle()->getFullURL()), $options);
$options = Xml::fieldset($this->msg('abusefilter-list-options')->text(), $options);
$output .= $options;
if (isset($wgAbuseFilterCentralDB) && !$wgAbuseFilterIsCentral && $scope == 'global') {
$globalPager = new GlobalAbuseFilterPager($this, $conds);
$output .= $globalPager->getNavigationBar() . $globalPager->getBody() . $globalPager->getNavigationBar();
} else {
$output .= $pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar();
}
$this->getOutput()->addHTML($output);
}
示例9: doTagRow
function doTagRow($tag, $hitcount)
{
static $doneTags = array();
if (in_array($tag, $doneTags)) {
return '';
}
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('code', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' ';
$editLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), $this->msg('tags-edit')->escaped());
$disp .= $this->msg('parentheses')->rawParams($editLink)->escaped();
$newRow .= Xml::tags('td', null, $disp);
$msg = $this->msg("tag-{$tag}-description");
$desc = !$msg->exists() ? '' : $msg->parse();
$desc .= ' ';
$editDescLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), $this->msg('tags-edit')->escaped());
$desc .= $this->msg('parentheses')->rawParams($editDescLink)->escaped();
$newRow .= Xml::tags('td', null, $desc);
$hitcount = $this->msg('tags-hitcount')->numParams($hitcount)->escaped();
$hitcount = Linker::link(SpecialPage::getTitleFor('Recentchanges'), $hitcount, array(), array('tagfilter' => $tag));
$newRow .= Xml::tags('td', null, $hitcount);
$doneTags[] = $tag;
return Xml::tags('tr', null, $newRow) . "\n";
}
示例10: validateDomain
/**
* @param $resourcename
* @param $error
* @param $alldata
* @return bool|string
*/
function validateDomain( $resourcename, $alldata ) {
if ( ! preg_match( "/^[a-z\*][a-z0-9\-]*$/", $resourcename ) ) {
return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badresourcename' ) );
} else {
return true;
}
}
示例11: execute
public function execute($subpage)
{
global $wgOut, $wgRequest, $wgUser, $wgCacheEpoch, $wgCityId;
wfProfileIn(__METHOD__);
$this->setHeaders();
$this->mTitle = SpecialPage::getTitleFor('UserData');
if ($this->isRestricted() && !$this->userCanExecute($wgUser)) {
$this->displayRestrictionError();
wfProfileOut(__METHOD__);
return;
}
$result = '';
$userId = $wgRequest->getInt('userId');
if ($userId) {
$user = User::newFromId($userId);
if (!empty($user)) {
//todo: add nicer result - right now only name and link to user page
$result = Xml::element('a', array('href' => $user->getUserPage()->getLocalURL()), $user->getName(), false);
}
}
$wgOut->addHTML(Xml::openElement('form', array('action' => $this->mTitle->getFullURL(), 'method' => 'get')));
$wgOut->addHTML(Xml::inputLabel(wfMsg('userdata-userid-label'), 'userId', 'user-id', false, $userId));
$wgOut->addHTML('<br>' . Xml::submitButton(wfMsg('userdata-submit')));
$wgOut->addHTML(Xml::closeElement('form'));
if ($result) {
$wgOut->addHTML('<hr>' . $result);
}
wfProfileOut(__METHOD__);
}
示例12: setupPersonalUrls
/**
* Modify personal URLs list
*/
private function setupPersonalUrls()
{
global $wgUser;
// Import the starting set of urls from the skin template
$this->personal_urls = F::app()->getSkinTemplateObj()->data['personal_urls'];
if ($wgUser->isAnon()) {
// add login and register links for anons
//$skin = RequestContext::getMain()->getSkin();
// where to redirect after login
$query = F::app()->wg->Request->getValues();
if (isset($query['title'])) {
if (!self::isBlacklisted($query['title'])) {
$returnto = $query['title'];
} else {
$returnto = Title::newMainPage()->getPartialURL();
}
} else {
$returnto = Title::newMainPage()->getPartialURL();
}
$returnto = wfGetReturntoParam($returnto);
$this->personal_urls['login'] = array('text' => wfMsg('login'), 'href' => Skin::makeSpecialUrl('UserLogin', $returnto), 'class' => 'ajaxLogin', 'afterText' => Xml::element('img', array('src' => $this->wg->BlankImgUrl, 'class' => 'chevron', 'width' => '0', 'height' => '0'), ''));
$this->personal_urls['register'] = array('text' => wfMsg('oasis-signup'), 'href' => Skin::makeSpecialUrl('UserSignup'), 'class' => 'ajaxRegister');
} else {
// use Mypage message for userpage entry
$this->personal_urls['userpage']['text'] = wfMsg('mypage');
}
}
示例13: doTagRow
function doTagRow($tag, $hitcount)
{
static $sk = null, $doneTags = array();
if (!$sk) {
$sk = $this->getSkin();
}
if (in_array($tag, $doneTags)) {
return '';
}
global $wgLang;
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsgHtml('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $disp);
$msg = wfMessage("tag-{$tag}-description");
$desc = !$msg->exists() ? '' : $msg->parse();
$desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsgHtml('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $desc);
$hitcount = wfMsgExt('tags-hitcount', array('parsemag'), $wgLang->formatNum($hitcount));
$hitcount = $sk->link(SpecialPage::getTitleFor('Recentchanges'), $hitcount, array(), array('tagfilter' => $tag));
$newRow .= Xml::tags('td', null, $hitcount);
$doneTags[] = $tag;
return Xml::tags('tr', null, $newRow) . "\n";
}
示例14: onThumbnailImageHTML
public static function onThumbnailImageHTML($options, $linkAttribs, $attribs, $file, &$html)
{
if (self::isValidLazyLoadedImage($attribs['src'])) {
$origImgAlt = Xml::element('img', $attribs, '', true);
// Remove empty alt attributes (messes up string replace later if not removed)
if (isset($attribs['alt']) && empty($attribs['alt'])) {
unset($attribs['alt']);
}
$origImg = Xml::element('img', $attribs, '', true);
$lazyImageAttribs = $attribs;
$lazyImageAttribs['data-src'] = $lazyImageAttribs['src'];
$lazyImageAttribs['src'] = wfBlankImgUrl();
$lazyImageAttribs['class'] = self::getImgClass($lazyImageAttribs);
/* for AJAX requests - makes sure that they are handled properly */
/* ImgLzy.load is not executed for main content because ImgLzy object is initiated on DOM ready event and those images */
/* are base64 encoded so they are "loaded" with the content itself */
$lazyImageAttribs['onload'] = self::IMG_ONLOAD;
$count = 0;
$html = str_replace($origImg, Xml::element('img', $lazyImageAttribs) . "<noscript>{$origImg}</noscript>", $html, $count);
if ($count == 0) {
$html = str_replace($origImgAlt, Xml::element('img', $lazyImageAttribs) . "<noscript>{$origImg}</noscript>", $html);
}
}
return true;
}
示例15: WidgetCategoryCloud
function WidgetCategoryCloud($id, $params)
{
$output = "";
wfProfileIn(__METHOD__);
global $wgMemc;
$key = wfMemcKey("WidgetCategoryCloud", "data");
$data = $wgMemc->get($key);
if (is_null($data)) {
$data = WidgetCategoryCloudCloudizeData(WidgetCategoryCloudGetData());
$wgMemc->set($key, $data, 3600);
}
if (empty($data)) {
wfProfileOut(__METHOD__);
return wfMsgForContent("widget-categorycloud-empty");
}
foreach ($data as $name => $value) {
$category = Title::newFromText($name, NS_CATEGORY);
if (is_object($category)) {
$class = "cloud" . $value;
$output .= Xml::openElement("li", array("class" => $class));
// FIXME fix Wikia:link and use it here
$output .= Xml::element("a", array("class" => $class, "href" => $category->getLocalURL(), "title" => $category->getFullText()), $category->getBaseText());
$output .= Xml::closeElement("li");
$output .= "\n";
}
}
if (empty($output)) {
wfProfileOut(__METHOD__);
return wfMsgForContent("widget-categorycloud-empty");
}
$output = Xml::openElement("ul") . $output . Xml::closeElement("ul");
wfProfileOut(__METHOD__);
return $output;
}