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); }
/** * 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); }
/** * 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; }
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; }
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); } }
/** * 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(); }
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' ); }
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); }
/** * 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')); }
/** * 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; }
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); }
/** * 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; }
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>'); }
/** * 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; }
/** * 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; }
/** * Render the special page and redirect the user to the editor (if page exists) * @param string $subpage The name of the page to edit */ public function executeWhenAvailable($subpage) { if (!is_string($subpage)) { $this->showPageNotFound(); return; } else { $title = Title::newFromText($subpage); if (is_null($title)) { $this->showPageNotFound(); return; } } $data = $this->getRequest()->getValues(); unset($data['title']); // Remove the title of the special page $section = (int) $this->getRequest()->getVal('section', 0); $output = $this->getOutput(); $output->addModules('mobile.special.mobileeditor.scripts'); $output->setPageTitle($this->msg('mobile-frontend-editor-redirect-title')->text()); $context = MobileContext::singleton(); $articleUrl = $context->getMobileUrl($title->getFullURL($data)); $targetUrl = $articleUrl . '#/editor/' . $section; $html = Html::openElement('div', array('id' => 'mw-mf-editor', 'data-targeturl' => $targetUrl)) . Html::openElement('noscript') . MobileUI::errorBox($this->msg('mobile-frontend-editor-unavailable')->text()) . Html::openElement('p') . Html::element('a', array('href' => $title->getLocalUrl()), $this->msg('returnto', $title->getText())->text()) . Html::closeElement('noscript') . Html::closeElement('div'); // #mw-mf-editorunavailable $output->addHTML($html); }
public function getConnectForm() { if ($this->getVar('wgDBserver') == 'localhost') { $this->parent->setVar('wgDBserver', ''); } return $this->getTextBox('wgDBserver', 'config-db-host-oracle', array(), $this->parent->getHelpBox('config-db-host-oracle-help')) . Html::openElement('fieldset') . Html::element('legend', array(), wfMsg('config-db-wiki-settings')) . $this->getTextBox('wgDBprefix', 'config-db-prefix') . $this->getTextBox('_OracleDefTS', 'config-oracle-def-ts') . $this->getTextBox('_OracleTempTS', 'config-oracle-temp-ts', array(), $this->parent->getHelpBox('config-db-oracle-help')) . Html::closeElement('fieldset') . $this->parent->getWarningBox(wfMsg('config-db-account-oracle-warn')) . $this->getInstallUserBox() . $this->getWebUserBox(); }
public function showForm() { global $wgScript; # Explanatory text $this->getOutput()->addWikiMsg('pendingchanges-list', $this->getLang()->formatNum($this->pager->getNumRows())); $form = Html::openElement('form', array('name' => 'pendingchanges', 'action' => $wgScript, 'method' => 'get')) . "\n"; $form .= "<fieldset><legend>" . wfMsgHtml('pendingchanges-legend') . "</legend>\n"; $form .= Html::hidden('title', $this->getTitle()->getPrefixedDBKey()) . "\n"; $items = array(); if (count(FlaggedRevs::getReviewNamespaces()) > 1) { $items[] = "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getNamespaceMenu($this->namespace, '') . '</span>'; } if (FlaggedRevs::qualityVersions()) { $items[] = "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getLevelMenu($this->level, 'revreview-filter-stable') . '</span>'; } if (!FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::useOnlyIfProtected()) { $items[] = "<span style='white-space: nowrap;'>" . Xml::check('stable', $this->stable, array('id' => 'wpStable')) . Xml::label(wfMsg('pendingchanges-stable'), 'wpStable') . '</span>'; } if ($items) { $form .= implode(' ', $items) . '<br />'; } $items = array(); $items[] = Xml::label(wfMsg("pendingchanges-category"), 'wpCategory') . ' ' . Xml::input('category', 30, $this->category, array('id' => 'wpCategory')); if ($this->getUser()->getId()) { $items[] = Xml::check('watched', $this->watched, array('id' => 'wpWatched')) . Xml::label(wfMsg('pendingchanges-onwatchlist'), 'wpWatched'); } $form .= implode(' ', $items) . '<br />'; $form .= Xml::label(wfMsg('pendingchanges-size'), 'wpSize') . Xml::input('size', 4, $this->size, array('id' => 'wpSize')) . ' ' . Xml::submitButton(wfMsg('allpagessubmit')) . "\n"; $form .= "</fieldset>"; $form .= Html::closeElement('form') . "\n"; $this->getOutput()->addHTML($form); }
/** * ToC rendering for non-hubs * @param $title Title of hub the ToC is generated off * @return string html */ public function renderSubpageToC(Title $title) { $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer(); // We assume $title is sane. This is supposed to be called with a $title gotten from CollaborationHubContent::getParentHub, which already checks if it is. $rev = Revision::newFromTitle($title); $content = $rev->getContent(); $colour = $content->getThemeColour(); $image = $content->getImage(); $html = Html::openElement('div', ['class' => "mw-ck-theme-{$colour}"]); $html .= Html::openElement('div', ['class' => "mw-ck-subpage-toc"]); // ToC label $html .= Html::rawElement('div', ['class' => 'mw-ck-toc-label'], Html::rawElement('span', [], wfMessage('collaborationkit-subpage-toc-label')->inContentLanguage()->text())); // hubpage $name = $content->getDisplayName() == '' ? $title->getText() : $content->getDisplayName(); $link = $this->renderItem($title, $name, $image, 16); $html .= Html::rawElement('div', ['class' => 'mw-ck-toc-subpage-hub'], $link); // Contents $html .= Html::openElement('ul', ['class' => 'mw-ck-toc-contents']); foreach ($content->getContent() as $item) { $itemTitle = Title::newFromText($item['title']); if (isset($item['display_title'])) { $itemDisplayTitle = $item['display_title']; } else { $itemDisplayTitle = $itemTitle->getSubpageText(); } $itemImage = isset($item['image']) ? $item['image'] : $itemDisplayTitle; $itemLink = $this->renderItem($itemTitle, $itemDisplayTitle, $itemImage, $colour, 16); $html .= Html::rawElement('li', ['class' => 'mw-ck-toc-item'], $itemLink); } $html .= Html::closeElement('ul'); $html .= Html::closeElement('div'); $html .= Html::closeElement('div'); return $html; }
/** * Show error message for missing or incorrect captcha on EditPage. * @param EditPage $editPage * @param OutputPage $out */ function showEditFormFields(&$editPage, &$out) { $page = $editPage->getArticle()->getPage(); if (!isset($page->ConfirmEdit_ActivateCaptcha)) { return; } unset($page->ConfirmEdit_ActivateCaptcha); $out->addHTML(Html::openElement('div', array('id' => 'mw-confirmedit-error-area', 'class' => 'errorbox')) . Html::element('strong', array(), $out->msg('errorpagetitle')->text()) . Html::element('div', array('id' => 'errorbox-body'), $out->msg('captcha-sendemail-fail')->text()) . Html::closeElement('div')); $this->showEditCaptcha = true; }
/** * Adds HTML to render a header at the top of the feed * @param Title|string $title The page to link to or a string to show */ protected function renderHeaderBar($title) { if ($title instanceof Title) { $headerTitle = $this->getHeaderBarLink($title); } else { // manually style it as a userlink $headerTitle = Html::element('span', array('class' => MobileUI::iconClass('user', 'before', 'mw-mf-user icon-16px')), $title); } $this->getOutput()->addHtml(Html::openElement('div', array('class' => 'content-header')) . Html::openElement('h2', array()) . $headerTitle . Html::closeElement('h2') . Html::closeElement('div')); }
function execute($par) { $this->setHeaders(); $this->outputHeader(); $this->getOutput()->allowClickjacking(); $from = $this->getRequest()->getText('from', $par); $cap = new CategoryPager($this->getContext(), $from); $cap->doQuery(); $this->getOutput()->addHTML(Html::openElement('div', array('class' => 'mw-spcontent')) . $this->msg('categoriespagetext', $cap->getNumRows())->parseAsBlock() . $cap->getStartForm($from) . $cap->getNavigationBar() . '<ul>' . $cap->getBody() . '</ul>' . $cap->getNavigationBar() . Html::closeElement('div')); }
private function showForm($err = '') { global $wgOut, $wgUser; $wgOut->addWikiMsg('lockdbtext'); if ($err != '') { $wgOut->setSubtitle(wfMsg('formerror')); $wgOut->addHTML('<p class="error">' . htmlspecialchars($err) . "</p>\n"); } $wgOut->addHTML(Html::openElement('form', array('id' => 'lockdb', 'method' => 'POST', 'action' => $this->getTitle()->getLocalURL('action=submit'))) . "\n" . wfMsgHtml('enterlockreason') . ":\n" . Html::textarea('wpLockReason', $this->reason, array('rows' => 4)) . "\n<table>\n\t<tr>\n\t\t" . Html::openElement('td', array('style' => 'text-align:right')) . "\n\t\t\t" . Html::input('wpLockConfirm', null, 'checkbox') . "\n\t\t</td>\n\t\t" . Html::openElement('td', array('style' => 'text-align:left')) . wfMsgHtml('lockconfirm') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td> </td>\n\t\t" . Html::openElement('td', array('style' => 'text-align:left')) . "\n\t\t\t" . Html::input('wpLock', wfMsg('lockbtn'), 'submit') . "\n\t\t</td>\n\t</tr>\n</table>\n" . Html::hidden('wpEditToken', $wgUser->editToken()) . "\n" . Html::closeElement('form')); }
/** * Show the special page * * @param $par Mixed: parameter passed to the page or null */ function execute( $par ) { global $wgOut, $wgUser; global $wgOpenIDShowUrlOnUserPage; global $wgOpenIDTrustEmailAddress; global $wgOpenIDAllowExistingAccountSelection; global $wgOpenIDAllowNewAccountname; global $wgOpenIDUseEmailAsNickname; global $wgOpenIDProposeUsernameFromSREG; global $wgOpenIDAllowAutomaticUsername; global $wgOpenIDOnly; global $wgOpenIDClientOnly; global $wgOpenIDAllowServingOpenIDUserAccounts; global $wgOpenIDShowProviderIcons; if ( !$this->userCanExecute( $wgUser ) ) { $this->displayRestrictionError(); return; } $totalUsers = SiteStats::users(); $OpenIDdistinctUsers = $this->getOpenIDUsers( 'distinctusers' ); $OpenIDUsers = $this->getOpenIDUsers(); $this->setHeaders(); $this->outputHeader(); $wgOut->addWikiMsg( 'openid-dashboard-introduction', 'http://www.mediawiki.org/wiki/Extension:OpenID' ); $wgOut->addHTML( Html::openElement( 'table', array( 'style' => 'width:50%;', 'class' => 'mw-openiddashboard-table wikitable' ) ) ); # Here we show some basic version infos. Retrieval of SVN revision number of OpenID appears to be too difficult $out = $this->show( 'OpenID ' . wfMsg( 'version-software-version' ), MEDIAWIKI_OPENID_VERSION ); $out .= $this->show( 'MediaWiki ' . wfMsg( 'version-software-version' ), SpecialVersion::getVersion() ); $out .= $this->show( '$wgOpenIDOnly', $wgOpenIDOnly ); $out .= $this->show( '$wgOpenIDClientOnly', $wgOpenIDClientOnly ); $out .= $this->show( '$wgOpenIDAllowServingOpenIDUserAccounts', $wgOpenIDAllowServingOpenIDUserAccounts ); $out .= $this->show( '$wgOpenIDTrustEmailAddress', $wgOpenIDTrustEmailAddress ); $out .= $this->show( '$wgOpenIDAllowExistingAccountSelection', $wgOpenIDAllowExistingAccountSelection ); $out .= $this->show( '$wgOpenIDAllowAutomaticUsername', $wgOpenIDAllowAutomaticUsername ); $out .= $this->show( '$wgOpenIDAllowNewAccountname', $wgOpenIDAllowNewAccountname ); $out .= $this->show( '$wgOpenIDUseEmailAsNickname', $wgOpenIDUseEmailAsNickname ); $out .= $this->show( '$wgOpenIDProposeUsernameFromSREG', $wgOpenIDProposeUsernameFromSREG ); $out .= $this->show( '$wgOpenIDShowUrlOnUserPage', $wgOpenIDShowUrlOnUserPage ); $out .= $this->show( '$wgOpenIDShowProviderIcons', $wgOpenIDShowProviderIcons ); $out .= $this->show( wfMsgExt( 'statistics-users', array( 'parseinline' ) ), $totalUsers ); $out .= $this->show( wfMsg( 'openid-dashboard-number-openid-users' ), $OpenIDdistinctUsers ); $out .= $this->show( wfMsg( 'openid-dashboard-number-openids-in-database' ), $OpenIDUsers ); $out .= $this->show( wfMsg( 'openid-dashboard-number-users-without-openid' ), $totalUsers - $OpenIDdistinctUsers ); $wgOut->addHTML( $out . Html::closeElement( 'table' ) . "\n" ); }
function execute($par) { global $wgOut, $wgRequest; $this->setHeaders(); $this->outputHeader(); $wgOut->allowClickjacking(); $from = $wgRequest->getText('from', $par); $cap = new CategoryPager($from); $cap->doQuery(); $wgOut->addHTML(Html::openElement('div', array('class' => 'mw-spcontent')) . wfMsgExt('categoriespagetext', array('parse'), $cap->getNumRows()) . $cap->getStartForm($from) . $cap->getNavigationBar() . '<ul>' . $cap->getBody() . '</ul>' . $cap->getNavigationBar() . Html::closeElement('div')); }
/** * Render Special Page Nearby * @param string $par Parameter submitted as subpage */ public function executeWhenAvailable($par = '') { $this->setHeaders(); $output = $this->getOutput(); // set config $output->addJsConfigVars('wgMFNearbyRange', $this->getMFConfig()->get('MFNearbyRange')); $output->setPageTitle(wfMessage('mobile-frontend-nearby-title')->escaped()); $html = Html::openElement('div', array('class' => 'content-unstyled', 'id' => 'mw-mf-nearby')) . MobileUI::contentElement(MobileUI::errorBox(Html::element('h2', array(), wfMessage('mobile-frontend-nearby-requirements')) . Html::element('p', array(), wfMessage('mobile-frontend-nearby-requirements-guidance'))), 'noscript') . Html::closeElement('div'); // #mw-mf-nearby $output->addHTML($html); }
/** * Reimplementation of SpecialNotifications:execute to add mobile specific stylesheet and Html * @param string $par Parameter submitted as subpage */ public function execute($par) { $out = $this->getOutput(); $out->addModuleStyles('mobile.special.notifications.styles'); $title = $out->getRequest()->getText('returnto'); $title = Title::newFromText($title); if ($title) { $out->addHtml(Html::openElement('p') . Html::element('a', array('href' => $title->getLocalUrl()), wfMessage('returnto', $title->getText())) . Html::closeElement('p')); } parent::execute($par); $out->addModules('mobile.special.notifications.scripts'); }
function execute($par) { global $wgOut, $wgUser, $wgRequest; $userGroups = $wgUser->getGroups(); if ($wgUser->isBlocked() || !in_array('staff', $userGroups)) { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext'); return; } if ($wgRequest->wasPosted()) { $wgOut->setArticleBodyOnly(true); $urlList = $wgRequest->getVal("urls"); $urlArray = explode("\n", $urlList); AdminImageRemoval::$imagesRemoved = array(); $urlArray = array_map("urldecode", $urlArray); $pages = Misc::getPagesFromURLs($urlArray); foreach ($pages as $page) { if ($page['lang'] == "en") { $this->removeImagesFromArticle($page['page_id']); } } $errors = array(); foreach ($urlArray as $article) { if (!array_key_exists($article, $pages)) { $errors[] = $article; } } if (count($errors) > 0) { $result['success'] = false; $result['errors'] = $errors; } else { $result['success'] = true; } echo json_encode($result); $filePath = "/tmp/images-removal-" . date('Ymd') . ".txt"; $fo = fopen($filePath, 'a'); foreach (AdminImageRemoval::$imagesRemoved as $fileName) { fwrite($fo, "Image:{$fileName}\n"); } fclose($fo); return; } $wgOut->addJScode('airj'); $s = Html::openElement('form', array('action' => '', 'id' => 'imageremoval')) . "\n"; $s .= Html::element('p', array(''), 'Input full URLs (e.g. http://www.wikihow.com/Kiss) for articles that should have images removed from them.'); $s .= Html::element('br'); $s .= Html::element('textarea', array('id' => 'urls', 'cols' => 55, 'rows' => 5)) . "\n"; $s .= Html::element('br'); $s .= Html::element('input', array('type' => 'submit', 'class' => "button primary", 'value' => 'Process articles')) . "\n"; $s .= Html::closeElement('form'); $s .= Html::element('div', array('id' => 'imageremoval_results')); $wgOut->addHTML($s); }
function getPageHeader() { # Do not show useless input form if special page is cached if ($this->isCached()) { return ''; } $prefix = $this->prefix; $t = $this->getPageTitle(); return Html::openElement('form', array('method' => 'get', 'action' => wfScript())) . "\n" . Html::openElement('fieldset') . "\n" . Html::element('legend', null, $this->msg('withoutinterwiki-legend')->text()) . "\n" . Html::hidden('title', $t->getPrefixedText()) . "\n" . Xml::inputLabel($this->msg('allpagesprefix')->text(), 'prefix', 'wiprefix', 20, $prefix) . "\n" . Xml::submitButton($this->msg('withoutinterwiki-submit')->text()) . "\n" . Html::closeElement('fieldset') . "\n" . Html::closeElement('form'); }
/** * @param string $page Active page */ protected function commonNav($page) { $html = Html::openElement('div', array('class' => 'mw-ui-button-group')); $html .= Html::element('a', array('href' => $this->getPageTitle(self::PAGE_OPEN_QUEUE)->getFullURL(), 'class' => 'mw-ui-button' . ($page === self::PAGE_OPEN_QUEUE ? ' mw-ui-primary' : '')), $this->msg('globalrenamequeue-nav-openqueue')->text()); $html .= Html::element('a', array('href' => $this->getPageTitle(self::PAGE_CLOSED_QUEUE)->getFullURL(), 'class' => 'mw-ui-button' . ($page === self::PAGE_CLOSED_QUEUE ? ' mw-ui-primary' : '')), $this->msg('globalrenamequeue-nav-closedqueue')->text()); $html .= Html::closeElement('div'); $html .= Html::element('div', array('style' => 'clear:both')); $this->getOutput()->addHtml($html); }