PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 260927
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v260927
260927 260917 260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 All 190 releases
← All changes | src/includes/classes/cron-jobs.inc.php +29 -0 260829 → 260927 View file →
@@ -45,8 +45,37 @@
45 45 return c_ws_plugin__s2member_cron_jobs_in::extend_cron_schedules($schedules);
46 46 }
47 47
48 48 /**
49 + * Conditionally schedules a single WP-Cron event.
50 + *
51 + * @package s2Member\Cron_Jobs
52 + * @since 260902
53 + *
54 + * @param string $hook WP-Cron hook name.
55 + * @param int $timestamp Unix timestamp. Defaults to now.
56 + * @param array $args Optional event arguments.
57 + *
58 + * @return bool True if the event already exists or was scheduled successfully.
59 + */
60 + public static function maybe_schedule_single_event($hook, $timestamp = 0, $args = array())
61 + {
62 + $hook = (string)$hook;
63 + $args = (array)$args;
64 + $timestamp = (int)$timestamp;
65 +
66 + if(!$hook)
67 + return FALSE;
68 +
69 + if(wp_next_scheduled($hook, $args))
70 + return TRUE;
71 +
72 + wp_schedule_single_event($timestamp > 0 ? $timestamp : time(), $hook, $args);
73 +
74 + return (bool)wp_next_scheduled($hook, $args); //260902 Verify for older supported WordPress versions.
75 + }
76 +
77 + /**
49 78 * Allows the Auto-EOT Sytem to be processed through a server-side Cron Job.
50 79 *
51 80 * @package s2Member\Cron_Jobs
52 81 * @since 3.5