本文整理汇总了PHP中wp_next_scheduled函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_next_scheduled函数的具体用法?PHP wp_next_scheduled怎么用?PHP wp_next_scheduled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_next_scheduled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
if (!wp_next_scheduled('fileaway_scheduled_cleanup')) {
wp_schedule_event(time(), 'hourly', 'fileaway_scheduled_cleanup');
}
add_action('fileaway_scheduled_cleanup', array($this, 'cleanup'));
}
示例2: __construct
function __construct() {
global $itsec_globals;
//make sure the log file info is there or generate it. This should only affect beta users.
if ( ! isset( $itsec_globals['settings']['log_info'] ) ) {
$itsec_globals['settings']['log_info'] = substr( sanitize_title( get_bloginfo( 'name' ) ), 0, 20 ) . '-' . ITSEC_Lib::get_random( mt_rand( 0, 10 ) );
update_site_option( 'itsec_global', $itsec_globals['settings'] );
}
//Make sure the logs directory was created
if ( ! is_dir( $itsec_globals['ithemes_log_dir'] ) ) {
@mkdir( trailingslashit( $itsec_globals['ithemes_dir'] ) . 'logs' );
}
//don't create a log file if we don't need it.
if ( isset( $itsec_globals['settings']['log_type'] ) && $itsec_globals['settings']['log_type'] !== 0 ) {
$this->log_file = $itsec_globals['ithemes_log_dir'] . '/event-log-' . $itsec_globals['settings']['log_info'] . '.log';
$this->start_log(); //create a log file if we don't have one
}
$this->logger_modules = array(); //array to hold information on modules using this feature
$this->logger_displays = array(); //array to hold metabox information
$this->module_path = ITSEC_Lib::get_module_path( __FILE__ );
add_action( 'plugins_loaded', array( $this, 'register_modules' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_script' ) ); //enqueue scripts for admin page
//Run database cleanup daily with cron
if ( ! wp_next_scheduled( 'itsec_purge_logs' ) ) {
wp_schedule_event( time(), 'daily', 'itsec_purge_logs' );
}
add_action( 'itsec_purge_logs', array( $this, 'purge_logs' ) );
if ( is_admin() ) {
require( trailingslashit( $itsec_globals['plugin_dir'] ) . 'core/lib/class-itsec-wp-list-table.php' ); //used for generating log tables
add_action( 'itsec_add_admin_meta_boxes', array( $this, 'add_admin_meta_boxes' ) ); //add log meta boxes
}
if ( isset( $_POST['itsec_clear_logs'] ) && $_POST['itsec_clear_logs'] === 'clear_logs' ) {
global $itsec_clear_all_logs;
$itsec_clear_all_logs = true;
add_action( 'plugins_loaded', array( $this, 'purge_logs' ) );
}
}
示例3: load
public function load($parent)
{
$this->parent = $parent;
//delete_option('redux-framework-tracking');
$this->options = get_option('redux-framework-tracking');
$this->options['dev_mode'] = $parent->args['dev_mode'];
if (!isset($this->options['hash']) || !$this->options['hash'] || empty($this->options['hash'])) {
$this->options['hash'] = md5(site_url() . '-' . $_SERVER['REMOTE_ADDR']);
update_option('redux-framework-tracking', $this->options);
}
if (isset($_GET['redux_framework_disable_tracking']) && !empty($_GET['redux_framework_disable_tracking'])) {
$this->options['allow_tracking'] = false;
update_option('redux-framework-tracking', $this->options);
}
if (isset($_GET['redux_framework_enable_tracking']) && !empty($_GET['redux_framework_enable_tracking'])) {
$this->options['allow_tracking'] = true;
update_option('redux-framework-tracking', $this->options);
}
if (isset($_GET['page']) && $_GET['page'] == $this->parent->args['page_slug']) {
if (!isset($this->options['allow_tracking'])) {
add_action('admin_enqueue_scripts', array($this, '_enqueue_tracking'));
} else {
if (!isset($this->options['tour']) && ($this->parent->args['dev_mode'] == "true" || $this->parent->args['page_slug'] == "redux_demo")) {
add_action('admin_enqueue_scripts', array($this, '_enqueue_newsletter'));
}
}
}
if (isset($this->options['allow_tracking']) && $this->options['allow_tracking'] == true) {
// The tracking checks daily, but only sends new data every 7 days.
if (!wp_next_scheduled('redux_tracking')) {
wp_schedule_event(time(), 'daily', 'redux_tracking');
}
add_action('redux_tracking', array($this, 'tracking'));
}
}
示例4: wordcamp_dev_test_cron_jobs
/**
* Run cron jobs more frequently so don't have to wait to test results
*/
function wordcamp_dev_test_cron_jobs()
{
/** @var $camptix CampTix_Plugin */
/** @var $camptix_network_dashboard CampTix_Network_Dashboard */
/** @var $WCOR_Mailer WCOR_Mailer */
global $camptix, $camptix_network_dashboard, $WCOR_Mailer;
// Schedule custom events
if (!wp_next_scheduled('wordcamp_dev_10_seconds')) {
wp_schedule_event(time(), '10-seconds', 'wordcamp_dev_10_seconds');
}
if (!wp_next_scheduled('wordcamp_dev_30_seconds')) {
wp_schedule_event(time(), '30-seconds', 'wordcamp_dev_30_seconds');
}
if (!wp_next_scheduled('wordcamp_dev_45_seconds')) {
wp_schedule_event(time(), '45-seconds', 'wordcamp_dev_45_seconds');
}
if (!wp_next_scheduled('wordcamp_dev_60_seconds')) {
wp_schedule_event(time(), '60-seconds', 'wordcamp_dev_60_seconds');
}
// Fire cron jobs on fast hooks
if (isset($camptix_network_dashboard)) {
add_action('wordcamp_dev_10_seconds', array($camptix_network_dashboard, 'gather_events_data'));
add_action('wordcamp_dev_60_seconds', array($camptix_network_dashboard, 'update_revenue_reports_data'));
}
if (isset($WCOR_Mailer)) {
add_action('wordcamp_dev_10_seconds', array($WCOR_Mailer, 'send_timed_emails'));
}
}
示例5: test_it_creates_cron_event_on_add
function test_it_creates_cron_event_on_add()
{
$actual = $this->client->add('cron_action_a');
$this->assertTrue($actual);
$next_event = wp_next_scheduled('cron_action_a', array());
$this->assertEquals(time(), $next_event, '', 1000);
}
示例6: run
/**
* 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');
}
}
示例7: run
/**
* 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');
}
}
示例8: init
function init()
{
global $wpmudev_un;
if (class_exists('WPMUDEV_Dashboard') || isset($wpmudev_un->version) && version_compare($wpmudev_un->version, '3.4', '<')) {
return;
}
// Schedule update cron on main site only
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, 'updates_check'));
}
add_action('delete_site_transient_update_plugins', array(&$this, 'updates_check'));
//refresh after upgrade/install
add_action('delete_site_transient_update_themes', array(&$this, 'updates_check'));
//refresh after upgrade/install
if (is_admin() && current_user_can('install_plugins')) {
add_action('site_transient_update_plugins', array(&$this, 'filter_plugin_count'));
add_action('site_transient_update_themes', array(&$this, 'filter_theme_count'));
add_filter('plugins_api', array(&$this, 'filter_plugin_info'), 101, 3);
//run later to work with bad autoupdate plugins
add_filter('themes_api', array(&$this, 'filter_plugin_info'), 101, 3);
//run later to work with bad autoupdate plugins
add_action('admin_init', array(&$this, 'filter_plugin_rows'), 15);
//make sure it runs after WP's
add_action('core_upgrade_preamble', array(&$this, 'disable_checkboxes'));
add_action('activated_plugin', array(&$this, 'set_activate_flag'));
//remove version 1.0
remove_action('admin_notices', 'wdp_un_check', 5);
remove_action('network_admin_notices', 'wdp_un_check', 5);
//remove version 2.0, a bit nasty but only way
remove_all_actions('all_admin_notices', 5);
//if dashboard is installed but not activated
if (file_exists(WP_PLUGIN_DIR . '/wpmudev-updates/update-notifications.php')) {
if (!get_site_option('wdp_un_autoactivated')) {
//include plugin API if necessary
if (!function_exists('activate_plugin')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$result = activate_plugin('/wpmudev-updates/update-notifications.php', network_admin_url('admin.php?page=wpmudev'), is_multisite());
if (!is_wp_error($result)) {
//if autoactivate successful don't show notices
update_site_option('wdp_un_autoactivated', 1);
return;
}
}
add_action('admin_print_styles', array(&$this, 'notice_styles'));
add_action('all_admin_notices', array(&$this, 'activate_notice'), 5);
} else {
//dashboard not installed at all
if (get_site_option('wdp_un_autoactivated')) {
update_site_option('wdp_un_autoactivated', 0);
//reset flag when dashboard is deleted
}
add_action('admin_print_styles', array(&$this, 'notice_styles'));
add_action('all_admin_notices', array(&$this, 'install_notice'), 5);
}
}
}
示例9: cron_schedule
function cron_schedule()
{
// Public Notices
if (!wp_next_scheduled('cron_notices_hourly')) {
wp_schedule_event(time(), 'hourly', 'cron_notices_hourly');
}
// News
if (!wp_next_scheduled('cron_news_hourly')) {
wp_schedule_event(time(), 'hourly', 'cron_news_hourly');
}
/*
// Events
if ( !wp_next_scheduled( 'cron_events_hourly' ) ) {
wp_schedule_event(time(), 'hourly', 'cron_events_hourly');
}
if ( !wp_next_scheduled( 'cron_notices_minute' ) ) {
wp_schedule_event(time(), 'minute', 'cron_notices_minute');
}
// News
if ( !wp_next_scheduled( 'cron_news_minute' ) ) {
wp_schedule_event(time(), 'minute', 'cron_news_minute');
}
*/
// Test by the minute
if (!wp_next_scheduled('cron_events_minute')) {
wp_schedule_event(time(), 'minute', 'cron_events_minute');
}
}
示例10: hook
/**
* Add hooks.
*/
public function hook()
{
if (!wp_next_scheduled('boxzilla_check_license_status')) {
wp_schedule_event(time(), 'daily', 'boxzilla_check_license_status');
}
add_action('boxzilla_check_license_status', array($this, 'run'));
}
示例11: registerCronTask
/**
* Register a cron task
* @param string $cronActionName The name of the action that will be registered with wp-cron
* @param string $callback The function to register with wp-cron
* @param string $interval can only be one of the following: hourly, daily and twicedaily if no other custom intervals are registered. Defaults to daily
* @return void
*/
public static function registerCronTask($cronActionName, $callback, $interval = 'daily')
{
if (!is_callable($callback)) {
return;
}
// if cron disabled -> run callback
if (!self::canRegisterCronTask()) {
self::registerTask($callback);
return;
}
$interval = strtolower($interval);
if (empty($interval)) {
$interval = 'daily';
} else {
// check to see if the time interval is valid
$timeIntervals = wp_get_schedules();
if (!array_key_exists($interval, $timeIntervals)) {
$interval = 'daily';
}
}
// avoid duplicate crons
add_action($cronActionName, $callback);
if (!wp_next_scheduled($cronActionName)) {
wp_schedule_event(time(), $interval, $cronActionName);
array_push(self::$_cronTasks, $cronActionName);
}
}
示例12: cbrobot_create_cronjob
function cbrobot_create_cronjob()
{
$options = unserialize(get_option("cbrobot_options"));
if (!wp_next_scheduled('cbrobot_job_event')) {
wp_schedule_event(time(), $options['cbrobot_time'], 'cbrobot_job_event');
}
}
示例13: fp_rac_cron_job_setting_savings
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');
}
}
示例14: _add_hooks
private function _add_hooks()
{
add_action('eab_scheduled_jobs', array($this, 'archive_old_events'));
if (!wp_next_scheduled('eab_scheduled_jobs')) {
wp_schedule_event(eab_current_time(), 'hourly', 'eab_scheduled_jobs');
}
}
示例15: cliv_create_recurring_schedule
function cliv_create_recurring_schedule()
{
if (!wp_next_scheduled('cliv_recurring_cron_job')) {
//shedule event to run after every hour
wp_schedule_event(time(), 'daily', 'cliv_recurring_cron_job');
}
}