<?php
/**
* Customizer validation functions
*
* @package Theme Palace
* @subpackage Raise Charity Pro
* @since Raise Charity Pro 1.0.0
*/

if ( ! function_exists( 'raise_charity_pro_validate_long_excerpt' ) ) :
  function raise_charity_pro_validate_long_excerpt( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 5 ) {
		 $validity->add( 'min_no_of_words', esc_html__( 'Minimum no of words is 5', 'raise-charity-pro' ) );
	 } elseif ( $value > 100 ) {
		 $validity->add( 'max_no_of_words', esc_html__( 'Maximum no of words is 100', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_slider_count' ) ) :
  function raise_charity_pro_validate_slider_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 20 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 20', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_recent_cause_count' ) ) :
  function raise_charity_pro_validate_recent_cause_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_service_count' ) ) :
  function raise_charity_pro_validate_service_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 12 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 12', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_event_count' ) ) :
  function raise_charity_pro_validate_event_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_counter_count' ) ) :
  function raise_charity_pro_validate_counter_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 12 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 12', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_gallery_count' ) ) :
  function raise_charity_pro_validate_gallery_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 50 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 50', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_team_count' ) ) :
  function raise_charity_pro_validate_team_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_testimonial_count' ) ) :
  function raise_charity_pro_validate_testimonial_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 20 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 20', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_sponsor_count' ) ) :
  function raise_charity_pro_validate_sponsor_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 20 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 20', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_skills_count' ) ) :
  function raise_charity_pro_validate_skills_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 20 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 20', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_latest_posts_count' ) ) :
  function raise_charity_pro_validate_latest_posts_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 2 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 2', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_courses_count' ) ) :
  function raise_charity_pro_validate_courses_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 2 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 2', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_featured_posts_count' ) ) :
  function raise_charity_pro_validate_featured_posts_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 2 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 2', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_popular_posts_count' ) ) :
  function raise_charity_pro_validate_popular_posts_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 2 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 2', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_recent_posts_count' ) ) :
  function raise_charity_pro_validate_recent_posts_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 3 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 3', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_latest_products_count' ) ) :
  function raise_charity_pro_validate_latest_products_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 2 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 2', 'raise-charity-pro' ) );
	 } elseif ( $value > 12 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 12', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_popular_products_count' ) ) :
  function raise_charity_pro_validate_popular_products_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_recent_products_count' ) ) :
  function raise_charity_pro_validate_recent_products_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_featured_products_count' ) ) :
  function raise_charity_pro_validate_featured_products_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 2 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 2', 'raise-charity-pro' ) );
	 } elseif ( $value > 30 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 30', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;

if ( ! function_exists( 'raise_charity_pro_validate_trending_product_count' ) ) :
  function raise_charity_pro_validate_trending_product_count( $validity, $value ){
		 $value = intval( $value );
	 if ( empty( $value ) || ! is_numeric( $value ) ) {
		 $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'raise-charity-pro' ) );
	 } elseif ( $value < 1 ) {
		 $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'raise-charity-pro' ) );
	 } elseif ( $value > 12 ) {
		 $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 12', 'raise-charity-pro' ) );
	 }
	 return $validity;
  }
endif;
