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; }
/** * 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')); }
function efGPManagerCustomToolboxAppend(&$skin) { global $wgOut, $wgUser; $tb = explode("\n", wfMsg('toolbox_append')); $new = array(); foreach ($tb as &$nt) { if (strpos($nt, '*') === 0) { $nt = trim($nt, '*'); $parts = explode('|', $nt); foreach ($parts as &$part) { $part = trim($part); } $href = wfMsgForContent($parts[0]); $text = wfMsgForContent($parts[1]); $perm = array_key_exists(2, $parts) ? $parts[2] : 'read'; if (!$wgUser->isAllowed($perm)) { continue; } if (wfEmptyMsg($parts[0], $href)) { $href = $parts[0]; } if (wfEmptyMsg($parts[1], $text)) { $text = $parts[1]; } $id = Sanitizer::escapeId($parts[1], 'noninitial'); $new[] = array($href, $text, $id); } } foreach ($new as $t) { echo '<li id="t-' . $t[2] . '"><a href="' . htmlspecialchars($t[0]) . '">' . $t[1] . '</a></li>'; } return true; }
/** * Ajax function to create checkboxes for a new group in $wgGroupPermissions * * @param String $group new group name * @return either <err#> if group already exist or html fragment */ function efConfigureAjax($group) { global $wgUser, $wgGroupPermissions; if (!$wgUser->isAllowed('configure-all')) { return '<err#>'; } if (isset($wgGroupPermissions[$group])) { $html = '<err#>'; } else { if (is_callable(array('User', 'getAllRights'))) { // 1.13 + $all = User::getAllRights(); } else { $all = array(); foreach ($wgGroupPermissions as $rights) { $all = array_merge($all, array_keys($rights)); } $all = array_unique($all); } $row = '<div style="-moz-column-count:2"><ul>'; foreach ($all as $right) { $id = Sanitizer::escapeId('wpwgGroupPermissions-' . $group . '-' . $right); $desc = is_callable(array('User', 'getRightDescription')) ? User::getRightDescription($right) : $right; $row .= '<li>' . Xml::checkLabel($desc, $id, $id) . "</li>\n"; } $row .= '</ul></div>'; $groupName = User::getGroupName($group); // Firefox seems to not like that :( $html = str_replace(' ', ' ', $row); } return $html; }
/** * Get unique id for ToC Link/header * @param $header * @return string */ public function getToCLinkID($header) { $link = Sanitizer::escapeId(htmlspecialchars($header)); $link2 = $link; $linkCounter = 1; while (in_array($link2, $this->tocLinks)) { $link2 = $link . '_' . $linkCounter; $spPageLinkCounter++; } $this->tocLinks[] = $link2; return $link2; }
/** * Show the special page * @param string|null $par */ public function execute($par) { $this->setHeaders(); $this->outputHeader(); $out = $this->getOutput(); $out->addModuleStyles('mediawiki.special'); $out->wrapWikiMsg("<div class=\"mw-listgrouprights-key\">\n\$1\n</div>", 'listgrouprights-key'); $out->addHTML(Xml::openElement('table', ['class' => 'wikitable mw-listgrouprights-table']) . '<tr>' . Xml::element('th', null, $this->msg('listgrouprights-group')->text()) . Xml::element('th', null, $this->msg('listgrouprights-rights')->text()) . '</tr>'); $config = $this->getConfig(); $groupPermissions = $config->get('GroupPermissions'); $revokePermissions = $config->get('RevokePermissions'); $addGroups = $config->get('AddGroups'); $removeGroups = $config->get('RemoveGroups'); $groupsAddToSelf = $config->get('GroupsAddToSelf'); $groupsRemoveFromSelf = $config->get('GroupsRemoveFromSelf'); $allGroups = array_unique(array_merge(array_keys($groupPermissions), array_keys($revokePermissions), array_keys($addGroups), array_keys($removeGroups), array_keys($groupsAddToSelf), array_keys($groupsRemoveFromSelf))); asort($allGroups); foreach ($allGroups as $group) { $permissions = isset($groupPermissions[$group]) ? $groupPermissions[$group] : []; $groupname = $group == '*' ? 'all' : $group; $msg = $this->msg('group-' . $groupname); $groupnameLocalized = !$msg->isBlank() ? $msg->text() : $groupname; $msg = $this->msg('grouppage-' . $groupname)->inContentLanguage(); $grouppageLocalized = !$msg->isBlank() ? $msg->text() : MWNamespace::getCanonicalName(NS_PROJECT) . ':' . $groupname; $grouppageLocalizedTitle = Title::newFromText($grouppageLocalized); if ($group == '*' || !$grouppageLocalizedTitle) { // Do not make a link for the generic * group or group with invalid group page $grouppage = htmlspecialchars($groupnameLocalized); } else { $grouppage = Linker::link($grouppageLocalizedTitle, htmlspecialchars($groupnameLocalized)); } if ($group === 'user') { // Link to Special:listusers for implicit group 'user' $grouplink = '<br />' . Linker::linkKnown(SpecialPage::getTitleFor('Listusers'), $this->msg('listgrouprights-members')->escaped()); } elseif (!in_array($group, $config->get('ImplicitGroups'))) { $grouplink = '<br />' . Linker::linkKnown(SpecialPage::getTitleFor('Listusers'), $this->msg('listgrouprights-members')->escaped(), [], ['group' => $group]); } else { // No link to Special:listusers for other implicit groups as they are unlistable $grouplink = ''; } $revoke = isset($revokePermissions[$group]) ? $revokePermissions[$group] : []; $addgroups = isset($addGroups[$group]) ? $addGroups[$group] : []; $removegroups = isset($removeGroups[$group]) ? $removeGroups[$group] : []; $addgroupsSelf = isset($groupsAddToSelf[$group]) ? $groupsAddToSelf[$group] : []; $removegroupsSelf = isset($groupsRemoveFromSelf[$group]) ? $groupsRemoveFromSelf[$group] : []; $id = $group == '*' ? false : Sanitizer::escapeId($group); $out->addHTML(Html::rawElement('tr', ['id' => $id], "\n\t\t\t\t<td>{$grouppage}{$grouplink}</td>\n\t\t\t\t\t<td>" . $this->formatPermissions($permissions, $revoke, $addgroups, $removegroups, $addgroupsSelf, $removegroupsSelf) . '</td> ')); } $out->addHTML(Xml::closeElement('table')); $this->outputNamespaceProtectionInfo(); }
/** * @param $input * @param $args * @param Parser $parser * @return string */ public function renderTag($input, $args, Parser $parser) { wfProfileIn(__METHOD__); // there must be something between tags if (empty($input)) { wfProfileOut(__METHOD__); return ''; } // we support only the Oasis skin for this feature if (!F::app()->checkSkin('oasis')) { wfProfileOut(__METHOD__); return ''; } $widgetType = 'Widget' . Sanitizer::escapeId($input, 0); // try to load widget if ($this->load($widgetType) == false) { wfProfileOut(__METHOD__); return ''; } // seek for style attribute (RT #19092) if (isset($args['style'])) { $style = ' style="' . htmlspecialchars($args['style']) . '"'; unset($args['style']); } else { $style = ''; } // create array for getParams method of widget framework $id = 'widget_' . $this->count++; $widget = array('type' => $widgetType, 'id' => $id, 'param' => $args, 'widgetTag' => true); // configure widget $widgetParams = $this->getParams($widget); // set additional params $widgetParams['skinname'] = $this->skinname; // inform widget he's rendered by WidgetTag $widgetParams['_widgetTag'] = true; // try to display it using widget function $output = $widgetType($id, $widgetParams); // Add any required javascript and CSS for the widget #$output .= $this->getAssets($widget); // wrap widget content $output = $this->wrap($widget, $output); // wrap widget HTML $output = "<div class=\"widgetTag\"{$style}>{$output}</div>"; // use markers to avoid RT #20855 when widget' HTML is multiline $marker = $parser->uniqPrefix() . "-WIDGET-{$this->count}-"; $this->markers[$marker] = $output; wfProfileOut(__METHOD__); return $marker; }
/** * Show the special page */ public function execute($par) { global $wgImplicitGroups; global $wgGroupPermissions, $wgRevokePermissions, $wgAddGroups, $wgRemoveGroups; global $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf; $out = $this->getOutput(); $this->setHeaders(); $this->outputHeader(); $out->addModuleStyles('mediawiki.special'); $out->addHTML(Xml::openElement('table', array('class' => 'wikitable mw-listgrouprights-table')) . '<tr>' . Xml::element('th', null, wfMsg('listgrouprights-group')) . Xml::element('th', null, wfMsg('listgrouprights-rights')) . '</tr>'); $allGroups = array_unique(array_merge(array_keys($wgGroupPermissions), array_keys($wgRevokePermissions), array_keys($wgAddGroups), array_keys($wgRemoveGroups), array_keys($wgGroupsAddToSelf), array_keys($wgGroupsRemoveFromSelf))); asort($allGroups); foreach ($allGroups as $group) { $permissions = isset($wgGroupPermissions[$group]) ? $wgGroupPermissions[$group] : array(); $groupname = $group == '*' ? 'all' : $group; $msg = wfMessage('group-' . $groupname); $groupnameLocalized = !$msg->isBlank() ? $msg->text() : $groupname; $msg = wfMessage('grouppage-' . $groupname)->inContentLanguage(); $grouppageLocalized = !$msg->isBlank() ? $msg->text() : MWNamespace::getCanonicalName(NS_PROJECT) . ':' . $groupname; if ($group == '*') { // Do not make a link for the generic * group $grouppage = htmlspecialchars($groupnameLocalized); } else { $grouppage = Linker::link(Title::newFromText($grouppageLocalized), htmlspecialchars($groupnameLocalized)); } if ($group === 'user') { // Link to Special:listusers for implicit group 'user' $grouplink = '<br />' . Linker::link(SpecialPage::getTitleFor('Listusers'), wfMsgHtml('listgrouprights-members'), array(), array(), array('known', 'noclasses')); } elseif (!in_array($group, $wgImplicitGroups)) { $grouplink = '<br />' . Linker::link(SpecialPage::getTitleFor('Listusers'), wfMsgHtml('listgrouprights-members'), array(), array('group' => $group), array('known', 'noclasses')); } else { // No link to Special:listusers for other implicit groups as they are unlistable $grouplink = ''; } $revoke = isset($wgRevokePermissions[$group]) ? $wgRevokePermissions[$group] : array(); $addgroups = isset($wgAddGroups[$group]) ? $wgAddGroups[$group] : array(); $removegroups = isset($wgRemoveGroups[$group]) ? $wgRemoveGroups[$group] : array(); $addgroupsSelf = isset($wgGroupsAddToSelf[$group]) ? $wgGroupsAddToSelf[$group] : array(); $removegroupsSelf = isset($wgGroupsRemoveFromSelf[$group]) ? $wgGroupsRemoveFromSelf[$group] : array(); $id = $group == '*' ? false : Sanitizer::escapeId($group); $out->addHTML(Html::rawElement('tr', array('id' => $id), "\n\t\t\t\t<td>{$grouppage}{$grouplink}</td>\n\t\t\t\t\t<td>" . self::formatPermissions($permissions, $revoke, $addgroups, $removegroups, $addgroupsSelf, $removegroupsSelf) . '</td> ')); } $out->addHTML(Xml::closeElement('table') . "\n<br /><hr />\n"); $out->wrapWikiMsg("<div class=\"mw-listgrouprights-key\">\n\$1\n</div>", 'listgrouprights-key'); }
function formatOptions($options, $value) { $html = ''; $attribs = $this->getAttributes(array('disabled', 'tabindex')); $elementFunc = array('Html', $this->mOptionsLabelsNotFromMessage ? 'rawElement' : 'element'); # @todo Should this produce an unordered list perhaps? foreach ($options as $label => $info) { if (is_array($info)) { $html .= Html::rawElement('h1', array(), $label) . "\n"; $html .= $this->formatOptions($info, $value); } else { $id = Sanitizer::escapeId($this->mID . "-{$info}"); $radio = Xml::radio($this->mName, $info, $info === $value, $attribs + array('id' => $id)); $radio .= ' ' . call_user_func($elementFunc, 'label', array('for' => $id), $label); $html .= ' ' . Html::rawElement('div', array('class' => 'mw-htmlform-flatlist-item'), $radio); } } return $html; }
/** * Hook point to SkinBuildSidebar * * Finds all top-level entries in the sidebar that have the format category:$1|$2. * Replaces the entry with a list of pages in Category:$1 and changes the label * to $2, or $1 if $2 not available. * * @param $skin Skin * @param $bar array * @return bool True */ function efCategoryMembersOnSidebar($skin, &$bar) { $newbar = array(); $i = 0; foreach ($bar as $key => $data) { # Check if this entry needs to be handled by this extension $matches = array(); preg_match('/category\\:([^|]*)\\|?([^|]*)/i', $key, $matches); if ($matches) { # Extract the new message key $newkey = trim($matches[2]) ? trim($matches[2]) : $matches[1]; # Extract category members $cat = Category::newFromName($matches[1]); if (!$cat) { # Invalid title continue; } $members = $cat->getMembers(); if ($members->count()) { # Create the subbar $subbar = array(); foreach ($members as $title) { $subbar[] = array('text' => $title->getText(), 'href' => $title->getLocalURL(), 'id' => 'catsb-' . Sanitizer::escapeId($title->getText()), 'active' => false); } $bar[$key] = $subbar; # Store the index of this top-level entry, because we need to # replace the key later with our new key $newbar[$i] = $newkey; } } $i++; } if ($newbar) { # Replace the keys without changing the order $keys = array_keys($bar); foreach ($newbar as $i => $newkey) { array_splice($keys, $i, 1, $newkey); } $bar = array_combine($keys, array_values($bar)); } return true; }
/** * Outputs a single sidebar portlet of any kind. */ private function outputPortlet($box) { if (!$box['content']) { return; } ?> <div role="navigation" class="mw-portlet" id="<?php echo Sanitizer::escapeId($box['id']); ?> " <?php echo Linker::tooltip($box['id']); ?> > <h3> <?php if (isset($box['headerMessage'])) { $this->msg($box['headerMessage']); } else { echo htmlspecialchars($box['header']); } ?> </h3> <?php if (is_array($box['content'])) { echo '<ul>'; foreach ($box['content'] as $key => $item) { echo $this->makeListItem($key, $item); } echo '</ul>'; } else { echo $box['content']; } ?> </div> <?php }
function formatOptions($options, $value) { global $wgUseMediaWikiUIEverywhere; $html = ''; $attribs = $this->getAttributes(['disabled', 'tabindex']); $elementFunc = ['Html', $this->mOptionsLabelsNotFromMessage ? 'rawElement' : 'element']; # @todo Should this produce an unordered list perhaps? foreach ($options as $label => $info) { if (is_array($info)) { $html .= Html::rawElement('h1', [], $label) . "\n"; $html .= $this->formatOptions($info, $value); } else { $id = Sanitizer::escapeId($this->mID . "-{$info}"); $classes = ['mw-htmlform-flatlist-item']; if ($wgUseMediaWikiUIEverywhere || $this->mParent instanceof VFormHTMLForm) { $classes[] = 'mw-ui-radio'; } $radio = Xml::radio($this->mName, $info, $info === $value, $attribs + ['id' => $id]); $radio .= ' ' . call_user_func($elementFunc, 'label', ['for' => $id], $label); $html .= ' ' . Html::rawElement('div', ['class' => $classes], $radio); } } return $html; }
/** * Generate search form * * @param string $type * @return string HTML * */ public function getSearchForm($type = 'standard') { // Use button label fallbacks if (!$this->mButtonLabel) { $this->mButtonLabel = wfMessage('search')->text(); } if ($this->mID !== '') { $this->mID = Sanitizer::escapeId($this->mID); $idArray = array('id' => $this->mID); } else { $idArray = array(); } $inputID = 'searchInput' . ($this->mID ?: rand()); $htmlLabel = ''; $classes = array(); if (isset($this->mLabelText) && strlen(trim($this->mLabelText))) { $this->mLabelText = $this->mParser->recursiveTagParse($this->mLabelText); } else { // No user supplied label, so apply a default but show it only to screen-readers $this->mLabelText = wfMessage('search'); $classes = array('sr-only'); } $htmlLabel = Html::element('label', array('for' => $inputID, 'class' => implode(' ', $classes)), $this->mLabelText); $classes = array('searchForm', 'hidden-print'); if ($this->mInline === 'yes') { $classes[] = 'form-inline'; } if ($this->mMobile === 'no') { $classes[] = 'hidden-xs'; } if ($type === 'mainpage') { $classes[] = 'mainPageSearchForm'; } $htmlOut = Html::openElement('form', array('name' => 'searchForm' . $this->mID, 'class' => implode(' ', $classes), 'action' => SpecialPage::getTitleFor('Search')->getLocalURL()) + $idArray); if ($this->mCategory != '') { $htmlOut .= Xml::element('input', array('name' => 'category', 'type' => 'hidden', 'value' => $this->mCategory)); } $classes = array('input-group'); if ($type === 'mainpage' || $this->mElementSize === 'large') { $classes[] = 'input-group-lg'; } elseif ($this->mElementSize === 'small') { $classes[] = 'input-group-sm'; } if (is_array($this->mWidthClasses)) { $classes = array_merge($classes, $this->mWidthClasses); } $htmlOut .= Html::openElement('div', array('class' => implode(' ', $classes))); $htmlOut .= $htmlLabel; $classes = array('form-control', 'mw-searchInput'); if ($this->mInternal === 'yes') { $classes[] = 'internalSearch'; } $htmlOut .= Html::element('input', array('id' => $inputID, 'type' => 'text', 'name' => 'search', 'dir' => $this->mDir, 'value' => $this->mDefaultText, 'class' => implode(' ', $classes), 'placeholder' => $this->mPlaceholderText, 'required' => 'required')); $htmlOut .= Html::openElement('span', array('class' => 'input-group-btn')); $classes = array('btn', 'searchBtn'); if ($this->mFancyButton === 'yes' || $type === 'mainpage') { $classes[] = 'btn-default'; } $htmlOut .= Html::openElement('button', array('type' => 'submit', 'name' => 'go', 'title' => $this->mButtonLabel, 'class' => implode(' ', $classes))); $htmlOut .= Html::openElement('span', array('class' => 'btn-text' . ($this->mHiddenButtonLabel === 'yes' ? ' sr-only' : ''))); $htmlOut .= $this->mButtonLabel . ' '; $htmlOut .= Html::closeElement('span'); // button text $htmlOut .= Html::element('span', array('class' => 'fa fa-search')); $htmlOut .= Html::closeElement('button'); // button $htmlOut .= Xml::closeElement('span'); // input-group-btn $htmlOut .= Xml::closeElement('div'); $htmlOut .= Xml::closeElement('form'); if ($type === 'mainpage') { $this->mParser->getOutput()->addModuleStyles('ext.searchboxes.mainpage.styles'); } // Return HTML return $htmlOut; }
/** * Same as guessSectionNameFromWikiText(), but produces legacy anchors * instead. For use in redirects, since IE6 interprets Redirect: headers * as something other than UTF-8 (apparently?), resulting in breakage. * * @param string $text The section name * @return string An anchor */ public function guessLegacySectionNameFromWikiText($text) { # Strip out wikitext links(they break the anchor) $text = $this->stripSectionName($text); $text = Sanitizer::normalizeSectionNameWhitespace($text); return '#' . Sanitizer::escapeId($text, array('noninitial', 'legacy')); }
private function renderPortal($name, $content, $msg = null, $hook = null) { if ($msg === null) { $msg = $name; } ?> <div class="portal" id='<?php echo Sanitizer::escapeId("p-{$name}"); ?> '<?php echo Linker::tooltip('p-' . $name); ?> > <h5<?php $this->html('userlangattributes'); ?> ><?php $msgObj = wfMessage($msg); echo htmlspecialchars($msgObj->exists() ? $msgObj->text() : $msg); ?> </h5> <div class="body"> <?php if (is_array($content)) { ?> <ul> <?php foreach ($content as $key => $val) { ?> <?php echo $this->makeListItem($key, $val); ?> <?php } if ($hook !== null) { wfRunHooks($hook, array(&$this, true)); } ?> </ul> <?php } else { ?> <?php echo $content; /* Allow raw HTML block to be defined by extensions */ } ?> </div> </div> <?php }
/** * Generate new section form */ public function getCommentForm() { global $wgScript; if (!$this->mButtonLabel) { $this->mButtonLabel = wfMessage('inputbox-postcommenttitle')->text(); } $htmlOut = Xml::openElement('div', array('class' => 'mw-inputbox-centered', 'style' => $this->bgColorStyle())); $commentFormParams = array('name' => 'commentbox', 'class' => 'commentbox', 'action' => $wgScript, 'method' => 'get'); if ($this->mID !== '') { $commentFormParams['id'] = Sanitizer::escapeId($this->mID); } $htmlOut .= Xml::openElement('form', $commentFormParams); $htmlOut .= Xml::openElement('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'edit')); $htmlOut .= Xml::openElement('input', array('type' => 'hidden', 'name' => 'preload', 'value' => $this->mPreload)); $htmlOut .= Xml::openElement('input', array('type' => 'hidden', 'name' => 'editintro', 'value' => $this->mEditIntro)); $htmlOut .= Xml::openElement('input', array('type' => $this->mHidden ? 'hidden' : 'text', 'name' => 'preloadtitle', 'class' => 'commentboxInput', 'value' => $this->mDefaultText, 'placeholder' => $this->mPlaceholderText, 'size' => $this->mWidth, 'dir' => $this->mDir)); $htmlOut .= Xml::openElement('input', array('type' => 'hidden', 'name' => 'section', 'value' => 'new')); $htmlOut .= Xml::openElement('input', array('type' => 'hidden', 'name' => 'title', 'value' => $this->mPage)); $htmlOut .= $this->mBR; $htmlOut .= Xml::openElement('input', array('type' => 'submit', 'name' => 'create', 'class' => 'commentboxButton', 'value' => $this->mButtonLabel)); $htmlOut .= Xml::closeElement('form'); $htmlOut .= Xml::closeElement('div'); // Return HTML return $htmlOut; }
function formatOptions($options, $value) { $html = ''; $attribs = array(); if (!empty($this->mParams['disabled'])) { $attribs['disabled'] = 'disabled'; } # TODO: should this produce an unordered list perhaps? foreach ($options as $label => $info) { if (is_array($info)) { $html .= Html::rawElement('h1', array(), $label) . "\n"; $html .= $this->formatOptions($info, $value); } else { $id = Sanitizer::escapeId($this->mID . "-{$info}"); $radio = Xml::radio($this->mName, $info, $info == $value, $attribs + array('id' => $id)); $radio .= ' ' . Html::rawElement('label', array('for' => $id), $label); $html .= ' ' . Html::rawElement('div', array('class' => 'mw-htmlform-flatlist-item'), $radio); } } return $html; }
public function getInputHTML($values) { $html = ''; foreach ((array) $values as $key => $value) { if ($key === 'nonjs') { continue; } $html .= Html::rawElement('li', ['class' => 'mw-htmlform-cloner-li'], $this->getInputHTMLForKey($key, $value)); } $template = $this->getInputHTMLForKey($this->uniqueId, null); $html = Html::rawElement('ul', ['id' => "mw-htmlform-cloner-list-{$this->mID}", 'class' => 'mw-htmlform-cloner-ul', 'data-template' => $template, 'data-unique-id' => $this->uniqueId], $html); $name = "{$this->mName}[create]"; $label = isset($this->mParams['create-button-message']) ? $this->mParams['create-button-message'] : 'htmlform-cloner-create'; $field = HTMLForm::loadInputFromParameters($name, ['type' => 'submit', 'name' => $name, 'id' => Sanitizer::escapeId("{$this->mID}--create"), 'cssclass' => 'mw-htmlform-cloner-create-button', 'default' => $this->getMessage($label)->text()], $this->mParent); $html .= $field->getInputHTML($field->getDefault()); return $html; }
/** * Builds a Table of Contents and links to headings * * @param string $text Text to build TOC from * @return string */ public function toc($text) { $isMain = true; $maxTocLevel = 15; $showEditLink = true; $doNumberHeadings = false; $doTocNumberHeadings = true; $forceTocPosition = true; //$mShowToc = true; // Get all headlines for numbering them and adding funky stuff like [edit] // links - this is for later, but we need the number of headlines right now $matches = array(); $numMatches = preg_match_all('/<H(?P<level>[1-6])(?P<attrib>.*?' . '>)(?P<header>.*?)<\\/H[1-6] *>/i', $text, $matches); // If there are fewer than 4 headlines in the article, do not show TOC // unless it's been explicitly enabled. $enoughToc = $numMatches >= 4 || $forceTocPosition; //$mShowToc && // Headline counter $headlineCount = 0; $sectionCount = 0; // headlineCount excluding template sections $numVisible = 0; // Ugh .. the TOC should have neat indentation levels which can be // passed to the skin functions. These are determined here $toc = ''; $full = ''; $head = array(); $sublevelCount = array(); $levelCount = array(); $toclevel = 0; $level = 0; $prevlevel = 0; $toclevel = 0; $prevtoclevel = 0; include_once PATH_CORE . DS . 'components' . DS . 'com_wiki' . DS . 'helpers' . DS . 'sanitizer.php'; foreach ($matches[3] as $headline) { $istemplate = 0; $templatetitle = ''; $templatesection = 0; $numbering = ''; $mat = array(); if ($toclevel) { $prevlevel = $level; $prevtoclevel = $toclevel; } $level = $matches[1][$headlineCount]; if ($doNumberHeadings || $doTocNumberHeadings || $enoughToc) { if ($level > $prevlevel) { // Increase TOC level $toclevel++; $sublevelCount[$toclevel] = 0; if ($toclevel < $maxTocLevel) { $prevtoclevel = $toclevel; $toc .= $this->_tocIndent(); $numVisible++; } } elseif ($level < $prevlevel && $toclevel > 1) { // Decrease TOC level, find level to jump to if ($toclevel == 2 && $level <= $levelCount[1]) { // Can only go down to level 1 $toclevel = 1; } else { for ($i = $toclevel; $i > 0; $i--) { if ($levelCount[$i] == $level) { // Found last matching level $toclevel = $i; break; } elseif ($levelCount[$i] < $level) { // Found first matching level below current level $toclevel = $i + 1; break; } } } if ($toclevel < $maxTocLevel) { if ($prevtoclevel < $maxTocLevel) { // Unindent only if the previous toc level was shown $toc .= $this->_tocUnindent($prevtoclevel - $toclevel); } else { $toc .= $this->_tocLineEnd(); } } } else { // No change in level, end TOC line if ($toclevel < $maxTocLevel) { $toc .= $this->_tocLineEnd(); } } $levelCount[$toclevel] = $level; // count number of headlines for each level @$sublevelCount[$toclevel]++; $dot = 0; for ($i = 1; $i <= $toclevel; $i++) { if (!empty($sublevelCount[$i])) { if ($dot) { $numbering .= '.'; } $numbering .= $sublevelCount[$i]; $dot = 1; } } } // The canonized header is a version of the header text safe to use for links // Avoid insertion of weird stuff like <math> by expanding the relevant sections $canonized_headline = $this->strip($headline); // Strip out HTML (other than plain <sup> and <sub>: bug 8393) $_tocLine = preg_replace(array('#<(?!/?(sup|sub)).*?' . '>#', '#<(/?(sup|sub)).*?' . '>#'), array('', '<$1>'), $canonized_headline); $_tocLine = trim($_tocLine); // For the anchor, strip out HTML-y stuff period $canonized_headline = preg_replace('/<.*?' . '>/', '', $canonized_headline); $canonized_headline = trim($canonized_headline); // Save headline for section edit hint before it's escaped $headline_hint = $canonized_headline; $canonized_headline = Sanitizer::escapeId($canonized_headline); $refers[$headlineCount] = $canonized_headline; // count how many in assoc. array so we can track dupes in anchors isset($refers[$canonized_headline]) ? $refers[$canonized_headline]++ : ($refers[$canonized_headline] = 1); $refcount[$headlineCount] = $refers[$canonized_headline]; // Don't number the heading if it is the only one (looks silly) if ($doNumberHeadings && count($matches[3]) > 1) { // the two are different if the line contains a link $headline = $numbering . ' ' . $headline; } // Create the anchor for linking from the TOC to the section $anchor = $canonized_headline; if ($refcount[$headlineCount] > 1) { $anchor .= '_' . $refcount[$headlineCount]; } if ($enoughToc && (!isset($maxTocLevel) || $toclevel < $maxTocLevel)) { if (!$doTocNumberHeadings) { $numbering = ''; } $toc .= $this->_tocLine($anchor, $_tocLine, $numbering, $toclevel); } // Give headline the correct <h#> tag /*if ($showEditLink && (!$istemplate || $templatetitle !== '')) { $editlink = $this->editSectionLink($this->mTitle, $sectionCount+1, $headline_hint); } else {*/ $editlink = ''; //} $head[$headlineCount] = $this->_makeHeadline($level, $matches['attrib'][$headlineCount], $anchor, $headline, $editlink); $headlineCount++; if (!$istemplate) { $sectionCount++; } } $toc .= $toc ? $this->_tocUnindent($toclevel - 1) . '</ul>' : ''; // Never ever show TOC if no headers if ($numVisible < 1) { $enoughToc = false; } // split up and insert constructed headlines $blocks = preg_split('/<H[1-6].*?' . '>.*?<\\/H[1-6]>/i', $text); $i = 0; foreach ($blocks as $block) { $full .= $block; if ($enoughToc && !$i && $isMain && !$forceTocPosition) { // Top anchor now in skin $full = $full . $toc; } if (!empty($head[$i])) { $full .= $head[$i]; } $i++; } $output = '<div class="article-toc">' . "\n"; $output .= '<h3 class="article-toc-heading">Contents</h3>' . "\n"; $output .= $toc . "\n"; $output .= '</div>' . "\n"; return str_replace('<p>MACRO' . $this->token() . '[[TableOfContents]]' . "\n" . '</p>', $output, $full); }
public function modifyHelp(array &$help, array $options, array &$tocData) { // Wish PHP had an "array_insert_before". Instead, we have to manually // reindex the array to get 'permissions' in the right place. $oldHelp = $help; $help = array(); foreach ($oldHelp as $k => $v) { if ($k === 'submodules') { $help['permissions'] = ''; } $help[$k] = $v; } $help['datatypes'] = ''; $help['credits'] = ''; // Fill 'permissions' $help['permissions'] .= Html::openElement('div', array('class' => 'apihelp-block apihelp-permissions')); $m = $this->msg('api-help-permissions'); if (!$m->isDisabled()) { $help['permissions'] .= Html::rawElement('div', array('class' => 'apihelp-block-head'), $m->numParams(count(self::$mRights))->parse()); } $help['permissions'] .= Html::openElement('dl'); foreach (self::$mRights as $right => $rightMsg) { $help['permissions'] .= Html::element('dt', null, $right); $rightMsg = $this->msg($rightMsg['msg'], $rightMsg['params'])->parse(); $help['permissions'] .= Html::rawElement('dd', null, $rightMsg); $groups = array_map(function ($group) { return $group == '*' ? 'all' : $group; }, User::getGroupsWithPermission($right)); $help['permissions'] .= Html::rawElement('dd', null, $this->msg('api-help-permissions-granted-to')->numParams(count($groups))->params($this->getLanguage()->commaList($groups))->parse()); } $help['permissions'] .= Html::closeElement('dl'); $help['permissions'] .= Html::closeElement('div'); // Fill 'datatypes' and 'credits', if applicable if (empty($options['nolead'])) { $level = $options['headerlevel']; $tocnumber =& $options['tocnumber']; $header = $this->msg('api-help-datatypes-header')->parse(); $help['datatypes'] .= Html::rawelement('h' . min(6, $level), array('id' => 'main/datatypes', 'class' => 'apihelp-header'), Html::element('span', array('id' => Sanitizer::escapeId('main/datatypes'))) . $header); $help['datatypes'] .= $this->msg('api-help-datatypes')->parseAsBlock(); if (!isset($tocData['main/datatypes'])) { $tocnumber[$level]++; $tocData['main/datatypes'] = array('toclevel' => count($tocnumber), 'level' => $level, 'anchor' => 'main/datatypes', 'line' => $header, 'number' => join('.', $tocnumber), 'index' => false); } $header = $this->msg('api-credits-header')->parse(); $help['credits'] .= Html::rawelement('h' . min(6, $level), array('id' => 'main/credits', 'class' => 'apihelp-header'), Html::element('span', array('id' => Sanitizer::escapeId('main/credits'))) . $header); $help['credits'] .= $this->msg('api-credits')->useDatabase(false)->parseAsBlock(); if (!isset($tocData['main/credits'])) { $tocnumber[$level]++; $tocData['main/credits'] = array('toclevel' => count($tocnumber), 'level' => $level, 'anchor' => 'main/credits', 'line' => $header, 'number' => join('.', $tocnumber), 'index' => false); } } }
/** * Get the suggested HTML for page status indicators: icons (or short text snippets) usually * displayed in the top-right corner of the page, outside of the main content. * * Your skin may implement this differently, for example by handling some indicator names * specially with a different UI. However, it is recommended to use a `<div class="mw-indicator" * id="mw-indicator-<id>" />` as a wrapper element for each indicator, for better compatibility * with extensions and user scripts. * * The raw data is available in `$this->data['indicators']` as an associative array (keys: * identifiers, values: contents) internally ordered by keys. * * @return string HTML * @since 1.25 */ public function getIndicators() { $out = "<div class=\"mw-indicators\">\n"; foreach ($this->data['indicators'] as $id => $content) { $out .= Html::rawElement('div', ['id' => Sanitizer::escapeId("mw-indicator-{$id}"), 'class' => 'mw-indicator'], $content) . "\n"; } $out .= "</div>\n"; return $out; }
/** * Add content from plain text * @since 1.17 * @param $bar array * @param $text string * @return Array */ function addToSidebarPlain(&$bar, $text) { $lines = explode("\n", $text); $heading = ''; foreach ($lines as $line) { if (strpos($line, '*') !== 0) { continue; } $line = rtrim($line, "\r"); // for Windows compat if (strpos($line, '**') !== 0) { $heading = trim($line, '* '); if (!array_key_exists($heading, $bar)) { $bar[$heading] = array(); } } else { $line = trim($line, '* '); if (strpos($line, '|') !== false) { // sanity check $line = MessageCache::singleton()->transform($line, false, null, $this->getTitle()); $line = array_map('trim', explode('|', $line, 2)); if (count($line) !== 2) { // Second sanity check, could be hit by people doing // funky stuff with parserfuncs... (bug 33321) continue; } $extraAttribs = array(); $msgLink = $this->msg($line[0])->inContentLanguage(); if ($msgLink->exists()) { $link = $msgLink->text(); if ($link == '-') { continue; } } else { $link = $line[0]; } $msgText = $this->msg($line[1]); if ($msgText->exists()) { $text = $msgText->text(); } else { $text = $line[1]; } if (preg_match('/^(?i:' . wfUrlProtocols() . ')/', $link)) { $href = $link; // Parser::getExternalLinkAttribs won't work here because of the Namespace things global $wgNoFollowLinks, $wgNoFollowDomainExceptions; if ($wgNoFollowLinks && !wfMatchesDomainList($href, $wgNoFollowDomainExceptions)) { $extraAttribs['rel'] = 'nofollow'; } global $wgExternalLinkTarget; if ($wgExternalLinkTarget) { $extraAttribs['target'] = $wgExternalLinkTarget; } } else { $title = Title::newFromText($link); if ($title) { $title = $title->fixSpecialName(); $href = $title->getLinkURL(); } else { $href = 'INVALID-TITLE'; } } $bar[$heading][] = array_merge(array('text' => $text, 'href' => $href, 'id' => 'n-' . Sanitizer::escapeId(strtr($line[1], ' ', '-'), 'noninitial'), 'active' => false), $extraAttribs); } else { continue; } } } return $bar; }
/** * Template filter callback for MonoBook skin. * Takes an associative array of data set from a SkinTemplate-based * class, and a wrapper for MediaWiki's localization database, and * outputs a formatted page. * * @access private */ function execute() { global $wgUser; $skin = $wgUser->getSkin(); // Suppress warnings to prevent notices about missing indexes in $this->data wfSuppressWarnings(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="<?php $this->text('xhtmldefaultnamespace'); ?> " <?php foreach ($this->data['xhtmlnamespaces'] as $tag => $ns) { ?> xmlns:<?php echo "{$tag}=\"{$ns}\" "; } ?> xml:lang="<?php $this->text('lang'); ?> " lang="<?php $this->text('lang'); ?> " dir="<?php $this->text('dir'); ?> "> <head> <meta http-equiv="Content-Type" content="<?php $this->text('mimetype'); ?> ; charset=<?php $this->text('charset'); ?> " /> <?php $this->html('headlinks'); ?> <title><?php $this->text('pagetitle'); ?> </title> <style type="text/css" media="screen, projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath'); ?> /common/shared.css?<?php echo $GLOBALS['wgStyleVersion']; ?> "; @import "<?php $this->text('stylepath'); ?> /<?php $this->text('stylename'); ?> /main.css?<?php echo $GLOBALS['wgStyleVersion']; ?> "; /*]]>*/</style> <link rel="stylesheet" type="text/css" <?php if (empty($this->data['printable'])) { ?> media="print"<?php } ?> href="<?php $this->text('stylepath'); ?> /common/commonPrint.css?<?php echo $GLOBALS['wgStyleVersion']; ?> " /> <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath'); ?> /<?php $this->text('stylename'); ?> /IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion']; ?> ";</style><![endif]--> <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath'); ?> /<?php $this->text('stylename'); ?> /IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion']; ?> ";</style><![endif]--> <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath'); ?> /<?php $this->text('stylename'); ?> /IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion']; ?> ";</style><![endif]--> <!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath'); ?> /<?php $this->text('stylename'); ?> /IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion']; ?> ";</style><![endif]--> <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype'); ?> " src="<?php $this->text('stylepath'); ?> /common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion']; ?> "></script> <meta http-equiv="imagetoolbar" content="no" /><![endif]--> <?php print Skin::makeGlobalVariablesScript($this->data); ?> <script type="<?php $this->text('jsmimetype'); ?> " src="<?php $this->text('stylepath'); ?> /common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion']; ?> "><!-- wikibits js --></script> <!-- Head Scripts --> <?php $this->html('headscripts'); if ($this->data['jsvarurl']) { ?> <script type="<?php $this->text('jsmimetype'); ?> " src="<?php $this->text('jsvarurl'); ?> "><!-- site js --></script> <?php } if ($this->data['pagecss']) { ?> <style type="text/css"><?php $this->html('pagecss'); ?> </style> <?php } if ($this->data['usercss']) { ?> <style type="text/css"><?php $this->html('usercss'); ?> </style> <?php } if ($this->data['userjs']) { ?> <script type="<?php $this->text('jsmimetype'); ?> " src="<?php $this->text('userjs'); ?> "></script> <?php } if ($this->data['userjsprev']) { ?> <script type="<?php $this->text('jsmimetype'); ?> "><?php $this->html('userjsprev'); ?> </script> <?php } if ($this->data['trackbackhtml']) { print $this->data['trackbackhtml']; } ?> </head> <body<?php if ($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick'); ?> "<?php } if ($this->data['body_onload']) { ?> onload="<?php $this->text('body_onload'); ?> "<?php } ?> class="mediawiki <?php $this->text('nsclass'); ?> <?php $this->text('dir'); ?> <?php $this->text('pageclass'); ?> "> <div id="globalWrapper"> <div id="column-content"> <div id="content"> <a name="top" id="top"></a> <?php if ($this->data['sitenotice']) { ?> <div id="siteNotice"><?php $this->html('sitenotice'); ?> </div><?php } ?> <h1 class="firstHeading"><?php $this->data['displaytitle'] != "" ? $this->html('title') : $this->text('title'); ?> </h1> <div id="bodyContent"> <h3 id="siteSub"><?php $this->msg('tagline'); ?> </h3> <div id="contentSub"><?php $this->html('subtitle'); ?> </div> <?php if ($this->data['undelete']) { ?> <div id="contentSub2"><?php $this->html('undelete'); ?> </div><?php } ?> <?php if ($this->data['newtalk']) { ?> <div class="usermessage"><?php $this->html('newtalk'); ?> </div><?php } ?> <?php if ($this->data['showjumplinks']) { ?> <div id="jump-to-nav"><?php $this->msg('jumpto'); ?> <a href="#column-one"><?php $this->msg('jumptonavigation'); ?> </a>, <a href="#searchInput"><?php $this->msg('jumptosearch'); ?> </a></div><?php } ?> <!-- start content --> <?php $this->html('bodytext'); ?> <?php if ($this->data['catlinks']) { ?> <div id="catlinks"><?php $this->html('catlinks'); ?> </div><?php } ?> <!-- end content --> <div class="visualClear"></div> </div> </div> </div> <div id="column-one"> <div id="p-cactions" class="portlet"> <h5><?php $this->msg('views'); ?> </h5> <div class="pBody"> <ul> <?php foreach ($this->data['content_actions'] as $key => $tab) { ?> <li id="ca-<?php echo Sanitizer::escapeId($key); ?> "<?php if ($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']); ?> "<?php } ?> ><a href="<?php echo htmlspecialchars($tab['href']); ?> "<?php echo $skin->tooltipAndAccesskey('ca-' . $key); ?> ><?php echo htmlspecialchars($tab['text']); ?> </a></li> <?php } ?> </ul> </div> </div> <div class="portlet" id="p-personal"> <h5><?php $this->msg('personaltools'); ?> </h5> <div class="pBody"> <ul> <?php foreach ($this->data['personal_urls'] as $key => $item) { ?> <li id="pt-<?php echo Sanitizer::escapeId($key); ?> "<?php if ($item['active']) { ?> class="active"<?php } ?> ><a href="<?php echo htmlspecialchars($item['href']); ?> "<?php echo $skin->tooltipAndAccesskey('pt-' . $key); if (!empty($item['class'])) { ?> class="<?php echo htmlspecialchars($item['class']); ?> "<?php } ?> ><?php echo htmlspecialchars($item['text']); ?> </a></li> <?php } ?> </ul> </div> </div> <div class="portlet" id="p-logo"> <a style="background-image: url(<?php $this->text('logopath'); ?> );" <?php ?> href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href']); ?> "<?php echo $skin->tooltipAndAccesskey('n-mainpage'); ?> ></a> </div> <script type="<?php $this->text('jsmimetype'); ?> "> if (window.isMSIE55) fixalpha(); </script> <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?> <div class='portlet' id='p-<?php echo Sanitizer::escapeId($bar); ?> '<?php echo $skin->tooltip('p-' . $bar); ?> > <h5><?php $out = wfMsg($bar); if (wfEmptyMsg($bar, $out)) { echo $bar; } else { echo $out; } ?> </h5> <div class='pBody'> <ul> <?php foreach ($cont as $key => $val) { ?> <li id="<?php echo Sanitizer::escapeId($val['id']); ?> "<?php if ($val['active']) { ?> class="active" <?php } ?> ><a href="<?php echo htmlspecialchars($val['href']); ?> "<?php echo $skin->tooltipAndAccesskey($val['id']); ?> ><?php echo htmlspecialchars($val['text']); ?> </a></li> <?php } ?> </ul> </div> </div> <?php } ?> <div id="p-search" class="portlet"> <h5><label for="searchInput"><?php $this->msg('search'); ?> </label></h5> <div id="searchBody" class="pBody"> <form action="<?php $this->text('searchaction'); ?> " id="searchform"><div> <input id="searchInput" name="search" type="text"<?php echo $skin->tooltipAndAccesskey('search'); if (isset($this->data['search'])) { ?> value="<?php $this->text('search'); ?> "<?php } ?> /> <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle'); ?> "<?php echo $skin->tooltipAndAccesskey('search-go'); ?> /> <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton'); ?> "<?php echo $skin->tooltipAndAccesskey('search-fulltext'); ?> /> </div></form> </div> </div> <div class="portlet" id="p-tb"> <h5><?php $this->msg('toolbox'); ?> </h5> <div class="pBody"> <ul> <?php if ($this->data['notspecialpage']) { ?> <li id="t-whatlinkshere"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href']); ?> "<?php echo $skin->tooltipAndAccesskey('t-whatlinkshere'); ?> ><?php $this->msg('whatlinkshere'); ?> </a></li> <?php if ($this->data['nav_urls']['recentchangeslinked']) { ?> <li id="t-recentchangeslinked"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href']); ?> "<?php echo $skin->tooltipAndAccesskey('t-recentchangeslinked'); ?> ><?php $this->msg('recentchangeslinked'); ?> </a></li> <?php } } if (isset($this->data['nav_urls']['trackbacklink'])) { ?> <li id="t-trackbacklink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href']); ?> "<?php echo $skin->tooltipAndAccesskey('t-trackbacklink'); ?> ><?php $this->msg('trackbacklink'); ?> </a></li> <?php } if ($this->data['feeds']) { ?> <li id="feedlinks"><?php foreach ($this->data['feeds'] as $key => $feed) { ?> <span id="feed-<?php echo Sanitizer::escapeId($key); ?> "><a href="<?php echo htmlspecialchars($feed['href']); ?> "<?php echo $skin->tooltipAndAccesskey('feed-' . $key); ?> ><?php echo htmlspecialchars($feed['text']); ?> </a> </span> <?php } ?> </li><?php } foreach (array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special) { if ($this->data['nav_urls'][$special]) { ?> <li id="t-<?php echo $special; ?> "><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href']); ?> "<?php echo $skin->tooltipAndAccesskey('t-' . $special); ?> ><?php $this->msg($special); ?> </a></li> <?php } } if (!empty($this->data['nav_urls']['print']['href'])) { ?> <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href']); ?> "<?php echo $skin->tooltipAndAccesskey('t-print'); ?> ><?php $this->msg('printableversion'); ?> </a></li><?php } if (!empty($this->data['nav_urls']['permalink']['href'])) { ?> <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href']); ?> "<?php echo $skin->tooltipAndAccesskey('t-permalink'); ?> ><?php $this->msg('permalink'); ?> </a></li><?php } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?> <li id="t-ispermalink"<?php echo $skin->tooltip('t-ispermalink'); ?> ><?php $this->msg('permalink'); ?> </li><?php } wfRunHooks('MonoBookTemplateToolboxEnd', array(&$this)); ?> </ul> </div> </div> <?php if ($this->data['language_urls']) { ?> <div id="p-lang" class="portlet"> <h5><?php $this->msg('otherlanguages'); ?> </h5> <div class="pBody"> <ul> <?php foreach ($this->data['language_urls'] as $langlink) { ?> <li class="<?php echo htmlspecialchars($langlink['class']); ?> "><?php ?> <a href="<?php echo htmlspecialchars($langlink['href']); ?> "><?php echo $langlink['text']; ?> </a></li> <?php } ?> </ul> </div> </div> <?php } ?> </div><!-- end of the left (by default at least) column --> <div class="visualClear"></div> <div id="footer"> <?php if ($this->data['poweredbyico']) { ?> <div id="f-poweredbyico"><?php $this->html('poweredbyico'); ?> </div> <?php } if ($this->data['copyrightico']) { ?> <div id="f-copyrightico"><?php $this->html('copyrightico'); ?> </div> <?php } // Generate additional footer links ?> <ul id="f-list"> <?php $footerlinks = array('lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright', 'privacy', 'about', 'disclaimer', 'tagline'); foreach ($footerlinks as $aLink) { if (isset($this->data[$aLink]) && $this->data[$aLink]) { ?> <li id="<?php echo $aLink; ?> "><?php $this->html($aLink); ?> </li> <?php } } ?> </ul> </div> <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?> </div> <?php $this->html('reporttime'); if ($this->data['debug']) { ?> <!-- Debug output: <?php $this->text('debug'); ?> --> <?php } ?> </body></html> <?php wfRestoreWarnings(); }
/** * Take an array of attribute names and values and normalize or discard * illegal values for the given whitelist. * * - Discards attributes not the given whitelist * - Unsafe style attributes are discarded * - Invalid id attributes are re-encoded * * @param array $attribs * @param array $whitelist List of allowed attribute names * @return array * * @todo Check for legal values where the DTD limits things. * @todo Check for unique id attribute :P */ static function validateAttributes($attribs, $whitelist) { global $wgAllowRdfaAttributes, $wgAllowMicrodataAttributes; $whitelist = array_flip($whitelist); $hrefExp = '/^(' . wfUrlProtocols() . ')[^\\s]+$/'; $out = array(); foreach ($attribs as $attribute => $value) { #allow XML namespace declaration if RDFa is enabled if ($wgAllowRdfaAttributes && preg_match(self::XMLNS_ATTRIBUTE_PATTERN, $attribute)) { if (!preg_match(self::EVIL_URI_PATTERN, $value)) { $out[$attribute] = $value; } continue; } # Allow any attribute beginning with "data-" if (!preg_match('/^data-(?!ooui)/i', $attribute) && !isset($whitelist[$attribute])) { continue; } # Strip javascript "expression" from stylesheets. # http://msdn.microsoft.com/workshop/author/dhtml/overview/recalc.asp if ($attribute == 'style') { $value = Sanitizer::checkCss($value); } if ($attribute === 'id') { $value = Sanitizer::escapeId($value, 'noninitial'); } # WAI-ARIA # http://www.w3.org/TR/wai-aria/ # http://www.whatwg.org/html/elements.html#wai-aria # For now we only support role="presentation" until we work out what roles should be # usable by content and we ensure that our code explicitly rejects patterns that # violate HTML5's ARIA restrictions. if ($attribute === 'role' && $value !== 'presentation') { continue; } // RDFa and microdata properties allow URLs, URIs and/or CURIs. // Check them for sanity. if ($attribute === 'rel' || $attribute === 'rev' || $attribute === 'about' || $attribute === 'property' || $attribute === 'resource' || $attribute === 'datatype' || $attribute === 'typeof' || $attribute === 'itemid' || $attribute === 'itemprop' || $attribute === 'itemref' || $attribute === 'itemscope' || $attribute === 'itemtype') { //Paranoia. Allow "simple" values but suppress javascript if (preg_match(self::EVIL_URI_PATTERN, $value)) { continue; } } # NOTE: even though elements using href/src are not allowed directly, supply # validation code that can be used by tag hook handlers, etc if ($attribute === 'href' || $attribute === 'src') { if (!preg_match($hrefExp, $value)) { continue; //drop any href or src attributes not using an allowed protocol. // NOTE: this also drops all relative URLs } } // If this attribute was previously set, override it. // Output should only have one attribute of each name. $out[$attribute] = $value; } if ($wgAllowMicrodataAttributes) { # itemtype, itemid, itemref don't make sense without itemscope if (!array_key_exists('itemscope', $out)) { unset($out['itemtype']); unset($out['itemid']); unset($out['itemref']); } # TODO: Strip itemprop if we aren't descendants of an itemscope or pointed to by an itemref. } return $out; }
/** * Escape a text fragment, say from a link, for a URL * * @param string $fragment Containing a URL or link fragment (after the "#") * @return string Escaped string */ static function escapeFragmentForURL($fragment) { # Note that we don't urlencode the fragment. urlencoded Unicode # fragments appear not to work in IE (at least up to 7) or in at least # one version of Opera 9.x. The W3C validator, for one, doesn't seem # to care if they aren't encoded. return Sanitizer::escapeId($fragment, 'noninitial'); }
/** * This function accomplishes several tasks: * 1) Auto-number headings if that option is enabled * 2) Add an [edit] link to sections for users who have enabled the option and can edit the page * 3) Add a Table of contents on the top for users who have enabled the option * 4) Auto-anchor headings * * It loops through all headlines, collects the necessary data, then splits up the * string and re-inserts the newly formatted headlines. * * @param string $text * @param boolean $isMain * @private */ function formatHeadings($text, $isMain = true) { global $wgMaxTocLevel, $wgContLang, $wgEnforceHtmlIds; $doNumberHeadings = $this->mOptions->getNumberHeadings(); $showEditLink = $this->mOptions->getEditSection(); // Do not call quickUserCan unless necessary if ($showEditLink && !$this->mTitle->quickUserCan('edit')) { $showEditLink = 0; } # Inhibit editsection links if requested in the page if (isset($this->mDoubleUnderscores['noeditsection']) || $this->mOptions->getIsPrintable()) { $showEditLink = 0; } # Get all headlines for numbering them and adding funky stuff like [edit] # links - this is for later, but we need the number of headlines right now $matches = array(); $numMatches = preg_match_all('/<H(?P<level>[1-6])(?P<attrib>.*?' . '>)(?P<header>.*?)<\\/H[1-6] *>/i', $text, $matches); # if there are fewer than 4 headlines in the article, do not show TOC # unless it's been explicitly enabled. $enoughToc = $this->mShowToc && ($numMatches >= 4 || $this->mForceTocPosition); # Allow user to stipulate that a page should have a "new section" # link added via __NEWSECTIONLINK__ if (isset($this->mDoubleUnderscores['newsectionlink'])) { $this->mOutput->setNewSection(true); } # Allow user to remove the "new section" # link via __NONEWSECTIONLINK__ if (isset($this->mDoubleUnderscores['nonewsectionlink'])) { $this->mOutput->hideNewSection(true); } # if the string __FORCETOC__ (not case-sensitive) occurs in the HTML, # override above conditions and always show TOC above first header if (isset($this->mDoubleUnderscores['forcetoc'])) { $this->mShowToc = true; $enoughToc = true; } # We need this to perform operations on the HTML $sk = $this->mOptions->getSkin(); # headline counter $headlineCount = 0; $numVisible = 0; # Ugh .. the TOC should have neat indentation levels which can be # passed to the skin functions. These are determined here $toc = ''; $full = ''; $head = array(); $sublevelCount = array(); $levelCount = array(); $toclevel = 0; $level = 0; $prevlevel = 0; $toclevel = 0; $prevtoclevel = 0; $markerRegex = "{$this->mUniqPrefix}-h-(\\d+)-" . self::MARKER_SUFFIX; $baseTitleText = $this->mTitle->getPrefixedDBkey(); $tocraw = array(); foreach ($matches[3] as $headline) { $isTemplate = false; $titleText = false; $sectionIndex = false; $numbering = ''; $markerMatches = array(); if (preg_match("/^{$markerRegex}/", $headline, $markerMatches)) { $serial = $markerMatches[1]; list($titleText, $sectionIndex) = $this->mHeadings[$serial]; $isTemplate = $titleText != $baseTitleText; $headline = preg_replace("/^{$markerRegex}/", "", $headline); } if ($toclevel) { $prevlevel = $level; $prevtoclevel = $toclevel; } $level = $matches[1][$headlineCount]; if ($doNumberHeadings || $enoughToc) { if ($level > $prevlevel) { # Increase TOC level $toclevel++; $sublevelCount[$toclevel] = 0; if ($toclevel < $wgMaxTocLevel) { $prevtoclevel = $toclevel; $toc .= $sk->tocIndent(); $numVisible++; } } elseif ($level < $prevlevel && $toclevel > 1) { # Decrease TOC level, find level to jump to if ($toclevel == 2 && $level <= $levelCount[1]) { # Can only go down to level 1 $toclevel = 1; } else { for ($i = $toclevel; $i > 0; $i--) { if ($levelCount[$i] == $level) { # Found last matching level $toclevel = $i; break; } elseif ($levelCount[$i] < $level) { # Found first matching level below current level $toclevel = $i + 1; break; } } } if ($toclevel < $wgMaxTocLevel) { if ($prevtoclevel < $wgMaxTocLevel) { # Unindent only if the previous toc level was shown :p $toc .= $sk->tocUnindent($prevtoclevel - $toclevel); $prevtoclevel = $toclevel; } else { $toc .= $sk->tocLineEnd(); } } } else { # No change in level, end TOC line if ($toclevel < $wgMaxTocLevel) { $toc .= $sk->tocLineEnd(); } } $levelCount[$toclevel] = $level; # count number of headlines for each level @$sublevelCount[$toclevel]++; $dot = 0; for ($i = 1; $i <= $toclevel; $i++) { if (!empty($sublevelCount[$i])) { if ($dot) { $numbering .= '.'; } $numbering .= $wgContLang->formatNum($sublevelCount[$i]); $dot = 1; } } } # The safe header is a version of the header text safe to use for links # Avoid insertion of weird stuff like <math> by expanding the relevant sections $safeHeadline = $this->mStripState->unstripBoth($headline); # Remove link placeholders by the link text. # <!--LINK number--> # turns into # link text with suffix $safeHeadline = $this->replaceLinkHoldersText($safeHeadline); # Strip out HTML (other than plain <sup> and <sub>: bug 8393) $tocline = preg_replace(array('#<(?!/?(sup|sub)).*?' . '>#', '#<(/?(sup|sub)).*?' . '>#'), array('', '<$1>'), $safeHeadline); $tocline = trim($tocline); # For the anchor, strip out HTML-y stuff period $safeHeadline = preg_replace('/<.*?' . '>/', '', $safeHeadline); $safeHeadline = trim($safeHeadline); # Save headline for section edit hint before it's escaped $headlineHint = $safeHeadline; if ($wgEnforceHtmlIds) { $legacyHeadline = false; $safeHeadline = Sanitizer::escapeId($safeHeadline, 'noninitial'); } else { # For reverse compatibility, provide an id that's # HTML4-compatible, like we used to. # # It may be worth noting, academically, that it's possible for # the legacy anchor to conflict with a non-legacy headline # anchor on the page. In this case likely the "correct" thing # would be to either drop the legacy anchors or make sure # they're numbered first. However, this would require people # to type in section names like "abc_.D7.93.D7.90.D7.A4" # manually, so let's not bother worrying about it. $legacyHeadline = Sanitizer::escapeId($safeHeadline, 'noninitial'); $safeHeadline = Sanitizer::escapeId($safeHeadline, 'xml'); if ($legacyHeadline == $safeHeadline) { # No reason to have both (in fact, we can't) $legacyHeadline = false; } elseif ($legacyHeadline != Sanitizer::escapeId($legacyHeadline, 'xml')) { # The legacy id is invalid XML. We used to allow this, but # there's no reason to do so anymore. Backward # compatibility will fail slightly in this case, but it's # no big deal. $legacyHeadline = false; } } # HTML names must be case-insensitively unique (bug 10721). FIXME: # Does this apply to Unicode characters? Because we aren't # handling those here. $arrayKey = strtolower($safeHeadline); if ($legacyHeadline === false) { $legacyArrayKey = false; } else { $legacyArrayKey = strtolower($legacyHeadline); } # count how many in assoc. array so we can track dupes in anchors if (isset($refers[$arrayKey])) { $refers[$arrayKey]++; } else { $refers[$arrayKey] = 1; } if (isset($refers[$legacyArrayKey])) { $refers[$legacyArrayKey]++; } else { $refers[$legacyArrayKey] = 1; } # Don't number the heading if it is the only one (looks silly) if ($doNumberHeadings && count($matches[3]) > 1) { # the two are different if the line contains a link $headline = $numbering . ' ' . $headline; } # Create the anchor for linking from the TOC to the section $anchor = $safeHeadline; $legacyAnchor = $legacyHeadline; if ($refers[$arrayKey] > 1) { $anchor .= '_' . $refers[$arrayKey]; } if ($legacyHeadline !== false && $refers[$legacyArrayKey] > 1) { $legacyAnchor .= '_' . $refers[$legacyArrayKey]; } if ($enoughToc && (!isset($wgMaxTocLevel) || $toclevel < $wgMaxTocLevel)) { $toc .= $sk->tocLine($anchor, $tocline, $numbering, $toclevel); $tocraw[] = array('toclevel' => $toclevel, 'level' => $level, 'line' => $tocline, 'number' => $numbering); } # give headline the correct <h#> tag if ($showEditLink && $sectionIndex !== false) { if ($isTemplate) { # Put a T flag in the section identifier, to indicate to extractSections() # that sections inside <includeonly> should be counted. $editlink = $sk->doEditSectionLink(Title::newFromText($titleText), "T-{$sectionIndex}"); } else { $editlink = $sk->doEditSectionLink($this->mTitle, $sectionIndex, $headlineHint); } } else { $editlink = ''; } $head[$headlineCount] = $sk->makeHeadline($level, $matches['attrib'][$headlineCount], $anchor, $headline, $editlink, $legacyAnchor); $headlineCount++; } $this->mOutput->setSections($tocraw); # Never ever show TOC if no headers if ($numVisible < 1) { $enoughToc = false; } if ($enoughToc) { if ($prevtoclevel > 0 && $prevtoclevel < $wgMaxTocLevel) { $toc .= $sk->tocUnindent($prevtoclevel - 1); } $toc = $sk->tocList($toc); } # split up and insert constructed headlines $blocks = preg_split('/<H[1-6].*?' . '>.*?<\\/H[1-6]>/i', $text); $i = 0; foreach ($blocks as $block) { if ($showEditLink && $headlineCount > 0 && $i == 0 && $block !== "\n") { # This is the [edit] link that appears for the top block of text when # section editing is enabled # Disabled because it broke block formatting # For example, a bullet point in the top line # $full .= $sk->editSectionLink(0); } $full .= $block; if ($enoughToc && !$i && $isMain && !$this->mForceTocPosition) { # Top anchor now in skin $full = $full . $toc; } if (!empty($head[$i])) { $full .= $head[$i]; } $i++; } if ($this->mForceTocPosition) { return str_replace('<!--MWTOC-->', $toc, $full); } else { return $full; } }
function navigationBox($bar, $cont) { ?> <div class='generated-sidebar portlet grid_16' id='<?php echo Sanitizer::escapeId("p-{$bar}"); ?> '<?php echo $this->skin->tooltip('p-' . $bar); ?> > <!--<h5><?php $out = wfMsg($bar); if (wfEmptyMsg($bar, $out)) { echo $bar; } else { echo $out; } ?> </h5>--> <div class='pBody'> <?php if (is_array($cont)) { ?> <ul> <?php foreach ($cont as $key => $val) { ?> <li id="<?php echo Sanitizer::escapeId($val['id']); ?> "<?php if ($val['active']) { ?> class="active" <?php } ?> ><a href="<?php echo htmlspecialchars($val['href']); ?> "<?php echo $this->tooltipAndAccesskey($val['id']); ?> ><?php echo htmlspecialchars($val['text']); ?> </a> </li> <?php } ?> </ul> <?php } else { # allow raw HTML block to be defined by extensions print $cont; } ?> </div> </div> <div class="clear"></div> <?php }
/** * Make a table with metadata to be shown in the output page. * * @todo FIXME: Bad interface, see note on MediaHandler::formatMetadata(). * * @param array $metadata the array containing the Exif data * @return String The metadata table. This is treated as Wikitext (!) */ protected function makeMetadataTable($metadata) { $r = "<div class=\"mw-imagepage-section-metadata\">"; $r .= wfMessage('metadata-help')->plain(); $r .= "<table id=\"mw_metadata\" class=\"mw_metadata\">\n"; foreach ($metadata as $type => $stuff) { foreach ($stuff as $v) { # @todo FIXME: Why is this using escapeId for a class?! $class = Sanitizer::escapeId($v['id']); if ($type == 'collapsed') { // Handled by mediawiki.action.view.metadata module // and skins/common/shared.css. $class .= ' collapsable'; } $r .= "<tr class=\"{$class}\">\n"; $r .= "<th>{$v['name']}</th>\n"; $r .= "<td>{$v['value']}</td>\n</tr>"; } } $r .= "</table>\n</div>\n"; return $r; }
/** * Outputs the entire contents of the page */ public function execute() { global $wgBSWfblink, $wgBSWgooglelink, $wgBSWtwitterlink, $wgBSWyoutubelink, $wgBSWemaillink; $this->html('headelement'); ?> <nav id="myNavbar" class="navbar navbar-default navbar-fixed-top" role="nevigation"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbarCollapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href']); ?> " <?php echo Xml::expandAttributes(Linker::tooltipAndAccessKeyAttribs('p-logo')); ?> > <img class="img-responsive" src="<?php $this->text('logopath'); ?> " alt="<?php $this->text('sitename'); ?> " /> </a> </div> <div class="collapse navbar-collapse" id="navbarCollapse"> <ul class="nav navbar-nav"> <?php $count = 0; $actionMenuStart = <<<AMS \t\t\t\t\t<li class="dropdown"> \t\t\t\t\t\t<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-cog"></span><span class="caret"></span></a> \t\t\t\t\t\t<ul class="dropdown-menu" role="menu"> AMS; $actionMenuEnd = <<<AME \t\t\t\t\t\t</ul> \t\t\t\t\t</li> AME; $actionMenuBody = ""; foreach ($this->data['content_navigation'] as $category => $tabs) { foreach ($tabs as $key => $tab) { if ($count > 4) { $actionMenuBody .= $this->makeListItem($key, $tab); } else { echo $this->makeListItem($key, $tab); } ++$count; } } echo $actionMenuStart . $actionMenuBody . $actionMenuEnd; ?> </ul> <ul class="nav navbar-nav navbar-right"> <?php if (isset($wgBSWfblink) && trim($wgBSWfblink) != "") { ?> <li><a href="<?php echo $wgBSWfblink; ?> " target="_blank" class="socicon facebook" title="like on facebook">b</a></li> <?php } ?> <?php if (isset($wgBSWtwitterlink) && trim($wgBSWtwitterlink) != "") { ?> <li><a href="<?php echo $wgBSWfblink; ?> " target="_blank" class="socicon twitter" title="Follow on twitter">a</a></li> <?php } ?> <?php if (isset($wgBSWyoutubelink) && trim($wgBSWyoutubelink) != "") { ?> <li><a href="<?php echo $wgBSWfblink; ?> " target="_blank" class="socicon youtube" title="subscribe on youtube">r</a></li> <?php } ?> <?php if (isset($wgBSWgooglelink) && trim($wgBSWgooglelink) != "") { ?> <li><a href="<?php echo $wgBSWgooglelink; ?> " target="_blank" class="socicon google" title="follow on google plus">c</a></li> <?php } ?> <?php if (isset($wgBSWemaillink) && trim($wgBSWemaillink) != "") { ?> <li><a href="mailto:<?php echo $wgBSWemaillink; ?> " class="socicon email" title="Email us">@</a></li> <?php } ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span><span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <?php foreach ($this->getPersonalTools() as $key => $item) { echo $this->makeListItem($key, $item); } ?> </ul> </li> </ul> </div> </div> </nav> <div class="container"> <?php if ($this->data['newtalk']) { ?> <div class="row"> <div class="col-sm-12"> <div class="bg-info usermessage"><?php $this->html('newtalk'); ?> </div> </div> </div> <?php } ?> <?php if ($this->data['sitenotice']) { ?> <div class="row"> <div class="col-sm-12"> <div class="" id="siteNotice"><?php $this->html('sitenotice'); ?> </div> </div> </div> <?php } ?> <div class="row"> <div class="col-xs-12 col-sm-4 col-md-4 col-lg-3" id="sidebar"> <div id="search-div"> <form class="form-inline" role="form" action="<?php $this->text('wgScript'); ?> "> <div class="form-group"> <div class="input-group"> <input type="hidden" name="title" value="<?php $this->text('searchtitle'); ?> " /> <?php echo $this->makeSearchInput(array('class' => 'form-control')); ?> <div class="input-group-addon"><span class="glyphicon glyphicon-search"></span></div> </div> </div> </form> </div> <?php foreach ($this->getSidebar() as $boxName => $box) { ?> <div id="<?php echo Sanitizer::escapeId($box['id']); ?> "<?php echo Linker::tooltip($box['id']); ?> > <ul class="nav nav-pills nav-stacked left-margin-zero"> <li class="dropdown"> <a class="side-menu-toggle" data-toggle="" onclick="" href="#"><?php echo htmlspecialchars($box['header']); ?> </a> <?php if (is_array($box['content'])) { ?> <ul class="nav-pills list-unstyled sub-side-menu" role="menu"> <?php foreach ($box['content'] as $key => $item) { echo $this->makeListItem($key, $item); } ?> </ul> <?php } else { echo $box['content']; } ?> </li> </ul> </div> <?php } ?> <?php if ($this->data['language_urls']) { ?> <ul class="nav nav-pills nav-stacked left-margin-zero"> <li class="dropdown"> <a class="side-menu-toggle" data-toggle="" onclick="" href="#">Language</a> <ul class="nav-pills list-unstyled sub-side-menu" role="menu"> <?php foreach ($this->data['language_urls'] as $key => $langLink) { echo $this->makeListItem($key, $langLink); } ?> </ul> </li> </ul> <?php } ?> </div> <div class="col-xs-12 col-sm-8 col-md-8 col-lg-9" id="maincontent"> <h1 id="firstHeading" class="firstHeading"><?php $this->html('title'); ?> </h1> <hr/> <?php if ($this->data['subtitle']) { ?> <h4 class="small" ><?php $this->html('subtitle'); ?> </h4><?php } ?> <?php if ($this->data['undelete']) { ?> <h4 class="small" ><?php $this->html('undelete'); ?> </h4><?php } ?> <div id="bodyContent"><?php $this->html('bodytext'); ?> </div> <?php $this->html('catlinks'); ?> <?php $this->html('dataAfterContent'); ?> </div> </div> <hr/> <div class="row"> <div class="col-sm-12 text-center"> <footer> <?php foreach ($this->getFooterIcons('icononly') as $blockName => $footerIcons) { foreach ($footerIcons as $icon) { echo $this->getSkin()->makeFooterIcon($icon); } } ?> <a href="https://www.examsmyantra.com" title="Designed By ExamsMyantra" id="em-logo"></a> </footer> </div> </div> </div> <a href="javascript:void(0);" id="top"><span class="glyphicon glyphicon-arrow-up"></span></a> <?php $this->printTrail(); ?> </body> </html> <?php }
function getAnchorName() { $wantedId = $this->subject() . "_{$this->id()}"; return Sanitizer::escapeId($wantedId); }