HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.30
System: Linux iZj6c1151k3ad370bosnmsZ 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User: root (0)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /var/www/html/amberconcept/wp-content/plugins/woocommerce-upload-files/classes/com/WCUF_Time.php
<?php 
class WCUF_Time 
{
	function __construct()
	{
		
	}
	public function can_be_displayed($field_data, $order = null)
	{
		$visibility_type = wcuf_get_value_if_set($field_data, array('time_visibility','type'), 'disabled');
		
		if($visibility_type == 'disabled' )
		 return true;
	 
	   if($visibility_type == 'amount_of_time' && !isset($order))
		   return false;
	   
	   
	   
	   if($visibility_type == 'specific_date')
	   {
		   $minute = wcuf_get_value_if_set($field_data, array( 'time_visibility','specific_date', 'minute'), '1');
		   $hour = wcuf_get_value_if_set($field_data, array( 'time_visibility','specific_date', 'hour'), '1');
		   $day = wcuf_get_value_if_set($field_data, array( 'time_visibility','specific_date', 'day'), '1');
		   $month = wcuf_get_value_if_set($field_data, array( 'time_visibility','specific_date', 'month'), '1');
		   $year = current_time( 'Y' );
		   $expiring_date = new DateTime($year."-".$month."-".$day." ".$hour.":". $minute.":00");
		   $current_date = new DateTime(current_time( 'Y-m-d H:i:s' ));
			return $current_date > $expiring_date ? false : true; 
		   
	   }
	   else if($visibility_type == 'amount_of_time')
	   {
		   $quantity = wcuf_get_value_if_set($field_data, array( 'time_visibility','amount_of_time', 'quantity'), '1');
		   $type = wcuf_get_value_if_set($field_data, array( 'time_visibility','amount_of_time', 'type'), '1');
		   $order_date = $order->get_date_created();
		   $order_date =  new DateTime($order_date->date("Y-m-d H:i:s"));
		   $current_date = new DateTime(current_time( 'Y-m-d H:i:s' ));
		   $order_date->modify('+'.$quantity." ".$type);
		  
		   return $current_date > $order_date ? false : true; 
	   }
	   
	   return true;
	}
}
?>