'widget_mailchimp_subscriber_popup', 'description' => __( 'Allows displaying a popup subscription form to visitors.', 'jetpack' ), 'customize_selective_refresh' => true, ) ); } /** * Outputs the HTML for this widget. * * @param array $args An array of standard parameters for widgets in this theme * @param array $instance An array of settings for this widget instance * * @return void Echoes it's output **/ function widget( $args, $instance ) { $instance = wp_parse_args( $instance, array( 'code' => '' ) ); // Regular expresion that will match maichimp shortcode. $regex = "(\[mailchimp_subscriber_popup[^\]]+\])"; // Check if the shortcode exists. preg_match( $regex, $instance['code'], $matches ); // Process the shortcode only, if exists. if ( ! empty( $matches[0] ) ) { echo do_shortcode( $matches[0] ); } /** This action is documented in modules/widgets/gravatar-profile.php */ do_action( 'jetpack_stats_extra', 'widget_view', 'mailchimp_subscriber_popup' ); } /** * Deals with the settings when they are saved by the admin. * * @param array $new_instance New configuration values * @param array $old_instance Old configuration values * * @return array */ function update( $new_instance, $old_instance ) { $instance = array(); $instance['code'] = MailChimp_Subscriber_Popup::reversal( $new_instance['code'] ); return $instance; } /** * Displays the form for this widget on the Widgets page of the WP Admin area. * * @param array $instance Instance configuration. * * @return void */ function form( $instance ) { $instance = wp_parse_args( $instance, array( 'code' => '' ) ); ?>