@@ -2030,6 +2030,10 @@ function cptui_update_post_type( $data = [] ) {
20302030 $ data ['cpt_supports ' ] = [];
20312031 }
20322032
2033+ if ( empty ( $ data ['cpt_labels ' ] ) || ! is_array ( $ data ['cpt_labels ' ] ) ) {
2034+ $ data ['cpt_labels ' ] = [];
2035+ }
2036+
20332037 foreach ( $ data ['cpt_labels ' ] as $ key => $ label ) {
20342038 if ( empty ( $ label ) ) {
20352039 unset( $ data ['cpt_labels ' ][ $ key ] );
@@ -2045,8 +2049,9 @@ function cptui_update_post_type( $data = [] ) {
20452049 }
20462050 }
20472051
2048- if ( empty ( $ data ['cpt_custom_post_type ' ]['menu_icon ' ] ) ) {
2049- $ data ['cpt_custom_post_type ' ]['menu_icon ' ] = null ;
2052+ $ menu_icon = trim ( $ data ['cpt_custom_post_type ' ]['menu_icon ' ] );
2053+ if ( '' === $ data ['cpt_custom_post_type ' ]['menu_icon ' ] ) {
2054+ $ menu_icon = null ;
20502055 }
20512056
20522057 $ register_meta_box_cb = trim ( $ data ['cpt_custom_post_type ' ]['register_meta_box_cb ' ] );
@@ -2081,7 +2086,6 @@ function cptui_update_post_type( $data = [] ) {
20812086 $ query_var_slug = trim ( $ data ['cpt_custom_post_type ' ]['query_var_slug ' ] );
20822087 $ menu_position = trim ( $ data ['cpt_custom_post_type ' ]['menu_position ' ] );
20832088 $ show_in_menu_string = trim ( $ data ['cpt_custom_post_type ' ]['show_in_menu_string ' ] );
2084- $ menu_icon = trim ( $ data ['cpt_custom_post_type ' ]['menu_icon ' ] );
20852089 $ custom_supports = trim ( $ data ['cpt_custom_post_type ' ]['custom_supports ' ] );
20862090 $ enter_title_here = trim ( $ data ['cpt_custom_post_type ' ]['enter_title_here ' ] );
20872091
@@ -2347,7 +2351,7 @@ function cptui_process_post_type() {
23472351 } elseif ( isset ( $ _POST ['cpt_delete ' ] ) ) {
23482352 check_admin_referer ( 'cptui_addedit_post_type_nonce_action ' , 'cptui_addedit_post_type_nonce_field ' );
23492353
2350- $ filtered_data = filter_input ( INPUT_POST , 'cpt_custom_post_type ' , FILTER_SANITIZE_STRING , FILTER_REQUIRE_ARRAY );
2354+ $ filtered_data = filter_input ( INPUT_POST , 'cpt_custom_post_type ' , FILTER_SANITIZE_FULL_SPECIAL_CHARS , FILTER_REQUIRE_ARRAY );
23512355 $ result = cptui_delete_post_type ( $ filtered_data );
23522356 add_filter ( 'cptui_post_type_deleted ' , '__return_true ' );
23532357 }
@@ -2390,8 +2394,8 @@ function cptui_do_convert_post_type_posts() {
23902394 if ( apply_filters ( 'cptui_convert_post_type_posts ' , false ) ) {
23912395 check_admin_referer ( 'cptui_addedit_post_type_nonce_action ' , 'cptui_addedit_post_type_nonce_field ' );
23922396
2393- $ original = filter_input ( INPUT_POST , 'cpt_original ' , FILTER_SANITIZE_STRING );
2394- $ new = filter_input ( INPUT_POST , 'cpt_custom_post_type ' , FILTER_SANITIZE_STRING , FILTER_REQUIRE_ARRAY );
2397+ $ original = filter_input ( INPUT_POST , 'cpt_original ' , FILTER_SANITIZE_FULL_SPECIAL_CHARS );
2398+ $ new = filter_input ( INPUT_POST , 'cpt_custom_post_type ' , FILTER_SANITIZE_FULL_SPECIAL_CHARS , FILTER_REQUIRE_ARRAY );
23952399
23962400 // Return early if either fails to successfully validate.
23972401 if ( ! $ original || ! $ new ) {
@@ -2451,7 +2455,7 @@ function cptui_filtered_post_type_post_global() {
24512455
24522456 $ items_arrays = array_merge ( $ default_arrays , $ third_party_items_arrays );
24532457 foreach ( $ items_arrays as $ item ) {
2454- $ first_result = filter_input ( INPUT_POST , $ item , FILTER_SANITIZE_STRING , FILTER_REQUIRE_ARRAY );
2458+ $ first_result = filter_input ( INPUT_POST , $ item , FILTER_SANITIZE_FULL_SPECIAL_CHARS , FILTER_REQUIRE_ARRAY );
24552459
24562460 if ( $ first_result ) {
24572461 $ filtered_data [ $ item ] = $ first_result ;
@@ -2471,7 +2475,7 @@ function cptui_filtered_post_type_post_global() {
24712475 $ items_string = array_merge ( $ default_strings , $ third_party_items_strings );
24722476
24732477 foreach ( $ items_string as $ item ) {
2474- $ second_result = filter_input ( INPUT_POST , $ item , FILTER_SANITIZE_STRING );
2478+ $ second_result = filter_input ( INPUT_POST , $ item , FILTER_SANITIZE_FULL_SPECIAL_CHARS );
24752479 if ( $ second_result ) {
24762480 $ filtered_data [ $ item ] = $ second_result ;
24772481 }
0 commit comments