HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //proc/self/cwd/wp-content/plugins/automatewoo/includes/Triggers/Utilities/CustomTimeOfDay.php
<?php

namespace AutomateWoo\Triggers\Utilities;

use AutomateWoo\Fields\Time as TimeField;

/**
 * Trait CustomTimeOfDayTrait
 *
 * @since 5.1.0
 */
trait CustomTimeOfDay {

	/**
	 * Register hooks.
	 */
	public function register_hooks() {
		// This action only needs to be added once for all custom time of day triggers
		if ( ! has_action( 'automatewoo/custom_time_of_day_workflow', [ 'AutomateWoo\Workflow_Background_Process_Helper', 'init_process' ] ) ) {
			add_action( 'automatewoo/custom_time_of_day_workflow', [ 'AutomateWoo\Workflow_Background_Process_Helper', 'init_process' ], 10, 2 );
		}
	}

	/**
	 * Returns the time of day field.
	 *
	 * @return TimeField
	 */
	protected function get_field_time_of_day() {
		$time = new TimeField();
		$time->set_title( __( 'Time of day', 'automatewoo' ) );
		$time->set_description( __( "Set the time in your site's timezone that the workflow will be triggered. If no time is set the workflow will run at midnight. If you set a time that has already passed for today the workflow will not run until tomorrow. The workflow will never be run twice in the same day. It's not possible to set a time after 23:00 which gives the background processor at least 1 hour to run any tasks.", 'automatewoo' ) );

		// Set the max hours value to 22 to prevent scheduling workflows in the last hour of the day
		// This way we always have at least 1 hour to run the tasks for the current day
		$time->max_hours = 22;

		return $time;
	}

	/**
	 * Get description text explaining the workflow is not run immediately.
	 *
	 * @return string
	 */
	protected function get_description_text_workflow_not_immediate() {
		return __( 'This workflow will not run immediately after it is saved. It will run daily in the background at the time set in the <strong>Time of day</strong> field. If no time is set it will run at midnight.', 'automatewoo' );
	}

}