Changeset 3697

Show
Ignore:
Timestamp:
04/06/06 05:25:50 (2 years ago)
Author:
matt
Message:

Formatting and eol fixes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/cron.php

    • Property svn:eol-style set to native
    r3636 r3697  
    11<?php 
    2 function wp_schedule_single_event($timestamp, $hook) { 
    3     $args = array_slice(func_get_args(), 2); 
    4     $crons = get_option('cron'); 
    5     $crons[$timestamp][$hook] = array('schedule' => false, 'args' => $args); 
    6     ksort($crons); 
    7     update_option('cron', $crons); 
    8 
    9 function wp_schedule_event($timestamp, $recurrence, $hook) { 
    10     $args = array_slice(func_get_args(), 3); 
    11     $crons = get_option('cron'); 
    12     $schedules = wp_get_schedules(); 
    13     if(!isset($schedules[$recurrence])) 
    14         return false; 
    15     $crons[$timestamp][$hook] = array('schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval']); 
    16     ksort($crons); 
    17     update_option('cron', $crons); 
     2 
     3function wp_schedule_single_event( $timestamp, $hook ) { 
     4    $args = array_slice( func_get_args(), 2 ); 
     5    $crons = get_option( 'cron' ); 
     6    $crons[$timestamp][$hook] = array( 'schedule' => false, 'args' => $args ); 
     7    ksort( $crons ); 
     8    update_option( 'cron', $crons ); 
    189} 
    1910 
     11function wp_schedule_event( $timestamp, $recurrence, $hook ) { 
     12    $args = array_slice( func_get_args(), 3 ); 
     13    $crons = get_option( 'cron' ); 
     14    $schedules = wp_get_schedules(); 
     15    if ( !isset( $schedules[$recurrence] ) ) 
     16        return false; 
     17    $crons[$timestamp][$hook] = array( 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] ); 
     18    ksort( $crons ); 
     19    update_option( 'cron', $crons ); 
     20} 
    2021 
    21 function wp_reschedule_event($timestamp, $recurrence, $hook) { 
    22     $args = array_slice(func_get_args(), 3); 
    23     $crons = get_option('cron'); 
     22function wp_reschedule_event( $timestamp, $recurrence, $hook ) { 
     23    $args = array_slice( func_get_args(), 3 ); 
     24    $crons = get_option( 'cron' ); 
    2425    $schedules = wp_get_schedules(); 
    2526    $interval = 0; 
    26      
     27 
    2728    // First we try to get it from the schedule 
    28     if( 0 == $interval ) 
     29    if ( 0 == $interval ) 
    2930        $interval = $schedules[$recurrence]['interval']; 
    3031    // Now we try to get it from the saved interval in case the schedule disappears 
    31     if( 0 == $interval ) 
     32    if ( 0 == $interval ) 
    3233        $interval = $crons[$timestamp][$hook]['interval']; 
    3334    // Now we assume something is wrong and fail to schedule 
    34     if( 0 == $interval ) 
     35    if ( 0 == $interval ) 
    3536        return false; 
    3637 
    37     while($timestamp < time() + 1) { 
     38    while ( $timestamp < time() + 1 ) 
    3839        $timestamp += $interval; 
    39     } 
    40     wp_schedule_event($timestamp, $recurrence, $hook); 
     40 
     41    wp_schedule_event( $timestamp, $recurrence, $hook ); 
    4142} 
    4243 
    43 function wp_unschedule_event($timestamp, $hook) { 
    44     $crons = get_option('cron'); 
    45     unset($crons[$timestamp][$hook]); 
     44function wp_unschedule_event( $timestamp, $hook ) { 
     45    $crons = get_option( 'cron' ); 
     46    unset( $crons[$timestamp][$hook] ); 
    4647    if ( empty($crons[$timestamp]) ) 
    47         unset($crons[$timestamp]); 
    48     update_option('cron', $crons); 
     48        unset( $crons[$timestamp] ); 
     49    update_option( 'cron', $crons ); 
    4950} 
    5051 
    51 function wp_clear_scheduled_hook($hook) { 
    52     while($timestamp = wp_next_scheduled($hook)
    53         wp_unschedule_event($timestamp, $hook); 
     52function wp_clear_scheduled_hook( $hook ) { 
     53    while ( $timestamp = wp_next_scheduled( $hook )
     54        wp_unschedule_event( $timestamp, $hook ); 
    5455} 
    5556 
    56 function wp_next_scheduled($hook) { 
    57     $crons = get_option('cron'); 
     57function wp_next_scheduled( $hook ) { 
     58    $crons = get_option( 'cron' ); 
    5859    if ( empty($crons) ) 
    5960        return false; 
    60     foreach($crons as $timestamp => $cron) { 
    61         //if($timestamp <= time()) continue; 
    62         if(isset($cron[$hook])) return $timestamp; 
    63     } 
     61    foreach ( $crons as $timestamp => $cron ) 
     62        if ( isset( $cron[$hook] ) ) 
     63            return $timestamp; 
    6464    return false; 
    6565} 
    6666 
    6767function spawn_cron() { 
    68     if (array_shift(array_keys(get_option('cron'))) > time()) return; 
    69      
    70     $cron_url = get_settings('siteurl') . '/wp-cron.php'; 
    71     $parts = parse_url($cron_url); 
    72      
    73     $argyle = @ fsockopen($parts['host'], $_SERVER['SERVER_PORT'], $errno, $errstr, 0.01); 
     68    if ( array_shift( array_keys( get_option( 'cron' ) ) ) > time() ) 
     69        return; 
     70 
     71    $cron_url = get_settings( 'siteurl' ) . '/wp-cron.php'; 
     72    $parts = parse_url( $cron_url ); 
     73 
     74    $argyle = @ fsockopen( $parts['host'], $_SERVER['SERVER_PORT'], $errno, $errstr, 0.01 ); 
    7475    if ( $argyle ) 
    75         fputs($argyle, 
     76        fputs( $argyle, 
    7677              "GET {$parts['path']}?check=" . md5(DB_PASS . '187425') . " HTTP/1.0\r\n" 
    7778            . "Host: {$_SERVER['HTTP_HOST']}\r\n\r\n" 
     
    8081 
    8182function wp_cron() { 
    82     $crons = get_option('cron'); 
    83     if (!is_array($crons) || array_shift(array_keys($crons)) > time()
     83    $crons = get_option( 'cron' ); 
     84    if ( !is_array($crons) || array_shift( array_keys( $crons ) ) > time()
    8485        return; 
    8586 
    8687    $schedules = wp_get_schedules(); 
    87     foreach ($crons as $timestamp => $cronhooks) { 
    88         if ($timestamp > time()) break; 
    89         foreach($cronhooks as $hook => $args) { 
    90             if(isset($schedules[$hook]['callback']) && !call_user_func($schedules[$hook]['callback'])
     88    foreach ( $crons as $timestamp => $cronhooks ) { 
     89        if ( $timestamp > time() ) break; 
     90        foreach ( $cronhooks as $hook => $args ) { 
     91            if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] )
    9192                continue; 
    9293            spawn_cron(); 
     
    9899function wp_get_schedules() { 
    99100    $schedules = array( 
    100         'hourly' => array('interval' => 3600, 'display' => __('Once Hourly')), 
    101         'daily' => array('interval' => 86400, 'display' => __('Once Daily')), 
     101        'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ), 
     102        'daily' => array( 'interval' => 86400, 'display' => __('Once Daily') ), 
    102103    ); 
    103     return array_merge(apply_filters('cron_schedules', array()), $schedules); 
     104    return array_merge( apply_filters( 'cron_schedules', array() ), $schedules ); 
    104105} 
     106 
    105107?> 
  • trunk/wp-includes/deprecated.php

    • Property svn:eol-style set to native
  • trunk/wp-includes/query.php

    • Property svn:eol-style set to native
  • trunk/wp-includes/rewrite.php

    • Property svn:eol-style set to native