HEX
Server: LiteSpeed
System: Linux premium235.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User: beaupptk (733)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //proc/thread-self/cwd/wp-content/plugins/elementor/modules/editor-one/classes/slug-normalizer.php
<?php

namespace Elementor\Modules\EditorOne\Classes;

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

class Slug_Normalizer {

	public function normalize( string $slug ): string {
		if ( 0 !== strpos( $slug, 'http' ) ) {
			return $slug;
		}

		$parsed = wp_parse_url( $slug );
		$path = basename( $parsed['path'] ?? '' );

		if ( ! empty( $parsed['query'] ) ) {
			$path .= '?' . $parsed['query'];
		}

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

		return $path;
	}

	public function is_excluded( string $item_slug, array $excluded_slugs ): bool {
		if ( in_array( $item_slug, $excluded_slugs, true ) ) {
			return true;
		}

		$normalized_slug = $this->normalize( $item_slug );

		return in_array( $normalized_slug, $excluded_slugs, true );
	}
}