Skip to content

Commit

Permalink
WP VIP standards escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul de Wouters committed Oct 29, 2015
1 parent d836697 commit 95ef4a8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions inc/class-mexp-resource-space-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions inc/class-resource-space-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' )
Expand Down
12 changes: 6 additions & 6 deletions inc/class-resource-space-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/';
Expand All @@ -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.
Expand Down Expand Up @@ -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' ) );
}

}
Expand Down
6 changes: 3 additions & 3 deletions resourcespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down Expand Up @@ -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' ),
) );

}
Expand Down

0 comments on commit 95ef4a8

Please sign in to comment.