File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ public static function init() {
117117 // Add the setting field for this size.
118118 add_settings_field (
119119 'image_size_ ' . $ s ,
120- sprintf ( __ ( '%s size ' , 'simple-image-sizes ' ), $ s ),
120+ sprintf ( __ ( '%s size ' , 'simple-image-sizes ' ), esc_html ( $ s ) ),
121121 [
122122 __CLASS__ ,
123123 'image_sizes ' ,
@@ -316,15 +316,15 @@ public static function a_add_size() {
316316 $ croppings [ false ] = '' ;
317317
318318 // Check entries
319- $ name = isset ( $ _POST ['name ' ] ) ? sanitize_title ( $ _POST ['name ' ] ) : '' ;
319+ $ name = isset ( $ _POST ['name ' ] ) ? sanitize_text_field ( sanitize_title ( $ _POST ['name ' ] ) ) : '' ;
320320 $ height = ! isset ( $ _POST ['height ' ] ) ? 0 : absint ( $ _POST ['height ' ] );
321321 $ width = ! isset ( $ _POST ['width ' ] ) ? 0 : absint ( $ _POST ['width ' ] );
322- $ crop = isset ( $ _POST ['crop ' ] ) && isset ( $ croppings [ $ _POST ['crop ' ] ] ) ? $ _POST ['crop ' ] : false ;
323- $ show = isset ( $ _POST ['show ' ] ) && $ _POST ['show ' ] == 'false ' ? false : true ;
322+ $ crop = isset ( $ _POST ['crop ' ] ) && isset ( $ croppings [ $ _POST ['crop ' ] ] ) ? ( bool ) $ _POST ['crop ' ] : false ;
323+ $ show = ! ( isset ( $ _POST ['show ' ] ) && $ _POST ['show ' ] == 'false ' ) ;
324324 $ cn = isset ( $ _POST ['customName ' ] ) && ! empty ( $ _POST ['customName ' ] ) ? sanitize_text_field ( $ _POST ['customName ' ] ) : $ name ;
325325
326326 // Check the nonce
327- if ( ! wp_verify_nonce ( $ nonce , 'add_size ' ) ) {
327+ if ( ! wp_verify_nonce ( $ nonce , 'add_size ' ) || ! current_user_can ( ' manage_options ' ) ) {
328328 die ( 0 );
329329 }
330330
You can’t perform that action at this time.
0 commit comments