init() public static method

Initialize the VideoPress_Scheduler and get back a singleton instance.
public static init ( ) : VideoPress_Scheduler
return VideoPress_Scheduler
Ejemplo n.º 1
0
 /**
  * Fires on init
  */
 public function on_init()
 {
     add_action('wp_enqueue_media', array($this, 'enqueue_admin_scripts'));
     add_filter('plupload_default_settings', array($this, 'videopress_pluploder_config'));
     add_filter('wp_get_attachment_url', array($this, 'update_attachment_url_for_videopress'), 10, 2);
     add_action('admin_print_footer_scripts', array($this, 'print_in_footer_open_media_add_new'));
     add_action('admin_menu', array($this, 'change_add_new_menu_location'), 999);
     VideoPress_Scheduler::init();
     VideoPress_XMLRPC::init();
 }
Ejemplo n.º 2
0
 /**
  * Actives the given cron job
  *
  * ## OPTIONS
  *
  * <cron_name>: The name of the cron job to check
  *
  * ## EXAMPLES
  *
  * wp videopress deactivate_cron cleanup
  */
 public function deactivate_cron($args)
 {
     if (!isset($args[0])) {
         WP_CLI::error(__('You need to provide the name of the cronjob to schedule.', 'jetpack'));
     }
     $scheduler = VideoPress_Scheduler::init();
     if (!$scheduler->is_cron_valid($args[0])) {
         return WP_CLI::error(sprintf(__('There is no cron named %s.', 'jetpack'), $args[0]));
     }
     $scheduler->deactivate_cron($args[0]);
     WP_CLI::success(sprintf(__('The cron named `%s` was removed from the schedule.', 'jetpack'), $args[0]));
 }