| 135 | | $crons = _get_cron_array(); |
| 136 | | $key = md5(serialize($args)); |
| 137 | | unset( $crons[$timestamp][$hook][$key] ); |
| 138 | | if ( empty($crons[$timestamp][$hook]) ) |
| 139 | | unset( $crons[$timestamp][$hook] ); |
| 140 | | if ( empty($crons[$timestamp]) ) |
| 141 | | unset( $crons[$timestamp] ); |
| 142 | | _set_cron_array( $crons ); |
| | 131 | $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'args' => $args ); |
| | 132 | wp_cron_delete_event($event); |
| | 341 | function wp_cron_delete_event( $event ) { |
| | 342 | if ( null !== $result = apply_filters('wp_cron_delete_event', null, $event) ) |
| | 343 | return $result; |
| | 344 | |
| | 345 | $crons = _get_cron_array(); |
| | 346 | $key = md5(serialize($event->args)); |
| | 347 | unset( $crons[$event->timestamp][$event->hook][$key] ); |
| | 348 | if ( empty($crons[$event->timestamp][$event->hook]) ) |
| | 349 | unset( $crons[$event->timestamp][$event->hook] ); |
| | 350 | if ( empty($crons[$event->timestamp]) ) |
| | 351 | unset( $crons[$event->timestamp] ); |
| | 352 | _set_cron_array( $crons ); |
| | 353 | } |
| | 354 | |
| | 355 | function wp_cron_get_event( $event ) { |
| | 356 | if ( null !== $result = apply_filters('wp_cron_get_event', null, $event) ) |
| | 357 | return $result; |
| | 358 | |
| | 359 | $crons = _get_cron_array(); |
| | 360 | $key = md5(serialize($event->args)); |
| | 361 | if ( empty($crons) ) |
| | 362 | return false; |
| | 363 | |
| | 364 | if ( empty($event->timestamp) || 'next' == $event->timestamp ) { |
| | 365 | foreach ( $crons as $timestamp => $cron ) { |
| | 366 | if ( isset( $cron[$event->hook][$key] ) ) |
| | 367 | return (object) array( 'hook' => $event->hook, 'args' => $event->args, 'timestamp' => $timestamp, 'schedule' => $cron[$event->hook][$key]['schedule'], 'interval' => $cron[$event->hook][$key]['interval']); |
| | 368 | } |
| | 369 | return false; |
| | 370 | } |
| | 371 | |
| | 372 | if ( isset($cron[$event->timestamp][$event->hook][$key]) ) |
| | 373 | return (object) array( 'hook' => $event->hook, 'args' => $event->args, 'timestamp' => $event->timestamp, 'schedule' => $cron[$event->timestamp][$event->hook][$key]['schedule'], 'interval' => $cron[$event->timestamp][$event->hook][$key]['interval']); |
| | 374 | |
| | 375 | return false; |
| | 376 | } |
| | 377 | |
| | 378 | function wp_cron_get_events( $args ) { |
| | 379 | if ( null !== $result = apply_filters('wp_cron_get_events', null, $args) ) |
| | 380 | return $result; |
| | 381 | |
| | 382 | // @todo |
| | 383 | return null; |
| | 384 | } |
| | 385 | |
| | 386 | function wp_cron_insert_event( $event ) { |
| | 387 | if ( null !== $result = apply_filters('wp_cron_insert_event', null, $event) ) |
| | 388 | return $result; |
| | 389 | |
| | 390 | $key = md5(serialize($event->args)); |
| | 391 | |
| | 392 | $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval ); |
| | 393 | uksort( $crons, "strnatcasecmp" ); |
| | 394 | _set_cron_array( $crons ); |
| | 395 | } |
| | 396 | |