monobookcbt.php

来自「php 开发的内容管理系统」· PHP 代码 · 共 1,391 行 · 第 1/3 页

PHP
1,391
字号
	}		function bodytext() {		return cbt_value( $this->mOut->getHTML(), 'dynamic' );	}		function catlinks() {		if ( !isset( $this->mCatlinks ) ) {			$this->mCatlinks = $this->getCategories();		}		return cbt_value( $this->mCatlinks, 'dynamic' );	}		function extratabs( $itemTemplate ) {		global $wgContLang, $wgDisableLangConversion;				$etpl = cbt_escape( $itemTemplate );		/* show links to different language variants */		$variants = $wgContLang->getVariants();		$s = '';		if ( !$wgDisableLangConversion && count( $wgContLang->getVariants() ) > 1 ) {			$vcount=0;			foreach ( $variants as $code ) {				$name = $wgContLang->getVariantname( $code );				if ( $name == 'disable' ) {					continue;				}				$code = cbt_escape( $code );				$name = cbt_escape( $name );				$s .= "{ca_variant {{$code}} {{$name}} {{$vcount}} {{$etpl}}}\n";				$vcount ++;			}		}		return cbt_value( $s, array(), true );	}	function is_special() { return cbt_value( $this->mTitle->getNamespace() == NS_SPECIAL, 'title' ); }	function can_edit() { return cbt_value( (string)($this->mTitle->userCanEdit()), 'dynamic' ); }	function can_move() { return cbt_value( (string)($this->mTitle->userCanMove()), 'dynamic' ); }	function is_talk() { return cbt_value( (string)($this->mTitle->isTalkPage()), 'title' ); }	function is_protected() { return cbt_value( (string)$this->mTitle->isProtected(), 'dynamic' ); }	function nskey() { return cbt_value( $this->mTitle->getNamespaceKey(), 'title' ); }	function request_url() {		global $wgRequest;		return cbt_value( $wgRequest->getRequestURL(), 'dynamic' );	}	function subject_url() { 		$title = $this->getSubjectPage();		if ( $title->exists() ) {			$url = $title->getLocalUrl();		} else {			$url = $title->getLocalUrl( 'action=edit' );		}		return cbt_value( $url, 'title' ); 	}	function talk_url() {		$title = $this->getTalkPage();		if ( $title->exists() ) {			$url = $title->getLocalUrl();		} else {			$url = $title->getLocalUrl( 'action=edit' );		}		return cbt_value( $url, 'title' );	}	function edit_url() {		return cbt_value( $this->getEditUrl(), array( 'title', 'nonview dynamic' ) );	}	function move_url() {		return cbt_value( $this->makeSpecialParamUrl( 'Movepage' ), array(), true );	}	function localurl( $query ) {		return cbt_value( $this->mTitle->getLocalURL( $query ), 'title' );	}	function selecttab( $tab, $extraclass = '' ) {		if ( !isset( $this->mSelectedTab ) ) {			$prevent_active_tabs = false ;			wfRunHooks( 'SkinTemplatePreventOtherActiveTabs', array( &$this , &$preventActiveTabs ) );			$actionTabs = array(				'edit' => 'edit',				'submit' => 'edit',				'history' => 'history',				'protect' => 'protect',				'unprotect' => 'protect',				'delete' => 'delete',				'watch' => 'watch',				'unwatch' => 'watch',			);			if ( $preventActiveTabs ) {				$this->mSelectedTab = false;			} else {				$action = $this->getAction();				$section = $this->getSection();								if ( isset( $actionTabs[$action] ) ) {					$this->mSelectedTab = $actionTabs[$action];					if ( $this->mSelectedTab == 'edit' && $section == 'new' ) {						$this->mSelectedTab = 'addsection';					}				} elseif ( $this->mTitle->isTalkPage() ) {					$this->mSelectedTab = 'talk';				} else {					$this->mSelectedTab = 'subject';				}			}		}		if ( $extraclass ) {			if ( $this->mSelectedTab == $tab ) {				$s = 'class="selected ' . htmlspecialchars( $extraclass ) . '"';			} else {				$s = 'class="' . htmlspecialchars( $extraclass ) . '"';			}					} else {			if ( $this->mSelectedTab == $tab ) {				$s = 'class="selected"';			} else {				$s = '';			}		}		return cbt_value( $s, array( 'nonview dynamic', 'title' ) );	}	function subject_newclass() {		$title = $this->getSubjectPage();		$class = $title->exists() ? '' : 'new';		return cbt_value( $class, 'dynamic' );	}	function talk_newclass() {		$title = $this->getTalkPage();		$class = $title->exists() ? '' : 'new';		return cbt_value( $class, 'dynamic' );	}		function ca_variant( $code, $name, $index, $template ) {		global $wgContLang;		$selected = ($code == $wgContLang->getPreferredVariant());		$action = $this->getAction();		$actstr = '';		if( $action )			$actstr = 'action=' . $action . '&';		$s = strtr( $template, array( 			'$id' => htmlspecialchars( 'varlang-' . $index ),			'$class' => $selected ? 'class="selected"' : '',			'$text' => $name,			'$href' => htmlspecialchars( $this->mTitle->getLocalUrl( $actstr . 'variant=' . $code ) )		));		return cbt_value( $s, 'dynamic' );	}	function is_watching() {		return cbt_value( (string)$this->mTitle->userIsWatching(), array( 'dynamic' ) );	}		function personal_urls( $itemTemplate ) {		global $wgShowIPinHeader, $wgContLang;		# Split this function up into many small functions, to obtain the		# best specificity in the dependencies of each one. The template below 		# has no dependencies, so its generation, and any static subfunctions,		# can be optimised away.		$etpl = cbt_escape( $itemTemplate );		$s = "			{userpage {{$etpl}}}			{mytalk {{$etpl}}}			{preferences {{$etpl}}}			{watchlist {{$etpl}}}			{mycontris {{$etpl}}}			{logout {{$etpl}}}		";		if ( $wgShowIPinHeader ) {			$s .= "				{anonuserpage {{$etpl}}}				{anontalk {{$etpl}}}				{anonlogin {{$etpl}}}			";		} else {			$s .= "{login {{$etpl}}}\n";		}		// No dependencies		return cbt_value( $s, array(), true /*this is a template*/ );	}	function userpage( $itemTemplate ) {		global $wgUser;		if ( $this->isLoggedIn() ) {			$userPage = $this->getUserPageTitle();			$s = $this->makeTemplateLink( $itemTemplate, 'userpage', $userPage, $wgUser->getName() );		} else {			$s = '';		}		return cbt_value( $s, 'user' );	}		function mytalk( $itemTemplate ) {		global $wgUser;		if ( $this->isLoggedIn() ) {			$userPage = $this->getUserPageTitle();			$talkPage = $userPage->getTalkPage();			$s = $this->makeTemplateLink( $itemTemplate, 'mytalk', $talkPage, wfMsg('mytalk') );		} else {			$s = '';		}		return cbt_value( $s, 'user' );	}		function preferences( $itemTemplate ) {		if ( $this->isLoggedIn() ) {			$s = $this->makeSpecialTemplateLink( $itemTemplate, 'preferences', 				'Preferences', wfMsg( 'preferences' ) );		} else {			$s = '';		}		return cbt_value( $s, array( 'loggedin', 'lang' ) );	}		function watchlist( $itemTemplate ) {		if ( $this->isLoggedIn() ) {			$s = $this->makeSpecialTemplateLink( $itemTemplate, 'watchlist', 				'Watchlist', wfMsg( 'watchlist' ) );		} else {			$s = '';		}		return cbt_value( $s, array( 'loggedin', 'lang' ) );	}		function mycontris( $itemTemplate ) {		if ( $this->isLoggedIn() ) {			global $wgUser;			$s = $this->makeSpecialTemplateLink( $itemTemplate, 'mycontris', 				"Contributions/" . $wgUser->getTitleKey(), wfMsg('mycontris') );		} else {			$s = '';		}		return cbt_value( $s, 'user' );	}		function logout( $itemTemplate ) {		if ( $this->isLoggedIn() ) {			$s = $this->makeSpecialTemplateLink( $itemTemplate, 'logout', 				'Userlogout', wfMsg( 'userlogout' ), 					$this->mTitle->getNamespace() === NS_SPECIAL && $this->mTitle->getText() === 'Preferences' 					? '' : "returnto=" . $this->mTitle->getPrefixedURL() );		} else {			$s = '';		}		return cbt_value( $s, 'loggedin dynamic' );	}		function anonuserpage( $itemTemplate ) {		if ( $this->isLoggedIn() ) {			$s = '';		} else {			global $wgUser;			$userPage = $this->getUserPageTitle();			$s = $this->makeTemplateLink( $itemTemplate, 'userpage', $userPage, $wgUser->getName() );		}		return cbt_value( $s, '!loggedin dynamic' );	}		function anontalk( $itemTemplate ) {		if ( $this->isLoggedIn() ) {			$s = '';		} else {			$userPage = $this->getUserPageTitle();			$talkPage = $userPage->getTalkPage();			$s = $this->makeTemplateLink( $itemTemplate, 'mytalk', $talkPage, wfMsg('anontalk') );		}		return cbt_value( $s, '!loggedin dynamic' );	}		function anonlogin( $itemTemplate ) {		if ( $this->isLoggedIn() ) {			$s = '';		} else {			$s = $this->makeSpecialTemplateLink( $itemTemplate, 'anonlogin', 'Userlogin', 				wfMsg( 'userlogin' ), 'returnto=' . urlencode( $this->getThisPDBK() ) );		}		return cbt_value( $s, '!loggedin dynamic' );	}		function login( $itemTemplate ) {		if ( $this->isLoggedIn() ) {			$s = '';		} else {			$s = $this->makeSpecialTemplateLink( $itemTemplate, 'login', 'Userlogin', 				wfMsg( 'userlogin' ), 'returnto=' . urlencode( $this->getThisPDBK() ) );		}		return cbt_value( $s, '!loggedin dynamic' );	}		function logopath() { return $GLOBALS['wgLogo']; }	function mainpage() { return $this->makeI18nUrl( 'mainpage' ); }		function sidebar( $startSection, $endSection, $innerTpl ) {		$s = '';		$lines = explode( "\n", wfMsgForContent( 'sidebar' ) );		$firstSection = true;		foreach ($lines as $line) {			if (strpos($line, '*') !== 0)				continue;			if (strpos($line, '**') !== 0) {				$bar = trim($line, '* ');				$name = wfMsg( $bar ); 				if (wfEmptyMsg($bar, $name)) {					$name = $bar;				}				if ( $firstSection ) {					$firstSection = false;				} else {					$s .= $endSection;				}				$s .= strtr( $startSection,					array( 						'$bar' => htmlspecialchars( $bar ),						'$barname' => $name					) );			} else {				if (strpos($line, '|') !== false) { // sanity check					$line = explode( '|' , trim($line, '* '), 2 );					$link = wfMsgForContent( $line[0] );					if ($link == '-')						continue;					if (wfEmptyMsg($line[1], $text = wfMsg($line[1])))						$text = $line[1];					if (wfEmptyMsg($line[0], $link))						$link = $line[0];					$href = $this->makeInternalOrExternalUrl( $link );										$s .= strtr( $innerTpl,						array(							'$text' => htmlspecialchars( $text ),							'$href' => htmlspecialchars( $href ),							'$id' => htmlspecialchars( 'n-' . strtr($line[1], ' ', '-') ),							'$classactive' => ''						) );				} else { continue; }			}		}		if ( !$firstSection ) {			$s .= $endSection;		}		// Depends on user language only		return cbt_value( $s, 'lang' );	}		function searchaction() {		// Static link		return $this->getSearchLink();	}		function search() {		global $wgRequest;		return cbt_value( trim( $this->getSearch() ), 'special dynamic' );	}		function notspecialpage() {		return cbt_value( $this->mTitle->getNamespace() != NS_SPECIAL, 'special' );	}		function nav_whatlinkshere() {		return cbt_value( $this->makeSpecialParamUrl('Whatlinkshere' ), array(), true );	}	function article_exists() {		return cbt_value( (string)($this->mTitle->getArticleId() !== 0), 'title' );	}		function nav_recentchangeslinked() {		return cbt_value( $this->makeSpecialParamUrl('Recentchangeslinked' ), array(), true );	}		function feeds( $itemTemplate = '' ) {		if ( !$this->mOut->isSyndicated() ) {			$feeds = '';		} elseif ( $itemTemplate == '' ) {			// boolean only required			$feeds = 'true';		} else {			$feeds = '';			global $wgFeedClasses, $wgRequest;			foreach( $wgFeedClasses as $format => $class ) {				$feeds .= strtr( $itemTemplate,					array( 						'$key' => htmlspecialchars( $format ),						'$text' => $format,						'$href' => $wgRequest->appendQuery( "feed=$format" )					) );			}		}		return cbt_value( $feeds, 'special dynamic' );	}	function is_userpage() {		list( $id, $ip ) = $this->getUserPageIdIp();		return cbt_value( (string)($id || $ip), 'title' );	}	function is_ns_mediawiki() {		return cbt_value( (string)$this->mTitle->getNamespace() == NS_MEDIAWIKI, 'title' );	}	function is_loggedin() {		global $wgUser;		return cbt_value( (string)($wgUser->isLoggedIn()), 'loggedin' );	}	function nav_contributions() {		$url = $this->makeSpecialParamUrl( 'Contributions', '', '{title_userurl}' );		return cbt_value( $url, array(), true );	}	function is_allowed( $right ) {		global $wgUser;		return cbt_value( (string)$wgUser->isAllowed( $right ), 'user' );	}		function nav_blockip() {		$url = $this->makeSpecialParamUrl( 'Blockip', '', '{title_userurl}' );		return cbt_value( $url, array(), true );	}		function nav_emailuser() {		global $wgEnableEmail, $wgEnableUserEmail, $wgUser;		if ( !$wgEnableEmail || !$wgEnableUserEmail ) return '';				$url = $this->makeSpecialParamUrl( 'Emailuser', '', '{title_userurl}' );		return cbt_value( $url, array(), true );	}		function nav_upload() {		global $wgEnableUploads, $wgUploadNavigationUrl;		if ( !$wgEnableUploads ) { 			return '';		} elseif ( $wgUploadNavigationUrl ) {			return $wgUploadNavigationUrl;		} else {			return $this->makeSpecialUrl('Upload');		}	}		function nav_specialpages() {		return $this->makeSpecialUrl('Specialpages');	}		function nav_print() {		global $wgRequest, $wgArticle;		$action = $this->getAction();		$url = '';		if( $this->mTitle->getNamespace() !== NS_SPECIAL 				&& ($action == '' || $action == 'view' || $action == 'purge' ) ) 		{

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?