$this->load();
            $this->add_sample_rule();
        }
    }
    /**
     * Add a sample rule, used upon activation
     *
     */
    public function add_sample_rule()
    {
        $rule = new WP_Stream_Notification_Rule();
        $details = array('author' => 0, 'summary' => __('Sample Rule', 'stream-notifications'), 'visibility' => 'inactive', 'type' => 'notification_rule', 'triggers' => array(array('group' => 0, 'relation' => 'and', 'type' => 'author_role', 'operator' => '!=', 'value' => 'administrator'), array('group' => 0, 'relation' => 'and', 'type' => 'action', 'operator' => '=', 'value' => 'updated'), array('group' => 1, 'relation' => 'and', 'type' => 'author_role', 'operator' => '=', 'value' => 'administrator'), array('group' => 1, 'relation' => 'and', 'type' => 'connector', 'operator' => '=', 'value' => 'widgets'), array('group' => 1, 'relation' => 'and', 'type' => 'action', 'operator' => '=', 'value' => 'sorted')), 'groups' => array(1 => array('group' => 0, 'relation' => 'or')), 'alerts' => array(array('type' => 'email', 'users' => '1', 'emails' => '', 'subject' => sprintf(__('[Site Activity Alert] %s', 'stream-notifications'), get_bloginfo('name')), 'message' => __("The following just happened on your site:\r\n\r\n{summary} by {author.display_name}\r\n\r\nDate of action: {created}", 'stream-notifications'))));
        $rule->load_from_array($details);
        $rule->save();
    }
    /**
     * Return active instance of WP_Stream, create one if it doesn't exist
     *
     * @return WP_Stream
     */
    public static function get_instance()
    {
        if (empty(self::$instance)) {
            $class = __CLASS__;
            self::$instance = new $class();
        }
        return self::$instance;
    }
}
$GLOBALS['wp_stream_notifications'] = WP_Stream_Notifications::get_instance();
register_activation_hook(__FILE__, array($GLOBALS['wp_stream_notifications'], 'on_activation'));