当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_get_schedule函数代码示例

本文整理汇总了PHP中wp_get_schedule函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_get_schedule函数的具体用法?PHP wp_get_schedule怎么用?PHP wp_get_schedule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_get_schedule函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: schedule_omnibar_update

 public function schedule_omnibar_update()
 {
     if (!wp_get_schedule('idx_omnibar_get_locations')) {
         //refresh omnibar fields once a day
         wp_schedule_event(time(), 'daily', 'idx_omnibar_get_locations');
     }
 }
开发者ID:jdelia,项目名称:wordpress-plugin,代码行数:7,代码来源:initiate-plugin.php

示例2: init

 /**
  * things to run within WordPress init
  */
 public function init()
 {
     if (!wp_get_schedule(static::schedule)) {
         wp_schedule_event(time(), static::schedule, static::schedule);
     }
     return false;
 }
开发者ID:petermolnar,项目名称:blogroll2email,代码行数:10,代码来源:blogroll2email.php

示例3: cp_schedule_expire_check

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');
    }
}
开发者ID:TopLineMediaTeam,项目名称:horseshow,代码行数:26,代码来源:cron.php

示例4: test_deleteOldAlertsIsScheduledAndUnscheduled

 public function test_deleteOldAlertsIsScheduledAndUnscheduled()
 {
     $this->plugin->activate();
     $this->assertEquals('twicedaily', wp_get_schedule('better-angels_delete_old_alerts'));
     $this->plugin->deactivate();
     $this->assertFalse(wp_get_schedule('better-angels_delete_old_alerts'));
 }
开发者ID:adagaria,项目名称:better-angels,代码行数:7,代码来源:test-alerts.php

示例5: hook_init

 function hook_init()
 {
     if (!defined('NEWSLETTER_EXTENSION_UPDATE') || NEWSLETTER_EXTENSION_UPDATE) {
         add_filter('site_transient_update_plugins', array($this, 'hook_site_transient_update_plugins'));
         add_filter('pre_set_site_transient_update_plugins', array($this, 'hook_pre_set_site_transient_update_plugins'));
     } else {
         add_filter('site_transient_update_plugins', array($this, 'hook_site_transient_update_plugins_disable'));
     }
     if ($this->options['enabled'] == 1) {
         add_action('newsletter_mandrill_bounce', array($this, 'bounce'));
         if ($this->options['api'] == 1) {
             if (method_exists('Newsletter', 'register_mail_method')) {
                 Newsletter::instance()->register_mail_method(array($this, 'mail'));
             }
         } else {
             add_filter('newsletter_smtp', array($this, 'hook_newsletter_smtp'));
         }
     }
     if (is_admin()) {
         add_action('admin_init', array($this, 'hook_admin_init'));
         add_action('admin_menu', array($this, 'hook_admin_menu'), 100);
         if (isset($_GET['page']) && strpos($_GET['page'], $this->slug . '/') === 0) {
             wp_enqueue_script('jquery-ui-tabs');
             wp_enqueue_style($this->prefix . '_css', plugin_dir_url(__FILE__) . '/admin.css');
         }
         if (!defined('DOING_CRON') || !DOING_CRON) {
             if (wp_get_schedule('newsletter_mandrill_bounce') === false) {
                 wp_schedule_event(time() + 60, 'daily', 'newsletter_mandrill_bounce');
             }
         }
         //            add_filter('plugin_install_action_links', array($this, 'hook_plugin_install_action_links'), 100, 2);
     }
 }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:33,代码来源:mandrill.php

示例6: test_schedule_and_unschedule_delete_old_alerts_hook_on_activation_and_deactivation

 /**
  * Checks (de)activating the plugin (un)schedules "old" alerts for
  * deletion.
  *
  * It is important for Buoy alerts to be ephemeral in nature, not
  * necessarily stored in a database for a long time. This test is
  * used to make sure that merely activating the plugin is enough
  * to tell the plugin to delete any incident data that was made
  * 48 hours ago (or longer).
  *
  * This test also checks for the inverse: that this scheduled job
  * is automatically removed whenever the plugin is deactivated.
  *
  * Note that this test does *not* ensure the alert data itself is
  * deleted, only that the automatic job scheduler has the correct
  * information.
  *
  * @ticket 21
  */
 public function test_schedule_and_unschedule_delete_old_alerts_hook_on_activation_and_deactivation()
 {
     WP_Buoy_Plugin::activate();
     $this->assertEquals('hourly', wp_get_schedule('buoy_delete_old_alerts', array('-2 days')));
     WP_Buoy_Plugin::deactivate();
     $this->assertFalse(wp_get_schedule('buoy_delete_old_alerts', array('-2 days')));
 }
开发者ID:vincentshadow,项目名称:better-angels,代码行数:26,代码来源:test-alerts.php

示例7: scheduleProcessComments

 public function scheduleProcessComments()
 {
     $options = get_option($this->prefix . 'settings');
     if (!wp_get_schedule($this->prefix . 'process') && 1 === $options['use_txs_polling']) {
         wp_schedule_event(time(), 'hourly', $this->prefix . 'process');
     }
 }
开发者ID:meitar,项目名称:my-two-cents,代码行数:7,代码来源:my-two-cents.php

示例8: initialisePlugin

 public static function initialisePlugin()
 {
     // NB Network activation will not upgrade a site
     // do upgrade will check current upgrade script version and apply as necessary
     upgrader::checkUpgrade();
     // 2 is required for $file to be populated
     add_filter('plugin_row_meta', array(__CLASS__, 'filter_plugin_row_meta'), 10, 2);
     add_action('do_robots', array(__CLASS__, 'addRobotLinks'), 100, 0);
     add_action('wp_head', array(__CLASS__, 'addRssLink'), 100);
     // only include admin files when necessary.
     if (is_admin()) {
         include_once 'settings.php';
         include_once 'postMetaData.php';
         include_once 'categoryMetaData.php';
         settings::addHooks();
         categoryMetaData::addHooks();
         postMetaData::addHooks();
     }
     if (!wp_get_schedule('xmsg_ping')) {
         // ping in 2 hours from when setup.
         wp_schedule_event(time() + 60 * 60 * 2, 'daily', 'xmsg_ping');
     }
     add_action('xmsg_ping', array(__CLASS__, 'doPing'));
     // NB Network activation will not have set up the rules for the site.
     // Check if they exist and then reactivate.
     if (get_option(RULES_OPTION_NAME, null) != RULES_VERSION) {
         add_action('wp_loaded', array(__CLASS__, 'activateRewriteRules'), 99999, 1);
     }
 }
开发者ID:wistel,项目名称:wordpress,代码行数:29,代码来源:core.php

示例9: Enable

 /**
  * Enabled the sitemap plugin with registering all required hooks
  *
  * @uses add_action Adds actions for admin menu, executing pings and handling robots.txt
  * @uses add_filter Adds filtes for admin menu icon and contexual help
  * @uses GoogleSitemapGeneratorLoader::SetupRewriteHooks() Registeres the rewrite hooks
  * @uses GoogleSitemapGeneratorLoader::CallShowPingResult() Shows the ping result on request
  * @uses GoogleSitemapGeneratorLoader::ActivateRewrite() Writes rewrite rules the first time
  */
 public static function Enable()
 {
     //Register the sitemap creator to wordpress...
     add_action('admin_menu', array(__CLASS__, 'RegisterAdminPage'));
     //Nice icon for Admin Menu (requires Ozh Admin Drop Down Plugin)
     add_filter('ozh_adminmenu_icon', array(__CLASS__, 'RegisterAdminIcon'));
     //Additional links on the plugin page
     add_filter('plugin_row_meta', array(__CLASS__, 'RegisterPluginLinks'), 10, 2);
     //Listen to ping request
     add_action('sm_ping', array(__CLASS__, 'CallSendPing'), 10, 1);
     //Listen to daily ping
     add_action('sm_ping_daily', array(__CLASS__, 'CallSendPingDaily'), 10, 1);
     //Existing page was published
     add_action('publish_post', array(__CLASS__, 'SchedulePing'), 999, 1);
     add_action('publish_page', array(__CLASS__, 'SchedulePing'), 9999, 1);
     add_action('delete_post', array(__CLASS__, 'SchedulePing'), 9999, 1);
     //Robots.txt request
     add_action('do_robots', array(__CLASS__, 'CallDoRobots'), 100, 0);
     //Help topics for context sensitive help
     //add_filter('contextual_help_list', array(__CLASS__, 'CallHtmlShowHelpList'), 9999, 2);
     //Check if the result of a ping request should be shown
     if (!empty($_GET["sm_ping_service"])) {
         self::CallShowPingResult();
     }
     //Fix rewrite rules if not already done on activation hook. This happens on network activation for example.
     if (get_option("sm_rewrite_done", null) != self::$svnVersion) {
         add_action('wp_loaded', array(__CLASS__, 'ActivateRewrite'), 9999, 1);
     }
     //Schedule daily ping
     if (!wp_get_schedule('sm_ping_daily')) {
         wp_schedule_event(time() + 60 * 60, 'daily', 'sm_ping_daily');
     }
 }
开发者ID:rongandat,项目名称:best-picture,代码行数:42,代码来源:sitemap-loader.php

示例10: get_transient

 /**
  * 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;
         }
     }
 }
开发者ID:firetreedesign,项目名称:ccbpress-core,代码行数:38,代码来源:class-ccbpress-transients.php

示例11: get_schedule

 public function get_schedule($cron_id)
 {
     $a = wp_get_schedule('fw_backup_cron', array($cron_id));
     if ($a === false) {
         return 'disabled';
     }
     return $a;
 }
开发者ID:chrisuehlein,项目名称:couponsite,代码行数:8,代码来源:class-fw-backup-cron.php

示例12: init

 public function init()
 {
     // get_pung is not restrictive enough
     //add_filter ( 'get_pung', array( &$this, 'get_pung' ) );
     if (!wp_get_schedule(static::cron)) {
         wp_schedule_event(time(), static::cron, static::cron);
     }
 }
开发者ID:petermolnar,项目名称:wp-webmention-again,代码行数:8,代码来源:sender.php

示例13: feature_on

 public function feature_on()
 {
     // Already scheduled
     if (false !== wp_get_schedule(self::CRON_NAME)) {
         return;
     }
     // Schedule cron for this plugin.
     wp_schedule_event(time(), 'daily', self::CRON_NAME);
 }
开发者ID:hiromaki,项目名称:wordpress_blog,代码行数:9,代码来源:siteguard-updates-notify.php

示例14: bpsPro_schedule_DBB_checks

function bpsPro_schedule_DBB_checks()
{
    $bpsDBBCronCheck = wp_get_schedule('bpsPro_DBB_check');
    $DBBoptions = get_option('bulletproof_security_options_db_backup');
    $clock = mktime(date("H", time()), 0, 0, date("n", time()), date("j", time()), date("Y", time()));
    if ($DBBoptions['bps_db_backup'] == 'On') {
        if (!wp_next_scheduled('bpsPro_DBB_check')) {
            wp_schedule_event($clock, 'hourly', 'bpsPro_DBB_check');
        }
    }
}
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:11,代码来源:db-security.php

示例15: _wpr_schedule_crons_initial

function _wpr_schedule_crons_initial()
{
    $cron_schedules = $GLOBALS['wpr_cron_schedules'];
    foreach ($cron_schedules as $cron) {
        if (false == wp_get_schedule($cron['action'], $cron['arguments'])) {
            if (count($cron['arguments']) > 0) {
                wp_schedule_event(time() + 300, $cron['schedule'], $cron['action'], $cron['arguments']);
            } else {
                wp_schedule_event(time() + 300, $cron['schedule'], $cron['action']);
            }
        }
    }
}
开发者ID:anirut,项目名称:wp-autoresponder,代码行数:13,代码来源:cron.php


注:本文中的wp_get_schedule函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。