Ejemplo n.º 1
0
/**
 * Retrieve a list with the scheduled tasks configured for the site.
 *
 * @return array A list of pseudo-variables and values that will replace them in the HTML template.
 */
function sucuriscan_show_cronjobs()
{
    $template_variables = array('Cronjobs.List' => '', 'Cronjobs.Total' => 0);
    $cronjobs = _get_cron_array();
    $schedules = wp_get_schedules();
    $counter = 0;
    foreach ($cronjobs as $timestamp => $cronhooks) {
        foreach ((array) $cronhooks as $hook => $events) {
            foreach ((array) $events as $key => $event) {
                if (empty($event['args'])) {
                    $event['args'] = array('<em>empty</em>');
                }
                $template_variables['Cronjobs.Total'] += 1;
                $template_variables['Cronjobs.List'] .= SucuriScanTemplate::get_snippet('infosys-cronjobs', array('Cronjob.Hook' => $hook, 'Cronjob.Schedule' => $event['schedule'], 'Cronjob.NextTime' => SucuriScan::datetime($timestamp), 'Cronjob.Arguments' => SucuriScan::implode(', ', $event['args']), 'Cronjob.CssClass' => $counter % 2 == 0 ? '' : 'alternate'));
                $counter += 1;
            }
        }
    }
    return SucuriScanTemplate::get_section('infosys-cronjobs', $template_variables);
}