'None', 'post' => 'Posts', 'project' => 'Projects', 'testimonial' => 'Testimonials', ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } /** * File upload sanitization. * * Returns a sanitized filepath if it has a valid extension. */ function igthemes_sanitize_upload( $input ) { $output = ''; $filetype = wp_check_filetype( $input ); if ( $filetype["ext"] ) { $output = esc_url_raw( $input ); } return $output; } /** * Sanitization of input with allowed tags and wpautotop. * * Allows allowed tags in html input and ensures tags close properly. */ function igthemes_sanitize_allowedtags( $input ) { global $allowedtags; $output = wpautop( wp_kses( $input, $allowedtags ) ); return $output; } /** * Validates that the categories select input */ function igthemes_sanitize_cat( $input ) { $categories = get_categories(); $cats = array(); $i = 0; foreach($categories as $category){ if($i==0){ $default = $category->slug; $i++; } $cats[$category->slug] = $category->name; } if ( array_key_exists( $input, $cats ) ){ return $input; } } /** * Validates layout input */ function igthemes_sanitize_layout( $input) { $valid = array( '1col' => '1col', '2cl' => '2cl', '2cr' => '2cr', ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } /** * Sanitize a color represented in hexidecimal notation. */ function igthemes_sanitize_hex( $input ) { $hex = sanitize_hex_color( $input ); return $hex; }