All pastes #466645 Raw Edit

Mine

public php v1 · immutable
·published 2007-05-01 03:01 UTC
rendered paste body
<?php/*Plugin Name: wp cron clonePlugin URI: http://wordpress.org/support/topic/109641Description: execute cron tasks without running wp-cron.php on the server.Author: yoshiVersion: 0.1*/remove_action('init', 'wp_cron');if(!defined('DOING_CRON'))  add_action('init', 'wp_cron_clone');function wp_cron_clone() {	// Prevent infinite loops caused by lack of wp-cron.php	if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false )		return;	$crons = _get_cron_array();		if ( !is_array($crons) )		return;	$keys = array_keys( $crons );	if ( isset($keys[0]) && $keys[0] > time() )		return;	$schedules = wp_get_schedules();	foreach ( $crons as $timestamp => $cronhooks ) {		if ( $timestamp > time() ) break;		foreach ( $cronhooks as $hook => $args ) {			if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) )				continue;			wp_cron_clone_run();			break 2;		}	}}function wp_cron_clone_run() {  ignore_user_abort(true);  if ( get_option('doing_cron') > time() )  	return;  update_option('doing_cron', time() + 30);  $crons = _get_cron_array();  $keys = array_keys($crons);  if (!is_array($crons) || $keys[0] > time())  	return;  foreach ($crons as $timestamp => $cronhooks) {  	if ($timestamp > time()) break;  	foreach ($cronhooks as $hook => $keys) {  		foreach ($keys as $key => $args) {  			$schedule = $args['schedule'];  			if ($schedule != false) {  				$new_args = array($timestamp, $schedule, $hook, $args['args']);  				call_user_func_array('wp_reschedule_event', $new_args);  			}  			wp_unschedule_event($timestamp, $hook, $args['args']);   			do_action_ref_array($hook, $args['args']);  		}  	}  }  update_option('doing_cron', 0);}?>