PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.8
Elementor Website Builder – more than just a page builder v4.0.8
4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 All 455 releases
← All changes | modules/atomic-widgets/props-resolver/transformers/svg-src-transformer.php +9 -23 4.3.0 → 4.0.8 View file →
@@ -48,39 +48,25 @@
48 48 if ( ! $url ) {
49 49 return null;
50 50 }
51 51
52 - $local_content = $this->fetch_local_svg_content( $url );
52 + $local_path = $this->resolve_local_path( $url );
53 53
54 - return $local_content ? $local_content : $this->fetch_remote_svg_content( $url );
55 - }
54 + if ( $local_path ) {
55 + $content = Utils::file_get_contents( $local_path );
56 56
57 - private function fetch_local_svg_content( string $url ): ?string {
58 - $local_path = $this->resolve_local_path( $url );
59 -
60 - if ( ! $local_path ) {
61 - return null;
57 + if ( $content ) {
58 + return $content;
59 + }
62 60 }
63 61
64 - $content = Utils::file_get_contents( $local_path );
65 -
66 - return $content ? $content : null;
67 - }
68 -
69 - private function fetch_remote_svg_content( string $url ): ?string {
70 62 $response = wp_safe_remote_get( $url );
71 63
72 - if ( is_wp_error( $response ) ) {
73 - return null;
64 + if ( ! is_wp_error( $response ) ) {
65 + return $response['body'];
74 66 }
75 67
76 - if ( \WP_Http::OK !== (int) wp_remote_retrieve_response_code( $response ) ) {
77 - return null;
78 - }
79 -
80 - $body = wp_remote_retrieve_body( $response );
81 -
82 - return $body ? $body : null;
68 + return null;
83 69 }
84 70
85 71 private function resolve_local_path( string $url ): ?string {
86 72 $site_url = site_url();