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.0
*/
public function widget( $args, $instance ) {
// return if standard sharing is disabled
if ( ! isset( $this->options['hor_enable'] ) ) {
return;
}
extract( $args );
if ( $instance['hide_for_logged_in'] == 1 && is_user_logged_in() ) return;
global $post;
if ( NULL === $post ) {
$post_id = 0;
} else {
$post_id = $post->ID;
}
if ( isset( $instance['target_url'] ) ) {
if ( $instance['target_url'] == 'default' ) {
$sharing_url = html_entity_decode( esc_url( $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 = html_entity_decode( esc_url( $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 );
echo "
public_class_object->is_amp_page() ? "" : "heateor-sss-data-href='" . ( isset( $share_count_url ) && $share_count_url ? $share_count_url : $sharing_url ) . "'" ) . ( ( $cached_share_count === false || $this->public_class_object->is_amp_page() ) ? "" : 'heateor-sss-no-counts="1"' ) .">";
echo $before_widget;
if ( ! empty( $instance['title'] ) ) {
$title = apply_filters( 'widget_title', $instance[ 'title' ] );
echo $before_title . $title . $after_title;
}
if ( ! empty( $instance['before_widget_content'] ) ) {
echo '
' . $instance['before_widget_content'] . '
';
}
$short_url = $this->public_class_object->get_short_url( $sharing_url, $post_id );
echo $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 );
if ( ! empty( $instance['after_widget_content'] ) ) {
echo '
' . $instance['after_widget_content'] . '
';
}
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.0
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['show_counts'] = $new_instance['show_counts'];
$instance['total_shares'] = $new_instance['total_shares'];
$instance['target_url'] = $new_instance['target_url'];
$instance['target_url_custom'] = $new_instance['target_url_custom'];
$instance['before_widget_content'] = $new_instance['before_widget_content'];
$instance['after_widget_content'] = $new_instance['after_widget_content'];
$instance['hide_for_logged_in'] = $new_instance['hide_for_logged_in'];
return $instance;
}
/**
* Widget options form at admin panel.
*
* @since 1.0.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.0
*/
public function widget( $args, $instance ) {
// return if vertical sharing is disabled
if ( ! isset( $this->options['vertical_enable'] ) ) {
return;
}
extract( $args );
if ( $instance['hide_for_logged_in'] == 1 && is_user_logged_in() ) return;
global $post;
$post_id = $post -> ID;
if ( isset( $instance['target_url'] ) ) {
if ( $instance['target_url'] == 'default' ) {
$sharing_url = html_entity_decode( esc_url( $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 = html_entity_decode( esc_url( $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;
}
$ssOffset = 0;
if ( isset( $instance['alignment'] ) && isset( $instance[$instance['alignment'] . '_offset'] ) ) {
$ssOffset = $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 "options['bottom_mobile_sharing'] ) ? ' heateor_sss_bottom_sharing' : '' ) . "' ss-offset='" . $ssOffset . "' 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 : $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() ? "" : "heateor-sss-data-href='" . ( isset( $share_count_url ) && $share_count_url ? $share_count_url : $sharing_url ) . "'" ) . ( ( $cached_share_count === false || $this->public_class_object->is_amp_page() ) ? "" : 'heateor-sss-no-counts="1"' ) .">";
$short_url = $this->public_class_object->get_short_url( $sharing_url, $post_id );
//echo $before_widget;
echo $this->public_class_object->prepare_sharing_html( $short_url ? $short_url : $sharing_url, 'vertical', isset( $instance['show_counts'] ), isset( $instance['total_shares'] ) );
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.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.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
/>
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' ) )
);
}
/**
* Render widget at front-end
*
* @since 3.1.7
*/
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 '' . $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_';
}
echo '';
if ( ! empty( $instance['title'] ) ) {
$title = apply_filters( 'widget_title', $instance[ 'title' ] );
echo $before_title;
if ( $instance['type'] == 'floating' ) {
echo '
';
}
echo $title;
if ( $instance['type'] == 'floating' ) {
echo '
';
}
echo $after_title;
}
echo $this->follow_icons( $instance );
echo '
';
echo '
';
if ( ! empty( $instance['after_widget_content'] ) ) {
echo '' . $instance['after_widget_content'] . '
';
}
echo $after_widget;
}
/**
* Render follow icons
*
* @since 3.1.7
*/
private function follow_icons( $instance ) {
$html = '';
$icon_style = 'width:'. $instance['size'] .'px;height:'. $instance['size'] .'px;'. ( $instance['icon_shape'] == 'round' ? 'border-radius:999px;' : '' );
$html .= '';
if ( $instance['facebook'] ) {
$html .= '';
}
if ( $instance['twitter'] ) {
$html .= '';
}
if ( $instance['instagram'] ) {
$html .= '';
}
if ( $instance['pinterest'] ) {
$html .= '';
}
if ( $instance['behance'] ) {
$html .= '';
}
if ( $instance['flickr'] ) {
$html .= '';
}
if ( $instance['foursquare'] ) {
$html .= '';
}
if ( $instance['github'] ) {
$html .= '';
}
if ( $instance['linkedin'] ) {
$html .= '';
}
if ( $instance['linkedin_company'] ) {
$html .= '';
}
if ( $instance['medium'] ) {
$html .= '';
}
if ( $instance['mewe'] ) {
$html .= '';
}
if ( $instance['odnoklassniki'] ) {
$html .= '';
}
if ( $instance['snapchat'] ) {
$html .= '';
}
if ( $instance['telegram'] ) {
$html .= '';
}
if ( $instance['tumblr'] ) {
$html .= '';
}
if ( $instance['vimeo'] ) {
$html .= '';
}
if ( $instance['vkontakte'] ) {
$html .= '';
}
if ( $instance['whatsapp'] ) {
$html .= '';
}
if ( $instance['xing'] ) {
$html .= '';
}
if ( $instance['youtube'] ) {
$html .= '';
}
if ( $instance['youtube_channel'] ) {
$html .= '';
}
if ( $instance['rss_feed'] ) {
$html .= '';
}
$html = apply_filters( 'heateor_sss_follow_icons', $html, $instance, $icon_style );
$html .= '
';
return $html;
}
/**
* Validate the widget options
*
* @since 3.1.7
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$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['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['mewe'] = $new_instance['mewe'];
$instance['odnoklassniki'] = $new_instance['odnoklassniki'];
$instance['snapchat'] = $new_instance['snapchat'];
$instance['telegram'] = $new_instance['telegram'];
$instance['tumblr'] = $new_instance['tumblr'];
$instance['vimeo'] = $new_instance['vimeo'];
$instance['vkontakte'] = $new_instance['vkontakte'];
$instance['whatsapp'] = $new_instance['whatsapp'];
$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['before_widget_content'] = $new_instance['before_widget_content'];
$instance['after_widget_content'] = $new_instance['after_widget_content'];
return $instance;
}
/**
* Widget options form
*
* @since 3.1.7
*/
public function form( $instance ) {
/* default widget settings. */
$defaults = array( 'title' => '', 'type' => 'standard', 'alignment' => 'right', 'size' => '32', 'icon_shape' => 'round', 'custom_color' => '', 'facebook' => '', 'twitter' => '', 'instagram' => '', 'pinterest' => '', 'behance' => '', 'flickr' => '', 'foursquare' => '', 'github' => '', 'gitlab' => '', 'linkedin' => '', 'linkedin_company' => '', 'medium' => '', 'mewe' => '', 'odnoklassniki' => '', 'snapchat' => '', 'telegram' => '', 'tumblr' => '', 'vimeo' => '', 'vkontakte' => '', 'whatsapp' => '', 'xing' => '', 'youtube' => '', 'youtube_channel' => '', 'rss_feed' => '', 'before_widget_content' => '', 'after_widget_content' => '', 'top_offset' => '200', 'alignment_value' => '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.facebook.com/ID
https://twitter.com/ID
https://www.instagram.com/ID
https://www.pinterest.com/ID
https://www.behance.net/ID
https://www.flickr.com/photos/ID
https://foursquare.com/ID
https://github.com/ID
https://www.linkedin.com/in/ID
https://www.linkedin.com/company/ID
https://medium.com/@ID
https://mewe.com/profile/ID
https://ok.ru/profile/ID
https://www.snapchat.com/add/ID
https://t.me/username
https://ID.tumblr.com
https://vimeo.com/ID
https://vk.com/ID
https://wa.me/PHONE_NUMBER
https://www.xing.com/profile/ID
https://www.youtube.com/user/ID
https://www.youtube.com/channel/ID
http://www.example.com/feed/