/**
  * Specifies the classname and description, instantiates the widget,
  * loads localization files, and includes necessary stylesheets and JavaScript.
  */
 public function __construct()
 {
     /*
      * Call $plugin_slug from public plugin class.
      *
      */
     $this->plugin = Super_Simple_Events::get_instance();
     $this->widget_id = $this->plugin->get_plugin_slug() . '-id';
     parent::__construct($this->widget_id, sprintf(__('Upcoming Events (%s)', $this->plugin->get_plugin_slug()), $this->plugin->get_plugin_name()), array('classname' => $this->plugin->get_plugin_slug() . '-class', 'description' => sprintf(__('Display a list of upcoming events created in the %s plugin', $this->plugin->get_plugin_slug()), $this->plugin->get_plugin_name())));
     $this->alt_option_name = 'widget_' . $this->plugin->get_plugin_slug();
     // Register site styles and scripts
     add_action('wp_enqueue_scripts', array($this, 'register_widget_styles'));
     // Refreshing the widget's cached output with each new post
     add_action('save_post', array($this, 'flush_widget_cache'));
     add_action('deleted_post', array($this, 'flush_widget_cache'));
     add_action('switch_theme', array($this, 'flush_widget_cache'));
 }
 /**
  * Return an instance of this class.
  *
  * @since     1.0.0
  *
  * @return    object    A single instance of this class.
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  * When update post_type_slug or taxonomy_slug, flush rewrite rules
  *
  * @param $old_value
  * @param $value
  * @since 1.0.1
  */
 public function update_option_callback($old_value, $value)
 {
     if ($old_value['post_type_slug'] != $value['post_type_slug'] || $old_value['taxonomy_slug'] != $value['taxonomy_slug']) {
         Super_Simple_Events::flush_rewrite_rules();
     }
 }