delete_schedule($to_delete); exit('1'); break; case 'delete-cron': break; } } function handle_posts() { if( isset($_POST['new_cron']) ) { wp_schedule_event(time(), $_POST['schedule'], $_POST['hookname']); } else if( isset($_POST['new_schedule']) ) { check_admin_referer("new-sched"); $name = $_POST['internal_name']; $interval = $_POST['interval']; $display = $_POST['display_name']; $this->add_schedule($name, $interval, $display); wp_redirect('options-general.php?page=crontrol_admin_options_page'); } else if( isset($_GET['action']) && $_GET['action']=='delete-sched') { $id = $_GET['id']; check_admin_referer("delete-sched_$id"); $this->delete_schedule($id); wp_redirect('options-general.php?page=crontrol_admin_options_page'); } } function add_schedule($name, $interval, $display) { $old_scheds = get_option('crontrol_schedules'); $old_scheds[$_POST['internal_name']] = array('interval'=>$_POST['interval'], 'display'=>$_POST['display_name']); update_option('crontrol_schedules', $old_scheds); } function delete_schedule($name) { $scheds = get_option('crontrol_schedules'); unset($scheds[$name]); update_option('crontrol_schedules', $scheds); } function activate() { $extra_scheds = array('twicedaily'=>array('interval'=>43200, 'display'=>'Twice Daily')); add_option('crontrol_schedules', $extra_scheds); } function admin_menu() { // Add a Zensor menu underneath the options and management page $page = add_options_page('Crontrol', 'Crontrol', 'manage_options', 'crontrol_admin_options_page', array(&$this, 'admin_options_page') ); add_action("admin_print_scripts-$page", array(&$this, 'scripts') ); $page = add_management_page('Crontrol', "Crontrol", '1', 'crontrol_admin_manage_page', array(&$this, 'admin_manage_page') ); // Add some scripts and stylesheets to the admin section // add_action("admin_print_scripts-$page", array(&$this, 'scripts') ); // add_action("admin_head", array(&$this, 'styles') ); } function cron_schedules($scheds) { $new_scheds = get_option('crontrol_schedules'); return $new_scheds; } function admin_options_page() { $schedules = wp_get_schedules(); $custom_schedules = get_option('crontrol_schedules'); $custom_keys = array_keys($custom_schedules); uasort($schedules, create_function('$a,$b', 'return $a["interval"]-$b["interval"];')); ?>

Cron Schedules (add new)

$data ) { echo ""; echo ""; echo ""; echo ""; if( in_array($name, $custom_keys) ) { echo ""; } echo ""; $class = empty($class)?"alternate":""; } ?>
Name Interval Display Name Actions
$name{$data['interval']} (".$this->time_since(time(), time()+$data['interval'])."){$data['display']}".__( 'Delete' )."

Add new cron schedule

WP-Cron Entries (add new)

$cron ) { foreach( $cron as $hook=>$data) { $data = array_shift($data); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $class = empty($class)?"alternate":""; } } ?>
Hook Name Next Run Recurrence Actions
$hook".strftime("%D %T", $time)." (".$this->time_since(time(), $time)."){$data['interval']} (".$this->time_since(time(), time()+$data['interval']).")

Add new cron entry