Current Path : /var/www/ya/wp-content/plugins/meanthemes-tools/include/ |
Current File : /var/www/ya/wp-content/plugins/meanthemes-tools/include/widgets.php |
<?php /** * Plugin Name: MeanThemes Social Widget * Description: Add your social links. * Author: MeanThemes * Author URI: http://meanthemes.com */ add_action( 'widgets_init', 'meanthemes_tools_social_widget' ); function meanthemes_tools_social_widget() { register_widget( 'MeanThemes_Tools_Social_Widget' ); } class MeanThemes_Tools_Social_Widget extends WP_Widget { function __construct() { $widget_ops = array( 'classname' => 'meanthemes', 'description' => __('Add your social links. ', 'meanthemes') ); $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'meanthemes-widget' ); parent::__construct( 'meanthemes-widget', __('MeanThemes Social Widget', 'meanthemes'), $widget_ops, $control_ops ); } function widget( $args, $instance ) { extract( $args ); //Our variables from the widget settings. $title = isset( $instance['title'] ) ? $instance['title'] : false; $description = isset( $instance['description'] ) ? $instance['description'] : false; $twitter = isset( $instance['twitter'] ) ? $instance['twitter'] : false; $facebook = isset( $instance['facebook'] ) ? $instance['facebook'] : false; $snapchat = isset( $instance['snapchat'] ) ? $instance['snapchat'] : false; $linkedin = isset( $instance['linkedin'] ) ? $instance['linkedin'] : false; $googleplus = isset( $instance['googleplus'] ) ? $instance['googleplus'] : false; $zerply = isset( $instance['zerply'] ) ? $instance['zerply'] : false; $vimeo = isset( $instance['vimeo'] ) ? $instance['vimeo'] : false; $youtube = isset( $instance['youtube'] ) ? $instance['youtube'] : false; $pinterest = isset( $instance['pinterest'] ) ? $instance['pinterest'] : false; $dribbble = isset( $instance['dribbble'] ) ? $instance['dribbble'] : false; $github = isset( $instance['github'] ) ? $instance['github'] : false; $instagram = isset( $instance['instagram'] ) ? $instance['instagram'] : false; $flickr = isset( $instance['flickr'] ) ? $instance['flickr'] : false; $adn = isset( $instance['adn'] ) ? $instance['adn'] : false; $behance = isset( $instance['behance'] ) ? $instance['behance'] : false; $tumblr = isset( $instance['tumblr'] ) ? $instance['tumblr'] : false; $lastfm = isset( $instance['lastfm'] ) ? $instance['lastfm'] : false; $soundcloud = isset( $instance['soundcloud'] ) ? $instance['soundcloud'] : false; $mixcloud = isset( $instance['mixcloud'] ) ? $instance['mixcloud'] : false; $spotify = isset( $instance['spotify'] ) ? $instance['spotify'] : false; $xing = isset( $instance['xing'] ) ? $instance['xing'] : false; $foursquare = isset( $instance['foursquare'] ) ? $instance['foursquare'] : false; $goodreads = isset( $instance['goodreads'] ) ? $instance['goodreads'] : false; $amazon = isset( $instance['amazon'] ) ? $instance['amazon'] : false; $rss = isset( $instance['rss'] ) ? $instance['rss'] : false; $open_new = isset( $instance['open_new'] ) ? $instance['open_new'] : false; $white = isset( $instance['white'] ) ? $instance['white'] : false; $fa = isset( $instance['fa'] ) ? $instance['fa'] : false; echo $before_widget; // Display the widget title if ( $title ) { echo $before_title . $title . $after_title; } // Display the widget title if ( $description ) { echo '<p>' . $description . '</p>'; } $open = ""; if ( $open_new ) { $open = ' target="_blank"'; } $white_icon = ""; if ( $white ) { $white_icon = ' white'; } echo '<div class="socials">'; //Display the socials if ( $twitter ) { ?> <a class="<?php if( !$fa ) { ?>social twitter<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $twitter ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-twitter"></i><span class="i"><?php } ?><?php esc_attr( _e('Twitter', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $facebook ) { ?> <a class="<?php if( !$fa ) { ?>social facebook<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $facebook ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-facebook"></i><span class="i"><?php } ?><?php esc_attr( _e('facebook', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $snapchat ) { ?> <a class="<?php if( !$fa ) { ?>social snapchat<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $snapchat ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-snapchat"></i><span class="i"><?php } ?><?php esc_attr( _e('Snapchat', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $linkedin ) { ?> <a class="<?php if( !$fa ) { ?>social linkedin<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $linkedin ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-linkedin"></i><span class="i"><?php } ?><?php esc_attr( _e('linkedin', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $googleplus ) { ?> <a class="<?php if( !$fa ) { ?>social googleplus<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $googleplus ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-google-plus"></i><span class="i"><?php } ?><?php esc_attr( _e('googleplus', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $zerply ) { printf( '<a class="social zerply' . $white_icon .'" href="' . esc_url( $zerply ) . '"' . $open . '>' . __('Zerply', 'meanthemes') . '</a>' ); } if ( $vimeo ) { ?> <a class="<?php if( !$fa ) { ?>social vimeo<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $vimeo ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-vimeo-square"></i><span class="i"><?php } ?><?php esc_attr( _e('vimeo', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $youtube ) { ?> <a class="<?php if( !$fa ) { ?>social youtube<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $youtube ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-youtube"></i><span class="i"><?php } ?><?php esc_attr( _e('youtube', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $pinterest ) { ?> <a class="<?php if( !$fa ) { ?>social pinterest<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $pinterest ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-pinterest"></i><span class="i"><?php } ?><?php esc_attr( _e('pinterest', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $dribbble ) { ?> <a class="<?php if( !$fa ) { ?>social dribbble<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $dribbble ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-dribbble"></i><span class="i"><?php } ?><?php esc_attr( _e('dribbble', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $github ) { ?> <a class="<?php if( !$fa ) { ?>social github<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $github ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-github"></i><span class="i"><?php } ?><?php esc_attr( _e('github', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $instagram ) { ?> <a class="<?php if( !$fa ) { ?>social instagram<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $instagram ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-instagram"></i><span class="i"><?php } ?><?php esc_attr( _e('instagram', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $flickr ) { ?> <a class="<?php if( !$fa ) { ?>social flickr<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $flickr ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-flickr"></i><span class="i"><?php } ?><?php esc_attr( _e('flickr', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $adn ) { ?> <a class="<?php if( !$fa ) { ?>social adn<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $adn ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-adn"></i><span class="i"><?php } ?><?php esc_attr( _e('adn', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $behance ) { ?> <a class="<?php if( !$fa ) { ?>social behance<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $behance ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-behance"></i><span class="i"><?php } ?><?php esc_attr( _e('behance', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $tumblr ) { ?> <a class="<?php if( !$fa ) { ?>social tumblr<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $tumblr ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-tumblr"></i><span class="i"><?php } ?><?php esc_attr( _e('tumblr', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $lastfm ) { ?> <a class="<?php if( !$fa ) { ?>social lastfm<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $lastfm ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-lastfm"></i><span class="i"><?php } ?><?php esc_attr( _e('lastfm', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $soundcloud ) { ?> <a class="<?php if( !$fa ) { ?>social soundcloud<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $soundcloud ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-soundcloud"></i><span class="i"><?php } ?><?php esc_attr( _e('soundcloud', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $mixcloud ) { ?> <a class="<?php if( !$fa ) { ?>social mixcloud<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $mixcloud ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-mixcloud"></i><span class="i"><?php } ?><?php esc_attr( _e('mixcloud', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $spotify ) { ?> <a class="<?php if( !$fa ) { ?>social spotify<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $spotify ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-spotify"></i><span class="i"><?php } ?><?php esc_attr( _e('spotify', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $xing ) { ?> <a class="<?php if( !$fa ) { ?>social xing<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $xing ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-xing"></i><span class="i"><?php } ?><?php esc_attr( _e('xing', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $foursquare ) { ?> <a class="<?php if( !$fa ) { ?>social foursquare<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $foursquare ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-foursquare"></i><span class="i"><?php } ?><?php esc_attr( _e('foursquare', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $goodreads ) { printf( '<a class="social goodreads' . $white_icon .'" href="' . esc_url( $goodreads ) . '"' . $open . '>' . __('Good Reads', 'meanthemes') . '</a>' ); } if ( $amazon ) { ?> <a class="<?php if( !$fa ) { ?>social amazon<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $amazon ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-amazon"></i><span class="i"><?php } ?><?php esc_attr( _e('Amazon', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } if ( $rss ) { ?> <a class="<?php if( !$fa ) { ?>social rss<?php } else { echo 'social-fa'; } ?><?php echo esc_attr( $white_icon ); ?>" href="<?php echo esc_url( $rss ); ?>" <?php echo esc_attr( $open ); ?>><?php if( $fa ) { ?><i class="fa fa-rss"></i><span class="i"><?php } ?><?php esc_attr( _e('rss', 'meanthemes') ); ?><?php if( $fa ) { ?></span><?php } ?></a> <?php } echo '</div>'; echo $after_widget; } //Update the widget function update( $new_instance, $old_instance ) { $instance = $old_instance; //Strip tags from title and name to remove HTML $instance['title'] = strip_tags( $new_instance['title'] ); $instance['description'] = strip_tags( $new_instance['description'] ); $instance['twitter'] = strip_tags( $new_instance['twitter'] ); $instance['facebook'] = strip_tags( $new_instance['facebook'] ); $instance['snapchat'] = strip_tags( $new_instance['snapchat'] ); $instance['linkedin'] = strip_tags( $new_instance['linkedin'] ); $instance['googleplus'] = strip_tags( $new_instance['googleplus'] ); $instance['zerply'] = strip_tags( $new_instance['zerply'] ); $instance['vimeo'] = strip_tags( $new_instance['vimeo'] ); $instance['youtube'] = strip_tags( $new_instance['youtube'] ); $instance['pinterest'] = strip_tags( $new_instance['pinterest'] ); $instance['dribbble'] = strip_tags( $new_instance['dribbble'] ); $instance['github'] = strip_tags( $new_instance['github'] ); $instance['instagram'] = strip_tags( $new_instance['instagram'] ); $instance['flickr'] = strip_tags( $new_instance['flickr'] ); $instance['adn'] = strip_tags( $new_instance['adn'] ); $instance['behance'] = strip_tags( $new_instance['behance'] ); $instance['tumblr'] = strip_tags( $new_instance['tumblr'] ); $instance['lastfm'] = strip_tags( $new_instance['lastfm'] ); $instance['soundcloud'] = strip_tags( $new_instance['soundcloud'] ); $instance['mixcloud'] = strip_tags( $new_instance['mixcloud'] ); $instance['spotify'] = strip_tags( $new_instance['spotify'] ); $instance['xing'] = strip_tags( $new_instance['xing'] ); $instance['foursquare'] = strip_tags( $new_instance['foursquare'] ); $instance['goodreads'] = strip_tags( $new_instance['goodreads'] ); $instance['amazon'] = strip_tags( $new_instance['amazon'] ); $instance['rss'] = strip_tags( $new_instance['rss'] ); $instance['open_new'] = $new_instance['open_new']; $instance['white'] = $new_instance['white']; $instance['fa'] = $new_instance['fa']; return $instance; } function form( $instance ) { //Set up some default widget settings. $defaults = array( "title" => "", "description" => "", "twitter" => "", "facebook" => "", "snapchat" => "", "linkedin" => "", "googleplus" => "", "zerply" => "", "vimeo" => "", "youtube" => "", "pinterest" => "", "dribbble" => "", "github" => "", "instagram" => "", "flickr" => "", "adn" => "", "behance" => "", "tumblr" => "", "lastfm" => "", "soundcloud" => "", "mixcloud" => "", "spotify" => "", "xing" => "", "foursquare" => "", "goodreads" => "", "amazon" => "", "rss" => "", 'open_new' => false, 'white' => false, 'fa' => false ); $instance = wp_parse_args( (array) $instance, $defaults ); ?> <?php //Widget Title: Text Input. ?> <p><em><?php _e('Please add Full URLs e.g. http://twitter.com/getmeanthemes','meanthemes'); ?></em></p> <p> <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" /> </p> <?php //Text Input. ?> <p> <label for="<?php echo $this->get_field_id( 'description' ); ?>"><?php _e('Description:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'description' ); ?>" name="<?php echo $this->get_field_name( 'description' ); ?>" value="<?php echo $instance['description']; ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'twitter' ); ?>"><?php _e('Twitter:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'twitter' ); ?>" name="<?php echo $this->get_field_name( 'twitter' ); ?>" value="<?php echo esc_url( $instance['twitter'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'facebook' ); ?>"><?php _e('Facebook:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'facebook' ); ?>" name="<?php echo $this->get_field_name( 'facebook' ); ?>" value="<?php echo esc_url( $instance['facebook'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'snapchat' ); ?>"><?php _e('Snapchat:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'snapchat' ); ?>" name="<?php echo $this->get_field_name( 'snapchat' ); ?>" value="<?php echo esc_url( $instance['snapchat'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'linkedin' ); ?>"><?php _e('LinkedIn:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'linkedin' ); ?>" name="<?php echo $this->get_field_name( 'linkedin' ); ?>" value="<?php echo esc_url( $instance['linkedin'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'googleplus' ); ?>"><?php _e('Google+:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'googleplus' ); ?>" name="<?php echo $this->get_field_name( 'googleplus' ); ?>" value="<?php echo esc_url( $instance['googleplus'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'zerply' ); ?>"><?php _e('Zerply:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'zerply' ); ?>" name="<?php echo $this->get_field_name( 'zerply' ); ?>" value="<?php echo esc_url( $instance['zerply'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'vimeo' ); ?>"><?php _e('Vimeo:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'vimeo' ); ?>" name="<?php echo $this->get_field_name( 'vimeo' ); ?>" value="<?php echo esc_url( $instance['vimeo'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'youtube' ); ?>"><?php _e('YouTube:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'youtube' ); ?>" name="<?php echo $this->get_field_name( 'youtube' ); ?>" value="<?php echo esc_url( $instance['youtube'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'pinterest' ); ?>"><?php _e('Pinterest:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'pinterest' ); ?>" name="<?php echo $this->get_field_name( 'pinterest' ); ?>" value="<?php echo esc_url( $instance['pinterest'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'dribbble' ); ?>"><?php _e('Dribbble:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'dribbble' ); ?>" name="<?php echo $this->get_field_name( 'dribbble' ); ?>" value="<?php echo esc_url( $instance['dribbble'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'github' ); ?>"><?php _e('Github:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'github' ); ?>" name="<?php echo $this->get_field_name( 'github' ); ?>" value="<?php echo esc_url( $instance['github'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'instagram' ); ?>"><?php _e('Instagram:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'instagram' ); ?>" name="<?php echo $this->get_field_name( 'instagram' ); ?>" value="<?php echo esc_url( $instance['instagram'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'flickr' ); ?>"><?php _e('Flickr:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'flickr' ); ?>" name="<?php echo $this->get_field_name( 'flickr' ); ?>" value="<?php echo esc_url( $instance['flickr'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'adn' ); ?>"><?php _e('App.Net:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'adn' ); ?>" name="<?php echo $this->get_field_name( 'adn' ); ?>" value="<?php echo esc_url( $instance['adn'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'behance' ); ?>"><?php _e('Behance:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'behance' ); ?>" name="<?php echo $this->get_field_name( 'behance' ); ?>" value="<?php echo esc_url( $instance['behance'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'tumblr' ); ?>"><?php _e('Tumblr:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'tumblr' ); ?>" name="<?php echo $this->get_field_name( 'tumblr' ); ?>" value="<?php echo esc_url( $instance['tumblr'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'lastfm' ); ?>"><?php _e('LastFM:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'lastfm' ); ?>" name="<?php echo $this->get_field_name( 'lastfm' ); ?>" value="<?php echo esc_url( $instance['lastfm'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'soundcloud' ); ?>"><?php _e('SoundCloud:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'soundcloud' ); ?>" name="<?php echo $this->get_field_name( 'soundcloud' ); ?>" value="<?php echo esc_url( $instance['soundcloud'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'mixcloud' ); ?>"><?php _e('MixCloud:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'mixcloud' ); ?>" name="<?php echo $this->get_field_name( 'mixcloud' ); ?>" value="<?php echo esc_url( $instance['mixcloud'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'spotify' ); ?>"><?php _e('Spotify:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'spotify' ); ?>" name="<?php echo $this->get_field_name( 'spotify' ); ?>" value="<?php echo esc_url( $instance['spotify'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'xing' ); ?>"><?php _e('Xing:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'xing' ); ?>" name="<?php echo $this->get_field_name( 'xing' ); ?>" value="<?php echo esc_url( $instance['xing'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'foursquare' ); ?>"><?php _e('Foursquare:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'foursquare' ); ?>" name="<?php echo $this->get_field_name( 'foursquare' ); ?>" value="<?php echo esc_url( $instance['foursquare'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'goodreads' ); ?>"><?php _e('Good Reads:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'goodreads' ); ?>" name="<?php echo $this->get_field_name( 'goodreads' ); ?>" value="<?php echo esc_url( $instance['goodreads'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'amazon' ); ?>"><?php _e('Amazon:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'amazon' ); ?>" name="<?php echo $this->get_field_name( 'amazon' ); ?>" value="<?php echo esc_url( $instance['amazon'] ); ?>" style="width:100%;" /> </p> <p> <label for="<?php echo $this->get_field_id( 'rss' ); ?>"><?php _e('RSS:', 'meanthemes'); ?></label> <input id="<?php echo $this->get_field_id( 'rss' ); ?>" name="<?php echo $this->get_field_name( 'rss' ); ?>" value="<?php echo esc_url( $instance['rss'] ); ?>" style="width:100%;" /> </p> <?php //Checkbox. ?> <p> <input class="checkbox" type="checkbox" <?php if ( ( $instance['open_new'] ) === "on" ) { echo 'checked'; } ?> id="<?php echo $this->get_field_id( 'open_new' ); ?>" name="<?php echo $this->get_field_name( 'open_new' ); ?>" /> <label for="<?php echo $this->get_field_id( 'open_new' ); ?>"><?php _e('Open links in new window?', 'meanthemes'); ?></label> </p> <p> <input class="checkbox" type="checkbox" <?php if ( ( $instance['white'] ) === "on" ) { echo 'checked'; } ?> id="<?php echo $this->get_field_id( 'white' ); ?>" name="<?php echo $this->get_field_name( 'white' ); ?>" /> <label for="<?php echo $this->get_field_id( 'white' ); ?>"><?php _e('Use white icons?', 'meanthemes'); ?></label> </p> <p> <input class="checkbox" type="checkbox" <?php if ( ( $instance['fa'] ) === "on" ) { echo 'checked'; } ?> id="<?php echo $this->get_field_id( 'fa' ); ?>" name="<?php echo $this->get_field_name( 'fa' ); ?>" /> <label for="<?php echo $this->get_field_id( 'fa' ); ?>"><?php _e('Use Font Awesome icons?', 'meanthemes'); ?></label> <br><br><i><?php _e('<strong>Please note:</strong> the following social icons do not have a matching Font Awesome icon, so the standard icon will be used instead: Zerply & Good Reads.', 'meanthemes'); ?></i> </p> <?php } } // About You widget // register widget add_action('widgets_init', 'meanthemes_tools_about_you_widget_widget'); function meanthemes_tools_about_you_widget_widget() { register_widget( 'meanthemes_tools_about_you_widget' ); } // add admin scripts add_action('admin_enqueue_scripts', 'meanthemes_tools_about_you_widget_script'); function meanthemes_tools_about_you_widget_script() { wp_enqueue_media(); wp_enqueue_script('meanthemes_widget_script', plugin_dir_url( __FILE__ ) . 'js/widgets.js', false, '1.0', true); wp_enqueue_style('meanthemes_widget_style', plugin_dir_url( __FILE__ ) . 'css/upload.css', false, '1.0'); } // widget class class meanthemes_tools_about_you_widget extends WP_Widget { function __construct() { $widget_ops = array( 'classname' => 'meanthemes_tools_about_you_widget', 'description' => __('Add your own "About" information and image in this handy widget. ', 'meanthemes') ); parent::__construct('meanthemes_tools_about_you_widget-widget', __( 'MeanThemes "About You"' , 'meanthemes' ), $widget_ops); } function widget($args, $instance) { extract($args); //Our variables from the widget settings. $title = isset( $instance['title'] ) ? $instance['title'] : false; $bio = isset( $instance['bio'] ) ? $instance['bio'] : false; $image = isset( $instance['image'] ) ? $instance['image'] : false; $image_above = isset( $instance['image_above'] ) ? $instance['image_above'] : false; // widget content echo '<div class="mt-about-you-widget">' . $before_widget; // Output Widget ?> <?php if ( $image && $image_above !== "on" ) { ?> <img class="mt-about-avatar" src="<?php echo esc_url($instance['image']); ?>" <?php if ( $title ) { echo 'alt="' . $title .'"'; } ?> /> <?php } ?> <?php if ( $title ) { echo $before_title . $title . $after_title; } ?> <?php if ( $image && $image_above === "on" ) { ?> <img class="mt-about-avatar" src="<?php echo esc_url($instance['image']); ?>" <?php if ( $title ) { echo 'alt="' . $title .'"'; } ?> /> <?php } ?> <?php if ( $bio ) { echo '<div class="mt-about-bio">' . wpautop( $bio ) . '</div>'; } ?> <?php echo $after_widget . '</div>'; } function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['bio'] = esc_attr( $new_instance['bio'] ); $instance['image'] = strip_tags( $new_instance['image'] ); $instance['image_above'] = $new_instance['image_above']; return $instance; } function form($instance) { //Set up some default widget settings. $defaults = array( "title" => "", "bio" => "", "image" => "", "image_above" => false ); $instance = wp_parse_args( (array) $instance, $defaults ); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Your Name:' , 'meanthemes' ); ?></label><br /> <input type="text" name="<?php echo $this->get_field_name('title'); ?>" id="<?php echo $this->get_field_id('title'); ?>" value="<?php echo $instance['title']; ?>" class="widefat" /> </p> <p> <label for="<?php echo $this->get_field_id('bio'); ?>"><?php _e( 'Your Short Biography:' , 'meanthemes' ); ?></label><br /> <textarea name="<?php echo $this->get_field_name('bio'); ?>" rows="10" style="width: 100%;" id="<?php echo $this->get_field_id('bio'); ?>"><?php echo $instance['bio']; ?></textarea> </p> <p> <div class="meanthemes-media-container"> <label><?php esc_html(_e( 'Your Image:' , 'meanthemes' )); ?></label> <div class="meanthemes-media-inner"> <?php $img_style = ( $instance[ 'image' ] != '' ) ? '' : 'style="display:none;"'; ?> <img id="<?php echo $this->get_field_id( 'image' ); ?>-preview" src="<?php echo esc_attr( $instance['image'] ); ?>" <?php echo $img_style; ?> /> <?php $no_img_style = ( $instance[ 'image' ] != '' ) ? 'style="display:none;"' : ''; ?> <span class="meanthemes-no-image" id="<?php echo $this->get_field_id( 'image' ); ?>-noimg" <?php echo $no_img_style; ?>><?php _e( 'No image selected', 'meanthemes' ); ?></span> </div> </div> <p><em><?php esc_html(_e( 'Upload a maximum of 350x350 and check the theme demo to see if your image should be the same height and width e.g. square or circular please' , 'meanthemes' )); ?></em></p> <label for="<?php echo $this->get_field_id('image'); ?>"> <?php esc_html(_e( 'Full link to image URL (auto-populated):' , 'meanthemes' )); ?></label> <input type="text" class="widefat custom_media_url" name="<?php echo $this->get_field_name('image'); ?>" id="<?php echo $this->get_field_id('image'); ?>" value="<?php echo $instance['image']; ?>"> <div class="meanthemes-button-wrap"> <input type="button" value="<?php echo _e( 'Remove', 'meanthemes' ); ?>" class="button meanthemes-media-remove" id="<?php echo $this->get_field_id( 'image' ); ?>-remove" <?php echo $img_style; ?> /> <input type="button" class="button meanthemes-media-upload" id="<?php echo $this->get_field_id( 'image' ); ?>-button" name="<?php echo $this->get_field_name('image'); ?>" value="<?php esc_attr( _e( 'Upload Image','meanthemes' ) ); ?>" /> </div> </p> <p> <input class="checkbox" type="checkbox" <?php if ( ( $instance['image_above'] ) === "on" ) { echo 'checked'; } ?> id="<?php echo $this->get_field_id( 'image_above' ); ?>" name="<?php echo $this->get_field_name( 'image_above' ); ?>" /> <label for="<?php echo $this->get_field_id( 'image_above' ); ?>"><?php _e('Place image below title?', 'meanthemes'); ?></label> </p> <?php } } ?>