<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
<?php

class ThemeMakers_Mail_Subscriber_Newsletters_Widget extends WP_Widget {

    //Widget Setup
    function __construct() {
        //Basic settings
        $settings = array('classname' => __CLASS__, 'description' => __('Newsletters Subscriptions', THEMEMAKERS_THEME_FOLDER_NAME));

        //Creation
        $this->WP_Widget(__CLASS__, __('ThemeMakers Newsletters Subscriptions', THEMEMAKERS_THEME_FOLDER_NAME), $settings);
    }

    //Widget view
    function widget($args, $instance) {
        $args['instance'] = $instance;
        echo ThemeMakersThemeView::draw_free_page(Application_Mail_Subscriber::get_application_path() . '/views/widgets/newsletters_subscriptions.php', $args);
    }

    //Update widget
    function update($new_instance, $old_instance) {
        $instance = $old_instance;
        $instance['title'] = $new_instance['title'];
        $instance['text'] = $new_instance['text'];
        return $instance;
    }

    //Widget form
    function form($instance) {
        //Defaults
        $defaults = array(
            'title' => __('Subscribe Us', THEMEMAKERS_THEME_FOLDER_NAME),
            'text' => "",
        );
        $instance = wp_parse_args((array) $instance, $defaults);
        $args = array();
        $args['instance'] = $instance;
        $args['widget'] = $this;
        echo ThemeMakersThemeView::draw_free_page(Application_Mail_Subscriber::get_application_path() . '/views/widgets/newsletters_subscriptions_form.php', $args);
    }

}


//***************************************************************************************

register_widget('ThemeMakers_Mail_Subscriber_Newsletters_Widget');


