Social Counter for WordPress – AccessPress Social Counter - Version 1.0.3

Version Description

  • Added Theme Selection Feature in widget
Download this release

Release Info

Developer Access Keys
Plugin Icon 128x128 Social Counter for WordPress – AccessPress Social Counter
Version 1.0.3
Comparing to
See all releases

Code changes from version 1.0.2 to 1.0.3

accesspress-social-counter.php CHANGED
@@ -5,7 +5,7 @@ defined('ABSPATH') or die("No script kiddies please!");
5
  * Plugin Name: AccessPress Social Counter
6
  * Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-counter/
7
  * Description: A plugin to display your social accounts fans, subscribers and followers number on your website with handful of backend settings and interface.
8
- * Version: 1.0.2
9
  * Author: AccessPress Themes
10
  * Author URI: http://accesspressthemes.com
11
  * Text Domain: aps-counter
@@ -26,7 +26,7 @@ if (!defined('SC_CSS_DIR')) {
26
  define('SC_CSS_DIR', plugin_dir_url(__FILE__) . 'css');
27
  }
28
  if (!defined('SC_VERSION')) {
29
- define('SC_VERSION', '1.0.2');
30
  }
31
  /**
32
  * Register of widgets
@@ -175,7 +175,7 @@ if (!class_exists('SC_Class')) {
175
  /**
176
  * Adds Shortcode
177
  */
178
- function apsc_shortcode() {
179
  ob_start();
180
  include('inc/frontend/shortcode.php');
181
  $html = ob_get_contents();
5
  * Plugin Name: AccessPress Social Counter
6
  * Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-counter/
7
  * Description: A plugin to display your social accounts fans, subscribers and followers number on your website with handful of backend settings and interface.
8
+ * Version: 1.0.3
9
  * Author: AccessPress Themes
10
  * Author URI: http://accesspressthemes.com
11
  * Text Domain: aps-counter
26
  define('SC_CSS_DIR', plugin_dir_url(__FILE__) . 'css');
27
  }
28
  if (!defined('SC_VERSION')) {
29
+ define('SC_VERSION', '1.0.3');
30
  }
31
  /**
32
  * Register of widgets
175
  /**
176
  * Adds Shortcode
177
  */
178
+ function apsc_shortcode($atts) {
179
  ob_start();
180
  include('inc/frontend/shortcode.php');
181
  $html = ob_get_contents();
inc/backend/boards/display-settings.php CHANGED
@@ -33,23 +33,23 @@
33
  <div class="apsc-option-field">
34
  <label>
35
  <input type="radio" name="social_profile_theme" value="theme-1" <?php if($apsc_settings['social_profile_theme']=='theme-1'){?>checked="checked"<?php }?>/><?php _e('Theme 1', 'aps-counter'); ?>
36
- <div class="apsc-theme-image"><img src="<?php echo SC_IMAGE_DIR.'/themes/theme-1.JPG';?>"/></div>
37
  </label>
38
  <label>
39
  <input type="radio" name="social_profile_theme" value="theme-2" <?php if($apsc_settings['social_profile_theme']=='theme-2'){?>checked="checked"<?php }?>/><?php _e('Theme 2', 'aps-counter'); ?>
40
- <div class="apsc-theme-image"><img src="<?php echo SC_IMAGE_DIR.'/themes/theme-2.JPG';?>"/></div>
41
  </label>
42
  <label>
43
  <input type="radio" name="social_profile_theme" value="theme-3" <?php if($apsc_settings['social_profile_theme']=='theme-3'){?>checked="checked"<?php }?>/><?php _e('Theme 3', 'aps-counter'); ?>
44
- <div class="apsc-theme-image"><img src="<?php echo SC_IMAGE_DIR.'/themes/theme-3.JPG';?>"/></div>
45
  </label>
46
  <label>
47
  <input type="radio" name="social_profile_theme" value="theme-4" <?php if($apsc_settings['social_profile_theme']=='theme-4'){?>checked="checked"<?php }?>/><?php _e('Theme 4', 'aps-counter'); ?>
48
- <div class="apsc-theme-image"><img src="<?php echo SC_IMAGE_DIR.'/themes/theme-4.JPG';?>"/></div>
49
  </label>
50
  <label>
51
  <input type="radio" name="social_profile_theme" value="theme-5" <?php if($apsc_settings['social_profile_theme']=='theme-5'){?>checked="checked"<?php }?>/><?php _e('Theme 5', 'aps-counter'); ?>
52
- <div class="apsc-theme-image"><img src="<?php echo SC_IMAGE_DIR.'/themes/theme-5.JPG';?>"/></div>
53
  </label>
54
  </div>
55
  </div>
33
  <div class="apsc-option-field">
34
  <label>
35
  <input type="radio" name="social_profile_theme" value="theme-1" <?php if($apsc_settings['social_profile_theme']=='theme-1'){?>checked="checked"<?php }?>/><?php _e('Theme 1', 'aps-counter'); ?>
36
+ <div class="apsc-theme-image"><img src="<?php echo SC_IMAGE_DIR.'/themes/theme-1.jpg';?>"/></div>
37
  </label>
38
  <label>
39
  <input type="radio" name="social_profile_theme" value="theme-2" <?php if($apsc_settings['social_profile_theme']=='theme-2'){?>checked="checked"<?php }?>/><?php _e('Theme 2', 'aps-counter'); ?>
40
+ <div class="apsc-theme-image"><img src="<?php echo SC_IMAGE_DIR.'/themes/theme-2.jpg';?>"/></div>
41
  </label>
42
  <label>
43
  <input type="radio" name="social_profile_theme" value="theme-3" <?php if($apsc_settings['social_profile_theme']=='theme-3'){?>checked="checked"<?php }?>/><?php _e('Theme 3', 'aps-counter'); ?>
44
+ <div class="apsc-theme-image"><img src="<?php echo SC_IMAGE_DIR.'/themes/theme-3.jpg';?>"/></div>
45
  </label>
46
  <label>
47
  <input type="radio" name="social_profile_theme" value="theme-4" <?php if($apsc_settings['social_profile_theme']=='theme-4'){?>checked="checked"<?php }?>/><?php _e('Theme 4', 'aps-counter'); ?>
48
+ <div class="apsc-theme-image"><img src="<?php echo SC_IMAGE_DIR.'/themes/theme-4.jpg';?>"/></div>
49
  </label>
50
  <label>
51
  <input type="radio" name="social_profile_theme" value="theme-5" <?php if($apsc_settings['social_profile_theme']=='theme-5'){?>checked="checked"<?php }?>/><?php _e('Theme 5', 'aps-counter'); ?>
52
+ <div class="apsc-theme-image"><img src="<?php echo SC_IMAGE_DIR.'/themes/theme-5.jpg';?>"/></div>
53
  </label>
54
  </div>
55
  </div>
inc/backend/widget.php CHANGED
@@ -30,7 +30,15 @@ class APSC_Widget extends WP_Widget {
30
  if (!empty($instance['title'])) {
31
  echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
32
  }
33
- echo do_shortcode('[aps-counter]');
 
 
 
 
 
 
 
 
34
  echo $args['after_widget'];
35
  }
36
 
@@ -42,18 +50,26 @@ class APSC_Widget extends WP_Widget {
42
  * @param array $instance Previously saved values from database.
43
  */
44
  public function form($instance) {
45
- if (isset($instance['title'])) {
46
- $title = $instance['title'];
47
- } else {
48
- $title = '';
49
- }
50
  ?>
51
  <p>
52
 
53
  <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'aps-counter'); ?></label>
54
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>">
55
  </p>
 
56
 
 
 
 
 
 
 
 
 
 
 
57
  <?php
58
  }
59
 
@@ -71,6 +87,7 @@ class APSC_Widget extends WP_Widget {
71
  //die(print_r($new_instance));
72
  $instance = array();
73
  $instance['title'] = (!empty($new_instance['title']) ) ? strip_tags($new_instance['title']) : '';
 
74
  return $instance;
75
  }
76
 
30
  if (!empty($instance['title'])) {
31
  echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
32
  }
33
+ if(isset($instance['theme']) && $instance['theme']!='')
34
+ {
35
+ echo do_shortcode('[aps-counter theme="'.$instance['theme'].'"]');
36
+ }
37
+ else
38
+ {
39
+ echo do_shortcode('[aps-counter]');
40
+ }
41
+
42
  echo $args['after_widget'];
43
  }
44
 
50
  * @param array $instance Previously saved values from database.
51
  */
52
  public function form($instance) {
53
+ $title = isset($instance['title'])?$instance['title']:'';
54
+ $theme = isset($instance['theme'])?$instance['theme']:'';
 
 
 
55
  ?>
56
  <p>
57
 
58
  <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'aps-counter'); ?></label>
59
+ <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>"/>
60
  </p>
61
+ <p>
62
 
63
+ <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Theme:', 'aps-counter'); ?></label>
64
+ <select class="widefat" id="<?php echo $this->get_field_id('theme'); ?>" name="<?php echo $this->get_field_name('theme'); ?>" >
65
+ <option value="">Default</option>
66
+ <?php for($i=1;$i<=5;$i++){
67
+ ?>
68
+ <option value="theme-<?php echo $i;?>" <?php selected($theme,'theme-'.$i);?>>Theme <?php echo $i;?></option>
69
+ <?php
70
+ }?>
71
+ </select>
72
+ </p>
73
  <?php
74
  }
75
 
87
  //die(print_r($new_instance));
88
  $instance = array();
89
  $instance['title'] = (!empty($new_instance['title']) ) ? strip_tags($new_instance['title']) : '';
90
+ $instance['theme'] = (!empty($new_instance['theme']) ) ? strip_tags($new_instance['theme']) : '';
91
  return $instance;
92
  }
93
 
inc/frontend/shortcode.php CHANGED
@@ -2,8 +2,8 @@
2
  defined('ABSPATH') or die("No script kiddies please!");
3
 
4
  $apsc_settings = $this->apsc_settings;
5
- $cache_period = ($apsc_settings['cache_period'] != '') ? $apsc_settings['cache_period']*60*60 : 24 * 60 * 60;
6
-
7
  ?>
8
  <div class="apsc-icons-wrapper clearfix apsc-<?php echo $apsc_settings['social_profile_theme']; ?>" >
9
  <?php
@@ -37,7 +37,7 @@ $apsc_settings = $this->apsc_settings;
37
  } else {
38
  $count = $facebook_count;
39
  }
40
- ?><span class="apsc-count"><?php echo $count; ?></span><span class="apsc-media-type">Fan</span></div></a>
41
  <?php
42
  break;
43
  case 'twitter':
2
  defined('ABSPATH') or die("No script kiddies please!");
3
 
4
  $apsc_settings = $this->apsc_settings;
5
+ $cache_period = ($apsc_settings['cache_period'] != '') ? $apsc_settings['cache_period']*60*60 : 24 * 60 * 60;
6
+ $apsc_settings['social_profile_theme'] = isset($atts['theme'])?$atts['theme']:$apsc_settings['social_profile_theme'];
7
  ?>
8
  <div class="apsc-icons-wrapper clearfix apsc-<?php echo $apsc_settings['social_profile_theme']; ?>" >
9
  <?php
37
  } else {
38
  $count = $facebook_count;
39
  }
40
+ ?><span class="apsc-count"><?php echo $count; ?></span><span class="apsc-media-type">Fans</span></div></a>
41
  <?php
42
  break;
43
  case 'twitter':
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: social count, social counter, social counters, social media counters, soci
4
  Donate link: http://accesspressthemes.com/donation/
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
- Stable tag: 1.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -93,6 +93,9 @@ Once you install the plugin , you can check some general documentation about how
93
  5. Backend Cache Settings Section
94
 
95
  == Changelog ==
 
 
 
96
  = 1.0.2 =
97
  * Done number formatting for counts
98
 
4
  Donate link: http://accesspressthemes.com/donation/
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
+ Stable tag: 1.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
93
  5. Backend Cache Settings Section
94
 
95
  == Changelog ==
96
+ = 1.0.3 =
97
+ * Added Theme Selection Feature in widget
98
+
99
  = 1.0.2 =
100
  * Done number formatting for counts
101