'', 'text' => '', 'links' => array(), 'fields' => array(), ); public static $social_icons = array(); /* Widget setup */ function __construct() { /* Widget settings. */ $widget_ops = array( 'description' => _x( 'Contact info', 'widget', 'the7mk2' ) ); /* Create the widget. */ parent::__construct( 'presscore-contact-info-widget', DT_WIDGET_PREFIX . _x( 'Contact info', 'widget', 'the7mk2' ), $widget_ops ); if ( function_exists('presscore_get_social_icons_data') ) { self::$social_icons = presscore_get_social_icons_data(); } } /* Display the widget */ function widget( $args, $instance ) { extract( $args ); $instance = wp_parse_args( (array) $instance, self::$widget_defaults ); /* Our variables from the widget settings. */ $title = apply_filters( 'widget_title', $instance['title'] ); $text = $instance['text']; $links = $instance['links']; $fields = $instance['fields']; echo $before_widget ; // title if ( $title ) echo $before_title . $title . $after_title; // content if ( $text ) echo '
' . apply_filters('get_the_excerpt', $text) . '
'; // fields if ( !empty($fields) ) { echo ''; } // social links if ( !empty($links) && implode('', (array)$links) ) { echo '

' . __( 'Find us on:', 'the7mk2' ) . '

'; foreach ( $links as $class=>$link ) { if ( !$link ) continue; $title = ( isset( self::$social_icons[ $class ] ) ? self::$social_icons[ $class ] : '' ); echo presscore_get_social_icon( $class, $link, $title ); } echo '
'; } echo $after_widget; } /* Update the widget settings */ function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = $new_instance['title']; $instance['text'] = $new_instance['text']; $instance['links'] = isset($new_instance['links']) ? $new_instance['links'] : array(); $instance['fields'] = isset($new_instance['fields']) ? $new_instance['fields'] : array(); return $instance; } /** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating your form elements. This handles the confusing stuff. */ function form( $instance ) { /* Set up some default widget settings. */ $instance = wp_parse_args( (array) $instance, self::$widget_defaults ); $links = empty( $instance['links'] ) ? array() : $instance['links']; $fields = empty( $instance['fields'] ) ? array() : $instance['fields']; ?>

$title ) : $val = isset($links[ $class ]) ? esc_attr($links[ $class ]) : ''; ?>