diff --git a/includes/apple-exporter/components/class-divider.php b/includes/apple-exporter/components/class-divider.php index 3b5d949f..591724ad 100644 --- a/includes/apple-exporter/components/class-divider.php +++ b/includes/apple-exporter/components/class-divider.php @@ -23,7 +23,7 @@ class Divider extends Component { * @return \DOMElement|null The node on success, or null on no match. */ public static function node_matches( $node ) { - if ( 'hr' === $node->nodeName ) { + if ( 'hr' === $node->nodeName ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase return $node; } diff --git a/includes/apple-push-api/request/class-request.php b/includes/apple-push-api/request/class-request.php index 3ab5cbdb..e633fcbe 100644 --- a/includes/apple-push-api/request/class-request.php +++ b/includes/apple-push-api/request/class-request.php @@ -152,7 +152,7 @@ public function get( $url ) { private function parse_response( $response, $json = true, $type = 'post', $meta = null, $bundles = null, $article = '', $debug_mime_request = '' ) { // Ensure we have an expected response type. if ( ( ! is_array( $response ) || ! isset( $response['body'] ) ) && ! is_wp_error( $response ) ) { - throw new Request_Exception( __( 'Invalid response:', 'apple-news' ) . $response ); + throw new Request_Exception( esc_html( __( 'Invalid response:', 'apple-news' ) . $response ) ); } // If debugging mode is enabled, send an email. @@ -224,7 +224,7 @@ private function parse_response( $response, $json = true, $type = 'post', $meta if ( is_array( $error_messages ) && ! empty( $error_messages ) ) { $string_errors = implode( ', ', $error_messages ); } - throw new Request_Exception( __( 'There has been an error with your request:', 'apple-news' ) . " $string_errors" ); + throw new Request_Exception( esc_html( __( 'There has been an error with your request:', 'apple-news' ) . " $string_errors" ) ); } // Check for errors from the API. @@ -235,8 +235,8 @@ private function parse_response( $response, $json = true, $type = 'post', $meta foreach ( $response_decoded->errors as $error ) { // If there is a keyPath, build it into a string. $key_path = ''; - if ( ! empty( $error->keyPath ) && is_array( $error->keyPath ) ) { - foreach ( $error->keyPath as $i => $path ) { + if ( ! empty( $error->keyPath ) && is_array( $error->keyPath ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase + foreach ( $error->keyPath as $i => $path ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase if ( $i > 0 ) { $key_path .= "->$path"; } else { @@ -271,7 +271,7 @@ private function parse_response( $response, $json = true, $type = 'post', $meta ); } - throw new Request_Exception( $message ); + throw new Request_Exception( esc_html( $message ) ); } // Return the response in the desired format.