PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.0-dev3
Elementor Website Builder – more than just a page builder v4.0.0-dev3
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 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | modules/cloud-library/module.php +46 -0 4.2.14.0.0-dev3 View file →
@@ -50,10 +50,29 @@
50 50 }
51 51
52 52 return $module_name;
53 53 }, 12);
54 +
55 + if ( $this->is_screenshot_proxy_mode( $_GET ) ) { // phpcs:ignore -- Checking nonce inside the method.
56 + echo $this->get_proxy_data( htmlspecialchars( $_GET['href'] ) ); // phpcs:ignore -- Nonce was checked on the above method
57 + die;
58 + }
54 59 }
55 60
61 + public function get_proxy_data( $url ) {
62 + $response = wp_safe_remote_get( $url );
63 +
64 + if ( is_wp_error( $response ) ) {
65 + return '';
66 + }
67 +
68 + $content_type = wp_remote_retrieve_headers( $response )->offsetGet( 'content-type' );
69 +
70 + header( 'content-type: ' . $content_type );
71 +
72 + return wp_remote_retrieve_body( $response );
73 + }
74 +
56 75 public function localize_settings( $settings ) {
57 76 if ( isset( $settings['i18n'] ) ) {
58 77 $settings['i18n']['folder'] = esc_html__( 'Folder', 'elementor' );
59 78 }
@@ -157,6 +176,33 @@
157 176
158 177 $content = $doc->get_content( true );
159 178
160 179 echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
180 + }
181 +
182 +
183 + protected function is_screenshot_proxy_mode( array $query_params ) {
184 + $is_proxy = isset( $query_params['screenshot_proxy'] );
185 +
186 + if ( $is_proxy ) {
187 + if ( ! wp_verify_nonce( $query_params['nonce'], 'screenshot-proxy' ) ) {
188 + // WP >= 6.2-alpha
189 + if ( class_exists( '\WpOrg\Requests\Exception\Http\Status403' ) ) {
190 + throw new \WpOrg\Requests\Exception\Http\Status403();
191 + } else {
192 + throw new \Requests_Exception_HTTP_403();
193 + }
194 + }
195 +
196 + if ( ! $query_params['href'] ) {
197 + // WP >= 6.2-alpha
198 + if ( class_exists( '\WpOrg\Requests\Exception\Http\Status400' ) ) {
199 + throw new \WpOrg\Requests\Exception\Http\Status400();
200 + } else {
201 + throw new \Requests_Exception_HTTP_400();
202 + }
203 + }
204 + }
205 +
206 + return $is_proxy;
161 207 }
162 208 }