ajax = new ACMajax(); 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')); } public function add_schedules_to_filter($schedules) { foreach ( get_option('acm_schedules', array()) 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_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(); ?>
$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 ''; _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_cron_schedules() { echo '