Plugin Directory

Changeset 1894854


Ignore:
Timestamp:
06/19/2018 12:22:14 AM (8 years ago)
Author:
wpdashboard
Message:

Moving to Webhooks

Location:
wp-dashboard/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • wp-dashboard/trunk/includes/class-wpdashboard-activator.php

    r1809618 r1894854  
    3838            }
    3939        }
     40        if (! wp_next_scheduled ( 'wpdashboard_send_updates_available', [] )) {
     41            wp_schedule_event( time(), 'hourly', 'wpdashboard_send_updates_available', [] );
     42        }
    4043    }
    4144
  • wp-dashboard/trunk/includes/class-wpdashboard-deactivator.php

    r1821677 r1894854  
    4141        delete_option('wpdashboard_admin_user');
    4242        delete_option('wpdashboard_tag_manager_id');
     43
     44        wp_clear_scheduled_hook( 'wpdashboard_send_updates_available' );
    4345    }
    4446
  • wp-dashboard/trunk/webhooks/lib/class-wpdashboard-plugins.php

    r1847202 r1894854  
    2727trait Wpdashboard_Plugins {
    2828
     29    /**
     30     * Init Plugins
     31     *
     32     * Initialize the Wordpress Plugins
     33     * class and add the actions to the
     34     * specified hooks required.
     35     *
     36     * @since 2.0.0
     37     *
     38     * @return void
     39     */
    2940    public function initPlugins() {
    3041//        add_action( 'activated_plugin', [$this, 'plugin_installed'], 10, 2);
     
    3445    }
    3546
     47    /**
     48     * Plugin Installed
     49     *
     50     * Fires when a plugin is installed.
     51     *
     52     * @since 2.0.0
     53     *
     54     * @param $plugin
     55     * @param $network_activation
     56     */
    3657    public function plugin_installed($plugin, $network_activation) {
    3758        //TODO:: Implement Plugin Installation Tracking
    3859    }
    3960
     61    /**
     62     * Plugin Activated
     63     *
     64     * Fires when a plugin is activated.
     65     *
     66     * @since 2.0.0
     67     *
     68     * @param $plugin
     69     * @param $network_activation
     70     */
    4071    public function plugin_activated($plugin, $network_activation) {
    4172        $body = [
     
    4778    }
    4879
     80    /**
     81     * Plugin Deactivated
     82     *
     83     * Fires when a plugin is deactivated.
     84     *
     85     * @since 2.0.0
     86     *
     87     * @param $plugin
     88     * @param $network_deactivation
     89     */
    4990    public function plugin_deactivated($plugin, $network_deactivation) {
    5091        $body = [
     
    5697    }
    5798
     99    /**
     100     * Plugin Deleted
     101     *
     102     * Fires when a plugin is deleted.
     103     *
     104     * @since 2.0.0
     105     *
     106     * @param $plugin
     107     * @param $deleted
     108     */
    58109    public function plugin_deleted($plugin, $deleted) {
    59110        $body = [
  • wp-dashboard/trunk/webhooks/lib/class-wpdashboard-themes.php

    r1847202 r1894854  
    2727trait Wpdashboard_Themes {
    2828
     29    /**
     30     * Init Themes
     31     *
     32     * Initialize the Wordpress Themes
     33     * class and add the actions to the
     34     * specified hooks required.
     35     *
     36     * @since 2.0.0
     37     *
     38     * @return void
     39     */
    2940    public function initThemes() {
    3041        add_action( 'switch_theme', [$this, 'theme_switched'], 10, 3);
    3142    }
    3243
     44    /**
     45     * Theme Switched
     46     *
     47     * Fires when a theme is switched.
     48     *
     49     * @since 2.0.0
     50     *
     51     * @param $new_name
     52     * @param $new_theme
     53     * @param $old_theme
     54     */
    3355    public function theme_switched($new_name, $new_theme, $old_theme) {
    3456        $body = [
  • wp-dashboard/trunk/webhooks/lib/class-wpdashboard-users.php

    r1847202 r1894854  
    2727trait Wpdashboard_Users {
    2828
     29    /**
     30     * Init Users
     31     *
     32     * Initialize the Wordpress Users
     33     * class and add the actions to the
     34     * specified hooks required.
     35     *
     36     * @since 2.0.0
     37     *
     38     * @return void
     39     */
    2940    public function initUsers() {
     41        add_action( 'user_register', [$this, 'user_registered'], 10, 1);
    3042        add_action( 'switch_theme', [$this, 'theme_switched'], 10, 3);
    3143    }
    3244
     45    /**
     46     * User Registered
     47     *
     48     * Fires when a new user is registered.
     49     *
     50     * @since 2.0.0
     51     *
     52     * @param $user_id
     53     */
     54    public function user_registered($user_id) {
     55        $user = get_user_by('ID', $user_id);
     56        $body = [
     57            'user' => $user,
     58        ];
     59        parent::post('user/registered', $body);
     60    }
     61
     62    /**
     63     * Update User
     64     *
     65     * Fires when a user is updated.
     66     *
     67     * @since 2.0.0
     68     *
     69     * @param $new_name
     70     * @param $new_theme
     71     * @param $old_theme
     72     */
    3373    public function theme_switched($new_name, $new_theme, $old_theme) {
    3474        $body = [
  • wp-dashboard/trunk/wpdashboard.php

    r1824829 r1894854  
    5959 */
    6060require plugin_dir_path( __FILE__ ) . 'includes/class-wpdashboard.php';
     61require plugin_dir_path( __FILE__ ) . 'includes/class-wpdashboard-updates.php';
    6162
    6263/**
     
    7475    $plugin->run();
    7576
     77    add_action( 'wpdashboard_send_updates_available', 'wpdashboard_send_updates_available_now', 10, 2 );
     78
    7679}
    7780
     
    8285}
    8386
     87function wpdashboard_send_updates_available_now($args_1, $args_2 ) {
     88    WpDashboard_Updates::send();
     89}
     90
    8491run_wpdashboard();
Note: See TracChangeset for help on using the changeset viewer.