meta_contact['admin_header'] = __( 'Contact', 'bpq' ); $this->meta_contact['data'] = array( 'show_contact_phone' => array( 'admin_label' => __( 'Phone number', 'bpq' ), 'class' => '', 'icon' => 'fa-phone', 'js' => '', 'link' => '', 'raw' => '', 'text' => get_theme_mod( 'bpq_opt_profile_phone', '' ), ), 'show_contact_fax' => array( 'admin_label' => __( 'Fax number', 'bpq' ), 'class' => '', 'icon' => 'fa-fax', 'js' => '', 'link' => '', 'raw' => '', 'text' => get_theme_mod( 'bpq_opt_profile_fax', '' ), ), 'show_contact_email' => array( 'admin_label' => __( 'E-mail address', 'bpq' ), 'class' => '', 'icon' => 'fa-laptop', 'js' => '', 'link' => '', 'raw' => '', 'text' => get_theme_mod( 'bpq_opt_profile_email', '' ), ), 'show_contact_street' => array( 'admin_label' => __( 'Street address', 'bpq' ), 'class' => '', 'icon' => 'fa-envelope', 'js' => '', 'link' => '', 'raw' => '', 'text' => get_theme_mod( 'bpq_opt_profile_street', '' ), ), 'show_contact_hours' => array( 'admin_label' => __( 'Business hours', 'bpq' ), 'class' => '', 'icon' => 'fa-clock-o', 'js' => '', 'link' => '', 'raw' => '', 'text' => get_theme_mod( 'bpq_opt_profile_hours', '' ), ), 'show_contact_info' => array( 'admin_label' => __( 'General info', 'bpq' ), 'class' => '', 'icon' => 'fa-info', 'js' => '', 'link' => '', 'raw' => '', 'text' => get_theme_mod( 'bpq_opt_profile_info', '' ), ), ); $this->meta_follow['admin_header'] = __( 'Follow', 'bpq' ); $this->meta_follow['data'] = array( 'show_follow_facebook' => array( 'admin_label' => __( 'Facebook fan page', 'bpq' ), 'class' => '', 'icon' => 'fa-facebook', 'js' => '', 'link' => get_theme_mod( 'bpq_opt_profile_facebook', '' ), 'raw' => '', 'text' => __( 'Facebook', 'bpq' ), ), 'show_follow_google' => array( 'admin_label' => __( 'Google+ page', 'bpq' ), 'class' => '', 'icon' => 'fa-google-plus', 'js' => '', 'link' => get_theme_mod( 'bpq_opt_profile_google', '' ), 'raw' => '', 'text' => __( 'Google+', 'bpq' ), ), 'show_follow_linkedin' => array( 'admin_label' => __( 'LinkedIn profile', 'bpq' ), 'class' => '', 'icon' => 'fa-linkedin', 'js' => '', 'link' => get_theme_mod( 'bpq_opt_profile_linkedin', '' ), 'raw' => '', 'text' => __( 'LinkedIn', 'bpq' ), ), 'show_follow_pinterest' => array( 'admin_label' => __( 'Pinterest pinboard', 'bpq' ), 'class' => '', 'icon' => 'fa-pinterest', 'js' => '', 'link' => get_theme_mod( 'bpq_opt_profile_pinterest', '' ), 'raw' => '', 'text' => __( 'Pinterest', 'bpq' ), ), 'show_follow_twitter' => array( 'admin_label' => __( 'Twitter follow', 'bpq' ), 'class' => '', 'icon' => 'fa-twitter', 'js' => '', 'link' => get_theme_mod( 'bpq_opt_profile_twitter', '' ), 'raw' => '', 'text' => __( 'Twitter', 'bpq' ), ), ); $this->meta_share['admin_header'] = __( 'Share', 'bpq' ); $this->meta_share['data'] = array( 'show_share_facebook' => array( 'admin_label' => __( 'Facebook like button', 'bpq' ), 'class' => '', 'icon' => 'fa-facebook', 'js' => '', 'link' => '', 'raw' => '
', 'text' => '', ), 'show_share_google' => array( 'admin_label' => __( 'Google +1 button', 'bpq' ), 'class' => '', 'icon' => 'fa-google-plus', 'js' => '', 'link' => '', 'raw' => '
', 'text' => '', ), 'show_share_pinterest' => array( 'admin_label' => __( 'Pinterest marklet', 'bpq' ), 'class' => '', 'icon' => 'fa-pinterest', 'js' => '', 'link' => '', 'raw' => '', 'text' => __( 'Pinterest', 'bpq' ), ), 'show_share_stumbleupon' => array( 'admin_label' => __( 'StumbleUpon', 'bpq' ), 'class' => '', 'icon' => 'fa-stumbleupon', 'js' => '', 'link' => '', 'raw' => '', 'text' => __( 'StumbleUpon', 'bpq' ), ), ); $this->meta_extra['admin_header'] = __( 'Extra', 'bpq' ); $this->meta_extra['data'] = array(); for ( $i = 0; $i < constant( 'BPQ_PROFILE_NUM_EXTRAS' ); $i++ ) { $setting_prefix = sprintf( 'bpq_opt_profile_extra%d', ( $i + 1 ) ); $icon = get_theme_mod( $setting_prefix.'_icon', '' ); if ( empty( $icon ) ) $icon = 'fa-star'; $this->meta_extra['data'][sprintf( 'show_extra_%d', ( $i + 1 ) )] = array( 'admin_label' => sprintf( __( 'Extra #%d', 'bpq' ), ( $i + 1 ) ), 'class' => '', 'icon' => $icon, 'js' => '', 'link' => get_theme_mod( $setting_prefix.'_url', '' ), 'raw' => '', 'text' => get_theme_mod( $setting_prefix.'_title', '' ), ); } $title = __( '- BluePrint-Q - Profile', 'bpq' ); $description = __( 'Displays contact and social information.', 'bpq' ); parent::__construct( 'widget_profile', $title, array( 'description' => $description ) ); } /** * Outputs the content of the widget. * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { // Wrap start. echo $args['before_widget']; // Keeping with the WP pattern, display the title. $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); if ( !empty( $instance['title'] ) ) echo $args['before_title'].$instance['title'].$args['after_title']; // Links can open in the same window or a new window/tab. $target = empty( $instance['new_window'] ) ? '' : 'target="_blank"'; // Use large icons or keep same size as the text. $large_icons = empty( $instance['large_icons'] ) ? '' : 'fa-lg'; // The orientation is directly related to the Bootstrap class - // write out the beginning of the list container. $list_class = empty( $instance['vertical'] ) ? 'list-inline' : 'list-unstyled'; echo ''; // Wrap end. echo $args['after_widget']; } /** * Outputs the options form on admin. * * @param array $instance The widget options */ public function form( $instance ) { $title = isset( $instance['title'] ) ? strip_tags( $instance['title'] ) : ''; $vertical = isset( $instance['vertical'] ) ? (bool)$instance['vertical'] : false; $hide_text = isset( $instance['hide_text'] ) ? (bool)$instance['hide_text'] : false; $new_window = isset( $instance['new_window'] ) ? (bool)$instance['new_window'] : false; $large_icons = isset( $instance['large_icons'] ) ? (bool)$instance['large_icons'] : false; $show_meta = array(); $meta_groups = array( $this->meta_contact, $this->meta_follow, $this->meta_share, $this->meta_extra ); foreach ( array_merge( $meta_groups ) as $k1 => $v1 ) { foreach ( $v1['data'] as $k2 => $v2 ) { $show_meta[$k2] = isset( $instance[$k2] ) ? (bool)$instance[$k2] : false; } } // Display the title, similar to the WP-provided widgets. echo '

'. ''. '

'; // Display the list as vertical or horizontal. echo '

'. ''. '
'. ''. __( 'By default, the social media is displayed side-by-side.', 'bpq' ). ''. '

'; // Display the name of the social site next to the corresponding icon. echo '

'. ''. '
'. ''. __( 'Normally, the icon and the corresponding text are displayed.', 'bpq' ). ''. '

'; // Use large icons. echo '

'. ''. '
'. ''. __( 'Icons are normally the same size as the text.', 'bpq' ). ''. '

'; // Open links in a new window echo '

'. ''. '
'. ''. __( 'The alternative is to open links in the same window.', 'bpq' ). ''. '

'; // Display the list of social sites allowing each to be toggled on/off independently. echo '

'. __( 'What would you like to display?', 'bpq' ). '
'. ''. sprintf( __( 'Some links are read from the Customizer profile section.', 'bpq' ), admin_url( 'customize.php' ) ). ''. '
'; foreach ( $meta_groups as $k1 => $v1 ) { echo '
'.$v1['admin_header'].'
'; foreach ( $v1['data'] as $k2 => $v2 ) { echo ''. '
'; } } echo '

'; } /** * Processing widget options on save. * * @param array $new_instance The new options * @param array $old_instance The previous options */ public function update( $new_instance, $old_instance ) { $new_instance['title'] = strip_tags( $new_instance['title'] ); $new_instance['vertical'] = isset( $new_instance['vertical'] ); $new_instance['hide_text'] = isset( $new_instance['hide_text'] ); $new_instance['new_window'] = isset( $new_instance['new_window'] ); $new_instance['large_icons'] = isset( $new_instance['large_icons'] ); $meta_groups = array( $this->meta_contact, $this->meta_follow, $this->meta_share, $this->meta_extra ); foreach ( array_merge( $meta_groups ) as $k1 => $v1 ) { foreach ( $v1['data'] as $k2 => $v2 ) { $new_instance[$k2] = isset( $new_instance[$k2] ); } } return $new_instance; } } ?>