Custom Share Buttons with Floating Sidebar - Version 3.5

Version Description

  • Tested with latest wordpress version 4.9.7
    • Fixed blog page share url issues
    • Optimized code
    • Released addon new version 3.5 with new features
Download this release

Release Info

Developer india-web-developer
Plugin Icon 128x128 Custom Share Buttons with Floating Sidebar
Version 3.5
Comparing to
See all releases

Code changes from version 3.4 to 3.5

csbwfs-class.php CHANGED
@@ -131,30 +131,20 @@ function csbwfsCheckCookie() {
131
  }
132
 
133
  </script>';
134
-
135
-
136
-
137
  }
138
-
139
  if(isset($pluginOptionsVal['csbwfs_buttons_active']) && $pluginOptionsVal['csbwfs_buttons_active']==1){
140
  add_filter( 'the_content', 'csbfs_the_content_filter', 20);
141
  add_action( 'wp_enqueue_scripts', 'csbwf_sidebar_scripts' );
142
  }
143
-
144
  //register style and scrip files
145
  function csbwf_sidebar_scripts() {
146
  wp_enqueue_script( 'jquery' ); // wordpress jQuery
147
  wp_register_style( 'csbwf_sidebar_style', plugins_url( 'css/csbwfs.css',__FILE__ ) );
148
  wp_enqueue_style( 'csbwf_sidebar_style' );
149
  }
150
-
151
- /*
152
- -----------------------------------------------------------------------------------------------
153
- "Add the jQuery code in head section using hooks"
154
- -----------------------------------------------------------------------------------------------
155
- */
156
-
157
-
158
  function csbwf_sidebar_load_inline_js()
159
  {
160
  $pluginOptionsVal=get_csbwf_sidebar_options();
@@ -227,81 +217,16 @@ $jscnt.='});
227
  echo $jscnt;
228
  }
229
 
230
- /*
231
- -----------------------------------------------------------------------------------------------
232
- "Custom Share Buttons with Floating Sidebar" HTML
233
- -----------------------------------------------------------------------------------------------
234
- */
235
-
236
-
237
  function get_csbwf_sidebar_content() {
238
  global $post;
239
  $pluginOptionsVal=get_csbwf_sidebar_options();
240
-
241
- /*Default Pinit Share image */
242
- /*if(isset($pluginOptionsVal['csbwfs_defaultfeaturedshrimg']) && $pluginOptionsVal['csbwfs_defaultfeaturedshrimg']!=''){
243
- $pinShareImg=$pluginOptionsVal['csbwfs_defaultfeaturedshrimg'];
244
- }else{
245
- $pinShareImg=plugins_url('images/mrweb-logo.jpg',__FILE__);
246
- }*/
247
-
248
- if(is_category())
249
- {
250
- $category_id = get_query_var('cat');
251
- //$shareurl =get_category_link( $category_id );
252
- $cats = get_the_category();
253
- $ShareTitle=$cats[0]->name;
254
- }elseif(is_page() || is_single())
255
- {
256
- /*if ( has_post_thumbnail() )
257
- {
258
- $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
259
-
260
- $pinShareImg= $large_image_url[0] ;
261
- }*/
262
-
263
- // $shareurl=get_permalink($post->ID);
264
- $ShareTitle=$post->post_title;
265
- }
266
- elseif(is_archive())
267
- {
268
- global $wp;
269
- $current_url = get_home_url(null, $wp->request, null);
270
-
271
- if ( is_day() ) :
272
- $ShareTitle='Daily Archives: '. get_the_date();
273
- elseif ( is_month() ) :
274
- $ShareTitle='Monthly Archives: '. get_the_date('F Y');
275
- elseif ( is_year() ) :
276
- $ShareTitle='Yearly Archives: '. get_the_date('Y');
277
- elseif ( is_author() ) :
278
- $ShareTitle='Author Archives: '. get_the_author();
279
- else :
280
- $ShareTitle ='Blog Archives';
281
- endif;
282
- //$shareurl=$current_url;
283
-
284
- //$ShareTitle=$post->post_title;
285
- }
286
- else
287
- {
288
- // $shareurl =home_url('/');
289
- $ShareTitle=get_bloginfo('name');
290
- }
291
  $shareurl = htmlspecialchars(csbwfs_get_current_page_url($_SERVER), ENT_QUOTES, 'UTF-8');
292
- /* Set title and url for home page */
293
- if(is_home() || is_front_page())
294
- {
295
- $shareurl =home_url('/');
296
- $ShareTitle=get_bloginfo('name');
297
- }
298
-
299
  $ShareTitle= htmlspecialchars(rawurlencode($ShareTitle));
300
-
301
-
302
-
303
  /* Get All buttons Image */
304
-
305
  //get facebook button image
306
  if($pluginOptionsVal['csbwfs_fb_image']!=''){ $fImg=$pluginOptionsVal['csbwfs_fb_image'];}
307
  else{$fImg='';}
@@ -318,23 +243,17 @@ if($pluginOptionsVal['csbwfs_mail_image']!=''){ $mImg=$pluginOptionsVal['csbwfs_
318
  if($pluginOptionsVal['csbwfs_gp_image']!=''){ $gImg=$pluginOptionsVal['csbwfs_gp_image'];}
319
  else{$gImg='';}
320
  //get pinterest button image
321
-
322
  if($pluginOptionsVal['csbwfs_pin_image']!=''){ $pImg=$pluginOptionsVal['csbwfs_pin_image'];}
323
  else{$pImg='';}
324
-
325
  //get youtube button image
326
  if(isset($pluginOptionsVal['csbwfs_yt_image']) && $pluginOptionsVal['csbwfs_yt_image']!=''){ $ytImg=$pluginOptionsVal['csbwfs_yt_image'];}
327
- else{$ytImg='';}
328
-
329
  //get reddit plus button image
330
  if(isset($pluginOptionsVal['csbwfs_re_image']) && $pluginOptionsVal['csbwfs_re_image']!=''){ $reImg=$pluginOptionsVal['csbwfs_re_image'];}
331
- else{$reImg='';}
332
-
333
  //get stumbleupon button image
334
  if(isset($pluginOptionsVal['csbwfs_st_image']) && $pluginOptionsVal['csbwfs_st_image']!=''){ $stImg=$pluginOptionsVal['csbwfs_st_image'];}
335
  else{$stImg='';}
336
-
337
-
338
  /* Get All buttons Image Alt/Title */
339
  //get facebook button image alt/title
340
  if($pluginOptionsVal['csbwfs_fb_title']!=''){ $fImgAlt=$pluginOptionsVal['csbwfs_fb_title'];}
@@ -362,19 +281,15 @@ if(isset($pluginOptionsVal['csbwfs_re_title']) && $pluginOptionsVal['csbwfs_re_t
362
  else{$reImgAlt='Share On Reddit';}
363
  //get stumbleupon button image alt/title
364
  if(isset($pluginOptionsVal['csbwfs_st_title']) && $pluginOptionsVal['csbwfs_st_title']!=''){ $stImgAlt=$pluginOptionsVal['csbwfs_st_title'];}
365
- else{$stImgAlt='Share On Stumbleupon';}
366
-
367
  //get email message
368
  if(is_page() || is_single() || is_category() || is_archive()){
369
-
370
  if($pluginOptionsVal['csbwfs_mailMessage']!=''){ $mailMsg=$pluginOptionsVal['csbwfs_mailMessage'];} else{
371
  $mailMsg='?subject='.$ShareTitle.'&body='.$shareurl;}
372
  }else
373
  {
374
  $mailMsg='?subject='.get_bloginfo('name').'&body='.home_url('/');
375
  }
376
-
377
-
378
  // Top Margin
379
  if($pluginOptionsVal['csbwfs_top_margin']!=''){
380
  $margin=$pluginOptionsVal['csbwfs_top_margin'];
@@ -558,11 +473,8 @@ $floatingSidebarContent .='<div class="csbwfs-hide"><a href="javascript:" title=
558
  endif;
559
 
560
  $floatingSidebarContent .='</div></div>'; //End social-inner
561
-
562
-
563
  /** Check conditions */
564
- // Returns the content.
565
-
566
  if(isset($pluginOptionsVal['csbwfs_hide_home'])){$hideOnHome=$pluginOptionsVal['csbwfs_hide_home']; }else{ $hideOnHome='';}
567
 
568
  if((is_home() && is_front_page()) && $hideOnHome=='yes'):
@@ -574,10 +486,7 @@ endif;
574
  /** hide on 404 pages */
575
  if(is_404()):$floatingSidebarContent='';endif;
576
 
577
-
578
- print $floatingSidebarContent;
579
-
580
-
581
  }
582
 
583
  /**
@@ -591,46 +500,39 @@ function csbfs_the_content_filter( $content ) {
591
 
592
  global $post;
593
  $pluginOptionsVal=get_csbwf_sidebar_options();
594
-
595
- /*Default Pinit Share image */
596
- /*
597
- if(isset($pluginOptionsVal['csbwfs_defaultfeaturedshrimg']) && $pluginOptionsVal['csbwfs_defaultfeaturedshrimg']!=''){
598
- $pinShareImg=$pluginOptionsVal['csbwfs_defaultfeaturedshrimg'];
599
- }else{
600
- $pinShareImg=plugins_url('images/mrweb-logo.jpg',__FILE__);
601
- }*/
602
-
603
  if(is_category())
604
  {
605
- $category_id = get_query_var('cat');
606
- $shareurl =get_category_link( $category_id );
607
  $cats = get_the_category();
608
  $ShareTitle=$cats[0]->name;
609
- }elseif(is_page() || is_single())
610
  {
611
- /*if ( has_post_thumbnail() )
612
- {
613
- $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
614
-
615
- $pinShareImg= $large_image_url[0] ;
616
- }*/
617
- $shareurl=get_permalink($post->ID);
618
  $ShareTitle=$post->post_title;
619
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
620
  else
621
  {
622
- $shareurl =home_url('/');
623
  $ShareTitle=get_bloginfo('name');
624
  }
625
-
626
  /* Set title and url for home page */
627
- if(is_home() || is_front_page())
628
- {
629
- $shareurl =home_url('/');
630
- $ShareTitle=get_bloginfo('name');
631
- }
632
 
633
- $shareurl = htmlspecialchars($shareurl, ENT_QUOTES, 'UTF-8');
634
 
635
  $ShareTitle= htmlspecialchars(rawurlencode($ShareTitle));
636
 
@@ -861,31 +763,31 @@ global $post;
861
  if(is_front_page() && $pluginOptionsVal['csbwfs_page_hide_home']=='yes'):
862
  $shareButtonContentReturn=$shareButtonContent;
863
  endif;
864
-
865
  if(is_single() && $pluginOptionsVal['csbwfs_page_hide_post']=='yes'):
866
  $shareButtonContentReturn=$shareButtonContent;
867
- // echo 'dfff case 6';
868
  endif;
 
869
  if(is_page() && $pluginOptionsVal['csbwfs_page_hide_page']=='yes'):
870
  if(!is_front_page()):
871
  $shareButtonContentReturn=$shareButtonContent;
872
  endif;
873
  endif;
 
874
  if(is_archive() && $pluginOptionsVal['csbwfs_page_hide_archive']=='yes'):
875
  $shareButtonContentReturn=$shareButtonContent;
876
- //echo 'dfff case 14';
877
  endif;
878
-
879
  if(is_404()):
880
  $shareButtonContentReturn='';
881
- //echo 'dfff case 17';
882
  endif;
883
  /** Buttons position on content */
884
- if(isset($pluginOptionsVal['csbwfs_btn_display']) && $pluginOptionsVal['csbwfs_btn_display']=='above')
885
- {return $shareButtonContentReturn.$content;
886
- }
887
- else {
888
- return $content.$shareButtonContentReturn;
889
  }
 
890
  }
891
  ?>
131
  }
132
 
133
  </script>';
 
 
 
134
  }
 
135
  if(isset($pluginOptionsVal['csbwfs_buttons_active']) && $pluginOptionsVal['csbwfs_buttons_active']==1){
136
  add_filter( 'the_content', 'csbfs_the_content_filter', 20);
137
  add_action( 'wp_enqueue_scripts', 'csbwf_sidebar_scripts' );
138
  }
 
139
  //register style and scrip files
140
  function csbwf_sidebar_scripts() {
141
  wp_enqueue_script( 'jquery' ); // wordpress jQuery
142
  wp_register_style( 'csbwf_sidebar_style', plugins_url( 'css/csbwfs.css',__FILE__ ) );
143
  wp_enqueue_style( 'csbwf_sidebar_style' );
144
  }
145
+ /*********************************************************
146
+ "Add the jQuery code in head section using hooks"
147
+ *********************************************************/
 
 
 
 
 
148
  function csbwf_sidebar_load_inline_js()
149
  {
150
  $pluginOptionsVal=get_csbwf_sidebar_options();
217
  echo $jscnt;
218
  }
219
 
220
+ /********************************************************
221
+ "Custom Share Buttons with Floating Sidebar" HTML
222
+ *********************************************************/
 
 
 
 
223
  function get_csbwf_sidebar_content() {
224
  global $post;
225
  $pluginOptionsVal=get_csbwf_sidebar_options();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  $shareurl = htmlspecialchars(csbwfs_get_current_page_url($_SERVER), ENT_QUOTES, 'UTF-8');
227
+ $ShareTitle = (is_front_page() && is_home()) ? get_bloginfo('name'): trim(wp_title('',false));
 
 
 
 
 
 
228
  $ShareTitle= htmlspecialchars(rawurlencode($ShareTitle));
 
 
 
229
  /* Get All buttons Image */
 
230
  //get facebook button image
231
  if($pluginOptionsVal['csbwfs_fb_image']!=''){ $fImg=$pluginOptionsVal['csbwfs_fb_image'];}
232
  else{$fImg='';}
243
  if($pluginOptionsVal['csbwfs_gp_image']!=''){ $gImg=$pluginOptionsVal['csbwfs_gp_image'];}
244
  else{$gImg='';}
245
  //get pinterest button image
 
246
  if($pluginOptionsVal['csbwfs_pin_image']!=''){ $pImg=$pluginOptionsVal['csbwfs_pin_image'];}
247
  else{$pImg='';}
 
248
  //get youtube button image
249
  if(isset($pluginOptionsVal['csbwfs_yt_image']) && $pluginOptionsVal['csbwfs_yt_image']!=''){ $ytImg=$pluginOptionsVal['csbwfs_yt_image'];}
250
+ else{$ytImg='';}
 
251
  //get reddit plus button image
252
  if(isset($pluginOptionsVal['csbwfs_re_image']) && $pluginOptionsVal['csbwfs_re_image']!=''){ $reImg=$pluginOptionsVal['csbwfs_re_image'];}
253
+ else{$reImg='';}
 
254
  //get stumbleupon button image
255
  if(isset($pluginOptionsVal['csbwfs_st_image']) && $pluginOptionsVal['csbwfs_st_image']!=''){ $stImg=$pluginOptionsVal['csbwfs_st_image'];}
256
  else{$stImg='';}
 
 
257
  /* Get All buttons Image Alt/Title */
258
  //get facebook button image alt/title
259
  if($pluginOptionsVal['csbwfs_fb_title']!=''){ $fImgAlt=$pluginOptionsVal['csbwfs_fb_title'];}
281
  else{$reImgAlt='Share On Reddit';}
282
  //get stumbleupon button image alt/title
283
  if(isset($pluginOptionsVal['csbwfs_st_title']) && $pluginOptionsVal['csbwfs_st_title']!=''){ $stImgAlt=$pluginOptionsVal['csbwfs_st_title'];}
284
+ else{$stImgAlt='Share On Stumbleupon';}
 
285
  //get email message
286
  if(is_page() || is_single() || is_category() || is_archive()){
 
287
  if($pluginOptionsVal['csbwfs_mailMessage']!=''){ $mailMsg=$pluginOptionsVal['csbwfs_mailMessage'];} else{
288
  $mailMsg='?subject='.$ShareTitle.'&body='.$shareurl;}
289
  }else
290
  {
291
  $mailMsg='?subject='.get_bloginfo('name').'&body='.home_url('/');
292
  }
 
 
293
  // Top Margin
294
  if($pluginOptionsVal['csbwfs_top_margin']!=''){
295
  $margin=$pluginOptionsVal['csbwfs_top_margin'];
473
  endif;
474
 
475
  $floatingSidebarContent .='</div></div>'; //End social-inner
 
 
476
  /** Check conditions */
477
+ // Returns the content.
 
478
  if(isset($pluginOptionsVal['csbwfs_hide_home'])){$hideOnHome=$pluginOptionsVal['csbwfs_hide_home']; }else{ $hideOnHome='';}
479
 
480
  if((is_home() && is_front_page()) && $hideOnHome=='yes'):
486
  /** hide on 404 pages */
487
  if(is_404()):$floatingSidebarContent='';endif;
488
 
489
+ print $floatingSidebarContent;
 
 
 
490
  }
491
 
492
  /**
500
 
501
  global $post;
502
  $pluginOptionsVal=get_csbwf_sidebar_options();
 
 
 
 
 
 
 
 
 
503
  if(is_category())
504
  {
505
+ $category_id = get_query_var('cat');
 
506
  $cats = get_the_category();
507
  $ShareTitle=$cats[0]->name;
508
+ }elseif($post && is_singular($post->post_type))
509
  {
 
 
 
 
 
 
 
510
  $ShareTitle=$post->post_title;
511
  }
512
+ elseif(is_archive()){
513
+ global $wp;
514
+ if ( is_day() ) :
515
+ $ShareTitle='Daily Archives: '. get_the_date();
516
+ elseif ( is_month() ) :
517
+ $ShareTitle='Monthly Archives: '. get_the_date('F Y');
518
+ elseif ( is_year() ) :
519
+ $ShareTitle='Yearly Archives: '. get_the_date('Y');
520
+ elseif ( is_author() ) :
521
+ $ShareTitle='Author Archives: '. get_the_author();
522
+ else :
523
+ $ShareTitle ='Blog Archives';
524
+ endif;
525
+ }
526
  else
527
  {
 
528
  $ShareTitle=get_bloginfo('name');
529
  }
 
530
  /* Set title and url for home page */
531
+ if(is_home() && is_front_page()){
532
+ $ShareTitle=get_bloginfo('name');
533
+ }
 
 
534
 
535
+ $shareurl = htmlspecialchars(csbwfs_get_current_page_url($_SERVER), ENT_QUOTES, 'UTF-8');
536
 
537
  $ShareTitle= htmlspecialchars(rawurlencode($ShareTitle));
538
 
763
  if(is_front_page() && $pluginOptionsVal['csbwfs_page_hide_home']=='yes'):
764
  $shareButtonContentReturn=$shareButtonContent;
765
  endif;
766
+ //post
767
  if(is_single() && $pluginOptionsVal['csbwfs_page_hide_post']=='yes'):
768
  $shareButtonContentReturn=$shareButtonContent;
 
769
  endif;
770
+ //page
771
  if(is_page() && $pluginOptionsVal['csbwfs_page_hide_page']=='yes'):
772
  if(!is_front_page()):
773
  $shareButtonContentReturn=$shareButtonContent;
774
  endif;
775
  endif;
776
+ //archive
777
  if(is_archive() && $pluginOptionsVal['csbwfs_page_hide_archive']=='yes'):
778
  $shareButtonContentReturn=$shareButtonContent;
 
779
  endif;
780
+ // 404
781
  if(is_404()):
782
  $shareButtonContentReturn='';
 
783
  endif;
784
  /** Buttons position on content */
785
+ if(isset($pluginOptionsVal['csbwfs_btn_display']) && $pluginOptionsVal['csbwfs_btn_display']=='above'){
786
+ $finalContent= $shareButtonContentReturn.$content;
787
+ }else
788
+ {
789
+ $finalContent = $content.$shareButtonContentReturn;
790
  }
791
+ return $finalContent;
792
  }
793
  ?>
custom-share-buttons-with-floating-sidebar.php CHANGED
@@ -5,10 +5,10 @@ Plugin URI: http://www.mrwebsolution.in/
5
  Description: It's a very simple plugin to add social share buttons with floating sidebar. Even you can edit share buttons images if you wish
6
  Author: MR Web Solution
7
  Author URI: http://raghunathgurjar.wordpress.com
8
- Version: 3.4
9
  */
10
 
11
- /* Copyright 2017 custom-share-buttons-with-floating-sidebar (email : raghunath.0087@gmail.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
@@ -150,7 +150,7 @@ if(!class_exists('Csbwfs_Class'))
150
  */
151
  public function csbwf_sidebar_menu()
152
  {
153
- add_options_page('Custom Share Buttons With Floating Sidebar','Custom Share Buttons With Floating Sidebar','manage_options','csbwfs-settings',array(&$this,'csbwf_sidebar_admin_option_page'));
154
 
155
  } // END public function add_menu()
156
 
@@ -288,6 +288,8 @@ if(class_exists('Csbwfs_Class'))
288
  $plugin = plugin_basename(__FILE__);
289
  add_filter("plugin_action_links_$plugin", array('Csbwfs_Class','csbwfs_add_settings_link'));
290
  require dirname(__FILE__).'/csbwfs-class.php';
 
 
291
  }
292
 
293
 
5
  Description: It's a very simple plugin to add social share buttons with floating sidebar. Even you can edit share buttons images if you wish
6
  Author: MR Web Solution
7
  Author URI: http://raghunathgurjar.wordpress.com
8
+ Version: 3.5
9
  */
10
 
11
+ /* Copyright 2018 custom-share-buttons-with-floating-sidebar (email : raghunath.0087@gmail.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
150
  */
151
  public function csbwf_sidebar_menu()
152
  {
153
+ add_options_page('Social Share Buttons(CSBWFS)','Social Share Buttons(CSBWFS)','manage_options','csbwfs-settings',array(&$this,'csbwf_sidebar_admin_option_page'));
154
 
155
  } // END public function add_menu()
156
 
288
  $plugin = plugin_basename(__FILE__);
289
  add_filter("plugin_action_links_$plugin", array('Csbwfs_Class','csbwfs_add_settings_link'));
290
  require dirname(__FILE__).'/csbwfs-class.php';
291
+ //shortcode
292
+ require dirname(__FILE__).'/lib/shortcode.php';
293
  }
294
 
295
 
lib/settings.php CHANGED
@@ -1,5 +1,4 @@
1
  <div style="width: 80%; padding: 10px; margin: 10px;">
2
-
3
  <h1>Custom Share Buttons With Floating Sidebar Settings</h1>
4
  <!-- Start Options Form -->
5
 
@@ -11,8 +10,10 @@
11
  <!-- General Setting -->
12
  <div class="first csbwfs-tab" id="div-csbwfs-general">
13
  <h2>General Settings</h2>
14
- <p><input type="checkbox" id="csbwfs_active" name="csbwfs_active" value='1' <?php checked(get_option('csbwfs_active'),1);?>/> <b><?php _e('Enable Sidebar');?> </b></p>
15
-
 
 
16
  <p><h3><strong><?php _e('Social Share Button Publish Options:','csbwfs');?></strong></h3></p>
17
  <p><input type="checkbox" id="publish1" value="yes" name="csbwfs_fpublishBtn" <?php checked(get_option('csbwfs_fpublishBtn'),'yes');?>/><b>Facebook Button</b></p>
18
  <p><input type="checkbox" id="publish2" name="csbwfs_tpublishBtn" value="yes" <?php checked(get_option('csbwfs_tpublishBtn'),'yes');?>/> <b>Twitter Button</b></p>
@@ -23,22 +24,22 @@
23
  <p><input type="checkbox" id="publish8" name="csbwfs_stpublishBtn" value="yes" <?php checked(get_option('csbwfs_stpublishBtn'),'yes');?>/> <b>Stumbleupon Button</b></p>
24
  <p><input type="checkbox" id="publish5" name="csbwfs_mpublishBtn" value="yes" <?php checked(get_option('csbwfs_mpublishBtn'),'yes');?>/> <b>Mailbox Button</b></p>
25
  <?php if(get_option('csbwfs_mpublishBtn')=='yes');{?>
26
- <p id="mailmsg"><input type="text" name="csbwfs_mailMessage" id="csbwfs_mailMessage" value="<?php echo get_option('csbwfs_mailMessage');?>" placeholder="raghunath.0087@gmail.com" size="40" class="regular-text ltr"><br>Note:add the mail message like this format <b>your@email.com?subject=Your Subject</b></p>
27
  <?php } ?>
28
  <p><input type="checkbox" id="ytBtns" name="csbwfs_ytpublishBtn" value="yes" <?php checked(get_option('csbwfs_ytpublishBtn'),'yes');?>/> <b>Youtube Button</b></p>
29
- <?php if(get_option('csbwfs_ytpublishBtn')=='yes'){?>
30
  <p id="ytpath"><input type="text" name="csbwfs_ytPath" id="csbwfs_ytPath" value="<?php echo get_option('csbwfs_ytPath');?>" placeholder="http://www.youtube.com" size="40" class="regular-text ltr"><br>add youtube channel url</p>
31
- <?php } ?>
32
-
33
-
34
- <p><label><h3 ><strong><?php _e('Define your custom message:','csbwfs');?></strong></h3></label></p>
35
- <p><label><?php _e('Show:');?></label><input type="text" id="csbwfs_show_btn" name="csbwfs_show_btn" value="<?php echo get_option('csbwfs_show_btn'); ?>" placeholder="Show Buttons" size="40"/></p>
36
- <p><label><?php _e('Hide:');?></label><input type="text" id="csbwfs_hide_btn" name="csbwfs_hide_btn" value="<?php echo get_option('csbwfs_hide_btn'); ?>" placeholder="Hide Buttons" size="40"/></p>
37
- <p><label><?php _e('Message:');?></label><input type="textbox" id="csbwfs_share_msg" name="csbwfs_share_msg" value="<?php echo get_option('csbwfs_share_msg'); ?>" placeholder="Share This With Your Friends" size="40"/></p>
38
- <?php /*?><p><h3><strong><?php _e('Pinterest Share Image Setting :'); ?></strong></h3></p>
39
- <p><?php _e('Default Image :');?><input type="textbox" id="csbwfs_defaultfeaturedshrimg" name="csbwfs_defaultfeaturedshrimg" value="<?php echo get_option('csbwfs_defaultfeaturedshrimg'); ?>" placeholder="" size="55"/></p>
40
- <p><input type="checkbox" id="featuredshrimg" name="csbwfs_featuredshrimg" value="yes" <?php checked(get_option('csbwfs_featuredshrimg'),'yes');?>/> <?php _e('Make post/page featured image as pinterest share image');?></p>
41
- <?php */?>
 
42
  </div>
43
  <!-- Floating Sidebar -->
44
  <div class="csbwfs-tab" id="div-csbwfs-sidebar">
@@ -261,11 +262,12 @@
261
  <div class="last author csbwfs-tab" id="div-csbwfs-pro">
262
 
263
  <h2>GO PRO</h2>
264
- <p><a href="https://rgaddons.wordpress.com/custom-share-buttons-with-floating-sidebar-pro/" target="_blank" class="contact-author">Go Pro</a></p>
265
  <p>We have released an add-on for Custom Share Buttons With Floating Sidebar which not only demonstrates the flexibility of CSBWFS, but also adds some important features:</p>
266
 
267
  <iframe width="560" height="315" src="https://www.youtube.com/embed/tqnAPG5VfFY" frameborder="0" allowfullscreen></iframe>
268
 
 
269
  <ol>
270
  <li>Responsive Floating Sidebar</li>
271
  <li>An option for Hide Floating Sidebar On Home/Blog/Search/Category/Author pages</li>
@@ -291,9 +293,6 @@
291
  <li>An option for remove mouse hover animation effect for all social buttons</li>
292
  <li>Faster support</li>
293
  </ol>
294
- <h2 style="color:green;text-align:center;"><strong>Pay one time use lifetime!!!!!</strong></h2>
295
- <p><a href="https://rgaddons.wordpress.com/custom-share-buttons-with-floating-sidebar-pro/" target="_blank" class="contact-author">Go Pro</a></p>
296
- <p> <a href="mailto:raghunath.0087@gmail.com" target="_blank" class="contact-author">Contact To Author</a></p>
297
  </div>
298
  </div>
299
  <span class="submit-btn"><?php echo get_submit_button('Save Settings','button-primary','submit','','');?></span>
1
  <div style="width: 80%; padding: 10px; margin: 10px;">
 
2
  <h1>Custom Share Buttons With Floating Sidebar Settings</h1>
3
  <!-- Start Options Form -->
4
 
10
  <!-- General Setting -->
11
  <div class="first csbwfs-tab" id="div-csbwfs-general">
12
  <h2>General Settings</h2>
13
+ <table cellpadding="10">
14
+ <tr>
15
+ <td valign="top" nowrap>
16
+ <p><input type="checkbox" id="csbwfs_active" name="csbwfs_active" value='1' <?php checked(get_option('csbwfs_active'),1);?>/> <b><?php _e('Enable Sidebar');?> </b></p>
17
  <p><h3><strong><?php _e('Social Share Button Publish Options:','csbwfs');?></strong></h3></p>
18
  <p><input type="checkbox" id="publish1" value="yes" name="csbwfs_fpublishBtn" <?php checked(get_option('csbwfs_fpublishBtn'),'yes');?>/><b>Facebook Button</b></p>
19
  <p><input type="checkbox" id="publish2" name="csbwfs_tpublishBtn" value="yes" <?php checked(get_option('csbwfs_tpublishBtn'),'yes');?>/> <b>Twitter Button</b></p>
24
  <p><input type="checkbox" id="publish8" name="csbwfs_stpublishBtn" value="yes" <?php checked(get_option('csbwfs_stpublishBtn'),'yes');?>/> <b>Stumbleupon Button</b></p>
25
  <p><input type="checkbox" id="publish5" name="csbwfs_mpublishBtn" value="yes" <?php checked(get_option('csbwfs_mpublishBtn'),'yes');?>/> <b>Mailbox Button</b></p>
26
  <?php if(get_option('csbwfs_mpublishBtn')=='yes');{?>
27
+ <p id="mailmsg"><input type="text" name="csbwfs_mailMessage" id="csbwfs_mailMessage" value="<?php echo get_option('csbwfs_mailMessage');?>" placeholder="your@email.com?subject=Your Subject" size="40" class="regular-text ltr"><br><i>Leave empty to add current page title as subject line and url as body text </i></p>
28
  <?php } ?>
29
  <p><input type="checkbox" id="ytBtns" name="csbwfs_ytpublishBtn" value="yes" <?php checked(get_option('csbwfs_ytpublishBtn'),'yes');?>/> <b>Youtube Button</b></p>
 
30
  <p id="ytpath"><input type="text" name="csbwfs_ytPath" id="csbwfs_ytPath" value="<?php echo get_option('csbwfs_ytPath');?>" placeholder="http://www.youtube.com" size="40" class="regular-text ltr"><br>add youtube channel url</p>
31
+ <p><label><h3 ><strong><?php _e('Define your custom message:','csbwfs');?></strong></h3></label></p>
32
+ <p><label><?php _e('Show:');?></label><input type="text" id="csbwfs_show_btn" name="csbwfs_show_btn" value="<?php echo get_option('csbwfs_show_btn'); ?>" placeholder="Show Buttons" size="40"/></p>
33
+ <p><label><?php _e('Hide:');?></label><input type="text" id="csbwfs_hide_btn" name="csbwfs_hide_btn" value="<?php echo get_option('csbwfs_hide_btn'); ?>" placeholder="Hide Buttons" size="40"/></p>
34
+ <p><label><?php _e('Message:');?></label><input type="textbox" id="csbwfs_share_msg" name="csbwfs_share_msg" value="<?php echo get_option('csbwfs_share_msg'); ?>" placeholder="Share This With Your Friends" size="40"/></p>
35
+ </td>
36
+ <td valign="top" style="border-left:1px solid #ccc;padding-left:20px;">
37
+ <p style="text-align: center;margin:0px;font-size:16px"><a href="//rgaddons.wordpress.com/custom-share-buttons-with-floating-sidebar-pro/" style="color: green;font-weight: bold;font-size: 18px;text-align:center;">“Get 20% discount to addon on occasion of completed 3 Lakhs download of wordpress best social share plugin.“</a><br><marquee direction="right"><i style="color: red;">Offer valid for limited period, so hurry up!!. <a href="https://rgaddons.wordpress.com/custom-share-buttons-with-floating-sidebar-pro/" target="_blank" class="contact-author"><strong>Click Here</strong></a> to download addon. </marquee></i></p>
38
+ <p style="font-size:16px;">Want to know all about addon Features? Watch given below video</p>
39
+ <iframe width="100%" height="500" src="https://www.youtube.com/embed/QUnxtCe95Ww?rel=0&autoplay=1&start=90" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
40
+ <h2><a href="https://rgaddons.wordpress.com/custom-share-buttons-with-floating-sidebar-pro/" target="_blank" class="contact-author"><strong>Click Here</strong></a> to download addon.</h2>
41
+ </tr>
42
+ </table>
43
  </div>
44
  <!-- Floating Sidebar -->
45
  <div class="csbwfs-tab" id="div-csbwfs-sidebar">
262
  <div class="last author csbwfs-tab" id="div-csbwfs-pro">
263
 
264
  <h2>GO PRO</h2>
265
+ <p><a href="https://rgaddons.wordpress.com/custom-share-buttons-with-floating-sidebar-pro/" target="_blank" class="contact-author">Click here</a> to download addon.</p>
266
  <p>We have released an add-on for Custom Share Buttons With Floating Sidebar which not only demonstrates the flexibility of CSBWFS, but also adds some important features:</p>
267
 
268
  <iframe width="560" height="315" src="https://www.youtube.com/embed/tqnAPG5VfFY" frameborder="0" allowfullscreen></iframe>
269
 
270
+ <h2 style="color:green;text-align:center;"><strong>Pay one time use lifetime!!!!!</strong></h2>
271
  <ol>
272
  <li>Responsive Floating Sidebar</li>
273
  <li>An option for Hide Floating Sidebar On Home/Blog/Search/Category/Author pages</li>
293
  <li>An option for remove mouse hover animation effect for all social buttons</li>
294
  <li>Faster support</li>
295
  </ol>
 
 
 
296
  </div>
297
  </div>
298
  <span class="submit-btn"><?php echo get_submit_button('Save Settings','button-primary','submit','','');?></span>
lib/shortcode.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Template files to define CSBWFS Shortcodes
4
+ * @add_shortcode()
5
+ * @do_shortcode()
6
+ * shortcode [csbwfs_buttons]
7
+ **/
8
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
+
10
+ if(!class_exists('CsbwfsShortcodeClass')):
11
+ class CsbwfsShortcodeClass {
12
+ /**
13
+ * Construct the plugin object
14
+ */
15
+ public function __construct()
16
+ {
17
+ // register actions
18
+ add_shortcode( 'csbwfs_buttons', array(&$this, 'csbwfs_shortcode_func' ) );
19
+ add_filter( 'widget_text', 'do_shortcode' );
20
+ } // END public function __construct
21
+
22
+
23
+ public function csbwfs_shortcode_style_func() {
24
+ echo '<style type="text/css">.csbwfs-shortcode a{box-shadow:inherit}.csbwfs-shortcode a i{display:inline-block;position:relative;width:35px;height:36px;background-image:url('.plugin_dir_url( __FILE__ ).'../images/minify-social.png)}.csbwfs-shortcode{display:inline-block;position:relative;width:auto;}i.csbwfs_facebook{background-position:68% 4%}i.csbwfs_twitter{background-position:14% 4%}i.csbwfs_plus{background-position:80% 4%}i.csbwfs_linkedin{background-position:92% 4%}i.csbwfs_pinterest{background-position:14% 19%}i.csbwfs_youtube{background-position:32% 4%}i.csbwfs_reddit{background-position:26% 19%}i.csbwfs_stumbleupon{background-position:2% 4%}i.csbwfs_mail{background-position:8% 19%}</style>';
25
+ }
26
+
27
+ public static function csbwfs_shortcode_func($atts) {
28
+ //[csbwfs_buttons buttons='fb,tw,gp,li,pi,yt,re,st,ml']
29
+ $shortcode_html = '';
30
+ $btnsordaryy = isset($atts['buttons']) ? explode(',',$atts['buttons']) : array();
31
+ $class = isset($atts['class']) ? $atts['class'] : '';
32
+ if(is_array($btnsordaryy) && count($btnsordaryy) > 0 ){
33
+ add_action( 'wp_footer', array(&$this,'csbwfs_shortcode_style_func' ));
34
+ $shortcode_html .= '<div id="csbwfs-shortcode" class="'.$class.'">';
35
+ foreach($btnsordaryy as $btnsVal)
36
+ {
37
+ /** FB */
38
+ if($btnsVal=='fb'):
39
+ $shortcode_html .='<div id="csbwfs-fb" class="csbwfs-shortcode"><a href="javascript:" onclick="javascript:window.open(\'//www.facebook.com/sharer/sharer.php?u=\'+encodeURIComponent(location.href)+\'&title=\'+encodeURIComponent(document.title)+\'&jump=close\', \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600\');return false;" target="_blank" ><i class="csbwfs_facebook"></i></a></div>';
40
+ endif;
41
+ /** TW */
42
+ if($btnsVal=='tw'):
43
+ $shortcode_html .='<div id="csbwfs-tw" class="csbwfs-shortcode"><a href="javascript:" onclick="window.open(\'//twitter.com/share?url=\'+encodeURIComponent(location.href)+\'&text=\'+encodeURIComponent(document.title)+\'&jump=close\',\'_blank\',\'width=800,height=300\')" ><i class="csbwfs_twitter"></i></a></div>';
44
+
45
+ endif;
46
+
47
+ /** GP */
48
+ if($btnsVal=='gp'):
49
+ $shortcode_html .='<div id="csbwfs-gp" class="csbwfs-shortcode"><a href="javascript:" onclick="javascript:window.open(\'//plus.google.com/share?url=\'+encodeURIComponent(location.href)+\'&title=\'+encodeURIComponent(document.title)+\'&jump=close\',\'\',\'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=800\');return false;"><i class="csbwfs_plus"></i></a></div>';
50
+ endif;
51
+
52
+ /** LI */
53
+ if($btnsVal=='li'):
54
+ $shortcode_html .='<div id="csbwfs-li" class="csbwfs-shortcode"><a href="javascript:" onclick="javascript:window.open(\'//www.linkedin.com/shareArticle?mini=true&url=\'+encodeURIComponent(location.href)+\'&title=\'+encodeURIComponent(document.title)+\'&jump=close\',\'\',\'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=800\');return false;" ><i class="csbwfs_linkedin"></i></a></div>';
55
+ endif;
56
+
57
+ /** PIN */
58
+ if($btnsVal=='pi'):
59
+ $shortcode_html .='<div id="csbwfs-pin" class="csbwfs-shortcode"><a onclick="javascript:void((function(){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)})());" href="javascript:void(0);"><i class="csbwfs_pinterest"></i></a></div>';
60
+ endif;
61
+
62
+ /** Reddit */
63
+ if($btnsVal=='re'):
64
+ $shortcode_html .='<div id="csbwfs-re" class="csbwfs-shortcode"><a onclick="window.open(\'//reddit.com/submit?url=\'+encodeURIComponent(location.href)+\'&title=\'+encodeURIComponent(document.title)+\'&jump=close\',\'Reddit\',\'toolbar=0,status=0,width=1000,height=800\');" href="javascript:void(0);"><i class="csbwfs_reddit"></i></a></div>';
65
+ endif;
66
+
67
+ /** Stumbleupon */
68
+ if($btnsVal=='st'):
69
+ $shortcode_html .='<div id="csbwfs-st" class="csbwfs-shortcode"><a onclick="window.open(\'//www.stumbleupon.com/submit?url=\'+encodeURIComponent(location.href)+\'&title=\'+encodeURIComponent(document.title)+\'&jump=close\',\'Stumbleupon\',\'toolbar=0,status=0,width=1000,height=800\');" href="javascript:void(0);"><i class="csbwfs_stumbleupon"></i></a></div>';
70
+ endif;
71
+ /** YT */
72
+ if($btnsVal=='yt'):
73
+ $shortcode_html .='<div id="csbwfs-yt" class="csbwfs-shortcode"><a onclick="window.open(\''.get_option('csbwfs_ytPath').'\');" href="javascript:void(0);"><i class="csbwfs_youtube"></i></a></div>';
74
+ endif;
75
+ /** Mail*/
76
+ if($btnsVal=='ml'):
77
+ $shortcode_html .='<div id="csbwfs-ml" class="csbwfs-shortcode"><a onclick="javascript:window.location=(\'mailto:'.get_bloginfo('admin_email').'\'+\'?subject=\'+encodeURIComponent(document.title)+\'&body=\'+encodeURIComponent(location.href));" href="javascript:void(0);" ><i class="csbwfs_mail"></i></a></div>';
78
+ endif;
79
+ }
80
+ $shortcode_html .='</div>'; //End #csbwfs-shortcode
81
+ }
82
+ return $shortcode_html;
83
+ }
84
+ }
85
+ //init class
86
+ new CsbwfsShortcodeClass(); //init
87
+ endif;
readme.txt CHANGED
@@ -1,18 +1,18 @@
1
  === Custom Share Buttons with Floating Sidebar ===
2
  Contributors:india-web-developer
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZEMSYQUZRUK6A
4
- Tags: social share buttons,custom share buttons,facebook, twitter, google+, share buttons,linkedin,Stumbleupon,Reddit,pinterest,Xing,floating sidebar,float,floating share buttons,float share buttons
5
  Requires at least: 4.0
6
- Tested up to: 4.9.1
7
- Stable tag: 3.4
8
 
9
- Social Share Buttons (Facebook,Twitter,Linkedin,Google+,Pinterest,Youtube,Mail,Stumbleupon,Reddit) & Share Floating Sidebar.
10
 
11
  == Description ==
12
 
13
- = “custom-share-buttons-with-floating-sidebar” = It is a plugin to share your site among your friends through social sites. This plugin supports 9 social networking websites.
14
 
15
- By using this plugin, visitors can share your website on popular social networks such as Facebook, Twitter, Linkedin, Pinterest, Google+, Stumbleupon, Reddit, Youtube.
16
 
17
  https://youtu.be/tqnAPG5VfFY
18
 
@@ -27,11 +27,18 @@ It is a lightweight plugin. There is no external JS file added in this plugin s
27
  You can add a social share floating sidebar with all social share buttons and Even you can change the share buttons images and their style from admin if you wish!.
28
 
29
 
30
- **[Upgrade to Pro Version](https://rgaddons.wordpress.com/custom-share-buttons-with-floating-sidebar-pro/)**
31
 
 
 
 
32
 
33
- = Features =
34
 
 
 
 
 
 
35
  * An options to add Custom Image of any social button.
36
  * An options to add background color of social button.
37
  * Floating Sidebar
@@ -49,7 +56,7 @@ You can add a social share floating sidebar with all social share buttons and Ev
49
 
50
  = Go Pro =
51
 
52
- We have also released an add-on for Custom Share Buttons With Floating Sidebar which not only demonstrates the flexibility of CSBWFS, but also adds some important features:
53
 
54
  PRO FEATURES :
55
 
@@ -138,6 +145,10 @@ Step 3. Go to Settings/"Custom Share Buttons with Floating Sidebar" and configur
138
  9.) Is there any option for show/hide share buttons OR floating sidebar on some specific pages?
139
 
140
  * No. this options are available in pro addon.
 
 
 
 
141
 
142
  == Screenshots ==
143
 
@@ -161,6 +172,12 @@ Step 3. Go to Settings/"Custom Share Buttons with Floating Sidebar" and configur
161
 
162
  == Changelog ==
163
 
 
 
 
 
 
 
164
  = 3.4 =
165
  * Tested with latest wordpress version 4.9.1
166
  * Optimized CSS of share buttons
1
  === Custom Share Buttons with Floating Sidebar ===
2
  Contributors:india-web-developer
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZEMSYQUZRUK6A
4
+ Tags: social share buttons,custom share buttons,facebook, twitter, google+,linkedin,Stumbleupon,Reddit,pinterest,Xing, social share floating sidebar
5
  Requires at least: 4.0
6
+ Tested up to: 4.9.7
7
+ Stable tag: 3.5
8
 
9
+ A best =Social Share= plugin that help to increases traffic & engagement on your website.
10
 
11
  == Description ==
12
 
13
+ = “custom-share-buttons-with-floating-sidebar” = It is a plugin to share your site among your friends through social sites and help to increases traffic on your website. This plugin supports 9 social networking websites.
14
 
15
+ Using =custom-share-buttons-with-floating-sidebar= plugin, visitors can share your website on popular social networks such as Facebook, Twitter, Linkedin, Pinterest, Google+, Stumbleupon, Reddit, Youtube.
16
 
17
  https://youtu.be/tqnAPG5VfFY
18
 
27
  You can add a social share floating sidebar with all social share buttons and Even you can change the share buttons images and their style from admin if you wish!.
28
 
29
 
30
+ =Shortcode=
31
 
32
+ [csbwfs_buttons buttons='fb,tw,gp,li,pi,yt,re,st,ml']
33
+
34
+ fb-facebook,tw-twitter,gp-google-plus,li-linkedin,pi-pinterest,yt-youtube,re-reddit,st-stumbleupon,ml-mail
35
 
 
36
 
37
+ **[I want upgrade to Pro Version](https://rgaddons.wordpress.com/custom-share-buttons-with-floating-sidebar-pro/)**
38
+
39
+
40
+ = Features =
41
+ * Shortcode
42
  * An options to add Custom Image of any social button.
43
  * An options to add background color of social button.
44
  * Floating Sidebar
56
 
57
  = Go Pro =
58
 
59
+ We have also released an addon of Custom Share Buttons With Floating Sidebar which not only demonstrates the flexibility of CSBWFS, but also adds some important features:
60
 
61
  PRO FEATURES :
62
 
145
  9.) Is there any option for show/hide share buttons OR floating sidebar on some specific pages?
146
 
147
  * No. this options are available in pro addon.
148
+
149
+ 9.) Is there any shortcode of social share buttons?
150
+
151
+ * Yes, [csbwfs_buttons]
152
 
153
  == Screenshots ==
154
 
172
 
173
  == Changelog ==
174
 
175
+ = 3.5 =
176
+ * Tested with latest wordpress version 4.9.7
177
+ * Fixed blog page share url issues
178
+ * Optimized code
179
+ * Released addon new version 3.5 with new features
180
+
181
  = 3.4 =
182
  * Tested with latest wordpress version 4.9.1
183
  * Optimized CSS of share buttons