Last active
April 11, 2016 10:40
-
-
Save ianmjones/e3128d04ce517ab0e4cfe2bd10ce347e to your computer and use it in GitHub Desktop.
Cron_Pixie::__construct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Cron_Pixie constructor. | |
* | |
* Registers all action and filter hooks if user can use widget. | |
* | |
* @param array $plugin_meta | |
*/ | |
public function __construct( $plugin_meta = array() ) { | |
if ( empty( $plugin_meta ) ) { | |
return; | |
} | |
$this->plugin_meta = $plugin_meta; | |
// Usage of the plugin is restricted to Administrators. | |
if ( ! current_user_can( 'manage_options' ) ) { | |
return; | |
} | |
// Add the widget during dashboard set up. | |
add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widget' ) ); | |
// Enqueue the CSS & JS scripts. | |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); | |
// AJAX handlers. | |
add_action( 'wp_ajax_cron_pixie_schedules', array( $this, 'ajax_schedules' ) ); | |
add_action( 'wp_ajax_cron_pixie_events', array( $this, 'ajax_events' ) ); | |
// Add a schedule of our own for testing. | |
add_filter( 'cron_schedules', array( $this, 'filter_cron_schedules' ) ); | |
// Add an event to our test schedule. | |
$this->_create_test_event(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment