本文整理汇总了PHP中Xml::openElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::openElement方法的具体用法?PHP Xml::openElement怎么用?PHP Xml::openElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::openElement方法的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: switchForm
/**
* Output a form to allow searching for a user
*/
function switchForm()
{
global $wgScript;
$this->getOutput()->addModules('ext.centralauth.globaluserautocomplete');
$this->getOutput()->addModuleStyles('mediawiki.special');
$this->getOutput()->addHTML(Xml::openElement('form', array('method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1')) . Html::hidden('title', $this->getPageTitle()) . Xml::openElement('fieldset') . Xml::element('legend', array(), $this->msg('userrights-lookup-user')->text()) . Xml::inputLabel($this->msg('userrights-user-editname')->text(), 'user', 'username', 30, $this->mTarget, array('class' => 'mw-autocomplete-global-user')) . ' <br />' . Xml::submitButton($this->msg('editusergroup')->text()) . Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n");
}
示例3: makeForm
function makeForm() {
$self = $this->getTitle();
$form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
$form .= Xml::element( 'input', array( 'type' => 'submit', 'name' => 'purge', 'value' => wfMsg( 'purgecache-button' ) ) );
$form .= Xml::closeElement( 'form' );
return $form;
}
示例4: 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__);
}
示例5: PoemExtension
function PoemExtension($in, $param = array(), $parser = null)
{
/* using newlines in the text will cause the parser to add <p> tags,
* which may not be desired in some cases
*/
$nl = isset($param['compact']) ? '' : "\n";
if (method_exists($parser, 'recursiveTagParse')) {
//new methods in 1.8 allow nesting <nowiki> in <poem>.
$tag = $parser->insertStripItem("<br />", $parser->mStripState);
$text = preg_replace(array("/^\n/", "/\n\$/D", "/\n/", "/^( +)/me"), array("", "", "{$tag}\n", "str_replace(' ',' ','\\1')"), $in);
$text = $parser->recursiveTagParse($text);
} else {
$text = preg_replace(array("/^\n/", "/\n\$/D", "/\n/", "/^( +)/me"), array("", "", "<br />\n", "str_replace(' ',' ','\\1')"), $in);
$ret = $parser->parse($text, $parser->getTitle(), $parser->getOptions(), true, false);
$text = $ret->getText();
}
global $wgVersion;
if (version_compare($wgVersion, "1.7alpha") >= 0) {
// Pass HTML attributes through to the output.
$attribs = Sanitizer::validateTagAttributes($param, 'div');
} else {
// Can't guarantee safety on 1.6 or older.
$attribs = array();
}
// Wrap output in a <div> with "poem" class.
if (isset($attribs['class'])) {
$attribs['class'] = 'poem ' . $attribs['class'];
} else {
$attribs['class'] = 'poem';
}
return Xml::openElement('div', $attribs) . $nl . trim($text) . "{$nl}</div>";
}
示例6: execute
public function execute($sub)
{
global $wgLastModifiedRange;
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->addHTML(Xml::openElement('h2'));
$out->addHTML(wfMsg('lastmodified-options'));
$out->addHTML(Xml::closeElement('h2'));
$out->addHTML(Xml::openElement('p'));
$out->addHTML(wfMsg('lastmodified-display-range-value') . ' ' . $wgLastModifiedRange);
$out->addHTML(Xml::closeElement('p'));
$rangeMessage = wfMsg('lastmodified-display') . ' ';
$rangeMessageDatetime = '';
$displayRange = array(0 => 'years', 1 => 'months', 2 => 'days', 3 => 'hours', 4 => 'minutes', 5 => 'seconds');
// Display seconds
foreach ($displayRange as $key => $value) {
// Check to see which values to display.
if ($wgLastModifiedRange == 0 || $key >= $wgLastModifiedRange) {
// append a comma if necessary
$rangeMessageDatetime .= empty($rangeMessageDatetime) ? '' : ', ';
// append message
$rangeMessageDatetime .= wfMsg('lastmodified-label-' . $value);
}
}
$rangeMessage .= $rangeMessageDatetime;
$out->addHTML(Xml::openElement('p'));
$out->addHTML($rangeMessage);
$out->addHTML(Xml::closeElement('p'));
}
示例7: wfQuickCreateButton
function wfQuickCreateButton($input, $argv, $parser)
{
$title = Title::makeTitle(NS_SPECIAL, "CreatePage");
$link = $title->getFullUrl();
$output = Xml::openElement('a', array('class' => 'wikia-button', 'id' => 'mr-submit', 'href' => $link)) . wfMsg('quickcreate') . Xml::closeElement('a');
return $parser->replaceVariables($output);
}
示例8: display_captcha
/**
* Display the submission form with the captcha injected into it
*/
public function display_captcha()
{
global $wgOut;
$publicKey = $this->gateway_adapter->getGlobal('RecaptchaPublicKey');
$useSSL = $this->gateway_adapter->getGlobal('RecaptchaUseSSL');
// log that a captcha's been triggered
$this->log($this->gateway_adapter->getData_Unstaged_Escaped('contribution_tracking_id'), 'Captcha triggered');
// construct the HTML used to display the captcha
$captcha_html = Xml::openElement('div', array('id' => 'mw-donate-captcha'));
$captcha_html .= recaptcha_get_html($publicKey, $this->recap_err, $useSSL);
$captcha_html .= '<span class="creditcard-error-msg">' . wfMsg($this->gateway_adapter->getIdentifier() . '_gateway-error-msg-captcha-please') . '</span>';
$captcha_html .= Xml::closeElement('div');
// close div#mw-donate-captcha
// load up the form class
$form_class = $this->gateway_adapter->getFormClass();
//TODO: use setValidationErrors and getValidationErrors everywhere, and
//refactor all the form constructors one more time. Eventually.
$data = $this->gateway_adapter->getData_Unstaged_Escaped();
$errors = $this->gateway_adapter->getValidationErrors();
$form_obj = new $form_class($this->gateway_adapter, $errors);
// set the captcha HTML to use in the form
$form_obj->setCaptchaHTML($captcha_html);
// output the form
$wgOut->addHTML($form_obj->getForm());
}
示例9: getDiv
public function getDiv($value)
{
global $wgOut, $wgPromoterAdPreview;
if (array_key_exists('language', $this->mParams)) {
$language = $this->mParams['language'];
} else {
$language = $wgOut->getContext()->getLanguage()->getCode();
}
$html = Xml::openElement('div', array('id' => Sanitizer::escapeId("pr-ad-list-element-{$this->mParams['ad']}"), 'class' => "pr-ad-list-element"));
// Make the label; this consists of a text link to the ad editor, and a series of status icons
if (array_key_exists('withlabel', $this->mParams)) {
$adName = $this->mParams['ad'];
$html .= Xml::openElement('div', array('class' => 'pr-ad-list-element-label'));
$html .= Linker::link(SpecialPage::getTitleFor('PromoterAds', "edit/{$adName}"), htmlspecialchars($adName), array('class' => 'pr-ad-list-element-label-text'));
$html .= ' (' . Linker::link(SpecialPage::getTitleFor('Randompage'), $this->msg('promoter-live-preview'), array('class' => 'pr-ad-list-element-label-text'), array('ad' => $adName, 'uselang' => $language, 'force' => '1')) . ')';
// TODO: Output status icons
$html .= Xml::tags('div', array('class' => 'pr-ad-list-element-label-icons'), '');
$html .= Xml::closeElement('div');
}
// Add the ad preview
if ($wgPromoterAdPreview) {
$html .= $this->getInputHTML(null);
}
$html .= Xml::closeElement('div');
return $html;
}
示例10: renderPersonalUrl
/**
* Render personal URLs item as HTML link
*/
private function renderPersonalUrl($id)
{
wfProfileIn(__METHOD__);
$personalUrl = $this->personal_urls[$id];
$attributes = array('data-id' => $id, 'href' => $personalUrl['href']);
if (in_array($id, array('login', 'register'))) {
$attributes['rel'] = 'nofollow';
}
// add class attribute
if (isset($personalUrl['class'])) {
$attributes['class'] = $personalUrl['class'];
}
// add accesskey attribute
switch ($id) {
case 'mytalk':
$attributes['accesskey'] = 'n';
break;
case 'login':
$attributes['accesskey'] = 'o';
break;
}
$ret = Xml::openElement('a', $attributes);
$ret .= $personalUrl['text'];
if (array_key_exists('afterText', $personalUrl)) {
$ret .= $personalUrl['afterText'];
}
$ret .= Xml::closeElement('a');
wfProfileOut(__METHOD__);
return $ret;
}
示例11: execute
public function execute( $subpage ) {
$this->setHeaders();
$out = $this->getOutput();
$out->addHTML( Xml::openElement( 'table', array( 'class' => 'wikitable' ) ) );
$out->addHTML( '<thead>' );
$out->addHTML( '<tr>' );
$out->addHTML( '<th>' );
$out->addWikiMsg( 'userdebuginfo-key' );
$out->addHTML( '</th>' );
$out->addHTML( '<th>' );
$out->addWikiMsg( 'userdebuginfo-value' );
$out->addHTML( '</th>' );
$out->addHTML( '</tr>' );
$out->addHTML( '</thead>' );
$out->addHTML( '<tbody>' );
$this->printRow( 'userdebuginfo-useragent', htmlspecialchars( $_SERVER['HTTP_USER_AGENT'] ) );
if ( isset( $_SERVER['REMOTE_HOST'] ) ) {
$this->printRow( 'userdebuginfo-remotehost', $_SERVER['REMOTE_HOST'] );
}
$this->printRow( 'userdebuginfo-remoteaddr', wfGetIP() );
$this->printRow( 'userdebuginfo-language', htmlspecialchars( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) );
$out->addHTML( '</tbody>' );
$out->addHTML( '</table>' );
}
示例12: showRequestForm
/**
* Show a nice form for the user to request a confirmation mail
*/
function showRequestForm()
{
global $wgOut, $wgUser, $wgLang, $wgRequest;
if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
$ok = $wgUser->sendConfirmationMail();
if (WikiError::isError($ok)) {
$wgOut->addWikiMsg('confirmemail_sendfailed', $ok->toString());
} else {
$wgOut->addWikiMsg('confirmemail_sent');
}
} else {
if ($wgUser->isEmailConfirmed()) {
// date and time are separate parameters to facilitate localisation.
// $time is kept for backward compat reasons.
// 'emailauthenticated' is also used in SpecialPreferences.php
$time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
$d = $wgLang->date($wgUser->mEmailAuthenticated, true);
$t = $wgLang->time($wgUser->mEmailAuthenticated, true);
$wgOut->addWikiMsg('emailauthenticated', $time, $d, $t);
}
if ($wgUser->isEmailConfirmationPending()) {
$wgOut->wrapWikiMsg("<div class=\"error mw-confirmemail-pending\">\n\$1</div>", 'confirmemail_pending');
}
$wgOut->addWikiMsg('confirmemail_text');
$form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl()));
$form .= Xml::hidden('token', $wgUser->editToken());
$form .= Xml::submitButton(wfMsg('confirmemail_send'));
$form .= Xml::closeElement('form');
$wgOut->addHTML($form);
}
}
示例13: getDeletionButton
protected function getDeletionButton( $ip ) {
return Xml::openElement( 'form', array( 'id' => 'prem-wl-delete' . $ip, 'method' => 'post' ) ) .
Xml::submitButton( wfMsg( 'premoderation-table-list-delete' ) ) .
'<input type="hidden" name="action" value="delete" />' .
'<input type="hidden" name="ip" value="' . $ip . '" />' .
Xml::closeElement( 'form' );
}
示例14: 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;
}
示例15: getTag
public function getTag()
{
$this->wf->profileIn(__METHOD__);
$imageHTML = $this->request->getVal('imageHTML');
$align = $this->request->getVal('align');
$width = $this->request->getVal('width');
$showCaption = $this->request->getVal('showCaption', false);
$caption = $this->request->getVal('caption', '');
$zoomIcon = $this->request->getVal('zoomIcon', '');
$showPictureAttribution = $this->request->getVal('showPictureAttribution', false);
$attributeTo = $this->request->getVal('$attributeTo', null);
$html = "<figure class=\"thumb" . (!empty($align) ? " t{$align}" : '') . " thumbinner\" style=\"width:{$width}px;\">{$imageHTML}{$zoomIcon}";
if (!empty($showCaption)) {
$html .= "<figcaption class=\"thumbcaption\">{$caption}";
}
//picture attribution
if (!empty($showPictureAttribution) && !empty($attributeTo)) {
$this->wf->profileIn(__METHOD__ . '::PictureAttribution');
// render avatar and link to user page
$avatar = AvatarService::renderAvatar($attributeTo, 16);
$link = AvatarService::renderLink($attributeTo);
$html .= Xml::openElement('div', array('class' => 'picture-attribution')) . $avatar . $this->wf->MsgExt('oasis-content-picture-added-by', array('parsemag'), $link, $attributeTo) . Xml::closeElement('div');
$this->wf->profileOut(__METHOD__ . '::PictureAttribution');
}
if (!empty($showCaption)) {
$html .= '</figcaption>';
}
$html .= '</figure>';
$this->setVal('tag', $html);
$this->wf->profileOut(__METHOD__);
}