options = $heateor_sss->options;
$this->public_class_object = new Sassy_Social_Share_Public( $heateor_sss->options, HEATEOR_SSS_VERSION );
parent::__construct(
'Heateor_SSS_Sharing', // unique id
__( 'Sassy Social Share - Standard Widget' ), // Widget title
array( 'description' => __( 'Standard sharing widget. Let your website users share content on popular Social networks like Facebook, Twitter, Tumblr, Whatsapp and many more', 'sassy-social-share' ) )
);
}
/**
* Render widget at front-end
*
* @since 1.0
*/
public function widget( $args, $instance ) {
// return if standard sharing is disabled
if ( ! isset( $this->options['hor_enable'] ) ) {
return;
}
extract( $args );
if ( isset( $instance['hide_for_logged_in'] ) && is_user_logged_in() ) return;
global $post;
if ( isset( $this->options['js_when_needed'] ) && ! wp_script_is( 'heateor_sss_sharing_js' ) ) {
$in_footer = isset( $this->options['footer_script'] ) ? true : false;
$inline_script = 'function heateorSssLoadEvent(e) {var t=window.onload;if (typeof window.onload!="function") {window.onload=e}else{window.onload=function() {t();e()}}};';
if ( $post ) {
$inline_script .= 'var heateorSssInstagramUsername="' . ( $this->options['instagram_username'] != '' ? $this->options['instagram_username'] : $this->options['vertical_instagram_username'] ) . '",heateorSssYoutubeUsername="' . ( $this->options['youtube_username'] != '' ? $this->options['youtube_username'] : $this->options['vertical_youtube_username'] ) . '", heateorSssSharingAjaxUrl = \'' . get_admin_url() . 'admin-ajax.php\', heateorSssCloseIconPath = \'' . plugins_url( '../images/close.png', __FILE__ ) . '\', heateorSssPluginIconPath = \'' . plugins_url( '../images/logo.png', __FILE__ ) . '\', heateorSssHorizontalSharingCountEnable = '. ( isset( $this->options['hor_enable'] ) && ( isset( $this->options['horizontal_counts'] ) || isset( $this->options['horizontal_total_shares'] ) ) ? 1 : 0 ) . ', heateorSssVerticalSharingCountEnable = ' . ( isset( $this->options['vertical_enable'] ) && ( isset( $this->options['vertical_counts'] ) || isset( $this->options['vertical_total_shares'] ) ) ? 1 : 0 ) . ', heateorSssSharingOffset = ' . ( isset( $this->options['alignment'] ) && $this->options['alignment'] != '' && isset( $this->options[$this->options['alignment'] . '_offset'] ) && $this->options[$this->options['alignment'] . '_offset'] != '' ? intval( $this->options[$this->options['alignment'] . '_offset'] ) : 0 ) . '; var heateorSssMobileStickySharingEnabled = ' . ( isset( $this->options['vertical_enable'] ) && isset( $this->options['bottom_mobile_sharing'] ) && $this->options['horizontal_screen_width'] != '' ? 1 : 0 ) . ';';
$inline_script .= 'var heateorSssCopyLinkMessage = "' . htmlspecialchars( __( 'Link copied.', 'sassy-social-share' ), ENT_QUOTES ) . '";';
if ( isset( $this->options['horizontal_counts'] ) && isset( $this->options['horizontal_counter_position'] ) ) {
$inline_script .= in_array( $this->options['horizontal_counter_position'], array( 'inner_left', 'inner_right' ) ) ? 'var heateorSssReduceHorizontalSvgWidth = true;' : '';
$inline_script .= in_array( $this->options['horizontal_counter_position'], array( 'inner_top', 'inner_bottom' ) ) ? 'var heateorSssReduceHorizontalSvgHeight = true;' : '';
}
if ( isset( $this->options['vertical_counts'] ) ) {
$inline_script .= isset( $this->options['vertical_counter_position'] ) && in_array( $this->options['vertical_counter_position'], array( 'inner_left', 'inner_right' ) ) ? 'var heateorSssReduceVerticalSvgWidth = true;' : '';
$inline_script .= ! isset( $this->options['vertical_counter_position'] ) || in_array( $this->options['vertical_counter_position'], array( 'inner_top', 'inner_bottom' ) ) ? 'var heateorSssReduceVerticalSvgHeight = true;' : '';
}
$inline_script .= 'var heateorSssUrlCountFetched = [], heateorSssSharesText = \''. htmlspecialchars(__( 'Shares', 'sassy-social-share' ), ENT_QUOTES ) . '\', heateorSssShareText = \'' . htmlspecialchars( __( 'Share', 'sassy-social-share' ), ENT_QUOTES ) . '\';';
$inline_script .= 'function heateorSssPopup(e) {window.open(e,"popUpWindow","height=400,width=600,left=400,top=100,resizable,scrollbars,toolbar=0,personalbar=0,menubar=no,location=no,directories=no,status")}';
if ( $this->public_class_object->facebook_like_recommend_enabled() || $this->public_class_object->facebook_share_enabled() ) {
$inline_script .= 'function heateorSssInitiateFB() {FB.init({appId:"",channelUrl:"",status:!0,cookie:!0,xfbml:!0,version:"v23.0"})}window.fbAsyncInit=function() {heateorSssInitiateFB(),' . ( defined( 'HEATEOR_SOCIAL_SHARE_MYCRED_INTEGRATION_VERSION' ) && $this->facebook_like_recommend_enabled() ? 1 : 0 ) . '&&(FB.Event.subscribe("edge.create",function(e){heateorSsmiMycredPoints("Facebook_like_recommend","",e?e:"")}),FB.Event.subscribe("edge.remove",function(e){heateorSsmiMycredPoints("Facebook_like_recommend","",e?e:"","Minus point(s) for undoing Facebook like-recommend")}) ),' . ( defined( 'HEATEOR_SHARING_GOOGLE_ANALYTICS_VERSION' ) ? 1 : 0 ) . '&&(FB.Event.subscribe("edge.create",function(e) {heateorSssSsgaSocialPluginsTracking("Facebook","Like",e?e:"")}),FB.Event.subscribe("edge.remove",function(e) {heateorSssSsgaSocialPluginsTracking("Facebook","Unlike",e?e:"")}) )},function(e) {var n,i="facebook-jssdk",o=e.getElementsByTagName("script")[0];e.getElementById(i)||(n=e.createElement("script"),n.id=i,n.async=!0,n.src="//connect.facebook.net/' . ( $this->options['language'] ? $this->options['language'] : 'en_GB' ) . '/sdk.js",o.parentNode.insertBefore(n,o) )}(document);';
}
$inline_script .= '; var heateorSsmiAjaxUrl = "' . get_admin_url() . 'admin-ajax.php";';
wp_enqueue_script( 'heateor_sss_sharing_js', plugins_url( '../public/js/sassy-social-share-public.js', __FILE__ ), array( 'jquery' ), $this->public_class_object->version, $in_footer );
wp_add_inline_script( 'heateor_sss_sharing_js', $inline_script, $position = 'before' );
}
}
if ( NULL === $post ) {
$post_id = 0;
} else {
$post_id = $post->ID;
}
if ( isset( $instance['target_url'] ) ) {
if ( $instance['target_url'] == 'default' ) {
$sharing_url = esc_url_raw( $this->public_class_object->get_http_protocol() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] );
if ( is_home() ) {
$sharing_url = home_url();
$post_id = 0;
} elseif ( ! is_singular() ) {
$post_id = 0;
} elseif ( isset( $_SERVER['QUERY_STRING'] ) && $_SERVER['QUERY_STRING'] ) {
$sharing_url = esc_url_raw( $this->public_class_object->get_http_protocol() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] );
} elseif ( get_permalink( $post -> ID ) ) {
$sharing_url = get_permalink( $post->ID );
}
} elseif ( $instance['target_url'] == 'homepage' ) {
$sharing_url = home_url();
$post_id = 0;
} elseif ( $instance['target_url'] == 'custom' ) {
$sharing_url = isset( $instance['target_url_custom'] ) ? trim( $instance['target_url_custom'] ) : get_permalink( $post->ID );
$post_id = 0;
}
} else {
$sharing_url = get_permalink( $post->ID );
}
$share_count_url = $sharing_url;
if ( isset( $instance['target_url'] ) && $instance['target_url'] == 'default' && is_singular() ) {
$share_count_url = get_permalink( $post -> ID );
}
$custom_post_url = $this->public_class_object->apply_target_share_url_filter( $sharing_url, 'horizontal', ! is_singular() ? true : false );
if ( $custom_post_url != $sharing_url ) {
$sharing_url = $custom_post_url;
$share_count_url = $sharing_url;
}
// share count transient ID
$this->public_class_object->share_count_transient_id = $this->public_class_object->get_share_count_transient_id( $sharing_url );
$cached_share_count = $this->public_class_object->get_cached_share_count( $this->public_class_object->share_count_transient_id );
$short_url = $this->public_class_object->get_short_url( $sharing_url, $post_id );
echo $before_widget;
$sharing_divs = $this->public_class_object->prepare_sharing_html( $short_url ? $short_url : $sharing_url, 'horizontal', isset( $instance['show_counts'] ), isset( $instance['total_shares'] ), ! is_singular() ? true : false );
$sharing_divs = explode( '%instance%', $sharing_divs );
if ( ! empty( $instance['before_widget_content'] ) ) {
echo '
' . esc_html( $instance['before_widget_content'] ) . '
';
}
foreach ( $sharing_divs as $sharing_div ) {
if ( $sharing_div ) {
global $heateor_sss_allowed_tags;
echo wp_kses( "public_class_object->is_amp_page() ? "" : "data-heateor-sss-href='" . ( isset( $share_count_url ) && $share_count_url ? $share_count_url : $sharing_url ) . "'" ) . ( ( $cached_share_count === false || $this->public_class_object->is_amp_page() ) ? "" : 'data-heateor-sss-no-counts="1"' ) . ">", $heateor_sss_allowed_tags );
if ( ! empty( $instance['title'] ) ) {
$title = apply_filters( 'widget_title', $instance[ 'title' ] );
echo $before_title . esc_html( $title ) . $after_title;
}
echo wp_kses( $sharing_div, $heateor_sss_allowed_tags );
echo '
';
}
}
if ( ! empty( $instance['after_widget_content'] ) ) {
echo '' . esc_html( $instance['after_widget_content'] ) . '
';
}
if ( ( isset( $instance['show_counts'] ) || isset( $instance['total_shares'] ) ) && $cached_share_count === false ) {
echo '';
}
echo $after_widget;
}
/**
* Everything which should happen when user edit widget at admin panel.
*
* @since 1.0
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = isset( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
if ( isset( $new_instance['show_counts'] ) ) {
$instance['show_counts'] = $new_instance['show_counts'];
} else {
unset( $instance['show_counts'] );
}
if ( isset( $new_instance['total_shares'] ) ) {
$instance['total_shares'] = $new_instance['total_shares'];
} else {
unset( $instance['total_shares'] );
}
$instance['target_url'] = isset( $new_instance['target_url'] ) ? $new_instance['target_url'] : '';
$instance['target_url_custom'] = isset( $new_instance['target_url_custom'] ) ? $new_instance['target_url_custom'] : '';
$instance['before_widget_content'] = isset( $new_instance['before_widget_content'] ) ? $new_instance['before_widget_content'] : '';
$instance['after_widget_content'] = isset( $new_instance['after_widget_content'] ) ? $new_instance['after_widget_content'] : '';
if ( isset( $new_instance['hide_for_logged_in'] ) ) {
$instance['hide_for_logged_in'] = $new_instance['hide_for_logged_in'];
} else {
unset( $instance['hide_for_logged_in'] );
}
return $instance;
}
/**
* Widget options form at admin panel.
*
* @since 1.0
*/
public function form( $instance ) {
// default widget settings
$defaults = array( 'title' => 'Share the joy', 'show_counts' => '', 'total_shares' => '', 'target_url' => 'default', 'target_url_custom' => '', 'before_widget_content' => '', 'after_widget_content' => '', 'hide_for_logged_in' => '' );
foreach ( $instance as $key => $value ) {
if ( is_string( $value ) ) {
$instance[ $key ] = esc_attr( $value );
}
}
$instance = wp_parse_args( ( array ) $instance, $defaults );
?>
Note:
/>
/>
/>
options = $heateor_sss->options;
$this->public_class_object = new Sassy_Social_Share_Public( $heateor_sss->options, HEATEOR_SSS_VERSION );
parent::__construct(
'heateor_sss_Floating_Sharing', // unique id
'Sassy Social Share - Floating Widget', // widget title
// additional parameters
array(
'description' => __( 'Floating sharing widget. Let your website users share content on popular Social networks like Facebook, Twitter, Tumblr, Whatsapp and many more', 'sassy-social-share' ) )
);
}
/**
* Render widget at front-end
*
* @since 1.0
*/
public function widget( $args, $instance ) {
$amp_options = array();
if ( class_exists( 'AMP_Options_Manager' ) && null !== AMP_Options_Manager::OPTION_NAME ) {
$amp_options = get_option( AMP_Options_Manager::OPTION_NAME );
}
// return if vertical sharing is disabled
if ( ! isset( $this->options['vertical_enable'] ) || ( isset( $this->options['amp_enable'] ) && $amp_options['theme_support'] == 'reader' ) ) {
return;
}
extract( $args );
if ( isset( $instance['hide_for_logged_in'] ) && is_user_logged_in() ) return;
global $post;
if ( isset( $this->options['js_when_needed'] ) && ! wp_script_is( 'heateor_sss_sharing_js' ) ) {
$in_footer = isset( $this->options['footer_script'] ) ? true : false;
$inline_script = 'function heateorSssLoadEvent(e) {var t=window.onload;if (typeof window.onload!="function") {window.onload=e}else{window.onload=function() {t();e()}}};';
if ( $post ) {
$inline_script .= 'var heateorSssInstagramUsername="' . ( $this->options['instagram_username'] != '' ? $this->options['instagram_username'] : $this->options['vertical_instagram_username'] ) . '",heateorSssYoutubeUsername="' . ( $this->options['youtube_username'] != '' ? $this->options['youtube_username'] : $this->options['vertical_youtube_username'] ) . '", heateorSssSharingAjaxUrl = \'' . get_admin_url() . 'admin-ajax.php\', heateorSssCloseIconPath = \'' . plugins_url( '../images/close.png', __FILE__ ) . '\', heateorSssPluginIconPath = \'' . plugins_url( '../images/logo.png', __FILE__ ) . '\', heateorSssHorizontalSharingCountEnable = '. ( isset( $this->options['hor_enable'] ) && ( isset( $this->options['horizontal_counts'] ) || isset( $this->options['horizontal_total_shares'] ) ) ? 1 : 0 ) . ', heateorSssVerticalSharingCountEnable = ' . ( isset( $this->options['vertical_enable'] ) && ( isset( $this->options['vertical_counts'] ) || isset( $this->options['vertical_total_shares'] ) ) ? 1 : 0 ) . ', heateorSssSharingOffset = ' . ( isset( $this->options['alignment'] ) && $this->options['alignment'] != '' && isset( $this->options[$this->options['alignment'] . '_offset'] ) && $this->options[$this->options['alignment'] . '_offset'] != '' ? intval( $this->options[$this->options['alignment'] . '_offset'] ) : 0 ) . '; var heateorSssMobileStickySharingEnabled = ' . ( isset( $this->options['vertical_enable'] ) && isset( $this->options['bottom_mobile_sharing'] ) && $this->options['horizontal_screen_width'] != '' ? 1 : 0 ) . ';';
$inline_script .= 'var heateorSssCopyLinkMessage = "' . htmlspecialchars( __( 'Link copied.', 'sassy-social-share' ), ENT_QUOTES ) . '";';
if ( isset( $this->options['horizontal_counts'] ) && isset( $this->options['horizontal_counter_position'] ) ) {
$inline_script .= in_array( $this->options['horizontal_counter_position'], array( 'inner_left', 'inner_right' ) ) ? 'var heateorSssReduceHorizontalSvgWidth = true;' : '';
$inline_script .= in_array( $this->options['horizontal_counter_position'], array( 'inner_top', 'inner_bottom' ) ) ? 'var heateorSssReduceHorizontalSvgHeight = true;' : '';
}
if ( isset( $this->options['vertical_counts'] ) ) {
$inline_script .= isset( $this->options['vertical_counter_position'] ) && in_array( $this->options['vertical_counter_position'], array( 'inner_left', 'inner_right' ) ) ? 'var heateorSssReduceVerticalSvgWidth = true;' : '';
$inline_script .= ! isset( $this->options['vertical_counter_position'] ) || in_array( $this->options['vertical_counter_position'], array( 'inner_top', 'inner_bottom' ) ) ? 'var heateorSssReduceVerticalSvgHeight = true;' : '';
}
$inline_script .= 'var heateorSssUrlCountFetched = [], heateorSssSharesText = \''. htmlspecialchars(__( 'Shares', 'sassy-social-share' ), ENT_QUOTES ) . '\', heateorSssShareText = \'' . htmlspecialchars( __( 'Share', 'sassy-social-share' ), ENT_QUOTES ) . '\';';
$inline_script .= 'function heateorSssPopup(e) {window.open(e,"popUpWindow","height=400,width=600,left=400,top=100,resizable,scrollbars,toolbar=0,personalbar=0,menubar=no,location=no,directories=no,status")}';
if ( $this->public_class_object->facebook_like_recommend_enabled() || $this->public_class_object->facebook_share_enabled() ) {
$inline_script .= 'function heateorSssInitiateFB() {FB.init({appId:"",channelUrl:"",status:!0,cookie:!0,xfbml:!0,version:"v23.0"})}window.fbAsyncInit=function() {heateorSssInitiateFB(),' . ( defined( 'HEATEOR_SOCIAL_SHARE_MYCRED_INTEGRATION_VERSION' ) && $this->facebook_like_recommend_enabled() ? 1 : 0 ) . '&&(FB.Event.subscribe("edge.create",function(e){heateorSsmiMycredPoints("Facebook_like_recommend","",e?e:"")}),FB.Event.subscribe("edge.remove",function(e){heateorSsmiMycredPoints("Facebook_like_recommend","",e?e:"","Minus point(s) for undoing Facebook like-recommend")}) ),' . ( defined( 'HEATEOR_SHARING_GOOGLE_ANALYTICS_VERSION' ) ? 1 : 0 ) . '&&(FB.Event.subscribe("edge.create",function(e) {heateorSssSsgaSocialPluginsTracking("Facebook","Like",e?e:"")}),FB.Event.subscribe("edge.remove",function(e) {heateorSssSsgaSocialPluginsTracking("Facebook","Unlike",e?e:"")}) )},function(e) {var n,i="facebook-jssdk",o=e.getElementsByTagName("script")[0];e.getElementById(i)||(n=e.createElement("script"),n.id=i,n.async=!0,n.src="//connect.facebook.net/' . ( $this->options['language'] ? $this->options['language'] : 'en_GB' ) . '/sdk.js",o.parentNode.insertBefore(n,o) )}(document);';
}
$inline_script .= '; var heateorSsmiAjaxUrl = "' . get_admin_url() . 'admin-ajax.php";';
wp_enqueue_script( 'heateor_sss_sharing_js', plugins_url( '../public/js/sassy-social-share-public.js', __FILE__ ), array( 'jquery' ), $this->public_class_object->version, $in_footer );
wp_add_inline_script( 'heateor_sss_sharing_js', $inline_script, $position = 'before' );
}
}
$post_id = $post->ID;
if ( isset( $instance['target_url'] ) ) {
if ( $instance['target_url'] == 'default' ) {
$sharing_url = esc_url_raw( $this->public_class_object->get_http_protocol() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] );
if ( is_home() ) {
$sharing_url = home_url();
$post_id = 0;
} elseif ( ! is_singular() ) {
$post_id = 0;
} elseif ( isset( $_SERVER['QUERY_STRING'] ) && $_SERVER['QUERY_STRING'] ) {
$sharing_url = esc_url_raw( $this->public_class_object->get_http_protocol() . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] );
} elseif ( get_permalink( $post->ID ) ) {
$sharing_url = get_permalink( $post->ID );
}
} elseif ( $instance['target_url'] == 'homepage' ) {
$sharing_url = home_url();
$post_id = 0;
} elseif ( $instance['target_url'] == 'custom' ) {
$sharing_url = isset( $instance['target_url_custom'] ) ? trim( $instance['target_url_custom'] ) : get_permalink( $post->ID );
$post_id = 0;
}
} else {
$sharing_url = get_permalink( $post->ID );
}
$share_count_url = $sharing_url;
if ( isset( $instance['target_url'] ) && $instance['target_url'] == 'default' && is_singular() ) {
$share_count_url = get_permalink( $post->ID );
}
$custom_post_url = $this->public_class_object->apply_target_share_url_filter( $sharing_url, 'vertical', false );
if ( $custom_post_url != $sharing_url ) {
$sharing_url = $custom_post_url;
$share_count_url = $sharing_url;
}
$ss_offset = 0;
if ( isset( $instance['alignment'] ) && isset( $instance[$instance['alignment'] . '_offset'] ) ) {
$ss_offset = intval( $instance[$instance['alignment'] . '_offset'] );
}
// share count transient ID
$this->public_class_object->share_count_transient_id = $this->public_class_object->get_share_count_transient_id( $sharing_url );
$cached_share_count = $this->public_class_object->get_cached_share_count( $this->public_class_object->share_count_transient_id );
echo $before_widget;
global $heateor_sss_allowed_tags;
echo wp_kses( "options['bottom_mobile_sharing'] ) ? ' heateor_sss_bottom_sharing' : '' ) . "' data-heateor-ss-offset='" . $ss_offset . "' style='width:" . ( ( $this->options['vertical_sharing_size'] ? $this->options['vertical_sharing_size'] : 35 ) + 4 ) . "px;" . ( isset( $instance['alignment'] ) && $instance['alignment'] != '' && isset( $instance[$instance['alignment'] . '_offset'] ) ? $instance['alignment'] . ': ' . ( $instance[$instance['alignment'].'_offset'] == '' ? 0 : intval( $instance[$instance['alignment'] . '_offset'] ) ) . 'px;' : '' ) . ( isset( $instance['top_offset'] ) ? 'top: ' . ( $instance['top_offset'] == '' ? 0 : $instance['top_offset'] ) . 'px;' : '' ) . ( isset( $instance['vertical_bg'] ) && $instance['vertical_bg'] != '' ? 'background-color:' . $instance['vertical_bg'] . ';' : '-webkit-box-shadow:none;box-shadow:none;' ) . "' " . ( $this->public_class_object->is_amp_page() ? "" : "data-heateor-sss-href='" . ( isset( $share_count_url ) && $share_count_url ? $share_count_url : $sharing_url ) . "'" ) . ( ( $cached_share_count === false || $this->public_class_object->is_amp_page() ) ? "" : 'data-heateor-sss-no-counts="1"' ) . ">", $heateor_sss_allowed_tags );
$short_url = $this->public_class_object->get_short_url( $sharing_url, $post_id );
global $heateor_sss_allowed_tags;
echo wp_kses( $this->public_class_object->prepare_sharing_html( $short_url ? $short_url : $sharing_url, 'vertical', isset( $instance['show_counts'] ), isset( $instance['total_shares'] ) ), $heateor_sss_allowed_tags );
echo '
';
if ( ( isset( $instance['show_counts'] ) || isset( $instance['total_shares'] ) ) && $cached_share_count === false ) {
echo '';
}
echo $after_widget;
}
/**
* Everything which should happen when user edit widget at admin panel.
*
* @since 1.0
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['target_url'] = $new_instance['target_url'];
$instance['show_counts'] = $new_instance['show_counts'];
$instance['total_shares'] = $new_instance['total_shares'];
$instance['target_url_custom'] = $new_instance['target_url_custom'];
$instance['alignment'] = $new_instance['alignment'];
$instance['left_offset'] = $new_instance['left_offset'];
$instance['right_offset'] = $new_instance['right_offset'];
$instance['top_offset'] = $new_instance['top_offset'];
$instance['vertical_bg'] = $new_instance['vertical_bg'];
$instance['hide_for_logged_in'] = $new_instance['hide_for_logged_in'];
return $instance;
}
/**
* Widget options form at admin panel.
*
* @since 1.0
*/
public function form( $instance ) {
/* Set up default widget settings. */
$defaults = array( 'alignment' => 'left', 'show_counts' => '', 'total_shares' => '', 'left_offset' => '40', 'right_offset' => '0', 'target_url' => 'default', 'target_url_custom' => '', 'top_offset' => '100', 'vertical_bg' => '', 'hide_for_logged_in' => '' );
foreach ( $instance as $key => $value ) {
if ( is_string( $value ) ) {
$instance[ $key ] = esc_attr( $value );
}
}
$instance = wp_parse_args( ( array ) $instance, $defaults );
?>
Note:
/>
/>
px
/>
options = $heateor_sss->options;
$this->public_class_object = new Sassy_Social_Share_Public( $heateor_sss->options, HEATEOR_SSS_VERSION );
parent::__construct(
'heateor_sss_Follow', // unique id
__( 'Sassy Social Share - Follow Icons' ), // Widget title
array( 'description' => __( 'These icons link to your Social Media accounts', 'sassy-social-share' ) )
);
}
private function folow_icons_amp( $instance){
$html = '';
$icon_style = 'width:'. $instance['size'] .'px;height:'. $instance['size'] .'px;'. ( $instance['icon_shape'] == 'round' ? 'border-radius:999px;' : '' );
$html .= '';
if ( isset( $instance['facebook'] ) && $instance['facebook'] ) {
$html .= '
';
}
if ( isset( $instance['twitter'] ) && $instance['twitter'] ) {
$html .= '';
}
if ( isset( $instance['instagram'] ) && $instance['instagram'] ) {
$html .= '
';
}
if ( isset( $instance['pinterest'] ) && $instance['pinterest'] ) {
$html .= '
';
}
if ( isset( $instance['flickr'] ) && $instance['flickr'] ) {
$html .= '
';
}
if ( isset( $instance['foursquare'] ) && $instance['foursquare'] ) {
$html .= '
';
}
if ( isset( $instance['github'] ) && $instance['github'] ) {
$html .= '
';
}
if ( isset( $instance['linkedin'] ) && $instance['linkedin'] ) {
$html .= '
';
}
if ( isset( $instance['linkedin_company'] ) && $instance['linkedin_company'] ) {
$html .= '
';
}
if ( isset( $instance['medium'] ) && $instance['medium'] ) {
$html .= '
';
}
if ( isset( $instance['behance'] ) && $instance['behance'] ) {
$html .= '
';
}
if ( isset( $instance['mewe'] ) && $instance['mewe'] ) {
$html .= '
';
}
if ( isset( $instance['odnoklassniki'] ) && $instance['odnoklassniki'] ) {
$html .= '
';
}
if ( isset( $instance['telegram'] ) && $instance['telegram'] ) {
$html .= '
';
}
if ( isset( $instance['tumblr'] ) && $instance['tumblr'] ) {
$html .= '
';
}
if ( isset( $instance['vimeo'] ) && $instance['vimeo'] ) {
$html .= '
';
}
if ( isset( $instance['vkontakte'] ) && $instance['vkontakte'] ) {
$html .= '
';
}
if ( isset( $instance['whatsapp'] ) && $instance['whatsapp'] ) {
$html .= '
';
}
if ( isset( $instance['xing'] ) && $instance['xing'] ) {
$html .= '
';
}
if ( isset( $instance['youtube'] ) && $instance['youtube'] ) {
$html .= '
';
}
if ( isset( $instance['youtube_channel'] ) && $instance['youtube_channel'] ) {
$html .= '
';
}
if ( isset( $instance['rss_feed'] ) && $instance['rss_feed'] ) {
$html .= '';
}
if ( isset( $instance['parler'] ) && $instance['parler'] ) {
$html .= '
';
}
if ( isset( $instance['gab'] ) && $instance['gab'] ) {
$html .= '
';
}
if ( isset( $instance['google_news'] ) && $instance['google_news'] ) {
$html .= '
';
}
$html .= '
';
return $html;
}
/**
* Render widget at front-end
*
* @since 1.0
*/
public function widget( $args, $instance ) {
if ( $this->public_class_object->is_amp_page() ) {
return;
}
extract( $args );
echo $before_widget;
if ( ! empty( $instance['before_widget_content'] ) ) {
echo '' . esc_html( $instance['before_widget_content'] ) . '
';
}
$check_theme = '';
if ( $instance['custom_color'] == '' ) {
$check_theme = '';
} elseif ( $instance['custom_color'] == 'standard' ) {
$check_theme = 'standard_';
} elseif ( $instance['custom_color'] == 'floating' ) {
$check_theme = 'floating_';
}
$style = '';
if ( $instance['type'] == 'floating' ) {
$style = 'position:fixed;top:' . ( isset( $instance['top_offset'] ) ? intval( $instance['top_offset'] ) : 100 ) . 'px;' . ( isset( $instance['alignment'] ) && $instance['alignment'] == 'left' ? 'left' : 'right' ) . ':' . ( isset( $instance['alignment_value'] ) ? intval( $instance['alignment_value'] ) : 100 ) . 'px;width:' . ( isset( $instance['size'] ) ? intval( $instance['size'] ) : 32 ) . 'px;';
}
global $heateor_sss_allowed_tags;
echo wp_kses( '', $heateor_sss_allowed_tags );
if ( ! empty( $instance['title'] ) ) {
$title = apply_filters( 'widget_title', $instance['title'] );
if ( $instance['type'] != 'floating' ) {
echo $before_title;
}
if ( $instance['type'] == 'floating' ) {
echo wp_kses( '
', $heateor_sss_allowed_tags );
}
echo esc_html( $title );
if ( $instance['type'] == 'floating' ) {
echo '
';
}
if ( $instance['type'] != 'floating' ) {
echo $after_title;
}
}
echo wp_kses( $this->follow_icons( $instance ), $heateor_sss_allowed_tags );
echo '
';
echo '
';
if ( ! empty( $instance['after_widget_content'] ) ) {
echo '' . esc_html( $instance['after_widget_content'] ) . '
';
}
echo $after_widget;
}
/**
* Render follow icons
*
* @since 1.0
*/
private function follow_icons( $instance ) {
$logo_color = '#fff';
$html = '';
if ( isset( $instance['type'] ) && $instance['type'] == 'standard' && isset( $instance['hor_alignment'] ) && $instance['hor_alignment'] == "center" ) {
$html .= '';
}
if ( isset( $instance['hide_mobile_sharing'] ) && $instance['vertical_screen_width'] != '' ) {
$html .= '';
}
if ( $instance['custom_color'] == 'standard' ) {
if ( $this->options['horizontal_font_color_default'] ) {
$logo_color = $this->options['horizontal_font_color_default'];
}
if ( $this->options['horizontal_font_color_hover'] ) {
$html .= "";
}
} elseif ( $instance['custom_color'] == 'floating' ) {
if ( $this->options['vertical_font_color_default'] ) {
$logo_color = $this->options['vertical_font_color_default'];
}
if ( $this->options['vertical_font_color_hover'] ) {
$html .= "";
}
}
$bottom_sharing_alignment = ! isset( $instance['bottom_sharing_alignment'] ) || $instance['bottom_sharing_alignment'] == 'left' ? 'left' : 'right';
$bottom_sharing_alignment_inverse = $bottom_sharing_alignment == 'left' ? 'right' : 'left';
$icon_style = 'width:' . $instance['size'] . 'px;height:' . $instance['size'] . 'px;' . ( $instance['icon_shape'] == 'round' ? 'border-radius:999px;' : '' );
$html .= '';
$num_follow_icons = 0;
if ( isset( $instance['facebook'] ) && $instance['facebook'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['twitter'] ) && $instance['twitter'] ) {
$num_follow_icons++;
$html .= '';
}
if ( isset( $instance['x'] ) && $instance['x'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['instagram'] ) && $instance['instagram'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['parler'] ) && $instance['parler'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['gettr'] ) && $instance['gettr'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['pinterest'] ) && $instance['pinterest'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['threads'] ) && $instance['threads'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['tiktok'] ) && $instance['tiktok'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['mastodon'] ) && $instance['mastodon'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['behance'] ) && $instance['behance'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['flickr'] ) && $instance['flickr'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['foursquare'] ) && $instance['foursquare'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['github'] ) && $instance['github'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['linkedin'] ) && $instance['linkedin'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['linkedin_company'] ) && $instance['linkedin_company'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['medium'] ) && $instance['medium'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['mewe'] ) && $instance['mewe'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['odnoklassniki'] ) && $instance['odnoklassniki'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['telegram'] ) && $instance['telegram'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['tumblr'] ) && $instance['tumblr'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['vimeo'] ) && $instance['vimeo'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['vkontakte'] ) && $instance['vkontakte'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['whatsapp'] ) && $instance['whatsapp'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['xing'] ) && $instance['xing'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['youtube'] ) && $instance['youtube'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['youtube_channel'] ) && $instance['youtube_channel'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['rss_feed'] ) && $instance['rss_feed'] ) {
$num_follow_icons++;
$html .= '';
}
if ( isset( $instance['gab'] ) && $instance['gab'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['google_maps'] ) && $instance['google_maps'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['google_news'] ) && $instance['google_news'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['yelp'] ) && $instance['yelp'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['line'] ) && $instance['line'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['bluesky'] ) && $instance['bluesky'] ) {
$num_follow_icons++;
$html .= '
';
}
if ( isset( $instance['micro.blog'] ) && $instance['micro.blog'] ) {
$num_follow_icons++;
$html .= '
';
}
$html = apply_filters( 'heateor_sss_follow_icons', $html, $instance, $icon_style );
$html .= '
';
$bottom_sharing_responsive_css = '';
if ( isset( $instance['type'] ) && $instance['type'] == 'floating' && isset( $instance['bottom_sharing_position_radio'] ) && $instance['bottom_sharing_position_radio'] == 'responsive' ) {
$bottom_sharing_responsive_css = 'div.heateor_sss_bottom_follow{width:100%!important;left:0!important;}div.heateor_sss_bottom_follow a{margin:0!important;width:' . ( 100/( $num_follow_icons ) ) . '%}div.heateor_sss_bottom_follow .heateor_sss_svg{width:100%!important;}';
}
if ( isset( $instance['type'] ) && $instance['type'] == 'floating' && isset( $instance['bottom_mobile_sharing'] ) && $instance['horizontal_screen_width'] != '' && isset( $instance['bottom_sharing_position_radio'] ) && $instance['bottom_sharing_position_radio'] == 'responsive' ) {
$bottom_sharing_position = isset( $instance['bottom_sharing_position'] ) ? $instance['bottom_sharing_position'] : '0';
$html .= '';
}
return $html;
}
/**
* Validate the widget options
*
* @since 1.0
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['mobile_sharing'] = $new_instance['mobile_sharing'];
$instance['hor_alignment'] = $new_instance['hor_alignment'];
$instance['bottom_mobile_sharing'] = $new_instance['bottom_mobile_sharing'];
$instance['vertical_screen_width'] = $new_instance['vertical_screen_width'];
$instance['horizontal_screen_width'] = $new_instance['horizontal_screen_width'];
$instance['bottom_sharing_position_radio'] = $new_instance['bottom_sharing_position_radio'];
$instance['bottom_sharing_position'] = $new_instance['bottom_sharing_position'];
$instance['bottom_sharing_alignment'] = $new_instance['bottom_sharing_alignment'];
$instance['type'] = $new_instance['type'];
$instance['top_offset'] = $new_instance['top_offset'];
$instance['alignment_value'] = $new_instance['alignment_value'];
$instance['alignment'] = $new_instance['alignment'];
$instance['size'] = intval( $new_instance['size'] );
$instance['icon_shape'] = $new_instance['icon_shape'];
$instance['custom_color'] = $new_instance['custom_color'];
$instance['facebook'] = $new_instance['facebook'];
$instance['twitter'] = $new_instance['twitter'];
$instance['instagram'] = $new_instance['instagram'];
$instance['parler'] = $new_instance['parler'];
$instance['pinterest'] = $new_instance['pinterest'];
$instance['behance'] = $new_instance['behance'];
$instance['flickr'] = $new_instance['flickr'];
$instance['foursquare'] = $new_instance['foursquare'];
$instance['github'] = $new_instance['github'];
$instance['gitlab'] = $new_instance['gitlab'];
$instance['linkedin'] = $new_instance['linkedin'];
$instance['linkedin_company'] = $new_instance['linkedin_company'];
$instance['medium'] = $new_instance['medium'];
$instance['gettr'] = $new_instance['gettr'];
$instance['mewe'] = $new_instance['mewe'];
$instance['odnoklassniki'] = $new_instance['odnoklassniki'];
$instance['telegram'] = $new_instance['telegram'];
$instance['threads'] = $new_instance['threads'];
$instance['bluesky'] = $new_instance['bluesky'];
$instance['micro.blog'] = $new_instance['micro.blog'];
$instance['tiktok'] = $new_instance['tiktok'];
$instance['tumblr'] = $new_instance['tumblr'];
$instance['vimeo'] = $new_instance['vimeo'];
$instance['vkontakte'] = $new_instance['vkontakte'];
$instance['whatsapp'] = $new_instance['whatsapp'];
$instance['line'] = $new_instance['line'];
$instance['mastodon'] = $new_instance['mastodon'];
$instance['x'] = $new_instance['x'];
$instance['xing'] = $new_instance['xing'];
$instance['youtube'] = $new_instance['youtube'];
$instance['youtube_channel'] = $new_instance['youtube_channel'];
$instance['rss_feed'] = $new_instance['rss_feed'];
$instance['gab'] = $new_instance['gab'];
$instance['google_maps'] = $new_instance['google_maps'];
$instance['google_news'] = $new_instance['google_news'];
$instance['google_news'] = $new_instance['google_news'];
$instance['yelp'] = $new_instance['yelp'];
$instance['before_widget_content'] = $new_instance['before_widget_content'];
$instance['after_widget_content'] = $new_instance['after_widget_content'];
return $instance;
}
/**
* Widget options form
*
* @since 1.0
*/
public function form( $instance ) {
/* default widget settings. */
$defaults = array( 'hor_alignment' => 'left', 'title' => '', 'type' => 'standard', 'alignment' => 'right', 'size' => '35', 'icon_shape' => 'round', 'custom_color' => '', 'facebook' => '', 'twitter' => '', 'line' => '', 'mastodon' => '', 'threads' => '', 'instagram' => '', 'tiktok' => '', 'parler' => '', 'x' => '', 'pinterest' => '', 'behance' => '', 'flickr' => '', 'foursquare' => '', 'github' => '', 'gitlab' => '', 'linkedin' => '', 'linkedin_company' => '', 'medium' => '', 'mewe' => '', 'odnoklassniki' => '', 'telegram' => '', 'tumblr' => '', 'vimeo' => '', 'vkontakte' => '', 'whatsapp' => '', 'xing' => '', 'youtube' => '', 'youtube_channel' => '', 'rss_feed' => '', 'gab' => '', 'bluesky' => '', 'micro.blog' => '', 'gettr' => '', 'google_maps' => '', 'yelp' => '', 'google_news' => '', 'before_widget_content' => '', 'after_widget_content' => '', 'top_offset' => '200', 'alignment_value' => '0', 'mobile_sharing' => '1', 'bottom_mobile_sharing' => '1', 'vertical_screen_width' => '783', 'horizontal_screen_width' => '783', 'bottom_sharing_alignment' => 'left', 'bottom_sharing_position_radio' => 'responsive', 'bottom_sharing_position' => '0' );
foreach ( $instance as $key => $value ) {
if ( is_string( $value ) ) {
$instance[ $key ] = esc_attr( $value );
}
}
$instance = wp_parse_args( ( array ) $instance, $defaults );
?>
>
>
px
https://www.behance.net/ID
https://bsky.app/profile/ID.bsky.social
https://www.facebook.com/ID
https://www.flickr.com/photos/ID
https://foursquare.com/ID
https://gab.com/ID
https://gettr.com/user/ID
https://github.com/ID
https://www.instagram.com/ID
https://www.linkedin.com/in/ID
https://www.linkedin.com/company/ID
https://medium.com/@ID
https://mewe.com/profile/ID
https://micro.blog/ID
()
https://www.minds.com/ID
https://ok.ru/profile/ID
https://parler.com/profile/ID
https://www.pinterest.com/ID
http://www.example.com/feed/
()
https://www.snapchat.com/add/ID
https://t.me/username
https://www.tiktok.com/@ID
https://www.threads.net/@ID
()
https://truthsocial.com/@username
https://ID.tumblr.com
https://twitter.com/ID
https://vimeo.com/ID
https://vk.com/ID
https://wa.me/PHONE_NUMBER
https://x.com/ID
https://www.xing.com/profile/ID
https://www.yelp.com/biz/catskill-momos-delhi
https://www.youtube.com/user/ID
https://www.youtube.com/channel/ID