function autocron() { $enable = isset($_POST['enable']) ? $_POST['enable'] : false; if ($enable !== false) { SendPress_Option::set('autocron', 'yes'); SendPress_Option::set('allow_tracking', 'yes'); SendPress_Cron::use_iron_cron(); $email = get_option('admin_email'); $url = "http://api.sendpress.com/senddiscountcode/" . md5($_SERVER['SERVER_NAME'] . "|" . $email) . "/" . $email; wp_remote_get($url); } else { SendPress_Option::set('autocron', 'no'); } SendPress::add_cron(); exit; }
static function plugin_install() { if (version_compare($GLOBALS['wp_version'], SENDPRESS_MINIMUM_WP_VERSION, '<')) { deactivate_plugins(__FILE__); wp_die(sprintf(__('SendPress requires WordPress version %s or later.', 'sendpress'), SENDPRESS_MINIMUM_WP_VERSION)); } else { SendPress_DB_Tables::install(); @SPNL()->db->subscribers_tracker->create_table(); @SPNL()->db->subscribers_url->create_table(); @SPNL()->db->url->create_table(); } //Make sure we stop the old action from running wp_clear_scheduled_hook('sendpress_cron_action_run'); flush_rewrite_rules(); SendPress::add_cron(); SendPress_Option::set('install_date', time()); }