Last active
September 10, 2022 08:55
-
-
Save weartstudio/d4365d33c3f3c9da681211fc767027a5 to your computer and use it in GitHub Desktop.
Revisions
-
weartstudio revised this gist
Jun 26, 2019 . No changes.There are no files selected for viewing
-
weartstudio revised this gist
Jun 26, 2019 . 1 changed file with 54 additions and 45 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,49 +1,58 @@ <?php //sanitize adsense box adsense codes function weart_sanitize_adsense( $input ) { esc_js($input); $input = str_replace(array("\r", "\n"), '', $input); return $input; } //sanitize checkbox function weart_sanitize_checkbox( $input ) { return ( ( isset( $input ) && true == $input ) ? true : false ); } //sanitize text function weart_sanitize_text( $input ) { return esc_html( $input ); } //sanitize select function weart_sanitize_select( $input, $setting ) { global $wp_customize; $control = $wp_customize->get_control( $setting->id ); if ( array_key_exists( $input, $control->choices ) ) { return $input; } else { return $setting->default; } } // sanitize number function weart_sanitize_number_absint( $number, $setting ) { // Ensure $number is an absolute integer (whole number, zero or greater). $number = absint( $number ); // If the input is an absolute integer, return it; otherwise, return the default return ( $number ? $number : $setting->default ); } // sanitize radio button function weart_sanitize_radio( $input, $setting ) { // Ensure input is a slug. $input = sanitize_key( $input ); // Get list of choices from the control associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } // sanitize img upload function weart_sanitize_image( $input ) { $filetype = wp_check_filetype( $input ); if ( $filetype['ext'] && wp_ext2type( $filetype['ext'] ) === 'image' ) { return esc_url( $input ); } return ''; } ?> -
weartstudio revised this gist
Oct 20, 2017 . No changes.There are no files selected for viewing
-
weartstudio revised this gist
Oct 20, 2017 . 1 changed file with 39 additions and 39 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,49 +1,49 @@ <?php //sanitize adsense box adsense codes function weart_sanitize_adsense( $input ) { esc_js($input); $input = str_replace(array("\r", "\n"), '', $input); return $input; } //sanitize checkbox function weart_sanitize_checkbox( $input ) { return ( ( isset( $input ) && true == $input ) ? true : false ); } //sanitize text function weart_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } //sanitize select function weart_sanitize_select( $input, $setting ) { global $wp_customize; $control = $wp_customize->get_control( $setting->id ); if ( array_key_exists( $input, $control->choices ) ) { return $input; } else { return $setting->default; } } // sanitize number function weart_sanitize_number_absint( $number, $setting ) { // Ensure $number is an absolute integer (whole number, zero or greater). $number = absint( $number ); // If the input is an absolute integer, return it; otherwise, return the default return ( $number ? $number : $setting->default ); } // sanitize radio button function weart_sanitize_radio( $input, $setting ) { // Ensure input is a slug. $input = sanitize_key( $input ); // Get list of choices from the control associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } ?> -
weartstudio created this gist
Oct 20, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ <?php //sanitize adsense box adsense codes function weart_sanitize_adsense( $input ) { esc_js($input); $input = str_replace(array("\r", "\n"), '', $input); return $input; } //sanitize checkbox function weart_sanitize_checkbox( $input ) { return ( ( isset( $input ) && true == $input ) ? true : false ); } //sanitize text function weart_sanitize_text( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } //sanitize select function weart_sanitize_select( $input, $setting ) { global $wp_customize; $control = $wp_customize->get_control( $setting->id ); if ( array_key_exists( $input, $control->choices ) ) { return $input; } else { return $setting->default; } } // sanitize number function weart_sanitize_number_absint( $number, $setting ) { // Ensure $number is an absolute integer (whole number, zero or greater). $number = absint( $number ); // If the input is an absolute integer, return it; otherwise, return the default return ( $number ? $number : $setting->default ); } // sanitize radio button function weart_sanitize_radio( $input, $setting ) { // Ensure input is a slug. $input = sanitize_key( $input ); // Get list of choices from the control associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } ?>