From 95ef4a81290c5d1450a580a2341e606c7fcaf709 Mon Sep 17 00:00:00 2001 From: Paul de Wouters Date: Thu, 29 Oct 2015 09:44:13 +0000 Subject: [PATCH] WP VIP standards escaping --- inc/class-mexp-resource-space-service.php | 6 +++--- inc/class-resource-space-admin.php | 4 ++-- inc/class-resource-space-loader.php | 12 ++++++------ resourcespace.php | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/inc/class-mexp-resource-space-service.php b/inc/class-mexp-resource-space-service.php index 353a338..388ea07 100644 --- a/inc/class-mexp-resource-space-service.php +++ b/inc/class-mexp-resource-space-service.php @@ -151,9 +151,9 @@ public function tabs( array $tabs ) { */ public function labels( array $labels ) { $labels['resource-space'] = array( - 'insert' => __( 'Insert Image', 'resourcespace' ), - 'noresults' => __( 'No images matched your search query.', 'resourcespace' ), - 'title' => __( 'Insert Stock Photo', 'resourcespace' ), + 'insert' => esc_html__( 'Insert Image', 'resourcespace' ), + 'noresults' => esc_html__( 'No images matched your search query.', 'resourcespace' ), + 'title' => esc_html__( 'Insert Stock Photo', 'resourcespace' ), ); return $labels; diff --git a/inc/class-resource-space-admin.php b/inc/class-resource-space-admin.php index 54f6336..47e7a76 100644 --- a/inc/class-resource-space-admin.php +++ b/inc/class-resource-space-admin.php @@ -39,8 +39,8 @@ public function setup_actions() { function admin_menu() { add_media_page( - __( 'Stock Photos', 'resourcespace' ), - __( 'Stock Photos', 'resourcespace' ), + esc_html__( 'Stock Photos', 'resourcespace' ), + esc_html__( 'Stock Photos', 'resourcespace' ), 'insert_from_resourcespace', 'resourcespace', array( $this, 'render_page' ) diff --git a/inc/class-resource-space-loader.php b/inc/class-resource-space-loader.php index f53203b..aa2b01a 100644 --- a/inc/class-resource-space-loader.php +++ b/inc/class-resource-space-loader.php @@ -32,7 +32,7 @@ function ajax_get_image() { $parent_post_id = isset( $_POST['post'] ) ? intval( $_POST['post'] ) : 0; if ( empty( $resource_id ) ) { - wp_send_json_error( __( 'Empty resource id', 'resourcespace' ) ); + wp_send_json_error( esc_html__( 'Empty resource id', 'resourcespace' ) ); } $url = PJ_RESOURCE_SPACE_DOMAIN . '/plugins/api_search/'; @@ -58,11 +58,11 @@ function ajax_get_image() { if ( 200 == wp_remote_retrieve_response_code( $response ) ) { $data = json_decode( wp_remote_retrieve_body( $response ) ); } else { - wp_send_json_error( __( 'Unable to query API', 'resourcespace' ) ); + wp_send_json_error( esc_html__( 'Unable to query API', 'resourcespace' ) ); } if ( count( $data ) < 1 ) { - wp_send_json_error( __( 'Resource not found', 'resourcespace' ) ); + wp_send_json_error( esc_html__( 'Resource not found', 'resourcespace' ) ); } // Request original URL. @@ -132,17 +132,17 @@ private function sideload_image( $url ) { } else { unlink( $file ); - return new WP_Error( 'broke', __( 'Could not create attachment', 'resourcespace' ) ); + return new WP_Error( 'broke', esc_html__( 'Could not create attachment', 'resourcespace' ) ); } } else { unlink( $file ); - return new WP_Error( 'broke', __( 'Upload error', 'resourcespace' ) ); + return new WP_Error( 'broke', esc_html__( 'Upload error', 'resourcespace' ) ); } unlink( $file ); } else { - return new WP_Error( 'broke', __( 'Unable to retrieve image', 'resourcespace' ) ); + return new WP_Error( 'broke', esc_html__( 'Unable to retrieve image', 'resourcespace' ) ); } } diff --git a/resourcespace.php b/resourcespace.php index 02e563d..d6c5cff 100644 --- a/resourcespace.php +++ b/resourcespace.php @@ -16,7 +16,7 @@ defined( 'PJ_RESOURCE_SPACE_RESULTS_PER_PAGE' ) or define( 'PJ_RESOURCE_SPACE_RESULTS_PER_PAGE', 10 ); if ( ! class_exists( 'MEXP_Service' ) ) { - wp_die( __( 'Media Explorer plugin must be enabled.', 'resourcespace' ) ); + wp_die( esc_html__( 'Media Explorer plugin must be enabled.', 'resourcespace' ) ); } require_once( __DIR__ . '/inc/class-resource-space-loader.php' ); @@ -54,8 +54,8 @@ function resource_space_vc_script() { wp_enqueue_script( 'resource-space-vc', plugins_url( 'js/resource-space-vc.js', __FILE__ ), array( 'wpb_jscomposer_media_editor_js' ), null, true ); wp_localize_script( 'resource-space-vc', 'resourceSpaceVC', array( - 'stockImagesTabText' => __( 'Stock Images', 'resourcespace' ), - 'stockImagesInsertText' => __( 'Import', 'resourcespace' ), + 'stockImagesTabText' => esc_html__( 'Stock Images', 'resourcespace' ), + 'stockImagesInsertText' => esc_html__( 'Import', 'resourcespace' ), ) ); }