__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?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() );
	}
}

Filemanager

Name Type Size Permission Actions
Templates Folder 0750
FetchInfoBlocksTask.php File 2.07 KB 0640
Helpers.php File 12.6 KB 0640
InfoBlocks.php File 5.36 KB 0640
Mailer.php File 12.46 KB 0640
NotificationBlocks.php File 4.63 KB 0640
Notifications.php File 37.06 KB 0640
Preview.php File 12.95 KB 0640
Styler.php File 2.53 KB 0640
Summaries.php File 14.08 KB 0640
Filemanager