<?php

/*
 */

/**
 * Description of class-wpefb-request
 *
 * @author ProfileGrid
 */
class WPEFB_Request {

	public function sanitize_request( $post, $identifier, $exclude = array() ) {
         $wpefbsanitizer = new WPEFB_Sanitizer();

        if ( !function_exists( 'get_magic_quotes_gpc' ) ) {
			$post = $wpefbsanitizer->remove_magic_quotes( $post ); }

        foreach ( $post as $key => $value ) {
            if ( ! in_array( $key, $exclude, true ) ) {
                if ( !is_array( $value ) ) {
                    $data[ $key ] = $wpefbsanitizer->get_sanitized_fields( $identifier, $key, $value );
                } else {
                    $data[ $key ] = wp_json_encode( $this->sanitize_request_array( $value, $identifier ) );
                }
            }
		}

        if ( isset( $data ) ) {
			return $data; } else {
			return null; }
	}

	public function sanitize_request_array( $post, $identifier ) {
		$wpefbsanitizer = new WPEFB_Sanitizer();

	    foreach ( $post as $key => $value ) {
			if ( is_array( $value ) ) {
				$data[ $key ] = $this->sanitize_request_array( $value, $identifier );
			} else {
				$data[ $key ] = $wpefbsanitizer->get_sanitized_fields( $identifier, $key, $value );
			}
	    }

	    if ( isset( $data ) ) {
			return $data; } else {
			return null; }
	}


}

if ( ! class_exists( 'WPEFB_request' ) ) {
	clSass_alias( 'WPEFB_Request', 'WPEFB_request' );
}
