<?php
/**
* Customizer validation functions
*
* @package Theme Palace
* @subpackage Enlightme
* @since Enlightme 1.0.0
*/

if ( ! function_exists( 'enlightme_validate_long_excerpt' ) ) :
  function enlightme_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.', 'enlightme' ) );
	 } elseif ( $value < 5 ) {
		 $validity->add( 'min_no_of_words', esc_html__( 'Minimum no of words is 5', 'enlightme' ) );
	 } elseif ( $value > 100 ) {
		 $validity->add( 'max_no_of_words', esc_html__( 'Maximum no of words is 100', 'enlightme' ) );
	 }
	 return $validity;
  }
endif;

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