| 1 |
<?php |
| 2 |
// @codingStandardsIgnoreFile |
| 3 |
/** |
| 4 |
* Cron routines handled by s2Member. |
| 5 |
* |
| 6 |
* Copyright: © 2009-2011 |
| 7 |
* {@link http://websharks-inc.com/ WebSharks, Inc.} |
| 8 |
* (coded in the USA) |
| 9 |
* |
| 10 |
* Released under the terms of the GNU General Public License. |
| 11 |
* You should have received a copy of the GNU General Public License, |
| 12 |
* along with this software. In the main directory, see: /licensing/ |
| 13 |
* If not, see: {@link http://www.gnu.org/licenses/}. |
| 14 |
* |
| 15 |
* @package s2Member\Cron_Jobs |
| 16 |
* @since 3.5 |
| 17 |
*/ |
| 18 |
if(!defined('WPINC')) // MUST have WordPress. |
| 19 |
exit ("Do not access this file directly."); |
| 20 |
|
| 21 |
if(!class_exists("c_ws_plugin__s2member_cron_jobs")) |
| 22 |
{ |
| 23 |
/** |
| 24 |
* Cron routines handled by s2Member. |
| 25 |
* |
| 26 |
* @package s2Member\Cron_Jobs |
| 27 |
* @since 3.5 |
| 28 |
*/ |
| 29 |
class c_ws_plugin__s2member_cron_jobs |
| 30 |
{ |
| 31 |
/** |
| 32 |
* Extends WP-Cron schedules to support 10 minute intervals. |
| 33 |
* |
| 34 |
* @package s2Member\Cron_Jobs |
| 35 |
* @since 3.5 |
| 36 |
* |
| 37 |
* @attaches-to ``add_filter("cron_schedules");`` |
| 38 |
* |
| 39 |
* @param array $schedules Expects an array of WP_Cron schedules passed in by the Filter. |
| 40 |
* |
| 41 |
* @return array Return-value of inner routine. |
| 42 |
*/ |
| 43 |
public static function extend_cron_schedules($schedules = array()) |
| 44 |
{ |
| 45 |
return c_ws_plugin__s2member_cron_jobs_in::extend_cron_schedules($schedules); |
| 46 |
} |
| 47 |
|
| 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 |
/** |
| 78 |
* Allows the Auto-EOT Sytem to be processed through a server-side Cron Job. |
| 79 |
* |
| 80 |
* @package s2Member\Cron_Jobs |
| 81 |
* @since 3.5 |
| 82 |
* |
| 83 |
* @attaches-to ``add_action("init");`` |
| 84 |
*/ |
| 85 |
public static function auto_eot_system_via_cron() |
| 86 |
{ |
| 87 |
if(!empty($_GET["s2member_auto_eot_system_via_cron"])) |
| 88 |
c_ws_plugin__s2member_cron_jobs_in::auto_eot_system_via_cron(); |
| 89 |
} |
| 90 |
} |
| 91 |
} |
| 92 |
|