' . $action . ' ' . date('m/d/Y H:i:s ', time()) . ' ' . sanitize_text_field($update_id) . ' ' . sanitize_text_field($chat_id) . ' ' . sanitize_text_field($text) . ' ' . get_option('wp_teletter_log')); } include_once('includes/send-functions.php'); include_once('includes/api-settings.php'); include_once('includes/pagetemplate.php'); include_once('includes/users-save.php'); include_once('includes/getupdates.php'); include_once('includes/publishsend.php'); include_once('includes/notification-metabox.php'); $options = get_option( 'tbot_settings' ); $method = $options['tbot_select_method']; $currency = $options['tbot_select_updates_time']; if ($method == 'getupdates') { // Add function to register event to WordPress init add_action( 'init', 'getupdates_cron'); // Custom Cron Recurrences function custom_cron_job_recurrence( $schedules ) { $schedules['twentymin'] = array( 'display' => __( 'Twenty Minutes', 'tbot' ), 'interval' => 1200, // time in seconds ); return $schedules; } add_filter( 'cron_schedules', 'custom_cron_job_custom_recurrence' ); add_action( 'wp', 'custom_cron_job' ); // Function which will register the event function getupdates_cron() { $options = get_option( 'tbot_settings' ); $currency = $options['tbot_select_updates_time']; // Make sure this event hasn't been scheduled if( !wp_next_scheduled( 'getupdates' ) ) { // Schedule the event if ($currency == 'hourly') { wp_schedule_event( time(), 'hourly', 'getupdates' ); } elseif ($currency == 'twicedaily') { wp_schedule_event( time(), 'twicedaily', 'getupdates' ); } elseif ($currency == 'daily') { wp_schedule_event( time(), 'twentymin', 'getupdates' ); } } } } else { $timestamp = wp_next_scheduled( 'getupdates' ); // Un-schedule the event wp_unschedule_event( $timestamp, 'getupdates' ); } $time = time(); $time = $time+100; if(wp_next_scheduled('getupdates') && $time>wp_next_scheduled('getupdates')) { add_action( 'init', 'getupdates' ); } add_site_option( 'lastupdateid', '1'); ?>