\n";
$html .= "\n";
$html .= "\n";
}
// and output it
return $html;
}
/**
* Class ALO_Easymail_Widget
*/
class ALO_Easymail_Widget extends WP_Widget {
public function __construct() {
/* Widget settings. NOTE: Class name must be lower case*/
$widget_ops = array( 'classname' => 'alo_easymail_widget', 'description' => __('Allow users to opt in/out of email', 'alo-easymail') );
/* Widget control settings. */
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'alo-easymail-widget' );
/* Create the widget. */
parent::__construct( 'alo-easymail-widget', __('ALO Easymail Widget', 'alo-easymail'), $widget_ops, $control_ops );
}
/**
* Display the widget on the screen.
*/
public function widget( $args, $instance ) {
global $user_ID, $user_email, $wpdb;
extract( $args );
// add ALO: hide the widget in subscriber page
if ( is_page( get_option('alo_em_subsc_page') ) ) return;
if ( is_page( alo_em_get_subscrpage_id( alo_em_get_language() ) ) ) return;
// Hide widget to users, if required in setting
if ( get_option('alo_em_hide_widget_users') == "yes" && is_user_logged_in() ) return;
// Our variables from the widget settings.
$title = apply_filters('widget_title', $instance['title'] );
// Before widget (defined by themes).
echo $before_widget;
// Display the widget title if one was input (before and after defined by themes).
if ( $title ) {
echo $before_title . $title . $after_title;
}
// add ALO: print the form
echo alo_em_show_widget_form ();
// After widget (defined by themes).
echo $after_widget;
}
/**
* Update the widget settings.
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
// Strip tags for title and name to remove HTML
$instance['title'] = strip_tags( $new_instance['title'] );
return $instance;
}
/**
* Displays the widget settings controls on the widget panel.
* Make use of the get_field_id() and get_field_name() function
* This handles the confusing stuff.
*/
public function form( $instance ) {
/* Set up some default widget settings. */
$defaults = array( 'title' => __('Newsletter', 'alo-easymail') );
$instance = wp_parse_args( (array) $instance, $defaults );
$html = "";
$html .= "\r\n";
$html .= "\r\n".'