Code Monkey home page Code Monkey logo

liberty-skin's Introduction

Liberty MediaWiki Skin

English

리브레 위키의 기본 스킨입니다. 위키 엔진 '리버티'의 기본 레이아웃입니다.

개발

원본 소스는 GitHub.com에 존재하며, 버그 리포팅은 bbs.librewiki.net에서, 패치는 GitHub.com 에서만 받고 있습니다. 이 외의 호스팅에서 발견되는 코드는 모두 미러링이며, 코드의 최신성을 보증하지 않습니다.

보안 취약점은 이메일 (dev(골뱅이!)librewiki.net) 로 보고해 주세요.

설치

  • 미디어위키 Skins 폴더에 압축을 풀거나 git clone을 수행하세요. 압축해제된 폴더의 이름은 Liberty 이어야 합니다.
  • LocalSettings.php 파일에 wfLoadSkin( 'Liberty' ); 를 추가해 주세요.

설정

LocalSettings.php 파일에 아래와 같이 작성해주세요.

이름 설명 예시 값 기본 값
$wgLibertyMainColor theme-color 메타 설정 및 사이트 주 색상 설정 #4188F1 #4188F1
$wgLibertySecondColor 사이트 보조 색상 설정 #2774DC $wgLibertyMainColor의 값에서 1A1415만큼 뺀 값
$wgTwitterAccount 트위터 카드 계정 설정 librewiki (없음)
$wgLibertyOgLogo 오픈그래프 태그에 사용 될 이미지 설정 https://librewiki.net/images/6/6a/Libre_favicon.png $wgLogo의 값
$wgNaverVerification 네이버 사이트 도구 인증 코드 (네이버에서 제공된 값) (없음)
$wgLibertyAdSetting 구글 애드센스 설정 array( 'client' => '(Google Adsense에서 제공한 값)', 'header' => '1234567890', 'right' => '0987654321', 'belowarticle' => 1313135452 ) (없음)
$wgLibertyAdGroup 사용자 그룹별 광고 차등화 여부 설정 differ null
$wgLibertyMobileReplaceAd 모바일 환경일 시 사이드바 광고를 하단으로 옮깁니다. true false
$wgLibertyEnableLiveRC 사이드바 최근 변경 사용 여부 true true
$wgLibertyMaxRecent 사이드바 최근 변경에 등장하는 편집의 최대 개수 10 10
$wgLibertyNavBarLogoImage 내비게이션 바에 표시되는 로고 이미지 ./image.png null
$wgLibertyLiveRCArticleNamespaces 사이드바 최근 변경 왼쪽 탭에 보여질 네임스페이스 목록 [NS_MAIN, NS_PROJECT, NS_TEMPLATE, NS_HELP, NS_CATEGORY] [NS_MAIN, NS_PROJECT, NS_TEMPLATE, NS_HELP, NS_CATEGORY]
$wgLibertyLiveRCTalkNamespaces 사이드바 최근 변경 오른쪽 탭에 보여질 네임스페이스 목록 [NS_TALK, NS_USER_TALK, NS_PROJECT_TALK, NS_FILE_TALK, NS_MEDIAWIKI_TALK, NS_TEMPLATE_TALK, NS_HELP_TALK, NS_CATEGORY_TALK] [NS_TALK, NS_USER_TALK, NS_PROJECT_TALK, NS_FILE_TALK, NS_MEDIAWIKI_TALK, NS_TEMPLATE_TALK, NS_HELP_TALK, NS_CATEGORY_TALK]

상단바

다음과 같은 형식을 따라서 미디어위키:Liberty-Navbar 문서에 작성해주세요.

  • 최상단 메뉴:
    • * icon=아이콘 | display=표시 내용 | title=Hover 문구 | link=클릭시 링크 | access=단축키 | class=커스텀 HTML 클래스 | group=필요 그룹 | right=필요 권한
  • 하위 메뉴:
    • ** icon=아이콘 | display=표시 내용 | title=Hover 문구 | link=클릭시 링크 | access=단축키 | class=커스텀 HTML 클래스 | group=필요 그룹 | right=필요 권한
  • 최하위 메뉴:
    • *** icon=아이콘 | display=표시 내용 | title=Hover 문구 | link=클릭시 링크 | access=단축키 | class=커스텀 HTML 클래스 | group=필요 그룹 | right=필요 권한

  • 모든 내용은 선택이나, icondisplay 중 적어도 하나는 설정되어 있어야 합니다.
  • 설정하지 않을 내용은 적지 않으면 됩니다. 예를 들어, 아이콘을 설정하지 않으려면 icon=...을 생략하면 됩니다.
  • title이 설정되어 있지 않다면 display로 자동 설정 됩니다.
  • displaytitle을 설정할 때 미디어위키 i18n 메시지의 이름을 작성하여 해당 i18n 메시지의 내용이 출력되게 할 수 있습니다. (예시: recentchanges를 적으면 최근 바뀜 출력)
  • 단축키는 Alt-Shift-(키)로 사용할 수 있습니다.
  • 단축키를 설정할 때는 미디어위키에서 제공하는 기본 단축키와 겹치지 않도록 주의해 주세요.
  • 커스텀 클래스는 ,로 구분하여 작성해 주세요. (예시: classA, classB를 적어서 classAclassB 클래스 추가)

예시는 리브레 위키에서 확인할 수 있습니다.

권한

권한별 광고 차등화를 구현하기 위해 아래와 같이 네 가지 권한이 추가됩니다. 만약 $wgLibertyAdGroup이 'differ'로 설정되어 있다면 아래 권한에 따라 환경설정에 광고 커스터마이징 옵션이 나타납니다.

  • blockads-header : 헤더 광고를 없앨 수 있습니다.
  • blockads-right : 우측 광고를 없앨 수 있습니다.
  • blockads-belowarticle : 글 하단 광고를 없앨 수 있습니다.
  • blockads-bottom : 하단 광고를 없앨 수 있습니다.

liberty-skin's People

Contributors

ahn9807 avatar fregmented avatar hoto-cocoa avatar jdlrobson avatar justman100 avatar katinor avatar mary-kate avatar nessunkim avatar nuxe01 avatar paladox avatar revi avatar translatewiki avatar universal-omega avatar zlzleking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

liberty-skin's Issues

Logo not displayed

I downloaded and applied the Levi's skin, but I don't see the Libre Wiki logo, and it doesn't show up even if I replace it with another picture. How do I fix it? Also, I'm curious about how I can change the color of the top bar of Wiki.

Make it possible to run the Liberty skin without third-party CSS/JS dependencies

Currently a bunch of external assets (FontAwesome from FontAwesome.com, other fonts mainly/only (?) for supporting Korean, share-api-polyfill from unpkg.com) are loaded unconditionally in SkinLiberty#setupCss. While this may work just as intended from a functional point of view and be totally acceptable for a lower-traffic MediaWiki instance, this would make Liberty a no-go for more privacy-conscious setups; for example, the Wikimedia Foundation's sites.*

Ideally there'd be a configuration global that could and should be explicitly enabled by the end-user (sysadmin) in the wiki's LocalSettings.php to enable loading assets from external servers.
Google AdSense JS is a notable exception to that since it cannot be self-hosted; but the scenario I want to see is that with ads turned off, Liberty makes no connections to external servers.

  • I want to note that while I personally don't think we're seeing Liberty on WMF servers anytime soon, especially in the current political climate when it comes to skins, the WMF as the biggest MediaWiki user and developer is still an organization that cannot be ignored, and I find the policy of self-hosting as much as possible and avoiding external dependencies where and when possible a very reasonable policy.

Translation updates blocked

When pushing translations to this repository, we are currently facing this issue:

 The command "cd 'mwgithub/librewiki/liberty-skin'; git add .; if ! git diff  
   --cached --quiet; then git commit -m 'Localisation updates from https://tr  
  anslatewiki.net.'; git rebase 'origin/master' && git push origin 'master';   
  fi" failed.                                                                  
                                                                               
  Exit Code: 1(General error)                                                  
                                                                               
  Working directory: /scratch/exports                                          
                                                                               
  Output:                                                                      
  ================                                                             
  [master 1b05bbf] Localisation updates from https://translatewiki.net.        
   1 file changed, 11 insertions(+)                                            
  Current branch master is up to date.                                         
                                                                               
                                                                               
  Error Output:                                                                
  ================                                                             
  remote: error: GH006: Protected branch update failed for refs/heads/master.  
                                                                               
  remote: error: 2 of 2 required status checks are expected.                   
  To github.com:librewiki/liberty-skin.git                                     
   ! [remote rejected] master -> master (protected branch hook declined)       
  error: failed to push some refs to 'github.com:librewiki/liberty-skin.git' 

Please investigate a way to resume translations updates by @translatewiki.

INstallationproblem

After installation on mw1.27.4 and php 7 (xampp) i get :
Notice: Undefined index: notifications-alert in L:\xammp7025\htdocs\mw1274\skins\liberty\LibertyTemplate.php on line 638 .... Notice: Undefined index: notifications-message in L:\xammp7025\htdocs\mw1274\skins\liberty\LibertyTemplate.php on line 639

(I was at https://issue.librewiki.net/search/query/ryjJBqxqTfRS/#R - but could not publish an issue...)

Remove or redefine missing i18n messages "liberty-btn-close" and "liberty-btn-save-changes"

The i18n messages liberty-btn-close and liberty-btn-save-changes got removed from the English i18n JSON file in aa86154 by @revi, but to this day they're seemingly "used" in the div.modal-footer element of the login dialog (which is only shown to anons), but that element is always (?) visually hidden via CSS...

As a side note, it might be worthwhile to look into the OOJsUIAjaxLogin extension and see if using that extension would make more sense than to have the skin provide such a feature. (Granted, the extension is formally unmaintained but it worked just fine the last time I tried and it's not like it's the most complex piece of software out there, so it probably won't need much maintenance going forward.)

PHP Deprecated

Get this:

PHP message: PHP Deprecated: Use of ContentHandler::getContentText was deprecated in MediaWiki 1.37. [Called from LibertyTemplate::parseNavbar in skins/liberty-skin/LibertyTemplate.php:879]

HTML parsing error related in the Navbar

Hello, thank you very much for creating the Liberty skin.

Currently, there is an issue where the site is not hyperlinked properly due to an HTML
parsing error when '=' and '&' are included in the HTML.

For instance, using "https://papago.naver.net/website?locale=ko&source=ko&target=en&url=https://xxx"
creates parsing errors at the "=", and due to incorrect usages of the "htmlentities(): function,
the result is "https://papago.naver.net/website?".

Since I am not familiar with PHP, I applied a simple patch as follows, but I am concerned about any potential security vulnerabilities.

// LibertyTemplate.php
 foreach ( $split as $key => $value ) {
         $valueArr = explode( '=', trim( $value ) );
         if ( isset( $valueArr[1] ) ) {
                 $newValue = implode( '=', array_slice($valueArr, 1)); // <- Temporary fix for concat hyperlink with "=".
                 $data[$valueArr[0]] = $newValue;
         } else {
                 $data[$types[$key]] = trim( $value );
         }
 }
// LibertyTemplate.php
if ( isset( $data['link'] ) ) {
        // @todo CHECKME: Should this use wfUrlProtocols() or somesuch instead?
        if ( preg_match( '/^((?:(?:http(?:s)?)?:)?\/\/(?:.{4,}))$/i', $data['link'] ) ) {
                $href = htmlentities( $data['link'], ENT_QUOTES, 'UTF-8' );
                $href = $data['link']; // <- Temporary fix for ignoring htmlentitites produce hyperlink with &amp.
        } else {
                $href = str_replace( '%3A', ':', urlencode( $data['link'] ) );
                $href = str_replace( '$1', $href, $wgArticlePath );
        }
} else {
        $href = null;
}

If you could confirm, I will apply the related changes and submit a pull request.

Thank you.

미디어위키:Liberty-Navbar의 형식과 맞지 않게 Navbar가 출력되는 문제

미디어위키:Liberty-Navbar는 다음과 같이 적용했습니다.

* icon=comments | display=게시판
** icon=pencil-alt | display=위키방 | link=https://bbs.gaonwiki.com | title=https://bbs.gaonwiki.com
** icon=copyright | display=저작권 처리 게시판 | link=https://bbs.gaonwiki.com/copyrights | title=https://bbs.gaonwiki.com/copyrights
** icon=comments | display=자유게시판 | link=https://bbs.gaonwiki.com/free | title=https://bbs.gaonwiki.com/free
* icon=exclamation | display=버그/기능 개선
** icon=bullhorn | display=이슈 등록 | link=https://bbs.gaonwiki.com/issue | title=https://bbs.gaonwiki.com/issue
** icon=hands-helping | display=기능 구현 도움 | link=https://www.gaonwiki.com/w/가온_위키:기능_구현_불가-누가_해결책을_알려주세요! | title=https://www.gaonwiki.com/w/가온_위키:기능_구현_불가-누가_해결책을_알려주세요!
** icon=bug | display=알려진 문제들 | link=https://www.gaonwiki.com/w/가온_위키/알려진_문제들 | title=https://www.gaonwiki.com/w/가온_위키/알려진_문제들
* icon=gear | display=도구
** icon=wrench | display=특수 문서 목록 | link=특수:특수문서 | title=특수:특수문서
** icon=upload | display=파일 올리기
*** icon=cloud-upload-alt | display=(기존) 업로드 | link=특수:올리기 | title=특수:올리기
*** icon=file-upload | display=(신규) 업로드 마법사 | link=특수:UploadWizard | title=특수:UploadWizard
** icon=flag | display=이슈 트래커 | link=https://bbs.gaonwiki.com/issue/ | title=https://bbs.gaonwiki.com/issue/
** icon=flask | display=가온 위키 베타 | link=https://beta.gaonwiki.com | title=https://beta.gaonwiki.com
* icon=book | display=도움말
** icon=spell-check | display=위키 문법 | link=도움말:위키_문법 | title=도움말:위키_문법
** icon=book | display=설명서 | link=도움말:설명서 | title=도움말:설명서

이후 리버티 스킨 1786539 커밋을 적용하면 첨부한 이미지와 같이 각 드롭다운 메뉴의 마지막 항목이 다음 드롭다운 타이틀로 적용되는 문제가 있습니다.
image

현재 미디어위키 버전은 1.39.8 사용중이고, a15075a 커밋에서는 문제가 없습니다. 즉, a15075a 이후 커밋 중에 문제가 발생하는 것 같습니다(정확히 어떤 커밋에서 발생하는지는 모르겠습니다).


[환경]

문제가 발생하지 않은 a15075a 커밋을 바탕으로 다음과 같이 수정하면 정상 동작합니다.

protected function parseNavbar() {
	global $wgArticlePath;

	$headings = [];
	$skin = $this->getSkin();
	$userName = $skin->getUser()->getName();
	$userLang = $skin->getLanguage()->mCode;
	$globalData = ContentHandler::getContentText( WikiPage::factory(
		Title::newFromText( 'Liberty-Navbar', NS_MEDIAWIKI )
	)->getContent( RevisionRecord::RAW ) );
	$globalLangData = ContentHandler::getContentText( WikiPage::factory(
		Title::newFromText( 'Liberty-Navbar/' . $userLang, NS_MEDIAWIKI )
	)->getContent( RevisionRecord::RAW ) );
	$userData = ContentHandler::getContentText( WikiPage::factory(
		Title::newFromText( $userName . '/Liberty-Navbar', NS_USER )
	)->getContent( RevisionRecord::RAW ) );
	if ( !empty( $userData ) ) {
		$data = $userData;
	} elseif ( !empty( $globalLangData ) ) {
		$data = $globalLangData;
	} else {
		$data = $globalData;
	}
	if ( empty( $data ) ) {
		return $headings;
	}

	$lines = explode( "\n", $data );

	$types = [ 'icon', 'display', 'title', 'link', 'access', 'class' ];

	foreach ( $lines as $line ) {
		$line = rtrim( $line, "\r" );
		if ( $line[0] !== '*' ) {
			continue;
		}
		if ( $line[1] !== '*' ) {
			// First level menu
			$data = [];
			$split = explode( '|', $line );
			$split[0] = substr( $split[0], 1 );
			foreach ( $split as $key => $value ) {
				$valueArr = explode( '=', trim( $value ) );
				if ( isset( $valueArr[1] ) ) {
					$data[$valueArr[0]] = $valueArr[1];
				} else {
					$data[$types[$key]] = trim( $value );
				}
			}

			$icon = isset( $data['icon'] ) ? htmlentities( $data['icon'], ENT_QUOTES, 'UTF-8' ) : null;
			$group = isset( $data['group'] ) ? htmlentities( $data['group'], ENT_QUOTES, 'UTF-8' ) : null;
			$right = isset( $data['right'] ) ? htmlentities( $data['right'], ENT_QUOTES, 'UTF-8' ) : null;

			if ( isset( $data['display'] ) ) {
				$textObj = $skin->msg( $data['display'] );
				if ( $textObj->isDisabled() ) {
					$text = htmlentities( $data['display'], ENT_QUOTES, 'UTF-8' );
				} else {
					$text = $textObj->text();
				}
			} else {
				$text = '';
			}

			if ( empty( $icon ) && empty( $text ) ) {
				continue;
			}

			if ( isset( $data['title'] ) ) {
				$titleObj = $skin->msg( $data['title'] );
				if ( $titleObj->isDisabled() ) {
					$title = htmlentities( $data['title'], ENT_QUOTES, 'UTF-8' );
				} else {
					$title = $titleObj->text();
				}
			} else {
				$title = $text;
			}

			if ( isset( $data['link'] ) ) {
				if ( preg_match( '/^((?:(?:http(?:s)?)?:)?\/\/(?:.{4,}))$/i', $data['link'] ) ) {
					$href = htmlentities( $data['link'], ENT_QUOTES, 'UTF-8' );
				} else {
					$href = str_replace( '%3A', ':', urlencode( $data['link'] ) );
					$href = str_replace( '$1', $href, $wgArticlePath );
				}
			} else {
				$href = null;
			}

			$access = isset( $data['access'] ) ? preg_match( '/^([0-9a-z]{1})$/i', $data['access'] ) ? $data['access'] : '' : null;

			$classes = isset( $data['class'] ) ? array_map( 'trim', explode( ',', htmlentities( $data['class'], ENT_QUOTES, 'UTF-8' ) ) ) : [];protected function parseNavbar() {
		global $wgArticlePath;

		$headings = [];
		$currentHeading = null;
		$skin = $this->getSkin();
		$userName = $skin->getUser()->getName();
		$userLang = $skin->getLanguage()->mCode;
		$globalData = ContentHandler::getContentText( WikiPage::factory(
			Title::newFromText( 'Liberty-Navbar', NS_MEDIAWIKI )
		)->getContent( RevisionRecord::RAW ) );
		$globalLangData = ContentHandler::getContentText( WikiPage::factory(
			Title::newFromText( 'Liberty-Navbar/' . $userLang, NS_MEDIAWIKI )
		)->getContent( RevisionRecord::RAW ) );
		$userData = ContentHandler::getContentText( WikiPage::factory(
			Title::newFromText( $userName . '/Liberty-Navbar', NS_USER )
		)->getContent( RevisionRecord::RAW ) );
		if ( !empty( $userData ) ) {
			$data = $userData;
		} elseif ( !empty( $globalLangData ) ) {
			$data = $globalLangData;
		} else {
			$data = $globalData;
		}
		// Well, [[MediaWiki:Liberty-Navbar]] *should* have some content, but
		// if it doesn't, bail out here so that we don't trigger E_NOTICEs
		// about undefined indexes later on
		if ( empty( $data ) ) {
			return $headings;
		}

		$lines = explode( "\n", $data );

		$types = [ 'icon', 'display', 'title', 'link', 'access', 'class' ];

		foreach ( $lines as $line ) {
			$line = rtrim( $line, "\r" );
			if ( $line[0] !== '*' ) {
				// Line does not start with '*'
				continue;
			}
			if ( $line[1] !== '*' ) {
				// First level menu
				$data = [];
				$split = explode( '|', $line );
				$split[0] = substr( $split[0], 1 );
				foreach ( $split as $key => $value ) {
					$valueArr = explode( '=', trim( $value ) );
					if ( isset( $valueArr[1] ) ) {
						$data[$valueArr[0]] = $valueArr[1];
					} else {
						$data[$types[$key]] = trim( $value );
					}
				}

				// Icon
				$icon = isset( $data['icon'] ) ? htmlentities( $data['icon'], ENT_QUOTES, 'UTF-8' ) : null;

				// Group
				$group = isset( $data['group'] ) ? htmlentities( $data['group'], ENT_QUOTES, 'UTF-8' ) : null;

				// Right
				$right = isset( $data['right'] ) ? htmlentities( $data['right'], ENT_QUOTES, 'UTF-8' ) : null;

				// support the usual [[MediaWiki:Sidebar]] syntax of
				// ** link target|<some MW: message name> and if the
				// thing on the right side of the pipe isn't the name of a MW:
				// message, then and _only_ then render it as-is
				if ( isset( $data['display'] ) ) {
					$textObj = $skin->msg( $data['display'] );
					if ( $textObj->isDisabled() ) {
						$text = htmlentities( $data['display'], ENT_QUOTES, 'UTF-8' );
					} else {
						$text = $textObj->text();
					}
				} else {
					$text = '';
				}

				// If icon and text both empty
				if ( empty( $icon ) && empty( $text ) ) {
					continue;
				}

				// Title
				if ( isset( $data['title'] ) ) {
					$titleObj = $skin->msg( $data['title'] );
					if ( $titleObj->isDisabled() ) {
						$title = htmlentities( $data['title'], ENT_QUOTES, 'UTF-8' );
					} else {
						$title = $titleObj->text();
					}
				} else {
					$title = $text;
				}

				// Link href
				if ( isset( $data['link'] ) ) {
					// @todo CHECKME: Should this use wfUrlProtocols() or somesuch instead?
					if ( preg_match( '/^((?:(?:http(?:s)?)?:)?\/\/(?:.{4,}))$/i', $data['link'] ) ) {
						$href = htmlentities( $data['link'], ENT_QUOTES, 'UTF-8' );
					} else {
						$href = str_replace( '%3A', ':', urlencode( $data['link'] ) );
						$href = str_replace( '$1', $href, $wgArticlePath );
					}
				} else {
					$href = null;
				}

				if ( isset( $data['access'] ) ) {
					// Access
					$access = preg_match( '/^([0-9a-z]{1})$/i', $data['access'] ) ? $data['access'] : '';
				} else {
					$access = null;
				}

				if ( isset( $data['class'] ) ) {
					// Classes
					$classes = explode( ',', htmlentities( $data['class'], ENT_QUOTES, 'UTF-8' ) );
					foreach ( $classes as $key => $value ) {
						$classes[$key] = trim( $value );
					}
				} else {
					$classes = [];
				}

				$item = [
					'access' => $access,
					'classes' => $classes,
					'href' => $href,
					'icon' => $icon,
					'text' => $text,
					'title' => $title,
					'group' => $group,
					'right' => $right
				];
				$level2Children = &$item['children'];
				$headings[] = $item;
				continue;
			}
			if ( $line[2] !== '*' ) {
				// Second level menu
				$data = [];
				$split = explode( '|', $line );
				$split[0] = substr( $split[0], 2 );
				foreach ( $split as $key => $value ) {
					$valueArr = explode( '=', trim( $value ) );
					if ( isset( $valueArr[1] ) ) {
						$data[$valueArr[0]] = $valueArr[1];
					} else {
						$data[$types[$key]] = trim( $value );
					}
				}

				// Icon
				$icon = isset( $data['icon'] ) ? htmlentities( $data['icon'], ENT_QUOTES, 'UTF-8' ) : null;

				// Group
				$group = isset( $data['group'] ) ? htmlentities( $data['group'], ENT_QUOTES, 'UTF-8' ) : null;

				// Right
				$right = isset( $data['right'] ) ? htmlentities( $data['right'], ENT_QUOTES, 'UTF-8' ) : null;

				// support the usual [[MediaWiki:Sidebar]] syntax of
				// ** link target|<some MW: message name> and if the
				// thing on the right side of the pipe isn't the name of a MW:
				// message, then and _only_ then render it as-is
				if ( isset( $data['display'] ) ) {
					$textObj = $skin->msg( $data['display'] );
					if ( $textObj->isDisabled() ) {
						$text = htmlentities( $data['display'], ENT_QUOTES, 'UTF-8' );
					} else {
						$text = $textObj->text();
					}
				} else {
					$text = '';
				}

				// If icon and text both empty
				if ( empty( $icon ) && empty( $text ) ) {
					continue;
				}

				// Title
				if ( isset( $data['title'] ) ) {
					$titleObj = $skin->msg( $data['title'] );
					if ( $titleObj->isDisabled() ) {
						$title = htmlentities( $data['title'], ENT_QUOTES, 'UTF-8' );
					} else {
						$title = $titleObj->text();
					}
				} else {
					$title = $text;
				}

				if ( isset( $data['link'] ) ) {
					// Link href
					// @todo CHECKME: Should this use wfUrlProtocols() or somesuch instead?
					if ( preg_match( '/^((?:(?:http(?:s)?)?:)?\/\/(?:.{4,}))$/i', $data['link'] ) ) {
						$href = htmlentities( $data['link'], ENT_QUOTES, 'UTF-8' );
					} else {
						$href = str_replace( '%3A', ':', urlencode( $data['link'] ) );
						$href = str_replace( '$1', $href, $wgArticlePath );
					}
				}

				if ( isset( $data['access'] ) ) {
					// Access
					$access = preg_match( '/^([0-9a-z]{1})$/i', $data['access'] ) ? $data['access'] : '';
				} else {
					$access = null;
				}

				if ( isset( $data['class'] ) ) {
					// Classes
					$classes = explode( ',', htmlentities( $data['class'], ENT_QUOTES, 'UTF-8' ) );
					foreach ( $classes as $key => $value ) {
						$classes[$key] = trim( $value );
					}
				} else {
					$classes = [];
				}

				$item = [
					'access' => $access,
					'classes' => $classes,
					'href' => $href,
					'icon' => $icon,
					'text' => $text,
					'title' => $title,
					'group' => $group,
					'right' => $right
				];
				$level3Children = &$item['children'];
				$level2Children[] = $item;
				continue;
			}
			if ( $line[3] !== '*' ) {
				// Third level menu
				$data = [];
				$split = explode( '|', $line );
				$split[0] = substr( $split[0], 3 );
				foreach ( $split as $key => $value ) {
					$valueArr = explode( '=', trim( $value ) );
					if ( isset( $valueArr[1] ) ) {
						$data[$valueArr[0]] = $valueArr[1];
					} else {
						$data[$types[$key]] = trim( $value );
					}
				}

				// Icon
				$icon = isset( $data['icon'] ) ? htmlentities( $data['icon'], ENT_QUOTES, 'UTF-8' ) : null;

				// Group
				$group = isset( $data['group'] ) ? htmlentities( $data['group'], ENT_QUOTES, 'UTF-8' ) : null;

				// Right
				$right = isset( $data['right'] ) ? htmlentities( $data['right'], ENT_QUOTES, 'UTF-8' ) : null;

				// support the usual [[MediaWiki:Sidebar]] syntax of
				// ** link target|<some MW: message name> and if the
				// thing on the right side of the pipe isn't the name of a MW:
				// message, then and _only_ then render it as-is
				if ( isset( $data['display'] ) ) {
					$textObj = $skin->msg( $data['display'] );
					if ( $textObj->isDisabled() ) {
						$text = htmlentities( $data['display'], ENT_QUOTES, 'UTF-8' );
					} else {
						$text = $textObj->text();
					}
				} else {
					$text = '';
				}

				// If icon and text both empty
				if ( empty( $icon ) && empty( $text ) ) {
					continue;
				}

				// Title
				if ( isset( $data['title'] ) ) {
					$titleObj = $skin->msg( $data['title'] );
					if ( $titleObj->isDisabled() ) {
						$title = htmlentities( $data['title'], ENT_QUOTES, 'UTF-8' );
					} else {
						$title = $titleObj->text();
					}
				} else {
					$title = $text;
				}

				// Link href
				// @todo CHECKME: Should this use wfUrlProtocols() or somesuch instead?
				if ( preg_match( '/^((?:(?:http(?:s)?)?:)?\/\/(?:.{4,}))$/i', $data['link'] ) ) {
					$href = htmlentities( $data['link'], ENT_QUOTES, 'UTF-8' );
				} else {
					$href = str_replace( '%3A', ':', urlencode( $data['link'] ) );
					$href = str_replace( '$1', $href, $wgArticlePath );
				}

				// Access
				if ( isset( $data['access'] ) ) {
					$access = preg_match( '/^([0-9a-z]{1})$/i', $data['access'] ) ? $data['access'] : '';
				} else {
					$access = null;
				}

				if ( isset( $data['class'] ) ) {
					// Classes
					$classes = explode( ',', htmlentities( $data['class'], ENT_QUOTES, 'UTF-8' ) );
					foreach ( $classes as $key => $value ) {
						$classes[$key] = trim( $value );
					}
				} else {
					$classes = [];
				}

				$item = [
					'access' => $access,
					'classes' => $classes,
					'href' => $href,
					'icon' => $icon,
					'text' => $text,
					'title' => $title,
					'group' => $group,
					'right' => $right
				];
				$level3Children[] = $item;
				continue;
			} else {
				// Not supported
				continue;
			}
		}

		return $headings;
	}

다만 a15075a 커밋 이후의 몇개의 수정사항이 반영되어 있지 않을 수 있어서 이 부분은 확인해 주시면 감사하겠습니다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.