'bp_social_widget', 'description' => __( 'Display Social links in your sidebar', 'blue-planet' ), ); parent::__construct( 'bp-social', __( 'Blue Planet Social', 'blue-planet' ), $opts ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); echo $args['before_widget']; if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } $bp_options = blueplanet_get_option_all(); echo '
'; $social_sites = array( 'facebook','twitter','googleplus','youtube','pinterest','linkedin','flickr','tumblr','dribbble','deviantart','rss','instagram','skype','digg','stumbleupon','forrst','500px','vimeo' ); foreach ( $social_sites as $key => $site ) { if ( '' !== $bp_options[ "social_$site" ] ) { echo ''; } } if ( isset( $bp_options['social_email'] ) && ! empty( $bp_options['social_email'] ) ) { echo ''; } echo '
'; echo $args['after_widget']; } /** * Update widget instance. * * @since 1.0.0 * * @param array $new_instance New settings for this instance as input by the user via * {@see WP_Widget::form()}. * @param array $old_instance Old settings for this instance. * @return array Settings to save or bool false to cancel saving. */ function update( $new_instance, $old_instance ) { $instance = $old_instance; $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) ); $instance['title'] = sanitize_text_field( $new_instance['title'] ); return $instance; } /** * Output the settings update form. * * @since 1.0.0 * * @param array $instance Current settings. */ function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); $title = $instance['title']; ?>