ajax = new ACMajax(); $this->acm_schedules = get_option('acm_schedules', array()); $this->settings = get_option( 'acm_settings', array( 'log' => false, 'keep_in_db' => 100, ) ); add_filter( 'cron_schedules', array($this, 'add_schedules_to_filter') ); $this->time_offset = get_option('gmt_offset') * 3600; add_action('admin_menu', array($this, 'add_menu_page')); add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_and_styles')); if ( class_exists( 'ACMPRO' ) ) { $acm_pro = new ACMPRO( $this ); } } public function add_schedules_to_filter($schedules) { foreach ( $this->acm_schedules as $name => $schedule ) { $schedules[$name] = array( 'interval' => $schedule['interval'], 'display' => $schedule['display'] ); } return $schedules; } public function enqueue_scripts_and_styles($hook) { if( 'tools_page_acm' != $hook ) return; wp_enqueue_style('thickbox'); wp_enqueue_script('thickbox'); wp_enqueue_script( 'acm_scripts', ACM_URL.'assets/js/admin.js', array('jquery'), 1, true ); wp_enqueue_script( 'acm_ajax_scripts', ACM_URL.'assets/js/ajax.js', array('jquery'), 1, true ); wp_enqueue_style( 'acm_style', ACM_URL.'assets/css/style.css' ); } public function add_menu_page() { add_management_page('Advanced Cron Manager', 'Cron Manager', 'manage_options', 'acm', array($this, 'acm_page')); } public function acm_page() { $this->parse_crons(); ?>
show_notifications(); ?>

display_content(); ?>
display_aside(); ?>
$crons) { foreach ($crons as $cron_name => $cron_args) { foreach ($cron_args as $cron) { $this->crons[$timestamp + $this->time_offset][] = array( 'hook' => $cron_name, 'cron' => $cron, 'hash' => acm_get_cron_hash($cron_name, $timestamp, $cron['args'], (!isset($cron['interval'])) ? 0 : $cron['interval']) ); } } } ksort($this->crons); } public function show_notifications() { echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; } public function display_content() { $this->schedules = wp_get_schedules(); $this->display_cron_table(); if ( ! class_exists( 'ACMPRO' ) ) { echo '

'.__('Logs', 'acm').'

'; echo '

' . __( 'Log cron executions with Advanced Cron Manager PRO', 'acm' ) . '

'; echo '

' . __( 'Until 1st June 2015 only $19.99 $14.99!', 'acm' ) . '

'; echo '
'; } do_action( 'acm_after_table', $this ); } public function display_aside() { echo '

'.__('Cron Schedules', 'acm').'

'; $this->display_cron_schedules(); echo '
'; echo '

'.__('Informations', 'acm').'

'; $this->display_informations_widget(); echo '
'; $this->settings_array = apply_filters( 'acm_settings', $this->settings_array ); if ( ! empty( $this->settings_array ) ) { echo '

'.__('Settings', 'acm').'

'; $this->display_settings_widget(); echo '
'; } echo '

'.__('Check this out!', 'acm').'

'; $this->display_popslide_widget(); echo '
'; } public function display_informations_widget() { echo '

'; _e('Please remember - after deactivation of this plugin added Schedules will be not available. Added Tasks will still work.', 'acm'); echo '

'; echo '

'; _e('Important - WordPress Cron is depended on the User. WP Cron fires only on the page visit so it can be not accurate.', 'acm'); echo '

'; } public function display_settings_widget() { foreach ( $this->settings_array as $key => $setting ) { echo '

'; if ( isset( $setting['label'] ) && ! empty( $setting['label'] ) ) { echo ''; } echo '

'; } echo '
'; } public function display_popslide_widget() { echo '

'; _e('Did you ever searched for beautiful minimalistic and non aggressive popup?', 'acm'); echo '

'; echo ''.__('Try Popslide!', 'acm').''; } public function display_cron_schedules() { echo ''; echo '
'; $this->display_add_schedule_form(); } public function get_schedule_actions($name) { if ( in_array($name, $this->protected_schedules) || !isset($this->acm_schedules[$name]) ) return ' '.__('Schedule protected', 'acm').''; return ' Remove'; } public function display_add_schedule_form() { ?> display_cron_table_body(); ?>
crons as $timestamp => $cron_many) { foreach ($cron_many as $cron) { $alternate = ($alternate == '') ? 'alternate' : ''; echo ''; echo ''; echo $cron['hook']; $this->display_row_actions($cron['hook'], (!isset($cron['cron']['interval'])) ? 0 : $cron['cron']['interval'], $cron['cron']['args']); echo ''; echo ''; echo empty($cron['cron']['schedule']) ? _e('single', 'acm') : $cron['cron']['schedule']; echo ''; echo ''.acm_get_cron_arguments($cron['cron']['args']).''; echo ''.acm_get_next_cron_execution($timestamp).''; echo ''.__('Execute', 'acm').''; echo ''; } } // Add task row $this->add_task_row($alternate); } public function add_task_row($alternate) { $alternate = ($alternate == '') ? 'alternate' : ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; ?>
+ .
'; } public function display_row_actions($cron, $interval, $args) { echo '
'; if ( in_array($cron, $this->protected_crons) ) { _e('Task protected', 'acm'); } else { // echo ''.__('Edit', 'acm').' | '; echo ''.__('Remove', 'acm').''; } echo '
'; } }