$61 GRAYBYTE WORDPRESS FILE MANAGER $77

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/kigalix.com/wp-content/plugins/wpforms-lite/src/Emails/

HOME
Current File : /home/bravrvjk/kigalix.com/wp-content/plugins/wpforms-lite/src/Emails//FetchInfoBlocksTask.php
<?php

namespace WPForms\Emails;

use WPForms\Tasks\Task;

/**
 * Action Scheduler task to fetch and cache Email Summaries Info Blocks.
 *
 * @since 1.6.4
 */
class FetchInfoBlocksTask extends Task {

	/**
	 * Action name for this task.
	 *
	 * @since 1.6.4
	 */
	const ACTION = 'wpforms_email_summaries_fetch_info_blocks';

	/**
	 * Option name to store the timestamp of the last run.
	 *
	 * @since 1.6.4
	 */
	const LAST_RUN = 'wpforms_email_summaries_fetch_info_blocks_last_run';

	/**
	 * Class constructor.
	 *
	 * @since 1.6.4
	 */
	public function __construct() {

		parent::__construct( self::ACTION );

		$this->init();
	}

	/**
	 * Initialize the task with all the proper checks.
	 *
	 * @since 1.6.4
	 */
	public function init() {

		$this->hooks();

		$tasks = wpforms()->obj( 'tasks' );

		// Add new if none exists.
		if ( $tasks->is_scheduled( self::ACTION ) !== false ) {
			return;
		}

		$this->recurring( $this->generate_start_date(), WEEK_IN_SECONDS )->register();
	}

	/**
	 * Add hooks.
	 *
	 * @since 1.7.3
	 */
	private function hooks() {

		// Register the action handler.
		add_action( self::ACTION, [ $this, 'process' ] );
	}

	/**
	 * Randomly pick a timestamp which is not more than 1 week in the future
	 * starting before Email Summaries dispatch happens.
	 *
	 * @since 1.6.4
	 *
	 * @return int
	 */
	private function generate_start_date() {

		$tracking = [];

		$tracking['days']    = wp_rand( 0, 6 ) * DAY_IN_SECONDS;
		$tracking['hours']   = wp_rand( 0, 23 ) * HOUR_IN_SECONDS;
		$tracking['minutes'] = wp_rand( 0, 59 ) * MINUTE_IN_SECONDS;
		$tracking['seconds'] = wp_rand( 0, 59 );

		return strtotime( 'previous monday 1pm' ) + array_sum( $tracking );
	}

	/**
	 * Process the task.
	 *
	 * @since 1.6.4
	 */
	public function process() {

		$last_run = get_option( self::LAST_RUN );

		// Make sure we do not run it more than once a day.
		if (
			$last_run !== false &&
			( time() - $last_run ) < DAY_IN_SECONDS
		) {
			return;
		}

		( new InfoBlocks() )->cache_all();

		// Update the last run option to the current timestamp.
		update_option( self::LAST_RUN, time() );
	}
}


Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
9 May 2025 2.02 AM
bravrvjk / bravrvjk
0755
Templates
--
9 May 2025 2.02 AM
bravrvjk / bravrvjk
0755
FetchInfoBlocksTask.php
2.071 KB
26 Sep 2024 3.36 PM
bravrvjk / bravrvjk
0644
Helpers.php
12.599 KB
16 Jan 2024 5.57 PM
bravrvjk / bravrvjk
0644
InfoBlocks.php
5.362 KB
24 Apr 2025 2.53 PM
bravrvjk / bravrvjk
0644
Mailer.php
12.465 KB
24 Apr 2025 2.53 PM
bravrvjk / bravrvjk
0644
NotificationBlocks.php
4.627 KB
26 Sep 2024 3.36 PM
bravrvjk / bravrvjk
0644
Notifications.php
39.322 KB
5 May 2025 2.58 PM
bravrvjk / bravrvjk
0644
Preview.php
12.951 KB
16 Jan 2024 5.57 PM
bravrvjk / bravrvjk
0644
Styler.php
2.534 KB
28 Nov 2023 4.59 PM
bravrvjk / bravrvjk
0644
Summaries.php
14.078 KB
17 Oct 2024 3.23 PM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF