/** * Check whether WP Cron needs to add new task. */ public function check_cron() { if (!is_admin()) { return; } // set wp cron task if (Post_Views_Counter()->get_attribute('options', 'general', 'cron_run')) { // not set or need to be updated? if (!wp_next_scheduled('pvc_reset_counts') || Post_Views_Counter()->get_attribute('options', 'general', 'cron_update')) { // task is added but need to be updated if (Post_Views_Counter()->get_attribute('options', 'general', 'cron_update')) { // remove old schedule wp_clear_scheduled_hook('pvc_reset_counts'); // set update to false $general = Post_Views_Counter()->get_attribute('options', 'general'); $general['cron_update'] = false; // update settings update_option('post_views_counter_settings_general', $general); } // set schedule wp_schedule_event(Post_Views_Counter()->get_instance('counter')->get_timestamp(Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'type'), Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'number')), 'post_views_counter_interval', 'pvc_reset_counts'); } } else { // remove schedule wp_clear_scheduled_hook('pvc_reset_counts'); remove_action('pvc_reset_counts', array(&$this, 'reset_counts')); } }
/** * Set up crons. CLear any existing scheduled hooks, and add ours. * * @since Astoundify Crowdfunding 1.6 * * @return void */ public static function cron() { wp_clear_scheduled_hook('atcf_check_for_completed_campaigns'); wp_schedule_event(time(), 'hourly', 'atcf_check_for_completed_campaigns'); wp_clear_scheduled_hook('atcf_process_payments'); wp_schedule_event(time(), 'hourly', 'atcf_process_payments'); }
function uninstall() { global $wpdb, $table_prefix; // get name of subscribe2 table $this->public = $table_prefix . "subscribe2"; // delete entry from wp_options table delete_option('subscribe2_options'); // delete legacy entry from wp-options table delete_option('s2_future_posts'); // remove and scheduled events wp_clear_scheduled_hook('s2_digest_cron'); // delete usermeta data for registered users $users = $wpdb->get_col("SELECT ID FROM {$wpdb->users}"); if (!empty($users)) { foreach ($users as $user) { $cats = explode(',', get_usermeta($user, 's2_subscribed')); if ($cats) { foreach ($cats as $cat) { delete_usermeta($user, "s2_cat" . $cat); } } delete_usermeta($user, 's2_subscribed'); } } // drop the subscribe2 table $sql = "DROP TABLE IF EXISTS `" . $this->public . "`"; mysql_query($sql); }
/** * Setup the module's functionality * * Loads the file change detection module's unpriviledged functionality including * performing the scans themselves * * @since 4.0.0 * * @return void */ function run() { global $itsec_globals; $this->settings = get_site_option('itsec_file_change'); $this->running = false; $this->excludes = array('file_change.lock', $itsec_globals['ithemes_backup_dir'], $itsec_globals['ithemes_log_dir'], '.lock'); $interval = 86400; //Run daily // If we're splitting the file check run it every 6 hours. if (isset($this->settings['split']) && true === $this->settings['split']) { $interval = 12342; } add_filter('itsec_logger_modules', array($this, 'itsec_logger_modules')); add_filter('itsec_sync_modules', array($this, 'itsec_sync_modules')); //register sync modules add_action('itsec_execute_file_check_cron', array($this, 'execute_file_check')); //Action to execute during a cron run. if ((!defined('DOING_AJAX') || DOING_AJAX === false) && isset($this->settings['enabled']) && true === $this->settings['enabled'] && isset($this->settings['last_run']) && $itsec_globals['current_time'] - $interval > $this->settings['last_run'] && (!defined('ITSEC_FILE_CHECK_CRON') || false === ITSEC_FILE_CHECK_CRON)) { wp_clear_scheduled_hook('itsec_file_check'); add_action('init', array($this, 'execute_file_check')); } elseif (defined('ITSEC_FILE_CHECK_CRON') && true === ITSEC_FILE_CHECK_CRON && !wp_next_scheduled('itsec_execute_file_check_cron')) { //Use cron if needed wp_schedule_event(time(), 'daily', 'itsec_execute_file_check_cron'); } }
/** * @since 1.4 * @return array */ public function &upgrade() { $major_version = (double) $this->options['version']; if ($major_version < 1.3) { $this->upgradeOptionsUpTo_1_2_2(); // Here the backup() method must be called after upgradeOptionsUpTo_1_2_2() // to let the latter merge the two arrays of options. $this->backup(); delete_transient('sitetree'); delete_option('sitetree_content'); } elseif ($major_version < 1.4) { $this->backup(); $this->upgrade_1_3_Options(); delete_transient('sitetree'); delete_transient('sitetree_xml'); wp_clear_scheduled_hook('sitetree_rebuild'); wp_clear_scheduled_hook('sitetree_rebuild', array('xml')); } elseif ($major_version < 1.5) { $this->backup(); $this->upgrade_1_4_Data(); } elseif ($this->options['version'] === '1.5') { $this->restoreAndUpgradeExceptionsLostWith_1_5(); } else { return $this->options; } return $this->newOptions; }
/** * Sets up gateaway and adds relevant actions/filters */ function __construct() { //Booking Interception if ($this->is_active() && absint(get_option('em_' . $this->gateway . '_booking_timeout')) > 0) { $this->count_pending_spaces = true; } parent::__construct(); $this->status_txt = __('Awaiting PayPal Payment', 'em-pro'); add_action('admin_enqueue_scripts', array(&$this, 'gateway_admin_js')); if ($this->is_active()) { add_action('em_gateway_js', array(&$this, 'em_gateway_js')); //Gateway-Specific add_action('em_template_my_bookings_header', array(&$this, 'say_thanks')); //say thanks on my_bookings page add_filter('em_bookings_table_booking_actions_4', array(&$this, 'bookings_table_actions'), 1, 2); //add_filter('em_my_bookings_booking_actions', array(&$this,'em_my_bookings_booking_actions'),1,2); //set up cron $timestamp = wp_next_scheduled('emp_paypal_cron'); if (absint(get_option('em_paypal_booking_timeout')) > 0 && !$timestamp) { $result = wp_schedule_event(time(), 'em_minute', 'emp_paypal_cron'); } elseif (!$timestamp) { wp_unschedule_event($timestamp, 'emp_paypal_cron'); } } else { //unschedule the cron wp_clear_scheduled_hook('emp_paypal_cron'); } }
function relevanssi_clear_database_tables() { global $wpdb; if (defined('RELEVANSSI_PREMIUM')) { return; } // Relevanssi Premium exists, do not delete the tables wp_clear_scheduled_hook('relevanssi_truncate_cache'); $relevanssi_table = $wpdb->prefix . "relevanssi"; $stopword_table = $wpdb->prefix . "relevanssi_stopwords"; $log_table = $wpdb->prefix . "relevanssi_log"; $relevanssi_cache = $wpdb->prefix . 'relevanssi_cache'; $relevanssi_excerpt_cache = $wpdb->prefix . 'relevanssi_excerpt_cache'; if ($wpdb->get_var("SHOW TABLES LIKE '{$stopword_table}'") == $stopword_table) { $sql = "DROP TABLE {$stopword_table}"; $wpdb->query($sql); } if ($wpdb->get_var("SHOW TABLES LIKE '{$relevanssi_table}'") == $relevanssi_table) { $sql = "DROP TABLE {$relevanssi_table}"; $wpdb->query($sql); } if ($wpdb->get_var("SHOW TABLES LIKE '{$log_table}'") == $log_table) { $sql = "DROP TABLE {$log_table}"; $wpdb->query($sql); } if ($wpdb->get_var("SHOW TABLES LIKE '{$relevanssi_cache}'") == $relevanssi_cache) { $sql = "DROP TABLE {$relevanssi_cache}"; $wpdb->query($sql); } if ($wpdb->get_var("SHOW TABLES LIKE '{$relevanssi_excerpt_cache}'") == $relevanssi_excerpt_cache) { $sql = "DROP TABLE {$relevanssi_excerpt_cache}"; $wpdb->query($sql); } echo '<div id="message" class="updated fade"><p>' . __("Data wiped clean, you can now delete the plugin.", "relevanssi") . '</p></div>'; }
function install_jobroller() { // define vars global $app_theme, $app_version, $jr_log, $wp_rewrite; $jr_log->clear_log(); // Clear cron wp_clear_scheduled_hook('get_indeed_jobs'); wp_clear_scheduled_hook('check_indeed_jobs'); wp_clear_scheduled_hook('jr_get_indeed_jobs'); wp_clear_scheduled_hook('jr_check_indeed_jobs'); wp_clear_scheduled_hook('check_if_jobs_have_expired'); wp_clear_scheduled_hook('jr_check_jobs_expired'); wp_clear_scheduled_hook('get_indeed_jobs'); wp_clear_scheduled_hook('get_indeed_jobs'); wp_clear_scheduled_hook('appthemes_update_check'); update_option('jr_get_indeed_jobs', 'no'); update_option('jr_check_jobs_expired', 'no'); update_option('jr_indeed_xml_index', '0'); // insert the default values jr_default_options(); // insert additional default values jr_default_values(); // run the table install script jr_tables_install(); // create pages and assign templates jr_create_pages(); // insert the default job types jr_create_cats(); // insert the default links jr_insert_links(); //flush the rewrite rules so the new custom post types will automatically work $wp_rewrite->flush_rules(); }
public static function onDeactivation() { $sources = get_option(self::PREFIX . '_sources'); unset($sources[self::SERVICE]); update_option(self::PREFIX . '_sources', $sources); wp_clear_scheduled_hook(self::PREFIX . '_parse', array(self::SERVICE)); }
function wp_rss_multi_deactivation_event() { wp_clear_scheduled_hook('wp_rss_multi_event_importfeeds'); wp_clear_scheduled_hook('wp_rss_multi_event_feedtopost'); wp_clear_scheduled_hook('wp_rss_multi_event_delete_custom_posts'); wp_clear_scheduled_hook('wp_rss_multi_event'); }
function cp_schedule_expire_check() { global $cp_options; $recurrance = $cp_options->ad_expired_check_recurrance; if (empty($recurrance)) { $recurrance = 'daily'; } // clear schedule if prune ads disabled or recurrance set to none if (!$cp_options->post_prune || $recurrance == 'none') { if (wp_next_scheduled('cp_ad_expired_check')) { wp_clear_scheduled_hook('cp_ad_expired_check'); } return; } // set schedule if does not exist if (!wp_next_scheduled('cp_ad_expired_check')) { wp_schedule_event(time(), $recurrance, 'cp_ad_expired_check'); return; } // re-schedule if settings changed $schedule = wp_get_schedule('cp_ad_expired_check'); if ($schedule && $schedule != $recurrance) { wp_clear_scheduled_hook('cp_ad_expired_check'); wp_schedule_event(time(), $recurrance, 'cp_ad_expired_check'); } }
public static function register() { TMM_Event::init(); //TMM_GoogleCalendar::init(); $args = array('labels' => array('name' => __('Events', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'singular_name' => __('Event', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'add_new' => __('Add New', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'add_new_item' => __('Add New Event', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'edit_item' => __('Edit Event', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'new_item' => __('New Event', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'view_item' => __('View Event', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'search_items' => __('Search In Events', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'not_found' => __('Nothing found', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'not_found_in_trash' => __('Nothing found in Trash', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'parent_item_colon' => ''), 'public' => true, 'archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => true, 'menu_position' => null, 'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'tags', 'comments'), 'rewrite' => array('slug' => 'event'), 'show_in_admin_bar' => true, 'taxonomies' => array('events-categories'), 'menu_icon' => 'dashicons-calendar'); register_post_type('event', $args); //*** taxonomies **** register_taxonomy("events-categories", array("event"), array("hierarchical" => true, "labels" => array('name' => __('Events Categories', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'singular_name' => __('Event category', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'add_new' => __('Add New', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'add_new_item' => __('Add New Event category', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'edit_item' => __('Edit Event category', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'new_item' => __('New Event category', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'view_item' => __('View Event category', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'search_items' => __('Search Events categories', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'not_found' => __('No Events categories found', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'not_found_in_trash' => __('No Events categories found in Trash', TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'parent_item_colon' => ''), "singular_label" => __("Events", TMM_EVENTS_PLUGIN_TEXTDOMAIN), 'public' => true, "show_tagcloud" => true, 'query_var' => true, "rewrite" => true, 'show_in_nav_menus' => true, 'capabilities' => array('manage_terms'), 'show_ui' => true)); add_filter("manage_event_posts_columns", array('TMM_Event', "show_edit_columns")); add_action("manage_event_posts_custom_column", array('TMM_Event', "show_edit_columns_content")); //*** add_filter("manage_edit-event_sortable_columns", array('TMM_Event', "event_sortable_columns")); add_action('pre_get_posts', array('TMM_Event', "event_column_orderby")); if (class_exists('TMM')) { $events_set_old_ev_to_draft = TMM::get_option("events_set_old_ev_to_draft"); if ($events_set_old_ev_to_draft) { //set crone add_action('old_events_shedules', array(__CLASS__, 'old_events_shedules')); if (!wp_next_scheduled('old_events_shedules')) { wp_schedule_event(time(), 'hourly', 'old_events_shedules'); } } else { wp_clear_scheduled_hook('old_events_shedules'); } } }
function stop() { if ($this->is_active()) { pnfw_log(PNFW_FEEDBACK_PROVIDER_LOG, __("Un-scheduled Feedback Provider.", 'pnfw')); wp_clear_scheduled_hook('pnfw_feedback_provider_event'); } }
/** * Plugin deactivation actions * * @since 1.4.0 * @change 1.4.0 */ public static function init() { /* Delete transients */ delete_transient('statify_data'); /* Delete cron event */ wp_clear_scheduled_hook('statify_cleanup'); }
function tin_clear_newsletter_event() { global $pagenow; if ('themes.php' == $pagenow && isset($_GET['activated'])) { wp_clear_scheduled_hook('tin_newsletter_weekly_hook'); } }
function reset_transients() { delete_transient('sendpress_weekly_post_notification_check'); delete_transient('sendpress_daily_post_notification_check'); delete_transient('sendpress_post_notification_check'); wp_clear_scheduled_hook('sendpress_post_notification_check'); }
public static function fp_rac_cron_job_setting_savings() { wp_clear_scheduled_hook('rac_cron_job'); if (wp_next_scheduled('rac_cron_job') == false) { wp_schedule_event(time(), 'xhourly', 'rac_cron_job'); } }
/** * Setup cron jobs */ public function cron() { wp_clear_scheduled_hook('job_manager_check_for_expired_jobs'); wp_clear_scheduled_hook('job_manager_delete_old_previews'); wp_schedule_event(time(), 'hourly', 'job_manager_check_for_expired_jobs'); wp_schedule_event(time(), 'daily', 'job_manager_delete_old_previews'); }
/** * Install the hooks required to run periodic update checks and inject update info * into WP data structures. * * @return void */ function installHooks() { //Override requests for plugin information add_filter('plugins_api', array(&$this, 'injectInfo'), 10, 3); //Insert our update info into the update array maintained by WP add_filter('site_transient_update_plugins', array(&$this, 'injectUpdate')); //WP 3.0+ add_filter('transient_update_plugins', array(&$this, 'injectUpdate')); //WP 2.8+ //Set up the periodic update checks $cronHook = 'check_plugin_updates-' . $this->slug; if ($this->checkPeriod > 0) { //Trigger the check via Cron add_filter('cron_schedules', array(&$this, '_addCustomSchedule')); if (!wp_next_scheduled($cronHook) && !defined('WP_INSTALLING')) { $scheduleName = 'every' . $this->checkPeriod . 'hours'; wp_schedule_event(time(), $scheduleName, $cronHook); } add_action($cronHook, array(&$this, 'checkForUpdates')); //In case Cron is disabled or unreliable, we also manually trigger //the periodic checks while the user is browsing the Dashboard. add_action('admin_init', array(&$this, 'maybeCheckForUpdates')); } else { //Periodic checks are disabled. wp_clear_scheduled_hook($cronHook); } //Add action for extra notifications add_action('in_plugin_update_message-' . $this->pluginFile, array(&$this, 'maybeInjectUpgradeNotice'), 10, 2); }
public function __construct($logger) { // do not run this plugin on local or staging if (defined("ENV") && (ENV == "local" || ENV == "staging")) { return; } $this->logger = $logger; add_action("admin_init", function () { if (defined("ENV") && ENV == "local") { deactivate_plugins(plugin_basename(__FILE__)); } }); if (defined("ENV") && ENV != "local") { register_activation_hook(__FILE__, function () { wp_schedule_event(time(), "daily", "wp_location_grams_import"); wp_schedule_event(time(), "daily", "wp_location_grams_archive"); }); add_action("wp_location_grams_import", array($this, "import")); add_action("wp_location_grams_archive", array($this, "archive")); register_deactivation_hook(__FILE__, function () { wp_clear_scheduled_hook("wp_location_grams_import"); wp_clear_scheduled_hook("wp_location_grams_archive"); }); } // add_action("admin_init", array($this, "import")); // for auto import // add_action("admin_init", array($this, "archive")); // for auto archive }
function sp_cron_remove_users() { require_once ABSPATH . 'wp-admin/includes/user.php'; # make sure auto removal is enabled $sfuser = sp_get_option('sfuserremoval'); if ($sfuser['sfuserremove']) { # see if removing users with no posts if ($sfuser['sfusernoposts']) { $users = spdb_select('set', 'SELECT ' . SFUSERS . '.ID FROM ' . SFUSERS . ' JOIN ' . SFMEMBERS . ' on ' . SFUSERS . '.ID = ' . SFMEMBERS . '.user_id LEFT JOIN ' . SFWPPOSTS . ' ON ' . SFUSERS . '.ID = ' . SFWPPOSTS . '.post_author WHERE user_registered < DATE_SUB(NOW(), INTERVAL ' . $sfuser['sfuserperiod'] . ' DAY) AND post_author IS NULL AND posts < 1'); if ($users) { foreach ($users as $user) { wp_delete_user($user->ID); } } } # see if removing inactive users if ($sfuser['sfuserinactive']) { $users = spdb_table(SFMEMBERS, 'lastvisit < DATE_SUB(NOW(), INTERVAL ' . $sfuser['sfuserperiod'] . ' DAY)'); if ($users) { foreach ($users as $user) { wp_delete_user($user->user_id); } } } } else { wp_clear_scheduled_hook('sph_cron_user'); } do_action('sph_remove_users_cron'); }
function admin_init() { if (!function_exists("remove_action")) { return; } do_action('ekandreas/nowpupdates/pre_admin_init'); remove_action('load-themes.php', 'wp_update_themes'); remove_action('load-update.php', 'wp_update_themes'); remove_action('admin_init', '_maybe_update_themes'); remove_action('wp_update_themes', 'wp_update_themes'); wp_clear_scheduled_hook('wp_update_themes'); remove_action('load-update-core.php', 'wp_update_themes'); wp_clear_scheduled_hook('wp_update_themes'); remove_action('load-plugins.php', 'wp_update_plugins'); remove_action('load-update.php', 'wp_update_plugins'); remove_action('admin_init', '_maybe_update_plugins'); remove_action('wp_update_plugins', 'wp_update_plugins'); wp_clear_scheduled_hook('wp_update_plugins'); remove_action('load-update-core.php', 'wp_update_plugins'); wp_clear_scheduled_hook('wp_update_plugins'); add_action('init', create_function('', 'remove_action( \'init\', \'wp_version_check\' );'), 2); add_filter('pre_option_update_core', '__return_null'); remove_action('wp_version_check', 'wp_version_check'); remove_action('admin_init', '_maybe_update_core'); wp_clear_scheduled_hook('wp_version_check'); wp_clear_scheduled_hook('wp_version_check'); remove_action('wp_maybe_auto_update', 'wp_maybe_auto_update'); remove_action('admin_init', 'wp_maybe_auto_update'); remove_action('admin_init', 'wp_auto_update_core'); wp_clear_scheduled_hook('wp_maybe_auto_update'); do_action('ekandreas/nowpupdates/post_admin_init'); }
/** * Set up the API module. * * @since 4.0.0 * @internal */ public function __construct() { if (WPMUDEV_CUSTOM_API_SERVER) { $this->server_root = trailingslashit(WPMUDEV_CUSTOM_API_SERVER); } $this->server_url = $this->server_root . $this->rest_api; if (defined('WPMUDEV_APIKEY') && WPMUDEV_APIKEY) { $this->api_key = WPMUDEV_APIKEY; } else { // If 'clear_key' is present in URL then do not load the key from DB. $this->api_key = get_site_option('wpmudev_apikey'); } // Schedule automatic data update on the main site of the network. if (is_main_site()) { if (!wp_next_scheduled('wpmudev_scheduled_jobs')) { wp_schedule_event(time(), 'twicedaily', 'wpmudev_scheduled_jobs'); } add_action('wpmudev_scheduled_jobs', array($this, 'refresh_membership_data')); } elseif (wp_next_scheduled('wpmudev_scheduled_jobs')) { // In case the cron job was already installed in a sub-site... wp_clear_scheduled_hook('wpmudev_scheduled_jobs'); } /** * Run custom initialization code for the API module. * * @since 4.0.0 * @var WPMUDEV_Dashboard_Api The dashboards API module. */ do_action('wpmudev_dashboard_api_init', $this); }
/** * Get the data from the transient and/or schedule new data to be retrieved. * * @param string $transient The name of the transient. Must be 43 characters or less including $this->transient_prefix. * @param string $hook The name of the hook to retrieve new data. * @param array $args An array of arguments to pass to the function. * * @return mixed Either false or the data from the transient. */ public function get_transient($transient, $hook, $args) { // Build the transient names. $transient = $this->prefix . $transient; $fallback_transient = $transient . '_'; if (is_multisite()) { if (false === ($data = get_site_transient($transient))) { $data = get_site_transient($fallback_transient); if (!wp_get_schedule($hook, $args)) { wp_clear_scheduled_hook($hook, $args); wp_schedule_single_event(time(), $hook, $args); } return $data; } else { return $data; } } else { if (false === ($data = get_transient($transient))) { $data = get_transient($fallback_transient); if (!wp_get_schedule($hook, $args)) { wp_clear_scheduled_hook($hook, $args); wp_schedule_single_event(time(), $hook, $args); } return $data; } else { return $data; } } }
function rt_wp_nginx_helper_uninstall() { wp_clear_scheduled_hook('rt_wp_nginx_helper_check_log_file_size_daily'); delete_site_option('rt_wp_nginx_helper_options'); rt_wp_nginx_helper_remove_capability('Nginx Helper | Config'); rt_wp_nginx_helper_remove_capability('Nginx Helper | Purge cache'); }
/** * Send an alert */ public function job_manager_alert($alert_id, $force = false) { $alert = get_post($alert_id); if (!$alert || $alert->post_type !== 'job_alert') { return; } if ($alert->post_status !== 'publish' && !$force) { return; } $user = get_user_by('id', $alert->post_author); $jobs = $this->get_matching_jobs($alert, $force); if ($jobs->found_posts || !get_option('job_manager_alerts_matches_only')) { $email = $this->format_email($alert, $user, $jobs); add_filter('wp_mail_from_name', array($this, 'mail_from_name')); add_filter('wp_mail_from', array($this, 'mail_from_email')); if ($email) { wp_mail($user->user_email, apply_filters('job_manager_alerts_subject', sprintf(__('Job Alert Results Matching "%s"', 'wp-job-manager-alerts'), $alert->post_title), $alert), $email); } remove_filter('wp_mail_from_name', array($this, 'mail_from_name')); remove_filter('wp_mail_from', array($this, 'mail_from_email')); } if (($days_to_disable = get_option('job_manager_alerts_auto_disable')) > 0) { $days = (strtotime('NOW') - strtotime($alert->post_modified)) / (60 * 60 * 24); if ($days > $days_to_disable) { $update_alert = array(); $update_alert['ID'] = $alert->ID; $update_alert['post_status'] = 'draft'; wp_update_post($update_alert); wp_clear_scheduled_hook('job-manager-alert', array($alert->ID)); return; } } // Inc sent count update_post_meta($alert->ID, 'send_count', 1 + absint(get_post_meta($alert->ID, 'send_count', true))); }
function ajax_calls($call, $data) { global $sitepress_settings, $sitepress; switch ($call) { case 'set_pickup_mode': $method = intval($data['icl_translation_pickup_method']); $iclsettings['translation_pickup_method'] = $method; $sitepress->save_settings($iclsettings); if (!empty($sitepress_settings)) { $data['site_id'] = $sitepress_settings['site_id']; $data['accesskey'] = $sitepress_settings['access_key']; $data['create_account'] = 0; $data['pickup_type'] = $method; $icl_query = new ICanLocalizeQuery(); $res = $icl_query->updateAccount($data); } if ($method == ICL_PRO_TRANSLATION_PICKUP_XMLRPC) { wp_clear_scheduled_hook('icl_hourly_translation_pickup'); } else { wp_schedule_event(time(), 'hourly', 'icl_hourly_translation_pickup'); } echo json_encode(array('message' => 'OK')); break; case 'pickup_translations': if ($sitepress_settings['translation_pickup_method'] == ICL_PRO_TRANSLATION_PICKUP_POLLING) { $fetched = $this->poll_for_translations(true); echo json_encode(array('message' => 'OK', 'fetched' => urlencode(' ' . sprintf(__('Fetched %d translations.', 'sitepress'), $fetched)))); } else { echo json_encode(array('error' => __('Manual pick up is disabled.', 'sitepress'))); } break; } }
/** * Setup the module's functionality * * Loads the file change detection module's unpriviledged functionality including * performing the scans themselves * * @since 4.0.0 * * @return void */ function run() { global $itsec_globals; $settings = ITSEC_Modules::get_settings('file-change'); $interval = 86400; //Run daily // If we're splitting the file check run it every 6 hours. if (isset($settings['split']) && true === $settings['split']) { $interval = 12342; } add_action('itsec_execute_file_check_cron', array($this, 'run_scan')); //Action to execute during a cron run. add_filter('itsec_logger_displays', array($this, 'itsec_logger_displays')); //adds logs metaboxes add_filter('itsec_logger_modules', array($this, 'itsec_logger_modules')); add_filter('itsec_sync_modules', array($this, 'itsec_sync_modules')); //register sync modules if ((!defined('DOING_AJAX') || DOING_AJAX === false) && isset($settings['last_run']) && $itsec_globals['current_time'] - $interval > $settings['last_run'] && (!defined('ITSEC_FILE_CHECK_CRON') || false === ITSEC_FILE_CHECK_CRON)) { wp_clear_scheduled_hook('itsec_file_check'); add_action('init', array($this, 'run_scan')); } elseif (defined('ITSEC_FILE_CHECK_CRON') && true === ITSEC_FILE_CHECK_CRON && !wp_next_scheduled('itsec_execute_file_check_cron')) { //Use cron if needed wp_schedule_event(time(), 'daily', 'itsec_execute_file_check_cron'); } }
function degg_remove_notifications() { if (!current_user_can('edit_dashboard')) { delete_site_transient('update_core'); remove_action('admin_init', '_maybe_update_core'); remove_action('wp_version_check', 'wp_version_check'); wp_clear_scheduled_hook('wp_version_check'); remove_action('init', 'wp_schedule_update_checks'); delete_site_transient('update_plugins'); remove_action('admin_init', '_maybe_update_plugins'); remove_action('load-plugins.php', 'wp_update_plugins'); remove_action('load-update-core.php', 'wp_update_plugins'); remove_action('load-update.php', 'wp_update_plugins'); remove_action('wp_update_plugins', 'wp_update_plugins'); wp_clear_scheduled_hook('wp_update_plugins'); delete_site_transient('update_themes'); remove_action('admin_init', '_maybe_update_themes'); remove_action('load-themes.php', 'wp_update_themes'); remove_action('load-update-core.php', 'wp_update_themes'); remove_action('load-update.php', 'wp_update_themes'); remove_action('wp_update_themes', 'wp_update_themes'); wp_clear_scheduled_hook('wp_update_themes'); add_action('admin_print_styles', 'degg_admin_editor_styles'); } }
function bebop_general_admin_update_settings() { if (!empty($_GET['page'])) { $current_page = $_GET['page']; if ($current_page == 'bebop_admin_settings') { $edited = false; if (isset($_POST['bebop_general_crontime'])) { $crontime = trim(strip_tags(strtolower($_POST['bebop_general_crontime']))); $result = bebop_tables::update_option('bebop_general_crontime', $crontime); wp_clear_scheduled_hook('bebop_main_import_cron'); //Stops the cron if ($crontime > 0) { //if cron time is > 0, reschedule the cron. If zero, do not reschedule wp_schedule_event(time(), 'bebop_main_cron_time', 'bebop_main_import_cron'); //Re-activate with new time. } $_SESSION['bebop_admin_notice'] = true; $edited = true; } if ($edited == true) { check_admin_referer('bebop_admin_settings'); wp_safe_redirect(wp_get_referer()); } } } }