| @@ -50,29 +50,10 @@ | ||
| 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 | - } | |
| 59 | 54 | } |
| 60 | 55 | |
| 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 | - | |
| 75 | 56 | public function localize_settings( $settings ) { |
| 76 | 57 | if ( isset( $settings['i18n'] ) ) { |
| 77 | 58 | $settings['i18n']['folder'] = esc_html__( 'Folder', 'elementor' ); |
| 78 | 59 | } |
| @@ -176,33 +157,6 @@ | ||
| 176 | 157 | |
| 177 | 158 | $content = $doc->get_content( true ); |
| 178 | 159 | |
| 179 | 160 | 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; | |
| 207 | 161 | } |
| 208 | 162 | } |