← All changes
|
includes/frontend/dynamic-content/interpreters/request-params.php
+17
-13
2.9.1
→
2.14.0
View file →
| @@ -21,25 +21,29 @@ | ||
| 21 | 21 | $this->default = strval( $this->setting[5] ?? '' ); |
| 22 | 22 | $this->field = empty( $this->field ) ? 'get' : $this->field; |
| 23 | 23 | } |
| 24 | 24 | public function content() : string { |
| 25 | + if ( ! is_admin() ) { | |
| 26 | + switch ( $this->field ) { | |
| 27 | + case 'get': | |
| 28 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 29 | + $this->content = $this->req_param_value( $_GET ); | |
| 30 | + break; | |
| 25 | 31 | |
| 26 | - switch ( $this->field ) { | |
| 27 | - case 'get': | |
| 28 | - $this->content = $this->req_param_value( $_GET ); | |
| 29 | - break; | |
| 32 | + case 'post': | |
| 33 | + // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 34 | + $this->content = $this->req_param_value( $_POST ); | |
| 35 | + break; | |
| 30 | 36 | |
| 31 | - case 'post': | |
| 32 | - $this->content = $this->req_param_value( $_POST ); | |
| 33 | - break; | |
| 37 | + case 'query var': | |
| 38 | + $this->content = get_query_var( $this->param, '' ); | |
| 39 | + break; | |
| 34 | 40 | |
| 35 | - case 'query var': | |
| 36 | - $this->content = get_query_var( $this->param, '' ); | |
| 37 | - break; | |
| 41 | + default: | |
| 42 | + $this->content = ''; | |
| 43 | + } | |
| 44 | + } | |
| 38 | 45 | |
| 39 | - default: | |
| 40 | - $this->content = ''; | |
| 41 | - } | |
| 42 | 46 | return $this->pre . ( $this->content === '' ? $this->default : $this->content ) . $this->post; |
| 43 | 47 | } |
| 44 | 48 | public function req_param_value( array $params ) : string { |
| 45 | 49 | return sanitize_text_field( $params[ $this->param ] ?? '' ); |