| Server IP : 213.186.33.4 / Your IP : 216.73.216.146 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/plugins/glaza-core/lib/meta-box/inc/ |
Upload File : |
<?php
/**
* Sanitize field value before saving.
*
* @package Meta Box
*/
/**
* Sanitize class.
*/
class RWMB_Sanitizer {
/**
* Built-in callbacks for some specific types.
*
* @var array
*/
protected $callbacks = array(
'email' => 'sanitize_email',
'file_input' => 'esc_url_raw',
'oembed' => 'esc_url_raw',
'url' => 'esc_url_raw',
);
/**
* Register hook to sanitize field value.
*/
public function init() {
// Built-in callback.
foreach ( $this->callbacks as $type => $callback ) {
add_filter( "rwmb_{$type}_sanitize", $callback );
}
// Custom callback.
$types = array_diff( get_class_methods( __CLASS__ ), array( 'init' ) );
foreach ( $types as $type ) {
add_filter( "rwmb_{$type}_sanitize", array( $this, $type ) );
}
}
/**
* Set the value of checkbox to 1 or 0 instead of 'checked' and empty string.
* This prevents using default value once the checkbox has been unchecked.
*
* @link https://github.com/rilwis/meta-box/issues/6
* @param string $value Checkbox value.
* @return int
*/
public function checkbox( $value ) {
return (int) ! empty( $value );
}
}