wp_create_nonce( self::ACTION ) );
}
/** Hidden inputs for a GET filter form: the view nonce, plus the current section and page id when not using pretty URLs. */
public static function fields( $section = '' ) {
$h = '';
if ( self::has_route( 'frontglut' ) ) {
$h .= '';
}
if ( self::has_route( 'page_id' ) ) {
$h .= '';
}
return $h;
}
private static function clean( $v, $type, $default ) {
if ( ! is_scalar( $v ) ) {
return $default;
}
$v = (string) $v;
switch ( $type ) {
case 'int':
return is_numeric( $v ) ? (int) $v : $default;
case 'text':
return sanitize_text_field( $v );
case 'date':
return preg_match( '/^\d{4}-\d{2}-\d{2}$/', $v ) && strtotime( $v ) ? $v : $default;
case 'url':
return esc_url_raw( $v );
case 'bool':
return '' !== $v && '0' !== $v;
default:
return sanitize_key( $v );
}
}
}