Simple Social Media Share Buttons – Social Sharing for Everyone - Version 2.1.4

Version Description

  • Please upgrade immediately. Many enhancements and bugfixes.

=

Download this release

Release Info

Developer hiddenpearls
Plugin Icon 128x128 Simple Social Media Share Buttons – Social Sharing for Everyone
Version 2.1.4
Comparing to
See all releases

Code changes from version 2.1.3 to 2.1.4

assets/css/front.css CHANGED
@@ -1634,7 +1634,8 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1634
  .simplesocialbuttons.simplesocial-simple-round button.simplesocial-viber-share:after,
1635
  .simplesocialbuttons.simplesocial-simple-round button.simplesocial-reddit-share:after,
1636
  .simplesocialbuttons.simplesocial-simple-round button.simplesocial-linkedin-share:after,
1637
- .simplesocialbuttons.simplesocial-simple-round button.simplesocial-pinterest-share:after{
 
1638
  background: none;
1639
  }
1640
  .simplesocialbuttons.simplesocial-simple-round button.simplesocial-msng-share:after{
@@ -1684,7 +1685,7 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1684
  .simplesocialbuttons.simplesocial-round-txt button.simplesocial-tumblr-share .ssb_counter{
1685
  background: #36465d;
1686
  }
1687
- .simplesocialbuttons.simplesocial-sm-round.ssb_counter-activate button:not(.simplesocial-viber-share):not(.simplesocial-whatsapp-share):not(.simplesocial-msng-share):not(.simplesocial-email-share):not(.simplesocial-print-share){
1688
  padding-right: 50px;
1689
  position: relative;
1690
  }
@@ -1692,7 +1693,7 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1692
  position: absolute;
1693
  top: 0;
1694
  right: 0;
1695
- width: 34px;
1696
  text-align: center;
1697
  height: 36px;
1698
  line-height: 36px;
@@ -1701,8 +1702,9 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1701
  background-image: linear-gradient(to right, rgb(255,255,255) 0%, rgb(221,221,221) 100%);
1702
  border-left: 1px solid #dedede;
1703
  border-radius: 0 3px 3px 0;
 
1704
  }
1705
- .simplesocialbuttons.simplesocial-simple-round.ssb_counter-activate button:not(.simplesocial-viber-share):not(.simplesocial-whatsapp-share):not(.simplesocial-msng-share):not(.simplesocial-email-share):not(.simplesocial-print-share){
1706
  padding-right: 50px;
1707
  position: relative;
1708
  }
@@ -1710,7 +1712,7 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1710
  position: absolute;
1711
  top: 1px;
1712
  right: 1px;
1713
- width: 34px;
1714
  text-align: center;
1715
  height: 36px;
1716
  line-height: 36px;
@@ -1751,7 +1753,7 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1751
  position: absolute;
1752
  top: 1px;
1753
  right: 1px;
1754
- width: 34px;
1755
  text-align: center;
1756
  height: 39px;
1757
  line-height: 39px;
@@ -1780,7 +1782,7 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1780
  color: #C92228;
1781
  }
1782
 
1783
- .simplesocialbuttons.simplesocial-flat-button-border.ssb_counter-activate button:not(.simplesocial-whatsapp-share):not(.simplesocial-viber-share):not(.simplesocial-msng-share):not(.simplesocial-email-share):not(.simplesocial-print-share){
1784
  padding-right: 50px;
1785
  position: relative;
1786
  }
@@ -1788,7 +1790,7 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1788
  position: absolute;
1789
  top: 1px;
1790
  right: 1px;
1791
- width: 34px;
1792
  text-align: center;
1793
  height: 39px;
1794
  line-height: 39px;
@@ -1819,7 +1821,7 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1819
  .simplesocialbuttons.simplesocial-flat-button-border button.simplesocial-tumblr-share .ssb_counter{
1820
  color: #36465d;
1821
  }
1822
- .simplesocialbuttons.simplesocial-round-btm-border.ssb_counter-activate button:not(.simplesocial-viber-share):not(.simplesocial-whatsapp-share):not(.simplesocial-msng-share):not(.simplesocial-email-share):not(.simplesocial-print-share){
1823
  padding-right: 60px;
1824
  position: relative;
1825
  }
@@ -1833,7 +1835,7 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1833
  border-radius: 3px;
1834
  height: 40px;
1835
  line-height: 40px;
1836
- width: 40px;
1837
  text-align: center;
1838
  }
1839
  .simplesocial-round-btm-border .ssb_counter:after {
@@ -1903,17 +1905,18 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
1903
  }
1904
  .simplesocialbuttons.simplesocial-round-icon button .ssb_counter {
1905
  position: absolute;
1906
- top: -6px;
1907
  right: -6px;
1908
  font-size: 10px;
1909
  color: #fff;
1910
  height: 17px;
1911
  line-height: 12px;
1912
- width: 17px;
1913
  border:1px solid transparent;
1914
  left: auto;
1915
- border-radius: 50%;
1916
  background: #fff;
 
1917
  text-align: center;
1918
  line-height: 15px;
1919
  padding: 0;
@@ -2033,6 +2036,11 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-sm-roun
2033
  background: #C92228;
2034
  }
2035
 
 
 
 
 
 
2036
 
2037
  div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-round button.simplesocial-fb-share .ssb_counter{
2038
  background: #ffffff;
@@ -2062,6 +2070,10 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-
2062
  background: #ffffff;
2063
  border:1px solid #C92228;
2064
  }
 
 
 
 
2065
  /*.simplesocialbuttons.simplesocial-flat-button-border button.simplesocial-fb-share .ssb_counter{
2066
 
2067
  }*/
@@ -2094,9 +2106,13 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-flat-bu
2094
  background: #ffffff;
2095
  border-color: #C92228;
2096
  }
 
 
 
 
2097
 
2098
  div[class*="simplesocialbuttons-float"]:not(.simplesocial-simple-icons) button .ssb_counter,div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-sm-round:not(.simplesocial-simple-icons) .ssb_counter{
2099
- width: 15px;
2100
  height: 15px;
2101
  color: #fff;
2102
  top: -10px;
@@ -2110,7 +2126,7 @@ div[class*="simplesocialbuttons-float"]:not(.simplesocial-simple-icons) button .
2110
  }
2111
 
2112
  div[class*="simplesocialbuttons-float"].simplesocial-round-txt button .ssb_counter{
2113
- border-radius: 50%;
2114
  height: 22px;
2115
  min-width: 22px;
2116
  line-height: 20px;
@@ -2124,13 +2140,13 @@ div.simplesocialbuttons.simplesocialbuttons-float-left-center:not(.simplesocial-
2124
  left: auto;
2125
  }
2126
  div[class*="simplesocialbuttons-float"].simplesocial-flat-button-border.ssb_counter-activate .ssb_counter{
2127
- width: 20px;
2128
  height: 20px;
2129
  line-height: 18px;
2130
  top: -10px;
2131
  }
2132
  div[class*="simplesocialbuttons-float"].simplesocial-simple-round.ssb_counter-activate .ssb_counter{
2133
- width: 20px;
2134
  height: 20px;
2135
  line-height: 18px;
2136
  top: -10px;
@@ -2152,6 +2168,7 @@ div[class*="simplesocialbuttons-float"]:not(.simplesocial-simple-icons) button
2152
  position: absolute;
2153
  color: #fff;
2154
  line-height: 15px;
 
2155
  }
2156
  div[class*="simplesocialbuttons-float"].simplesocialbuttons:not(.simplesocial-simple-icons) button{
2157
  padding-left: 34px;
@@ -2200,6 +2217,9 @@ div[class*="simplesocialbuttons-float"].simplesocialbuttons .ssb-fb-like{
2200
  div[class*="simplesocialbuttons-float-right"].simplesocialbuttons .ssb-fb-like{
2201
  float: right;
2202
  }
 
 
 
2203
  div[class*="simplesocialbuttons-float-left"].simplesocial-simple-icons .ssb_total_counter{
2204
  display: block;
2205
  text-align: left;
@@ -2464,8 +2484,11 @@ div.simplesocialbuttons-float-right-post{
2464
  .simplesocialbuttons-float-right-post.float-in{
2465
  opacity: 1;
2466
  }
 
 
 
2467
  .simplesocialbuttons.simplesocial-simple-round.simplesocialbuttons-float-left-post.ssb_counter-activate .ssb_counter{
2468
- width: 15px;
2469
  height: 15px;
2470
  color: #fff;
2471
  top: -10px;
@@ -2477,7 +2500,7 @@ div.simplesocialbuttons-float-right-post{
2477
  color: #000;
2478
  }
2479
  .simplesocialbuttons.simplesocial-simple-round.simplesocialbuttons-float-right-post.ssb_counter-activate .ssb_counter{
2480
- width: 15px;
2481
  height: 15px;
2482
  color: #fff;
2483
  top: -10px;
1634
  .simplesocialbuttons.simplesocial-simple-round button.simplesocial-viber-share:after,
1635
  .simplesocialbuttons.simplesocial-simple-round button.simplesocial-reddit-share:after,
1636
  .simplesocialbuttons.simplesocial-simple-round button.simplesocial-linkedin-share:after,
1637
+ .simplesocialbuttons.simplesocial-simple-round button.simplesocial-pinterest-share:after,
1638
+ .simplesocialbuttons.simplesocial-simple-round button.simplesocial-tumblr-share:after{
1639
  background: none;
1640
  }
1641
  .simplesocialbuttons.simplesocial-simple-round button.simplesocial-msng-share:after{
1685
  .simplesocialbuttons.simplesocial-round-txt button.simplesocial-tumblr-share .ssb_counter{
1686
  background: #36465d;
1687
  }
1688
+ .simplesocialbuttons.simplesocial-sm-round.ssb_counter-activate button:not(.simplesocial-viber-share):not(.simplesocial-whatsapp-share):not(.simplesocial-msng-share):not(.simplesocial-email-share):not(.simplesocial-print-share):not(.simplesocial-linkedin-share){
1689
  padding-right: 50px;
1690
  position: relative;
1691
  }
1693
  position: absolute;
1694
  top: 0;
1695
  right: 0;
1696
+ min-width: 34px;
1697
  text-align: center;
1698
  height: 36px;
1699
  line-height: 36px;
1702
  background-image: linear-gradient(to right, rgb(255,255,255) 0%, rgb(221,221,221) 100%);
1703
  border-left: 1px solid #dedede;
1704
  border-radius: 0 3px 3px 0;
1705
+ padding: 0 2px;
1706
  }
1707
+ .simplesocialbuttons.simplesocial-simple-round.ssb_counter-activate button:not(.simplesocial-viber-share):not(.simplesocial-whatsapp-share):not(.simplesocial-msng-share):not(.simplesocial-email-share):not(.simplesocial-print-share):not(.simplesocial-linkedin-share){
1708
  padding-right: 50px;
1709
  position: relative;
1710
  }
1712
  position: absolute;
1713
  top: 1px;
1714
  right: 1px;
1715
+ min-width: 34px;
1716
  text-align: center;
1717
  height: 36px;
1718
  line-height: 36px;
1753
  position: absolute;
1754
  top: 1px;
1755
  right: 1px;
1756
+ min-width: 34px;
1757
  text-align: center;
1758
  height: 39px;
1759
  line-height: 39px;
1782
  color: #C92228;
1783
  }
1784
 
1785
+ .simplesocialbuttons.simplesocial-flat-button-border.ssb_counter-activate button:not(.simplesocial-whatsapp-share):not(.simplesocial-viber-share):not(.simplesocial-msng-share):not(.simplesocial-email-share):not(.simplesocial-print-share):not(.simplesocial-linkedin-share){
1786
  padding-right: 50px;
1787
  position: relative;
1788
  }
1790
  position: absolute;
1791
  top: 1px;
1792
  right: 1px;
1793
+ min-width: 34px;
1794
  text-align: center;
1795
  height: 39px;
1796
  line-height: 39px;
1821
  .simplesocialbuttons.simplesocial-flat-button-border button.simplesocial-tumblr-share .ssb_counter{
1822
  color: #36465d;
1823
  }
1824
+ .simplesocialbuttons.simplesocial-round-btm-border.ssb_counter-activate button:not(.simplesocial-viber-share):not(.simplesocial-whatsapp-share):not(.simplesocial-msng-share):not(.simplesocial-email-share):not(.simplesocial-print-share):not(.simplesocial-linkedin-share){
1825
  padding-right: 60px;
1826
  position: relative;
1827
  }
1835
  border-radius: 3px;
1836
  height: 40px;
1837
  line-height: 40px;
1838
+ min-width: 40px;
1839
  text-align: center;
1840
  }
1841
  .simplesocial-round-btm-border .ssb_counter:after {
1905
  }
1906
  .simplesocialbuttons.simplesocial-round-icon button .ssb_counter {
1907
  position: absolute;
1908
+ top: -9px;
1909
  right: -6px;
1910
  font-size: 10px;
1911
  color: #fff;
1912
  height: 17px;
1913
  line-height: 12px;
1914
+ min-width: 17px;
1915
  border:1px solid transparent;
1916
  left: auto;
1917
+ /* border-radius: 50%; */
1918
  background: #fff;
1919
+ width: auto;
1920
  text-align: center;
1921
  line-height: 15px;
1922
  padding: 0;
2036
  background: #C92228;
2037
  }
2038
 
2039
+ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-sm-round button.simplesocial-tumblr-share .ssb_counter{
2040
+ border-color: #36465d;
2041
+ color: #ffffff;
2042
+ background: #36465d;
2043
+ }
2044
 
2045
  div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-round button.simplesocial-fb-share .ssb_counter{
2046
  background: #ffffff;
2070
  background: #ffffff;
2071
  border:1px solid #C92228;
2072
  }
2073
+ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-round button.simplesocial-tumblr-share .ssb_counter{
2074
+ background: #ffffff;
2075
+ border:1px solid #36465d;
2076
+ }
2077
  /*.simplesocialbuttons.simplesocial-flat-button-border button.simplesocial-fb-share .ssb_counter{
2078
 
2079
  }*/
2106
  background: #ffffff;
2107
  border-color: #C92228;
2108
  }
2109
+ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-flat-button-border button.simplesocial-tumblr-share .ssb_counter{
2110
+ background: #ffffff;
2111
+ border-color: #36465d;
2112
+ }
2113
 
2114
  div[class*="simplesocialbuttons-float"]:not(.simplesocial-simple-icons) button .ssb_counter,div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-sm-round:not(.simplesocial-simple-icons) .ssb_counter{
2115
+ min-width: 15px;
2116
  height: 15px;
2117
  color: #fff;
2118
  top: -10px;
2126
  }
2127
 
2128
  div[class*="simplesocialbuttons-float"].simplesocial-round-txt button .ssb_counter{
2129
+ border-radius: 0;
2130
  height: 22px;
2131
  min-width: 22px;
2132
  line-height: 20px;
2140
  left: auto;
2141
  }
2142
  div[class*="simplesocialbuttons-float"].simplesocial-flat-button-border.ssb_counter-activate .ssb_counter{
2143
+ min-width: 20px;
2144
  height: 20px;
2145
  line-height: 18px;
2146
  top: -10px;
2147
  }
2148
  div[class*="simplesocialbuttons-float"].simplesocial-simple-round.ssb_counter-activate .ssb_counter{
2149
+ min-width: 20px;
2150
  height: 20px;
2151
  line-height: 18px;
2152
  top: -10px;
2168
  position: absolute;
2169
  color: #fff;
2170
  line-height: 15px;
2171
+ height: 17px;
2172
  }
2173
  div[class*="simplesocialbuttons-float"].simplesocialbuttons:not(.simplesocial-simple-icons) button{
2174
  padding-left: 34px;
2217
  div[class*="simplesocialbuttons-float-right"].simplesocialbuttons .ssb-fb-like{
2218
  float: right;
2219
  }
2220
+ div[class*="simplesocialbuttons-float-right"].simplesocialbuttons .ssb_total_counter{
2221
+ float: right;
2222
+ }
2223
  div[class*="simplesocialbuttons-float-left"].simplesocial-simple-icons .ssb_total_counter{
2224
  display: block;
2225
  text-align: left;
2484
  .simplesocialbuttons-float-right-post.float-in{
2485
  opacity: 1;
2486
  }
2487
+ .ssb_counter{
2488
+ padding: 0 2px;
2489
+ }
2490
  .simplesocialbuttons.simplesocial-simple-round.simplesocialbuttons-float-left-post.ssb_counter-activate .ssb_counter{
2491
+ min-width: 15px;
2492
  height: 15px;
2493
  color: #fff;
2494
  top: -10px;
2500
  color: #000;
2501
  }
2502
  .simplesocialbuttons.simplesocial-simple-round.simplesocialbuttons-float-right-post.ssb_counter-activate .ssb_counter{
2503
+ min-width: 15px;
2504
  height: 15px;
2505
  color: #fff;
2506
  top: -10px;
assets/js/admin.js CHANGED
@@ -224,6 +224,16 @@
224
 
225
  });
226
 
 
 
 
 
 
 
 
 
 
 
227
  $(document).on('click', '.show_pinterest_check', function () {
228
  var widget_content = $(this).parent().parent();
229
  if ($(this).is(':checked')) {
224
 
225
  });
226
 
227
+ $(document).on('click', '.youtube_count_check', function () {
228
+
229
+ var youtube_content = $(this).parent().parent();
230
+ if ($(this).is(':checked')) {
231
+ $(youtube_content).find('.youtube_api_key').css('display', 'block');
232
+ } else {
233
+ $(youtube_content).find('.youtube_api_key').css('display', 'none');
234
+ }
235
+ });
236
+
237
  $(document).on('click', '.show_pinterest_check', function () {
238
  var widget_content = $(this).parent().parent();
239
  if ($(this).is(':checked')) {
assets/js/front.js CHANGED
@@ -126,6 +126,11 @@ var ssbPlugin = ssbPlugin || {};
126
  // $('.simplesocialbuttons_inline').addClass('simplesocialbuttons-inline-in');
127
  var sidebarwidth = $('div[class*="simplesocialbuttons-float"]>a:first-child').outerWidth(true);
128
  $('div[class*="simplesocialbuttons-float"]').css('width', sidebarwidth + 'px');
 
 
 
 
 
129
  // var sidebaroffset = $(window).width() - 1100;
130
  // if($('.simplesocialbuttons-float-left-post').length>0){
131
  // $('.simplesocialbuttons-float-left-post').css('left', sidebaroffset/2+'px');
126
  // $('.simplesocialbuttons_inline').addClass('simplesocialbuttons-inline-in');
127
  var sidebarwidth = $('div[class*="simplesocialbuttons-float"]>a:first-child').outerWidth(true);
128
  $('div[class*="simplesocialbuttons-float"]').css('width', sidebarwidth + 'px');
129
+ $('.simplesocialbuttons.ssb_counter-activate:not(.simplesocial-round-txt):not(.simplesocial-round-icon) button:not(.simplesocial-viber-share):not(.simplesocial-whatsapp-share):not(.simplesocial-msng-share):not(.simplesocial-email-share):not(.simplesocial-print-share):not(.simplesocial-linkedin-share)').each(function(){
130
+ var $elWidth = $(this).children('.ssb_counter').outerWidth();
131
+ $(this).css('padding-right', $elWidth + 10);
132
+ console.log($elWidth, $elWidth + 10, $(this).attr('class'));
133
+ });
134
  // var sidebaroffset = $(window).width() - 1100;
135
  // if($('.simplesocialbuttons-float-left-post').length>0){
136
  // $('.simplesocialbuttons-float-left-post').css('left', sidebaroffset/2+'px');
classes/ssb-admin.php CHANGED
@@ -10,10 +10,16 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
10
 
11
  class SimpleSocialButtonsPR_Admin extends SimpleSocialButtonsPR {
12
 
13
- function __construct() {
 
 
 
 
 
 
14
  parent::__construct();
15
 
16
- include_once SSB_PLUGIN_DIR . '/classes/ssb-settings.php';
17
 
18
  add_action( 'add_meta_boxes', array( $this, 'ssb_meta_box' ) );
19
  add_action( 'save_post', array( $this, 'ssb_save_meta' ), 10, 2 );
@@ -30,7 +36,9 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
30
  /**
31
  * Add Settings links in plugins.php
32
  *
 
33
  * @since 1.9
 
34
  */
35
  public function plugin_action_links( $links, $file ) {
36
  static $this_plugin;
@@ -47,25 +55,52 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
47
  return $links;
48
  }
49
 
50
- function admin_enqueue_scripts( $page ) {
51
-
52
- if ( 'toplevel_page_simple-social-buttons' == $page || 'social-buttons_page_ssb-help' == $page || 'widgets.php' == $page ) {
53
- wp_enqueue_style( 'ssb-admin-cs', plugins_url( 'assets/css/admin.css',plugin_dir_path( __FILE__ ) ), false, SSB_VERSION );
54
- wp_enqueue_script( 'ssb-admin-js', plugins_url( 'assets/js/admin.js',plugin_dir_path( __FILE__ ) ), array( 'jquery', 'jquery-ui-sortable' ), SSB_VERSION );
55
- wp_localize_script( 'ssb-admin-js', 'ssb', array(
56
- 'ssb_export_help_nonce' => wp_create_nonce( 'ssb-export-security-check' )
57
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
  }
60
 
61
  /**
62
  * Register meta box to hide/show SSB plugin on single post or page
 
 
 
 
63
  */
64
  public function ssb_meta_box() {
65
- $postId = isset( $_GET['post'] ) ? $_GET['post'] : false;
66
- $postType = get_post_type( $postId );
 
 
 
 
 
 
 
 
 
 
67
 
68
- if ( $postType != 'page' && $postType != 'post' ) {
 
69
  return false;
70
  }
71
 
@@ -77,13 +112,19 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
77
  $checked = false;
78
  }
79
 
80
- // Rendering meta box
81
  if ( ! function_exists( 'add_meta_box' ) ) {
82
- include( 'includes/template.php' );
83
  }
84
  add_meta_box(
85
- 'ssb_meta_box', __( 'SSB Settings', 'simple-social-buttons' ), array( $this, 'render_ssb_meta_box' ), $postType, 'side', 'default', array(
86
- 'type' => $postType,
 
 
 
 
 
 
87
  'checked' => $checked,
88
  )
89
  );
@@ -91,6 +132,10 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
91
 
92
  /**
93
  * Showing custom meta field
 
 
 
 
94
  */
95
  public function render_ssb_meta_box( $post, $metabox ) {
96
  wp_nonce_field( plugin_basename( __FILE__ ), 'ssb_noncename' );
@@ -99,14 +144,18 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
99
  <label for="<?php echo $this->hideCustomMetaKey; ?>"><input type="checkbox" id="<?php echo $this->hideCustomMetaKey; ?>" name="<?php echo $this->hideCustomMetaKey; ?>" value="true"
100
  <?php if ( $metabox['args']['checked'] ) : ?>
101
  checked="checked"
102
- <?php endif; ?>/>
103
- &nbsp;<?php echo __( 'Hide Simple Social Buttons', 'simple-social-buttons' ); ?></label>
104
- <?php
105
  }
106
 
107
 
108
  /**
109
- * Saving custom meta value
 
 
 
 
110
  */
111
  public function ssb_save_meta( $post_id, $post ) {
112
  $postId = (int) $post_id;
@@ -136,7 +185,7 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
136
  }
137
 
138
  // Saving data
139
- $newValue = (isset( $_POST[ $this->hideCustomMetaKey ] )) ? $_POST[ $this->hideCustomMetaKey ] : 'false';
140
 
141
  update_post_meta( $postId, $this->hideCustomMetaKey, $newValue );
142
  }
@@ -145,9 +194,11 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
145
  /**
146
  * Show the popup on pluing deactivate
147
  *
 
148
  * @since 1.9.0
 
149
  */
150
- function add_deactive_modal() {
151
  global $pagenow;
152
 
153
  if ( 'plugins.php' !== $pagenow ) {
@@ -158,11 +209,13 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
158
  }
159
 
160
  /**
161
- * Send the user responce to api.
162
  *
 
163
  * @since 1.9.0
 
164
  */
165
- function ssb_deactivate() {
166
  $email = get_option( 'admin_email' );
167
  $_reason = sanitize_text_field( wp_unslash( $_POST['reason'] ) );
168
  $reason_detail = sanitize_text_field( wp_unslash( $_POST['reason_detail'] ) );
@@ -192,12 +245,13 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
192
  'blog_language' => get_bloginfo( 'language' ),
193
  'wordpress_version' => get_bloginfo( 'version' ),
194
  'plugin_version' => SSB_VERSION,
195
- 'php_version' => PHP_VERSION,
196
  'plugin_name' => 'Simple Social Buttons',
197
  );
198
 
199
  $response = wp_remote_post(
200
- SSB_FEEDBACK_SERVER, array(
 
201
  'method' => 'POST',
202
  'timeout' => 5,
203
  'httpversion' => '1.0',
@@ -213,19 +267,21 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
213
  /**
214
  * Check either to show notice or not.
215
  *
 
216
  * @since 1.9.0
 
217
  */
218
  public function review_notice() {
219
 
220
  $this->review_dismissal();
221
  $this->review_prending();
222
 
223
- $review_dismissal = get_site_option( 'ssb_review_dismiss' );
224
  if ( 'yes' == $review_dismissal ) {
225
  return;
226
  }
227
 
228
- $activation_time = get_site_option( 'ssb_active_time' );
229
  if ( ! $activation_time ) {
230
 
231
  $activation_time = time();
@@ -234,7 +290,7 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
234
 
235
  // 1296000 = 15 Days in seconds.
236
  if ( time() - $activation_time > 1296000 ) {
237
- add_action( 'admin_notices' , array( $this, 'review_notice_message' ) );
238
  }
239
 
240
  }
@@ -242,7 +298,9 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
242
  /**
243
  * Show review Message After 15 days.
244
  *
 
245
  * @since 1.9.0
 
246
  */
247
  public function review_notice_message() {
248
 
@@ -279,15 +337,17 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
279
  <li><a href="<?php echo $dismiss_url; ?>"><span class="dashicons dashicons-dismiss"></span><?php _e( 'Never show again', 'simple-social-buttons' ); ?></a></li></ul>
280
  </div>
281
  </div>
282
- <?php
283
  }
284
 
285
  /**
286
  * Set time to current so review notice will popup after 15 days
287
  *
 
288
  * @since 1.9.0
 
289
  */
290
- function review_prending() {
291
 
292
  // delete_site_option( 'ssb_review_dismiss' );
293
  if ( ! is_admin() ||
@@ -305,9 +365,11 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
305
  }
306
 
307
  /**
308
- * Check and Dismiss review message.
309
  *
310
- * @since 1.9.0
 
 
311
  */
312
  private function review_dismissal() {
313
 
@@ -328,9 +390,11 @@ if ( ! class_exists( 'SimpleSocialButtonsPR_Admin' ) ) :
328
  /**
329
  * Skip the all the notice from settings page.
330
  *
 
331
  * @since 1.9.0
 
332
  */
333
- function skip_notices() {
334
 
335
  if ( 'toplevel_page_simple-social-buttons' === get_current_screen()->id ) {
336
 
10
 
11
  class SimpleSocialButtonsPR_Admin extends SimpleSocialButtonsPR {
12
 
13
+ /**
14
+ * Automatically when object created
15
+ *
16
+ * @access public
17
+ * @since 1.0.0
18
+ */
19
+ public function __construct() {
20
  parent::__construct();
21
 
22
+ include_once SSB_PLUGIN_DIR . '/classes/ssb-settings.php';
23
 
24
  add_action( 'add_meta_boxes', array( $this, 'ssb_meta_box' ) );
25
  add_action( 'save_post', array( $this, 'ssb_save_meta' ), 10, 2 );
36
  /**
37
  * Add Settings links in plugins.php
38
  *
39
+ * @access public
40
  * @since 1.9
41
+ * @return string link of the new action.
42
  */
43
  public function plugin_action_links( $links, $file ) {
44
  static $this_plugin;
55
  return $links;
56
  }
57
 
58
+ /**
59
+ * Admin side enqueued script
60
+ *
61
+ * @param string $page
62
+ * @access public
63
+ * @since 1.0.0
64
+ * @return void
65
+ */
66
+ public function admin_enqueue_scripts( $page ) {
67
+
68
+ if ( 'toplevel_page_simple-social-buttons' == $page || 'social-buttons_page_ssb-help' == $page || 'widgets.php' == $page ) {
69
+ wp_enqueue_style( 'ssb-admin-cs', plugins_url( 'assets/css/admin.css', plugin_dir_path( __FILE__ ) ), false, SSB_VERSION );
70
+ wp_enqueue_script( 'ssb-admin-js', plugins_url( 'assets/js/admin.js', plugin_dir_path( __FILE__ ) ), array( 'jquery', 'jquery-ui-sortable' ), SSB_VERSION );
71
+ wp_localize_script(
72
+ 'ssb-admin-js',
73
+ 'ssb',
74
+ array(
75
+ 'ssb_export_help_nonce' => wp_create_nonce( 'ssb-export-security-check' ),
76
+ )
77
+ );
78
  }
79
  }
80
 
81
  /**
82
  * Register meta box to hide/show SSB plugin on single post or page
83
+ *
84
+ * @access public
85
+ * @since 1.0.0
86
+ * @return void
87
  */
88
  public function ssb_meta_box() {
89
+ $postId = isset( $_GET['post'] ) ? $_GET['post'] : false;
90
+ $postType = get_post_type( $postId );
91
+ $ssb_positions = get_option( 'ssb_positions' );
92
+ $selected_post_type = array();
93
+ foreach ( $ssb_positions['position'] as $key => $value ) {
94
+ $options = get_option( 'ssb_' . $value );
95
+ if ( $options['posts'] ) {
96
+ foreach ( $options['posts'] as $allow_post_type ) {
97
+ $selected_post_type[ $allow_post_type ] = $allow_post_type;
98
+ }
99
+ }
100
+ }
101
 
102
+ $allow_post_type = apply_filters( 'ssb_cpt_visibility_mb', $selected_post_type );
103
+ if ( ! in_array( $postType, $allow_post_type ) ) {
104
  return false;
105
  }
106
 
112
  $checked = false;
113
  }
114
 
115
+ // Rendering meta box.
116
  if ( ! function_exists( 'add_meta_box' ) ) {
117
+ include 'includes/template.php';
118
  }
119
  add_meta_box(
120
+ 'ssb_meta_box',
121
+ __( 'SSB Settings', 'simple-social-buttons' ),
122
+ array( $this, 'render_ssb_meta_box' ),
123
+ $postType,
124
+ 'side',
125
+ 'default',
126
+ array(
127
+ 'type' => $postType,
128
  'checked' => $checked,
129
  )
130
  );
132
 
133
  /**
134
  * Showing custom meta field
135
+ *
136
+ * @access public
137
+ * @since 1.0.0
138
+ * @return void
139
  */
140
  public function render_ssb_meta_box( $post, $metabox ) {
141
  wp_nonce_field( plugin_basename( __FILE__ ), 'ssb_noncename' );
144
  <label for="<?php echo $this->hideCustomMetaKey; ?>"><input type="checkbox" id="<?php echo $this->hideCustomMetaKey; ?>" name="<?php echo $this->hideCustomMetaKey; ?>" value="true"
145
  <?php if ( $metabox['args']['checked'] ) : ?>
146
  checked="checked"
147
+ <?php endif; ?>/>
148
+ &nbsp;<?php echo __( 'Hide Simple Social Buttons', 'simple-social-buttons' ); ?></label>
149
+ <?php
150
  }
151
 
152
 
153
  /**
154
+ * Saving custom meta value.
155
+ *
156
+ * @access public
157
+ * @since 1.0.0
158
+ * @return void
159
  */
160
  public function ssb_save_meta( $post_id, $post ) {
161
  $postId = (int) $post_id;
185
  }
186
 
187
  // Saving data
188
+ $newValue = ( isset( $_POST[ $this->hideCustomMetaKey ] ) ) ? $_POST[ $this->hideCustomMetaKey ] : 'false';
189
 
190
  update_post_meta( $postId, $this->hideCustomMetaKey, $newValue );
191
  }
194
  /**
195
  * Show the popup on pluing deactivate
196
  *
197
+ * @access public
198
  * @since 1.9.0
199
+ * @return void
200
  */
201
+ public function add_deactive_modal() {
202
  global $pagenow;
203
 
204
  if ( 'plugins.php' !== $pagenow ) {
209
  }
210
 
211
  /**
212
+ * Send the user response to api.
213
  *
214
+ * @access public
215
  * @since 1.9.0
216
+ * @return void
217
  */
218
+ public function ssb_deactivate() {
219
  $email = get_option( 'admin_email' );
220
  $_reason = sanitize_text_field( wp_unslash( $_POST['reason'] ) );
221
  $reason_detail = sanitize_text_field( wp_unslash( $_POST['reason_detail'] ) );
245
  'blog_language' => get_bloginfo( 'language' ),
246
  'wordpress_version' => get_bloginfo( 'version' ),
247
  'plugin_version' => SSB_VERSION,
248
+ 'php_version' => PHP_VERSION,
249
  'plugin_name' => 'Simple Social Buttons',
250
  );
251
 
252
  $response = wp_remote_post(
253
+ SSB_FEEDBACK_SERVER,
254
+ array(
255
  'method' => 'POST',
256
  'timeout' => 5,
257
  'httpversion' => '1.0',
267
  /**
268
  * Check either to show notice or not.
269
  *
270
+ * @access public
271
  * @since 1.9.0
272
+ * @return void
273
  */
274
  public function review_notice() {
275
 
276
  $this->review_dismissal();
277
  $this->review_prending();
278
 
279
+ $review_dismissal = get_site_option( 'ssb_review_dismiss' );
280
  if ( 'yes' == $review_dismissal ) {
281
  return;
282
  }
283
 
284
+ $activation_time = get_site_option( 'ssb_active_time' );
285
  if ( ! $activation_time ) {
286
 
287
  $activation_time = time();
290
 
291
  // 1296000 = 15 Days in seconds.
292
  if ( time() - $activation_time > 1296000 ) {
293
+ add_action( 'admin_notices', array( $this, 'review_notice_message' ) );
294
  }
295
 
296
  }
298
  /**
299
  * Show review Message After 15 days.
300
  *
301
+ * @access public
302
  * @since 1.9.0
303
+ * @return void
304
  */
305
  public function review_notice_message() {
306
 
337
  <li><a href="<?php echo $dismiss_url; ?>"><span class="dashicons dashicons-dismiss"></span><?php _e( 'Never show again', 'simple-social-buttons' ); ?></a></li></ul>
338
  </div>
339
  </div>
340
+ <?php
341
  }
342
 
343
  /**
344
  * Set time to current so review notice will popup after 15 days
345
  *
346
+ * @access public
347
  * @since 1.9.0
348
+ * @return void
349
  */
350
+ public function review_prending() {
351
 
352
  // delete_site_option( 'ssb_review_dismiss' );
353
  if ( ! is_admin() ||
365
  }
366
 
367
  /**
368
+ * Check and Dismiss review message.
369
  *
370
+ * @access private
371
+ * @since 1.9.0
372
+ * @return void
373
  */
374
  private function review_dismissal() {
375
 
390
  /**
391
  * Skip the all the notice from settings page.
392
  *
393
+ * @access public
394
  * @since 1.9.0
395
+ * @return void
396
  */
397
+ public function skip_notices() {
398
 
399
  if ( 'toplevel_page_simple-social-buttons' === get_current_screen()->id ) {
400
 
classes/ssb-logs.php CHANGED
@@ -12,21 +12,23 @@ class Ssb_Logs_Info {
12
 
13
  /**
14
  * Returns the plugin & system information.
 
15
  * @access public
 
16
  * @return string
17
  */
18
  public static function get_sysinfo() {
19
 
20
  global $wpdb;
21
  $networks_option = get_option( 'ssb_networks' );
22
- $theme_option = get_option( 'ssb_themes' );
23
- $position_option = get_option( 'ssb_positions' );
24
- $inline_option = get_option( 'ssb_inline' );
25
- $sidebar_option = get_option( 'ssb_sidebar' );
26
- $media_option = get_option( 'ssb_media' );
27
- $popup_option = get_option( 'ssb_popup' );
28
- $flyin_option = get_option( 'ssb_flyin' );
29
- $extra_option = get_option( 'ssb_advanced' );
30
  $active_theme = wp_get_theme();
31
 
32
  // var_dump( wp_get_theme()->get( 'Name' ) );
@@ -55,7 +57,7 @@ class Ssb_Logs_Info {
55
  $html .= 'Media: ' . print_r( $media_option, true ) . "\n";
56
  $html .= 'Popup: ' . print_r( $popup_option, true ) . "\n";
57
  $html .= 'Flyin: ' . print_r( $flyin_option, true ) . "\n";
58
-
59
 
60
  // Server Configuration
61
  $html .= "\n" . '-- Server Configuration --' . "\n\n";
@@ -77,37 +79,40 @@ class Ssb_Logs_Info {
77
 
78
  // WordPress active theme
79
  $html .= "\n" . '-- WordPress Active Theme --' . "\n\n";
80
- $html .= $active_theme->get( 'Name' ) . ' '. $active_theme->get( 'Version' ) . ' by `' . $active_theme->get( 'Author' ) . "`\n";
81
 
82
  // WordPress active plugins
83
- $html .= "\n" . '-- WordPress Active Plugins --' . "\n\n";
84
- $plugins = get_plugins();
85
  $active_plugins = get_option( 'active_plugins', array() );
86
- foreach( $plugins as $plugin_path => $plugin ) {
87
- if( !in_array( $plugin_path, $active_plugins ) )
88
  continue;
 
89
  $html .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
90
  }
91
 
92
  // WordPress inactive plugins
93
  $html .= "\n" . '-- WordPress Inactive Plugins --' . "\n\n";
94
- foreach( $plugins as $plugin_path => $plugin ) {
95
- if( in_array( $plugin_path, $active_plugins ) )
96
  continue;
 
97
  $html .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
98
  }
99
 
100
- if( is_multisite() ) {
101
  // WordPress Multisite active plugins
102
- $html .= "\n" . '-- Network Active Plugins --' . "\n\n";
103
- $plugins = wp_get_active_network_plugins();
104
  $active_plugins = get_site_option( 'active_sitewide_plugins', array() );
105
- foreach( $plugins as $plugin_path ) {
106
  $plugin_base = plugin_basename( $plugin_path );
107
- if( !array_key_exists( $plugin_base, $active_plugins ) )
108
  continue;
109
- $plugin = get_plugin_data( $plugin_path );
110
- $html .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
 
111
  }
112
  }
113
 
12
 
13
  /**
14
  * Returns the plugin & system information.
15
+ *
16
  * @access public
17
+ * @since 2.0.0
18
  * @return string
19
  */
20
  public static function get_sysinfo() {
21
 
22
  global $wpdb;
23
  $networks_option = get_option( 'ssb_networks' );
24
+ $theme_option = get_option( 'ssb_themes' );
25
+ $position_option = get_option( 'ssb_positions' );
26
+ $inline_option = get_option( 'ssb_inline' );
27
+ $sidebar_option = get_option( 'ssb_sidebar' );
28
+ $media_option = get_option( 'ssb_media' );
29
+ $popup_option = get_option( 'ssb_popup' );
30
+ $flyin_option = get_option( 'ssb_flyin' );
31
+ $extra_option = get_option( 'ssb_advanced' );
32
  $active_theme = wp_get_theme();
33
 
34
  // var_dump( wp_get_theme()->get( 'Name' ) );
57
  $html .= 'Media: ' . print_r( $media_option, true ) . "\n";
58
  $html .= 'Popup: ' . print_r( $popup_option, true ) . "\n";
59
  $html .= 'Flyin: ' . print_r( $flyin_option, true ) . "\n";
60
+ $html .= 'Advance: ' . print_r( $extra_option, true ) . "\n";
61
 
62
  // Server Configuration
63
  $html .= "\n" . '-- Server Configuration --' . "\n\n";
79
 
80
  // WordPress active theme
81
  $html .= "\n" . '-- WordPress Active Theme --' . "\n\n";
82
+ $html .= $active_theme->get( 'Name' ) . ' ' . $active_theme->get( 'Version' ) . ' by `' . $active_theme->get( 'Author' ) . "`\n";
83
 
84
  // WordPress active plugins
85
+ $html .= "\n" . '-- WordPress Active Plugins --' . "\n\n";
86
+ $plugins = get_plugins();
87
  $active_plugins = get_option( 'active_plugins', array() );
88
+ foreach ( $plugins as $plugin_path => $plugin ) {
89
+ if ( ! in_array( $plugin_path, $active_plugins ) ) {
90
  continue;
91
+ }
92
  $html .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
93
  }
94
 
95
  // WordPress inactive plugins
96
  $html .= "\n" . '-- WordPress Inactive Plugins --' . "\n\n";
97
+ foreach ( $plugins as $plugin_path => $plugin ) {
98
+ if ( in_array( $plugin_path, $active_plugins ) ) {
99
  continue;
100
+ }
101
  $html .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
102
  }
103
 
104
+ if ( is_multisite() ) {
105
  // WordPress Multisite active plugins
106
+ $html .= "\n" . '-- Network Active Plugins --' . "\n\n";
107
+ $plugins = wp_get_active_network_plugins();
108
  $active_plugins = get_site_option( 'active_sitewide_plugins', array() );
109
+ foreach ( $plugins as $plugin_path ) {
110
  $plugin_base = plugin_basename( $plugin_path );
111
+ if ( ! array_key_exists( $plugin_base, $active_plugins ) ) {
112
  continue;
113
+ }
114
+ $plugin = get_plugin_data( $plugin_path );
115
+ $html .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
116
  }
117
  }
118
 
classes/ssb-settings-strucutre.php CHANGED
@@ -2,1252 +2,1253 @@
2
 
3
 
4
  if ( ! class_exists( 'Ssb_Settings_Structure' ) ) :
5
- class Ssb_Settings_Structure {
6
-
7
- /**
8
- * settings sections array
9
- *
10
- * @var array
11
- */
12
- protected $settings_sections = array();
13
-
14
- /**
15
- * Settings fields array
16
- *
17
- * @var array
18
- */
19
- protected $settings_fields = array();
20
-
21
- public function __construct() {
22
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
23
- }
24
-
25
- /**
26
- * Enqueue scripts and styles
27
- */
28
- function admin_enqueue_scripts() {
29
- wp_enqueue_style( 'wp-color-picker' );
30
- wp_enqueue_script( 'wp-color-picker' );
31
- wp_enqueue_script( 'jquery' );
32
- }
33
-
34
- /**
35
- * Set settings sections
36
- *
37
- * @param array $sections setting sections array
38
- */
39
- function set_sections( $sections ) {
40
- $this->settings_sections = $sections;
41
-
42
- return $this;
43
- }
44
-
45
- /**
46
- * Add a single section
47
- *
48
- * @param array $section
49
- */
50
- function add_section( $section ) {
51
- $this->settings_sections[] = $section;
52
-
53
- return $this;
54
- }
55
-
56
- /**
57
- * Set settings fields
58
- *
59
- * @param array $fields settings fields array
60
- */
61
- function set_fields( $fields ) {
62
- $this->settings_fields = $fields;
63
-
64
- return $this;
65
- }
66
-
67
- function add_field( $section, $field ) {
68
- $defaults = array(
69
- 'name' => '',
70
- 'label' => '',
71
- 'desc' => '',
72
- 'type' => 'text'
73
- );
74
-
75
- $arg = wp_parse_args( $field, $defaults );
76
- $this->settings_fields[$section][] = $arg;
77
-
78
- return $this;
79
- }
80
-
81
- /**
82
- * Initialize and registers the settings sections and fileds to WordPress
83
- *
84
- * Usually this should be called at `admin_init` hook.
85
- *
86
- * This function gets the initiated settings sections and fields. Then
87
- * registers them to WordPress and ready for use.
88
- */
89
- function admin_init() {
90
- //register settings sections
91
- foreach ( $this->settings_sections as $section ) {
92
- if ( false == get_option( $section['id'] ) ) {
93
- add_option( $section['id'] );
94
- }
95
-
96
- if ( isset($section['desc']) && !empty($section['desc']) ) {
97
- $section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
98
- $callback = create_function('', 'echo "' . str_replace( '"', '\"', $section['desc'] ) . '";');
99
- } else if ( isset( $section['callback'] ) ) {
100
- $callback = $section['callback'];
101
- } else {
102
- $callback = null;
103
- }
104
- if ( 'ssb_advanced' == $section['id'] ) {
105
- add_settings_section( $section['id'], $section['title'], $callback, $section['id'] );
106
- } else {
107
- add_settings_section( $section['id'], $section['title'], $callback, 'ssb_networks' );
108
- }
109
- }
110
- //register settings fields
111
- foreach ( $this->settings_fields as $section => $field ) {
112
- foreach ( $field as $index => $option ) {
113
-
114
- $name = $option['name'];
115
- $type = isset( $option['type'] ) ? $option['type'] : 'text';
116
- $label = isset( $option['label'] ) ? $option['label'] : '';
117
- $callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
118
-
119
- $args = array(
120
- 'id' => $name,
121
- 'class' => isset( $option['class'] ) ? $option['class'] : $name,
122
- 'label_for' => "{$section}[{$name}]",
123
- 'desc' => isset( $option['desc'] ) ? $option['desc'] : '',
124
- 'help' => isset( $option['help'] ) ? $option['help'] : '',
125
- 'name' => $label,
126
- 'section' => $section,
127
- 'size' => isset( $option['size'] ) ? $option['size'] : null,
128
- 'options' => isset( $option['options'] ) ? $option['options'] : '',
129
- 'std' => isset( $option['default'] ) ? $option['default'] : '',
130
- 'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '',
131
- 'type' => $type,
132
- 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',
133
- 'min' => isset( $option['min'] ) ? $option['min'] : '',
134
- 'max' => isset( $option['max'] ) ? $option['max'] : '',
135
- 'step' => isset( $option['step'] ) ? $option['step'] : '',
136
- 'link' => isset( $option['link'] ) ? $option['link'] : '',
137
- );
138
-
139
- if ( 'ssb_advanced' == $section ) {
140
- add_settings_field( "{$section}[{$name}]", $label, $callback, $section, $section, $args );
141
- } else {
142
- add_settings_field( "{$section}[{$name}]", $label, $callback, 'ssb_networks', $section, $args );
143
- }
144
-
145
- }
146
- }
147
-
148
- // creates our settings in the options table
149
- foreach ( $this->settings_sections as $section ) {
150
- if ( 'ssb_advanced' == $section['id'] ) {
151
- register_setting( $section['id'], $section['id'], array( $this, 'sanitize_options' ) );
152
- } else {
153
- register_setting( 'ssb_networks', $section['id'], array( $this, 'sanitize_options' ) );
154
- }
155
-
156
- }
157
- }
158
-
159
- /**
160
- * Get field description for display
161
- *
162
- * @param array $args settings field args
163
- */
164
- public function get_field_description( $args ) {
165
- if ( ! empty( $args['desc'] ) ) {
166
- $desc = sprintf( '<p class="description">%s</p>', $args['desc'] );
167
- } else {
168
- $desc = '';
169
- }
170
-
171
- return $desc;
172
- }
173
-
174
- function callback_icon_style( $args ) {
175
-
176
- $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
177
- ?>
178
-
179
- <!-- <div class="postbox">
180
- <div class="inside"> -->
181
- <?php foreach ($args['options'] as $key => $label ): ?>
182
- <div class="simplesocialbuttons-style-outer">
183
- <div class="simplesocialbuttons-style">
184
- <label>
185
- <!-- <input type="radio" name="simplesocialbuttons" value="test" <?php echo checked( $value, $key, false ) ?>> -->
186
- <?php
187
- printf( '<input type="radio" class="radio" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
188
- ?>
189
- <span class="radio"><span class="shadow"></span></span>
190
- </label>
191
- <div class="simplesocialbuttons-nav <?php echo $key ?>">
192
- <?php if ( 'simple-icons' == $key ) :?>
193
- <ul>
194
- <li><a href="#" class="simplesocial-fb-share"><span class="icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="_1pbq" color="#ffffff"><path fill="#ffffff" fill-rule="evenodd" class="icon" d="M8 14H3.667C2.733 13.9 2 13.167 2 12.233V3.667A1.65 1.65 0 0 1 3.667 2h8.666A1.65 1.65 0 0 1 14 3.667v8.566c0 .934-.733 1.667-1.667 1.767H10v-3.967h1.3l.7-2.066h-2V6.933c0-.466.167-.9.867-.9H12v-1.8c.033 0-.933-.266-1.533-.266-1.267 0-2.434.7-2.467 2.133v1.867H6v2.066h2V14z"></path></svg></span><span class="simplesocial-hidden-text">Share</span></a></li>
195
- <li><a href="#" class="simplesocial-twt-share"><span class="icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72"><path fill="none" d="M0 0h72v72H0z"></path><path class="icon" fill="#fff" d="M68.812 15.14c-2.348 1.04-4.87 1.744-7.52 2.06 2.704-1.62 4.78-4.186 5.757-7.243-2.53 1.5-5.33 2.592-8.314 3.176C56.35 10.59 52.948 9 49.182 9c-7.23 0-13.092 5.86-13.092 13.093 0 1.026.118 2.02.338 2.98C25.543 24.527 15.9 19.318 9.44 11.396c-1.125 1.936-1.77 4.184-1.77 6.58 0 4.543 2.312 8.552 5.824 10.9-2.146-.07-4.165-.658-5.93-1.64-.002.056-.002.11-.002.163 0 6.345 4.513 11.638 10.504 12.84-1.1.298-2.256.457-3.45.457-.845 0-1.666-.078-2.464-.23 1.667 5.2 6.5 8.985 12.23 9.09-4.482 3.51-10.13 5.605-16.26 5.605-1.055 0-2.096-.06-3.122-.184 5.794 3.717 12.676 5.882 20.067 5.882 24.083 0 37.25-19.95 37.25-37.25 0-.565-.013-1.133-.038-1.693 2.558-1.847 4.778-4.15 6.532-6.774z"></path></svg></span><span class="simplesocial-hidden-text">Tweet</span></a></li>
196
- <li><a href="#" class="simplesocial-linkedin-share"><span class="icon"><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="15px" height="14.1px" viewBox="-301.4 387.5 15 14.1" enable-background="new -301.4 387.5 15 14.1" xml:space="preserve"> <g id="XMLID_398_"> <path id="XMLID_399_" fill="#FFFFFF" d="M-296.2,401.6c0-3.2,0-6.3,0-9.5h0.1c1,0,2,0,2.9,0c0.1,0,0.1,0,0.1,0.1c0,0.4,0,0.8,0,1.2 c0.1-0.1,0.2-0.3,0.3-0.4c0.5-0.7,1.2-1,2.1-1.1c0.8-0.1,1.5,0,2.2,0.3c0.7,0.4,1.2,0.8,1.5,1.4c0.4,0.8,0.6,1.7,0.6,2.5 c0,1.8,0,3.6,0,5.4v0.1c-1.1,0-2.1,0-3.2,0c0-0.1,0-0.1,0-0.2c0-1.6,0-3.2,0-4.8c0-0.4,0-0.8-0.2-1.2c-0.2-0.7-0.8-1-1.6-1 c-0.8,0.1-1.3,0.5-1.6,1.2c-0.1,0.2-0.1,0.5-0.1,0.8c0,1.7,0,3.4,0,5.1c0,0.2,0,0.2-0.2,0.2c-1,0-1.9,0-2.9,0 C-296.1,401.6-296.2,401.6-296.2,401.6z"></path> <path id="XMLID_400_" fill="#FFFFFF" d="M-298,401.6L-298,401.6c-1.1,0-2.1,0-3,0c-0.1,0-0.1,0-0.1-0.1c0-3.1,0-6.1,0-9.2 c0-0.1,0-0.1,0.1-0.1c1,0,2,0,2.9,0h0.1C-298,395.3-298,398.5-298,401.6z"></path> <path id="XMLID_401_" fill="#FFFFFF" d="M-299.6,390.9c-0.7-0.1-1.2-0.3-1.6-0.8c-0.5-0.8-0.2-2.1,1-2.4c0.6-0.2,1.2-0.1,1.8,0.2 c0.5,0.4,0.7,0.9,0.6,1.5c-0.1,0.7-0.5,1.1-1.1,1.3C-299.1,390.8-299.4,390.8-299.6,390.9L-299.6,390.9z"></path> </g> </svg></span><span class="simplesocial-hidden-text">Share</span></a></li>
197
- <li><span style="line-height: 20px; vertical-align: top; font-weight: bold;display: inline-block;">Official Buttons</span></li>
198
- </ul>
199
- <?php else: ?>
200
- <ul>
201
- <li><a href="#" class="simplesocial-fb-share"><span class="simplesocial-hidden-text">Facebook</span></a></li>
202
- <li><a href="#" class="simplesocial-twt-share"><span class="simplesocial-hidden-text">Twitter</span></a></li>
203
- <li><a href="#" class="simplesocial-linkedin-share"><span class="simplesocial-hidden-text">LinkedIn</span></a></li>
204
- </ul>
205
- <?php endif; ?>
206
- </div> <!-- .simplesocialbuttons-nav -->
207
- </div> <!-- .simplesocialbuttons-style -->
208
- </div> <!-- .simplesocialbuttons-style-outer -->
209
- <?php endforeach; ?>
210
- <!-- </div>
211
- </div> -->
212
-
213
- <?php
214
-
215
- }
216
-
217
- function callback_position( $args ) {
218
-
219
- $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
220
- ?>
221
- <div class="simplesocial-postion-outer-wrapper">
222
- <?php printf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] ) ?>
223
- <?php foreach ( $args['options'] as $key => $label ): ?>
224
- <?php $checked = isset( $value[$key] ) ? $value[$key] : '0'; ?>
225
- <div class="simplesocial-postion-outer">
226
- <label class="simplesocial-postion-box simplesocial-<?php echo $key ?>">
227
- <span class="simplesocial-fb-sharehd-line"><?php echo $label ?></span>
228
- <span class="simplesocial-blue-box">
229
- <span class="simplesocial-highlight">
230
- </span>
231
- </span>
232
- <?php printf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) ); ?>
233
- <span class="checkbox"><span class="shadow"></span></span>
234
- </label>
235
- </div>
236
- <?php endforeach; ?>
237
- </div>
238
- <?php
239
- }
240
-
241
- function callback_ssb_select( $args ) {
242
- echo isset( $args['desc'] ) ? $args['desc'] : '';
243
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
244
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
245
- ?>
246
- <div class="simplesocial-form-section">
247
- <h5><?php echo $args['name'] ?></h5>
248
- <?php
249
- printf( '<select class="%1$s ssb_select" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
250
- foreach ( $args['options'] as $key => $label ) {
251
- printf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label );
252
- }
253
- printf( '</select>' );
254
- ?>
255
- </div>
256
- <?php
257
- }
258
 
259
  function callback_ssb_checkbox( $args ) {
260
 
261
- echo isset( $args['desc'] ) ? $args['desc'] : '';
262
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
263
- ?>
264
- <div class="simplesocial-form-section">
265
- <h5><?php echo $args['name'] ?></h5>
266
- <?php
267
- printf( '<input type="hidden" name="%1$s[%2$s]" value="0" />', $args['section'], $args['id'] );
268
- printf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s]" name="%1$s[%2$s]" value="1" %3$s />', $args['section'], $args['id'], checked( $value, '1', false ) );
269
- printf( '<label class="simplesocial-switch" for="%1$s[%2$s]"></label>', $args['section'], $args['id'] );
270
- echo isset( $args['help'] ) ? $args['help'] : '';
271
- ?>
272
  </div>
273
  <?php
274
- }
275
-
276
- function callback_ssb_color( $args ) {
277
-
278
- echo isset( $args['desc'] ) ? $args['desc'] : '';
279
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
280
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
281
- ?>
282
- <div class="simplesocial-form-section">
283
- <h5><?php echo $args['name'] ?></h5>
284
- <div class="selection-color">
285
- <?php
286
- printf( '<input type="text" class="%1$s-text ssb_settings_color_picker" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
287
- ?>
288
- </div>
289
- </div>
290
- <?php
291
- }
292
-
293
- function callback_ssb_post_types( $args ) {
294
-
295
- $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
296
- $html = '<fieldset>';
297
- ?>
298
- <h4>Post type Settings</h4>
299
- <div class="simplesocial-inline-form-section">
300
- <?php printf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] ); ?>
301
- <?php foreach ( $args['options'] as $key => $label ):
302
-
303
- $checked = isset( $value[$key] ) ? $value[$key] : '0';
304
- printf( '<label for="%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
305
- printf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
306
- printf('<span class="checkbox"><span class="shadow"></span></span>');
307
- printf( '%1$s</label>', $label );
308
-
309
- endforeach; ?>
310
-
311
- </div> <!-- .form-section -->
312
-
313
- <?php
314
-
315
- }
316
-
317
- function callback_ssb_text( $args ) {
318
-
319
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
320
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
321
- $type = isset( $args['type'] ) ? $args['type'] : 'text';
322
- $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
323
- echo $args['desc']
324
- ?>
325
- <div class="<?php printf( 'simplesocial-form-section container-%1$s[%2$s]', $args['section'], $args['id'] ) ?>">
326
- <?php ?>
327
- <h5><?php echo $args['name'] ?></h5>
328
- <div class="simplesocial-input">
329
- <?php printf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder ) ?>
330
- <span class="highlight"></span>
331
- <span class="bar"></span>
332
-
333
- </div>
334
- </div>
335
- <?php
336
- }
337
-
338
- function callback_ssb_textarea( $args ) {
339
-
340
- $value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
341
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
342
- $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="'.$args['placeholder'].'"';
343
-
344
- ?>
345
- <div class="simplesocial-form-section">
346
- <h5><?php echo $args['name'] ?></h5>
347
- <div class="simplesocial-input">
348
- <?php printf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value ) ?>
349
- <span class="highlight"></span>
350
- <span class="bar"></span>
351
- </div>
352
- </div>
353
- <?php
354
-
355
- }
356
-
357
-
358
- function callback_ssb_icon_selection( $args ) {
359
-
360
- $save_value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
361
- $settings = array_flip( array_merge( array(0), explode( ',', $save_value ) ) );
362
-
363
- ?>
364
-
365
- <div class="inside">
366
- <p>Drag & Drop to activate and order your share buttons:</p>
367
- <div class="ssb_settings_box">
368
- <h2>Active</h2>
369
- <ul id="ssb_active_icons" class="items" style="min-height:35px">
370
- <?php
371
- $ssb_icons_order = array();
372
- $arrKnownButtons = array( 'twitter', 'pinterest', 'fbshare', 'linkedin', 'reddit', 'whatsapp', 'viber', 'fblike', 'messenger' , 'email', 'print', 'tumblr' );
373
- foreach ($arrKnownButtons as $button_name) {
374
- $ssb_icons_order[$button_name] = isset( $settings[$button_name] ) ? $settings[$button_name] : '' ;
375
- }
376
-
377
- asort( $ssb_icons_order );
378
- ?>
379
- <?php foreach ($ssb_icons_order as $key => $value): ?>
380
- <?php if ( $value != 0): ?>
381
- <li data-id="<?php echo $key ?>" class="list"><img src="<?php echo plugins_url( 'assets/images/'.$key.'.svg', plugin_dir_path( __FILE__ ) ) ?>" /></li>
382
- <?php endif; ?>
383
- <?php endforeach; ?>
384
- </ul>
385
- </div>
386
- <div class="ssb_settings_box">
387
- <h2>InActive</h2>
388
-
389
- <ul id="ssb_inactive_icons" class="items" style="min-height:35px">
390
- <?php foreach ( $ssb_icons_order as $key => $value): ?>
391
- <?php if ( $value == 0): ?>
392
- <li data-id="<?php echo $key ?>" class="list" ><img src="<?php echo plugins_url( 'assets/images/'.$key.'.svg', plugin_dir_path( __FILE__ ) ) ?>" /></li>
393
- <?php endif; ?>
394
- <?php endforeach; ?>
395
- </ul>
396
- </div>
397
-
398
- <?php printf( '<input type="hidden" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s" />', $args['section'], $args['id'], $save_value ) ?>
399
-
400
- </div>
401
-
402
- <?php
403
- }
404
-
405
- function callback_ssb_go_pro( $args ) {
406
- ?>
407
- <div class="ssb_goto_pro_section">
408
- <h4><?php echo $args['name'] ?></h4>
409
- <p><?php echo $args['desc'] ?></p>
410
- <a href="<?php echo $args['link'] ?>" class="ssb_goto_pro_button">Click here to Upgrade</a>
411
- </div>
412
- <?php
413
- }
414
-
415
- function settings_header() {
416
- ?>
417
- <div class="ssb-top-bar">
418
- <a href="https://wpbrigade.com/"><img src="<?php echo plugins_url( 'assets/images/ssb_icon.png', plugin_dir_path( __FILE__ ) ) ?>" alt="Simple Social Buttons"></a>
419
- <div class="ssb-top-bar-content">
420
- <h2>Simple Social Buttons -->> <?php _e('makes Social Sharing easy for everyone'); ?></h2>
421
- <p><?php _e('<strong>Simple Social Buttons</strong> by <strong><a href="https://wpbrigade.com/?utm_source=simple-social-buttons-lite&utm_medium=link-header&utm_campaign=pro-upgrade">WPBrigade</a></strong> adds an advanced set of social media sharing buttons to your WordPress sites, such as: <strong>Google +1</strong>, <strong>Facebook</strong>, <strong>WhatsApp</strong>, <strong>Viber</strong>, <strong>Twitter</strong>, <strong>Reddit</strong>, <strong>LinkedIn</strong> and <strong>Pinterest</strong>. This makes it the most flexible social sharing plugin ever for Everyone.', 'simplesocialbuttons'); ?></p>
422
- </div>
423
- </div>
424
- <?php
425
- }
426
-
427
- function settings_sidebar() {
428
- ?>
429
- <div class="postbox-container ssb_right_sidebar">
430
- <div id="poststuff">
431
- <div class="postbox ssb_social_links_wrapper">
432
- <div class="sidebar postbox">
433
- <h2><?php _e( 'Spread the Word', 'simple-social-buttons' ) ?></h2>
434
- <ul class="ssb_social_links">
435
- <li>
436
- <a href="http://twitter.com/share?text=Check out this (FREE) Amazing Social Share Plugin for WordPress&amp;url=https://wordpress.org/plugins/simple-social-buttons/" data-count="none" class="button twitter" target="_blank" title="Post to Twitter Now"><?php _e( 'Share on Twitter', 'simple-social-buttons' ) ?><span class="dashicons dashicons-twitter"></span></a>
437
- </li>
438
- <li>
439
- <a href="https://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/plugins/simple-social-buttons/" class="button facebook" target="_blank" title="Check out this (FREE) Amazing Social Share Plugin for WordPress"><?php _e( 'Share on Facebook', 'simple-social-buttons' ) ?><span class="dashicons dashicons-facebook"></span>
440
- </a>
441
- </li>
442
- <li>
443
- <a href="https://wordpress.org/plugins/simple-social-buttons/?filter=5" class="button wordpress" target="_blank" title="Rate on WordPress.org"><?php _e( 'Rate on WordPress.org', 'simple-social-buttons' ) ?><span class="dashicons dashicons-wordpress"></span>
444
- </a>
445
- </li>
446
- </ul>
447
- </div>
448
- </div>
449
-
450
- <div class="postbox ssb_social_links_wrapper">
451
- <div class="sidebar postbox">
452
- <h2><?php _e( 'Subscribe Newsletter', 'simple-social-buttons' ) ?></h2>
453
- <ul>
454
- <li>
455
- <label for=""><?php _e( 'Email', 'simple-social-buttons' ) ?></label>
456
- <input type="email" name="subscriber_mail" value="<?php echo get_option( 'admin_email' ) ?>" id="ssb_subscribe_mail">
457
- <p class="ssb_subscribe_warning"></p>
458
- </li>
459
- <li>
460
- <label for=""><?php _e( 'Name', 'simple-social-buttons' ) ?></label>
461
- <input type="text" name="subscriber_name" id="ssb_subscribe_name" value="<?php echo wp_get_current_user()->display_name ?>">
462
- </li>
463
- <li>
464
- <input type="submit" value="Subscribe Now" class="button button-primary button-big" id="ssb_subscribe_btn">
465
- <img src="<?php echo admin_url( 'images/spinner.gif' ) ?>" class="ssb_subscribe_loader" style="display:none">
466
- </li>
467
- <li>
468
- <p class="ssb_return_message"></p>
469
- </li>
470
- </ul>
471
- </div>
472
- </div>
473
-
474
- <div class="postbox ssb_social_links_wrapper">
475
- <div class="sidebar postbox">
476
- <h2><?php _e( 'Recommended Plugins', 'simple-social-buttons' ) ?></h2>
477
- <ul class="plugins_lists">
478
- <li>
479
- <a href="https://wpbrigade.com/wordpress/plugins/loginpress-pro/?utm_source=ssb-lite&amp;utm_medium=sidebar&amp;utm_campaign=pro-upgrade" target="_blank" title="Post to Twitter Now">LoginPress - Login Customizer</a>
480
- </li>
481
- <li>
482
- <a href="https://analytify.io/ref/73/?utm_source=ssb-lite&amp;utm_medium=sidebar&amp;utm_campaign=pro-upgrade" target="_blank" title="Share with your facebook friends about this awesome plugin.">Google Analytics by Analytify
483
- </a>
484
- </li>
485
- <li>
486
- <a href="https://wpbrigade.com/wordpress/plugins/related-posts/?utm_source=ssb-lite&amp;utm_medium=sidebar&amp;utm_campaign=pro-upgrade" target="_blank" title="Releated Posts Thumbnails">Releated Posts Thumbnails</a>
487
- </li>
488
- <li>
489
- <a href="http://wpbrigade.com/recommend/maintenance-mode" target="_blank" title="Under Construction &amp; Maintenance mode">Under Construction &amp; Maintenance mode
490
- </a>
491
- </li>
492
- </ul>
493
- </div>
494
- </div>
495
- </div>
496
- </div>
497
- <?php
498
- }
499
-
500
- /**
501
- * Displays a text field for a settings field
502
- *
503
- * @param array $args settings field args
504
- */
505
- function callback_text( $args ) {
506
-
507
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
508
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
509
- $type = isset( $args['type'] ) ? $args['type'] : 'text';
510
- $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
511
-
512
- $html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );
513
- $html .= $this->get_field_description( $args );
514
-
515
- echo $html;
516
- }
517
-
518
- /**
519
- * Displays a url field for a settings field
520
- *
521
- * @param array $args settings field args
522
- */
523
- function callback_url( $args ) {
524
- $this->callback_text( $args );
525
- }
526
-
527
- /**
528
- * Displays a number field for a settings field
529
- *
530
- * @param array $args settings field args
531
- */
532
- function callback_number( $args ) {
533
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
534
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
535
- $type = isset ( $args['type'] ) ? $args['type'] : 'number';
536
- $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
537
- $min = empty( $args['min'] ) ? '' : ' min="' . $args['min'] . '"';
538
- $max = empty( $args['max'] ) ? '' : ' max="' . $args['max'] . '"';
539
- $step = empty( $args['max'] ) ? '' : ' step="' . $args['step'] . '"';
540
-
541
- $html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
542
- $html .= $this->get_field_description( $args );
543
-
544
- echo $html;
545
- }
546
-
547
- /**
548
- * Displays a checkbox for a settings field
549
- *
550
- * @param array $args settings field args
551
- */
552
- function callback_checkbox( $args ) {
553
-
554
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
555
-
556
- $html = '<fieldset>';
557
- $html .= sprintf( '<label for="%1$s[%2$s]">', $args['section'], $args['id'] );
558
- $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
559
- $html .= sprintf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked( $value, 'on', false ) );
560
- $html .= sprintf( '%1$s</label>', $args['desc'] );
561
- $html .= '</fieldset>';
562
-
563
- echo $html;
564
- }
565
-
566
- /**
567
- * Displays a multicheckbox for a settings field
568
- *
569
- * @param array $args settings field args
570
- */
571
- function callback_multicheck( $args ) {
572
-
573
- $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
574
- $html = '<fieldset>';
575
- $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
576
- foreach ( $args['options'] as $key => $label ) {
577
- $checked = isset( $value[$key] ) ? $value[$key] : '0';
578
- $html .= sprintf( '<label for="%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
579
- $html .= sprintf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
580
- $html .= sprintf( '%1$s</label><br>', $label );
581
- }
582
-
583
- $html .= $this->get_field_description( $args );
584
- $html .= '</fieldset>';
585
-
586
- echo $html;
587
- }
588
-
589
- /**
590
- * Displays a radio button for a settings field
591
- *
592
- * @param array $args settings field args
593
- */
594
- function callback_radio( $args ) {
595
-
596
- $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
597
- $html = '<fieldset>';
598
-
599
- foreach ( $args['options'] as $key => $label ) {
600
- $html .= sprintf( '<label for="%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
601
- $html .= sprintf( '<input type="radio" class="radio" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
602
- $html .= sprintf( '%1$s</label><br>', $label );
603
- }
604
-
605
- $html .= $this->get_field_description( $args );
606
- $html .= '</fieldset>';
607
-
608
- echo $html;
609
- }
610
-
611
- /**
612
- * Displays a selectbox for a settings field
613
- *
614
- * @param array $args settings field args
615
- */
616
- function callback_select( $args ) {
617
-
618
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
619
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
620
- $html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
621
-
622
- foreach ( $args['options'] as $key => $label ) {
623
- $html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label );
624
- }
625
-
626
- $html .= sprintf( '</select>' );
627
- $html .= $this->get_field_description( $args );
628
-
629
- echo $html;
630
- }
631
-
632
- /**
633
- * Displays a textarea for a settings field
634
- *
635
- * @param array $args settings field args
636
- */
637
- function callback_textarea( $args ) {
638
-
639
- $value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
640
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
641
- $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="'.$args['placeholder'].'"';
642
-
643
- $html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );
644
- $html .= $this->get_field_description( $args );
645
-
646
- echo $html;
647
- }
648
-
649
- /**
650
- * Displays the html for a settings field
651
- *
652
- * @param array $args settings field args
653
- * @return string
654
- */
655
- function callback_html( $args ) {
656
- echo $this->get_field_description( $args );
657
- }
658
-
659
- /**
660
- * Displays a rich text textarea for a settings field
661
- *
662
- * @param array $args settings field args
663
- */
664
- function callback_wysiwyg( $args ) {
665
-
666
- $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
667
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : '500px';
668
-
669
- echo '<div style="max-width: ' . $size . ';">';
670
-
671
- $editor_settings = array(
672
- 'teeny' => true,
673
- 'textarea_name' => $args['section'] . '[' . $args['id'] . ']',
674
- 'textarea_rows' => 10
675
- );
676
-
677
- if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
678
- $editor_settings = array_merge( $editor_settings, $args['options'] );
679
- }
680
-
681
- wp_editor( $value, $args['section'] . '-' . $args['id'], $editor_settings );
682
-
683
- echo '</div>';
684
-
685
- echo $this->get_field_description( $args );
686
- }
687
-
688
- /**
689
- * Displays a file upload field for a settings field
690
- *
691
- * @param array $args settings field args
692
- */
693
- function callback_file( $args ) {
694
-
695
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
696
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
697
- $id = $args['section'] . '[' . $args['id'] . ']';
698
- $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
699
-
700
- $html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
701
- $html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
702
- $html .= $this->get_field_description( $args );
703
-
704
- echo $html;
705
- }
706
-
707
- /**
708
- * Displays a password field for a settings field
709
- *
710
- * @param array $args settings field args
711
- */
712
- function callback_password( $args ) {
713
-
714
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
715
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
716
-
717
- $html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
718
- $html .= $this->get_field_description( $args );
719
-
720
- echo $html;
721
- }
722
-
723
- /**
724
- * Displays a color picker field for a settings field
725
- *
726
- * @param array $args settings field args
727
- */
728
- function callback_color( $args ) {
729
-
730
- $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
731
- $size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
732
-
733
- $html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
734
- $html .= $this->get_field_description( $args );
735
-
736
- echo $html;
737
- }
738
-
739
-
740
- /**
741
- * Displays a select box for creating the pages select box
742
- *
743
- * @param array $args settings field args
744
- */
745
- function callback_pages( $args ) {
746
-
747
- $dropdown_args = array(
748
- 'selected' => esc_attr($this->get_option($args['id'], $args['section'], $args['std'] ) ),
749
- 'name' => $args['section'] . '[' . $args['id'] . ']',
750
- 'id' => $args['section'] . '[' . $args['id'] . ']',
751
- 'echo' => 0
752
- );
753
- $html = wp_dropdown_pages( $dropdown_args );
754
- echo $html;
755
- }
756
-
757
- /**
758
- * Sanitize callback for Settings API
759
- *
760
- * @return mixed
761
- */
762
- function sanitize_options( $options ) {
763
-
764
- if ( !$options ) {
765
- return $options;
766
- }
767
-
768
- foreach( $options as $option_slug => $option_value ) {
769
- $sanitize_callback = $this->get_sanitize_callback( $option_slug );
770
-
771
- // If callback is set, call it
772
- if ( $sanitize_callback ) {
773
- $options[ $option_slug ] = call_user_func( $sanitize_callback, $option_value );
774
- continue;
775
- }
776
- }
777
-
778
- return $options;
779
- }
780
-
781
- /**
782
- * Get sanitization callback for given option slug
783
- *
784
- * @param string $slug option slug
785
- *
786
- * @return mixed string or bool false
787
- */
788
- function get_sanitize_callback( $slug = '' ) {
789
- if ( empty( $slug ) ) {
790
- return false;
791
- }
792
-
793
- // Iterate over registered fields and see if we can find proper callback
794
- foreach( $this->settings_fields as $section => $options ) {
795
- foreach ( $options as $option ) {
796
- if ( $option['name'] != $slug ) {
797
- continue;
798
- }
799
-
800
- // Return the callback name
801
- return isset( $option['sanitize_callback'] ) && is_callable( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : false;
802
- }
803
- }
804
-
805
- return false;
806
- }
807
-
808
- /**
809
- * Get the value of a settings field
810
- *
811
- * @param string $option settings field name
812
- * @param string $section the section name this field belongs to
813
- * @param string $default default text if it's not found
814
- * @return string
815
- */
816
- function get_option( $option, $section, $default = '' ) {
817
-
818
- $options = get_option( $section );
819
-
820
- if ( isset( $options[$option] ) ) {
821
- return $options[$option];
822
- }
823
-
824
- return $default;
825
- }
826
-
827
- /**
828
- * Show navigations as tab
829
- *
830
- * Shows all the settings section labels as tab
831
- */
832
- function show_navigation() {
833
- $html = '<h2 class="nav-tab-wrapper">';
834
-
835
- $tabs = array(
836
- array(
837
- 'id' => 'ssb_settings',
838
- 'title' => '<span class="dashicons dashicons-admin-generic"></span>Settings',
839
- ),
840
- array(
841
- 'id' => 'ssb_advanced',
842
- 'title' => '<span class="dashicons dashicons-editor-code"></span>Advanced',
843
- ),
844
- );
845
- if ( ! class_exists( 'Simple_Social_Buttons_Pro' ) ) {
846
- $tabs[] = array(
847
- 'id' => 'ssb_go_pro',
848
- 'title' => '<span class="dashicons dashicons-star-filled"></span>Upgrade To Pro For More Features',
849
- 'link' => 'https://wpbrigade.com/wordpress/plugins/simple-social-buttons-pro/?utm_source=simple-social-buttons-lite&utm_medium=tab&utm_campaign=pro-upgrade'
850
- );
851
- }
852
- foreach ( $tabs as $tab ) {
853
- if ( isset( $tab['link'] ) ) {
854
- $html .= sprintf( '<a href="%3$s" class="nav-tab" id="%1$s-tab" target="_blank" >%2$s</a>', $tab['id'], $tab['title'], $tab['link'] );
855
- } else {
856
- $html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title'] );
857
- }
858
-
859
- }
860
-
861
- $html .= '</h2>';
862
-
863
- echo $html;
864
- }
865
-
866
- /**
867
- * Show the section settings forms
868
- *
869
- * This function displays every sections in a different form
870
- */
871
-
872
- function show_forms() {
873
- echo '<div class="ssb_settings_container ssb_settings-tab group" id="ssb_settings-tab-content">';
874
- echo '<div class="metabox-holder">';
875
- echo '<div id="poststuff">';
876
- echo '<form method="post" action="options.php">';
877
- $this->do_settings_sections( 'ssb_networks' );
878
- settings_fields( 'ssb_networks' );
879
- submit_button();
880
- echo '</form>';
881
- echo "</div>";
882
- echo "</div>";
883
- echo '</div>';
884
-
885
- echo '<div class="ssb_settings_container ssb_advanced-tab group" id="ssb_advanced-tab-content">';
886
- echo '<div class="metabox-holder">';
887
- echo '<div id="poststuff">';
888
- echo '<form method="post" action="options.php">';
889
- $this->do_settings_sections( 'ssb_advanced' );
890
- settings_fields( 'ssb_advanced' );
891
- $this->render_instruction();
892
- submit_button();
893
- echo '</form>';
894
- echo "</div>";
895
- echo "</div>";
896
- echo '</div>';
897
-
898
-
899
- $this->script();
900
- }
901
-
902
-
903
- function render_instruction(){
904
-
905
- echo '<div class="postbox " id="ssb_instruction">
906
- <div class="inside">
907
- <h3 class="">Instructions</h3>
908
- <div class="postbox-content">
909
- <h4 class="ssb_instruct_heading">Twitter count tracking requires the following steps:</h4>
910
- <p> '. __( '<span class="ssb_step">Step 1: </span> <a target="_blank" href="http://twitcount.com">Click here </a> to visit twitcount.com', 'simple-social-buttons') . '</p>
911
- <p> '. __( '<span class="ssb_step">Step 2: </span> Click the Button “Give Me My Twitter Count Back on their website to create an account. If you see a prompt to customize your button, ignore to click paste code. ', 'simple-social-buttons' ) . '</p>
912
- <p> '. __( '<span class="ssb_step">Step 3: </span> After creating an account Click “Account and Settings” tab then add your website click save button to track your Twitter share counts.', 'simple-social-buttons' ) . '</p>
913
- </div>
914
- </div>
915
- </div>';
916
-
917
- }
918
-
919
- /**
920
- * Prints out all settings sections added to a particular settings page
921
- *
922
- * Part of the Settings API. Use this in a settings page callback function
923
- * to output all the sections and fields that were added to that $page with
924
- * add_settings_section() and add_settings_field()
925
- *
926
- * @global $wp_settings_sections Storage array of all settings sections added to admin pages
927
- * @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
928
- * @since 2.7.0
929
- *
930
- * @param string $page The slug name of the page whose settings sections you want to output
931
- */
932
- function do_settings_sections( $page ) {
933
- global $wp_settings_sections, $wp_settings_fields;
934
-
935
- if ( ! isset( $wp_settings_sections[$page] ) )
936
- return;
937
-
938
- foreach ( (array) $wp_settings_sections[$page] as $section ) {
939
-
940
- if ( $section['callback'] )
941
- call_user_func( $section['callback'], $section );
942
-
943
- if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
944
- continue;
945
-
946
- $extra_class = in_array( $section['id'], array( 'ssb_sidebar','ssb_inline','ssb_media','ssb_popup','ssb_flyin' ) ) ? 'simpleshare-acordions' : '' ;
947
- ?>
948
- <div class="postbox <?php echo $extra_class ?>" id='<?php echo $section['id'] ?>' >
949
- <div class="inside">
950
- <h3 class="simpleshare-active"><?php echo $section['title'] ?></h3>
951
- <div class="postbox-content">
952
- <?php
953
- $this->do_settings_fields( $page, $section['id'] );
954
- ?>
955
- </div>
956
- </div>
957
- </div>
958
- <?php
959
- }
960
- }
961
-
962
-
963
- /**
964
- * Print out the settings fields for a particular settings section
965
- *
966
- * Part of the Settings API. Use this in a settings page to output
967
- * a specific section. Should normally be called by do_settings_sections()
968
- * rather than directly.
969
- *
970
- * @global $wp_settings_fields Storage array of settings fields and their pages/sections
971
- *
972
- * @since 2.7.0
973
- *
974
- * @param string $page Slug title of the admin page who's settings fields you want to show.
975
- * @param string $section Slug title of the settings section who's fields you want to show.
976
- */
977
- function do_settings_fields($page, $section) {
978
- global $wp_settings_fields;
979
-
980
- if ( ! isset( $wp_settings_fields[$page][$section] ) )
981
- return;
982
-
983
- foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
984
- $class = '';
985
-
986
- if ( ! empty( $field['args']['class'] ) ) {
987
- $class = ' class="' . esc_attr( $field['args']['class'] ) . '"';
988
- }
989
-
990
- // echo "<tr{$class}>";
991
- //
992
- // if ( ! empty( $field['args']['label_for'] ) ) {
993
- // echo '<th scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>';
994
- // } else {
995
- // echo '<th scope="row">' . $field['title'] . '</th>';
996
- // }
997
-
998
- // echo '<td>';
999
-
1000
- call_user_func($field['callback'], $field['args']);
1001
- // echo '</td>';
1002
- // echo '</tr>';
1003
- }
1004
- }
1005
-
1006
-
1007
- /**
1008
- * Tabbable JavaScript codes & Initiate Color Picker
1009
- *
1010
- * This code uses localstorage for displaying active tabs
1011
- */
1012
- function script() {
1013
- ?>
1014
- <script>
1015
- jQuery(document).ready(function($) {
1016
- //Initiate Color Picker
1017
- $('.wp-color-picker-field').wpColorPicker();
1018
-
1019
- // Switches option sections
1020
- $('.group').hide();
1021
- var activetab = '';
1022
- if (typeof(localStorage) != 'undefined' ) {
1023
- activetab = localStorage.getItem("activetab");
1024
- }
1025
-
1026
- //if url has section id as hash then set it as active or override the current local storage value
1027
- if(window.location.hash){
1028
- activetab = window.location.hash;
1029
- if (typeof(localStorage) != 'undefined' ) {
1030
- localStorage.setItem("activetab", activetab);
1031
- }
1032
- }
1033
-
1034
- $(activetab+'-tab-content').fadeIn();
1035
- if (activetab != '' && $(activetab).length ) {
1036
- $(activetab).fadeIn();
1037
- } else {
1038
- $('.group:first').fadeIn();
1039
- }
1040
- $('.group .collapsed').each(function(){
1041
- $(this).find('input:checked').parent().parent().parent().nextAll().each(
1042
- function(){
1043
- if ($(this).hasClass('last')) {
1044
- $(this).removeClass('hidden');
1045
- return false;
1046
- }
1047
- $(this).filter('.hidden').removeClass('hidden');
1048
- });
1049
- });
1050
-
1051
- if (activetab != '' && $(activetab + '-tab').length ) {
1052
- $(activetab + '-tab').addClass('nav-tab-active');
1053
- }
1054
- else {
1055
- $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
1056
- }
1057
- $('.nav-tab-wrapper a').click(function(evt) {
1058
-
1059
- if ('ssb_go_pro-tab' == $(this).attr('id')) { return; }
1060
- $('.nav-tab-wrapper a').removeClass('nav-tab-active');
1061
- $(this).addClass('nav-tab-active').blur();
1062
- var clicked_group = $(this).attr('href') + '-tab-content';
1063
- if (typeof(localStorage) != 'undefined' ) {
1064
- if ( $(this).attr('href').indexOf('#') > -1 ) {
1065
- localStorage.setItem("activetab", $(this).attr('href'));
1066
- }
1067
- }
1068
- $('.group').hide();
1069
- $(clicked_group).fadeIn();
1070
- evt.preventDefault();
1071
- });
1072
-
1073
- $('.wpsa-browse').on('click', function (event) {
1074
- event.preventDefault();
1075
-
1076
- var self = $(this);
1077
-
1078
- // Create the media frame.
1079
- var file_frame = wp.media.frames.file_frame = wp.media({
1080
- title: self.data('uploader_title'),
1081
- button: {
1082
- text: self.data('uploader_button_text'),
1083
- },
1084
- multiple: false
1085
- });
1086
-
1087
- file_frame.on('select', function () {
1088
- attachment = file_frame.state().get('selection').first().toJSON();
1089
- self.prev('.wpsa-url').val(attachment.url).change();
1090
- });
1091
-
1092
- // Finally, open the modal
1093
- file_frame.open();
1094
- });
1095
-
1096
- $('#ssb_subscribe_btn').on('click', function(event) {
1097
- event.preventDefault();
1098
- var subscriber_mail = $('#ssb_subscribe_mail').val();
1099
- var name = $('#ssb_subscribe_name').val();
1100
- if (!subscriber_mail) {
1101
- $('.ssb_subscribe_warning').html('Please Enter Email');
1102
- return;
1103
- }
1104
- $.ajax({
1105
- url: 'https://wpbrigade.com/wp-json/wpbrigade/v1/subsribe-to-mailchimp',
1106
- type: 'POST',
1107
- data: {
1108
- subscriber_mail : subscriber_mail,
1109
- name : name,
1110
- plugin_name : 'ssb'
1111
- },
1112
- beforeSend : function() {
1113
- $('.ssb_subscribe_loader').show();
1114
- $('#ssb_subscribe_btn').attr('disabled', 'disabled');
1115
- }
1116
- })
1117
- .done(function(res) {
1118
- $('.ssb_return_message').html(res);
1119
- $('.ssb_subscribe_loader').hide();
1120
- });
1121
- });
1122
- $('.simplesocialbuttons-style').on('click',function(){
1123
- var el = $(this);
1124
- $(this).addClass('social-active').parent().siblings().find('.simplesocialbuttons-style').removeClass('social-active');
1125
- $(this).find('input[type="radio"]').prop('checked', true);
1126
- });
1127
- $('.simplesocial-postion-box').on('click',function(){
1128
- var el = $(this);
1129
- var target = $(this).children('input[type="checkbox"]').val();
1130
- if($(this).children('input[type="checkbox"]').is(':checked')){
1131
- $(this).addClass('social-active');
1132
- $('#ssb_'+target).fadeIn();
1133
- }else{
1134
- $(this).removeClass('social-active');
1135
- $('#ssb_'+target).fadeOut();
1136
- }
1137
- $(this).find('.shadow').addClass('animated');
1138
- setTimeout(function(){ el.find('.shadow').removeClass('animated'); }, 400);
1139
- });
1140
- $('.simplesocial-postion-box').each(function(){
1141
- var el = $(this);
1142
- var target = $(this).children('input[type="checkbox"]').val();
1143
- if($(this).children('input[type="checkbox"]').is(':checked')){
1144
- $(this).addClass('social-active');
1145
- $('#ssb_'+target).fadeIn();
1146
- }else{
1147
- $(this).removeClass('social-active');
1148
- $('#ssb_'+target).fadeOut();
1149
- }
1150
- });
1151
- $('.simplesocial-inline-form-section label').on('click',function(){
1152
- var el = $(this);
1153
- $(this).find('.shadow').addClass('animated');
1154
- setTimeout(function(){ el.find('.shadow').removeClass('animated'); }, 400);
1155
- });
1156
- $('.simpleshare-acordions h3').on('click',function(){
1157
- $(this).toggleClass('simpleshare-active');
1158
- $(this).next('.postbox-content').slideToggle();
1159
- });
1160
- $('.ssb_select').each(function () {
1161
-
1162
- // Cache the number of options
1163
- var $this = $(this),
1164
- numberOfOptions = $(this).children('option').length;
1165
-
1166
- // Hides the select element
1167
- $this.addClass('s-hidden');
1168
-
1169
- // Wrap the select element in a div
1170
- $this.wrap('<div class="select"></div>');
1171
-
1172
- // Insert a styled div to sit over the top of the hidden select element
1173
- $this.after('<div class="styledSelect"></div>');
1174
-
1175
- // Cache the styled div
1176
- var $styledSelect = $this.next('div.styledSelect');
1177
- var getHTML = $this.children('option[value="'+$this.val()+'"]').text();
1178
- // Show the first select option in the styled div
1179
- $styledSelect.text(getHTML);
1180
-
1181
- // Insert an unordered list after the styled div and also cache the list
1182
- var $list = $('<ul />', {
1183
- 'class': 'options'
1184
- }).insertAfter($styledSelect);
1185
-
1186
- // Insert a list item into the unordered list for each select option
1187
- for (var i = 0; i < numberOfOptions; i++) {
1188
- $('<li />', {
1189
- text: $this.children('option').eq(i).text(),
1190
- rel: $this.children('option').eq(i).val()
1191
- }).appendTo($list);
1192
- }
1193
-
1194
- // Cache the list items
1195
- var $listItems = $list.children('li');
1196
-
1197
- // Show the unordered list when the styled div is clicked (also hides it if the div is clicked again)
1198
- $styledSelect.click(function (e) {
1199
-
1200
- // $(this).addClass('active').next('ul.options').slideDown();
1201
- if($(this).hasClass('active')){
1202
- $(this).removeClass('active').next('ul.options').slideUp();
1203
- }else{
1204
- $('div.styledSelect.active').each(function () {
1205
- $(this).removeClass('active').next('ul.options').slideUp();
1206
- });
1207
- $(this).addClass('active').next('ul.options').slideDown();
1208
- }
1209
- e.stopPropagation();
1210
- });
1211
-
1212
- // Hides the unordered list when a list item is clicked and updates the styled div to show the selected list item
1213
- // Updates the select element to have the value of the equivalent option
1214
- $listItems.click(function (e) {
1215
- e.stopPropagation();
1216
- $styledSelect.text($(this).text()).removeClass('active');
1217
- var value = $(this).attr('rel').toString();
1218
- $($this).val(value);
1219
- $($this).trigger('change');
1220
- $list.slideUp();
1221
- /* alert($this.val()); Uncomment this for demonstration! */
1222
- });
1223
-
1224
- // Hides the unordered list when clicking outside of it
1225
- $(document).click(function () {
1226
- $styledSelect.removeClass('active');
1227
- $list.slideUp();
1228
- });
1229
-
1230
- });
1231
- });
1232
- </script>
1233
- <?php
1234
- $this->_style_fix();
1235
- }
1236
-
1237
- function _style_fix() {
1238
- global $wp_version;
1239
-
1240
- if (version_compare($wp_version, '3.8', '<=')):
1241
- ?>
1242
- <style type="text/css">
1243
- /** WordPress 3.8 Fix **/
1244
- .form-table th { padding: 20px 10px; }
1245
- #wpbody-content .metabox-holder { padding-top: 5px; }
1246
- </style>
1247
- <?php
1248
- endif;
1249
- }
1250
-
1251
- }
 
 
 
1252
 
1253
  endif;
2
 
3
 
4
  if ( ! class_exists( 'Ssb_Settings_Structure' ) ) :
5
+ class Ssb_Settings_Structure {
6
+
7
+ /**
8
+ * settings sections array
9
+ *
10
+ * @var array
11
+ */
12
+ protected $settings_sections = array();
13
+
14
+ /**
15
+ * Settings fields array
16
+ *
17
+ * @var array
18
+ */
19
+ protected $settings_fields = array();
20
+
21
+ public function __construct() {
22
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
23
+ }
24
+
25
+ /**
26
+ * Enqueue scripts and styles
27
+ */
28
+ function admin_enqueue_scripts() {
29
+ wp_enqueue_style( 'wp-color-picker' );
30
+ wp_enqueue_script( 'wp-color-picker' );
31
+ wp_enqueue_script( 'jquery' );
32
+ }
33
+
34
+ /**
35
+ * Set settings sections
36
+ *
37
+ * @param array $sections setting sections array
38
+ */
39
+ function set_sections( $sections ) {
40
+ $this->settings_sections = $sections;
41
+
42
+ return $this;
43
+ }
44
+
45
+ /**
46
+ * Add a single section
47
+ *
48
+ * @param array $section
49
+ */
50
+ function add_section( $section ) {
51
+ $this->settings_sections[] = $section;
52
+
53
+ return $this;
54
+ }
55
+
56
+ /**
57
+ * Set settings fields
58
+ *
59
+ * @param array $fields settings fields array
60
+ */
61
+ function set_fields( $fields ) {
62
+ $this->settings_fields = $fields;
63
+
64
+ return $this;
65
+ }
66
+
67
+ function add_field( $section, $field ) {
68
+ $defaults = array(
69
+ 'name' => '',
70
+ 'label' => '',
71
+ 'desc' => '',
72
+ 'type' => 'text',
73
+ );
74
+
75
+ $arg = wp_parse_args( $field, $defaults );
76
+ $this->settings_fields[ $section ][] = $arg;
77
+
78
+ return $this;
79
+ }
80
+
81
+ /**
82
+ * Initialize and registers the settings sections and fileds to WordPress
83
+ *
84
+ * Usually this should be called at `admin_init` hook.
85
+ *
86
+ * This function gets the initiated settings sections and fields. Then
87
+ * registers them to WordPress and ready for use.
88
+ */
89
+ function admin_init() {
90
+ // register settings sections
91
+ foreach ( $this->settings_sections as $section ) {
92
+ if ( false == get_option( $section['id'] ) ) {
93
+ add_option( $section['id'] );
94
+ }
95
+
96
+ if ( isset( $section['desc'] ) && ! empty( $section['desc'] ) ) {
97
+ $section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
98
+ $callback = create_function( '', 'echo "' . str_replace( '"', '\"', $section['desc'] ) . '";' );
99
+ } elseif ( isset( $section['callback'] ) ) {
100
+ $callback = $section['callback'];
101
+ } else {
102
+ $callback = null;
103
+ }
104
+ if ( 'ssb_advanced' == $section['id'] ) {
105
+ add_settings_section( $section['id'], $section['title'], $callback, $section['id'] );
106
+ } else {
107
+ add_settings_section( $section['id'], $section['title'], $callback, 'ssb_networks' );
108
+ }
109
+ }
110
+ // register settings fields
111
+ foreach ( $this->settings_fields as $section => $field ) {
112
+ foreach ( $field as $index => $option ) {
113
+
114
+ $name = $option['name'];
115
+ $type = isset( $option['type'] ) ? $option['type'] : 'text';
116
+ $label = isset( $option['label'] ) ? $option['label'] : '';
117
+ $callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
118
+
119
+ $args = array(
120
+ 'id' => $name,
121
+ 'class' => isset( $option['class'] ) ? $option['class'] : $name,
122
+ 'label_for' => "{$section}[{$name}]",
123
+ 'desc' => isset( $option['desc'] ) ? $option['desc'] : '',
124
+ 'help' => isset( $option['help'] ) ? $option['help'] : '',
125
+ 'name' => $label,
126
+ 'section' => $section,
127
+ 'size' => isset( $option['size'] ) ? $option['size'] : null,
128
+ 'options' => isset( $option['options'] ) ? $option['options'] : '',
129
+ 'std' => isset( $option['default'] ) ? $option['default'] : '',
130
+ 'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '',
131
+ 'type' => $type,
132
+ 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',
133
+ 'min' => isset( $option['min'] ) ? $option['min'] : '',
134
+ 'max' => isset( $option['max'] ) ? $option['max'] : '',
135
+ 'step' => isset( $option['step'] ) ? $option['step'] : '',
136
+ 'link' => isset( $option['link'] ) ? $option['link'] : '',
137
+ );
138
+
139
+ if ( 'ssb_advanced' == $section ) {
140
+ add_settings_field( "{$section}[{$name}]", $label, $callback, $section, $section, $args );
141
+ } else {
142
+ add_settings_field( "{$section}[{$name}]", $label, $callback, 'ssb_networks', $section, $args );
143
+ }
144
+ }
145
+ }
146
+
147
+ // creates our settings in the options table
148
+ foreach ( $this->settings_sections as $section ) {
149
+ if ( 'ssb_advanced' == $section['id'] ) {
150
+ register_setting( $section['id'], $section['id'], array( $this, 'sanitize_options' ) );
151
+ } else {
152
+ register_setting( 'ssb_networks', $section['id'], array( $this, 'sanitize_options' ) );
153
+ }
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Get field description for display
159
+ *
160
+ * @param array $args settings field args
161
+ */
162
+ public function get_field_description( $args ) {
163
+ if ( ! empty( $args['desc'] ) ) {
164
+ $desc = sprintf( '<p class="description">%s</p>', $args['desc'] );
165
+ } else {
166
+ $desc = '';
167
+ }
168
+
169
+ return $desc;
170
+ }
171
+
172
+ function callback_icon_style( $args ) {
173
+
174
+ $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
175
+ ?>
176
+
177
+ <!-- <div class="postbox">
178
+ <div class="inside"> -->
179
+ <?php foreach ( $args['options'] as $key => $label ) : ?>
180
+ <div class="simplesocialbuttons-style-outer">
181
+ <div class="simplesocialbuttons-style">
182
+ <label>
183
+ <!-- <input type="radio" name="simplesocialbuttons" value="test" <?php echo checked( $value, $key, false ); ?>> -->
184
+ <?php
185
+ printf( '<input type="radio" class="radio" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
186
+ ?>
187
+ <span class="radio"><span class="shadow"></span></span>
188
+ </label>
189
+ <div class="simplesocialbuttons-nav <?php echo $key; ?>">
190
+ <?php if ( 'simple-icons' == $key ) : ?>
191
+ <ul>
192
+ <li><a href="#" class="simplesocial-fb-share"><span class="icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="_1pbq" color="#ffffff"><path fill="#ffffff" fill-rule="evenodd" class="icon" d="M8 14H3.667C2.733 13.9 2 13.167 2 12.233V3.667A1.65 1.65 0 0 1 3.667 2h8.666A1.65 1.65 0 0 1 14 3.667v8.566c0 .934-.733 1.667-1.667 1.767H10v-3.967h1.3l.7-2.066h-2V6.933c0-.466.167-.9.867-.9H12v-1.8c.033 0-.933-.266-1.533-.266-1.267 0-2.434.7-2.467 2.133v1.867H6v2.066h2V14z"></path></svg></span><span class="simplesocial-hidden-text">Share</span></a></li>
193
+ <li><a href="#" class="simplesocial-twt-share"><span class="icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72"><path fill="none" d="M0 0h72v72H0z"></path><path class="icon" fill="#fff" d="M68.812 15.14c-2.348 1.04-4.87 1.744-7.52 2.06 2.704-1.62 4.78-4.186 5.757-7.243-2.53 1.5-5.33 2.592-8.314 3.176C56.35 10.59 52.948 9 49.182 9c-7.23 0-13.092 5.86-13.092 13.093 0 1.026.118 2.02.338 2.98C25.543 24.527 15.9 19.318 9.44 11.396c-1.125 1.936-1.77 4.184-1.77 6.58 0 4.543 2.312 8.552 5.824 10.9-2.146-.07-4.165-.658-5.93-1.64-.002.056-.002.11-.002.163 0 6.345 4.513 11.638 10.504 12.84-1.1.298-2.256.457-3.45.457-.845 0-1.666-.078-2.464-.23 1.667 5.2 6.5 8.985 12.23 9.09-4.482 3.51-10.13 5.605-16.26 5.605-1.055 0-2.096-.06-3.122-.184 5.794 3.717 12.676 5.882 20.067 5.882 24.083 0 37.25-19.95 37.25-37.25 0-.565-.013-1.133-.038-1.693 2.558-1.847 4.778-4.15 6.532-6.774z"></path></svg></span><span class="simplesocial-hidden-text">Tweet</span></a></li>
194
+ <li><a href="#" class="simplesocial-linkedin-share"><span class="icon"><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="15px" height="14.1px" viewBox="-301.4 387.5 15 14.1" enable-background="new -301.4 387.5 15 14.1" xml:space="preserve"> <g id="XMLID_398_"> <path id="XMLID_399_" fill="#FFFFFF" d="M-296.2,401.6c0-3.2,0-6.3,0-9.5h0.1c1,0,2,0,2.9,0c0.1,0,0.1,0,0.1,0.1c0,0.4,0,0.8,0,1.2 c0.1-0.1,0.2-0.3,0.3-0.4c0.5-0.7,1.2-1,2.1-1.1c0.8-0.1,1.5,0,2.2,0.3c0.7,0.4,1.2,0.8,1.5,1.4c0.4,0.8,0.6,1.7,0.6,2.5 c0,1.8,0,3.6,0,5.4v0.1c-1.1,0-2.1,0-3.2,0c0-0.1,0-0.1,0-0.2c0-1.6,0-3.2,0-4.8c0-0.4,0-0.8-0.2-1.2c-0.2-0.7-0.8-1-1.6-1 c-0.8,0.1-1.3,0.5-1.6,1.2c-0.1,0.2-0.1,0.5-0.1,0.8c0,1.7,0,3.4,0,5.1c0,0.2,0,0.2-0.2,0.2c-1,0-1.9,0-2.9,0 C-296.1,401.6-296.2,401.6-296.2,401.6z"></path> <path id="XMLID_400_" fill="#FFFFFF" d="M-298,401.6L-298,401.6c-1.1,0-2.1,0-3,0c-0.1,0-0.1,0-0.1-0.1c0-3.1,0-6.1,0-9.2 c0-0.1,0-0.1,0.1-0.1c1,0,2,0,2.9,0h0.1C-298,395.3-298,398.5-298,401.6z"></path> <path id="XMLID_401_" fill="#FFFFFF" d="M-299.6,390.9c-0.7-0.1-1.2-0.3-1.6-0.8c-0.5-0.8-0.2-2.1,1-2.4c0.6-0.2,1.2-0.1,1.8,0.2 c0.5,0.4,0.7,0.9,0.6,1.5c-0.1,0.7-0.5,1.1-1.1,1.3C-299.1,390.8-299.4,390.8-299.6,390.9L-299.6,390.9z"></path> </g> </svg></span><span class="simplesocial-hidden-text">Share</span></a></li>
195
+ <li><span style="line-height: 20px; vertical-align: top; font-weight: bold;display: inline-block;">Official Buttons</span></li>
196
+ </ul>
197
+ <?php else : ?>
198
+ <ul>
199
+ <li><a href="#" class="simplesocial-fb-share"><span class="simplesocial-hidden-text">Facebook</span></a></li>
200
+ <li><a href="#" class="simplesocial-twt-share"><span class="simplesocial-hidden-text">Twitter</span></a></li>
201
+ <li><a href="#" class="simplesocial-linkedin-share"><span class="simplesocial-hidden-text">LinkedIn</span></a></li>
202
+ </ul>
203
+ <?php endif; ?>
204
+ </div> <!-- .simplesocialbuttons-nav -->
205
+ </div> <!-- .simplesocialbuttons-style -->
206
+ </div> <!-- .simplesocialbuttons-style-outer -->
207
+ <?php endforeach; ?>
208
+ <!-- </div>
209
+ </div> -->
210
+
211
+ <?php
212
+
213
+ }
214
+
215
+ function callback_position( $args ) {
216
+
217
+ $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
218
+ ?>
219
+ <div class="simplesocial-postion-outer-wrapper">
220
+ <?php printf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] ); ?>
221
+ <?php foreach ( $args['options'] as $key => $label ) : ?>
222
+ <?php $checked = isset( $value[ $key ] ) ? $value[ $key ] : '0'; ?>
223
+ <div class="simplesocial-postion-outer">
224
+ <label class="simplesocial-postion-box simplesocial-<?php echo $key; ?>">
225
+ <span class="simplesocial-fb-sharehd-line"><?php echo $label; ?></span>
226
+ <span class="simplesocial-blue-box">
227
+ <span class="simplesocial-highlight">
228
+ </span>
229
+ </span>
230
+ <?php printf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) ); ?>
231
+ <span class="checkbox"><span class="shadow"></span></span>
232
+ </label>
233
+ </div>
234
+ <?php endforeach; ?>
235
+ </div>
236
+ <?php
237
+ }
238
+
239
+ function callback_ssb_select( $args ) {
240
+ echo isset( $args['desc'] ) ? $args['desc'] : '';
241
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
242
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
243
+ ?>
244
+ <div class="simplesocial-form-section">
245
+ <h5><?php echo $args['name']; ?></h5>
246
+ <?php
247
+ printf( '<select class="%1$s ssb_select" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
248
+ foreach ( $args['options'] as $key => $label ) {
249
+ printf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label );
250
+ }
251
+ printf( '</select>' );
252
+ ?>
253
+ </div>
254
+ <?php
255
+ }
 
 
256
 
257
  function callback_ssb_checkbox( $args ) {
258
 
259
+ echo isset( $args['desc'] ) ? $args['desc'] : '';
260
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
261
+ ?>
262
+ <div class="simplesocial-form-section">
263
+ <h5><?php echo $args['name']; ?></h5>
264
+ <?php
265
+ printf( '<input type="hidden" name="%1$s[%2$s]" value="0" />', $args['section'], $args['id'] );
266
+ printf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s]" name="%1$s[%2$s]" value="1" %3$s />', $args['section'], $args['id'], checked( $value, '1', false ) );
267
+ printf( '<label class="simplesocial-switch" for="%1$s[%2$s]"></label>', $args['section'], $args['id'] );
268
+ echo isset( $args['help'] ) ? $args['help'] : '';
269
+ ?>
270
  </div>
271
  <?php
272
+ }
273
+
274
+ function callback_ssb_color( $args ) {
275
+
276
+ echo isset( $args['desc'] ) ? $args['desc'] : '';
277
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
278
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
279
+ ?>
280
+ <div class="simplesocial-form-section">
281
+ <h5><?php echo $args['name']; ?></h5>
282
+ <div class="selection-color">
283
+ <?php
284
+ printf( '<input type="text" class="%1$s-text ssb_settings_color_picker" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
285
+ ?>
286
+ </div>
287
+ </div>
288
+ <?php
289
+ }
290
+
291
+ function callback_ssb_post_types( $args ) {
292
+
293
+ $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
294
+ $html = '<fieldset>';
295
+ ?>
296
+ <h4>Post type Settings</h4>
297
+ <div class="simplesocial-inline-form-section">
298
+ <?php printf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] ); ?>
299
+ <?php
300
+ foreach ( $args['options'] as $key => $label ) :
301
+
302
+ $checked = isset( $value[ $key ] ) ? $value[ $key ] : '0';
303
+ printf( '<label for="%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
304
+ printf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
305
+ printf( '<span class="checkbox"><span class="shadow"></span></span>' );
306
+ printf( '%1$s</label>', $label );
307
+
308
+ endforeach;
309
+ ?>
310
+
311
+ </div> <!-- .form-section -->
312
+
313
+ <?php
314
+
315
+ }
316
+
317
+ function callback_ssb_text( $args ) {
318
+
319
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
320
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
321
+ $type = isset( $args['type'] ) ? $args['type'] : 'text';
322
+ $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
323
+ echo $args['desc']
324
+ ?>
325
+ <div class="<?php printf( 'simplesocial-form-section container-%1$s[%2$s]', $args['section'], $args['id'] ); ?>">
326
+ <h5><?php echo $args['name']; ?></h5>
327
+ <div class="simplesocial-input">
328
+ <?php printf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder ); ?>
329
+ <span class="highlight"></span>
330
+ <span class="bar"></span>
331
+
332
+ </div>
333
+ </div>
334
+ <?php
335
+ }
336
+
337
+ function callback_ssb_textarea( $args ) {
338
+
339
+ $value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
340
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
341
+ $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
342
+
343
+ ?>
344
+ <div class="simplesocial-form-section">
345
+ <h5><?php echo $args['name']; ?></h5>
346
+ <div class="simplesocial-input">
347
+ <?php printf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value ); ?>
348
+ <span class="highlight"></span>
349
+ <span class="bar"></span>
350
+ </div>
351
+ </div>
352
+ <?php
353
+
354
+ }
355
+
356
+
357
+ function callback_ssb_icon_selection( $args ) {
358
+
359
+ $save_value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
360
+ $settings = array_flip( array_merge( array( 0 ), explode( ',', $save_value ) ) );
361
+
362
+ ?>
363
+
364
+ <div class="inside">
365
+ <p>Drag & Drop to activate and order your share buttons:</p>
366
+ <div class="ssb_settings_box">
367
+ <h2>Active</h2>
368
+ <ul id="ssb_active_icons" class="items" style="min-height:35px">
369
+ <?php
370
+ $ssb_icons_order = array();
371
+ $arrKnownButtons = array( 'twitter', 'pinterest', 'fbshare', 'linkedin', 'reddit', 'whatsapp', 'viber', 'fblike', 'messenger', 'email', 'print', 'tumblr' );
372
+ foreach ( $arrKnownButtons as $button_name ) {
373
+ $ssb_icons_order[ $button_name ] = isset( $settings[ $button_name ] ) ? $settings[ $button_name ] : '';
374
+ }
375
+
376
+ asort( $ssb_icons_order );
377
+ ?>
378
+ <?php foreach ( $ssb_icons_order as $key => $value ) : ?>
379
+ <?php if ( $value != 0 ) : ?>
380
+ <li data-id="<?php echo $key; ?>" class="list"><img src="<?php echo plugins_url( 'assets/images/' . $key . '.svg', plugin_dir_path( __FILE__ ) ); ?>" /></li>
381
+ <?php endif; ?>
382
+ <?php endforeach; ?>
383
+ </ul>
384
+ </div>
385
+ <div class="ssb_settings_box">
386
+ <h2>InActive</h2>
387
+
388
+ <ul id="ssb_inactive_icons" class="items" style="min-height:35px">
389
+ <?php foreach ( $ssb_icons_order as $key => $value ) : ?>
390
+ <?php if ( $value == 0 ) : ?>
391
+ <li data-id="<?php echo $key; ?>" class="list" ><img src="<?php echo plugins_url( 'assets/images/' . $key . '.svg', plugin_dir_path( __FILE__ ) ); ?>" /></li>
392
+ <?php endif; ?>
393
+ <?php endforeach; ?>
394
+ </ul>
395
+ </div>
396
+
397
+ <?php printf( '<input type="hidden" id="%1$s[%2$s]" name="%1$s[%2$s]" value="%3$s" />', $args['section'], $args['id'], $save_value ); ?>
398
+
399
+ </div>
400
+
401
+ <?php
402
+ }
403
+
404
+ function callback_ssb_go_pro( $args ) {
405
+ ?>
406
+ <div class="ssb_goto_pro_section">
407
+ <h4><?php echo $args['name']; ?></h4>
408
+ <p><?php echo $args['desc']; ?></p>
409
+ <a href="<?php echo $args['link']; ?>" class="ssb_goto_pro_button">Click here to Upgrade</a>
410
+ </div>
411
+ <?php
412
+ }
413
+
414
+ function settings_header() {
415
+ ?>
416
+ <div class="ssb-top-bar">
417
+ <a href="https://wpbrigade.com/"><img src="<?php echo plugins_url( 'assets/images/ssb_icon.png', plugin_dir_path( __FILE__ ) ); ?>" alt="Simple Social Buttons"></a>
418
+ <div class="ssb-top-bar-content">
419
+ <h2>Simple Social Buttons -->> <?php _e( 'makes Social Sharing easy for everyone' ); ?></h2>
420
+ <p><?php _e( '<strong>Simple Social Buttons</strong> by <strong><a href="https://wpbrigade.com/?utm_source=simple-social-buttons-lite&utm_medium=link-header&utm_campaign=pro-upgrade">WPBrigade</a></strong> adds an advanced set of social media sharing buttons to your WordPress sites, such as: <strong>Google +1</strong>, <strong>Facebook</strong>, <strong>WhatsApp</strong>, <strong>Viber</strong>, <strong>Twitter</strong>, <strong>Reddit</strong>, <strong>LinkedIn</strong> and <strong>Pinterest</strong>. This makes it the most flexible social sharing plugin ever for Everyone.', 'simplesocialbuttons' ); ?></p>
421
+ </div>
422
+ </div>
423
+ <?php
424
+ }
425
+
426
+ function settings_sidebar() {
427
+ ?>
428
+ <div class="postbox-container ssb_right_sidebar">
429
+ <div id="poststuff">
430
+ <div class="postbox ssb_social_links_wrapper">
431
+ <div class="sidebar postbox">
432
+ <h2><?php _e( 'Spread the Word', 'simple-social-buttons' ); ?></h2>
433
+ <ul class="ssb_social_links">
434
+ <li>
435
+ <a href="http://twitter.com/share?text=Check out this (FREE) Amazing Social Share Plugin for WordPress&amp;url=https://wordpress.org/plugins/simple-social-buttons/" data-count="none" class="button twitter" target="_blank" title="Post to Twitter Now"><?php _e( 'Share on Twitter', 'simple-social-buttons' ); ?><span class="dashicons dashicons-twitter"></span></a>
436
+ </li>
437
+ <li>
438
+ <a href="https://www.facebook.com/sharer/sharer.php?u=https://wordpress.org/plugins/simple-social-buttons/" class="button facebook" target="_blank" title="Check out this (FREE) Amazing Social Share Plugin for WordPress"><?php _e( 'Share on Facebook', 'simple-social-buttons' ); ?><span class="dashicons dashicons-facebook"></span>
439
+ </a>
440
+ </li>
441
+ <li>
442
+ <a href="https://wordpress.org/plugins/simple-social-buttons/?filter=5" class="button wordpress" target="_blank" title="Rate on WordPress.org"><?php _e( 'Rate on WordPress.org', 'simple-social-buttons' ); ?><span class="dashicons dashicons-wordpress"></span>
443
+ </a>
444
+ </li>
445
+ </ul>
446
+ </div>
447
+ </div>
448
+
449
+ <div class="postbox ssb_social_links_wrapper">
450
+ <div class="sidebar postbox">
451
+ <h2><?php _e( 'Subscribe Newsletter', 'simple-social-buttons' ); ?></h2>
452
+ <ul>
453
+ <li>
454
+ <label for=""><?php _e( 'Email', 'simple-social-buttons' ); ?></label>
455
+ <input type="email" name="subscriber_mail" value="<?php echo get_option( 'admin_email' ); ?>" id="ssb_subscribe_mail">
456
+ <p class="ssb_subscribe_warning"></p>
457
+ </li>
458
+ <li>
459
+ <label for=""><?php _e( 'Name', 'simple-social-buttons' ); ?></label>
460
+ <input type="text" name="subscriber_name" id="ssb_subscribe_name" value="<?php echo wp_get_current_user()->display_name; ?>">
461
+ </li>
462
+ <li>
463
+ <input type="submit" value="Subscribe Now" class="button button-primary button-big" id="ssb_subscribe_btn">
464
+ <img src="<?php echo admin_url( 'images/spinner.gif' ); ?>" class="ssb_subscribe_loader" style="display:none">
465
+ </li>
466
+ <li>
467
+ <p class="ssb_return_message"></p>
468
+ </li>
469
+ </ul>
470
+ </div>
471
+ </div>
472
+
473
+ <div class="postbox ssb_social_links_wrapper">
474
+ <div class="sidebar postbox">
475
+ <h2><?php _e( 'Recommended Plugins', 'simple-social-buttons' ); ?></h2>
476
+ <ul class="plugins_lists">
477
+ <li>
478
+ <a href="https://wpbrigade.com/wordpress/plugins/loginpress-pro/?utm_source=ssb-lite&amp;utm_medium=sidebar&amp;utm_campaign=pro-upgrade" target="_blank" title="Post to Twitter Now">LoginPress - Login Customizer</a>
479
+ </li>
480
+ <li>
481
+ <a href="https://analytify.io/ref/73/?utm_source=ssb-lite&amp;utm_medium=sidebar&amp;utm_campaign=pro-upgrade" target="_blank" title="Share with your facebook friends about this awesome plugin.">Google Analytics by Analytify
482
+ </a>
483
+ </li>
484
+ <li>
485
+ <a href="https://wpbrigade.com/wordpress/plugins/related-posts/?utm_source=ssb-lite&amp;utm_medium=sidebar&amp;utm_campaign=pro-upgrade" target="_blank" title="Releated Posts Thumbnails">Releated Posts Thumbnails</a>
486
+ </li>
487
+ <li>
488
+ <a href="http://wpbrigade.com/recommend/maintenance-mode" target="_blank" title="Under Construction &amp; Maintenance mode">Under Construction &amp; Maintenance mode
489
+ </a>
490
+ </li>
491
+ </ul>
492
+ </div>
493
+ </div>
494
+ </div>
495
+ </div>
496
+ <?php
497
+ }
498
+
499
+ /**
500
+ * Displays a text field for a settings field
501
+ *
502
+ * @param array $args settings field args
503
+ */
504
+ function callback_text( $args ) {
505
+
506
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
507
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
508
+ $type = isset( $args['type'] ) ? $args['type'] : 'text';
509
+ $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
510
+
511
+ $html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );
512
+ $html .= $this->get_field_description( $args );
513
+
514
+ echo $html;
515
+ }
516
+
517
+ /**
518
+ * Displays a url field for a settings field
519
+ *
520
+ * @param array $args settings field args
521
+ */
522
+ function callback_url( $args ) {
523
+ $this->callback_text( $args );
524
+ }
525
+
526
+ /**
527
+ * Displays a number field for a settings field
528
+ *
529
+ * @param array $args settings field args
530
+ */
531
+ function callback_number( $args ) {
532
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
533
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
534
+ $type = isset( $args['type'] ) ? $args['type'] : 'number';
535
+ $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
536
+ $min = empty( $args['min'] ) ? '' : ' min="' . $args['min'] . '"';
537
+ $max = empty( $args['max'] ) ? '' : ' max="' . $args['max'] . '"';
538
+ $step = empty( $args['max'] ) ? '' : ' step="' . $args['step'] . '"';
539
+
540
+ $html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
541
+ $html .= $this->get_field_description( $args );
542
+
543
+ echo $html;
544
+ }
545
+
546
+ /**
547
+ * Displays a checkbox for a settings field
548
+ *
549
+ * @param array $args settings field args
550
+ */
551
+ function callback_checkbox( $args ) {
552
+
553
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
554
+
555
+ $html = '<fieldset>';
556
+ $html .= sprintf( '<label for="%1$s[%2$s]">', $args['section'], $args['id'] );
557
+ $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
558
+ $html .= sprintf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked( $value, 'on', false ) );
559
+ $html .= sprintf( '%1$s</label>', $args['desc'] );
560
+ $html .= '</fieldset>';
561
+
562
+ echo $html;
563
+ }
564
+
565
+ /**
566
+ * Displays a multicheckbox for a settings field
567
+ *
568
+ * @param array $args settings field args
569
+ */
570
+ function callback_multicheck( $args ) {
571
+
572
+ $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
573
+ $html = '<fieldset>';
574
+ $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
575
+ foreach ( $args['options'] as $key => $label ) {
576
+ $checked = isset( $value[ $key ] ) ? $value[ $key ] : '0';
577
+ $html .= sprintf( '<label for="%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
578
+ $html .= sprintf( '<input type="checkbox" class="checkbox" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
579
+ $html .= sprintf( '%1$s</label><br>', $label );
580
+ }
581
+
582
+ $html .= $this->get_field_description( $args );
583
+ $html .= '</fieldset>';
584
+
585
+ echo $html;
586
+ }
587
+
588
+ /**
589
+ * Displays a radio button for a settings field
590
+ *
591
+ * @param array $args settings field args
592
+ */
593
+ function callback_radio( $args ) {
594
+
595
+ $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
596
+ $html = '<fieldset>';
597
+
598
+ foreach ( $args['options'] as $key => $label ) {
599
+ $html .= sprintf( '<label for="%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
600
+ $html .= sprintf( '<input type="radio" class="radio" id="%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
601
+ $html .= sprintf( '%1$s</label><br>', $label );
602
+ }
603
+
604
+ $html .= $this->get_field_description( $args );
605
+ $html .= '</fieldset>';
606
+
607
+ echo $html;
608
+ }
609
+
610
+ /**
611
+ * Displays a selectbox for a settings field
612
+ *
613
+ * @param array $args settings field args
614
+ */
615
+ function callback_select( $args ) {
616
+
617
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
618
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
619
+ $html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
620
+
621
+ foreach ( $args['options'] as $key => $label ) {
622
+ $html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label );
623
+ }
624
+
625
+ $html .= sprintf( '</select>' );
626
+ $html .= $this->get_field_description( $args );
627
+
628
+ echo $html;
629
+ }
630
+
631
+ /**
632
+ * Displays a textarea for a settings field
633
+ *
634
+ * @param array $args settings field args
635
+ */
636
+ function callback_textarea( $args ) {
637
+
638
+ $value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
639
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
640
+ $placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
641
+
642
+ $html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );
643
+ $html .= $this->get_field_description( $args );
644
+
645
+ echo $html;
646
+ }
647
+
648
+ /**
649
+ * Displays the html for a settings field
650
+ *
651
+ * @param array $args settings field args
652
+ * @return string
653
+ */
654
+ function callback_html( $args ) {
655
+ echo $this->get_field_description( $args );
656
+ }
657
+
658
+ /**
659
+ * Displays a rich text textarea for a settings field
660
+ *
661
+ * @param array $args settings field args
662
+ */
663
+ function callback_wysiwyg( $args ) {
664
+
665
+ $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
666
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : '500px';
667
+
668
+ echo '<div style="max-width: ' . $size . ';">';
669
+
670
+ $editor_settings = array(
671
+ 'teeny' => true,
672
+ 'textarea_name' => $args['section'] . '[' . $args['id'] . ']',
673
+ 'textarea_rows' => 10,
674
+ );
675
+
676
+ if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
677
+ $editor_settings = array_merge( $editor_settings, $args['options'] );
678
+ }
679
+
680
+ wp_editor( $value, $args['section'] . '-' . $args['id'], $editor_settings );
681
+
682
+ echo '</div>';
683
+
684
+ echo $this->get_field_description( $args );
685
+ }
686
+
687
+ /**
688
+ * Displays a file upload field for a settings field
689
+ *
690
+ * @param array $args settings field args
691
+ */
692
+ function callback_file( $args ) {
693
+
694
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
695
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
696
+ $id = $args['section'] . '[' . $args['id'] . ']';
697
+ $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
698
+
699
+ $html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
700
+ $html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
701
+ $html .= $this->get_field_description( $args );
702
+
703
+ echo $html;
704
+ }
705
+
706
+ /**
707
+ * Displays a password field for a settings field
708
+ *
709
+ * @param array $args settings field args
710
+ */
711
+ function callback_password( $args ) {
712
+
713
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
714
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
715
+
716
+ $html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
717
+ $html .= $this->get_field_description( $args );
718
+
719
+ echo $html;
720
+ }
721
+
722
+ /**
723
+ * Displays a color picker field for a settings field
724
+ *
725
+ * @param array $args settings field args
726
+ */
727
+ function callback_color( $args ) {
728
+
729
+ $value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
730
+ $size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
731
+
732
+ $html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
733
+ $html .= $this->get_field_description( $args );
734
+
735
+ echo $html;
736
+ }
737
+
738
+
739
+ /**
740
+ * Displays a select box for creating the pages select box
741
+ *
742
+ * @param array $args settings field args
743
+ */
744
+ function callback_pages( $args ) {
745
+
746
+ $dropdown_args = array(
747
+ 'selected' => esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) ),
748
+ 'name' => $args['section'] . '[' . $args['id'] . ']',
749
+ 'id' => $args['section'] . '[' . $args['id'] . ']',
750
+ 'echo' => 0,
751
+ );
752
+ $html = wp_dropdown_pages( $dropdown_args );
753
+ echo $html;
754
+ }
755
+
756
+ /**
757
+ * Sanitize callback for Settings API
758
+ *
759
+ * @return mixed
760
+ */
761
+ function sanitize_options( $options ) {
762
+
763
+ if ( ! $options ) {
764
+ return $options;
765
+ }
766
+
767
+ foreach ( $options as $option_slug => $option_value ) {
768
+ $sanitize_callback = $this->get_sanitize_callback( $option_slug );
769
+
770
+ // If callback is set, call it
771
+ if ( $sanitize_callback ) {
772
+ $options[ $option_slug ] = call_user_func( $sanitize_callback, $option_value );
773
+ continue;
774
+ }
775
+ }
776
+
777
+ return $options;
778
+ }
779
+
780
+ /**
781
+ * Get sanitization callback for given option slug
782
+ *
783
+ * @param string $slug option slug
784
+ *
785
+ * @return mixed string or bool false
786
+ */
787
+ function get_sanitize_callback( $slug = '' ) {
788
+ if ( empty( $slug ) ) {
789
+ return false;
790
+ }
791
+
792
+ // Iterate over registered fields and see if we can find proper callback
793
+ foreach ( $this->settings_fields as $section => $options ) {
794
+ foreach ( $options as $option ) {
795
+ if ( $option['name'] != $slug ) {
796
+ continue;
797
+ }
798
+
799
+ // Return the callback name
800
+ return isset( $option['sanitize_callback'] ) && is_callable( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : false;
801
+ }
802
+ }
803
+
804
+ return false;
805
+ }
806
+
807
+ /**
808
+ * Get the value of a settings field
809
+ *
810
+ * @param string $option settings field name
811
+ * @param string $section the section name this field belongs to
812
+ * @param string $default default text if it's not found
813
+ * @return string
814
+ */
815
+ function get_option( $option, $section, $default = '' ) {
816
+
817
+ $options = get_option( $section );
818
+
819
+ if ( isset( $options[ $option ] ) ) {
820
+ return $options[ $option ];
821
+ }
822
+
823
+ return $default;
824
+ }
825
+
826
+ /**
827
+ * Show navigations as tab
828
+ *
829
+ * Shows all the settings section labels as tab
830
+ */
831
+ function show_navigation() {
832
+ $html = '<h2 class="nav-tab-wrapper">';
833
+
834
+ $tabs = array(
835
+ array(
836
+ 'id' => 'ssb_settings',
837
+ 'title' => '<span class="dashicons dashicons-admin-generic"></span>Settings',
838
+ ),
839
+ array(
840
+ 'id' => 'ssb_advanced',
841
+ 'title' => '<span class="dashicons dashicons-editor-code"></span>Advanced',
842
+ ),
843
+ );
844
+ if ( ! class_exists( 'Simple_Social_Buttons_Pro' ) ) {
845
+ $tabs[] = array(
846
+ 'id' => 'ssb_go_pro',
847
+ 'title' => '<span class="dashicons dashicons-star-filled"></span>Upgrade To Pro For More Features',
848
+ 'link' => 'https://wpbrigade.com/wordpress/plugins/simple-social-buttons-pro/?utm_source=simple-social-buttons-lite&utm_medium=tab&utm_campaign=pro-upgrade',
849
+ );
850
+ }
851
+ foreach ( $tabs as $tab ) {
852
+ if ( isset( $tab['link'] ) ) {
853
+ $html .= sprintf( '<a href="%3$s" class="nav-tab" id="%1$s-tab" target="_blank" >%2$s</a>', $tab['id'], $tab['title'], $tab['link'] );
854
+ } else {
855
+ $html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title'] );
856
+ }
857
+ }
858
+
859
+ $html .= '</h2>';
860
+
861
+ echo $html;
862
+ }
863
+
864
+ /**
865
+ * Show the section settings forms
866
+ *
867
+ * This function displays every sections in a different form
868
+ */
869
+
870
+ function show_forms() {
871
+ echo '<div class="ssb_settings_container ssb_settings-tab group" id="ssb_settings-tab-content">';
872
+ echo '<div class="metabox-holder">';
873
+ echo '<div id="poststuff">';
874
+ echo '<form method="post" action="options.php">';
875
+ $this->do_settings_sections( 'ssb_networks' );
876
+ settings_fields( 'ssb_networks' );
877
+ submit_button();
878
+ echo '</form>';
879
+ echo '</div>';
880
+ echo '</div>';
881
+ echo '</div>';
882
+
883
+ echo '<div class="ssb_settings_container ssb_advanced-tab group" id="ssb_advanced-tab-content">';
884
+ echo '<div class="metabox-holder">';
885
+ echo '<div id="poststuff">';
886
+ echo '<form method="post" action="options.php">';
887
+ $this->do_settings_sections( 'ssb_advanced' );
888
+ settings_fields( 'ssb_advanced' );
889
+ $this->render_instruction();
890
+ submit_button();
891
+ echo '</form>';
892
+ echo '</div>';
893
+ echo '</div>';
894
+ echo '</div>';
895
+
896
+ $this->script();
897
+ }
898
+
899
+
900
+ function render_instruction() {
901
+
902
+ echo '<div class="postbox " id="ssb_instruction">
903
+ <div class="inside">
904
+ <h3 class="">Instructions</h3>
905
+ <div class="postbox-content">
906
+ <h4 class="ssb_instruct_heading">Twitter count tracking requires the following steps:</h4>
907
+ <p> ' . __( '<span class="ssb_step">Step 1: </span> <a target="_blank" href="http://twitcount.com">Click here </a> to visit twitcount.com', 'simple-social-buttons' ) . '</p>
908
+ <p> ' . __( '<span class="ssb_step">Step 2: </span> Click the Button “Give Me My Twitter Count Back” on their website to create an account. If you see a prompt to customize your button, ignore to click paste code. ', 'simple-social-buttons' ) . '</p>
909
+ <p> ' . __( '<span class="ssb_step">Step 3: </span> After creating an account Click “Account and Settingstab then add your website click save button to track your Twitter share counts.', 'simple-social-buttons' ) . '</p>
910
+ </div>
911
+ </div>
912
+ </div>';
913
+
914
+ }
915
+
916
+ /**
917
+ * Prints out all settings sections added to a particular settings page
918
+ *
919
+ * Part of the Settings API. Use this in a settings page callback function
920
+ * to output all the sections and fields that were added to that $page with
921
+ * add_settings_section() and add_settings_field()
922
+ *
923
+ * @global $wp_settings_sections Storage array of all settings sections added to admin pages
924
+ * @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
925
+ * @since 2.7.0
926
+ *
927
+ * @param string $page The slug name of the page whose settings sections you want to output
928
+ */
929
+ function do_settings_sections( $page ) {
930
+ global $wp_settings_sections, $wp_settings_fields;
931
+
932
+ if ( ! isset( $wp_settings_sections[ $page ] ) ) {
933
+ return;
934
+ }
935
+
936
+ foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
937
+
938
+ if ( $section['callback'] ) {
939
+ call_user_func( $section['callback'], $section );
940
+ }
941
+
942
+ if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
943
+ continue;
944
+ }
945
+
946
+ $extra_class = in_array( $section['id'], array( 'ssb_sidebar', 'ssb_inline', 'ssb_media', 'ssb_popup', 'ssb_flyin' ) ) ? 'simpleshare-acordions' : '';
947
+ ?>
948
+ <div class="postbox <?php echo $extra_class; ?>" id='<?php echo $section['id']; ?>' >
949
+ <div class="inside">
950
+ <h3 class="simpleshare-active"><?php echo $section['title']; ?></h3>
951
+ <div class="postbox-content">
952
+ <?php
953
+ $this->do_settings_fields( $page, $section['id'] );
954
+ ?>
955
+ </div>
956
+ </div>
957
+ </div>
958
+ <?php
959
+ }
960
+ }
961
+
962
+
963
+ /**
964
+ * Print out the settings fields for a particular settings section
965
+ *
966
+ * Part of the Settings API. Use this in a settings page to output
967
+ * a specific section. Should normally be called by do_settings_sections()
968
+ * rather than directly.
969
+ *
970
+ * @global $wp_settings_fields Storage array of settings fields and their pages/sections
971
+ *
972
+ * @since 2.7.0
973
+ *
974
+ * @param string $page Slug title of the admin page who's settings fields you want to show.
975
+ * @param string $section Slug title of the settings section who's fields you want to show.
976
+ */
977
+ function do_settings_fields( $page, $section ) {
978
+ global $wp_settings_fields;
979
+
980
+ if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
981
+ return;
982
+ }
983
+
984
+ foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) {
985
+ $class = '';
986
+
987
+ if ( ! empty( $field['args']['class'] ) ) {
988
+ $class = ' class="' . esc_attr( $field['args']['class'] ) . '"';
989
+ }
990
+
991
+ // echo "<tr{$class}>";
992
+ //
993
+ // if ( ! empty( $field['args']['label_for'] ) ) {
994
+ // echo '<th scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>';
995
+ // } else {
996
+ // echo '<th scope="row">' . $field['title'] . '</th>';
997
+ // }
998
+
999
+ // echo '<td>';
1000
+
1001
+ call_user_func( $field['callback'], $field['args'] );
1002
+ // echo '</td>';
1003
+ // echo '</tr>';
1004
+ }
1005
+ }
1006
+
1007
+
1008
+ /**
1009
+ * Tabbable JavaScript codes & Initiate Color Picker
1010
+ *
1011
+ * This code uses localstorage for displaying active tabs
1012
+ */
1013
+ function script() {
1014
+ ?>
1015
+ <script>
1016
+ jQuery(document).ready(function($) {
1017
+ //Initiate Color Picker
1018
+ $('.wp-color-picker-field').wpColorPicker();
1019
+
1020
+ // Switches option sections
1021
+ $('.group').hide();
1022
+ var activetab = '';
1023
+ if (typeof(localStorage) != 'undefined' ) {
1024
+ activetab = localStorage.getItem("activetab");
1025
+ }
1026
+
1027
+ //if url has section id as hash then set it as active or override the current local storage value
1028
+ if(window.location.hash){
1029
+ activetab = window.location.hash;
1030
+ if (typeof(localStorage) != 'undefined' ) {
1031
+ localStorage.setItem("activetab", activetab);
1032
+ }
1033
+ }
1034
+
1035
+ $(activetab+'-tab-content').fadeIn();
1036
+ if (activetab != '' && $(activetab).length ) {
1037
+ $(activetab).fadeIn();
1038
+ } else {
1039
+ $('.group:first').fadeIn();
1040
+ }
1041
+ $('.group .collapsed').each(function(){
1042
+ $(this).find('input:checked').parent().parent().parent().nextAll().each(
1043
+ function(){
1044
+ if ($(this).hasClass('last')) {
1045
+ $(this).removeClass('hidden');
1046
+ return false;
1047
+ }
1048
+ $(this).filter('.hidden').removeClass('hidden');
1049
+ });
1050
+ });
1051
+
1052
+ if (activetab != '' && $(activetab + '-tab').length ) {
1053
+ $(activetab + '-tab').addClass('nav-tab-active');
1054
+ }
1055
+ else {
1056
+ $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
1057
+ }
1058
+ $('.nav-tab-wrapper a').click(function(evt) {
1059
+
1060
+ if ('ssb_go_pro-tab' == $(this).attr('id')) { return; }
1061
+ $('.nav-tab-wrapper a').removeClass('nav-tab-active');
1062
+ $(this).addClass('nav-tab-active').blur();
1063
+ var clicked_group = $(this).attr('href') + '-tab-content';
1064
+ if (typeof(localStorage) != 'undefined' ) {
1065
+ if ( $(this).attr('href').indexOf('#') > -1 ) {
1066
+ localStorage.setItem("activetab", $(this).attr('href'));
1067
+ }
1068
+ }
1069
+ $('.group').hide();
1070
+ $(clicked_group).fadeIn();
1071
+ evt.preventDefault();
1072
+ });
1073
+
1074
+ $('.wpsa-browse').on('click', function (event) {
1075
+ event.preventDefault();
1076
+
1077
+ var self = $(this);
1078
+
1079
+ // Create the media frame.
1080
+ var file_frame = wp.media.frames.file_frame = wp.media({
1081
+ title: self.data('uploader_title'),
1082
+ button: {
1083
+ text: self.data('uploader_button_text'),
1084
+ },
1085
+ multiple: false
1086
+ });
1087
+
1088
+ file_frame.on('select', function () {
1089
+ attachment = file_frame.state().get('selection').first().toJSON();
1090
+ self.prev('.wpsa-url').val(attachment.url).change();
1091
+ });
1092
+
1093
+ // Finally, open the modal
1094
+ file_frame.open();
1095
+ });
1096
+
1097
+ $('#ssb_subscribe_btn').on('click', function(event) {
1098
+ event.preventDefault();
1099
+ var subscriber_mail = $('#ssb_subscribe_mail').val();
1100
+ var name = $('#ssb_subscribe_name').val();
1101
+ if (!subscriber_mail) {
1102
+ $('.ssb_subscribe_warning').html('Please Enter Email');
1103
+ return;
1104
+ }
1105
+ $.ajax({
1106
+ url: 'https://wpbrigade.com/wp-json/wpbrigade/v1/subsribe-to-mailchimp',
1107
+ type: 'POST',
1108
+ data: {
1109
+ subscriber_mail : subscriber_mail,
1110
+ name : name,
1111
+ plugin_name : 'ssb'
1112
+ },
1113
+ beforeSend : function() {
1114
+ $('.ssb_subscribe_loader').show();
1115
+ $('#ssb_subscribe_btn').attr('disabled', 'disabled');
1116
+ }
1117
+ })
1118
+ .done(function(res) {
1119
+ $('.ssb_return_message').html(res);
1120
+ $('.ssb_subscribe_loader').hide();
1121
+ });
1122
+ });
1123
+ $('.simplesocialbuttons-style').on('click',function(){
1124
+ var el = $(this);
1125
+ $(this).addClass('social-active').parent().siblings().find('.simplesocialbuttons-style').removeClass('social-active');
1126
+ $(this).find('input[type="radio"]').prop('checked', true);
1127
+ });
1128
+ $('.simplesocial-postion-box').on('click',function(){
1129
+ var el = $(this);
1130
+ var target = $(this).children('input[type="checkbox"]').val();
1131
+ if($(this).children('input[type="checkbox"]').is(':checked')){
1132
+ $(this).addClass('social-active');
1133
+ $('#ssb_'+target).fadeIn();
1134
+ }else{
1135
+ $(this).removeClass('social-active');
1136
+ $('#ssb_'+target).fadeOut();
1137
+ }
1138
+ $(this).find('.shadow').addClass('animated');
1139
+ setTimeout(function(){ el.find('.shadow').removeClass('animated'); }, 400);
1140
+ });
1141
+ $('.simplesocial-postion-box').each(function(){
1142
+ var el = $(this);
1143
+ var target = $(this).children('input[type="checkbox"]').val();
1144
+ if($(this).children('input[type="checkbox"]').is(':checked')){
1145
+ $(this).addClass('social-active');
1146
+ $('#ssb_'+target).fadeIn();
1147
+ }else{
1148
+ $(this).removeClass('social-active');
1149
+ $('#ssb_'+target).fadeOut();
1150
+ }
1151
+ });
1152
+ $('.simplesocial-inline-form-section label').on('click',function(){
1153
+ var el = $(this);
1154
+ $(this).find('.shadow').addClass('animated');
1155
+ setTimeout(function(){ el.find('.shadow').removeClass('animated'); }, 400);
1156
+ });
1157
+ $('.simpleshare-acordions h3').on('click',function(){
1158
+ $(this).toggleClass('simpleshare-active');
1159
+ $(this).next('.postbox-content').slideToggle();
1160
+ });
1161
+ $('.ssb_select').each(function () {
1162
+
1163
+ // Cache the number of options
1164
+ var $this = $(this),
1165
+ numberOfOptions = $(this).children('option').length;
1166
+
1167
+ // Hides the select element
1168
+ $this.addClass('s-hidden');
1169
+
1170
+ // Wrap the select element in a div
1171
+ $this.wrap('<div class="select"></div>');
1172
+
1173
+ // Insert a styled div to sit over the top of the hidden select element
1174
+ $this.after('<div class="styledSelect"></div>');
1175
+
1176
+ // Cache the styled div
1177
+ var $styledSelect = $this.next('div.styledSelect');
1178
+ var getHTML = $this.children('option[value="'+$this.val()+'"]').text();
1179
+ // Show the first select option in the styled div
1180
+ $styledSelect.text(getHTML);
1181
+
1182
+ // Insert an unordered list after the styled div and also cache the list
1183
+ var $list = $('<ul />', {
1184
+ 'class': 'options'
1185
+ }).insertAfter($styledSelect);
1186
+
1187
+ // Insert a list item into the unordered list for each select option
1188
+ for (var i = 0; i < numberOfOptions; i++) {
1189
+ $('<li />', {
1190
+ text: $this.children('option').eq(i).text(),
1191
+ rel: $this.children('option').eq(i).val()
1192
+ }).appendTo($list);
1193
+ }
1194
+
1195
+ // Cache the list items
1196
+ var $listItems = $list.children('li');
1197
+
1198
+ // Show the unordered list when the styled div is clicked (also hides it if the div is clicked again)
1199
+ $styledSelect.click(function (e) {
1200
+
1201
+ // $(this).addClass('active').next('ul.options').slideDown();
1202
+ if($(this).hasClass('active')){
1203
+ $(this).removeClass('active').next('ul.options').slideUp();
1204
+ }else{
1205
+ $('div.styledSelect.active').each(function () {
1206
+ $(this).removeClass('active').next('ul.options').slideUp();
1207
+ });
1208
+ $(this).addClass('active').next('ul.options').slideDown();
1209
+ }
1210
+ e.stopPropagation();
1211
+ });
1212
+
1213
+ // Hides the unordered list when a list item is clicked and updates the styled div to show the selected list item
1214
+ // Updates the select element to have the value of the equivalent option
1215
+ $listItems.click(function (e) {
1216
+ e.stopPropagation();
1217
+ $styledSelect.text($(this).text()).removeClass('active');
1218
+ var value = $(this).attr('rel').toString();
1219
+ $($this).val(value);
1220
+ $($this).trigger('change');
1221
+ $list.slideUp();
1222
+ /* alert($this.val()); Uncomment this for demonstration! */
1223
+ });
1224
+
1225
+ // Hides the unordered list when clicking outside of it
1226
+ $(document).click(function () {
1227
+ $styledSelect.removeClass('active');
1228
+ $list.slideUp();
1229
+ });
1230
+
1231
+ });
1232
+ });
1233
+ </script>
1234
+ <?php
1235
+ $this->_style_fix();
1236
+ }
1237
+
1238
+ function _style_fix() {
1239
+ global $wp_version;
1240
+
1241
+ if ( version_compare( $wp_version, '3.8', '<=' ) ) :
1242
+ ?>
1243
+ <style type="text/css">
1244
+ /** WordPress 3.8 Fix **/
1245
+ .form-table th { padding: 20px 10px; }
1246
+ #wpbody-content .metabox-holder { padding-top: 5px; }
1247
+ </style>
1248
+ <?php
1249
+ endif;
1250
+ }
1251
+
1252
+ }
1253
 
1254
  endif;
classes/ssb-widget.php CHANGED
@@ -3,18 +3,12 @@
3
  /**
4
  * Widget class for social share follower widget
5
  *
6
- * @sicne 2.0.2
7
  *
8
  * Class Ssb_Follower_Widget
9
  */
10
  class Ssb_Follower_Widget extends WP_Widget {
11
 
12
- /**
13
- * Google console api key for google+ and youtube api for getting follower and subscriber
14
- * @var string
15
- */
16
- private $api_key = 'AIzaSyBkQDWiRWxWKUoavuajUSAs28ld0Pdx8a4';
17
-
18
  /**
19
  * Transient Time
20
  *
@@ -25,7 +19,7 @@ class Ssb_Follower_Widget extends WP_Widget {
25
  /**
26
  * Register ssb widget with WordPress.
27
  *
28
- * @since 2.0.2
29
  */
30
  function __construct() {
31
  $widget_ops = array(
@@ -38,40 +32,43 @@ class Ssb_Follower_Widget extends WP_Widget {
38
  /**
39
  * Front-end display of widget.
40
  *
41
- * @see WP_Widget::widget()
42
- *
43
  * @param array $args Widget arguments.
44
  * @param array $instance Saved values from database.
 
 
 
 
45
  */
46
- function widget( $args, $instance ) {
47
  extract( $args );
48
  $display = '1';
49
 
50
- $widget_title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance );
51
-
52
- $show_facebook = $instance['show_facebook'];
53
- $show_twitter = $instance['show_twitter'];
54
- $show_google_plus = $instance['show_google_plus'];
55
- $show_youtube = $instance['show_youtube'];
56
- $show_pinterest = $instance['show_pinterest'];
57
- $show_instagram = $instance['show_instagram'];
58
- $show_whatsapp = $instance['show_whatsapp'];
59
-
60
- $facebook_id = $instance['facebook_id'];
61
- $facebook_show_counter = $instance['facebook_show_counter'];
62
- $facebook_text = $instance['facebook_text'];
63
- $facebook_access_token = $instance['facebook_access_token'];
64
-
65
- $twitter_id = $instance['twitter'];
66
- $twitter_show_counter = $instance['twitter_show_counter'];
67
- $twitter_text = $instance['twitter_text'];
68
- $twitter_api_key = $instance['twitter_api_key'];
69
- $twitter_secret_key = $instance['twitter_secret_key'];
70
-
71
- $youtube_id = $instance['youtube'];
72
- $youtube_show_counter = $instance['youtube_show_counter'];
73
- $youtube_text = $instance['youtube_text'];
74
- $youtube_type = $instance['youtube_type'];
 
75
 
76
  $pinterest_id = $instance['pinterest'];
77
  $pinterest_show_counter = $instance['pinterest_show_counter'];
@@ -79,18 +76,18 @@ class Ssb_Follower_Widget extends WP_Widget {
79
  $pinterest_text = $instance['pinterest_text'];
80
 
81
  $instagram_id = $instance['instagram'];
82
- $instagram_show_counter = $instance['instagram_show_counter'];
83
- $instagram_text = $instance['instagram_text'];
84
- $instagram_access_token = $instance['instagram_access_token'];
85
 
86
- $whatsapp = $instance['whatsapp'];
87
- $whatsapp_text = $instance['whatsapp_text'];
88
 
89
- $fb_likes = $this->get_facebook_likes_count( $facebook_id, $facebook_access_token, $facebook_show_counter );
90
- $twitter_follower = $this->get_twitter_followers( $twitter_id, $twitter_api_key, $twitter_secret_key, $twitter_show_counter );
91
- $youtube_subscriber = $this->get_youtube_subscriber( $youtube_id, $youtube_show_counter, $youtube_type );
92
- $pinterest_follower = $this->get_pinterest_followers( $pinterest_id, $pinterest_show_counter );
93
- $instagram_follower = $this->get_instagram_id_followers( $instagram_access_token, $instagram_show_counter );
94
 
95
  include SSB_PLUGIN_DIR . '/inc/ssb-widget-front.php';
96
  }
@@ -98,25 +95,27 @@ class Ssb_Follower_Widget extends WP_Widget {
98
  /**
99
  * Back-end widget form.
100
  *
 
101
  * @see WP_Widget::form()
102
  *
103
- * @param array $instance Previously saved values from database.
 
 
104
  */
105
  public function form( $instance ) {
106
  $display = '1';
107
 
108
- //first time run when instance create
109
  if ( 0 == count( $instance ) ) {
110
  $instance['facebook_text'] = __( 'Follow us on Facebook', 'simple-social-buttons' );
111
  $instance['youtube_text'] = __( 'Subscribe us on Youtube', 'simple-social-buttons' );
112
  $instance['twitter_text'] = __( 'Follow us on Twitter', 'simple-social-buttons' );
113
- $instance['pinterest_text'] = __( 'Pin us on Pinterest', 'simple-social-buttons' );
114
  $instance['instagram_text'] = __( 'Follow us on Instagram', 'simple-social-buttons' );
115
  $instance['whatsapp_text'] = __( 'Contact us on WhatsApp', 'simple-social-buttons' );
116
 
117
  }
118
 
119
-
120
  $title = isset( $instance['title'] ) ? $instance['title'] : esc_html__( 'Follow Us', 'simple-social-buttons' );
121
 
122
  $show_facebook = ! empty( $instance['show_facebook'] ) ? $instance['show_facebook'] : '';
@@ -125,7 +124,7 @@ class Ssb_Follower_Widget extends WP_Widget {
125
  $show_youtube = ! empty( $instance['show_youtube'] ) ? $instance['show_youtube'] : '';
126
  $show_pinterest = ! empty( $instance['show_pinterest'] ) ? $instance['show_pinterest'] : '';
127
  $show_instagram = ! empty( $instance['show_instagram'] ) ? $instance['show_instagram'] : '';
128
- $show_whatsapp = ! empty( $instance['show_whatsapp'] ) ? $instance['show_whatsapp'] : '';
129
 
130
  $facebook_id = ! empty( $instance['facebook_id'] ) ? $instance['facebook_id'] : '';
131
  $facebook_show_counter = ! empty( $instance['facebook_show_counter'] ) ? $instance['facebook_show_counter'] : '';
@@ -144,6 +143,7 @@ class Ssb_Follower_Widget extends WP_Widget {
144
  $youtube_text = ! empty( $instance['youtube_text'] ) ? $instance['youtube_text'] : '';
145
  $youtube_type = ! empty( $instance['youtube_type'] ) ? $instance['youtube_type'] : '';
146
  $youtube_show_counter = ! empty( $instance['youtube_show_counter'] ) ? $instance['youtube_show_counter'] : '';
 
147
 
148
  $pinterest = ! empty( $instance['pinterest'] ) ? $instance['pinterest'] : '';
149
  $pinterest_text = ! empty( $instance['pinterest_text'] ) ? $instance['pinterest_text'] : '';
@@ -156,10 +156,9 @@ class Ssb_Follower_Widget extends WP_Widget {
156
  $instagram_show_counter = ! empty( $instance['instagram_show_counter'] ) ? $instance['instagram_show_counter'] : '';
157
  $instagram_access_token = ! empty( $instance['instagram_access_token'] ) ? $instance['instagram_access_token'] : '';
158
 
159
- //whats app mobile number will store in $whatsapp
160
- $whatsapp = ! empty( $instance['whatsapp'] ) ? $instance['whatsapp'] : '';
161
- $whatsapp_text = ! empty( $instance['whatsapp_text'] ) ? $instance['whatsapp_text'] : '';
162
-
163
 
164
  include SSB_PLUGIN_DIR . '/inc/ssb-widget-fields.php';
165
 
@@ -168,11 +167,11 @@ class Ssb_Follower_Widget extends WP_Widget {
168
  /**
169
  * Sanitize widget form values as they are saved.
170
  *
171
- * @see WP_Widget::update()
172
- *
173
  * @param array $new_instance Values just sent to be saved.
174
  * @param array $old_instance Previously saved values from database.
175
- *
 
 
176
  * @return array Updated safe values to be saved.
177
  */
178
  public function update( $new_instance, $old_instance ) {
@@ -184,9 +183,6 @@ class Ssb_Follower_Widget extends WP_Widget {
184
  delete_transient( 'ssb_follow_pinterest_counter' );
185
  delete_transient( 'ssb_follow_instagram_counter' );
186
 
187
- /*var_dump( $new_instance );
188
- die;*/
189
-
190
  $instance = array();
191
  $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
192
 
@@ -215,6 +211,7 @@ class Ssb_Follower_Widget extends WP_Widget {
215
  $instance['youtube_show_counter'] = ( ! empty( $new_instance['youtube_show_counter'] ) ) ? strip_tags( $new_instance['youtube_show_counter'] ) : '0';
216
  $instance['youtube_text'] = sanitize_text_field( wp_unslash( $new_instance['youtube_text'] ) );
217
  $instance['youtube_type'] = sanitize_text_field( wp_unslash( $new_instance['youtube_type'] ) );
 
218
 
219
  $instance['pinterest'] = sanitize_text_field( wp_unslash( $new_instance['pinterest'] ) );
220
  $instance['pinterest_show_counter'] = ( ! empty( $new_instance['pinterest_show_counter'] ) ) ? strip_tags( $new_instance['pinterest_show_counter'] ) : '0';
@@ -224,28 +221,28 @@ class Ssb_Follower_Widget extends WP_Widget {
224
  $instance['instagram'] = sanitize_text_field( wp_unslash( $new_instance['instagram'] ) );
225
  $instance['instagram_show_counter'] = ( ! empty( $new_instance['instagram_show_counter'] ) ) ? strip_tags( $new_instance['instagram_show_counter'] ) : '0';
226
  $instance['instagram_text'] = sanitize_text_field( wp_unslash( $new_instance['instagram_text'] ) );
227
- $instance['instagram_access_token'] = sanitize_text_field( wp_unslash( $new_instance['instagram_access_token'] ) );
228
 
229
- $instance['whatsapp'] = sanitize_text_field( wp_unslash( $new_instance['whatsapp'] ) );
230
- $instance['whatsapp_text'] = sanitize_text_field( wp_unslash( $new_instance['whatsapp_text'] ) );
231
 
232
  return $instance;
233
  }
234
 
235
  /**
236
- * passing facebook and access token return facebook like counter
237
- *
238
- * @since 2.0.2
239
  *
240
  * @param $facebook_id
241
  * @param $access_token
242
  *
 
 
243
  * @return int
244
  */
245
- function get_facebook_likes_count( $facebook_id, $access_token, $show_counter ) {
246
 
247
  if ( $show_counter ) {
248
- if( '' == $facebook_id ){
249
  return 0;
250
  }
251
 
@@ -259,8 +256,8 @@ class Ssb_Follower_Widget extends WP_Widget {
259
  return 0;
260
  }
261
  $result = json_decode( wp_remote_retrieve_body( $json_feed ) );
262
- $counter = ( isset( $result->fan_count ) ? $result->fan_count : 0 );
263
- $counter = $this->format_number( $counter );
264
 
265
  if ( ! empty( $counter ) ) {
266
  set_transient( 'ssb_follow_facebook_counter', $counter, $this->cache_time );
@@ -276,16 +273,16 @@ class Ssb_Follower_Widget extends WP_Widget {
276
  /**
277
  * Pass twitter user name and api key return twitter follower
278
  *
279
- * @since 2.0.2
280
- *
281
  * @param $twitter_handle
282
  * @param $api_key
283
  * @param $secret_key
284
  *
 
 
285
  * @return mixed|void
286
  */
287
- function get_twitter_followers( $twitter_handle, $api_key, $secret_key, $show_count ) {
288
- // some variables
289
  $consumerKey = $api_key;
290
  $consumerSecret = $secret_key;
291
  $token = get_option( 'ssb_follow_twitter_token' );
@@ -295,13 +292,13 @@ class Ssb_Follower_Widget extends WP_Widget {
295
 
296
  if ( $show_count ) {
297
 
298
- if( '' == $twitter_handle ){
299
  return 0;
300
  }
301
- // cache version does not exist or expired
302
  if ( false == get_transient( 'ssb_follow_twitter_counter' ) ) {
303
 
304
- // getting new auth bearer only if we don't have one
305
  if ( ! $token ) {
306
  // preparing credentials
307
  $credentials = $consumerKey . ':' . $consumerSecret;
@@ -340,8 +337,8 @@ class Ssb_Follower_Widget extends WP_Widget {
340
  );
341
 
342
  add_filter( 'https_ssl_verify', '__return_false' );
343
- $api_url = "https://api.twitter.com/1.1/users/show.json?screen_name=$twitter_handle";
344
- $response = wp_remote_get( $api_url, $args );
345
  if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
346
  return 0;
347
  }
@@ -363,38 +360,40 @@ class Ssb_Follower_Widget extends WP_Widget {
363
  }
364
 
365
  /**
366
- * passing youtube channel id and access token return the channel subscriber counter
367
- * @since 2.0.2
368
  *
369
  * @param $channel_id
370
  * @param $access_token
371
  *
 
 
372
  * @return int
373
  */
374
- function get_youtube_subscriber( $channel_id, $show_counter, $youtube_type ) {
375
 
376
  if ( $show_counter ) {
377
 
378
- if( '' == $channel_id ){
379
  return 0;
380
  }
 
381
  if ( false === get_transient( 'ssb_follow_youtube_counter' ) ) {
382
 
383
  // Check if username of channel id.
384
- $_type = $youtube_type == 'username' ? 'forUsername' : 'id';
385
-
386
- $json_feed_url = 'https://www.googleapis.com/youtube/v3/channels?key=' . $this->api_key . '&part=contentDetails,statistics&'. $_type . '=' . $channel_id;
387
- $args = array(
388
- 'httpversion' => '1.1',
389
- 'timeout' => 15
390
- );
391
  $json_feed = wp_remote_get( $json_feed_url, $args );
392
  if ( is_wp_error( $json_feed ) || 200 !== wp_remote_retrieve_response_code( $json_feed ) ) {
393
  return 0;
394
  }
395
  $result = json_decode( wp_remote_retrieve_body( $json_feed ) );
396
- $counter = isset( $result->items[0]->statistics->subscriberCount ) ? $result->items[0]->statistics->subscriberCount : 0;
397
- $counter = $this->format_number( $counter );
398
 
399
  if ( ! empty( $counter ) ) {
400
 
@@ -411,34 +410,27 @@ class Ssb_Follower_Widget extends WP_Widget {
411
  }
412
 
413
  /**
414
- * passing pinterest access_token for getting pinterest follower counter
415
- * @since 2.0.2
416
  * @param $access_token
417
  * @param $show_counter
418
  *
 
 
419
  * @return int|string
420
  */
421
- function get_pinterest_followers( $pinterest_id, $show_counter ) {
422
 
423
  if ( $show_counter ) {
424
- if( '' == $pinterest_id ){
425
  return 0;
426
  }
427
 
428
  if ( false === get_transient( 'ssb_follow_pinterest_counter' ) ) {
429
- $json_feed_url = 'https://www.pinterest.com/' . $pinterest_id;
430
- $args = array(
431
- 'httpversion' => '1.1',
432
- 'timeout' => 60
433
- );
434
- $json_feed = wp_remote_get( $json_feed_url, $args );
435
- if ( is_wp_error( $json_feed ) || 200 !== wp_remote_retrieve_response_code( $json_feed ) ) {
436
- return 0;
437
- }
438
- $result = array();
439
- $regex = '/property\=\"pinterestapp:followers\" name\=\"pinterestapp:followers\" content\=\"(.*?)" data-app/';
440
- preg_match( $regex, wp_remote_retrieve_body( $json_feed ), $tags );
441
- $counter = isset( $tags[1] ) ? intval( $tags[1] ) : 0;;
442
  $counter = $this->format_number( $counter );
443
  if ( ! empty( $counter ) ) {
444
 
@@ -455,27 +447,30 @@ class Ssb_Follower_Widget extends WP_Widget {
455
  }
456
 
457
  /**
458
- * Passing instagram access token for getting instagram follower
459
- * @since 2.0.10
460
- * @param $instagram_id
461
- * @param $show_counter
462
- *
463
- * @return int|string( insta follower )
464
- */
465
- function get_instagram_id_followers( $access_token, $show_counter ){
 
 
466
 
467
  if ( $show_counter ) {
468
- if( '' == $access_token ){
469
  return 0;
470
  }
471
 
472
  if ( false === get_transient( 'ssb_follow_instagram_counter' ) ) {
473
- $json_feed_url = "https://api.instagram.com/v1/users/self/?access_token=". $access_token;
474
 
475
- $args = array(
476
  'httpversion' => '1.1',
477
- 'sslverify' => false,
478
- 'timeout' => 60 );
 
479
  $json_feed = wp_remote_get( $json_feed_url, $args );
480
 
481
  if ( is_wp_error( $json_feed ) || 200 !== wp_remote_retrieve_response_code( $json_feed ) ) {
@@ -483,9 +478,9 @@ class Ssb_Follower_Widget extends WP_Widget {
483
  }
484
 
485
  $result = json_decode( wp_remote_retrieve_body( $json_feed ), true );
486
- $counter = isset($result['data']['counts']['followed_by']) ? $result['data']['counts']['followed_by'] : 0;
487
  $counter = $this->format_number( $counter );
488
-
489
  if ( ! empty( $counter ) ) {
490
  set_transient( 'ssb_follow_instagram_counter', $counter, $this->cache_time );
491
  }
@@ -499,17 +494,19 @@ class Ssb_Follower_Widget extends WP_Widget {
499
 
500
  /**
501
  * Format the (int)number into easy readable format like 1K, 1M
502
- * @since 2.0.2
503
  *
504
  * @param $value
 
505
  *
 
 
506
  * @return string
507
  */
508
- function format_number( $value ) {
509
  if ( $value > 999 && $value <= 999999 ) {
510
- return $result = floor( $value / 1000 ) . 'K';
511
  } elseif ( $value > 999999 ) {
512
- return $result = floor( $value / 1000000 ) . ' M';
513
  } else {
514
  return $result = $value;
515
  }
3
  /**
4
  * Widget class for social share follower widget
5
  *
6
+ * @sicne 2.0.5
7
  *
8
  * Class Ssb_Follower_Widget
9
  */
10
  class Ssb_Follower_Widget extends WP_Widget {
11
 
 
 
 
 
 
 
12
  /**
13
  * Transient Time
14
  *
19
  /**
20
  * Register ssb widget with WordPress.
21
  *
22
+ * @since 2.0.5
23
  */
24
  function __construct() {
25
  $widget_ops = array(
32
  /**
33
  * Front-end display of widget.
34
  *
 
 
35
  * @param array $args Widget arguments.
36
  * @param array $instance Saved values from database.
37
+
38
+ * @see WP_Widget::widget()
39
+ * @access public
40
+ * @since 2.0.5
41
  */
42
+ public function widget( $args, $instance ) {
43
  extract( $args );
44
  $display = '1';
45
 
46
+ $widget_title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance );
47
+
48
+ $show_facebook = $instance['show_facebook'];
49
+ $show_twitter = $instance['show_twitter'];
50
+ $show_google_plus = $instance['show_google_plus'];
51
+ $show_youtube = $instance['show_youtube'];
52
+ $show_pinterest = $instance['show_pinterest'];
53
+ $show_instagram = $instance['show_instagram'];
54
+ $show_whatsapp = $instance['show_whatsapp'];
55
+
56
+ $facebook_id = $instance['facebook_id'];
57
+ $facebook_show_counter = $instance['facebook_show_counter'];
58
+ $facebook_text = $instance['facebook_text'];
59
+ $facebook_access_token = $instance['facebook_access_token'];
60
+
61
+ $twitter_id = $instance['twitter'];
62
+ $twitter_show_counter = $instance['twitter_show_counter'];
63
+ $twitter_text = $instance['twitter_text'];
64
+ $twitter_api_key = $instance['twitter_api_key'];
65
+ $twitter_secret_key = $instance['twitter_secret_key'];
66
+
67
+ $youtube_id = $instance['youtube'];
68
+ $youtube_show_counter = $instance['youtube_show_counter'];
69
+ $youtube_text = $instance['youtube_text'];
70
+ $youtube_type = $instance['youtube_type'];
71
+ $youtube_api_key = $instance['youtube_api_key'];
72
 
73
  $pinterest_id = $instance['pinterest'];
74
  $pinterest_show_counter = $instance['pinterest_show_counter'];
76
  $pinterest_text = $instance['pinterest_text'];
77
 
78
  $instagram_id = $instance['instagram'];
79
+ $instagram_show_counter = $instance['instagram_show_counter'];
80
+ $instagram_text = $instance['instagram_text'];
81
+ $instagram_access_token = $instance['instagram_access_token'];
82
 
83
+ $whatsapp = $instance['whatsapp'];
84
+ $whatsapp_text = $instance['whatsapp_text'];
85
 
86
+ $fb_likes = $this->get_facebook_likes_count( $facebook_id, $facebook_access_token, $facebook_show_counter );
87
+ $twitter_follower = $this->get_twitter_followers( $twitter_id, $twitter_api_key, $twitter_secret_key, $twitter_show_counter );
88
+ $youtube_subscriber = $this->get_youtube_subscriber( $youtube_id, $youtube_api_key, $youtube_show_counter, $youtube_type );
89
+ $pinterest_follower = $this->get_pinterest_followers( $pinterest_id, $pinterest_show_counter );
90
+ $instagram_follower = $this->get_instagram_id_followers( $instagram_access_token, $instagram_show_counter );
91
 
92
  include SSB_PLUGIN_DIR . '/inc/ssb-widget-front.php';
93
  }
95
  /**
96
  * Back-end widget form.
97
  *
98
+ * @param array $instance Previously saved values from database.
99
  * @see WP_Widget::form()
100
  *
101
+ * @access public
102
+ * @since 2.0.5
103
+ * @return mixed
104
  */
105
  public function form( $instance ) {
106
  $display = '1';
107
 
108
+ // first time run when instance create
109
  if ( 0 == count( $instance ) ) {
110
  $instance['facebook_text'] = __( 'Follow us on Facebook', 'simple-social-buttons' );
111
  $instance['youtube_text'] = __( 'Subscribe us on Youtube', 'simple-social-buttons' );
112
  $instance['twitter_text'] = __( 'Follow us on Twitter', 'simple-social-buttons' );
113
+ $instance['pinterest_text'] = __( 'Follow us on Pinterest', 'simple-social-buttons' );
114
  $instance['instagram_text'] = __( 'Follow us on Instagram', 'simple-social-buttons' );
115
  $instance['whatsapp_text'] = __( 'Contact us on WhatsApp', 'simple-social-buttons' );
116
 
117
  }
118
 
 
119
  $title = isset( $instance['title'] ) ? $instance['title'] : esc_html__( 'Follow Us', 'simple-social-buttons' );
120
 
121
  $show_facebook = ! empty( $instance['show_facebook'] ) ? $instance['show_facebook'] : '';
124
  $show_youtube = ! empty( $instance['show_youtube'] ) ? $instance['show_youtube'] : '';
125
  $show_pinterest = ! empty( $instance['show_pinterest'] ) ? $instance['show_pinterest'] : '';
126
  $show_instagram = ! empty( $instance['show_instagram'] ) ? $instance['show_instagram'] : '';
127
+ $show_whatsapp = ! empty( $instance['show_whatsapp'] ) ? $instance['show_whatsapp'] : '';
128
 
129
  $facebook_id = ! empty( $instance['facebook_id'] ) ? $instance['facebook_id'] : '';
130
  $facebook_show_counter = ! empty( $instance['facebook_show_counter'] ) ? $instance['facebook_show_counter'] : '';
143
  $youtube_text = ! empty( $instance['youtube_text'] ) ? $instance['youtube_text'] : '';
144
  $youtube_type = ! empty( $instance['youtube_type'] ) ? $instance['youtube_type'] : '';
145
  $youtube_show_counter = ! empty( $instance['youtube_show_counter'] ) ? $instance['youtube_show_counter'] : '';
146
+ $youtube_api_key = ! empty( $instance['youtube_api_key'] ) ? $instance['youtube_api_key'] : '';
147
 
148
  $pinterest = ! empty( $instance['pinterest'] ) ? $instance['pinterest'] : '';
149
  $pinterest_text = ! empty( $instance['pinterest_text'] ) ? $instance['pinterest_text'] : '';
156
  $instagram_show_counter = ! empty( $instance['instagram_show_counter'] ) ? $instance['instagram_show_counter'] : '';
157
  $instagram_access_token = ! empty( $instance['instagram_access_token'] ) ? $instance['instagram_access_token'] : '';
158
 
159
+ // whats app mobile number will store in $whatsapp
160
+ $whatsapp = ! empty( $instance['whatsapp'] ) ? $instance['whatsapp'] : '';
161
+ $whatsapp_text = ! empty( $instance['whatsapp_text'] ) ? $instance['whatsapp_text'] : '';
 
162
 
163
  include SSB_PLUGIN_DIR . '/inc/ssb-widget-fields.php';
164
 
167
  /**
168
  * Sanitize widget form values as they are saved.
169
  *
 
 
170
  * @param array $new_instance Values just sent to be saved.
171
  * @param array $old_instance Previously saved values from database.
172
+ * @see WP_Widget::update()
173
+ * @access public
174
+ * @since 2.0.5
175
  * @return array Updated safe values to be saved.
176
  */
177
  public function update( $new_instance, $old_instance ) {
183
  delete_transient( 'ssb_follow_pinterest_counter' );
184
  delete_transient( 'ssb_follow_instagram_counter' );
185
 
 
 
 
186
  $instance = array();
187
  $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
188
 
211
  $instance['youtube_show_counter'] = ( ! empty( $new_instance['youtube_show_counter'] ) ) ? strip_tags( $new_instance['youtube_show_counter'] ) : '0';
212
  $instance['youtube_text'] = sanitize_text_field( wp_unslash( $new_instance['youtube_text'] ) );
213
  $instance['youtube_type'] = sanitize_text_field( wp_unslash( $new_instance['youtube_type'] ) );
214
+ $instance['youtube_api_key'] = sanitize_text_field( wp_unslash( $new_instance['youtube_api_key'] ) );
215
 
216
  $instance['pinterest'] = sanitize_text_field( wp_unslash( $new_instance['pinterest'] ) );
217
  $instance['pinterest_show_counter'] = ( ! empty( $new_instance['pinterest_show_counter'] ) ) ? strip_tags( $new_instance['pinterest_show_counter'] ) : '0';
221
  $instance['instagram'] = sanitize_text_field( wp_unslash( $new_instance['instagram'] ) );
222
  $instance['instagram_show_counter'] = ( ! empty( $new_instance['instagram_show_counter'] ) ) ? strip_tags( $new_instance['instagram_show_counter'] ) : '0';
223
  $instance['instagram_text'] = sanitize_text_field( wp_unslash( $new_instance['instagram_text'] ) );
224
+ $instance['instagram_access_token'] = sanitize_text_field( wp_unslash( $new_instance['instagram_access_token'] ) );
225
 
226
+ $instance['whatsapp'] = sanitize_text_field( wp_unslash( $new_instance['whatsapp'] ) );
227
+ $instance['whatsapp_text'] = sanitize_text_field( wp_unslash( $new_instance['whatsapp_text'] ) );
228
 
229
  return $instance;
230
  }
231
 
232
  /**
233
+ * passing facebook and access token return facebook like counter.
 
 
234
  *
235
  * @param $facebook_id
236
  * @param $access_token
237
  *
238
+ * @access public
239
+ * @since 2.0.5
240
  * @return int
241
  */
242
+ public function get_facebook_likes_count( $facebook_id, $access_token, $show_counter ) {
243
 
244
  if ( $show_counter ) {
245
+ if ( '' == $facebook_id ) {
246
  return 0;
247
  }
248
 
256
  return 0;
257
  }
258
  $result = json_decode( wp_remote_retrieve_body( $json_feed ) );
259
+ $counter = ( isset( $result->fan_count ) ? $result->fan_count : 0 );
260
+ $counter = $this->format_number( $counter );
261
 
262
  if ( ! empty( $counter ) ) {
263
  set_transient( 'ssb_follow_facebook_counter', $counter, $this->cache_time );
273
  /**
274
  * Pass twitter user name and api key return twitter follower
275
  *
 
 
276
  * @param $twitter_handle
277
  * @param $api_key
278
  * @param $secret_key
279
  *
280
+ * @access public
281
+ * @since 2.0.5
282
  * @return mixed|void
283
  */
284
+ public function get_twitter_followers( $twitter_handle, $api_key, $secret_key, $show_count ) {
285
+ // some variables.
286
  $consumerKey = $api_key;
287
  $consumerSecret = $secret_key;
288
  $token = get_option( 'ssb_follow_twitter_token' );
292
 
293
  if ( $show_count ) {
294
 
295
+ if ( '' == $twitter_handle ) {
296
  return 0;
297
  }
298
+ // cache version does not exist or expired.
299
  if ( false == get_transient( 'ssb_follow_twitter_counter' ) ) {
300
 
301
+ // getting new auth bearer only if we don't have one.
302
  if ( ! $token ) {
303
  // preparing credentials
304
  $credentials = $consumerKey . ':' . $consumerSecret;
337
  );
338
 
339
  add_filter( 'https_ssl_verify', '__return_false' );
340
+ $api_url = "https://api.twitter.com/1.1/users/show.json?screen_name=$twitter_handle";
341
+ $response = wp_remote_get( $api_url, $args );
342
  if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
343
  return 0;
344
  }
360
  }
361
 
362
  /**
363
+ * Passing youtube channel id and access token return the channel subscriber counter.
 
364
  *
365
  * @param $channel_id
366
  * @param $access_token
367
  *
368
+ * @access public
369
+ * @since 2.0.5
370
  * @return int
371
  */
372
+ public function get_youtube_subscriber( $channel_id, $api_key, $show_counter, $youtube_type ) {
373
 
374
  if ( $show_counter ) {
375
 
376
+ if ( '' == $channel_id ) {
377
  return 0;
378
  }
379
+
380
  if ( false === get_transient( 'ssb_follow_youtube_counter' ) ) {
381
 
382
  // Check if username of channel id.
383
+ $_type = $youtube_type == 'user' ? 'forUsername' : 'id';
384
+ // Youtube Data APi V3.
385
+ $json_feed_url = 'https://www.googleapis.com/youtube/v3/channels?key=' . $api_key . '&part=contentDetails,statistics&' . $_type . '=' . $channel_id;
386
+ $args = array(
387
+ 'httpversion' => '1.1',
388
+ 'timeout' => 15,
389
+ );
390
  $json_feed = wp_remote_get( $json_feed_url, $args );
391
  if ( is_wp_error( $json_feed ) || 200 !== wp_remote_retrieve_response_code( $json_feed ) ) {
392
  return 0;
393
  }
394
  $result = json_decode( wp_remote_retrieve_body( $json_feed ) );
395
+ $counter = isset( $result->items[0]->statistics->subscriberCount ) ? $result->items[0]->statistics->subscriberCount : 0;
396
+ $counter = $this->format_number( $counter );
397
 
398
  if ( ! empty( $counter ) ) {
399
 
410
  }
411
 
412
  /**
413
+ * Passing pinterest access_token for getting pinterest follower counter
414
+ *
415
  * @param $access_token
416
  * @param $show_counter
417
  *
418
+ * @access public
419
+ * @since 2.0.5
420
  * @return int|string
421
  */
422
+ public function get_pinterest_followers( $pinterest_id, $show_counter ) {
423
 
424
  if ( $show_counter ) {
425
+ if ( '' == $pinterest_id ) {
426
  return 0;
427
  }
428
 
429
  if ( false === get_transient( 'ssb_follow_pinterest_counter' ) ) {
430
+
431
+ $metas = get_meta_tags( "http://pinterest.com/$pinterest_id/" );
432
+
433
+ $counter = isset( $metas['pinterestapp:followers'] ) ? intval( $metas['pinterestapp:followers'] ) : 0;
 
 
 
 
 
 
 
 
 
434
  $counter = $this->format_number( $counter );
435
  if ( ! empty( $counter ) ) {
436
 
447
  }
448
 
449
  /**
450
+ * Passing instagram access token for getting instagram follower
451
+ *
452
+ * @param $instagram_id
453
+ * @param $show_counter
454
+ *
455
+ * @access public
456
+ * @since 2.0.10
457
+ * @return int|string( insta follower )
458
+ */
459
+ public function get_instagram_id_followers( $access_token, $show_counter ) {
460
 
461
  if ( $show_counter ) {
462
+ if ( '' == $access_token ) {
463
  return 0;
464
  }
465
 
466
  if ( false === get_transient( 'ssb_follow_instagram_counter' ) ) {
467
+ $json_feed_url = 'https://api.instagram.com/v1/users/self/?access_token=' . $access_token;
468
 
469
+ $args = array(
470
  'httpversion' => '1.1',
471
+ 'sslverify' => false,
472
+ 'timeout' => 60,
473
+ );
474
  $json_feed = wp_remote_get( $json_feed_url, $args );
475
 
476
  if ( is_wp_error( $json_feed ) || 200 !== wp_remote_retrieve_response_code( $json_feed ) ) {
478
  }
479
 
480
  $result = json_decode( wp_remote_retrieve_body( $json_feed ), true );
481
+ $counter = isset( $result['data']['counts']['followed_by'] ) ? $result['data']['counts']['followed_by'] : 0;
482
  $counter = $this->format_number( $counter );
483
+
484
  if ( ! empty( $counter ) ) {
485
  set_transient( 'ssb_follow_instagram_counter', $counter, $this->cache_time );
486
  }
494
 
495
  /**
496
  * Format the (int)number into easy readable format like 1K, 1M
 
497
  *
498
  * @param $value
499
+ * @param $value
500
  *
501
+ * @access public
502
+ * @since 2.0.5
503
  * @return string
504
  */
505
+ public function format_number( $value ) {
506
  if ( $value > 999 && $value <= 999999 ) {
507
+ return $result = floor( $value / 1000 ) . 'k+';
508
  } elseif ( $value > 999999 ) {
509
+ return $result = floor( $value / 1000000 ) . 'm+';
510
  } else {
511
  return $result = $value;
512
  }
inc/custom-css.php CHANGED
@@ -1,100 +1,100 @@
1
  <style media="screen">
2
 
3
- <?php if ( isset( $this->selected_position['inline'] ) && isset( $this->inline_option['icon_space'] ) ): ?>
4
- .simplesocialbuttons.simplesocialbuttons_inline .ssb-fb-like {
5
- margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
6
- }
7
- <?php endif ?>
8
- /*inline margin*/
9
- <?php if ( 'sm-round' == $this->selected_theme && isset( $this->selected_position['inline'] ) ): ?>
10
- .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-sm-round button{
11
- margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
12
- }
13
- <?php endif ?>
14
-
15
- <?php if ( 'simple-round' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
16
- .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-simple-round button{
17
- margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
18
- }
19
- <?php endif ?>
20
-
21
- <?php if ( 'round-txt' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
22
- .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-round-txt button{
23
- margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
24
- }
25
- <?php endif ?>
26
-
27
- <?php if ( 'round-btm-border' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
28
- .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-round-btm-border button{
29
- margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
30
- }
31
- <?php endif ?>
32
-
33
- <?php if ( 'flat-button-border' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
34
- .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-flat-button-border button{
35
- margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
36
- }
37
- <?php endif ?>
38
-
39
- <?php if ( 'round-icon' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
40
- .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-round-icon button{
41
- margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
42
- }
43
-
44
- <?php endif ?>
45
-
46
- <?php if ( 'simple-icons' == $this->selected_theme && isset( $this->selected_position['inline'] ) && isset( $this->inline_option['icon_space'] ) ) : ?>
47
- .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-simple-icons button{
48
- margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
49
- }
50
-
51
- <?php endif ?>
52
- /*margin-digbar*/
53
-
54
- <?php if ( 'sm-round' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
55
- div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-sm-round button{
56
- margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
57
- }
58
- <?php endif ?>
59
-
60
- <?php if ( 'simple-round' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
61
- div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-round button{
62
- margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
63
- }
64
- <?php endif ?>
65
-
66
- <?php if ( 'round-txt' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
67
  div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-round-txt button{
68
- margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
69
  }
70
- <?php endif ?>
71
 
72
- <?php if ( 'round-btm-border' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
73
- div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-round-btm-border button{
74
- margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
75
- }
76
- <?php endif ?>
77
 
78
- <?php if ( 'round-icon' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
79
  div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-round-icon button{
80
- margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
81
  }
82
- <?php endif ?>
83
 
84
- <?php if ( 'simple-icons' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
85
  div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-icons button{
86
- margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
87
  }
88
  div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-icons .ssb-fb-like{
89
- margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
90
  }
91
- <?php endif ?>
92
 
93
- <?php if ( isset( $this->selected_position['sidebar'] ) && $this->sidebar_option['icon_space'] == '1' ) : ?>
94
  div[class*="simplesocialbuttons-float"].simplesocialbuttons .ssb-fb-like{
95
- margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
96
  }
97
- <?php endif ?>
98
 
99
 
100
  </style>
1
  <style media="screen">
2
 
3
+ <?php if ( isset( $this->selected_position['inline'] ) && isset( $this->inline_option['icon_space'] ) ) : ?>
4
+ .simplesocialbuttons.simplesocialbuttons_inline .ssb-fb-like {
5
+ margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
6
+ }
7
+ <?php endif ?>
8
+ /*inline margin*/
9
+ <?php if ( 'sm-round' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
10
+ .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-sm-round button{
11
+ margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
12
+ }
13
+ <?php endif ?>
14
+
15
+ <?php if ( 'simple-round' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
16
+ .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-simple-round button{
17
+ margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
18
+ }
19
+ <?php endif ?>
20
+
21
+ <?php if ( 'round-txt' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
22
+ .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-round-txt button{
23
+ margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
24
+ }
25
+ <?php endif ?>
26
+
27
+ <?php if ( 'round-btm-border' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
28
+ .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-round-btm-border button{
29
+ margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
30
+ }
31
+ <?php endif ?>
32
+
33
+ <?php if ( 'flat-button-border' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
34
+ .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-flat-button-border button{
35
+ margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
36
+ }
37
+ <?php endif ?>
38
+
39
+ <?php if ( 'round-icon' == $this->selected_theme && isset( $this->selected_position['inline'] ) ) : ?>
40
+ .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-round-icon button{
41
+ margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
42
+ }
43
+
44
+ <?php endif ?>
45
+
46
+ <?php if ( 'simple-icons' == $this->selected_theme && isset( $this->selected_position['inline'] ) && isset( $this->inline_option['icon_space'] ) ) : ?>
47
+ .simplesocialbuttons.simplesocialbuttons_inline.simplesocial-simple-icons button{
48
+ margin: <?php echo $this->inline_option['icon_space'] == '1' && $this->inline_option['icon_space_value'] != '' ? $this->inline_option['icon_space_value'] . 'px' : ''; ?>;
49
+ }
50
+
51
+ <?php endif ?>
52
+ /*margin-digbar*/
53
+
54
+ <?php if ( 'sm-round' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
55
+ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-sm-round button{
56
+ margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
57
+ }
58
+ <?php endif ?>
59
+
60
+ <?php if ( 'simple-round' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
61
+ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-round button{
62
+ margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
63
+ }
64
+ <?php endif ?>
65
+
66
+ <?php if ( 'round-txt' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
67
  div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-round-txt button{
68
+ margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
69
  }
70
+ <?php endif ?>
71
 
72
+ <?php if ( 'round-btm-border' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
73
+ div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-round-btm-border button{
74
+ margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
75
+ }
76
+ <?php endif ?>
77
 
78
+ <?php if ( 'round-icon' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
79
  div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-round-icon button{
80
+ margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
81
  }
82
+ <?php endif ?>
83
 
84
+ <?php if ( 'simple-icons' == $this->selected_theme && isset( $this->selected_position['sidebar'] ) ) : ?>
85
  div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-icons button{
86
+ margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
87
  }
88
  div[class*="simplesocialbuttons-float"].simplesocialbuttons.simplesocial-simple-icons .ssb-fb-like{
89
+ margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
90
  }
91
+ <?php endif ?>
92
 
93
+ <?php if ( isset( $this->selected_position['sidebar'] ) && $this->sidebar_option['icon_space'] == '1' ) : ?>
94
  div[class*="simplesocialbuttons-float"].simplesocialbuttons .ssb-fb-like{
95
+ margin: <?php echo $this->sidebar_option['icon_space'] == '1' && $this->sidebar_option['icon_space_value'] != '' ? $this->sidebar_option['icon_space_value'] . 'px 0' : ''; ?>;
96
  }
97
+ <?php endif ?>
98
 
99
 
100
  </style>
inc/ssb-deactivate-form.php CHANGED
@@ -79,91 +79,91 @@
79
 
80
  <div class="wp-ssb-popup-overlay">
81
  <div class="wp-ssb-serveypanel">
82
- <form action="#" method="post" id="wp-ssb-deactivate-form">
83
- <div class="wp-ssb-popup-header">
84
- <h2><?php _e( 'Quick feedback about Simple Social Buttons', 'wp-ssb' ); ?></h2>
85
- </div>
86
- <div class="wp-ssb-popup-body">
87
- <h3><?php _e( 'If you have a moment, please let us know why you are deactivating:', 'wp-ssb' ); ?></h3>
88
- <ul id="wp-ssb-reason-list">
89
- <li class="wp-ssb-reason" data-input-type="" data-input-placeholder="">
90
- <label>
91
- <span>
92
- <input type="radio" name="wp-ssb-selected-reason" value="1">
93
- </span>
94
- <span><?php _e( 'I only needed the plugin for a short period', 'wp-ssb' ); ?></span>
95
- </label>
96
- <div class="wp-ssb-internal-message"></div>
97
- </li>
98
- <li class="wp-ssb-reason has-input" data-input-type="textfield">
99
- <label>
100
- <span>
101
- <input type="radio" name="wp-ssb-selected-reason" value="2">
102
- </span>
103
- <span><?php _e( 'I found a better plugin', 'wp-ssb' ); ?></span>
104
- </label>
105
- <div class="wp-ssb-internal-message"></div>
106
- <div class="wp-ssb-reason-input"><span class="message error-message"><?php _e( 'Kindly tell us the name of plugin', 'wp-ssb' ); ?></span><input type="text" name="better_plugin" placeholder="What's the plugin's name?"></div>
107
- </li>
108
- <li class="wp-ssb-reason" data-input-type="" data-input-placeholder="">
109
- <label>
110
- <span>
111
- <input type="radio" name="wp-ssb-selected-reason" value="3">
112
- </span>
113
- <span><?php _e( 'The plugin broke my site', 'wp-ssb' ); ?></span>
114
- </label>
115
- <div class="wp-ssb-internal-message"></div>
116
- </li>
117
- <li class="wp-ssb-reason" data-input-type="" data-input-placeholder="">
118
- <label>
119
- <span>
120
- <input type="radio" name="wp-ssb-selected-reason" value="4">
121
- </span>
122
- <span><?php _e( 'The plugin suddenly stopped working', 'wp-ssb' ); ?></span>
123
- </label>
124
- <div class="wp-ssb-internal-message"></div>
125
- </li>
126
- <li class="wp-ssb-reason" data-input-type="" data-input-placeholder="">
127
- <label>
128
- <span>
129
- <input type="radio" name="wp-ssb-selected-reason" value="5">
130
- </span>
131
- <span><?php _e( 'I no longer need the plugin', 'wp-ssb' ); ?></span>
132
- </label>
133
- <div class="wp-ssb-internal-message"></div>
134
- </li>
135
- <li class="wp-ssb-reason" data-input-type="" data-input-placeholder="">
136
- <label>
137
- <span>
138
- <input type="radio" name="wp-ssb-selected-reason" value="6">
139
- </span>
140
- <span><?php _e( "It's a temporary deactivation. I'm just debugging an issue.", 'wp-ssb' ); ?></span>
141
- </label>
142
- <div class="wp-ssb-internal-message"></div>
143
- </li>
144
- <li class="wp-ssb-reason has-input" data-input-type="textfield" >
145
- <label>
146
- <span>
147
- <input type="radio" name="wp-ssb-selected-reason" value="7">
148
- </span>
149
- <span><?php _e( 'Other', 'wp-ssb' ); ?></span>
150
- </label>
151
- <div class="wp-ssb-internal-message"></div>
152
- <div class="wp-ssb-reason-input"><span class="message error-message "><?php _e( 'Kindly tell us the reason so we can improve.', 'wp-ssb' ); ?></span><input type="text" name="other_reason" placeholder="Would you like to share what's other reason ?"></div>
153
- </li>
154
- </ul>
155
- </div>
156
- <div class="wp-ssb-popup-footer">
157
- <label class="wp-ssb-anonymous"><input type="checkbox" /><?php _e( 'Anonymous feedback', 'wp-ssb' ); ?></label>
158
- <input type="button" class="button button-secondary button-skip wp-ssb-popup-skip-feedback" value="Skip &amp; Deactivate" >
159
- <div class="action-btns">
160
- <span class="wp-ssb-spinner"><img src="<?php echo admin_url( '/images/spinner.gif' ); ?>" alt=""></span>
161
- <input type="submit" class="button button-secondary button-deactivate wp-ssb-popup-allow-deactivate" value="Submit &amp; Deactivate" disabled="disabled">
162
- <a href="#" class="button button-primary wp-ssb-popup-button-close"><?php _e( 'Cancel', 'wp-ssb' ); ?></a>
163
 
164
- </div>
165
- </div>
166
- </form>
167
  </div>
168
  </div>
169
 
@@ -173,83 +173,83 @@
173
 
174
  $(function() {
175
 
176
- var pluginSlug = 'simple-social-buttons';
177
- // Code to fire when the DOM is ready.
178
 
179
- $(document).on('click', 'tr[data-slug="' + pluginSlug + '"] .deactivate', function(e){
180
- e.preventDefault();
181
 
182
- $('.wp-ssb-popup-overlay').addClass('wp-ssb-active');
183
- $('body').addClass('wp-ssb-hidden');
184
- });
185
- $(document).on('click', '.wp-ssb-popup-button-close', function () {
186
- close_popup();
187
- });
188
- $(document).on('click', ".wp-ssb-serveypanel,tr[data-slug='" + pluginSlug + "'] .deactivate",function(e){
189
- e.stopPropagation();
190
- });
191
 
192
- $(document).click(function(){
193
- close_popup();
194
- });
195
- $('.wp-ssb-reason label').on('click', function(){
196
- if($(this).find('input[type="radio"]').is(':checked')){
197
- //$('.wp-ssb-anonymous').show();
198
- $(this).next().next('.wp-ssb-reason-input').show().end().end().parent().siblings().find('.wp-ssb-reason-input').hide();
199
- }
200
- });
201
- $('input[type="radio"][name="wp-ssb-selected-reason"]').on('click', function(event) {
202
- $(".wp-ssb-popup-allow-deactivate").removeAttr('disabled');
203
- });
204
- $(document).on('submit', '#wp-ssb-deactivate-form', function(event) {
205
- event.preventDefault();
206
 
207
- var _reason = $(this).find('input[type="radio"][name="wp-ssb-selected-reason"]:checked').val();
208
- var _reason_details = '';
209
- if ( _reason == 2 ) {
210
- _reason_details = $(this).find("input[type='text'][name='better_plugin']").val();
211
- } else if ( _reason == 7 ) {
212
- _reason_details = $(this).find("input[type='text'][name='other_reason']").val();
213
- }
214
 
215
- if ( ( _reason == 7 || _reason == 2 ) && _reason_details == '' ) {
216
- $('.message.error-message').show();
217
- return ;
218
- }
219
 
220
- $.ajax({
221
- url: ajaxurl,
222
- type: 'POST',
223
- data: {
224
- action : 'ssb_deactivate',
225
- reason : _reason,
226
- reason_detail : _reason_details,
227
- },
228
- beforeSend: function(){
229
- $(".wp-ssb-spinner").show();
230
- $(".wp-ssb-popup-allow-deactivate").attr("disabled", "disabled");
231
- }
232
- })
233
- .done(function() {
234
- // $(".wp-ssb-spinner").hide();
235
- // $(".wp-ssb-popup-allow-deactivate").removeAttr("disabled");
236
- window.location.href = $("tr[data-slug='"+ pluginSlug +"'] .deactivate a").attr('href');
237
- });
238
 
239
- });
240
 
241
- $('.wp-ssb-popup-skip-feedback').on('click', function(e){
242
- window.location.href = $("tr[data-slug='"+ pluginSlug +"'] .deactivate a").attr('href');
243
- })
244
 
245
- function close_popup() {
246
- $('.wp-ssb-popup-overlay').removeClass('wp-ssb-active');
247
- $('#wp-ssb-deactivate-form').trigger("reset");
248
- $(".wp-ssb-popup-allow-deactivate").attr('disabled', 'disabled');
249
- $(".wp-ssb-reason-input").hide();
250
- $('body').removeClass('wp-ssb-hidden');
251
- $('.message.error-message').hide();
252
- }
253
  });
254
 
255
  })( jQuery ); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code.
79
 
80
  <div class="wp-ssb-popup-overlay">
81
  <div class="wp-ssb-serveypanel">
82
+ <form action="#" method="post" id="wp-ssb-deactivate-form">
83
+ <div class="wp-ssb-popup-header">
84
+ <h2><?php _e( 'Quick feedback about Simple Social Buttons', 'wp-ssb' ); ?></h2>
85
+ </div>
86
+ <div class="wp-ssb-popup-body">
87
+ <h3><?php _e( 'If you have a moment, please let us know why you are deactivating:', 'wp-ssb' ); ?></h3>
88
+ <ul id="wp-ssb-reason-list">
89
+ <li class="wp-ssb-reason" data-input-type="" data-input-placeholder="">
90
+ <label>
91
+ <span>
92
+ <input type="radio" name="wp-ssb-selected-reason" value="1">
93
+ </span>
94
+ <span><?php _e( 'I only needed the plugin for a short period', 'wp-ssb' ); ?></span>
95
+ </label>
96
+ <div class="wp-ssb-internal-message"></div>
97
+ </li>
98
+ <li class="wp-ssb-reason has-input" data-input-type="textfield">
99
+ <label>
100
+ <span>
101
+ <input type="radio" name="wp-ssb-selected-reason" value="2">
102
+ </span>
103
+ <span><?php _e( 'I found a better plugin', 'wp-ssb' ); ?></span>
104
+ </label>
105
+ <div class="wp-ssb-internal-message"></div>
106
+ <div class="wp-ssb-reason-input"><span class="message error-message"><?php _e( 'Kindly tell us the name of plugin', 'wp-ssb' ); ?></span><input type="text" name="better_plugin" placeholder="What's the plugin's name?"></div>
107
+ </li>
108
+ <li class="wp-ssb-reason" data-input-type="" data-input-placeholder="">
109
+ <label>
110
+ <span>
111
+ <input type="radio" name="wp-ssb-selected-reason" value="3">
112
+ </span>
113
+ <span><?php _e( 'The plugin broke my site', 'wp-ssb' ); ?></span>
114
+ </label>
115
+ <div class="wp-ssb-internal-message"></div>
116
+ </li>
117
+ <li class="wp-ssb-reason" data-input-type="" data-input-placeholder="">
118
+ <label>
119
+ <span>
120
+ <input type="radio" name="wp-ssb-selected-reason" value="4">
121
+ </span>
122
+ <span><?php _e( 'The plugin suddenly stopped working', 'wp-ssb' ); ?></span>
123
+ </label>
124
+ <div class="wp-ssb-internal-message"></div>
125
+ </li>
126
+ <li class="wp-ssb-reason" data-input-type="" data-input-placeholder="">
127
+ <label>
128
+ <span>
129
+ <input type="radio" name="wp-ssb-selected-reason" value="5">
130
+ </span>
131
+ <span><?php _e( 'I no longer need the plugin', 'wp-ssb' ); ?></span>
132
+ </label>
133
+ <div class="wp-ssb-internal-message"></div>
134
+ </li>
135
+ <li class="wp-ssb-reason" data-input-type="" data-input-placeholder="">
136
+ <label>
137
+ <span>
138
+ <input type="radio" name="wp-ssb-selected-reason" value="6">
139
+ </span>
140
+ <span><?php _e( "It's a temporary deactivation. I'm just debugging an issue.", 'wp-ssb' ); ?></span>
141
+ </label>
142
+ <div class="wp-ssb-internal-message"></div>
143
+ </li>
144
+ <li class="wp-ssb-reason has-input" data-input-type="textfield" >
145
+ <label>
146
+ <span>
147
+ <input type="radio" name="wp-ssb-selected-reason" value="7">
148
+ </span>
149
+ <span><?php _e( 'Other', 'wp-ssb' ); ?></span>
150
+ </label>
151
+ <div class="wp-ssb-internal-message"></div>
152
+ <div class="wp-ssb-reason-input"><span class="message error-message "><?php _e( 'Kindly tell us the reason so we can improve.', 'wp-ssb' ); ?></span><input type="text" name="other_reason" placeholder="Would you like to share what's other reason ?"></div>
153
+ </li>
154
+ </ul>
155
+ </div>
156
+ <div class="wp-ssb-popup-footer">
157
+ <label class="wp-ssb-anonymous"><input type="checkbox" /><?php _e( 'Anonymous feedback', 'wp-ssb' ); ?></label>
158
+ <input type="button" class="button button-secondary button-skip wp-ssb-popup-skip-feedback" value="Skip &amp; Deactivate" >
159
+ <div class="action-btns">
160
+ <span class="wp-ssb-spinner"><img src="<?php echo admin_url( '/images/spinner.gif' ); ?>" alt=""></span>
161
+ <input type="submit" class="button button-secondary button-deactivate wp-ssb-popup-allow-deactivate" value="Submit &amp; Deactivate" disabled="disabled">
162
+ <a href="#" class="button button-primary wp-ssb-popup-button-close"><?php _e( 'Cancel', 'wp-ssb' ); ?></a>
163
 
164
+ </div>
165
+ </div>
166
+ </form>
167
  </div>
168
  </div>
169
 
173
 
174
  $(function() {
175
 
176
+ var pluginSlug = 'simple-social-buttons';
177
+ // Code to fire when the DOM is ready.
178
 
179
+ $(document).on('click', 'tr[data-slug="' + pluginSlug + '"] .deactivate', function(e){
180
+ e.preventDefault();
181
 
182
+ $('.wp-ssb-popup-overlay').addClass('wp-ssb-active');
183
+ $('body').addClass('wp-ssb-hidden');
184
+ });
185
+ $(document).on('click', '.wp-ssb-popup-button-close', function () {
186
+ close_popup();
187
+ });
188
+ $(document).on('click', ".wp-ssb-serveypanel,tr[data-slug='" + pluginSlug + "'] .deactivate",function(e){
189
+ e.stopPropagation();
190
+ });
191
 
192
+ $(document).click(function(){
193
+ close_popup();
194
+ });
195
+ $('.wp-ssb-reason label').on('click', function(){
196
+ if($(this).find('input[type="radio"]').is(':checked')){
197
+ //$('.wp-ssb-anonymous').show();
198
+ $(this).next().next('.wp-ssb-reason-input').show().end().end().parent().siblings().find('.wp-ssb-reason-input').hide();
199
+ }
200
+ });
201
+ $('input[type="radio"][name="wp-ssb-selected-reason"]').on('click', function(event) {
202
+ $(".wp-ssb-popup-allow-deactivate").removeAttr('disabled');
203
+ });
204
+ $(document).on('submit', '#wp-ssb-deactivate-form', function(event) {
205
+ event.preventDefault();
206
 
207
+ var _reason = $(this).find('input[type="radio"][name="wp-ssb-selected-reason"]:checked').val();
208
+ var _reason_details = '';
209
+ if ( _reason == 2 ) {
210
+ _reason_details = $(this).find("input[type='text'][name='better_plugin']").val();
211
+ } else if ( _reason == 7 ) {
212
+ _reason_details = $(this).find("input[type='text'][name='other_reason']").val();
213
+ }
214
 
215
+ if ( ( _reason == 7 || _reason == 2 ) && _reason_details == '' ) {
216
+ $('.message.error-message').show();
217
+ return ;
218
+ }
219
 
220
+ $.ajax({
221
+ url: ajaxurl,
222
+ type: 'POST',
223
+ data: {
224
+ action : 'ssb_deactivate',
225
+ reason : _reason,
226
+ reason_detail : _reason_details,
227
+ },
228
+ beforeSend: function(){
229
+ $(".wp-ssb-spinner").show();
230
+ $(".wp-ssb-popup-allow-deactivate").attr("disabled", "disabled");
231
+ }
232
+ })
233
+ .done(function() {
234
+ // $(".wp-ssb-spinner").hide();
235
+ // $(".wp-ssb-popup-allow-deactivate").removeAttr("disabled");
236
+ window.location.href = $("tr[data-slug='"+ pluginSlug +"'] .deactivate a").attr('href');
237
+ });
238
 
239
+ });
240
 
241
+ $('.wp-ssb-popup-skip-feedback').on('click', function(e){
242
+ window.location.href = $("tr[data-slug='"+ pluginSlug +"'] .deactivate a").attr('href');
243
+ })
244
 
245
+ function close_popup() {
246
+ $('.wp-ssb-popup-overlay').removeClass('wp-ssb-active');
247
+ $('#wp-ssb-deactivate-form').trigger("reset");
248
+ $(".wp-ssb-popup-allow-deactivate").attr('disabled', 'disabled');
249
+ $(".wp-ssb-reason-input").hide();
250
+ $('body').removeClass('wp-ssb-hidden');
251
+ $('.message.error-message').hide();
252
+ }
253
  });
254
 
255
  })( jQuery ); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code.
inc/ssb-import-export.php CHANGED
@@ -1,44 +1,44 @@
1
  <?php
2
  /**
3
- * SSB Import Export Page Content.
4
- *
5
- * @since 2.0.4
6
- */
7
  ?>
8
  <div class="ssb-import-export-page">
9
  <h2><?php esc_html_e( 'Import/Export Simple Social Share Buttons Settings', 'simple-social-buttons' ); ?></h2>
10
- <div class=""><?php esc_html_e( "Import/Export your Social share button Settings for/from other sites.", 'simple-social-buttons' ); ?></div>
11
  <table class="form-table">
12
- <tbody>
13
- <tr class="import_setting">
14
- <th scope="row">
15
- <label for="ssb_press_import"><?php esc_html_e( 'Import Settings:', 'simple-social-buttons' ); ?></label>
16
- </th>
17
- <td>
18
- <input type="file" name="ssb_press_import" id="ssb_press_import">
19
- <input type="button" class="button ssb-import" value="<?php esc_html_e( 'Import', 'simple-social-buttons' ); ?>" disabled="disabled">
20
- <span class="import-sniper">
21
- <img src="<?php echo admin_url( 'images/wpspin_light.gif' ); ?>">
22
- </span>
23
- <span class="import-text"><?php esc_html_e( 'Simple Social Buttons Share Settings Imported Successfully.', 'simple-social-buttons' ); ?></span>
24
- <span class="wrong-import"></span>
25
- <p class="description"><?php esc_html_e( 'Select a file and click on Import to start processing.', 'simple-social-buttons' ); ?></p>
26
- </td>
27
- </tr>
28
- <tr class="export_setting">
29
- <th scope="row">
30
- <label for="ssb_configure[export_setting]"><?php esc_html_e( 'Export Settings:', 'simple-social-buttons' ); ?></label>
31
- </th>
32
- <td>
33
- <input type="button" class="button ssb-export" value="<?php esc_html_e( 'Export', 'simple-social-buttons' ); ?>">
34
- <span class="export-sniper">
35
- <img src="<?php echo admin_url( 'images/wpspin_light.gif' ); ?>">
36
- </span>
37
- <span class="export-text"><?php esc_html_e( 'Simple Social Button Settings Exported Successfully!', 'simple-social-buttons' ); ?></span>
38
- <p class="description"><?php esc_html_e( 'Export Simple Social Button Settings.', 'simple-social-buttons' ) ?></p>
39
- </td>
40
- </tr>
41
- </tbody>
42
  </table>
43
  </div>
44
 
@@ -53,106 +53,106 @@
53
  // Remove Disabled attribute from Import Button.
54
  $( '#ssb_press_import' ).on( 'change', function( event ) {
55
 
56
- event.preventDefault();
57
 
58
- var ssbFileImp = $( '#ssb_press_import' ).val();
59
- var ssbpressFileExt = ssbFileImp.substr( ssbFileImp.lastIndexOf('.') + 1 );
60
 
61
- $( '.ssb-import' ).attr( "disabled", "disabled" );
62
 
63
- if ( 'json' == ssbpressFileExt ) {
64
- $(".import_setting .wrong-import").html("");
65
- $( '.ssb-import' ).removeAttr( "disabled" );
66
- } else {
67
- $(".import_setting .wrong-import").html("Invalid File.");
68
- }
69
  });
70
  $('.ssb-export').on('click', function(event) {
71
 
72
- event.preventDefault();
73
-
74
- var dateObj = new Date();
75
- var month = dateObj.getUTCMonth() + 1; //months from 1-12
76
- var day = dateObj.getUTCDate();
77
- var year = dateObj.getUTCFullYear();
78
- var newdate = year + "-" + month + "-" + day;
79
-
80
- $.ajax({
81
-
82
- url: ajaxurl,
83
- type: 'POST',
84
- data: {
85
- action : 'ssb_export',
86
- security : '<?php echo wp_create_nonce( 'ssb-export-security-check' )?>'
87
- },
88
- beforeSend: function() {
89
- $(".export_setting .export-sniper").show();
90
- },
91
- success: function( response ) {
92
-
93
- $(".export_setting .export-sniper").hide();
94
- $(".export_setting .export-text").show();
95
-
96
- if ( ! window.navigator.msSaveOrOpenBlob ) { // If msSaveOrOpenBlob() is supported, then so is msSaveBlob().
97
- $("<a />", {
98
- "download" : "ssb-export-"+newdate+".json",
99
- "href" : "data:application/json;charset=utf-8," + encodeURIComponent( response ),
100
- }).appendTo( "body" )
101
- .click(function() {
102
- $(this).remove()
103
- })[0].click()
104
- } else {
105
- var blobObject = new Blob( [response] );
106
- window.navigator.msSaveBlob( blobObject, "ssb-export-"+newdate+".json" );
107
- }
108
-
109
- setTimeout(function() {
110
- $(".export_setting .export-text").fadeOut()
111
- }, 3000 );
112
- }
113
- });
114
  });
115
 
116
  $('.ssb-import').on( 'click', function(event) {
117
- event.preventDefault();
118
-
119
- var file = $('#ssb_press_import');
120
- var fileObj = new FormData();
121
- var content = file[0].files[0];
122
-
123
- fileObj.append( 'file', content );
124
- fileObj.append( 'action', 'ssb_import' );
125
- fileObj.append( 'security', '<?php echo wp_create_nonce( 'ssb-import-security-check' )?>' );
126
-
127
- $.ajax({
128
-
129
- processData: false,
130
- contentType: false,
131
- url: ajaxurl,
132
- type: 'POST',
133
- data: fileObj, // file and action append into variable fileObj.
134
- beforeSend: function() {
135
- $(".import_setting .import-sniper").show();
136
- $(".import_setting .wrong-import").html("");
137
- $( '.ssb-import' ).attr( "disabled", "disabled" );
138
- },
139
- success: function(response) {
140
-
141
- $(".import_setting .import-sniper").hide();
142
- // $(".import_setting .import-text").fadeIn();
143
- if ( 'error' == response ) {
144
- $(".import_setting .wrong-import").html("JSON File is not Valid.");
145
- } else {
146
- $(".import_setting .import-text").show();
147
- setTimeout( function() {
148
- $(".import_setting .import-text").fadeOut();
149
- // $(".import_setting .wrong-import").html("");
150
- file.val('');
151
- }, 3000 );
152
- }
153
-
154
- }
155
- }); //!ajax.
156
  });
157
  })(jQuery); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code.
158
 
1
  <?php
2
  /**
3
+ * SSB Import Export Page Content.
4
+ *
5
+ * @since 2.0.4
6
+ */
7
  ?>
8
  <div class="ssb-import-export-page">
9
  <h2><?php esc_html_e( 'Import/Export Simple Social Share Buttons Settings', 'simple-social-buttons' ); ?></h2>
10
+ <div class=""><?php esc_html_e( 'Import/Export your Social share button Settings for/from other sites.', 'simple-social-buttons' ); ?></div>
11
  <table class="form-table">
12
+ <tbody>
13
+ <tr class="import_setting">
14
+ <th scope="row">
15
+ <label for="ssb_press_import"><?php esc_html_e( 'Import Settings:', 'simple-social-buttons' ); ?></label>
16
+ </th>
17
+ <td>
18
+ <input type="file" name="ssb_press_import" id="ssb_press_import">
19
+ <input type="button" class="button ssb-import" value="<?php esc_html_e( 'Import', 'simple-social-buttons' ); ?>" disabled="disabled">
20
+ <span class="import-sniper">
21
+ <img src="<?php echo admin_url( 'images/wpspin_light.gif' ); ?>">
22
+ </span>
23
+ <span class="import-text"><?php esc_html_e( 'Simple Social Buttons Share Settings Imported Successfully.', 'simple-social-buttons' ); ?></span>
24
+ <span class="wrong-import"></span>
25
+ <p class="description"><?php esc_html_e( 'Select a file and click on Import to start processing.', 'simple-social-buttons' ); ?></p>
26
+ </td>
27
+ </tr>
28
+ <tr class="export_setting">
29
+ <th scope="row">
30
+ <label for="ssb_configure[export_setting]"><?php esc_html_e( 'Export Settings:', 'simple-social-buttons' ); ?></label>
31
+ </th>
32
+ <td>
33
+ <input type="button" class="button ssb-export" value="<?php esc_html_e( 'Export', 'simple-social-buttons' ); ?>">
34
+ <span class="export-sniper">
35
+ <img src="<?php echo admin_url( 'images/wpspin_light.gif' ); ?>">
36
+ </span>
37
+ <span class="export-text"><?php esc_html_e( 'Simple Social Button Settings Exported Successfully!', 'simple-social-buttons' ); ?></span>
38
+ <p class="description"><?php esc_html_e( 'Export Simple Social Button Settings.', 'simple-social-buttons' ); ?></p>
39
+ </td>
40
+ </tr>
41
+ </tbody>
42
  </table>
43
  </div>
44
 
53
  // Remove Disabled attribute from Import Button.
54
  $( '#ssb_press_import' ).on( 'change', function( event ) {
55
 
56
+ event.preventDefault();
57
 
58
+ var ssbFileImp = $( '#ssb_press_import' ).val();
59
+ var ssbpressFileExt = ssbFileImp.substr( ssbFileImp.lastIndexOf('.') + 1 );
60
 
61
+ $( '.ssb-import' ).attr( "disabled", "disabled" );
62
 
63
+ if ( 'json' == ssbpressFileExt ) {
64
+ $(".import_setting .wrong-import").html("");
65
+ $( '.ssb-import' ).removeAttr( "disabled" );
66
+ } else {
67
+ $(".import_setting .wrong-import").html("Invalid File.");
68
+ }
69
  });
70
  $('.ssb-export').on('click', function(event) {
71
 
72
+ event.preventDefault();
73
+
74
+ var dateObj = new Date();
75
+ var month = dateObj.getUTCMonth() + 1; //months from 1-12
76
+ var day = dateObj.getUTCDate();
77
+ var year = dateObj.getUTCFullYear();
78
+ var newdate = year + "-" + month + "-" + day;
79
+
80
+ $.ajax({
81
+
82
+ url: ajaxurl,
83
+ type: 'POST',
84
+ data: {
85
+ action : 'ssb_export',
86
+ security : '<?php echo wp_create_nonce( 'ssb-export-security-check' ); ?>'
87
+ },
88
+ beforeSend: function() {
89
+ $(".export_setting .export-sniper").show();
90
+ },
91
+ success: function( response ) {
92
+
93
+ $(".export_setting .export-sniper").hide();
94
+ $(".export_setting .export-text").show();
95
+
96
+ if ( ! window.navigator.msSaveOrOpenBlob ) { // If msSaveOrOpenBlob() is supported, then so is msSaveBlob().
97
+ $("<a />", {
98
+ "download" : "ssb-export-"+newdate+".json",
99
+ "href" : "data:application/json;charset=utf-8," + encodeURIComponent( response ),
100
+ }).appendTo( "body" )
101
+ .click(function() {
102
+ $(this).remove()
103
+ })[0].click()
104
+ } else {
105
+ var blobObject = new Blob( [response] );
106
+ window.navigator.msSaveBlob( blobObject, "ssb-export-"+newdate+".json" );
107
+ }
108
+
109
+ setTimeout(function() {
110
+ $(".export_setting .export-text").fadeOut()
111
+ }, 3000 );
112
+ }
113
+ });
114
  });
115
 
116
  $('.ssb-import').on( 'click', function(event) {
117
+ event.preventDefault();
118
+
119
+ var file = $('#ssb_press_import');
120
+ var fileObj = new FormData();
121
+ var content = file[0].files[0];
122
+
123
+ fileObj.append( 'file', content );
124
+ fileObj.append( 'action', 'ssb_import' );
125
+ fileObj.append( 'security', '<?php echo wp_create_nonce( 'ssb-import-security-check' ); ?>' );
126
+
127
+ $.ajax({
128
+
129
+ processData: false,
130
+ contentType: false,
131
+ url: ajaxurl,
132
+ type: 'POST',
133
+ data: fileObj, // file and action append into variable fileObj.
134
+ beforeSend: function() {
135
+ $(".import_setting .import-sniper").show();
136
+ $(".import_setting .wrong-import").html("");
137
+ $( '.ssb-import' ).attr( "disabled", "disabled" );
138
+ },
139
+ success: function(response) {
140
+
141
+ $(".import_setting .import-sniper").hide();
142
+ // $(".import_setting .import-text").fadeIn();
143
+ if ( 'error' == response ) {
144
+ $(".import_setting .wrong-import").html("JSON File is not Valid.");
145
+ } else {
146
+ $(".import_setting .import-text").show();
147
+ setTimeout( function() {
148
+ $(".import_setting .import-text").fadeOut();
149
+ // $(".import_setting .wrong-import").html("");
150
+ file.val('');
151
+ }, 3000 );
152
+ }
153
+
154
+ }
155
+ }); //!ajax.
156
  });
157
  })(jQuery); // This invokes the function above and allows us to use '$' in place of 'jQuery' in our code.
158
 
inc/ssb-widget-fields.php CHANGED
@@ -97,7 +97,7 @@
97
  <label for="<?php echo esc_attr( $this->get_field_id( 'youtube_type' ) ); ?> "><?php esc_attr_e( 'Type :', 'simple-social-buttons' ); ?></label>
98
  <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'youtube_type' ) ); ?>">
99
  <option <?php selected( $youtube_type, 'channel'); ?> value="channel">Channel</option>
100
- <option <?php selected( $youtube_type, 'username'); ?> value="username">Username</option>
101
  </select>
102
  </p>
103
 
@@ -107,6 +107,16 @@
107
  <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'youtube_show_counter' ) ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'youtube_show_counter' ) ) ?>" value="1" <?php checked( $youtube_show_counter, 1 ) ?> class="youtube_count_check" >
108
  <label for="<?php echo esc_attr( $this->get_field_id( 'youtube_show_counter' ) ) ?>"> Display YouTube subscriber counter</label>
109
  </p>
 
 
 
 
 
 
 
 
 
 
110
  <hr/>
111
 
112
  </div>
97
  <label for="<?php echo esc_attr( $this->get_field_id( 'youtube_type' ) ); ?> "><?php esc_attr_e( 'Type :', 'simple-social-buttons' ); ?></label>
98
  <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'youtube_type' ) ); ?>">
99
  <option <?php selected( $youtube_type, 'channel'); ?> value="channel">Channel</option>
100
+ <option <?php selected( $youtube_type, 'user'); ?> value="user">Username</option>
101
  </select>
102
  </p>
103
 
107
  <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'youtube_show_counter' ) ) ?>" id="<?php echo esc_attr( $this->get_field_id( 'youtube_show_counter' ) ) ?>" value="1" <?php checked( $youtube_show_counter, 1 ) ?> class="youtube_count_check" >
108
  <label for="<?php echo esc_attr( $this->get_field_id( 'youtube_show_counter' ) ) ?>"> Display YouTube subscriber counter</label>
109
  </p>
110
+
111
+ <div class="youtube_api_key" style="display: <?php echo ( $display == $youtube_show_counter )? 'block' : 'none' ?>">
112
+ <p>
113
+ <label for="<?php echo esc_attr( $this->get_field_id( 'youtube_api_key' ) ); ?>"><?php esc_attr_e( 'YouTube Api Key: ', 'simple-social-buttons' ); ?><a href="#" target="_blank">How to get the YouTube API Key</a>
114
+ </label>
115
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'youtube_api_key' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'youtube_api_key' ) ); ?>" type="text" value="<?php echo esc_attr( $youtube_api_key ); ?>">
116
+ </p>
117
+
118
+
119
+ </div>
120
  <hr/>
121
 
122
  </div>
inc/ssb-widget-front.php CHANGED
@@ -1,35 +1,40 @@
1
  <?php
2
 
3
- if ( !empty( $widget_title ) ) {
4
  echo $before_title . $widget_title . $after_title;
5
  }
6
  ?>
7
 
8
  <section class="ssb_followers simplesocial-simple-round">
9
 
10
- <?php if( $display == $show_facebook ):?>
11
- <a class="ssb_button simplesocial-fb-follow" rel="noopener" href="https://facebook.com/<?php echo $facebook_id;?>" target="_blank"><span class="simplesocialtxt"><?php echo $facebook_text;?> </span><span class="widget_counter"> <?php echo ( $display == $facebook_show_counter)? $fb_likes: '' ;?> </span></a>
12
- <?php endif;
13
- if( $display == $show_twitter ): ?>
14
- <a class="ssb_button simplesocial-twt-follow" rel="noopener" href="https://twitter.com/<?php echo $twitter_id;?>" target="_blank"><span class="simplesocialtxt"><?php echo $twitter_text;?> </span><span class="widget_counter"> <?php echo ( $display == $twitter_show_counter)? $twitter_follower: '';?> </span></a>
15
- <?php endif;
16
- if ( $display == $show_google_plus ):?>
17
- <a class="ssb_button simplesocial-gplus-follow" rel="noopener" href="https://plus.google.com/<?php echo $google_id;?>" target="_blank"><span class="simplesocialtxt"><?php echo $google_text;?> </span><span class="widget_counter"> <?php echo ( $display == $google_show_counter )? $google_follower: '';?> </span></a>
18
- <?php endif;
19
- if( $display == $show_youtube):
20
- ?>
21
- <a class="ssb_button simplesocial-yt-follow" rel="noopener" href="https://youtube.com/<?php echo $youtube_type ?><?php echo $youtube_id ?>" target="_blank"><span class="simplesocialtxt"><?php echo $youtube_text?> </span><span class="widget_counter"> <?php echo ( $display == $youtube_show_counter)?$youtube_subscriber:" ";?> </span></a>
22
- <?php endif;?>
23
- <?php if ( $display == $show_pinterest ):?>
24
- <a class="ssb_button simplesocial-pinterest-follow" rel="noopener" href="https://pinterest.com/<?php echo $pinterest_id;?>" target="_blank"><span class="simplesocialtxt"><?php echo $pinterest_text;?> </span><span class="widget_counter"> <?php echo ( $display == $pinterest_show_counter )? $pinterest_follower: '';?> </span></a>
25
- <?php endif;?>
 
 
 
 
 
26
 
27
- <?php if ( $display == $show_instagram ):?>
28
- <a class="ssb_button simplesocial-instagram-follow" rel="noopener" href="https://www.instagram.com/<?php echo $instagram_id;?>" target="_blank"><span class="simplesocialtxt"><?php echo $instagram_text;?> </span><span class="widget_counter"> <?php echo ( $display == $instagram_show_counter )? $instagram_follower: '';?> </span></a>
29
- <?php endif;?>
30
- <?php if ( $display == $show_whatsapp ):?>
31
- <a class="ssb_button simplesocial-whatsapp-follow" rel="noopener" href="https://api.whatsapp.com/send?phone=<?php echo $whatsapp;?>" target="_blank"><span class="simplesocialtxt"><?php echo $whatsapp_text;?> </span></a>
32
- <?php endif;?>
33
 
34
  </section>
35
- <?php echo $after_widget;?>
1
  <?php
2
 
3
+ if ( ! empty( $widget_title ) ) {
4
  echo $before_title . $widget_title . $after_title;
5
  }
6
  ?>
7
 
8
  <section class="ssb_followers simplesocial-simple-round">
9
 
10
+ <?php if ( $display == $show_facebook ) : ?>
11
+ <a class="ssb_button simplesocial-fb-follow" rel="noopener" href="https://facebook.com/<?php echo $facebook_id; ?>" target="_blank"><span class="simplesocialtxt"><?php echo $facebook_text; ?> </span><span class="widget_counter"> <?php echo ( $display == $facebook_show_counter ) ? $fb_likes : ''; ?> </span></a>
12
+ <?php
13
+ endif;
14
+ if ( $display == $show_twitter ) :
15
+ ?>
16
+ <a class="ssb_button simplesocial-twt-follow" rel="noopener" href="https://twitter.com/<?php echo $twitter_id; ?>" target="_blank"><span class="simplesocialtxt"><?php echo $twitter_text; ?> </span><span class="widget_counter"> <?php echo ( $display == $twitter_show_counter ) ? $twitter_follower : ''; ?> </span></a>
17
+ <?php
18
+ endif;
19
+ if ( $display == $show_google_plus ) :
20
+ ?>
21
+ <a class="ssb_button simplesocial-gplus-follow" rel="noopener" href="https://plus.google.com/<?php echo $google_id; ?>" target="_blank"><span class="simplesocialtxt"><?php echo $google_text; ?> </span><span class="widget_counter"> <?php echo ( $display == $google_show_counter ) ? $google_follower : ''; ?> </span></a>
22
+ <?php
23
+ endif;
24
+ if ( $display == $show_youtube ) :
25
+ ?>
26
+ <a class="ssb_button simplesocial-yt-follow" rel="noopener" href="https://youtube.com/<?php echo $youtube_type; ?>/<?php echo $youtube_id; ?>" target="_blank"><span class="simplesocialtxt"><?php echo $youtube_text; ?> </span><span class="widget_counter"> <?php echo ( $display == $youtube_show_counter ) ? $youtube_subscriber : ' '; ?> </span></a>
27
+ <?php endif; ?>
28
+ <?php if ( $display == $show_pinterest ) : ?>
29
+ <a class="ssb_button simplesocial-pinterest-follow" rel="noopener" href="https://pinterest.com/<?php echo $pinterest_id; ?>" target="_blank"><span class="simplesocialtxt"><?php echo $pinterest_text; ?> </span><span class="widget_counter"> <?php echo ( $display == $pinterest_show_counter ) ? $pinterest_follower : ''; ?> </span></a>
30
+ <?php endif; ?>
31
 
32
+ <?php if ( $display == $show_instagram ) : ?>
33
+ <a class="ssb_button simplesocial-instagram-follow" rel="noopener" href="https://www.instagram.com/<?php echo $instagram_id; ?>" target="_blank"><span class="simplesocialtxt"><?php echo $instagram_text; ?> </span><span class="widget_counter"> <?php echo ( $display == $instagram_show_counter ) ? $instagram_follower : ''; ?> </span></a>
34
+ <?php endif; ?>
35
+ <?php if ( $display == $show_whatsapp ) : ?>
36
+ <a class="ssb_button simplesocial-whatsapp-follow" rel="noopener" href="https://api.whatsapp.com/send?phone=<?php echo intval( $whatsapp ); // intval use to remove + or 00 ?>" target="_blank"><span class="simplesocialtxt"><?php echo $whatsapp_text; ?> </span></a>
37
+ <?php endif; ?>
38
 
39
  </section>
40
+ <?php echo $after_widget; ?>
inc/upgrade-routine.php CHANGED
@@ -33,7 +33,7 @@ function ssb_upgrade_routine_2() {
33
 
34
  // Set Position of Inline Icons.
35
  $before_post = isset( $_old_value['beforepost'] ) && $_old_value['beforepost'] == '1' ? true : false;
36
- $after_post = isset( $_old_value['afterpost'] ) && $_old_value['afterpost'] == '1' ? true : false;
37
 
38
  if ( $before_post && $after_post ) {
39
  $inline_location = 'above_below';
@@ -91,7 +91,8 @@ function ssb_upgrade_routine_2() {
91
  // Set Extra tab settings.
92
  if ( isset( $_old_value['twitterusername'] ) ) {
93
  update_option(
94
- 'ssb_extra', array(
 
95
  'twitter_handle' => $_old_value['twitterusername'],
96
  )
97
  );
@@ -103,4 +104,4 @@ function ssb_upgrade_routine_2() {
103
  update_option( 'run_ssb_update_routine_2', 'yes' );
104
  }
105
 
106
- ?>
33
 
34
  // Set Position of Inline Icons.
35
  $before_post = isset( $_old_value['beforepost'] ) && $_old_value['beforepost'] == '1' ? true : false;
36
+ $after_post = isset( $_old_value['afterpost'] ) && $_old_value['afterpost'] == '1' ? true : false;
37
 
38
  if ( $before_post && $after_post ) {
39
  $inline_location = 'above_below';
91
  // Set Extra tab settings.
92
  if ( isset( $_old_value['twitterusername'] ) ) {
93
  update_option(
94
+ 'ssb_extra',
95
+ array(
96
  'twitter_handle' => $_old_value['twitterusername'],
97
  )
98
  );
104
  update_option( 'run_ssb_update_routine_2', 'yes' );
105
  }
106
 
107
+
inc/utils.php CHANGED
@@ -2,281 +2,330 @@
2
 
3
 
4
  /**
5
- * Crul to fetch stats.
6
- *
7
- * @since 2.0
8
- */
9
  function ssb_fetch_shares_via_curl_multi( $data, $options = array() ) {
10
 
11
- // array of curl handles
12
- $curly = array();
13
- // data to be returned
14
- $result = array();
15
-
16
- // multi handle
17
- $mh = curl_multi_init();
18
-
19
- // loop through $data and create curl handles
20
- // then add them to the multi-handle
21
- if ( is_array( $data ) ) :
22
- foreach ( $data as $id => $d ) :
23
-
24
- if ( $d !== 0 ) :
25
-
26
- $curly[ $id ] = curl_init();
27
-
28
- $url = (is_array( $d ) && ! empty( $d['url'] )) ? $d['url'] : $d;
29
- curl_setopt( $curly[ $id ], CURLOPT_URL, $url );
30
- curl_setopt( $curly[ $id ], CURLOPT_HEADER, 0 );
31
- curl_setopt( $curly[ $id ], CURLOPT_RETURNTRANSFER, 1 );
32
- curl_setopt( $curly[ $id ], CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT'] );
33
- curl_setopt( $curly[ $id ], CURLOPT_FAILONERROR, 0 );
34
- curl_setopt( $curly[ $id ], CURLOPT_FOLLOWLOCATION, 0 );
35
- curl_setopt( $curly[ $id ], CURLOPT_RETURNTRANSFER,1 );
36
- curl_setopt( $curly[ $id ], CURLOPT_SSL_VERIFYPEER, false );
37
- curl_setopt( $curly[ $id ], CURLOPT_SSL_VERIFYHOST, false );
38
- curl_setopt( $curly[ $id ], CURLOPT_TIMEOUT, 5 );
39
- curl_setopt( $curly[ $id ], CURLOPT_CONNECTTIMEOUT, 5 );
40
- curl_setopt( $curly[ $id ], CURLOPT_NOSIGNAL, 1 );
41
- curl_setopt( $curly[ $id ], CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
42
- // curl_setopt($curly[$id], CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
43
-
44
- // extra options?
45
- if ( ! empty( $options ) ) {
46
- curl_setopt_array( $curly[ $id ], $options );
47
- }
48
-
49
- curl_multi_add_handle( $mh, $curly[ $id ] );
50
-
51
- endif;
52
- endforeach;
53
- endif;
54
-
55
- // execute the handles
56
- $running = null;
57
- do {
58
- curl_multi_exec( $mh, $running );
59
- } while ( $running > 0 );
60
-
61
- // get content and remove handles
62
- foreach ( $curly as $id => $c ) {
63
- $result[ $id ] = curl_multi_getcontent( $c );
64
- curl_multi_remove_handle( $mh, $c );
65
- }
66
-
67
- // all done
68
- curl_multi_close( $mh );
69
-
70
- return $result;
71
- }
72
-
73
-
74
-
75
- /**
76
- * Return false if to fetch the new counts.
77
- *
78
- * @return bool
79
- * @since 2.0
80
- */
81
- function ssb_is_cache_fresh( $post_id, $output = false, $ajax = false ) {
82
- // global $swp_user_options;
83
- // Bail early if it's a crawl bot. If so, ONLY SERVE CACHED RESULTS FOR MAXIMUM SPEED.
84
- if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/bot|crawl|slurp|spider/i', wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ) {
85
- return true;
86
- }
87
-
88
- // $options = $swp_user_options;
89
- $fresh_cache = false;
90
-
91
- if( isset( $_POST['ssb_cache'] ) && 'rebuild' === $_POST['ssb_cache'] ) {
92
- return false;
93
- }
94
- // Always be TRUE if we're not on a single.php otherwise we could end up
95
- // Rebuilding multiple page caches which will cost a lot of time.
96
- // if ( ! is_singular() && ! $ajax ) {
97
- // return true;
98
- // }
99
-
100
- $post_age = floor( date( 'U' ) - get_post_time( 'U' , false , $post_id ) );
101
-
102
- if ( $post_age < ( 21 * 86400 ) ) {
103
- $hours = 1;
104
- } elseif ( $post_age < ( 60 * 86400 ) ) {
105
- $hours = 4;
106
- } else {
107
- $hours = 12;
108
- }
109
-
110
- $time = floor( ( ( date( 'U' ) / 60 ) / 60 ) );
111
- $last_checked = get_post_meta( $post_id, 'ssb_cache_timestamp', true );
112
-
113
- if ( $last_checked > ( $time - $hours ) && $last_checked > 390000 ) {
114
- $fresh_cache = true;
115
- } else {
116
- $fresh_cache = false;
117
- }
118
-
119
- return $fresh_cache;
120
- }
121
-
122
-
123
- /**
124
- * Fetch fresh counts and cached them.
125
- *
126
- * @param Array $stats
127
- * @param String $post_id
128
- * @return Array Simple array with counts.
129
- * @since 2.0
130
- */
131
- function ssb_fetch_fresh_counts( $stats, $post_id ,$alt_share_link) {
132
-
133
- $stats_result = array();
134
- $total = 0;
135
-
136
- // special case if post id not exist for example short code run on widget out side the loop in archive page
137
- if( 0 !== $post_id ){
138
- $networks = get_post_meta( $post_id, 'ssb_old_counts', true );
139
- }else{
140
- $networks = get_option( 'ssb_not_exist_post_old_counts' );
141
- }
142
-
143
- if( ! $networks ){
144
- $_result = ssb_fetch_shares_via_curl_multi( array_filter( $alt_share_link ) );
145
- ssb_fetch_http_or_https_counts( $_result, $post_id );
146
- // special case if post id not exist for example short code run on widget out side the loop in archive page
147
- if( 0 !== $post_id ){
148
- $networks = get_post_meta( $post_id, 'ssb_old_counts', true );
149
- }else{
150
- $networks = get_option( 'ssb_not_exist_post_old_counts' );
151
-
152
- }
153
-
154
- }
155
-
156
- foreach ( $stats as $social_name => $counts ) {
157
- if ( 'totalshare' == $social_name || 'viber' == $social_name || 'fblike' == $social_name || 'whatsapp' == $social_name || 'print' == $social_name || 'email' == $social_name || 'messenger' == $social_name )
158
- { continue; }
159
- $stats_counts = call_user_func( 'ssb_format_' . $social_name . '_response', $counts );
160
- $new_counts = $stats_counts + $networks[ $social_name];
161
-
162
- $old_counts = get_post_meta( $post_id, 'ssb_' . $social_name . '_counts', true );
163
-
164
- // this will solve if new plugin install.
165
- $old_counts = $old_counts ? $old_counts : 0;
166
- // if old counts less than new. Return old.
167
- if ( $new_counts > $old_counts ) {
168
- $stats_result[ $social_name ] = $new_counts;
169
- } else {
170
- $stats_result[ $social_name ] = $old_counts;
171
- }
172
-
173
- // special case if post id not exist for example short code run on widget out side the loop in archive page
174
- if( 0 !== $post_id ) {
175
- if ( $new_counts > $old_counts ) {
176
- update_post_meta( $post_id, 'ssb_' . $social_name . '_counts', $new_counts );
177
- } else {
178
- // set new counts = old counts for total calculation.
179
- $new_counts = $old_counts;
180
- }
181
- } else {
182
- update_option( 'ssb_not_exist_post_'. $social_name .'_counts', $new_counts );
183
- }
184
-
185
- $total += $new_counts;
186
- }
187
-
188
- $stats_result['total'] = $total;
189
- // special case if post id not exist for example short code run on widget out side the loop in archive page
190
- if( 0 !== $post_id ){
191
- update_post_meta( $post_id, 'ssb_total_counts', $total );
192
- }else{
193
- update_option( 'ssb_not_exist_post_total_counts', $total );
194
- }
195
 
196
- return $stats_result;
197
- }
198
  /**
199
- * Fetch counts + http or https resolve .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  *
201
  * @param Array $stats
202
  * @param String $post_id
203
  * @return Array Simple array with counts.
204
- * @since 2.0.12
205
  */
206
- function ssb_fetch_http_or_https_counts( $stats, $post_id ){
207
- $stats_result = array();
208
- $networks = array();
209
- foreach ( $stats as $social_name => $counts ) {
210
- if ( 'totalshare' == $social_name || 'viber' == $social_name || 'fblike' == $social_name || 'whatsapp' == $social_name || 'print' == $social_name || 'email' == $social_name || 'messenger' == $social_name )
211
- { continue; }
212
- $stats_counts = call_user_func( 'ssb_format_' . $social_name . '_response', $counts );
213
- $networks[ $social_name] = $stats_counts;
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  // special case if post id not exist for example short code run on widget out side the loop in archive page
216
- if( 0 !== $post_id ){
217
- update_post_meta( $post_id, 'ssb_old_counts', $networks );
218
- }else{
219
- update_option( 'ssb_not_exist_post_old_counts', $networks );
 
 
 
 
 
220
  }
221
 
 
222
  }
223
 
224
- /**
225
- * Get the cahced counts.
226
- *
227
- * @param Array $network_name
228
- * @param String $post_id
229
- * @return Array Counts of each network.
230
- * @since 2.0
231
- */
232
- function ssb_fetch_cached_counts( $network_name, $post_id ) {
233
- $network_name[] = 'total';
234
- $result = array();
235
- foreach ( $network_name as $social_name ) {
236
- // special case if post id not exist for example short code run on widget out side the loop in archive page
237
- if( 0 !== $post_id ){
238
- $result[ $social_name ] = get_post_meta( $post_id, 'ssb_' . $social_name . '_counts', true );
239
- }else{
240
- $result[ $social_name ] = get_option( 'ssb_not_exist_post_'. $social_name .'_counts' );
241
- }
242
- }
243
- return $result;
244
  }
245
-
246
 
 
 
247
  /**
248
- * Detect if mobile.
249
  *
250
- * @since 2.0.13
 
 
 
251
  */
252
- function is_mobile() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
 
254
- $useragent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : 'none';
255
 
256
- if ( preg_match( '/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $useragent ) || preg_match( '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i', substr( $useragent, 0, 4 ) ) ) {
257
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  } else {
259
- return false;
260
  }
261
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
263
  /**
264
  * Generate Whats app shara link.
265
- *
266
  * @param String $url
267
  * @return Srtring Final url after detection is it mobile or desktop.
268
  * @since 2.0.23
269
  */
270
- function ssb_whats_app_share_link( $url ){
271
- $whats_share_link = '';
272
- if( wp_is_mobile() ){
273
- $whats_share_link = 'https://api.whatsapp.com/send?text=' . $url;
274
- } else {
275
- $whats_share_link = 'https://web.whatsapp.com/send?text=' . $url;
276
- }
 
 
 
 
277
 
278
- return $whats_share_link;
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  }
280
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
-
2
 
3
 
4
  /**
5
+ * Crul to fetch stats.
6
+ *
7
+ * @since 2.0
8
+ */
9
  function ssb_fetch_shares_via_curl_multi( $data, $options = array() ) {
10
 
11
+ // array of curl handles
12
+ $curly = array();
13
+ // data to be returned
14
+ $result = array();
15
+
16
+ // multi handle
17
+ $mh = curl_multi_init();
18
+
19
+ // loop through $data and create curl handles
20
+ // then add them to the multi-handle
21
+ if ( is_array( $data ) ) :
22
+ foreach ( $data as $id => $d ) :
23
+
24
+ if ( $d !== 0 ) :
25
+
26
+ $curly[ $id ] = curl_init();
27
+
28
+ $url = ( is_array( $d ) && ! empty( $d['url'] ) ) ? $d['url'] : $d;
29
+ curl_setopt( $curly[ $id ], CURLOPT_URL, $url );
30
+ curl_setopt( $curly[ $id ], CURLOPT_HEADER, 0 );
31
+ curl_setopt( $curly[ $id ], CURLOPT_RETURNTRANSFER, 1 );
32
+ curl_setopt( $curly[ $id ], CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT'] );
33
+ curl_setopt( $curly[ $id ], CURLOPT_FAILONERROR, 0 );
34
+ curl_setopt( $curly[ $id ], CURLOPT_FOLLOWLOCATION, 0 );
35
+ curl_setopt( $curly[ $id ], CURLOPT_RETURNTRANSFER, 1 );
36
+ curl_setopt( $curly[ $id ], CURLOPT_SSL_VERIFYPEER, false );
37
+ curl_setopt( $curly[ $id ], CURLOPT_SSL_VERIFYHOST, false );
38
+ curl_setopt( $curly[ $id ], CURLOPT_TIMEOUT, 5 );
39
+ curl_setopt( $curly[ $id ], CURLOPT_CONNECTTIMEOUT, 5 );
40
+ curl_setopt( $curly[ $id ], CURLOPT_NOSIGNAL, 1 );
41
+ curl_setopt( $curly[ $id ], CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
42
+ // curl_setopt($curly[$id], CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
43
+
44
+ // extra options?
45
+ if ( ! empty( $options ) ) {
46
+ curl_setopt_array( $curly[ $id ], $options );
47
+ }
48
+
49
+ curl_multi_add_handle( $mh, $curly[ $id ] );
50
+
51
+ endif;
52
+ endforeach;
53
+ endif;
54
+
55
+ // execute the handles
56
+ $running = null;
57
+ do {
58
+ curl_multi_exec( $mh, $running );
59
+ } while ( $running > 0 );
60
+
61
+ // get content and remove handles
62
+ foreach ( $curly as $id => $c ) {
63
+ $result[ $id ] = curl_multi_getcontent( $c );
64
+ curl_multi_remove_handle( $mh, $c );
65
+ }
66
+
67
+ // all done
68
+ curl_multi_close( $mh );
69
+
70
+ return $result;
71
+ }
72
+
73
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
 
 
75
  /**
76
+ * Return false if to fetch the new counts.
77
+ *
78
+ * @return bool
79
+ * @since 2.0
80
+ */
81
+ function ssb_is_cache_fresh( $post_id, $output = false, $ajax = false ) {
82
+ // global $swp_user_options;
83
+ // Bail early if it's a crawl bot. If so, ONLY SERVE CACHED RESULTS FOR MAXIMUM SPEED.
84
+ if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/bot|crawl|slurp|spider/i', wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ) {
85
+ return true;
86
+ }
87
+
88
+ // $options = $swp_user_options;
89
+ $fresh_cache = false;
90
+
91
+ if ( isset( $_POST['ssb_cache'] ) && 'rebuild' === $_POST['ssb_cache'] ) {
92
+ return false;
93
+ }
94
+ // Always be TRUE if we're not on a single.php otherwise we could end up
95
+ // Rebuilding multiple page caches which will cost a lot of time.
96
+ // if ( ! is_singular() && ! $ajax ) {
97
+ // return true;
98
+ // }
99
+
100
+ $post_age = floor( date( 'U' ) - get_post_time( 'U', false, $post_id ) );
101
+
102
+ if ( $post_age < ( 21 * 86400 ) ) {
103
+ $hours = 1;
104
+ } elseif ( $post_age < ( 60 * 86400 ) ) {
105
+ $hours = 4;
106
+ } else {
107
+ $hours = 12;
108
+ }
109
+
110
+ $time = floor( ( ( date( 'U' ) / 60 ) / 60 ) );
111
+ $last_checked = get_post_meta( $post_id, 'ssb_cache_timestamp', true );
112
+
113
+ if ( $last_checked > ( $time - $hours ) && $last_checked > 390000 ) {
114
+ $fresh_cache = true;
115
+ } else {
116
+ $fresh_cache = false;
117
+ }
118
+
119
+ return $fresh_cache;
120
+ }
121
+
122
+
123
+ /**
124
+ * Fetch fresh counts and cached them.
125
  *
126
  * @param Array $stats
127
  * @param String $post_id
128
  * @return Array Simple array with counts.
129
+ * @since 2.0
130
  */
131
+ function ssb_fetch_fresh_counts( $stats, $post_id, $alt_share_link ) {
132
+
133
+ $stats_result = array();
134
+ $total = 0;
135
+
136
+ // special case if post id not exist for example short code run on widget out side the loop in archive page
137
+ if ( 0 !== $post_id ) {
138
+ $networks = get_post_meta( $post_id, 'ssb_old_counts', true );
139
+ } else {
140
+ $networks = get_option( 'ssb_not_exist_post_old_counts' );
141
+ }
142
+
143
+ if ( ! $networks ) {
144
+ $_result = ssb_fetch_shares_via_curl_multi( array_filter( $alt_share_link ) );
145
+ ssb_fetch_http_or_https_counts( $_result, $post_id );
146
+ // special case if post id not exist for example short code run on widget out side the loop in archive page
147
+ if ( 0 !== $post_id ) {
148
+ $networks = get_post_meta( $post_id, 'ssb_old_counts', true );
149
+ } else {
150
+ $networks = get_option( 'ssb_not_exist_post_old_counts' );
151
+
152
  }
153
+ }
154
+
155
+ foreach ( $stats as $social_name => $counts ) {
156
+ if ( ! is_network_has_counts( $social_name ) ) {
157
+ continue; }
158
+ $stats_counts = call_user_func( 'ssb_format_' . $social_name . '_response', $counts );
159
+ $new_counts = $stats_counts + $networks[ $social_name ];
160
+
161
+ $old_counts = get_post_meta( $post_id, 'ssb_' . $social_name . '_counts', true );
162
+
163
+ // this will solve if new plugin install.
164
+ $old_counts = $old_counts ? $old_counts : 0;
165
+ // if old counts less than new. Return old.
166
+ if ( $new_counts > $old_counts ) {
167
+ $stats_result[ $social_name ] = $new_counts;
168
+ } else {
169
+ $stats_result[ $social_name ] = $old_counts;
170
+ }
171
+
172
  // special case if post id not exist for example short code run on widget out side the loop in archive page
173
+ if ( 0 !== $post_id ) {
174
+ if ( $new_counts > $old_counts ) {
175
+ update_post_meta( $post_id, 'ssb_' . $social_name . '_counts', $new_counts );
176
+ } else {
177
+ // set new counts = old counts for total calculation.
178
+ $new_counts = $old_counts;
179
+ }
180
+ } else {
181
+ update_option( 'ssb_not_exist_post_' . $social_name . '_counts', $new_counts );
182
  }
183
 
184
+ $total += $new_counts;
185
  }
186
 
187
+ $stats_result['total'] = $total;
188
+ // special case if post id not exist for example short code run on widget out side the loop in archive page
189
+ if ( 0 !== $post_id ) {
190
+ update_post_meta( $post_id, 'ssb_total_counts', $total );
191
+ } else {
192
+ update_option( 'ssb_not_exist_post_total_counts', $total );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  }
 
194
 
195
+ return $stats_result;
196
+ }
197
  /**
198
+ * Fetch counts + http or https resolve .
199
  *
200
+ * @param Array $stats
201
+ * @param String $post_id
202
+ * @return Array Simple array with counts.
203
+ * @since 2.0.12
204
  */
205
+ function ssb_fetch_http_or_https_counts( $stats, $post_id ) {
206
+ $stats_result = array();
207
+ $networks = array();
208
+ foreach ( $stats as $social_name => $counts ) {
209
+ if ( ! is_network_has_counts( $social_name ) ) {
210
+ continue; }
211
+ $stats_counts = call_user_func( 'ssb_format_' . $social_name . '_response', $counts );
212
+ $networks[ $social_name ] = $stats_counts;
213
+ }
214
+ // special case if post id not exist for example short code run on widget out side the loop in archive page
215
+ if ( 0 !== $post_id ) {
216
+ update_post_meta( $post_id, 'ssb_old_counts', $networks );
217
+ } else {
218
+ update_option( 'ssb_not_exist_post_old_counts', $networks );
219
+ }
220
 
221
+ }
222
 
223
+ /**
224
+ * Get the cahced counts.
225
+ *
226
+ * @param Array $network_name
227
+ * @param String $post_id
228
+ * @return Array Counts of each network.
229
+ * @since 2.0
230
+ */
231
+ function ssb_fetch_cached_counts( $network_name, $post_id ) {
232
+ $network_name[] = 'total';
233
+ $result = array();
234
+ foreach ( $network_name as $social_name ) {
235
+ // special case if post id not exist for example short code run on widget out side the loop in archive page
236
+ if ( 0 !== $post_id ) {
237
+ $result[ $social_name ] = get_post_meta( $post_id, 'ssb_' . $social_name . '_counts', true );
238
  } else {
239
+ $result[ $social_name ] = get_option( 'ssb_not_exist_post_' . $social_name . '_counts' );
240
  }
241
  }
242
+ return $result;
243
+ }
244
+
245
+
246
+ /**
247
+ * Detect if mobile.
248
+ *
249
+ * @since 2.0.13
250
+ */
251
+ function is_mobile() {
252
+
253
+ $useragent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : 'none';
254
+
255
+ if ( preg_match( '/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $useragent ) || preg_match( '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i', substr( $useragent, 0, 4 ) ) ) {
256
+ return true;
257
+ } else {
258
+ return false;
259
+ }
260
+ }
261
 
262
  /**
263
  * Generate Whats app shara link.
264
+ *
265
  * @param String $url
266
  * @return Srtring Final url after detection is it mobile or desktop.
267
  * @since 2.0.23
268
  */
269
+ function ssb_whats_app_share_link( $url ) {
270
+ $whats_share_link = '';
271
+ if ( wp_is_mobile() ) {
272
+ $whats_share_link = 'https://api.whatsapp.com/send?text=' . $url;
273
+ } else {
274
+ $whats_share_link = 'https://web.whatsapp.com/send?text=' . $url;
275
+ }
276
+
277
+ return $whats_share_link;
278
+ }
279
+
280
 
281
+
282
+ /**
283
+ * Check is network has count.
284
+ *
285
+ * @since 2.1.4
286
+ * @param string $network network name.
287
+ * @return boolean
288
+ */
289
+ function is_network_has_counts( $network ) {
290
+ $no_count_networks = array( 'totalshare', 'viber', 'fblike', 'whatsapp', 'print', 'email', 'messenger', 'linkedin' );
291
+ if ( in_array( $network, $no_count_networks ) ) {
292
+ return false;
293
+ } else {
294
+ return true;
295
  }
296
+ }
297
+
298
+ /**
299
+ * Pretty counts format.
300
+ *
301
+ * @param integer $n .
302
+ * @param integer $precision .
303
+ * @return int|mixed
304
+ * @since 2.0.0
305
+ */
306
+ function ssb_count_format( $n, $precision = 1 ) {
307
+ if ( $n >= 0 && $n < 1000 ) {
308
+ // 1 - 999
309
+ $n_format = floor( $n );
310
+ $suffix = '';
311
+ } elseif ( $n >= 1000 && $n < 1000000 ) {
312
+ // 1k-999k
313
+ $n_format = number_format( $n / 1000, $precision );
314
+ $suffix = 'K+';
315
+ } elseif ( $n >= 1000000 && $n < 1000000000 ) {
316
+ // 1m-999m
317
+ $n_format = number_format( $n / 1000000, $precision );
318
+ $suffix = 'M+';
319
+ } elseif ( $n >= 1000000000 && $n < 1000000000000 ) {
320
+ // 1b-999b
321
+ $n_format = number_format( $n / 1000000000, $precision );
322
+ $suffix = 'B+';
323
+ } elseif ( $n >= 1000000000000 ) {
324
+ // 1t+
325
+ $n_format = number_format( $n / 1000000000000, $precision );
326
+ $suffix = 'T+';
327
+ }
328
+ return ! empty( $n_format . $suffix ) ? floatval( $n_format ) . $suffix : $n;
329
+
330
+ }
331
 
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wpbrigade.com/
4
  Tags: Social share, Social buttons, Whatsapp, Viber, LinkedIn, facebook, twitter, pinterest, plus one
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
- Stable tag: 2.1.3
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -146,11 +146,21 @@ like_button_size = small(default), large
146
 
147
  == Upgrade Notice ==
148
 
149
- = 2.1.3 =
150
- * Please upgrade immediately. Google+ removed from social sharing list.
151
 
152
  == Changelog ==
153
 
 
 
 
 
 
 
 
 
 
 
154
  = 2.1.3 - 2019-08-05 =
155
  * Enhancement: Google+ button removed as G+ API is not longer available by Google.
156
 
4
  Tags: Social share, Social buttons, Whatsapp, Viber, LinkedIn, facebook, twitter, pinterest, plus one
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
+ Stable tag: 2.1.4
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
146
 
147
  == Upgrade Notice ==
148
 
149
+ = 2.1.4 =
150
+ * Please upgrade immediately. Many enhancements and bugfixes.
151
 
152
  == Changelog ==
153
 
154
+ = 2.1.4 - 2019-10-21 =
155
+ * Enhancement: `ssb_buttons_output` filter added to add own button.
156
+ * Enhancement: Settings link added at plugin listing page.
157
+ * Enhancement: Advance settings added at help page log.
158
+ * Enhancement: Code Refactored.
159
+ * Enhancement: Social Sharing Counter formatting is added.
160
+ * Bug fix: WhatsApp number error fix if number added with + or 00 in follow widget.
161
+ * Bug fix: Sidebars position issue fix with long counter.
162
+ * Bug Fix: YouTube follower link in Social Follow widget.
163
+
164
  = 2.1.3 - 2019-08-05 =
165
  * Enhancement: Google+ button removed as G+ API is not longer available by Google.
166
 
simple-social-buttons.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Simple Social Buttons
4
  * Plugin URI: http://www.WPBrigade.com/wordpress/plugins/simple-social-buttons/
5
  * Description: Simple Social Buttons adds an advanced set of social media sharing buttons to your WordPress sites, such as: Google +1, Facebook, WhatsApp, Viber, Twitter, Reddit, LinkedIn and Pinterest. This makes it the most <code>Flexible Social Sharing Plugin ever for Everyone.</code>
6
- * Version: 2.1.3
7
  * Author: WPBrigade
8
  * Author URI: http://www.WPBrigade.com/
9
  * Text Domain: simple-social-buttons
@@ -29,13 +29,53 @@
29
 
30
 
31
  class SimpleSocialButtonsPR {
32
- public $pluginName = 'Simple Social Buttons';
33
- public $pluginVersion = '2.1.3';
34
- public $pluginPrefix = 'ssb_pr_';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  public $hideCustomMetaKey = '_ssb_hide';
36
- private $fb_app_id = '891268654262273';
37
 
38
- // plugin default settings
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  public $pluginDefaultSettings = array(
40
  'twitter' => '3',
41
  'pinterest' => '0',
@@ -51,18 +91,69 @@ class SimpleSocialButtonsPR {
51
  'cache' => 'on',
52
  );
53
 
54
- // defined buttons
 
 
 
 
 
55
  public $arrKnownButtons = array( 'twitter', 'pinterest', 'fbshare', 'linkedin', 'reddit', 'whatsapp', 'viber', 'fblike', 'messenger', 'email', 'print', 'tumblr' );
56
 
57
- // an array to store current settings, to avoid passing them between functions
 
 
 
 
 
58
  public $settings = array();
59
 
 
 
 
 
 
 
60
  public $selected_networks = array();
61
- public $selected_theme = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  public $selected_position = '';
63
- public $inline_option = '';
64
- public $sidebar_option = '';
65
- public $extra_option = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
  /**
68
  * Constructor
@@ -100,6 +191,9 @@ class SimpleSocialButtonsPR {
100
 
101
  add_action( 'wp_enqueue_scripts', array( $this, 'front_enqueue_scripts' ) );
102
 
 
 
 
103
  // Queue up our hook function
104
  add_action( 'wp_footer', array( $this, 'ssb_footer_functions' ), 99 );
105
 
@@ -123,39 +217,88 @@ class SimpleSocialButtonsPR {
123
 
124
  }
125
 
126
- function set_selected_networks() {
 
 
 
 
 
 
 
127
  $networks = get_option( 'ssb_networks' );
128
  $this->selected_networks = array_flip( array_merge( array( 0 ), explode( ',', $networks['icon_selection'] ) ) );
129
  }
130
 
131
- function set_selected_theme() {
 
 
 
 
 
 
 
132
  $theme = get_option( 'ssb_themes' );
133
  $this->selected_theme = $theme['icon_style'];
134
 
135
  }
136
 
137
- function set_selected_position() {
 
 
 
 
 
 
 
138
  $theme = get_option( 'ssb_positions' );
139
  $this->selected_position = $theme['position'];
140
  }
141
 
142
- function set_inline_option() {
 
 
 
 
 
 
 
143
  $this->inline_option = get_option( 'ssb_inline' );
144
  }
145
 
146
- function set_sidebar_option() {
 
 
 
 
 
 
 
147
  $this->sidebar_option = get_option( 'ssb_sidebar' );
148
  }
149
 
150
 
151
- function set_extra_option() {
 
 
 
 
 
 
 
152
  $this->extra_option = get_option( 'ssb_advanced' );
153
  }
154
 
155
- function ajax_fetch_fresh_data() {
 
 
 
 
 
 
 
156
 
157
  $order = array();
158
- $post_id = (int)$_POST['postID'];
159
  foreach ( $this->arrKnownButtons as $button_name ) {
160
 
161
  if ( isset( $this->selected_networks[ $button_name ] ) && $this->selected_networks[ $button_name ] > 0 ) {
@@ -165,7 +308,7 @@ class SimpleSocialButtonsPR {
165
 
166
  $_share_links = array();
167
  foreach ( $order as $social_name => $priority ) {
168
- if ( 'totalshare' == $social_name || 'viber' == $social_name || 'fblike' == $social_name || 'whatsapp' == $social_name || 'print' == $social_name || 'email' == $social_name || 'messenger' == $social_name ) {
169
  continue; }
170
  $_share_links[ $social_name ] = call_user_func( 'ssb_' . $social_name . '_generate_link', get_permalink( $post_id ) );
171
  }
@@ -185,12 +328,26 @@ class SimpleSocialButtonsPR {
185
  // );
186
  $share_counts = ssb_fetch_fresh_counts( $result, $post_id, $_alt_share_links );
187
 
 
188
  update_post_meta( $post_id, 'ssb_cache_timestamp', floor( ( ( date( 'U' ) / 60 ) / 60 ) ) );
 
 
 
 
 
 
189
  echo json_encode( $share_counts );
190
  wp_die();
191
  }
192
 
193
- function ssb_output_cache_trigger( $info ) {
 
 
 
 
 
 
 
194
 
195
  // Return early if we're not on a single page or we have fresh cache.
196
  if ( ( ssb_is_cache_fresh( $info['postID'], true ) ) && empty( $_GET['ssb_cache'] ) ) {
@@ -230,7 +387,7 @@ class SimpleSocialButtonsPR {
230
  };
231
  jQuery.post(ssb_admin_ajax, data, function(data, textStatus, xhr) {
232
  var array = JSON.parse(data);
233
-
234
  jQuery.each( array, function( index, value ){
235
 
236
  if( index == 'total' ){
@@ -273,7 +430,14 @@ class SimpleSocialButtonsPR {
273
  }
274
 
275
 
276
- function ssb_footer_functions() {
 
 
 
 
 
 
 
277
  // Check it is 404 page or not single (page/post)
278
  if ( is_404() || ! is_singular() ) {
279
  return false;
@@ -309,7 +473,14 @@ class SimpleSocialButtonsPR {
309
 
310
 
311
 
312
- function front_enqueue_scripts() {
 
 
 
 
 
 
 
313
 
314
  wp_enqueue_script( 'jquery' );
315
  wp_enqueue_script( 'ssb-front-js', plugins_url( 'assets/js/front.js', __FILE__ ), array( 'jquery' ), SSB_VERSION );
@@ -317,15 +488,17 @@ class SimpleSocialButtonsPR {
317
  }
318
 
319
  /**
320
- * Includes all files.
321
  *
 
322
  * @since 2.0
 
323
  */
324
- function _includes() {
325
 
326
  include_once SSB_PLUGIN_DIR . '/inc/utils.php';
327
  include_once SSB_PLUGIN_DIR . '/ssb-social-counts/facebook.php';
328
- include_once SSB_PLUGIN_DIR . '/ssb-social-counts/linkedin.php';
329
  include_once SSB_PLUGIN_DIR . '/ssb-social-counts/twitter.php';
330
  include_once SSB_PLUGIN_DIR . '/ssb-social-counts/pinterest.php';
331
  include_once SSB_PLUGIN_DIR . '/ssb-social-counts/reddit.php';
@@ -333,21 +506,47 @@ class SimpleSocialButtonsPR {
333
  }
334
 
335
 
336
- function load_plugin_domain() {
 
 
 
 
 
 
 
337
  load_plugin_textdomain( 'simple-social-buttons', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
338
  }
339
 
340
- function constants() {
341
- define( 'SSB_FEEDBACK_SERVER', 'https://wpbrigade.com/' );
342
- define( 'SSB_VERSION', $this->pluginVersion );
343
- define( 'SSB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  }
345
 
346
 
347
  /**
348
  * Set default settings.
 
 
 
 
349
  */
350
- function plugin_install() {
351
 
352
  if ( ! get_option( 'ssb_networks' ) ) {
353
  $_default = array(
@@ -387,9 +586,13 @@ class SimpleSocialButtonsPR {
387
  }
388
 
389
  /**
390
- * Plugin unistall and database clean up
 
 
 
 
391
  */
392
- function plugin_uninstall() {
393
  if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
394
  exit();
395
  }
@@ -400,16 +603,20 @@ class SimpleSocialButtonsPR {
400
  }
401
 
402
 
403
- function _get_settings( $section, $value, $default = false ) {
404
  $section = $section . '_option';
405
  $_arr = $this->$section;
406
  return isset( $_arr[ $value ] ) && ! empty( $_arr[ $value ] ) ? $_arr[ $value ] : $default;
407
  }
408
 
409
  /**
410
- * Returns true on pages where buttons should be shown
 
 
 
 
411
  */
412
- function where_to_insert() {
413
 
414
  $return = false;
415
 
@@ -425,7 +632,9 @@ class SimpleSocialButtonsPR {
425
  /**
426
  * Add Thumbs Up Icon
427
  *
 
428
  * @since 1.9.0
 
429
  */
430
  public function _row_meta( $links, $file ) {
431
 
@@ -446,9 +655,11 @@ class SimpleSocialButtonsPR {
446
  /**
447
  * Add inline for the excerpt.
448
  *
 
449
  * @since 2.0
 
450
  */
451
- function insert_excerpt_buttons( $content ) {
452
 
453
  if ( is_single() ) {
454
  return $content;
@@ -460,9 +671,11 @@ class SimpleSocialButtonsPR {
460
  /**
461
  * Return class
462
  *
 
463
  * @since 2.0.4
 
464
  */
465
- function add_post_class( $post_id = null ) {
466
  $post = get_post( $post_id );
467
 
468
  $classes = '';
@@ -481,9 +694,11 @@ class SimpleSocialButtonsPR {
481
  /**
482
  * Add Inline Buttons.
483
  *
 
484
  * @since 1.0
 
485
  */
486
- function insert_buttons( $content ) {
487
 
488
  // Return the content if we are not in loop.
489
  if ( ! is_main_query() || ! in_the_loop() ) {
@@ -528,7 +743,7 @@ class SimpleSocialButtonsPR {
528
  $extra_class .= ' simplesocialbuttons-inline-' . $this->_get_settings( 'inline', 'animation', 'no-animation' );
529
 
530
  $_selected_network = apply_filters( 'ssb_inline_social_networks', $this->selected_networks );
531
- $ssb_buttonscode = $this->generate_buttons_code( $_selected_network, $show_count, $show_total, $extra_class );
532
 
533
  $sharing_text = '';
534
 
@@ -548,20 +763,27 @@ class SimpleSocialButtonsPR {
548
  return $content;
549
 
550
  }
551
-
552
  /**
553
- * Generate buttons html code with specified order
554
  *
555
- * @param mixed $order - order of social buttons
 
 
 
 
 
 
 
556
  */
557
- function generate_buttons_code( $order = null, $show_count = false, $show_total = false, $extra_class = '' ) {
558
 
559
- // define empty buttons code to use
560
  $ssb_buttonscode = '';
561
  // get post permalink and title
562
  $permalink = get_permalink();
563
- $title = urlencode( html_entity_decode( get_the_title(), ENT_COMPAT, 'UTF-8' ) );
564
- // $title = urlencode( get_the_title() );
 
565
  // Sorting the buttons
566
  $arrButtons = array();
567
  foreach ( $this->arrKnownButtons as $button_name ) {
@@ -574,10 +796,17 @@ class SimpleSocialButtonsPR {
574
 
575
  // add total share index in array.
576
  if ( $show_total ) {
577
- $arrButtons['totalshare'] = '100'; }
578
- $post_id = get_the_id();
 
 
 
 
 
 
 
579
 
580
- // get the value for http or https solve options
581
  $http_solve = false;
582
  if ( isset( $this->extra_option['http_https_resolve'] ) ) {
583
  if ( false == get_post_meta( $post_id, 'ssb_old_counts', true ) ) {
@@ -585,13 +814,20 @@ class SimpleSocialButtonsPR {
585
  }
586
  }
587
 
 
 
 
 
 
 
 
588
  // Reset the cache timestamp if needed
589
  // if false fetch the new share counts.
590
- if ( ( isset( $this->settings['cache'] ) && $this->settings['cache'] == 'off' ) || ( true == $http_solve ) ) {
591
 
592
  $_share_links = array();
593
  foreach ( $arrButtons as $social_name => $priority ) {
594
- if ( 'totalshare' == $social_name || 'viber' == $social_name || 'fblike' == $social_name || 'whatsapp' == $social_name || 'print' == $social_name || 'email' == $social_name || 'messenger' == $social_name ) {
595
  continue; }
596
  $_share_links[ $social_name ] = call_user_func( 'ssb_' . $social_name . '_generate_link', $permalink );
597
  }
@@ -604,7 +840,6 @@ class SimpleSocialButtonsPR {
604
 
605
  // $result = ssb_fetch_shares_via_curl_multi(
606
  // array(
607
- // 'linkedin' => ssb_linkedin_generate_link( 'https://wpbrigade.com/first-wordcamp-talk/' ),
608
  // 'fbshare' => ssb_fbshare_generate_link( 'https://propakistani.pk/2017/09/06/lahore-get-600-million-disneyland-like-amusement-park/' ),
609
  // 'twitter' => ssb_twitter_generate_link( 'https://wptavern.com/jetpack-5-3-adds-php-7-1-compatibility-better-control-for-wordads-placement' ),
610
  // 'pinterest' => ssb_pinterest_generate_link( 'http://websitehostingcost.com/tag/dedicated/' ),
@@ -630,7 +865,7 @@ class SimpleSocialButtonsPR {
630
  <span class="simplesocialtxt">Share </span>';
631
 
632
  if ( $show_count ) {
633
- $_html .= ' <span class="ssb_counter">' . $fbshare_share . '</span>';
634
  }
635
 
636
  $_html .= ' </button>';
@@ -639,7 +874,7 @@ class SimpleSocialButtonsPR {
639
  $_html = '<button class="simplesocial-fb-share" target="_blank" data-href="https://www.facebook.com/sharer/sharer.php?u=' . $permalink . '" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;"><span class="simplesocialtxt">Facebook </span> ';
640
 
641
  if ( $show_count ) {
642
- $_html .= '<span class="ssb_counter ssb_fbshare_counter">' . $fbshare_share . '</span>';
643
  }
644
  $_html .= '</button>';
645
  }
@@ -657,7 +892,7 @@ class SimpleSocialButtonsPR {
657
  <span class="icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72"><path fill="none" d="M0 0h72v72H0z"/><path class="icon" fill="#fff" d="M68.812 15.14c-2.348 1.04-4.87 1.744-7.52 2.06 2.704-1.62 4.78-4.186 5.757-7.243-2.53 1.5-5.33 2.592-8.314 3.176C56.35 10.59 52.948 9 49.182 9c-7.23 0-13.092 5.86-13.092 13.093 0 1.026.118 2.02.338 2.98C25.543 24.527 15.9 19.318 9.44 11.396c-1.125 1.936-1.77 4.184-1.77 6.58 0 4.543 2.312 8.552 5.824 10.9-2.146-.07-4.165-.658-5.93-1.64-.002.056-.002.11-.002.163 0 6.345 4.513 11.638 10.504 12.84-1.1.298-2.256.457-3.45.457-.845 0-1.666-.078-2.464-.23 1.667 5.2 6.5 8.985 12.23 9.09-4.482 3.51-10.13 5.605-16.26 5.605-1.055 0-2.096-.06-3.122-.184 5.794 3.717 12.676 5.882 20.067 5.882 24.083 0 37.25-19.95 37.25-37.25 0-.565-.013-1.133-.038-1.693 2.558-1.847 4.778-4.15 6.532-6.774z"/></svg></span>';
658
 
659
  if ( $show_count ) {
660
- $_html .= '<i class="simplesocialtxt">Tweet ' . $twitter_share . '</i>';
661
  } else {
662
  $_html .= '<i class="simplesocialtxt">Tweet </i>';
663
 
@@ -670,7 +905,7 @@ class SimpleSocialButtonsPR {
670
  $_html = '<button class="simplesocial-twt-share" data-href="https://twitter.com/share?text=' . $title . '&url=' . $permalink . '' . $via . '" rel="nofollow" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;"><span class="simplesocialtxt">Twitter</span> ';
671
 
672
  if ( $show_count ) {
673
- $_html .= '<span class="ssb_counter ssb_twitter_counter">' . $twitter_share . '</span>';
674
  }
675
  $_html .= '</button>';
676
  }
@@ -679,7 +914,7 @@ class SimpleSocialButtonsPR {
679
 
680
  break;
681
  case 'linkedin':
682
- $linkedin_share = $share_counts['linkedin'] ? $share_counts['linkedin'] : 0;
683
 
684
  if ( $this->selected_theme == 'simple-icons' ) {
685
 
@@ -687,17 +922,17 @@ class SimpleSocialButtonsPR {
687
  <span class="icon"> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="15px" height="14.1px" viewBox="-301.4 387.5 15 14.1" enable-background="new -301.4 387.5 15 14.1" xml:space="preserve"> <g id="XMLID_398_"> <path id="XMLID_399_" fill="#FFFFFF" d="M-296.2,401.6c0-3.2,0-6.3,0-9.5h0.1c1,0,2,0,2.9,0c0.1,0,0.1,0,0.1,0.1c0,0.4,0,0.8,0,1.2 c0.1-0.1,0.2-0.3,0.3-0.4c0.5-0.7,1.2-1,2.1-1.1c0.8-0.1,1.5,0,2.2,0.3c0.7,0.4,1.2,0.8,1.5,1.4c0.4,0.8,0.6,1.7,0.6,2.5 c0,1.8,0,3.6,0,5.4v0.1c-1.1,0-2.1,0-3.2,0c0-0.1,0-0.1,0-0.2c0-1.6,0-3.2,0-4.8c0-0.4,0-0.8-0.2-1.2c-0.2-0.7-0.8-1-1.6-1 c-0.8,0.1-1.3,0.5-1.6,1.2c-0.1,0.2-0.1,0.5-0.1,0.8c0,1.7,0,3.4,0,5.1c0,0.2,0,0.2-0.2,0.2c-1,0-1.9,0-2.9,0 C-296.1,401.6-296.2,401.6-296.2,401.6z"/> <path id="XMLID_400_" fill="#FFFFFF" d="M-298,401.6L-298,401.6c-1.1,0-2.1,0-3,0c-0.1,0-0.1,0-0.1-0.1c0-3.1,0-6.1,0-9.2 c0-0.1,0-0.1,0.1-0.1c1,0,2,0,2.9,0h0.1C-298,395.3-298,398.5-298,401.6z"/> <path id="XMLID_401_" fill="#FFFFFF" d="M-299.6,390.9c-0.7-0.1-1.2-0.3-1.6-0.8c-0.5-0.8-0.2-2.1,1-2.4c0.6-0.2,1.2-0.1,1.8,0.2 c0.5,0.4,0.7,0.9,0.6,1.5c-0.1,0.7-0.5,1.1-1.1,1.3C-299.1,390.8-299.4,390.8-299.6,390.9L-299.6,390.9z"/> </g> </svg> </span>
688
  <span class="simplesocialtxt">Share</span>';
689
 
690
- if ( $show_count ) {
691
- $_html .= ' <span class="ssb_counter">' . $linkedin_share . '</span>';
692
- }
693
  $_html .= ' </button>';
694
  } else {
695
 
696
  $_html = '<button target="popup" class="simplesocial-linkedin-share" data-href="https://www.linkedin.com/cws/share?url=' . get_permalink() . '" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;"><span class="simplesocialtxt">LinkedIn</span>';
697
 
698
- if ( $show_count ) {
699
- $_html .= '<span class="ssb_counter ssb_linkedin_counter">' . $linkedin_share . '</span>';
700
- }
701
  $_html .= '</button>';
702
  }
703
 
@@ -713,7 +948,7 @@ class SimpleSocialButtonsPR {
713
  <span class="icon"> <svg xmlns="http://www.w3.org/2000/svg" height="30px" width="30px" viewBox="-1 -1 31 31"><g><path d="M29.449,14.662 C29.449,22.722 22.868,29.256 14.75,29.256 C6.632,29.256 0.051,22.722 0.051,14.662 C0.051,6.601 6.632,0.067 14.75,0.067 C22.868,0.067 29.449,6.601 29.449,14.662" fill="#fff" stroke="#fff" stroke-width="1"></path><path d="M14.733,1.686 C7.516,1.686 1.665,7.495 1.665,14.662 C1.665,20.159 5.109,24.854 9.97,26.744 C9.856,25.718 9.753,24.143 10.016,23.022 C10.253,22.01 11.548,16.572 11.548,16.572 C11.548,16.572 11.157,15.795 11.157,14.646 C11.157,12.842 12.211,11.495 13.522,11.495 C14.637,11.495 15.175,12.326 15.175,13.323 C15.175,14.436 14.462,16.1 14.093,17.643 C13.785,18.935 14.745,19.988 16.028,19.988 C18.351,19.988 20.136,17.556 20.136,14.046 C20.136,10.939 17.888,8.767 14.678,8.767 C10.959,8.767 8.777,11.536 8.777,14.398 C8.777,15.513 9.21,16.709 9.749,17.359 C9.856,17.488 9.872,17.6 9.84,17.731 C9.741,18.141 9.52,19.023 9.477,19.203 C9.42,19.44 9.288,19.491 9.04,19.376 C7.408,18.622 6.387,16.252 6.387,14.349 C6.387,10.256 9.383,6.497 15.022,6.497 C19.555,6.497 23.078,9.705 23.078,13.991 C23.078,18.463 20.239,22.062 16.297,22.062 C14.973,22.062 13.728,21.379 13.302,20.572 C13.302,20.572 12.647,23.05 12.488,23.657 C12.193,24.784 11.396,26.196 10.863,27.058 C12.086,27.434 13.386,27.637 14.733,27.637 C21.95,27.637 27.801,21.828 27.801,14.662 C27.801,7.495 21.95,1.686 14.733,1.686" fill="#bd081c"></path></g></svg> </span>
714
  <span class="simplesocialtxt">Save</span>';
715
  if ( $show_count ) {
716
- $_html .= '<span class="ssb_counter">' . $pinterest_share . '</span>';
717
  }
718
  $_html .= ' </button>';
719
  } else {
@@ -721,7 +956,7 @@ class SimpleSocialButtonsPR {
721
  $_html = '<button rel="nofollow" class="simplesocial-pinterest-share" onclick="var e=document.createElement(\'script\');e.setAttribute(\'type\',\'text/javascript\');e.setAttribute(\'charset\',\'UTF-8\');e.setAttribute(\'src\',\'//assets.pinterest.com/js/pinmarklet.js?r=\'+Math.random()*99999999);document.body.appendChild(e);return false;" ><span class="simplesocialtxt">Pinterest</span>';
722
 
723
  if ( $show_count ) {
724
- $_html .= '<span class="ssb_counter ssb_pinterest_counter">' . $pinterest_share . '</span>';
725
  }
726
  $_html .= '</button>';
727
  }
@@ -731,7 +966,7 @@ class SimpleSocialButtonsPR {
731
  break;
732
  case 'totalshare':
733
  $total_share = $share_counts['total'] ? $share_counts['total'] : 0;
734
- $arrButtonsCode[] = "<span class='ssb_total_counter'>" . $total_share . '<span>Shares</span></span>';
735
  break;
736
  case 'reddit':
737
  $reddit_score = $share_counts['reddit'] ? $share_counts['reddit'] : 0;
@@ -743,7 +978,7 @@ class SimpleSocialButtonsPR {
743
  xml:space="preserve"> <g> <path id="reddit" d="M307.523,231.062c1.11,2.838,1.614,5.769,1.614,8.681c0,5.862-2.025,11.556-5.423,16.204 c-3.36,4.593-8.121,8.158-13.722,9.727h0.01c-0.047,0.019-0.094,0.019-0.117,0.037c-0.023,0-0.061,0.019-0.079,0.019 c-2.623,0.896-5.312,1.316-7.98,1.316c-6.254,0-12.396-2.254-17.306-6.096c-4.872-3.826-8.56-9.324-9.717-15.845h-0.01 c0-0.019,0-0.042-0.009-0.069c0-0.019,0-0.038-0.019-0.065h0.019c-0.364-1.681-0.551-3.36-0.551-5.021 c0-5.647,1.923-11.07,5.097-15.551c3.164-4.453,7.626-7.99,12.848-9.811c0.019,0,0.038-0.01,0.038-0.01 c0.027,0,0.027-0.027,0.051-0.027c2.954-1.092,6.072-1.639,9.157-1.639c5.619,0,11.154,1.704,15.821,4.821 c4.611,3.066,8.354,7.561,10.23,13.143c0.019,0.037,0.019,0.07,0.037,0.103c0,0.037,0.019,0.057,0.037,0.084H307.523z M290.329,300.349c-2.202-1.428-4.751-2.291-7.448-2.291c-2.175,0-4.434,0.621-6.445,1.955l0,0 c-19.004,11.342-41.355,17.558-63.547,17.558c-16.65,0-33.199-3.514-48.192-10.879l-0.077-0.037l-0.075-0.028 c-2.261-0.924-4.837-2.889-7.647-4.76c-1.428-0.925-2.919-1.844-4.574-2.521c-1.633-0.695-3.447-1.181-5.386-1.181 c-1.605,0-3.292,0.359-4.957,1.115c-0.086,0.033-0.168,0.065-0.252,0.098h0.009c-2.616,0.999-4.66,2.829-5.974,4.994 c-1.372,2.23-2.046,4.826-2.046,7.411c0,2.334,0.551,4.667,1.691,6.786c1.085,2.007,2.754,3.762,4.938,4.938 c21.429,14.454,46.662,21.002,71.992,20.979c22.838,0,45.814-5.287,66.27-14.911l0.107-0.065l0.103-0.056 c2.697-1.597,6.282-3.029,9.661-5.115c1.671-1.064,3.304-2.296,4.704-3.897c1.4-1.591,2.525-3.551,3.16-5.875v-0.01 c0.266-1.026,0.392-2.025,0.392-3.024c0-1.899-0.467-3.701-1.241-5.32C294.361,303.775,292.504,301.778,290.329,300.349z M139.875,265.589c0.037,0,0.086,0.014,0.128,0.037c2.735,0.999,5.554,1.493,8.345,1.493c6.963,0,13.73-2.852,18.853-7.5 c5.115-4.662,8.618-11.257,8.618-18.775c0-0.196,0-0.392-0.009-0.625c0.019-0.336,0.028-0.705,0.028-1.083 c0-7.458-3.456-14.08-8.522-18.762c-5.085-4.686-11.836-7.551-18.825-7.551c-1.867,0-3.769,0.219-5.628,0.653 c-0.028,0-0.049,0.009-0.077,0.009c0,0-0.019,0-0.028,0c-9.252,1.937-17.373,8.803-20.37,18.248l0,0v0.01 c0,0.019-0.009,0.037-0.009,0.037c-0.861,2.586-1.262,5.255-1.262,7.896c0,5.787,1.913,11.426,5.211,16.064 c3.269,4.56,7.894,8.145,13.448,9.819C139.816,265.561,139.835,265.571,139.875,265.589z M430.033,198.094v0.038 c0.066,0.94,0.084,1.878,0.084,2.81c0,10.447-3.351,20.493-8.941,29.016c-5.218,7.976-12.414,14.649-20.703,19.177 c0.532,4.158,0.84,8.349,0.84,12.526c-0.01,22.495-7.766,44.607-21.272,62.329v0.009h-0.028 c-24.969,33.216-63.313,52.804-102.031,62.684h-0.01l-0.027,0.023c-20.647,5.013-41.938,7.574-63.223,7.574 c-31.729,0-63.433-5.722-93.018-17.585l-0.009-0.028h-0.028c-30.672-12.643-59.897-32.739-77.819-62.184 c-9.642-15.71-14.935-34.141-14.935-52.659c0-4.19,0.283-8.387,0.843-12.536c-8.072-4.545-15.063-10.99-20.255-18.687 c-5.542-8.266-9.056-17.95-9.5-28.187v-0.04v-0.037v-0.082c0.009-14.337,6.237-27.918,15.915-37.932 c9.677-10.011,22.896-16.554,37.075-16.554c0.196,0,0.392,0,0.588,0c1.487-0.101,2.987-0.159,4.488-0.159 c7.122,0,14.26,1.153,21.039,3.752l0.037,0.028l0.038,0.012c5.787,2.437,11.537,5.377,16.662,9.449 c1.661-0.871,3.472-1.851,5.504-2.625c31.064-18.395,67.171-25.491,102.358-27.538c0.306-17.431,2.448-35.68,10.949-51.65 c7.08-13.269,19.369-23.599,34-27.179l0.061-0.03l0.079-0.009c5.573-1.078,11.192-1.575,16.774-1.575 c14.869,0,29.561,3.521,43.31,9.017c6.086-9.185,14.776-16.354,24.97-20.375l0.098-0.056l0.098-0.037 c5.983-1.864,12.303-2.954,18.646-2.954c6.692,0,13.437,1.223,19.756,4.046v-0.023c0.009,0.023,0.019,0.023,0.019,0.023 c0.047,0.016,0.084,0.044,0.116,0.044c9.059,3.489,16.727,9.937,22.164,17.95c5.442,8.048,8.644,17.688,8.644,27.599 c0,1.827-0.103,3.657-0.317,5.489l-0.019,0.037c0,0.028,0,0.068-0.01,0.096c-1.063,12.809-7.551,24.047-16.736,32.063 c-9.24,8.048-21.207,12.909-33.49,12.909c-1.97,0-3.958-0.11-5.937-0.374c-12.182-0.931-23.541-6.826-31.886-15.595 c-8.373-8.755-13.768-20.453-13.768-33.08c0-0.611,0.056-1.237,0.074-1.843c-11.435-5.092-23.578-9.316-35.646-9.306 c-1.746,0-3.491,0.096-5.237,0.273h-0.019c-9.035,0.871-17.436,6.566-21.506,14.757v0.009v0.028 c-6.179,12.034-7.411,26.101-7.598,40.064c34.639,2.259,69.483,10.571,100.043,28.138h0.047l0.438,0.259 c0.579,0.343,1.652,0.931,2.623,1.449c2.101-1.704,4.322-3.456,6.856-4.966c9.264-6.17,20.241-9.238,31.223-9.238 c4.872,0,9.749,0.621,14.481,1.834h0.019l0.196,0.058c0.07,0.01,0.121,0.033,0.178,0.033v0.009 c11.183,2.845,21.3,9.267,28.917,17.927c7.612,8.674,12.731,19.648,13.73,31.561v0.025H430.033z M328.002,84.733 c0,0.469,0.01,0.95,0.057,1.44v0.028v0.056c0.224,6.018,3.065,11.619,7.383,15.756c4.34,4.14,10.1,6.702,15.942,6.725h0.08h0.079 c0.42,0.033,0.85,0.033,1.26,0.033c5.899,0.009,11.752-2.532,16.148-6.655c4.405-4.144,7.309-9.78,7.542-15.849l0.009-0.028v-0.037 c0.038-0.464,0.057-0.903,0.057-1.377c0-6.247-2.922-12.202-7.496-16.612c-4.555-4.406-10.688-7.136-16.735-7.12 c-1.951,0-3.884,0.266-5.778,0.854l-0.065,0.005l-0.056,0.023c-4.984,1.295-9.656,4.368-13.012,8.449 C330.046,74.486,328.002,79.508,328.002,84.733z M72.312,177.578c-4.63-2.156-9.418-3.696-14.15-3.676 c-0.794,0-1.597,0.047-2.39,0.133h-0.11l-0.11,0.014c-6.795,0.187-13.653,3.15-18.801,7.899 c-5.152,4.732-8.559,11.122-8.821,18.167v0.065l-0.012,0.058c-0.046,0.57-0.065,1.137-0.065,1.683 c0,4.345,1.333,8.545,3.593,12.368c1.673,2.847,3.867,5.441,6.348,7.701C45.735,204.602,58.142,189.845,72.312,177.578z M374.066,262.635c0-15.5-5.592-31.069-14.646-43.604c-18.053-25.119-46.055-41.502-75.187-50.636l-0.205-0.072 c-5.592-1.715-11.238-3.234-16.933-4.534c-17.025-3.876-34.48-5.806-51.917-5.806c-23.414,0-46.827,3.465-69.245,10.379 c-29.125,9.243-57.221,25.51-75.233,50.71v0.019c-9.129,12.587-14.475,28.208-14.475,43.763c0,5.727,0.716,11.453,2.23,17.025 l0.019,0.01c3.278,12.508,9.689,23.671,17.989,33.393c8.295,9.745,18.472,18.058,29.176,24.839c2.371,1.47,4.751,2.87,7.187,4.237 c31.094,17.356,66.898,24.964,102.445,24.964c6.012,0,12.06-0.214,18.033-0.644c35.797-2.959,71.742-13.525,100.8-35.115 l0.01-0.023c9.25-6.837,17.818-15.112,24.595-24.525c6.805-9.418,11.789-19.947,14.002-31.382V275.6l0.009-0.01 C373.627,271.32,374.066,266.985,374.066,262.635z M402.32,200.95c-0.009-3.762-0.868-7.507-2.753-11l-0.047-0.044l-0.019-0.056 c-2.521-5.19-6.479-9.11-11.248-11.782c-4.77-2.69-10.352-4.056-15.952-4.056c-5.063,0-10.1,1.132-14.57,3.379 c14.216,12.344,26.687,27.179,34.746,44.636c2.595-2.259,4.808-5.018,6.464-8.084C401.098,209.92,402.32,205.405,402.32,200.95z"/></svg></span>
744
  <span class="simplesocialtxt">reddit </span>';
745
  if ( $show_count ) {
746
- $_html .= '<span class="ssb_counter">' . $reddit_score . '</span>';
747
  }
748
 
749
  $_html .= '</button>';
@@ -751,7 +986,7 @@ class SimpleSocialButtonsPR {
751
  $_html = '<button class="simplesocial-reddit-share" data-href="https://reddit.com/submit?url=' . $permalink . '&title=' . $title . '" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;" ><span class="simplesocialtxt">Reddit</span> ';
752
 
753
  if ( $show_count ) {
754
- $_html .= '<span class="ssb_counter ssb_reddit_counter">' . $reddit_score . '</span>';
755
  }
756
  $_html .= '</button>';
757
 
@@ -782,10 +1017,9 @@ class SimpleSocialButtonsPR {
782
  }
783
  break;
784
  case 'fblike':
785
- $_html = '<div class="fb-like ssb-fb-like" data-href="' . $permalink . '" data-layout="button_count" data-action="like" data-size="small" data-show-faces="false" data-share="false"></div>';
786
-
787
  $arrButtonsCode[] = $_html;
788
-
789
  break;
790
  case 'messenger':
791
  $link = urlencode( $permalink );
@@ -842,7 +1076,7 @@ class SimpleSocialButtonsPR {
842
  width="12.6px" height="17.8px" viewBox="-299.1 388.3 12.6 17.8" style="enable-background:new -299.1 388.3 12.6 17.8;" xml:space="preserve"><g> <path fill="#FFFFFF" d="M-294.7,388.3c1.1,0,2.1,0,3.2,0c0,1.5,0,2.9,0,4.4c1.7,0,3.3,0,5,0c0,1.1,0,2.2,0,3.4c-1.7,0-3.3,0-5,0 c0,0.1,0,0.2,0,0.2c0,1.6,0,3.2,0,4.8c0,1.2,0.6,1.8,1.8,2c1.1,0.1,2.1,0,3-0.5c0.1,0,0.1-0.1,0.2-0.1c0,0.1,0,0.1,0,0.2 c0,0.8,0,1.5,0,2.3c0,0.1,0,0.2-0.2,0.3c-1.6,0.6-3.2,0.9-5,0.8c-1-0.1-2-0.3-2.9-0.8c-1.2-0.7-1.8-1.7-1.8-3.1c0-2.1,0-4.1,0-6.2 c0-0.1,0-0.2,0-0.3c-0.9,0-1.8,0-2.7,0c0-0.1,0-0.1,0-0.2c0-0.7,0-1.5,0-2.2c0-0.1,0-0.2,0.2-0.2c0.3-0.1,0.7-0.2,1-0.3 c1.6-0.6,2.6-1.8,3-3.5c0-0.1,0.1-0.3,0.1-0.4C-294.8,388.6-294.7,388.4-294.7,388.3z"/> </g> </svg> </span>
843
  <span class="simplesocialtxt">tumblr </span>';
844
  if ( $show_count ) {
845
- $_html .= '<span class="ssb_counter">' . $tumblr_score . '</span>';
846
  }
847
 
848
  $_html .= '</button>';
@@ -850,7 +1084,7 @@ class SimpleSocialButtonsPR {
850
  $_html = '<button class="simplesocial-tumblr-share" data-href="' . $tumblr_share_url . '" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;" ><span class="simplesocialtxt">Tumblr</span> ';
851
 
852
  if ( $show_count ) {
853
- $_html .= '<span class="ssb_counter ssb_tumblr_counter">' . $tumblr_score . '</span>';
854
  }
855
  $_html .= '</button>';
856
 
@@ -862,11 +1096,15 @@ class SimpleSocialButtonsPR {
862
  }
863
 
864
  if ( count( $arrButtonsCode ) > 0 ) {
865
-
866
- $ssb_buttonscode .= '<div class="simplesocialbuttons simplesocial-' . $this->selected_theme . ' ' . $extra_class . '">' . "\n";
 
 
 
 
 
867
  $ssb_buttonscode .= implode( "\n", $arrButtonsCode ) . "\n";
868
  $ssb_buttonscode .= '</div>' . "\n";
869
-
870
  }
871
  return $ssb_buttonscode;
872
  }
@@ -877,9 +1115,11 @@ class SimpleSocialButtonsPR {
877
  * @param string $option Name of option.
878
  * @param boolean $default Default value.
879
  *
 
 
880
  * @since 2.0
881
  */
882
- function get_option( $option, $default = false ) {
883
  if ( isset( $this->settings[ $option ] ) ) {
884
  return $this->settings[ $option ];
885
  } else {
@@ -887,7 +1127,14 @@ class SimpleSocialButtonsPR {
887
  }
888
  }
889
 
890
- function get_post_type() {
 
 
 
 
 
 
 
891
 
892
  if ( is_home() || is_front_page() ) {
893
  return 'home';
@@ -900,9 +1147,11 @@ class SimpleSocialButtonsPR {
900
  /**
901
  * Add Buttons on SideBar.
902
  *
 
903
  * @since 2.0
 
904
  */
905
- function include_sidebar() {
906
 
907
  // Return Content if hide ssb.
908
  if ( get_post_meta( get_the_id(), $this->hideCustomMetaKey, true ) == 'true' ) {
@@ -932,21 +1181,30 @@ class SimpleSocialButtonsPR {
932
 
933
  $class .= ' simplesocialbuttons-slide-' . $this->_get_settings( 'sidebar', 'animation', 'no-animation' );
934
  $_selected_network = apply_filters( 'ssb_sidebar_social_networks', $this->selected_networks );
935
- echo $this->generate_buttons_code( $_selected_network, $show_count, $show_total, $class );
936
  }
937
  }
938
  }
939
 
940
- function css_file() {
 
 
 
 
 
 
 
941
  include_once dirname( __FILE__ ) . '/inc/custom-css.php';
942
  }
943
 
944
  /**
945
  * Update option when user click on dismiss button.
946
  *
 
947
  * @since 2.0.0
 
948
  */
949
- function review_update_notice() {
950
 
951
  if ( ! is_admin() ||
952
  ! current_user_can( 'manage_options' ) ||
@@ -966,9 +1224,10 @@ class SimpleSocialButtonsPR {
966
  /**
967
  * Show 2.0 Update Notice.
968
  *
 
969
  * @since 2.0.0
970
  */
971
- function update_notice() {
972
  // delete_option( 'ssb_update_2_0_dismiss' );
973
  if ( get_option( 'ssb_update_2_0_dismiss' ) ) {
974
  return; }
@@ -1006,9 +1265,11 @@ class SimpleSocialButtonsPR {
1006
  /**
1007
  * Add Facebook Like script.
1008
  *
 
1009
  * @since 2.0.4
 
1010
  */
1011
- function fblike_script() {
1012
 
1013
  if ( ! array_key_exists( 'fblike', array_filter( $this->selected_networks ) ) ) {
1014
  return;
@@ -1031,10 +1292,11 @@ class SimpleSocialButtonsPR {
1031
  *
1032
  * @param $atts
1033
  *
 
1034
  * @since 2.0.2
1035
  * @return string
1036
  */
1037
- function short_code_content( $atts ) {
1038
 
1039
  /*
1040
  counter = true,false
@@ -1086,6 +1348,8 @@ class SimpleSocialButtonsPR {
1086
  if ( null !== $selected_theme['order'] ) {
1087
  $selected_theme['order'] = array_flip( array_merge( array( 0 ), explode( ',', $selected_theme['order'] ) ) );
1088
 
 
 
1089
  }
1090
 
1091
  if ( isset( $this->selected_position['inline'] ) ) {
@@ -1117,8 +1381,14 @@ class SimpleSocialButtonsPR {
1117
 
1118
  $extra_class .= ' simplesocialbuttons-inline-' . $this->_get_settings( 'inline', 'animation', 'no-animation' );
1119
 
1120
- $ssb_buttons_code = $this->generate_buttons_short_code( $theme, $like_button_size, $selected_theme['order'], $this->selected_networks, $show_count, $show_total, $extra_class );
 
 
 
 
 
1121
 
 
1122
  }
1123
 
1124
  return $ssb_buttons_code;
@@ -1128,11 +1398,13 @@ class SimpleSocialButtonsPR {
1128
  /**
1129
  * Generate buttons html code with specified order for short code
1130
  *
1131
- * @since 2.0.2
1132
- *
1133
  * @param mixed $order - order of social buttons
 
 
 
 
1134
  */
1135
- function generate_buttons_short_code( $short_code_theme, $like_button_size, $short_code_order, $order = null, $show_count = false, $show_total = false, $extra_class = '' ) {
1136
 
1137
  // googleplus,fbshare,twitter,pinterest,whatsapp,viber,reddit,linkedin,messenger,email,print
1138
  // define empty buttons code to use
@@ -1189,7 +1461,7 @@ class SimpleSocialButtonsPR {
1189
  $_share_links = array();
1190
  $_alt_share_links = array();
1191
  foreach ( $arrButtons as $social_name => $priority ) {
1192
- if ( 'totalshare' == $social_name || 'viber' == $social_name || 'fblike' == $social_name || 'whatsapp' == $social_name || 'print' == $social_name || 'email' == $social_name || 'messenger' == $social_name ) {
1193
  continue;
1194
  }
1195
  $_share_links[ $social_name ] = call_user_func( 'ssb_' . $social_name . '_generate_link', $permalink );
@@ -1266,7 +1538,7 @@ class SimpleSocialButtonsPR {
1266
 
1267
  break;
1268
  case 'linkedin':
1269
- $linkedin_share = $share_counts['linkedin'] ? $share_counts['linkedin'] : 0;
1270
 
1271
  if ( $this->selected_theme == 'simple-icons' ) {
1272
 
@@ -1275,17 +1547,17 @@ class SimpleSocialButtonsPR {
1275
  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="15px" height="14.1px" viewBox="-301.4 387.5 15 14.1" enable-background="new -301.4 387.5 15 14.1" xml:space="preserve"> <g id="XMLID_398_"> <path id="XMLID_399_" fill="#FFFFFF" d="M-296.2,401.6c0-3.2,0-6.3,0-9.5h0.1c1,0,2,0,2.9,0c0.1,0,0.1,0,0.1,0.1c0,0.4,0,0.8,0,1.2 c0.1-0.1,0.2-0.3,0.3-0.4c0.5-0.7,1.2-1,2.1-1.1c0.8-0.1,1.5,0,2.2,0.3c0.7,0.4,1.2,0.8,1.5,1.4c0.4,0.8,0.6,1.7,0.6,2.5 c0,1.8,0,3.6,0,5.4v0.1c-1.1,0-2.1,0-3.2,0c0-0.1,0-0.1,0-0.2c0-1.6,0-3.2,0-4.8c0-0.4,0-0.8-0.2-1.2c-0.2-0.7-0.8-1-1.6-1 c-0.8,0.1-1.3,0.5-1.6,1.2c-0.1,0.2-0.1,0.5-0.1,0.8c0,1.7,0,3.4,0,5.1c0,0.2,0,0.2-0.2,0.2c-1,0-1.9,0-2.9,0 C-296.1,401.6-296.2,401.6-296.2,401.6z"/> <path id="XMLID_400_" fill="#FFFFFF" d="M-298,401.6L-298,401.6c-1.1,0-2.1,0-3,0c-0.1,0-0.1,0-0.1-0.1c0-3.1,0-6.1,0-9.2 c0-0.1,0-0.1,0.1-0.1c1,0,2,0,2.9,0h0.1C-298,395.3-298,398.5-298,401.6z"/> <path id="XMLID_401_" fill="#FFFFFF" d="M-299.6,390.9c-0.7-0.1-1.2-0.3-1.6-0.8c-0.5-0.8-0.2-2.1,1-2.4c0.6-0.2,1.2-0.1,1.8,0.2 c0.5,0.4,0.7,0.9,0.6,1.5c-0.1,0.7-0.5,1.1-1.1,1.3C-299.1,390.8-299.4,390.8-299.6,390.9L-299.6,390.9z"/></g></svg> </span>
1276
  <span class="simplesocialtxt">Share</span>';
1277
 
1278
- if ( $show_count ) {
1279
- $_html .= ' <span class="ssb_counter">' . $linkedin_share . '</span>';
1280
- }
1281
  $_html .= ' </button>';
1282
  } else {
1283
 
1284
  $_html = '<button target="popup" class="simplesocial-linkedin-share" data-href="https://www.linkedin.com/cws/share?url=' . get_permalink() . '" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;"><span class="simplesocialtxt">LinkedIn</span>';
1285
 
1286
- if ( $show_count ) {
1287
- $_html .= '<span class="ssb_counter ssb_linkedin_counter">' . $linkedin_share . '</span>';
1288
- }
1289
  $_html .= '</button>';
1290
  }
1291
 
@@ -1465,13 +1737,15 @@ class SimpleSocialButtonsPR {
1465
 
1466
 
1467
  /**
1468
- * Add Meta Tags
1469
  *
1470
  * @param int $post_id
 
 
1471
  * @since 2.0.9
1472
  * @return string
1473
  */
1474
- function add_meta_tags() {
1475
 
1476
  if ( class_exists( 'Jetpack' ) ) { // Check jetpack active.
1477
  return;
@@ -1507,15 +1781,37 @@ class SimpleSocialButtonsPR {
1507
  }
1508
 
1509
 
1510
- function og_get_title() {
 
 
 
 
 
 
 
1511
  return get_the_title() . ' - ' . get_bloginfo( 'name' );
1512
  }
1513
 
1514
- function og_get_description() {
 
 
 
 
 
 
 
1515
  return $this->get_excerpt_by_id( get_the_id() );
1516
  }
1517
 
1518
- function og_get_blog() {
 
 
 
 
 
 
 
 
1519
  return get_bloginfo( 'name' );
1520
  }
1521
 
@@ -1524,10 +1820,12 @@ class SimpleSocialButtonsPR {
1524
  * Get the excerpt
1525
  *
1526
  * @param int $post_id
 
 
1527
  * @since 2.0.9
1528
  * @return string
1529
  */
1530
- function get_excerpt_by_id( $post_id ) {
1531
 
1532
  if ( ! $post_id ) {
1533
  return;
@@ -1552,10 +1850,13 @@ class SimpleSocialButtonsPR {
1552
  }
1553
 
1554
  /**
1555
- * Get Image from content.
1556
  *
 
1557
  * @since 2.0.10
 
1558
  */
 
1559
  public function get_content_images( $post ) {
1560
 
1561
  if ( ! $post ) {
@@ -1575,11 +1876,13 @@ class SimpleSocialButtonsPR {
1575
  }
1576
 
1577
 
1578
- /**
1579
- * Get the featured image.
1580
- *
1581
- * @since 2.0.10
1582
- */
 
 
1583
  public function generate_og_image() {
1584
  $_post_id = get_the_ID();
1585
 
@@ -1590,11 +1893,13 @@ class SimpleSocialButtonsPR {
1590
  return $this->get_content_images( get_post( $_post_id ) );
1591
  }
1592
 
1593
- /**
1594
- * Get Open Graph image.
1595
- *
1596
- * @since 2.0.10
1597
- */
 
 
1598
  public function get_og_image() {
1599
  $image = $this->generate_og_image();
1600
 
@@ -1603,11 +1908,13 @@ class SimpleSocialButtonsPR {
1603
  }
1604
  }
1605
 
1606
- /**
1607
- * Get the featured image for Twitter.
1608
- *
1609
- * @since 2.0.10
1610
- */
 
 
1611
  public function generate_twitter_image() {
1612
  $_post_id = get_the_ID();
1613
 
@@ -1618,11 +1925,15 @@ class SimpleSocialButtonsPR {
1618
  return $this->get_twitter_content_images( get_post( $_post_id ) );
1619
  }
1620
 
1621
- /**
1622
- * Get Image from content for Twitter.
1623
- *
1624
- * @since 2.0.10
1625
- */
 
 
 
 
1626
  public function get_twitter_content_images( $post ) {
1627
 
1628
  if ( ! $post ) {
@@ -1641,13 +1952,15 @@ class SimpleSocialButtonsPR {
1641
  return $images;
1642
  }
1643
 
1644
- /**
1645
- * User to convert http to https or vice versa
1646
- *
1647
- * @since 2.0.12
1648
- * @param $url
1649
- * @return url
1650
- */
 
 
1651
  public function http_or_https_resolve_url( $url ) {
1652
 
1653
  $arr_parsed_url = parse_url( $url );
@@ -1663,16 +1976,18 @@ class SimpleSocialButtonsPR {
1663
 
1664
 
1665
  /**
1666
- * convert url http to https or vice versa
1667
  *
1668
  * @param $permalink
 
 
1669
  * @since 2.0.14
1670
  * @return mixed
1671
  */
1672
- function http_or_https_link_generate( $permalink ) {
1673
 
1674
  foreach ( $this->arrKnownButtons as $social_name ) {
1675
- if ( 'totalshare' == $social_name || 'viber' == $social_name || 'fblike' == $social_name || 'whatsapp' == $social_name || 'print' == $social_name || 'email' == $social_name || 'messenger' == $social_name ) {
1676
  continue; }
1677
  $url = $this->http_or_https_resolve_url( $permalink );
1678
  // get alt hurl to cover http or https issue
@@ -1684,13 +1999,17 @@ class SimpleSocialButtonsPR {
1684
  /**
1685
  * Function use to remove button names on excerpt if above the content selecetd .
1686
  *
1687
- * @param [string] $text already excertp set.
1688
- * @param [int] $num_words word in excerpt.
1689
- * @param [string $more more srting apprend in last of the excerpt sring.
1690
- * @param [string] $original_text original text of the string.
1691
- * @return [string] $text string of excerpt;
 
 
 
 
1692
  */
1693
- function on_excerpt_content( $text, $num_words, $more, $original_text ) {
1694
 
1695
  if ( empty( $text ) ) {
1696
  return $text;
@@ -1754,11 +2073,15 @@ class SimpleSocialButtonsPR {
1754
  }
1755
 
1756
  /**
1757
- * check is ssb on with position and post type
1758
  *
 
 
 
1759
  * @version 2.0.21
 
1760
  */
1761
- function is_ssb_on( $position ) {
1762
 
1763
  $is_ajax_callback = true;
1764
  if ( ! in_array( $this->get_post_type(), $this->_get_settings( $position, 'posts', array() ) ) ) {
@@ -1768,7 +2091,24 @@ class SimpleSocialButtonsPR {
1768
  return $is_ajax_callback;
1769
 
1770
  }
1771
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1772
 
1773
 
1774
  } // end class
3
  * Plugin Name: Simple Social Buttons
4
  * Plugin URI: http://www.WPBrigade.com/wordpress/plugins/simple-social-buttons/
5
  * Description: Simple Social Buttons adds an advanced set of social media sharing buttons to your WordPress sites, such as: Google +1, Facebook, WhatsApp, Viber, Twitter, Reddit, LinkedIn and Pinterest. This makes it the most <code>Flexible Social Sharing Plugin ever for Everyone.</code>
6
+ * Version: 2.1.4
7
  * Author: WPBrigade
8
  * Author URI: http://www.WPBrigade.com/
9
  * Text Domain: simple-social-buttons
29
 
30
 
31
  class SimpleSocialButtonsPR {
32
+
33
+ /**
34
+ * Plugin name
35
+ *
36
+ * @since 1.0.0
37
+ * @var string
38
+ */
39
+ public $pluginName = 'Simple Social Buttons';
40
+
41
+ /**
42
+ * Plugin Version
43
+ *
44
+ * @isnce
45
+ * @var string
46
+ */
47
+ public $pluginVersion = '2.1.4';
48
+
49
+ /**
50
+ * Plugin Prefix
51
+ *
52
+ * @since 1.0.0
53
+ * @var string
54
+ */
55
+ public $pluginPrefix = 'ssb_pr_';
56
+
57
+ /**
58
+ * SSB hide on single plage setting key.
59
+ *
60
+ * @since 1.0.0
61
+ * @var string
62
+ */
63
  public $hideCustomMetaKey = '_ssb_hide';
 
64
 
65
+ /**
66
+ * Facebook api key for graph api.
67
+ *
68
+ * @since 1.0.0
69
+ * @var string
70
+ */
71
+ private $fb_app_id = '891268654262273';
72
+
73
+ /**
74
+ * Plugin default setting.
75
+ *
76
+ * @since 1.0.0
77
+ * @var array
78
+ */
79
  public $pluginDefaultSettings = array(
80
  'twitter' => '3',
81
  'pinterest' => '0',
91
  'cache' => 'on',
92
  );
93
 
94
+ /**
95
+ * SSB all networks
96
+ *
97
+ * @since 1.0.0
98
+ * @var array
99
+ */
100
  public $arrKnownButtons = array( 'twitter', 'pinterest', 'fbshare', 'linkedin', 'reddit', 'whatsapp', 'viber', 'fblike', 'messenger', 'email', 'print', 'tumblr' );
101
 
102
+ /**
103
+ * Array to store current settings, to avoid passing them between functions.
104
+ *
105
+ * @since 1.0.0
106
+ * @var array
107
+ */
108
  public $settings = array();
109
 
110
+ /**
111
+ * User selected networks.
112
+ *
113
+ * @since 1.0.0
114
+ * @var array
115
+ */
116
  public $selected_networks = array();
117
+
118
+ /**
119
+ * User selected themes.
120
+ *
121
+ * @since 1.0.0
122
+ * @var string
123
+ */
124
+ public $selected_theme = '';
125
+
126
+ /**
127
+ * User selected position to show icons.
128
+ *
129
+ * @since 1.0.0
130
+ * @var string
131
+ */
132
  public $selected_position = '';
133
+
134
+ /**
135
+ * Inline postion user settings.
136
+ *
137
+ * @since 1.0.0
138
+ * @var string
139
+ */
140
+ public $inline_option = '';
141
+
142
+ /**
143
+ * Sidebar position setting.
144
+ *
145
+ * @since 1.0.0
146
+ * @var string
147
+ */
148
+ public $sidebar_option = '';
149
+
150
+ /**
151
+ * Advance settings.
152
+ *
153
+ * @since 1.0.0
154
+ * @var string
155
+ */
156
+ public $extra_option = '';
157
 
158
  /**
159
  * Constructor
191
 
192
  add_action( 'wp_enqueue_scripts', array( $this, 'front_enqueue_scripts' ) );
193
 
194
+ add_filter( 'network_admin_plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'filter_plugin_action_links' ) );
195
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'filter_plugin_action_links' ) );
196
+
197
  // Queue up our hook function
198
  add_action( 'wp_footer', array( $this, 'ssb_footer_functions' ), 99 );
199
 
217
 
218
  }
219
 
220
+ /**
221
+ * Setter function to set user selected networks.
222
+ *
223
+ * @access public
224
+ * @since 1.0.0
225
+ * @return void
226
+ */
227
+ public function set_selected_networks() {
228
  $networks = get_option( 'ssb_networks' );
229
  $this->selected_networks = array_flip( array_merge( array( 0 ), explode( ',', $networks['icon_selection'] ) ) );
230
  }
231
 
232
+ /**
233
+ * Set user selected theme.
234
+ *
235
+ * @access public
236
+ * @since 1.0.0
237
+ * @return void
238
+ */
239
+ public function set_selected_theme() {
240
  $theme = get_option( 'ssb_themes' );
241
  $this->selected_theme = $theme['icon_style'];
242
 
243
  }
244
 
245
+ /**
246
+ * Set network position to show
247
+ *
248
+ * @access public
249
+ * @since 1.0.0
250
+ * @return void
251
+ */
252
+ public function set_selected_position() {
253
  $theme = get_option( 'ssb_positions' );
254
  $this->selected_position = $theme['position'];
255
  }
256
 
257
+ /**
258
+ * Set inline position setting.
259
+ *
260
+ * @access public
261
+ * @since 1.0.0
262
+ * @return void
263
+ */
264
+ public function set_inline_option() {
265
  $this->inline_option = get_option( 'ssb_inline' );
266
  }
267
 
268
+ /**
269
+ * Set sidebar position settings.
270
+ *
271
+ * @access public
272
+ * @since 1.0.0
273
+ * @return void
274
+ */
275
+ public function set_sidebar_option() {
276
  $this->sidebar_option = get_option( 'ssb_sidebar' );
277
  }
278
 
279
 
280
+ /**
281
+ * Set advance settings.
282
+ *
283
+ * @access public
284
+ * @since 1.0.0
285
+ * @return void
286
+ */
287
+ public function set_extra_option() {
288
  $this->extra_option = get_option( 'ssb_advanced' );
289
  }
290
 
291
+ /**
292
+ * Ajax callback function get fresh count.
293
+ *
294
+ * @access public
295
+ * @since 1.0.0
296
+ * @return void
297
+ */
298
+ public function ajax_fetch_fresh_data() {
299
 
300
  $order = array();
301
+ $post_id = (int) $_POST['postID'];
302
  foreach ( $this->arrKnownButtons as $button_name ) {
303
 
304
  if ( isset( $this->selected_networks[ $button_name ] ) && $this->selected_networks[ $button_name ] > 0 ) {
308
 
309
  $_share_links = array();
310
  foreach ( $order as $social_name => $priority ) {
311
+ if ( ! is_network_has_counts( $social_name ) ) {
312
  continue; }
313
  $_share_links[ $social_name ] = call_user_func( 'ssb_' . $social_name . '_generate_link', get_permalink( $post_id ) );
314
  }
328
  // );
329
  $share_counts = ssb_fetch_fresh_counts( $result, $post_id, $_alt_share_links );
330
 
331
+ // var_dump( $share_counts );
332
  update_post_meta( $post_id, 'ssb_cache_timestamp', floor( ( ( date( 'U' ) / 60 ) / 60 ) ) );
333
+
334
+ $raw_share_counts = $share_counts;
335
+ foreach ( $share_counts as $key => $value ) {
336
+ $share_counts[ $key ] = ssb_count_format( $value );
337
+ }
338
+ $share_counts['raw'] = $raw_share_counts;
339
  echo json_encode( $share_counts );
340
  wp_die();
341
  }
342
 
343
+ /**
344
+ * Front end count refresh ajax callback.
345
+ *
346
+ * @access public
347
+ * @param array $info information about post/page.
348
+ * @return void
349
+ */
350
+ public function ssb_output_cache_trigger( $info ) {
351
 
352
  // Return early if we're not on a single page or we have fresh cache.
353
  if ( ( ssb_is_cache_fresh( $info['postID'], true ) ) && empty( $_GET['ssb_cache'] ) ) {
387
  };
388
  jQuery.post(ssb_admin_ajax, data, function(data, textStatus, xhr) {
389
  var array = JSON.parse(data);
390
+ console.log( array );
391
  jQuery.each( array, function( index, value ){
392
 
393
  if( index == 'total' ){
430
  }
431
 
432
 
433
+ /**
434
+ * SSB footer injection script.
435
+ *
436
+ * @access public
437
+ * @since 1.0.0
438
+ * @return void
439
+ */
440
+ public function ssb_footer_functions() {
441
  // Check it is 404 page or not single (page/post)
442
  if ( is_404() || ! is_singular() ) {
443
  return false;
473
 
474
 
475
 
476
+ /**
477
+ * Front enqueue script.
478
+ *
479
+ * @access public
480
+ * @since 1.0.0
481
+ * @return void
482
+ */
483
+ public function front_enqueue_scripts() {
484
 
485
  wp_enqueue_script( 'jquery' );
486
  wp_enqueue_script( 'ssb-front-js', plugins_url( 'assets/js/front.js', __FILE__ ), array( 'jquery' ), SSB_VERSION );
488
  }
489
 
490
  /**
491
+ * All third party api/ helper functions.
492
  *
493
+ * @access public
494
  * @since 2.0
495
+ * @return void
496
  */
497
+ public function _includes() {
498
 
499
  include_once SSB_PLUGIN_DIR . '/inc/utils.php';
500
  include_once SSB_PLUGIN_DIR . '/ssb-social-counts/facebook.php';
501
+ // include_once SSB_PLUGIN_DIR . '/ssb-social-counts/linkedin.php';
502
  include_once SSB_PLUGIN_DIR . '/ssb-social-counts/twitter.php';
503
  include_once SSB_PLUGIN_DIR . '/ssb-social-counts/pinterest.php';
504
  include_once SSB_PLUGIN_DIR . '/ssb-social-counts/reddit.php';
506
  }
507
 
508
 
509
+ /**
510
+ * Load plugin text domain.
511
+ *
512
+ * @access public
513
+ * @since 1.0.0
514
+ * @return void
515
+ */
516
+ public function load_plugin_domain() {
517
  load_plugin_textdomain( 'simple-social-buttons', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
518
  }
519
 
520
+ /**
521
+ * Plugin constant.
522
+ *
523
+ * @access public
524
+ * @since 1.0.0
525
+ * @return void
526
+ */
527
+ public function constants() {
528
+ if ( ! defined( 'SSB_FEEDBACK_SERVER' ) ) {
529
+
530
+ define( 'SSB_FEEDBACK_SERVER', 'https://wpbrigade.com/' );
531
+ }
532
+ if ( ! defined( 'SSB_VERSION' ) ) {
533
+
534
+ define( 'SSB_VERSION', $this->pluginVersion );
535
+ }
536
+ if ( ! defined( 'SSB_PLUGIN_DIR' ) ) {
537
+ define( 'SSB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
538
+ }
539
  }
540
 
541
 
542
  /**
543
  * Set default settings.
544
+ *
545
+ * @access public
546
+ * @since 1.0.0
547
+ * @return void
548
  */
549
+ public function plugin_install() {
550
 
551
  if ( ! get_option( 'ssb_networks' ) ) {
552
  $_default = array(
586
  }
587
 
588
  /**
589
+ * Plugin uninstall and database clean up routine.
590
+ *
591
+ * @access public
592
+ * @since 1.0.0
593
+ * @return void
594
  */
595
+ public function plugin_uninstall() {
596
  if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
597
  exit();
598
  }
603
  }
604
 
605
 
606
+ public function _get_settings( $section, $value, $default = false ) {
607
  $section = $section . '_option';
608
  $_arr = $this->$section;
609
  return isset( $_arr[ $value ] ) && ! empty( $_arr[ $value ] ) ? $_arr[ $value ] : $default;
610
  }
611
 
612
  /**
613
+ * Where to insert
614
+ *
615
+ * @access public
616
+ * @since 1.0.0
617
+ * @return mixed
618
  */
619
+ public function where_to_insert() {
620
 
621
  $return = false;
622
 
632
  /**
633
  * Add Thumbs Up Icon
634
  *
635
+ * @access public
636
  * @since 1.9.0
637
+ * @return mixed
638
  */
639
  public function _row_meta( $links, $file ) {
640
 
655
  /**
656
  * Add inline for the excerpt.
657
  *
658
+ * @access public
659
  * @since 2.0
660
+ * @return mixed
661
  */
662
+ public function insert_excerpt_buttons( $content ) {
663
 
664
  if ( is_single() ) {
665
  return $content;
671
  /**
672
  * Return class
673
  *
674
+ * @access public
675
  * @since 2.0.4
676
+ * @return mixed
677
  */
678
+ public function add_post_class( $post_id = null ) {
679
  $post = get_post( $post_id );
680
 
681
  $classes = '';
694
  /**
695
  * Add Inline Buttons.
696
  *
697
+ * @access public
698
  * @since 1.0
699
+ * @return mixed
700
  */
701
+ public function insert_buttons( $content ) {
702
 
703
  // Return the content if we are not in loop.
704
  if ( ! is_main_query() || ! in_the_loop() ) {
743
  $extra_class .= ' simplesocialbuttons-inline-' . $this->_get_settings( 'inline', 'animation', 'no-animation' );
744
 
745
  $_selected_network = apply_filters( 'ssb_inline_social_networks', $this->selected_networks );
746
+ $ssb_buttonscode = $this->generate_buttons_code( $_selected_network, $show_count, $show_total, array( 'class' => $extra_class ) );
747
 
748
  $sharing_text = '';
749
 
763
  return $content;
764
 
765
  }
 
766
  /**
767
+ * Generate HTML code for specific order.
768
  *
769
+ * @param array $order
770
+ * @param boolean $show_count
771
+ * @param boolean $show_total
772
+ * @param string $extra_class
773
+ *
774
+ * @access public
775
+ * @since 1.0.0
776
+ * @return string
777
  */
778
+ public function generate_buttons_code( $order = null, $show_count = false, $show_total = false, $extra_data = array() ) {
779
 
780
+ // define empty buttons code to use.
781
  $ssb_buttonscode = '';
782
  // get post permalink and title
783
  $permalink = get_permalink();
784
+ $title = urlencode( html_entity_decode( get_the_title(), ENT_COMPAT, 'UTF-8' ) );
785
+ $post_id = get_the_id();
786
+
787
  // Sorting the buttons
788
  $arrButtons = array();
789
  foreach ( $this->arrKnownButtons as $button_name ) {
796
 
797
  // add total share index in array.
798
  if ( $show_total ) {
799
+ $arrButtons['totalshare'] = '100';
800
+ }
801
+
802
+ // special case if post id not exist for example short code run on widget out side the loop in archive page and old counts not exsist
803
+ if ( false == $permalink ) {
804
+ $permalink = get_site_url();
805
+ $title = get_bloginfo( 'name' );
806
+ $post_id = 0;
807
+ }
808
 
809
+ // Get the value for http or https solve options.
810
  $http_solve = false;
811
  if ( isset( $this->extra_option['http_https_resolve'] ) ) {
812
  if ( false == get_post_meta( $post_id, 'ssb_old_counts', true ) ) {
814
  }
815
  }
816
 
817
+ $non_exist_post_record = false;
818
+ // special case if post id not exist for example short code run on widget out side the loop in archive page and old counts not exsist
819
+ if ( 0 == $post_id ) {
820
+ $non_exist_post_record = get_option( 'ssb_not_exist_post_old_counts' );
821
+ $non_exist_post_record = true;
822
+ }
823
+
824
  // Reset the cache timestamp if needed
825
  // if false fetch the new share counts.
826
+ if ( ( isset( $this->settings['cache'] ) && $this->settings['cache'] == 'off' ) || ( true == $http_solve ) || ( $non_exist_post_record ) ) {
827
 
828
  $_share_links = array();
829
  foreach ( $arrButtons as $social_name => $priority ) {
830
+ if ( ! is_network_has_counts( $social_name ) ) {
831
  continue; }
832
  $_share_links[ $social_name ] = call_user_func( 'ssb_' . $social_name . '_generate_link', $permalink );
833
  }
840
 
841
  // $result = ssb_fetch_shares_via_curl_multi(
842
  // array(
 
843
  // 'fbshare' => ssb_fbshare_generate_link( 'https://propakistani.pk/2017/09/06/lahore-get-600-million-disneyland-like-amusement-park/' ),
844
  // 'twitter' => ssb_twitter_generate_link( 'https://wptavern.com/jetpack-5-3-adds-php-7-1-compatibility-better-control-for-wordads-placement' ),
845
  // 'pinterest' => ssb_pinterest_generate_link( 'http://websitehostingcost.com/tag/dedicated/' ),
865
  <span class="simplesocialtxt">Share </span>';
866
 
867
  if ( $show_count ) {
868
+ $_html .= ' <span class="ssb_counter">' . ssb_count_format( $fbshare_share ) . '</span>';
869
  }
870
 
871
  $_html .= ' </button>';
874
  $_html = '<button class="simplesocial-fb-share" target="_blank" data-href="https://www.facebook.com/sharer/sharer.php?u=' . $permalink . '" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;"><span class="simplesocialtxt">Facebook </span> ';
875
 
876
  if ( $show_count ) {
877
+ $_html .= '<span class="ssb_counter ssb_fbshare_counter">' . ssb_count_format( $fbshare_share ) . '</span>';
878
  }
879
  $_html .= '</button>';
880
  }
892
  <span class="icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72"><path fill="none" d="M0 0h72v72H0z"/><path class="icon" fill="#fff" d="M68.812 15.14c-2.348 1.04-4.87 1.744-7.52 2.06 2.704-1.62 4.78-4.186 5.757-7.243-2.53 1.5-5.33 2.592-8.314 3.176C56.35 10.59 52.948 9 49.182 9c-7.23 0-13.092 5.86-13.092 13.093 0 1.026.118 2.02.338 2.98C25.543 24.527 15.9 19.318 9.44 11.396c-1.125 1.936-1.77 4.184-1.77 6.58 0 4.543 2.312 8.552 5.824 10.9-2.146-.07-4.165-.658-5.93-1.64-.002.056-.002.11-.002.163 0 6.345 4.513 11.638 10.504 12.84-1.1.298-2.256.457-3.45.457-.845 0-1.666-.078-2.464-.23 1.667 5.2 6.5 8.985 12.23 9.09-4.482 3.51-10.13 5.605-16.26 5.605-1.055 0-2.096-.06-3.122-.184 5.794 3.717 12.676 5.882 20.067 5.882 24.083 0 37.25-19.95 37.25-37.25 0-.565-.013-1.133-.038-1.693 2.558-1.847 4.778-4.15 6.532-6.774z"/></svg></span>';
893
 
894
  if ( $show_count ) {
895
+ $_html .= '<i class="simplesocialtxt">Tweet ' . ssb_count_format( $twitter_share ) . '</i>';
896
  } else {
897
  $_html .= '<i class="simplesocialtxt">Tweet </i>';
898
 
905
  $_html = '<button class="simplesocial-twt-share" data-href="https://twitter.com/share?text=' . $title . '&url=' . $permalink . '' . $via . '" rel="nofollow" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;"><span class="simplesocialtxt">Twitter</span> ';
906
 
907
  if ( $show_count ) {
908
+ $_html .= '<span class="ssb_counter ssb_twitter_counter">' . ssb_count_format( $twitter_share ) . '</span>';
909
  }
910
  $_html .= '</button>';
911
  }
914
 
915
  break;
916
  case 'linkedin':
917
+ // $linkedin_share = $share_counts['linkedin'] ? $share_counts['linkedin'] : 0;
918
 
919
  if ( $this->selected_theme == 'simple-icons' ) {
920
 
922
  <span class="icon"> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="15px" height="14.1px" viewBox="-301.4 387.5 15 14.1" enable-background="new -301.4 387.5 15 14.1" xml:space="preserve"> <g id="XMLID_398_"> <path id="XMLID_399_" fill="#FFFFFF" d="M-296.2,401.6c0-3.2,0-6.3,0-9.5h0.1c1,0,2,0,2.9,0c0.1,0,0.1,0,0.1,0.1c0,0.4,0,0.8,0,1.2 c0.1-0.1,0.2-0.3,0.3-0.4c0.5-0.7,1.2-1,2.1-1.1c0.8-0.1,1.5,0,2.2,0.3c0.7,0.4,1.2,0.8,1.5,1.4c0.4,0.8,0.6,1.7,0.6,2.5 c0,1.8,0,3.6,0,5.4v0.1c-1.1,0-2.1,0-3.2,0c0-0.1,0-0.1,0-0.2c0-1.6,0-3.2,0-4.8c0-0.4,0-0.8-0.2-1.2c-0.2-0.7-0.8-1-1.6-1 c-0.8,0.1-1.3,0.5-1.6,1.2c-0.1,0.2-0.1,0.5-0.1,0.8c0,1.7,0,3.4,0,5.1c0,0.2,0,0.2-0.2,0.2c-1,0-1.9,0-2.9,0 C-296.1,401.6-296.2,401.6-296.2,401.6z"/> <path id="XMLID_400_" fill="#FFFFFF" d="M-298,401.6L-298,401.6c-1.1,0-2.1,0-3,0c-0.1,0-0.1,0-0.1-0.1c0-3.1,0-6.1,0-9.2 c0-0.1,0-0.1,0.1-0.1c1,0,2,0,2.9,0h0.1C-298,395.3-298,398.5-298,401.6z"/> <path id="XMLID_401_" fill="#FFFFFF" d="M-299.6,390.9c-0.7-0.1-1.2-0.3-1.6-0.8c-0.5-0.8-0.2-2.1,1-2.4c0.6-0.2,1.2-0.1,1.8,0.2 c0.5,0.4,0.7,0.9,0.6,1.5c-0.1,0.7-0.5,1.1-1.1,1.3C-299.1,390.8-299.4,390.8-299.6,390.9L-299.6,390.9z"/> </g> </svg> </span>
923
  <span class="simplesocialtxt">Share</span>';
924
 
925
+ // if ( $show_count ) {
926
+ // $_html .= ' <span class="ssb_counter">' . $linkedin_share . '</span>';
927
+ // }
928
  $_html .= ' </button>';
929
  } else {
930
 
931
  $_html = '<button target="popup" class="simplesocial-linkedin-share" data-href="https://www.linkedin.com/cws/share?url=' . get_permalink() . '" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;"><span class="simplesocialtxt">LinkedIn</span>';
932
 
933
+ // if ( $show_count ) {
934
+ // $_html .= '<span class="ssb_counter ssb_linkedin_counter">' . $linkedin_share . '</span>';
935
+ // }
936
  $_html .= '</button>';
937
  }
938
 
948
  <span class="icon"> <svg xmlns="http://www.w3.org/2000/svg" height="30px" width="30px" viewBox="-1 -1 31 31"><g><path d="M29.449,14.662 C29.449,22.722 22.868,29.256 14.75,29.256 C6.632,29.256 0.051,22.722 0.051,14.662 C0.051,6.601 6.632,0.067 14.75,0.067 C22.868,0.067 29.449,6.601 29.449,14.662" fill="#fff" stroke="#fff" stroke-width="1"></path><path d="M14.733,1.686 C7.516,1.686 1.665,7.495 1.665,14.662 C1.665,20.159 5.109,24.854 9.97,26.744 C9.856,25.718 9.753,24.143 10.016,23.022 C10.253,22.01 11.548,16.572 11.548,16.572 C11.548,16.572 11.157,15.795 11.157,14.646 C11.157,12.842 12.211,11.495 13.522,11.495 C14.637,11.495 15.175,12.326 15.175,13.323 C15.175,14.436 14.462,16.1 14.093,17.643 C13.785,18.935 14.745,19.988 16.028,19.988 C18.351,19.988 20.136,17.556 20.136,14.046 C20.136,10.939 17.888,8.767 14.678,8.767 C10.959,8.767 8.777,11.536 8.777,14.398 C8.777,15.513 9.21,16.709 9.749,17.359 C9.856,17.488 9.872,17.6 9.84,17.731 C9.741,18.141 9.52,19.023 9.477,19.203 C9.42,19.44 9.288,19.491 9.04,19.376 C7.408,18.622 6.387,16.252 6.387,14.349 C6.387,10.256 9.383,6.497 15.022,6.497 C19.555,6.497 23.078,9.705 23.078,13.991 C23.078,18.463 20.239,22.062 16.297,22.062 C14.973,22.062 13.728,21.379 13.302,20.572 C13.302,20.572 12.647,23.05 12.488,23.657 C12.193,24.784 11.396,26.196 10.863,27.058 C12.086,27.434 13.386,27.637 14.733,27.637 C21.95,27.637 27.801,21.828 27.801,14.662 C27.801,7.495 21.95,1.686 14.733,1.686" fill="#bd081c"></path></g></svg> </span>
949
  <span class="simplesocialtxt">Save</span>';
950
  if ( $show_count ) {
951
+ $_html .= '<span class="ssb_counter">' . ssb_count_format( $pinterest_share ) . '</span>';
952
  }
953
  $_html .= ' </button>';
954
  } else {
956
  $_html = '<button rel="nofollow" class="simplesocial-pinterest-share" onclick="var e=document.createElement(\'script\');e.setAttribute(\'type\',\'text/javascript\');e.setAttribute(\'charset\',\'UTF-8\');e.setAttribute(\'src\',\'//assets.pinterest.com/js/pinmarklet.js?r=\'+Math.random()*99999999);document.body.appendChild(e);return false;" ><span class="simplesocialtxt">Pinterest</span>';
957
 
958
  if ( $show_count ) {
959
+ $_html .= '<span class="ssb_counter ssb_pinterest_counter">' . ssb_count_format( $pinterest_share ) . '</span>';
960
  }
961
  $_html .= '</button>';
962
  }
966
  break;
967
  case 'totalshare':
968
  $total_share = $share_counts['total'] ? $share_counts['total'] : 0;
969
+ $arrButtonsCode[] = "<span class='ssb_total_counter'>" . ssb_count_format( $total_share ) . '<span>Shares</span></span>';
970
  break;
971
  case 'reddit':
972
  $reddit_score = $share_counts['reddit'] ? $share_counts['reddit'] : 0;
978
  xml:space="preserve"> <g> <path id="reddit" d="M307.523,231.062c1.11,2.838,1.614,5.769,1.614,8.681c0,5.862-2.025,11.556-5.423,16.204 c-3.36,4.593-8.121,8.158-13.722,9.727h0.01c-0.047,0.019-0.094,0.019-0.117,0.037c-0.023,0-0.061,0.019-0.079,0.019 c-2.623,0.896-5.312,1.316-7.98,1.316c-6.254,0-12.396-2.254-17.306-6.096c-4.872-3.826-8.56-9.324-9.717-15.845h-0.01 c0-0.019,0-0.042-0.009-0.069c0-0.019,0-0.038-0.019-0.065h0.019c-0.364-1.681-0.551-3.36-0.551-5.021 c0-5.647,1.923-11.07,5.097-15.551c3.164-4.453,7.626-7.99,12.848-9.811c0.019,0,0.038-0.01,0.038-0.01 c0.027,0,0.027-0.027,0.051-0.027c2.954-1.092,6.072-1.639,9.157-1.639c5.619,0,11.154,1.704,15.821,4.821 c4.611,3.066,8.354,7.561,10.23,13.143c0.019,0.037,0.019,0.07,0.037,0.103c0,0.037,0.019,0.057,0.037,0.084H307.523z M290.329,300.349c-2.202-1.428-4.751-2.291-7.448-2.291c-2.175,0-4.434,0.621-6.445,1.955l0,0 c-19.004,11.342-41.355,17.558-63.547,17.558c-16.65,0-33.199-3.514-48.192-10.879l-0.077-0.037l-0.075-0.028 c-2.261-0.924-4.837-2.889-7.647-4.76c-1.428-0.925-2.919-1.844-4.574-2.521c-1.633-0.695-3.447-1.181-5.386-1.181 c-1.605,0-3.292,0.359-4.957,1.115c-0.086,0.033-0.168,0.065-0.252,0.098h0.009c-2.616,0.999-4.66,2.829-5.974,4.994 c-1.372,2.23-2.046,4.826-2.046,7.411c0,2.334,0.551,4.667,1.691,6.786c1.085,2.007,2.754,3.762,4.938,4.938 c21.429,14.454,46.662,21.002,71.992,20.979c22.838,0,45.814-5.287,66.27-14.911l0.107-0.065l0.103-0.056 c2.697-1.597,6.282-3.029,9.661-5.115c1.671-1.064,3.304-2.296,4.704-3.897c1.4-1.591,2.525-3.551,3.16-5.875v-0.01 c0.266-1.026,0.392-2.025,0.392-3.024c0-1.899-0.467-3.701-1.241-5.32C294.361,303.775,292.504,301.778,290.329,300.349z M139.875,265.589c0.037,0,0.086,0.014,0.128,0.037c2.735,0.999,5.554,1.493,8.345,1.493c6.963,0,13.73-2.852,18.853-7.5 c5.115-4.662,8.618-11.257,8.618-18.775c0-0.196,0-0.392-0.009-0.625c0.019-0.336,0.028-0.705,0.028-1.083 c0-7.458-3.456-14.08-8.522-18.762c-5.085-4.686-11.836-7.551-18.825-7.551c-1.867,0-3.769,0.219-5.628,0.653 c-0.028,0-0.049,0.009-0.077,0.009c0,0-0.019,0-0.028,0c-9.252,1.937-17.373,8.803-20.37,18.248l0,0v0.01 c0,0.019-0.009,0.037-0.009,0.037c-0.861,2.586-1.262,5.255-1.262,7.896c0,5.787,1.913,11.426,5.211,16.064 c3.269,4.56,7.894,8.145,13.448,9.819C139.816,265.561,139.835,265.571,139.875,265.589z M430.033,198.094v0.038 c0.066,0.94,0.084,1.878,0.084,2.81c0,10.447-3.351,20.493-8.941,29.016c-5.218,7.976-12.414,14.649-20.703,19.177 c0.532,4.158,0.84,8.349,0.84,12.526c-0.01,22.495-7.766,44.607-21.272,62.329v0.009h-0.028 c-24.969,33.216-63.313,52.804-102.031,62.684h-0.01l-0.027,0.023c-20.647,5.013-41.938,7.574-63.223,7.574 c-31.729,0-63.433-5.722-93.018-17.585l-0.009-0.028h-0.028c-30.672-12.643-59.897-32.739-77.819-62.184 c-9.642-15.71-14.935-34.141-14.935-52.659c0-4.19,0.283-8.387,0.843-12.536c-8.072-4.545-15.063-10.99-20.255-18.687 c-5.542-8.266-9.056-17.95-9.5-28.187v-0.04v-0.037v-0.082c0.009-14.337,6.237-27.918,15.915-37.932 c9.677-10.011,22.896-16.554,37.075-16.554c0.196,0,0.392,0,0.588,0c1.487-0.101,2.987-0.159,4.488-0.159 c7.122,0,14.26,1.153,21.039,3.752l0.037,0.028l0.038,0.012c5.787,2.437,11.537,5.377,16.662,9.449 c1.661-0.871,3.472-1.851,5.504-2.625c31.064-18.395,67.171-25.491,102.358-27.538c0.306-17.431,2.448-35.68,10.949-51.65 c7.08-13.269,19.369-23.599,34-27.179l0.061-0.03l0.079-0.009c5.573-1.078,11.192-1.575,16.774-1.575 c14.869,0,29.561,3.521,43.31,9.017c6.086-9.185,14.776-16.354,24.97-20.375l0.098-0.056l0.098-0.037 c5.983-1.864,12.303-2.954,18.646-2.954c6.692,0,13.437,1.223,19.756,4.046v-0.023c0.009,0.023,0.019,0.023,0.019,0.023 c0.047,0.016,0.084,0.044,0.116,0.044c9.059,3.489,16.727,9.937,22.164,17.95c5.442,8.048,8.644,17.688,8.644,27.599 c0,1.827-0.103,3.657-0.317,5.489l-0.019,0.037c0,0.028,0,0.068-0.01,0.096c-1.063,12.809-7.551,24.047-16.736,32.063 c-9.24,8.048-21.207,12.909-33.49,12.909c-1.97,0-3.958-0.11-5.937-0.374c-12.182-0.931-23.541-6.826-31.886-15.595 c-8.373-8.755-13.768-20.453-13.768-33.08c0-0.611,0.056-1.237,0.074-1.843c-11.435-5.092-23.578-9.316-35.646-9.306 c-1.746,0-3.491,0.096-5.237,0.273h-0.019c-9.035,0.871-17.436,6.566-21.506,14.757v0.009v0.028 c-6.179,12.034-7.411,26.101-7.598,40.064c34.639,2.259,69.483,10.571,100.043,28.138h0.047l0.438,0.259 c0.579,0.343,1.652,0.931,2.623,1.449c2.101-1.704,4.322-3.456,6.856-4.966c9.264-6.17,20.241-9.238,31.223-9.238 c4.872,0,9.749,0.621,14.481,1.834h0.019l0.196,0.058c0.07,0.01,0.121,0.033,0.178,0.033v0.009 c11.183,2.845,21.3,9.267,28.917,17.927c7.612,8.674,12.731,19.648,13.73,31.561v0.025H430.033z M328.002,84.733 c0,0.469,0.01,0.95,0.057,1.44v0.028v0.056c0.224,6.018,3.065,11.619,7.383,15.756c4.34,4.14,10.1,6.702,15.942,6.725h0.08h0.079 c0.42,0.033,0.85,0.033,1.26,0.033c5.899,0.009,11.752-2.532,16.148-6.655c4.405-4.144,7.309-9.78,7.542-15.849l0.009-0.028v-0.037 c0.038-0.464,0.057-0.903,0.057-1.377c0-6.247-2.922-12.202-7.496-16.612c-4.555-4.406-10.688-7.136-16.735-7.12 c-1.951,0-3.884,0.266-5.778,0.854l-0.065,0.005l-0.056,0.023c-4.984,1.295-9.656,4.368-13.012,8.449 C330.046,74.486,328.002,79.508,328.002,84.733z M72.312,177.578c-4.63-2.156-9.418-3.696-14.15-3.676 c-0.794,0-1.597,0.047-2.39,0.133h-0.11l-0.11,0.014c-6.795,0.187-13.653,3.15-18.801,7.899 c-5.152,4.732-8.559,11.122-8.821,18.167v0.065l-0.012,0.058c-0.046,0.57-0.065,1.137-0.065,1.683 c0,4.345,1.333,8.545,3.593,12.368c1.673,2.847,3.867,5.441,6.348,7.701C45.735,204.602,58.142,189.845,72.312,177.578z M374.066,262.635c0-15.5-5.592-31.069-14.646-43.604c-18.053-25.119-46.055-41.502-75.187-50.636l-0.205-0.072 c-5.592-1.715-11.238-3.234-16.933-4.534c-17.025-3.876-34.48-5.806-51.917-5.806c-23.414,0-46.827,3.465-69.245,10.379 c-29.125,9.243-57.221,25.51-75.233,50.71v0.019c-9.129,12.587-14.475,28.208-14.475,43.763c0,5.727,0.716,11.453,2.23,17.025 l0.019,0.01c3.278,12.508,9.689,23.671,17.989,33.393c8.295,9.745,18.472,18.058,29.176,24.839c2.371,1.47,4.751,2.87,7.187,4.237 c31.094,17.356,66.898,24.964,102.445,24.964c6.012,0,12.06-0.214,18.033-0.644c35.797-2.959,71.742-13.525,100.8-35.115 l0.01-0.023c9.25-6.837,17.818-15.112,24.595-24.525c6.805-9.418,11.789-19.947,14.002-31.382V275.6l0.009-0.01 C373.627,271.32,374.066,266.985,374.066,262.635z M402.32,200.95c-0.009-3.762-0.868-7.507-2.753-11l-0.047-0.044l-0.019-0.056 c-2.521-5.19-6.479-9.11-11.248-11.782c-4.77-2.69-10.352-4.056-15.952-4.056c-5.063,0-10.1,1.132-14.57,3.379 c14.216,12.344,26.687,27.179,34.746,44.636c2.595-2.259,4.808-5.018,6.464-8.084C401.098,209.92,402.32,205.405,402.32,200.95z"/></svg></span>
979
  <span class="simplesocialtxt">reddit </span>';
980
  if ( $show_count ) {
981
+ $_html .= '<span class="ssb_counter">' . ssb_count_format( $reddit_score ) . '</span>';
982
  }
983
 
984
  $_html .= '</button>';
986
  $_html = '<button class="simplesocial-reddit-share" data-href="https://reddit.com/submit?url=' . $permalink . '&title=' . $title . '" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;" ><span class="simplesocialtxt">Reddit</span> ';
987
 
988
  if ( $show_count ) {
989
+ $_html .= '<span class="ssb_counter ssb_reddit_counter">' . ssb_count_format( $reddit_score ) . '</span>';
990
  }
991
  $_html .= '</button>';
992
 
1017
  }
1018
  break;
1019
  case 'fblike':
1020
+ $button_size = isset( $extra_data['like-button-size'] ) ? $extra_data['like-button-size'] : 'small';
1021
+ $_html = '<div class="fb-like ssb-fb-like" data-href="' . $permalink . '" data-layout="button_count" data-action="like" data-size="' . $button_size . '" data-show-faces="false" data-share="false"></div>';
1022
  $arrButtonsCode[] = $_html;
 
1023
  break;
1024
  case 'messenger':
1025
  $link = urlencode( $permalink );
1076
  width="12.6px" height="17.8px" viewBox="-299.1 388.3 12.6 17.8" style="enable-background:new -299.1 388.3 12.6 17.8;" xml:space="preserve"><g> <path fill="#FFFFFF" d="M-294.7,388.3c1.1,0,2.1,0,3.2,0c0,1.5,0,2.9,0,4.4c1.7,0,3.3,0,5,0c0,1.1,0,2.2,0,3.4c-1.7,0-3.3,0-5,0 c0,0.1,0,0.2,0,0.2c0,1.6,0,3.2,0,4.8c0,1.2,0.6,1.8,1.8,2c1.1,0.1,2.1,0,3-0.5c0.1,0,0.1-0.1,0.2-0.1c0,0.1,0,0.1,0,0.2 c0,0.8,0,1.5,0,2.3c0,0.1,0,0.2-0.2,0.3c-1.6,0.6-3.2,0.9-5,0.8c-1-0.1-2-0.3-2.9-0.8c-1.2-0.7-1.8-1.7-1.8-3.1c0-2.1,0-4.1,0-6.2 c0-0.1,0-0.2,0-0.3c-0.9,0-1.8,0-2.7,0c0-0.1,0-0.1,0-0.2c0-0.7,0-1.5,0-2.2c0-0.1,0-0.2,0.2-0.2c0.3-0.1,0.7-0.2,1-0.3 c1.6-0.6,2.6-1.8,3-3.5c0-0.1,0.1-0.3,0.1-0.4C-294.8,388.6-294.7,388.4-294.7,388.3z"/> </g> </svg> </span>
1077
  <span class="simplesocialtxt">tumblr </span>';
1078
  if ( $show_count ) {
1079
+ $_html .= '<span class="ssb_counter">' . ssb_count_format( $tumblr_score ) . '</span>';
1080
  }
1081
 
1082
  $_html .= '</button>';
1084
  $_html = '<button class="simplesocial-tumblr-share" data-href="' . $tumblr_share_url . '" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;" ><span class="simplesocialtxt">Tumblr</span> ';
1085
 
1086
  if ( $show_count ) {
1087
+ $_html .= '<span class="ssb_counter ssb_tumblr_counter">' . ssb_count_format( $tumblr_score ) . '</span>';
1088
  }
1089
  $_html .= '</button>';
1090
 
1096
  }
1097
 
1098
  if ( count( $arrButtonsCode ) > 0 ) {
1099
+ $arrButtonsCode = apply_filters( 'ssb_buttons_output', $arrButtonsCode );
1100
+ $class = isset( $extra_data['class'] ) ? $extra_data['class'] : '';
1101
+ if ( ! is_array( $extra_data ) ) {
1102
+ $class = $extra_data;
1103
+ }
1104
+ $theme = isset( $extra_data['theme'] ) ? $extra_data['theme'] : $this->selected_theme;
1105
+ $ssb_buttonscode .= '<div class="simplesocialbuttons simplesocial-' . $theme . ' ' . $class . '">' . "\n";
1106
  $ssb_buttonscode .= implode( "\n", $arrButtonsCode ) . "\n";
1107
  $ssb_buttonscode .= '</div>' . "\n";
 
1108
  }
1109
  return $ssb_buttonscode;
1110
  }
1115
  * @param string $option Name of option.
1116
  * @param boolean $default Default value.
1117
  *
1118
+ * @return mixed
1119
+ * @access public
1120
  * @since 2.0
1121
  */
1122
+ public function get_option( $option, $default = false ) {
1123
  if ( isset( $this->settings[ $option ] ) ) {
1124
  return $this->settings[ $option ];
1125
  } else {
1127
  }
1128
  }
1129
 
1130
+ /**
1131
+ * Get post type.
1132
+ *
1133
+ * @access public
1134
+ * @since 1.0.0
1135
+ * @return string
1136
+ */
1137
+ public function get_post_type() {
1138
 
1139
  if ( is_home() || is_front_page() ) {
1140
  return 'home';
1147
  /**
1148
  * Add Buttons on SideBar.
1149
  *
1150
+ * @access public
1151
  * @since 2.0
1152
+ * @return void
1153
  */
1154
+ public function include_sidebar() {
1155
 
1156
  // Return Content if hide ssb.
1157
  if ( get_post_meta( get_the_id(), $this->hideCustomMetaKey, true ) == 'true' ) {
1181
 
1182
  $class .= ' simplesocialbuttons-slide-' . $this->_get_settings( 'sidebar', 'animation', 'no-animation' );
1183
  $_selected_network = apply_filters( 'ssb_sidebar_social_networks', $this->selected_networks );
1184
+ echo $this->generate_buttons_code( $_selected_network, $show_count, $show_total, array( 'class' => $class ) );
1185
  }
1186
  }
1187
  }
1188
 
1189
+ /**
1190
+ * User custoimzed CSS.
1191
+ *
1192
+ * @access public
1193
+ * @since 1.0.0
1194
+ * @return void
1195
+ */
1196
+ public function css_file() {
1197
  include_once dirname( __FILE__ ) . '/inc/custom-css.php';
1198
  }
1199
 
1200
  /**
1201
  * Update option when user click on dismiss button.
1202
  *
1203
+ * @access public
1204
  * @since 2.0.0
1205
+ * @return void
1206
  */
1207
+ public function review_update_notice() {
1208
 
1209
  if ( ! is_admin() ||
1210
  ! current_user_can( 'manage_options' ) ||
1224
  /**
1225
  * Show 2.0 Update Notice.
1226
  *
1227
+ * @access public
1228
  * @since 2.0.0
1229
  */
1230
+ public function update_notice() {
1231
  // delete_option( 'ssb_update_2_0_dismiss' );
1232
  if ( get_option( 'ssb_update_2_0_dismiss' ) ) {
1233
  return; }
1265
  /**
1266
  * Add Facebook Like script.
1267
  *
1268
+ * @access public
1269
  * @since 2.0.4
1270
+ * @return void
1271
  */
1272
+ public function fblike_script() {
1273
 
1274
  if ( ! array_key_exists( 'fblike', array_filter( $this->selected_networks ) ) ) {
1275
  return;
1292
  *
1293
  * @param $atts
1294
  *
1295
+ * @access public
1296
  * @since 2.0.2
1297
  * @return string
1298
  */
1299
+ public function short_code_content( $atts ) {
1300
 
1301
  /*
1302
  counter = true,false
1348
  if ( null !== $selected_theme['order'] ) {
1349
  $selected_theme['order'] = array_flip( array_merge( array( 0 ), explode( ',', $selected_theme['order'] ) ) );
1350
 
1351
+ } else {
1352
+ $selected_theme['order'] = $this->selected_networks;
1353
  }
1354
 
1355
  if ( isset( $this->selected_position['inline'] ) ) {
1381
 
1382
  $extra_class .= ' simplesocialbuttons-inline-' . $this->_get_settings( 'inline', 'animation', 'no-animation' );
1383
 
1384
+ // $ssb_buttons_code = $this->generate_buttons_short_code( $theme, $like_button_size, $selected_theme['order'], $this->selected_networks, $show_count, $show_total, $extra_class );
1385
+ $extra_option = array(
1386
+ 'class' => $extra_class,
1387
+ 'theme' => $theme,
1388
+ 'like-button-size' => $like_button_size,
1389
+ );
1390
 
1391
+ $ssb_buttons_code = $this->generate_buttons_code( $selected_theme['order'], $show_count, $show_total, $extra_option );
1392
  }
1393
 
1394
  return $ssb_buttons_code;
1398
  /**
1399
  * Generate buttons html code with specified order for short code
1400
  *
 
 
1401
  * @param mixed $order - order of social buttons
1402
+ *
1403
+ * @access public
1404
+ * @since 2.0.2
1405
+ * @return mixed
1406
  */
1407
+ public function generate_buttons_short_code( $short_code_theme, $like_button_size, $short_code_order, $order = null, $show_count = false, $show_total = false, $extra_class = '' ) {
1408
 
1409
  // googleplus,fbshare,twitter,pinterest,whatsapp,viber,reddit,linkedin,messenger,email,print
1410
  // define empty buttons code to use
1461
  $_share_links = array();
1462
  $_alt_share_links = array();
1463
  foreach ( $arrButtons as $social_name => $priority ) {
1464
+ if ( is_network_has_counts( $social_name ) ) {
1465
  continue;
1466
  }
1467
  $_share_links[ $social_name ] = call_user_func( 'ssb_' . $social_name . '_generate_link', $permalink );
1538
 
1539
  break;
1540
  case 'linkedin':
1541
+ // $linkedin_share = $share_counts['linkedin'] ? $share_counts['linkedin'] : 0;
1542
 
1543
  if ( $this->selected_theme == 'simple-icons' ) {
1544
 
1547
  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="15px" height="14.1px" viewBox="-301.4 387.5 15 14.1" enable-background="new -301.4 387.5 15 14.1" xml:space="preserve"> <g id="XMLID_398_"> <path id="XMLID_399_" fill="#FFFFFF" d="M-296.2,401.6c0-3.2,0-6.3,0-9.5h0.1c1,0,2,0,2.9,0c0.1,0,0.1,0,0.1,0.1c0,0.4,0,0.8,0,1.2 c0.1-0.1,0.2-0.3,0.3-0.4c0.5-0.7,1.2-1,2.1-1.1c0.8-0.1,1.5,0,2.2,0.3c0.7,0.4,1.2,0.8,1.5,1.4c0.4,0.8,0.6,1.7,0.6,2.5 c0,1.8,0,3.6,0,5.4v0.1c-1.1,0-2.1,0-3.2,0c0-0.1,0-0.1,0-0.2c0-1.6,0-3.2,0-4.8c0-0.4,0-0.8-0.2-1.2c-0.2-0.7-0.8-1-1.6-1 c-0.8,0.1-1.3,0.5-1.6,1.2c-0.1,0.2-0.1,0.5-0.1,0.8c0,1.7,0,3.4,0,5.1c0,0.2,0,0.2-0.2,0.2c-1,0-1.9,0-2.9,0 C-296.1,401.6-296.2,401.6-296.2,401.6z"/> <path id="XMLID_400_" fill="#FFFFFF" d="M-298,401.6L-298,401.6c-1.1,0-2.1,0-3,0c-0.1,0-0.1,0-0.1-0.1c0-3.1,0-6.1,0-9.2 c0-0.1,0-0.1,0.1-0.1c1,0,2,0,2.9,0h0.1C-298,395.3-298,398.5-298,401.6z"/> <path id="XMLID_401_" fill="#FFFFFF" d="M-299.6,390.9c-0.7-0.1-1.2-0.3-1.6-0.8c-0.5-0.8-0.2-2.1,1-2.4c0.6-0.2,1.2-0.1,1.8,0.2 c0.5,0.4,0.7,0.9,0.6,1.5c-0.1,0.7-0.5,1.1-1.1,1.3C-299.1,390.8-299.4,390.8-299.6,390.9L-299.6,390.9z"/></g></svg> </span>
1548
  <span class="simplesocialtxt">Share</span>';
1549
 
1550
+ // if ( $show_count ) {
1551
+ // $_html .= ' <span class="ssb_counter">' . $linkedin_share . '</span>';
1552
+ // }
1553
  $_html .= ' </button>';
1554
  } else {
1555
 
1556
  $_html = '<button target="popup" class="simplesocial-linkedin-share" data-href="https://www.linkedin.com/cws/share?url=' . get_permalink() . '" onclick="javascript:window.open(this.dataset.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;"><span class="simplesocialtxt">LinkedIn</span>';
1557
 
1558
+ // if ( $show_count ) {
1559
+ // $_html .= '<span class="ssb_counter ssb_linkedin_counter">' . $linkedin_share . '</span>';
1560
+ // }
1561
  $_html .= '</button>';
1562
  }
1563
 
1737
 
1738
 
1739
  /**
1740
+ * Add Meta Tags.
1741
  *
1742
  * @param int $post_id
1743
+ *
1744
+ * @access public
1745
  * @since 2.0.9
1746
  * @return string
1747
  */
1748
+ public function add_meta_tags() {
1749
 
1750
  if ( class_exists( 'Jetpack' ) ) { // Check jetpack active.
1751
  return;
1781
  }
1782
 
1783
 
1784
+ /**
1785
+ * Get title for open graph / meta description.
1786
+ *
1787
+ * @access public
1788
+ * @since 1.0.0
1789
+ * @return string
1790
+ */
1791
+ public function og_get_title() {
1792
  return get_the_title() . ' - ' . get_bloginfo( 'name' );
1793
  }
1794
 
1795
+ /**
1796
+ * Get description for the Open Graph / meta descriptoin.
1797
+ *
1798
+ * @access public
1799
+ * @since 1.0.0
1800
+ * @return string
1801
+ */
1802
+ public function og_get_description() {
1803
  return $this->get_excerpt_by_id( get_the_id() );
1804
  }
1805
 
1806
+
1807
+ /**
1808
+ * Get blog name for Open graph / meta descripton.
1809
+ *
1810
+ * @access public
1811
+ * @since 1.0.0
1812
+ * @return void
1813
+ */
1814
+ public function og_get_blog() {
1815
  return get_bloginfo( 'name' );
1816
  }
1817
 
1820
  * Get the excerpt
1821
  *
1822
  * @param int $post_id
1823
+ *
1824
+ * @access public
1825
  * @since 2.0.9
1826
  * @return string
1827
  */
1828
+ public function get_excerpt_by_id( $post_id ) {
1829
 
1830
  if ( ! $post_id ) {
1831
  return;
1850
  }
1851
 
1852
  /**
1853
+ * Get meta tage Image from content.
1854
  *
1855
+ * @param string $post
1856
  * @since 2.0.10
1857
+ * @return string
1858
  */
1859
+
1860
  public function get_content_images( $post ) {
1861
 
1862
  if ( ! $post ) {
1876
  }
1877
 
1878
 
1879
+ /**
1880
+ * Get the featured image / meta for open graph.
1881
+ *
1882
+ * @access public
1883
+ * @since 2.0.10
1884
+ * @return string Meta tag og:image for meta
1885
+ */
1886
  public function generate_og_image() {
1887
  $_post_id = get_the_ID();
1888
 
1893
  return $this->get_content_images( get_post( $_post_id ) );
1894
  }
1895
 
1896
+ /**
1897
+ * Get Open Graph image.
1898
+ *
1899
+ * @access public
1900
+ * @since 2.0.10
1901
+ * @return mixed
1902
+ */
1903
  public function get_og_image() {
1904
  $image = $this->generate_og_image();
1905
 
1908
  }
1909
  }
1910
 
1911
+ /**
1912
+ * Get the featured image for Twitter.
1913
+ *
1914
+ * @access public
1915
+ * @since 2.0.10
1916
+ * @return mixed
1917
+ */
1918
  public function generate_twitter_image() {
1919
  $_post_id = get_the_ID();
1920
 
1925
  return $this->get_twitter_content_images( get_post( $_post_id ) );
1926
  }
1927
 
1928
+ /**
1929
+ * Get Image from content for Twitter.
1930
+ *
1931
+ * @param object $post
1932
+ *
1933
+ * @access public
1934
+ * @since 2.0.10
1935
+ * @return mixed
1936
+ */
1937
  public function get_twitter_content_images( $post ) {
1938
 
1939
  if ( ! $post ) {
1952
  return $images;
1953
  }
1954
 
1955
+ /**
1956
+ * User to convert http to https or vice versa.
1957
+ *
1958
+ * @param $url
1959
+ *
1960
+ * @access public
1961
+ * @since 2.0.12
1962
+ * @return srting
1963
+ */
1964
  public function http_or_https_resolve_url( $url ) {
1965
 
1966
  $arr_parsed_url = parse_url( $url );
1976
 
1977
 
1978
  /**
1979
+ * Convert url http to https or vice versa.
1980
  *
1981
  * @param $permalink
1982
+ *
1983
+ * @access public
1984
  * @since 2.0.14
1985
  * @return mixed
1986
  */
1987
+ public function http_or_https_link_generate( $permalink ) {
1988
 
1989
  foreach ( $this->arrKnownButtons as $social_name ) {
1990
+ if ( ! is_network_has_counts( $social_name ) ) {
1991
  continue; }
1992
  $url = $this->http_or_https_resolve_url( $permalink );
1993
  // get alt hurl to cover http or https issue
1999
  /**
2000
  * Function use to remove button names on excerpt if above the content selecetd .
2001
  *
2002
+ * @param string $text already excertp set.
2003
+ * @param int $num_words word in excerpt.
2004
+ * @param string $more more srting apprend in last of the excerpt sring.
2005
+ * @param string $original_text original text of the string.
2006
+ * @return string $text string of excerpt;
2007
+ *
2008
+ * @access public
2009
+ * @since 2.0
2010
+ * @return string
2011
  */
2012
+ public function on_excerpt_content( $text, $num_words, $more, $original_text ) {
2013
 
2014
  if ( empty( $text ) ) {
2015
  return $text;
2073
  }
2074
 
2075
  /**
2076
+ * Check is ssb on with position and post type.
2077
  *
2078
+ * @param string $position location where you want to check ssb on/off.
2079
+ *
2080
+ * @access public
2081
  * @version 2.0.21
2082
+ * @return boolean
2083
  */
2084
+ public function is_ssb_on( $position ) {
2085
 
2086
  $is_ajax_callback = true;
2087
  if ( ! in_array( $this->get_post_type(), $this->_get_settings( $position, 'posts', array() ) ) ) {
2091
  return $is_ajax_callback;
2092
 
2093
  }
2094
+ /**
2095
+ * Action link on plugin page
2096
+ *
2097
+ * @param array $actions
2098
+ * @return array
2099
+ *
2100
+ * @access public
2101
+ * @since 2.1.4
2102
+ * @return array
2103
+ */
2104
+ public function filter_plugin_action_links( $actions ) {
2105
+ return array_merge(
2106
+ array(
2107
+ 'settings' => '<a href="/wp-admin/admin.php?page=simple-social-buttons">' . esc_html__( 'Settings', 'simple-social-buttons' ) . '</a>',
2108
+ ),
2109
+ $actions
2110
+ );
2111
+ }
2112
 
2113
 
2114
  } // end class
ssb-social-counts/facebook.php CHANGED
@@ -1,6 +1,12 @@
1
  <?php
2
 
3
-
 
 
 
 
 
 
4
  function ssb_format_fbshare_response( $response ) {
5
  $formatted_response = json_decode( $response, true );
6
  // Facebook share count check.
@@ -15,11 +21,18 @@ function ssb_format_fbshare_response( $response ) {
15
  }
16
 
17
 
 
 
 
 
 
 
 
18
  function ssb_fbshare_generate_link( $url ) {
19
  global $_ssb_pr;
20
  $advance_settings = $_ssb_pr->extra_option;
21
  $facebook_app_id = isset( $advance_settings['facebook_app_id'] ) ? $advance_settings['facebook_app_id'] : '';
22
  $facebook_secret_key = isset( $advance_settings['facebook_app_secret'] ) ? $advance_settings['facebook_app_secret'] : '';
23
- $link = "https://graph.facebook.com/v3.0/?id={$url}&fields=engagement&access_token={$facebook_app_id}|{$facebook_secret_key}";
24
  return $link;
25
  }
1
  <?php
2
 
3
+ /**
4
+ * Format the facebook response to beautiful count.
5
+ *
6
+ * @param array $response response of the count call.
7
+ * @since 1.0.0
8
+ * @return int count of facebook share.
9
+ */
10
  function ssb_format_fbshare_response( $response ) {
11
  $formatted_response = json_decode( $response, true );
12
  // Facebook share count check.
21
  }
22
 
23
 
24
+ /**
25
+ * Generate link for facebook get count API.
26
+ *
27
+ * @param string $url
28
+ * @since 1.0.0
29
+ * @return string ready link to call for API.
30
+ */
31
  function ssb_fbshare_generate_link( $url ) {
32
  global $_ssb_pr;
33
  $advance_settings = $_ssb_pr->extra_option;
34
  $facebook_app_id = isset( $advance_settings['facebook_app_id'] ) ? $advance_settings['facebook_app_id'] : '';
35
  $facebook_secret_key = isset( $advance_settings['facebook_app_secret'] ) ? $advance_settings['facebook_app_secret'] : '';
36
+ $link = "https://graph.facebook.com/v3.0/?id={$url}&fields=engagement&access_token={$facebook_app_id}|{$facebook_secret_key}";
37
  return $link;
38
  }
ssb-social-counts/linkedin.php CHANGED
@@ -1,12 +1,25 @@
1
  <?php
2
 
3
 
 
 
 
 
 
 
 
4
  function ssb_linkedin_generate_link( $url ) {
5
  $request_url = 'https://www.linkedin.com/countserv/count/share?url=' . $url . '&format=json';
6
  return $request_url;
7
  }
8
 
9
-
 
 
 
 
 
 
10
  function ssb_format_linkedin_response( $response ) {
11
  $response = json_decode( $response, true );
12
  return isset( $response['count'] ) ? intval( $response['count'] ) : 0;
1
  <?php
2
 
3
 
4
+ /**
5
+ * Linked in generate link.
6
+ *
7
+ * @deprecated 2.1.5
8
+ * @param string $url .
9
+ * @return string
10
+ */
11
  function ssb_linkedin_generate_link( $url ) {
12
  $request_url = 'https://www.linkedin.com/countserv/count/share?url=' . $url . '&format=json';
13
  return $request_url;
14
  }
15
 
16
+ /**
17
+ * Linked services.
18
+ *
19
+ * @deprecated 2.1.5
20
+ * @param array $response .
21
+ * @return int|array
22
+ */
23
  function ssb_format_linkedin_response( $response ) {
24
  $response = json_decode( $response, true );
25
  return isset( $response['count'] ) ? intval( $response['count'] ) : 0;
ssb-social-counts/pinterest.php CHANGED
@@ -1,15 +1,28 @@
1
  <?php
2
 
 
 
 
 
 
 
 
3
  function ssb_pinterest_generate_link( $url ) {
4
- $request_url = 'https://api.pinterest.com/v1/urls/count.json?url=' . $url ;
5
 
6
  return $request_url;
7
  }
8
 
9
-
 
 
 
 
 
 
10
  function ssb_format_pinterest_response( $response ) {
11
 
12
  $response = preg_replace( '/^receiveCount\((.*)\)$/', "\\1", $response );
13
- $response = json_decode( $response,true );
14
  return isset( $response['count'] ) ? intval( $response['count'] ) : 0;
15
  }
1
  <?php
2
 
3
+ /**
4
+ * Format the pinterest response to beautiful count.
5
+ *
6
+ * @param array $response response of the count call.
7
+ * @since 1.0.0
8
+ * @return int count of pinterest share.
9
+ */
10
  function ssb_pinterest_generate_link( $url ) {
11
+ $request_url = 'https://api.pinterest.com/v1/urls/count.json?url=' . $url;
12
 
13
  return $request_url;
14
  }
15
 
16
+ /**
17
+ * Generate link for pinterest get count API.
18
+ *
19
+ * @param string $url
20
+ * @since 1.0.0
21
+ * @return string ready link to call for API.
22
+ */
23
  function ssb_format_pinterest_response( $response ) {
24
 
25
  $response = preg_replace( '/^receiveCount\((.*)\)$/', "\\1", $response );
26
+ $response = json_decode( $response, true );
27
  return isset( $response['count'] ) ? intval( $response['count'] ) : 0;
28
  }
ssb-social-counts/reddit.php CHANGED
@@ -1,16 +1,27 @@
1
  <?php
2
 
3
-
 
 
 
 
 
 
4
  function ssb_reddit_generate_link( $url ) {
5
  $request_url = 'https://www.reddit.com/api/info.json?url=' . $url;
6
  return $request_url;
7
  }
8
 
9
-
10
-
 
 
 
 
 
11
  function ssb_format_reddit_response( $response ) {
12
  $response = json_decode( $response, true );
13
-
14
  $score = 0;
15
  // check data if data exist in respose and has length greater than 0.
16
  if ( isset( $response['data']['children'] ) && count( $response['data']['children'] ) > 0 ) {
1
  <?php
2
 
3
+ /**
4
+ * Format the reddit response to beautiful count.
5
+ *
6
+ * @param array $response response of the count call.
7
+ * @since 1.0.0
8
+ * @return int count of reddit share.
9
+ */
10
  function ssb_reddit_generate_link( $url ) {
11
  $request_url = 'https://www.reddit.com/api/info.json?url=' . $url;
12
  return $request_url;
13
  }
14
 
15
+ /**
16
+ * Generate link for reddit get count API.
17
+ *
18
+ * @param string $url
19
+ * @since 1.0.0
20
+ * @return string ready link to call for API.
21
+ */
22
  function ssb_format_reddit_response( $response ) {
23
  $response = json_decode( $response, true );
24
+
25
  $score = 0;
26
  // check data if data exist in respose and has length greater than 0.
27
  if ( isset( $response['data']['children'] ) && count( $response['data']['children'] ) > 0 ) {
ssb-social-counts/tumblr.php CHANGED
@@ -1,19 +1,35 @@
1
  <?php
2
 
3
- function ssb_tumblr_generate_link( $url ) {
4
- $request_url = 'https://api.tumblr.com/v2/share/stats?url=' . $url;
5
- return $request_url;
6
- }
7
-
8
-
 
9
  function ssb_format_tumblr_response( $response ) {
10
 
11
  $counts = 0;
12
- $response = json_decode( $response, true );
13
- // Check is valid api response
14
- if ( $response['meta']['status'] == 200 ) {
15
- $counts = $response['response']['note_count'];
 
 
16
  }
17
-
18
  return $counts;
19
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
+ /**
4
+ * Format the tumblr response to beautiful count.
5
+ *
6
+ * @param array $response response of the count call.
7
+ * @since 1.0.0
8
+ * @return int count of tumblr share.
9
+ */
10
  function ssb_format_tumblr_response( $response ) {
11
 
12
  $counts = 0;
13
+ $response = json_decode( $response, true );
14
+ // Check is valid api response
15
+ if ( isset( $response['meta']['status'] ) && $response['response']['note_count'] > 0 ) {
16
+ if ( $response['meta']['status'] == 200 ) {
17
+ $counts = $response['response']['note_count'];
18
+ }
19
  }
 
20
  return $counts;
21
  }
22
+
23
+ /**
24
+ * Generate link for tumblr get count API.
25
+ *
26
+ * @param string $url
27
+ * @since 1.0.0
28
+ * @return string ready link to call for API.
29
+ */
30
+ function ssb_tumblr_generate_link( $url ) {
31
+ $request_url = 'https://api.tumblr.com/v2/share/stats?url=' . $url;
32
+ return $request_url;
33
+ }
34
+
35
+
ssb-social-counts/twitter.php CHANGED
@@ -1,15 +1,28 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  function ssb_twitter_generate_link( $url ) {
4
 
5
  // Return the correct Twitter JSON endpoint URL
6
  $request_url = 'https://counts.twitcount.com/counts.php?url=' . $url;
7
  return $request_url;
8
  }
9
-
10
-
11
- function ssb_format_twitter_response( $response ) {
12
- // Parse the response to get the actual number
13
- $response = json_decode( $response, true );
14
- return isset( $response['count'] ) ? intval( $response['count'] ) : 0;
15
- }
1
  <?php
2
 
3
+ /**
4
+ * Format the twitter response to beautiful count.
5
+ *
6
+ * @param array $response response of the count call.
7
+ * @since 1.0.0
8
+ * @return int count of twitter share.
9
+ */
10
+ function ssb_format_twitter_response( $response ) {
11
+ // Parse the response to get the actual number
12
+ $response = json_decode( $response, true );
13
+ return isset( $response['count'] ) ? intval( $response['count'] ) : 0;
14
+ }
15
+
16
+ /**
17
+ * Generate link for twitter get count API.
18
+ *
19
+ * @param string $url
20
+ * @since 1.0.0
21
+ * @return string ready link to call for API.
22
+ */
23
  function ssb_twitter_generate_link( $url ) {
24
 
25
  // Return the correct Twitter JSON endpoint URL
26
  $request_url = 'https://counts.twitcount.com/counts.php?url=' . $url;
27
  return $request_url;
28
  }