本文整理汇总了PHP中Xml::expandAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Xml::expandAttributes方法的具体用法?PHP Xml::expandAttributes怎么用?PHP Xml::expandAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xml
的用法示例。
在下文中一共展示了Xml::expandAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: linkattr_ExternalLink
function linkattr_ExternalLink(&$url, &$text, &$link, &$attribs, $linktype)
{
$attribsText = Linker::getExternalLinkAttributes('external ' . $linktype);
$mergedattribs = array_merge($attribs, Sanitizer::decodeTagAttributes($attribsText));
linkattr_ModifyLink($text, $mergedattribs, 1);
if ($mergedattribs) {
$attribsText = Xml::expandAttributes($mergedattribs);
}
$link = sprintf('<a href="%s"%s>%s</a>', $url, $attribsText, $text);
return false;
}
示例2: execute
/**
* Outputs the entire contents of the (X)HTML page
*/
public function execute()
{
global $wgUser;
global $wgLiquiFlowWikiTitle;
// Build additional attributes for navigation urls
$nav = $this->data['content_navigation'];
$mode = $this->getSkin()->getUser()->isWatched($this->getSkin()->getRelevantTitle()) ? 'unwatch' : 'watch';
if (isset($nav['actions'][$mode])) {
$nav['views'][$mode] = $nav['actions'][$mode];
$nav['views'][$mode]['class'] = rtrim('icon ' . $nav['views'][$mode]['class'], ' ');
$nav['views'][$mode]['primary'] = true;
unset($nav['actions'][$mode]);
}
$xmlID = '';
foreach ($nav as $section => $links) {
foreach ($links as $key => $link) {
if ($section == 'views' && !(isset($link['primary']) && $link['primary'])) {
$link['class'] = rtrim('collapsible ' . $link['class'], ' ');
}
$xmlID = isset($link['id']) ? $link['id'] : 'ca-' . $xmlID;
$nav[$section][$key]['attributes'] = ' id="' . Sanitizer::escapeId($xmlID) . '"';
if ($link['class']) {
$nav[$section][$key]['attributes'] .= ' class="' . htmlspecialchars($link['class']) . '"';
unset($nav[$section][$key]['class']);
}
if (isset($link['tooltiponly']) && $link['tooltiponly']) {
$nav[$section][$key]['key'] = Linker::tooltip($xmlID);
} else {
$nav[$section][$key]['key'] = Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs($xmlID));
}
}
}
unset($nav['views']['view']);
//$nav['actions']['delete']['text'] = '<span class="fa fa-fw fa-trash-o" title="Page"></span> <span="hidden-sm">Delete</span>';
$this->data['namespace_urls'] = $nav['namespaces'];
$this->data['view_urls'] = $nav['views'];
$this->data['action_urls'] = $nav['actions'];
$this->data['variant_urls'] = $nav['variants'];
// Reverse horizontally rendered navigation elements
if ($this->data['rtl']) {
$this->data['view_urls'] = array_reverse($this->data['view_urls']);
$this->data['namespace_urls'] = array_reverse($this->data['namespace_urls']);
$this->data['personal_urls'] = array_reverse($this->data['personal_urls']);
}
// Output HTML Page
//$pos = strpos($this->data['headelement'], '<meta charset="UTF-8" />') + strlen("<meta charset=\"UTF-8\" />\n");
//$meta = "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n" .
// "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n";
//$this->data['headelement'] = substr_replace($this->data['headelement'], $meta, $pos, 0);
$this->html('headelement');
// extract the standard table of contents from the page html in order to add it to the left sidebar
preg_match("/<div id=\"toctitle\"><h2>Contents<\\/h2><\\/div>(.*?)<ul>(.*?)<\\/ul>(.*?)<\\/div>/si", $this->data['bodycontent'], $match);
$toc = "";
if (isset($match[0])) {
$toc = substr($match[0], 0, -6);
$toc = str_replace('<ul>', '<ul class="nav">', $toc);
// Hide standard toc on big screens when the sidebar toc is shown
$this->data['bodycontent'] = str_replace('<div id="toc" class="toc">', '<div id="toc" class="toc hidden-lg hidden-xl">', $this->data['bodycontent']);
}
?>
<nav class="navbar navbar-default navbar-fixed-top noprint" role="navigation" id="slide-nav">
<div class="container-fluid">
<div class="row">
<div class="col-md-12 navbar-main-column">
<div class="navbar-header">
<button class="navbar-toggle" id="main-nav-toggler">
<span class="sr-only">Toggle navigation</span>
<span class="fa fa-bars fa-2x"></span>
</button>
<a class="navbar-brand" href="<?php
echo htmlspecialchars($this->data['nav_urls']['mainpage']['href']);
?>
"
<?php
echo Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs('p-logo'));
?>
>
<div style="display: inline-block;">
<div class="hidden-xs"><img src="<?php
$this->text('logopath');
?>
" style="margin-top: -8px; height:40px; float:left; "></div>
<div class="visible-xs" style="white-space: nowrap;">Liquipedia</div>
</div>
</a>
<?php
if (strlen($toc) > 0) {
?>
<button class="navbar-toggle pull-right" id="toc-toggler">
<span class="sr-only">Toggle navigation</span>
<span style="padding-top:4px;" class="fa fa-list fa-2x"></span>
</button>
<?php
}
//.........这里部分代码省略.........
示例3: execute
/**
* Outputs the entire contents of the (X)HTML page
*/
public function execute()
{
global $wgVectorUseIconWatch;
// Build additional attributes for navigation urls
$nav = $this->data['content_navigation'];
if ($wgVectorUseIconWatch) {
$mode = $this->getSkin()->getTitle()->userIsWatching() ? 'unwatch' : 'watch';
if (isset($nav['actions'][$mode])) {
$nav['views'][$mode] = $nav['actions'][$mode];
$nav['views'][$mode]['class'] = rtrim('icon ' . $nav['views'][$mode]['class'], ' ');
$nav['views'][$mode]['primary'] = true;
unset($nav['actions'][$mode]);
}
}
$xmlID = '';
foreach ($nav as $section => $links) {
foreach ($links as $key => $link) {
if ($section == 'views' && !(isset($link['primary']) && $link['primary'])) {
$link['class'] = rtrim('collapsible ' . $link['class'], ' ');
}
$xmlID = isset($link['id']) ? $link['id'] : 'ca-' . $xmlID;
$nav[$section][$key]['attributes'] = ' id="' . Sanitizer::escapeId($xmlID) . '"';
if ($link['class']) {
$nav[$section][$key]['attributes'] .= ' class="' . htmlspecialchars($link['class']) . '"';
unset($nav[$section][$key]['class']);
}
if (isset($link['tooltiponly']) && $link['tooltiponly']) {
$nav[$section][$key]['key'] = Linker::tooltip($xmlID);
} else {
$nav[$section][$key]['key'] = Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs($xmlID));
}
}
}
$this->data['namespace_urls'] = $nav['namespaces'];
$this->data['view_urls'] = $nav['views'];
$this->data['action_urls'] = $nav['actions'];
$this->data['variant_urls'] = $nav['variants'];
// Reverse horizontally rendered navigation elements
if ($this->data['rtl']) {
$this->data['view_urls'] = array_reverse($this->data['view_urls']);
$this->data['namespace_urls'] = array_reverse($this->data['namespace_urls']);
$this->data['personal_urls'] = array_reverse($this->data['personal_urls']);
}
// Output HTML Page
$this->html('headelement');
?>
<div id="mw-page-base" class="noprint"></div>
<div id="mw-head-base" class="noprint"></div>
<!-- content -->
<div id="content" class="mw-body">
<a id="top"></a>
<div id="mw-js-message" style="display:none;"<?php
$this->html('userlangattributes');
?>
></div>
<?php
if ($this->data['sitenotice']) {
?>
<!-- sitenotice -->
<div id="siteNotice"><?php
$this->html('sitenotice');
?>
</div>
<!-- /sitenotice -->
<?php
}
?>
<!-- firstHeading -->
<h1 id="firstHeading" class="firstHeading">
<span dir="auto"><?php
$this->html('title');
?>
</span>
</h1>
<!-- /firstHeading -->
<!-- bodyContent -->
<div id="bodyContent">
<?php
if ($this->data['isarticle']) {
?>
<!-- tagline -->
<div id="siteSub"><?php
$this->msg('tagline');
?>
</div>
<!-- /tagline -->
<?php
}
?>
<!-- subtitle -->
<div id="contentSub"<?php
$this->html('userlangattributes');
?>
><?php
$this->html('subtitle');
?>
</div>
//.........这里部分代码省略.........
示例4: testExpandAttributesException
/**
* @covers Xml::expandAttributes
*/
public function testExpandAttributesException()
{
$this->setExpectedException('MWException');
Xml::expandAttributes('string');
}
示例5: tooltipAndAccesskey
function tooltipAndAccesskey($value)
{
return Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs($value));
}
示例6: execute
/**
* Outputs the entire contents of the (X)HTML page
*/
public function execute()
{
global $wgLang, $wgVectorUseIconWatch;
$this->skin = $this->data['skin'];
// Build additional attributes for navigation urls
//$nav = $this->skin->buildNavigationUrls();
$nav = $this->data['content_navigation'];
if ($wgVectorUseIconWatch) {
$mode = $this->skin->getTitle()->userIsWatching() ? 'unwatch' : 'watch';
if (isset($nav['actions'][$mode])) {
$nav['views'][$mode] = $nav['actions'][$mode];
$nav['views'][$mode]['class'] = rtrim('icon ' . $nav['views'][$mode]['class'], ' ');
$nav['views'][$mode]['primary'] = true;
unset($nav['actions'][$mode]);
}
}
$xmlID = '';
foreach ($nav as $section => $links) {
foreach ($links as $key => $link) {
if ($section == 'views' && !(isset($link['primary']) && $link['primary'])) {
$link['class'] = rtrim('collapsible ' . $link['class'], ' ');
}
$xmlID = isset($link['id']) ? $link['id'] : 'ca-' . $xmlID;
$nav[$section][$key]['attributes'] = ' id="' . Sanitizer::escapeId($xmlID) . '"';
if ($link['class']) {
$nav[$section][$key]['attributes'] .= ' class="' . htmlspecialchars($link['class']) . '"';
unset($nav[$section][$key]['class']);
}
if (isset($link['tooltiponly']) && $link['tooltiponly']) {
$nav[$section][$key]['key'] = Linker::tooltip($xmlID);
} else {
$nav[$section][$key]['key'] = Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs($xmlID));
}
}
}
$this->data['namespace_urls'] = $nav['namespaces'];
$this->data['view_urls'] = $nav['views'];
$this->data['action_urls'] = $nav['actions'];
$this->data['variant_urls'] = $nav['variants'];
// Reverse horizontally rendered navigation elements
if ($wgLang->isRTL()) {
$this->data['view_urls'] = array_reverse($this->data['view_urls']);
$this->data['namespace_urls'] = array_reverse($this->data['namespace_urls']);
}
// Output HTML Page
$this->html('headelement');
global $Cppreference2SkinRootLink;
$root_link = '/';
if (isset($Cppreference2SkinRootLink)) {
$root_link = htmlspecialchars($Cppreference2SkinRootLink);
}
?>
<!-- header -->
<div id="mw-head" class="noprint">
<div id="cpp-head-first-base">
<div id="cpp-head-first">
<h5><a href="<?php
echo $root_link;
?>
">
<?php
global $wgSitename;
echo $wgSitename;
?>
</a></h5>
<div id="cpp-head-search">
<?php
$this->renderNavigation('SEARCH');
?>
</div>
<div id="cpp-head-personal">
<?php
$this->renderNavigation('PERSONAL');
?>
</div>
</div>
</div>
<div id="cpp-head-second-base">
<div id="cpp-head-second">
<div id="cpp-head-tools-left">
<?php
$this->renderNavigation(array('NAMESPACES', 'VARIANTS'));
?>
</div>
<div id="cpp-head-tools-right">
<?php
$this->renderNavigation(array('VIEWS', 'ACTIONS'));
?>
</div>
</div>
</div>
</div>
<!-- /header -->
<!-- content -->
<div id="cpp-content-base">
<div id="content">
//.........这里部分代码省略.........
示例7: execute
/**
* Outputs the entire contents of the (X)HTML page
*/
public function execute()
{
// Build additional attributes for navigation urls
$nav = $this->data['content_navigation'];
if ($this->config->get('VectorUseIconWatch')) {
$mode = $this->getSkin()->getUser()->isWatched($this->getSkin()->getRelevantTitle()) ? 'unwatch' : 'watch';
if (isset($nav['actions'][$mode])) {
$nav['views'][$mode] = $nav['actions'][$mode];
$nav['views'][$mode]['class'] = rtrim('icon ' . $nav['views'][$mode]['class'], ' ');
$nav['views'][$mode]['primary'] = true;
unset($nav['actions'][$mode]);
}
}
$xmlID = '';
foreach ($nav as $section => $links) {
foreach ($links as $key => $link) {
if ($section == 'views' && !(isset($link['primary']) && $link['primary'])) {
$link['class'] = rtrim('collapsible ' . $link['class'], ' ');
}
$xmlID = isset($link['id']) ? $link['id'] : 'ca-' . $xmlID;
$nav[$section][$key]['attributes'] = ' id="' . Sanitizer::escapeId($xmlID) . '"';
if ($link['class']) {
$nav[$section][$key]['attributes'] .= ' class="' . htmlspecialchars($link['class']) . '"';
unset($nav[$section][$key]['class']);
}
if (isset($link['tooltiponly']) && $link['tooltiponly']) {
$nav[$section][$key]['key'] = Linker::tooltip($xmlID);
} else {
$nav[$section][$key]['key'] = Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs($xmlID));
}
}
}
$this->data['namespace_urls'] = $nav['namespaces'];
$this->data['view_urls'] = $nav['views'];
$this->data['action_urls'] = $nav['actions'];
$this->data['variant_urls'] = $nav['variants'];
// Reverse horizontally rendered navigation elements
if ($this->data['rtl']) {
$this->data['view_urls'] = array_reverse($this->data['view_urls']);
$this->data['namespace_urls'] = array_reverse($this->data['namespace_urls']);
$this->data['personal_urls'] = array_reverse($this->data['personal_urls']);
}
// Output HTML Page
$this->html('headelement');
?>
<div id="mw-page-base" class="noprint"></div>
<div id="mw-head-base" class="noprint"></div>
<div id="content" class="mw-body" role="main">
<a id="top"></a>
<?php
if ($this->data['sitenotice']) {
?>
<div id="siteNotice"><?php
$this->html('sitenotice');
?>
</div>
<?php
}
?>
<h1 id="firstHeading" class="firstHeading" lang="<?php
$this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
$this->text('pageLanguage');
?>
"><span dir="auto"><?php
$this->html('title');
?>
</span></h1>
<?php
$this->html('prebodyhtml');
?>
<div id="bodyContent" class="mw-body-content">
<?php
if ($this->data['isarticle']) {
?>
<div id="siteSub"><?php
$this->msg('tagline');
?>
</div>
<?php
}
?>
<div id="contentSub"<?php
$this->html('userlangattributes');
?>
><?php
$this->html('subtitle');
?>
</div>
<?php
if ($this->data['undelete']) {
?>
<div id="contentSub2"><?php
$this->html('undelete');
?>
</div>
<?php
//.........这里部分代码省略.........
示例8: getIconAltText
public static function getIconAltText($row)
{
$type = self::getIconType($row);
if ($type === false) {
return '';
}
wfProfileIn(__METHOD__);
switch ($type) {
case self::FEED_SUN_ICON:
$msg = 'newpage';
break;
case self::FEED_PENCIL_ICON:
$msg = 'edit';
break;
case self::FEED_MOVE_ICON:
$msg = 'move';
break;
case self::FEED_TALK_ICON:
$msg = 'talkpage';
break;
case self::FEED_COMMENT_ICON:
$msg = 'blogcomment';
break;
case self::FEED_DELETE_ICON:
$msg = 'delete';
break;
case self::FEED_PHOTO_ICON:
$msg = 'image';
break;
case self::FEED_FILM_ICON:
$msg = 'video';
break;
case self::FEED_CATEGORY_ICON:
$msg = 'categorization';
break;
}
$alt = wfMsg("myhome-feed-{$msg}");
$ret = Xml::expandAttributes(array('alt' => $alt, 'title' => $alt));
wfProfileOut(__METHOD__);
return $ret;
}
示例9: showForm
public function showForm($err = null)
{
$out = $this->getOutput();
$form = $this->form;
// convenience
$title = $this->form->getPage();
$oldConfig = $form->getOldConfig();
$s = '';
// form HTML string
# Add any error messages
if ("" != $err) {
$out->setSubtitle(wfMsgHtml('formerror'));
$out->addHTML("<p class='error'>{$err}</p>\n");
}
# Add header text
if (!$form->isAllowed()) {
$s .= wfMsgExt('stabilization-perm', 'parse', $title->getPrefixedText());
} else {
$s .= wfMsgExt('stabilization-text', 'parse', $title->getPrefixedText());
}
# Borrow some protection messages for dropdowns
$reasonDropDown = Xml::listDropDown('wpReasonSelection', wfMsgForContent('protect-dropdown'), wfMsgForContent('protect-otherreason-op'), $form->getReasonSelection(), 'mwStabilize-reason', 4);
$scExpiryOptions = wfMsgForContent('protect-expiry-options');
$showProtectOptions = $scExpiryOptions !== '-' && $form->isAllowed();
$dropdownOptions = array();
// array of <label,value>
# Add the current expiry as a dropdown option
if ($oldConfig['expiry'] && $oldConfig['expiry'] != Block::infinity()) {
$timestamp = $this->getLang()->timeanddate($oldConfig['expiry']);
$d = $this->getLang()->date($oldConfig['expiry']);
$t = $this->getLang()->time($oldConfig['expiry']);
$dropdownOptions[] = array(wfMsg('protect-existing-expiry', $timestamp, $d, $t), 'existing');
}
# Add "other time" expiry dropdown option
$dropdownOptions[] = array(wfMsg('protect-othertime-op'), 'othertime');
# Add custom expiry dropdown options (from MediaWiki message)
foreach (explode(',', $scExpiryOptions) as $option) {
if (strpos($option, ":") === false) {
$show = $value = $option;
} else {
list($show, $value) = explode(":", $option);
}
$dropdownOptions[] = array($show, $value);
}
# Actually build the options HTML...
$expiryFormOptions = '';
foreach ($dropdownOptions as $option) {
$show = htmlspecialchars($option[0]);
$value = htmlspecialchars($option[1]);
$expiryFormOptions .= Xml::option($show, $value, $form->getExpirySelection() === $value) . "\n";
}
# Build up the form...
$s .= Xml::openElement('form', array('name' => 'stabilization', 'action' => $this->getTitle()->getLocalUrl(), 'method' => 'post'));
# Add stable version override and selection options
$s .= Xml::fieldset(wfMsg('stabilization-def'), false) . "\n" . Xml::radioLabel(wfMsg('stabilization-def1'), 'wpStableconfig-override', 1, 'default-stable', 1 == $form->getOverride(), $this->disabledAttr()) . '<br />' . "\n" . Xml::radioLabel(wfMsg('stabilization-def2'), 'wpStableconfig-override', 0, 'default-current', 0 == $form->getOverride(), $this->disabledAttr()) . "\n" . Xml::closeElement('fieldset');
# Add autoreview restriction select
$s .= Xml::fieldset(wfMsg('stabilization-restrict'), false) . $this->buildSelector($form->getAutoreview()) . Xml::closeElement('fieldset') . Xml::fieldset(wfMsg('stabilization-leg'), false) . Xml::openElement('table');
# Add expiry dropdown to form...
if ($showProtectOptions && $form->isAllowed()) {
$s .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('stabilization-expiry'), 'mwStabilizeExpirySelection') . "</td>\n\t\t\t\t\t<td class='mw-input'>" . Xml::tags('select', array('id' => 'mwStabilizeExpirySelection', 'name' => 'wpExpirySelection', 'onchange' => 'onFRChangeExpiryDropdown()') + $this->disabledAttr(), $expiryFormOptions) . "</td>\n\t\t\t\t</tr>";
}
# Add custom expiry field to form...
$attribs = array('id' => "mwStabilizeExpiryOther", 'onkeyup' => 'onFRChangeExpiryField()') + $this->disabledAttr();
$s .= "\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>" . Xml::label(wfMsg('stabilization-othertime'), 'mwStabilizeExpiryOther') . '</td>
<td class="mw-input">' . Xml::input("mwStabilize-expiry", 50, $form->getExpiryCustom(), $attribs) . '</td>
</tr>';
# Add comment input and submit button
if ($form->isAllowed()) {
$watchLabel = wfMsgExt('watchthis', 'parseinline');
$watchAttribs = array('accesskey' => wfMsg('accesskey-watch'), 'id' => 'wpWatchthis');
$watchChecked = $this->getUser()->getOption('watchdefault') || $title->userIsWatching();
$reviewLabel = wfMsgExt('stabilization-review', 'parseinline');
$s .= ' <tr>
<td class="mw-label">' . xml::label(wfMsg('stabilization-comment'), 'wpReasonSelection') . '</td>
<td class="mw-input">' . $reasonDropDown . '</td>
</tr>
<tr>
<td class="mw-label">' . Xml::label(wfMsg('stabilization-otherreason'), 'wpReason') . '</td>
<td class="mw-input">' . Xml::input('wpReason', 70, $form->getReasonExtra(), array('id' => 'wpReason', 'maxlength' => 255)) . '</td>
</tr>
<tr>
<td></td>
<td class="mw-input">' . Xml::check('wpReviewthis', $form->getReviewThis(), array('id' => 'wpReviewthis')) . "<label for='wpReviewthis'>{$reviewLabel}</label>" . '     ' . Xml::check('wpWatchthis', $watchChecked, $watchAttribs) . " <label for='wpWatchthis' " . Xml::expandAttributes(array('title' => Linker::titleAttrib('watch', 'withaccess'))) . ">{$watchLabel}</label>" . '</td>
</tr>
<tr>
<td></td>
<td class="mw-submit">' . Xml::submitButton(wfMsg('stabilization-submit')) . '</td>
</tr>' . Xml::closeElement('table') . Html::hidden('title', $this->getTitle()->getPrefixedDBKey()) . Html::hidden('page', $title->getPrefixedText()) . Html::hidden('wpEditToken', $this->getUser()->editToken());
} else {
$s .= Xml::closeElement('table');
}
$s .= Xml::closeElement('fieldset') . Xml::closeElement('form');
$out->addHTML($s);
$out->addHTML(Xml::element('h2', null, htmlspecialchars(LogPage::logName('stable'))));
LogEventsList::showLogExtract($out, 'stable', $title->getPrefixedText(), '', array('lim' => 25));
# Add some javascript for expiry dropdowns
$out->addScript("<script type=\"text/javascript\">\n\t\t\t\tfunction onFRChangeExpiryDropdown() {\n\t\t\t\t\tdocument.getElementById('mwStabilizeExpiryOther').value = '';\n\t\t\t\t}\n\t\t\t\tfunction onFRChangeExpiryField() {\n\t\t\t\t\tdocument.getElementById('mwStabilizeExpirySelection').value = 'othertime';\n\t\t\t\t}\n\t\t\t</script>");
}
示例10: execute
/**
* Outputs the entire contents of the (X)HTML page
*/
public function execute()
{
global $wgPaperUseIconWatch;
$moniIconList = array('편집' => '/moniwiki/imgs/moni2/edit.png', '역사' => '/moniwiki/imgs/moni2/info.png', '보기' => '/moniwiki/imgs/moni2/show.png', '역링크' => '/moniwiki/imgs/moni2/backlinks.png', '임의 문서로' => '/moniwiki/imgs/moni2/random.png', '검색' => '/moniwiki/imgs/moni2/search.png', '차이' => '/moniwiki/imgs/moni2/diff.png', '도움말' => '/moniwiki/imgs/moni2/help.png', '환경설정' => '/moniwiki/imgs/moni2/pref.png', 'RSS' => '/moniwiki/imgs/moni2/rss.png');
// Build additional attributes for navigation urls
$nav = $this->data['content_navigation'];
$_TITLE = $this->getSkin()->getRelevantTitle();
$_URITITLE = rawurlencode($_TITLE);
/*
if ( $wgPaperUseIconWatch ) {
$mode = $this->getSkin()->getUser()->isWatched( $this->getSkin()->getRelevantTitle() ) ? 'unwatch' : 'watch';
if ( isset( $nav['actions'][$mode] ) ) {
$nav['views'][$mode] = $nav['actions'][$mode];
$nav['views'][$mode]['class'] = rtrim( 'icon ' . $nav['views'][$mode]['class'], ' ' );
$nav['views'][$mode]['primary'] = true;
unset( $nav['actions'][$mode] );
}
}*/
$xmlID = '';
foreach ($nav as $section => $links) {
foreach ($links as $key => $link) {
if ($section == 'views' && !(isset($link['primary']) && $link['primary'])) {
$link['class'] = rtrim('collapsible ' . $link['class'], ' ');
}
$xmlID = isset($link['id']) ? $link['id'] : 'ca-' . $xmlID;
$nav[$section][$key]['attributes'] = ' id="' . Sanitizer::escapeId($xmlID) . '"';
if ($link['class']) {
$nav[$section][$key]['attributes'] .= ' class="' . htmlspecialchars($link['class']) . '"';
unset($nav[$section][$key]['class']);
}
if (isset($link['tooltiponly']) && $link['tooltiponly']) {
$nav[$section][$key]['key'] = Linker::tooltip($xmlID);
} else {
$nav[$section][$key]['key'] = Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs($xmlID));
}
}
}
# if($_SERVER['REMOTE_ADDR'] == '182.216.191.202')
# print_r($nav);
$this->data['namespace_urls'] = $nav['namespaces'];
$this->data['view_urls'] = $nav['views'];
$this->data['action_urls'] = $nav['actions'];
$this->data['variant_urls'] = $nav['variants'];
// Reverse horizontally rendered navigation elements
if ($this->data['rtl']) {
$this->data['view_urls'] = array_reverse($this->data['view_urls']);
$this->data['namespace_urls'] = array_reverse($this->data['namespace_urls']);
$this->data['personal_urls'] = array_reverse($this->data['personal_urls']);
}
// Output HTML Page
$this->html('headelement');
?>
<div><a id="top" name="top" accesskey="t"></a></div>
<script type="text/javascript">
function toggle_menu() {
var menu = document.getElementById('wikiMenu');
if (!menu) return;
if (menu.style.height == 0)
menu.style.height = 0;
if (parseInt(menu.style.height) == 0) {
menu.style.height = 'auto';
} else {
menu.style.height = '0';
}
console.log(menu.style.height);
}
</script>
<div id="p-personal" role="navigation" class="<?php
if (count($this->data['personal_urls']) == 0) {
echo ' emptyPortlet';
}
?>
" aria-labelledby="p-personal-label" >
<div id="p-personal-align-center">
<!-- <h3 id="p-personal-label">Libre Wiki <?php
$this->msg('personaltools');
?>
</h3> -->
<ul<?php
$this->html('userlangattributes');
?>
>
<?php
$personalTools = $this->getPersonalTools();
foreach ($personalTools as $key => $item) {
echo $this->makeListItem($key, $item);
}
?>
</ul>
</div>
</div>
<div id="mw-js-message" style="display:none;"<?php
//.........这里部分代码省略.........
示例11: loadRevisionData
/**
* Load revision metadata for the specified articles. If newid is 0, then compare
* the old article in oldid to the current article; if oldid is 0, then
* compare the current article to the immediately previous one (ignoring the
* value of newid).
*
* If oldid is false, leave the corresponding revision object set
* to false. This is impossible via ordinary user input, and is provided for
* API convenience.
*/
function loadRevisionData()
{
global $wgLang, $wgUser;
if ($this->mRevisionsLoaded) {
return true;
} else {
// Whether it succeeds or fails, we don't want to try again
$this->mRevisionsLoaded = true;
}
// Load the new revision object
$this->mNewRev = $this->mNewid ? Revision::newFromId($this->mNewid) : Revision::newFromTitle($this->mTitle);
if (!$this->mNewRev instanceof Revision) {
return false;
}
// Update the new revision ID in case it was 0 (makes life easier doing UI stuff)
$this->mNewid = $this->mNewRev->getId();
// Check if page is editable
$editable = $this->mNewRev->getTitle()->userCan('edit');
// Set assorted variables
$timestamp = $wgLang->timeanddate($this->mNewRev->getTimestamp(), true);
$dateofrev = $wgLang->date($this->mNewRev->getTimestamp(), true);
$timeofrev = $wgLang->time($this->mNewRev->getTimestamp(), true);
$this->mNewPage = $this->mNewRev->getTitle();
if ($this->mNewRev->isCurrent()) {
$newLink = $this->mNewPage->escapeLocalUrl(array('oldid' => $this->mNewid));
$this->mPagetitle = htmlspecialchars(wfMsg('currentrev-asof', $timestamp, $dateofrev, $timeofrev));
$newEdit = $this->mNewPage->escapeLocalUrl(array('action' => 'edit'));
$this->mNewtitle = "<a href='{$newLink}'>{$this->mPagetitle}</a>";
$this->mNewtitle .= " (<a href='{$newEdit}'>" . wfMsgHtml($editable ? 'editold' : 'viewsourceold') . "</a>)";
} else {
$newLink = $this->mNewPage->escapeLocalUrl(array('oldid' => $this->mNewid));
$newEdit = $this->mNewPage->escapeLocalUrl(array('action' => 'edit', 'oldid' => $this->mNewid));
$this->mPagetitle = htmlspecialchars(wfMsg('revisionasof', $timestamp, $dateofrev, $timeofrev));
$this->mNewtitle = "<a href='{$newLink}'>{$this->mPagetitle}</a>";
$this->mNewtitle .= " (<a href='{$newEdit}'>" . wfMsgHtml($editable ? 'editold' : 'viewsourceold') . "</a>)";
}
if (!$this->mNewRev->userCan(Revision::DELETED_TEXT)) {
$this->mNewtitle = "<span class='history-deleted'>{$this->mPagetitle}</span>";
} else {
if ($this->mNewRev->isDeleted(Revision::DELETED_TEXT)) {
$this->mNewtitle = "<span class='history-deleted'>{$this->mNewtitle}</span>";
}
}
// Load the old revision object
$this->mOldRev = false;
if ($this->mOldid) {
$this->mOldRev = Revision::newFromId($this->mOldid);
} elseif ($this->mOldid === 0) {
$rev = $this->mNewRev->getPrevious();
if ($rev) {
$this->mOldid = $rev->getId();
$this->mOldRev = $rev;
} else {
// No previous revision; mark to show as first-version only.
$this->mOldid = false;
$this->mOldRev = false;
}
}
/* elseif ( $this->mOldid === false ) leave mOldRev false; */
if (is_null($this->mOldRev)) {
return false;
}
if ($this->mOldRev) {
$this->mOldPage = $this->mOldRev->getTitle();
$t = $wgLang->timeanddate($this->mOldRev->getTimestamp(), true);
$dateofrev = $wgLang->date($this->mOldRev->getTimestamp(), true);
$timeofrev = $wgLang->time($this->mOldRev->getTimestamp(), true);
$oldLink = $this->mOldPage->escapeLocalUrl(array('oldid' => $this->mOldid));
$oldEdit = $this->mOldPage->escapeLocalUrl(array('action' => 'edit', 'oldid' => $this->mOldid));
$this->mOldPagetitle = htmlspecialchars(wfMsg('revisionasof', $t, $dateofrev, $timeofrev));
$this->mOldtitle = "<a href='{$oldLink}'>{$this->mOldPagetitle}</a>" . " (<a href='{$oldEdit}'>" . wfMsgHtml($editable ? 'editold' : 'viewsourceold') . "</a>)";
// Add an "undo" link
$newUndo = $this->mNewPage->escapeLocalUrl(array('action' => 'edit', 'undoafter' => $this->mOldid, 'undo' => $this->mNewid));
$htmlLink = htmlspecialchars(wfMsg('editundo'));
$htmlTitle = Xml::expandAttributes(array('title' => $wgUser->getSkin()->titleAttrib('undo')));
if ($editable && !$this->mOldRev->isDeleted(Revision::DELETED_TEXT) && !$this->mNewRev->isDeleted(Revision::DELETED_TEXT)) {
$this->mNewtitle .= " (<a href='{$newUndo}' {$htmlTitle}>" . $htmlLink . "</a>)";
}
if (!$this->mOldRev->userCan(Revision::DELETED_TEXT)) {
$this->mOldtitle = '<span class="history-deleted">' . $this->mOldPagetitle . '</span>';
} else {
if ($this->mOldRev->isDeleted(Revision::DELETED_TEXT)) {
$this->mOldtitle = '<span class="history-deleted">' . $this->mOldtitle . '</span>';
}
}
}
return true;
}
示例12: renderLogo
/**
* Render logo
*/
private function renderLogo()
{
$mainPageLink = $this->data['nav_urls']['mainpage']['href'];
$toolTip = Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs('p-logo'));
?>
<ul class="nav logo-container pull-right" role="navigation"><li id="p-logo"><a href="<?php
echo htmlspecialchars($this->data['nav_urls']['mainpage']['href']);
?>
" <?php
echo Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs('p-logo'));
?>
><img src="<?php
$this->text('logopath');
?>
" alt="<?php
$this->html('sitename');
?>
" style="width:90%"></a><li></ul>
<?php
}
示例13: customBox
function customBox($bar, $cont)
{
?>
<div class='generated-sidebar portlet' id='<?php
echo Sanitizer::escapeId("p-{$bar}");
?>
'<?php
echo $this->skin->tooltip('p-' . $bar);
?>
>
<h5>
<?php
$out = wfMsg($bar);
if (wfEmptyMsg($bar, $out)) {
echo htmlspecialchars($bar);
} else {
echo htmlspecialchars($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 Xml::expandAttributes($this->skin->tooltipAndAccesskeyAttribs($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>
<?php
}
示例14: execute
/**
* Outputs the entire contents of the (X)HTML page
*/
public function execute()
{
// Build additional attributes for navigation urls
global $wgUser;
$nav = $this->data['content_navigation'];
if ($this->config->get('LibreUseIconWatch')) {
$mode = $this->getSkin()->getUser()->isWatched($this->getSkin()->getRelevantTitle()) ? 'unwatch' : 'watch';
if (isset($nav['actions'][$mode])) {
$nav['views'][$mode] = $nav['actions'][$mode];
$nav['views'][$mode]['class'] = rtrim('icon ' . $nav['views'][$mode]['class'], ' ');
$nav['views'][$mode]['primary'] = true;
unset($nav['actions'][$mode]);
}
}
$xmlID = '';
foreach ($nav as $section => $links) {
foreach ($links as $key => $link) {
if ($section == 'views' && !(isset($link['primary']) && $link['primary'])) {
$link['class'] = rtrim('collapsible ' . $link['class'], ' ');
}
$xmlID = isset($link['id']) ? $link['id'] : 'ca-' . $xmlID;
$nav[$section][$key]['attributes'] = ' id="' . Sanitizer::escapeId($xmlID) . '"';
if ($link['class']) {
$nav[$section][$key]['attributes'] .= ' class="' . htmlspecialchars($link['class']) . '"';
unset($nav[$section][$key]['class']);
}
if (isset($link['tooltiponly']) && $link['tooltiponly']) {
$nav[$section][$key]['key'] = Linker::tooltip($xmlID);
} else {
$nav[$section][$key]['key'] = Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs($xmlID));
}
}
}
$this->data['namespace_urls'] = $nav['namespaces'];
$this->data['view_urls'] = $nav['views'];
$this->data['action_urls'] = $nav['actions'];
$this->data['variant_urls'] = $nav['variants'];
// Reverse horizontally rendered navigation elements
if ($this->data['rtl']) {
$this->data['view_urls'] = array_reverse($this->data['view_urls']);
$this->data['namespace_urls'] = array_reverse($this->data['namespace_urls']);
$this->data['personal_urls'] = array_reverse($this->data['personal_urls']);
}
$userLinks = $this->getPersonalTools();
$user = $wgUser->isLoggedIn() ? array_shift($userLinks) : array_pop($userLinks);
$userLink = $user['links'][0];
// Output HTML Page
$this->html('headelement');
?>
<div class="container">
<!-- Static navbar -->
<nav class="navbar navbar-default navbar-fixed-top libre_navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="glyphicon glyphicon-th-large" aria-hidden="true"></span>
</button>
<div class="dropdown">
<?php
if ($wgUser->isLoggedIn()) {
$loginfuc = "data-toggle=\"dropdown\"";
$loginbtn = "user";
} else {
$loginbtn = "lock";
$loginfuc = "onclick=\"location.href='" . $userLink['href'] . "'\"";
}
?>
<button type="button" class="navbar-toggle collapsed dropdown-toggle" <?php
echo $loginfuc;
?>
aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="glyphicon glyphicon-<?php
echo $loginbtn;
?>
" aria-hidden="true"></span>
</button>
<?php
if ($wgUser->isLoggedIn()) {
?>
<ul class="dropdown-menu libre_personal_dropdown" role="menu">
<?php
$this->renderNavigation('PERSONAL');
?>
</ul>
<?php
}
?>
</div>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav_search" aria-expanded="false" aria-controls="nav_search">
<span class="sr-only">Toggle navigation</span>
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
</button>
<a class="navbar-brand" href="/wiki/리브레_위키:현관"><img alt="<?php
echo $this->msg('tagline');
//.........这里部分代码省略.........
示例15: getCheckboxes
/**
* Returns an array of html code of the following checkboxes:
* minor and watch
*
* @param int $tabindex Current tabindex
* @param array $checked Array of checkbox => bool, where bool indicates the checked
* status of the checkbox
*
* @return array
*/
public function getCheckboxes(&$tabindex, $checked)
{
global $wgUser, $wgUseMediaWikiUIEverywhere;
$checkboxes = array();
// don't show the minor edit checkbox if it's a new page or section
if (!$this->isNew) {
$checkboxes['minor'] = '';
$minorLabel = wfMessage('minoredit')->parse();
if ($wgUser->isAllowed('minoredit')) {
$attribs = array('tabindex' => ++$tabindex, 'accesskey' => wfMessage('accesskey-minoredit')->text(), 'id' => 'wpMinoredit');
$minorEditHtml = Xml::check('wpMinoredit', $checked['minor'], $attribs) . " <label for='wpMinoredit' id='mw-editpage-minoredit'" . Xml::expandAttributes(array('title' => Linker::titleAttrib('minoredit', 'withaccess'))) . ">{$minorLabel}</label>";
if ($wgUseMediaWikiUIEverywhere) {
$checkboxes['minor'] = Html::openElement('div', array('class' => 'mw-ui-checkbox')) . $minorEditHtml . Html::closeElement('div');
} else {
$checkboxes['minor'] = $minorEditHtml;
}
}
}
$watchLabel = wfMessage('watchthis')->parse();
$checkboxes['watch'] = '';
if ($wgUser->isLoggedIn()) {
$attribs = array('tabindex' => ++$tabindex, 'accesskey' => wfMessage('accesskey-watch')->text(), 'id' => 'wpWatchthis');
$watchThisHtml = Xml::check('wpWatchthis', $checked['watch'], $attribs) . " <label for='wpWatchthis' id='mw-editpage-watch'" . Xml::expandAttributes(array('title' => Linker::titleAttrib('watch', 'withaccess'))) . ">{$watchLabel}</label>";
if ($wgUseMediaWikiUIEverywhere) {
$checkboxes['watch'] = Html::openElement('div', array('class' => 'mw-ui-checkbox')) . $watchThisHtml . Html::closeElement('div');
} else {
$checkboxes['watch'] = $watchThisHtml;
}
}
wfRunHooks('EditPageBeforeEditChecks', array(&$this, &$checkboxes, &$tabindex));
return $checkboxes;
}