default_settings = apply_filters( 'powerkit_opt_in_subscription_widget_settings', array( 'title' => esc_html__( 'Subscription Form', 'powerkit' ), 'privacy' => powerkit_mailchimp_get_privacy_text(), 'text' => '', 'bg_image_id' => false, 'list_id' => null, 'type' => 'widget', 'display_name' => false, ) ); $widget_details = array( 'classname' => 'powerkit_opt_in_subscription_widget', 'description' => esc_html__( 'Add a subscription form to your sidebar.', 'powerkit' ), ); // Actions. add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); parent::__construct( 'powerkit_opt_in_subscription_widget', esc_html__( 'Subscription Form', 'powerkit' ), $widget_details ); } /** * Outputs the content for the current widget instance. * * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance Settings for the current widget instance. */ public function widget( $args, $instance ) { $params = array_merge( $this->default_settings, $instance ); // Before Widget. echo $args['before_widget']; // XSS. if ( $params['title'] ) { $params['title'] = $args['before_title'] . apply_filters( 'widget_title', $params['title'], $instance, $this->id_base ) . $args['after_title']; } ?>
default_settings, $instance ); $bg_image_url = $params['bg_image_id'] ? wp_get_attachment_image_url( intval( $params['bg_image_id'] ), 'large' ) : ''; ?>
'date_created', 'sort_dir' => 'DESC', 'count' => 1000, ) ); if ( is_array( $data ) && isset( $data['lists'] ) && $data['lists'] ) { ?>
/> ()
', '' ), '', ob_get_clean() ) ); } } } /** * Register Widget */ function powerkit_widget_init_subscription_form() { register_widget( 'Powerkit_Subscription_Form_Widget' ); } add_action( 'widgets_init', 'powerkit_widget_init_subscription_form' );