Version Description
- Updated Facebook API
- Added Youtube Subscribers field for mannual count
Download this release
Release Info
Developer | Access Keys |
Plugin | Social Counter for WordPress – AccessPress Social Counter |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.9 to 1.2.0
- accesspress-social-counter.php +17 -2
- css/backend.css +8 -0
- inc/backend/boards/social-profiles.php +10 -0
- inc/frontend/shortcode.php +6 -36
- readme.txt +5 -1
accesspress-social-counter.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: AccessPress Social Counter
|
4 |
* Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-counter/
|
5 |
* Description: A plugin to display your social accounts fans, subscribers and followers number on your website with handful of backend settings and interface.
|
6 |
-
* Version: 1.
|
7 |
* Author: AccessPress Themes
|
8 |
* Author URI: http://accesspressthemes.com
|
9 |
* Text Domain: aps-counter
|
@@ -24,7 +24,7 @@ if (!defined('SC_CSS_DIR')) {
|
|
24 |
define('SC_CSS_DIR', plugin_dir_url(__FILE__) . 'css');
|
25 |
}
|
26 |
if (!defined('SC_VERSION')) {
|
27 |
-
define('SC_VERSION', '1.
|
28 |
}
|
29 |
/**
|
30 |
* Register of widgets
|
@@ -352,6 +352,21 @@ if (!class_exists('SC_Class')) {
|
|
352 |
}
|
353 |
}
|
354 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
|
356 |
|
357 |
}
|
3 |
* Plugin Name: AccessPress Social Counter
|
4 |
* Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-counter/
|
5 |
* Description: A plugin to display your social accounts fans, subscribers and followers number on your website with handful of backend settings and interface.
|
6 |
+
* Version: 1.2.0
|
7 |
* Author: AccessPress Themes
|
8 |
* Author URI: http://accesspressthemes.com
|
9 |
* Text Domain: aps-counter
|
24 |
define('SC_CSS_DIR', plugin_dir_url(__FILE__) . 'css');
|
25 |
}
|
26 |
if (!defined('SC_VERSION')) {
|
27 |
+
define('SC_VERSION', '1.2.0');
|
28 |
}
|
29 |
/**
|
30 |
* Register of widgets
|
352 |
}
|
353 |
}
|
354 |
}
|
355 |
+
|
356 |
+
function facebook_count($url){
|
357 |
+
|
358 |
+
// Query in FQL
|
359 |
+
$fql = "SELECT like_count ";
|
360 |
+
$fql .= " FROM link_stat WHERE url = '$url'";
|
361 |
+
|
362 |
+
$fqlURL = "https://api.facebook.com/method/fql.query?format=json&query=" . urlencode($fql);
|
363 |
+
|
364 |
+
// Facebook Response is in JSON
|
365 |
+
$response = file_get_contents($fqlURL);
|
366 |
+
$response = json_decode($response);
|
367 |
+
return $response[0]->like_count;
|
368 |
+
|
369 |
+
}
|
370 |
|
371 |
|
372 |
}
|
css/backend.css
CHANGED
@@ -736,3 +736,11 @@ padding: 1px 12px;
|
|
736 |
display:inline-block;
|
737 |
}
|
738 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
display:inline-block;
|
737 |
}
|
738 |
|
739 |
+
.apsc-extra-note {
|
740 |
+
background-color: #FFFBCC;
|
741 |
+
padding: 10px;
|
742 |
+
font-style: italic;
|
743 |
+
font-size: 15px;
|
744 |
+
margin-bottom: 25px;
|
745 |
+
margin-top: -10px;
|
746 |
+
}
|
inc/backend/boards/social-profiles.php
CHANGED
@@ -129,6 +129,9 @@
|
|
129 |
<!--Youtube-->
|
130 |
<div class="apsc-option-outer-wrapper">
|
131 |
<h4><?php _e('Youtube', 'aps-counter') ?></h4>
|
|
|
|
|
|
|
132 |
<div class="apsc-option-inner-wrapper">
|
133 |
<label><?php _e('Display Counter', 'aps-counter') ?></label>
|
134 |
<div class="apsc-option-field"><label><input type="checkbox" name="social_profile[youtube][active]" value="1" class="apsc-counter-activation-trigger" <?php if(isset($apsc_settings['social_profile']['youtube']['active'])){?>checked="checked"<?php } ?>/><?php _e('Show/Hide', 'aps-counter'); ?></label></div>
|
@@ -148,6 +151,13 @@
|
|
148 |
<div class="apsc-option-note"><?php _e('Please enter the youtube channel URL.For example:https://www.youtube.com/user/accesspressthemes', 'aps-counter'); ?></div>
|
149 |
</div>
|
150 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
</div>
|
152 |
</div>
|
153 |
<!--Youtube-->
|
129 |
<!--Youtube-->
|
130 |
<div class="apsc-option-outer-wrapper">
|
131 |
<h4><?php _e('Youtube', 'aps-counter') ?></h4>
|
132 |
+
<div class="apsc-extra-note">
|
133 |
+
<p><?php _e('Note: Youtube has recently deprecated its gdata API and updated its API to v3 which needs authentication and complicated mechanism to get the simple count.So we are working on the easier solution.Till then please use the Youtube Subscribers Count for displaying the count in frontend.','aps-counter')?></p>
|
134 |
+
</div>
|
135 |
<div class="apsc-option-inner-wrapper">
|
136 |
<label><?php _e('Display Counter', 'aps-counter') ?></label>
|
137 |
<div class="apsc-option-field"><label><input type="checkbox" name="social_profile[youtube][active]" value="1" class="apsc-counter-activation-trigger" <?php if(isset($apsc_settings['social_profile']['youtube']['active'])){?>checked="checked"<?php } ?>/><?php _e('Show/Hide', 'aps-counter'); ?></label></div>
|
151 |
<div class="apsc-option-note"><?php _e('Please enter the youtube channel URL.For example:https://www.youtube.com/user/accesspressthemes', 'aps-counter'); ?></div>
|
152 |
</div>
|
153 |
</div>
|
154 |
+
<div class="apsc-option-inner-wrapper">
|
155 |
+
<label><?php _e('Youtube Subscribers Count', 'aps-counter'); ?></label>
|
156 |
+
<div class="apsc-option-field">
|
157 |
+
<input type="text" name="social_profile[youtube][subscribers_count]" value="<?php echo isset($apsc_settings['social_profile']['youtube']['subscribers_count'])?$apsc_settings['social_profile']['youtube']['subscribers_count']:0;?>"/>
|
158 |
+
<div class="apsc-option-note"><?php _e('Please enter the youtube channel URL.For example:https://www.youtube.com/user/accesspressthemes', 'aps-counter'); ?></div>
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
</div>
|
162 |
</div>
|
163 |
<!--Youtube-->
|
inc/frontend/shortcode.php
CHANGED
@@ -22,19 +22,11 @@ $format = isset($apsc_settings['counter_format'])?$apsc_settings['counter_format
|
|
22 |
$facebook_count = get_transient('apsc_facebook');
|
23 |
if (false === $facebook_count) {
|
24 |
|
25 |
-
$api_url = '
|
26 |
-
|
27 |
-
|
28 |
-
'timeout' => 60
|
29 |
-
);
|
30 |
-
$connection = wp_remote_get($api_url, $params);
|
31 |
-
if (is_wp_error($connection)) {
|
32 |
-
$count = 0;
|
33 |
-
} else {
|
34 |
-
$body = json_decode($connection['body']);
|
35 |
-
$count = ($body->likes);
|
36 |
set_transient('apsc_facebook', $count, $cache_period);
|
37 |
-
|
38 |
} else {
|
39 |
$count = $facebook_count;
|
40 |
}
|
@@ -131,30 +123,8 @@ $format = isset($apsc_settings['counter_format'])?$apsc_settings['counter_format
|
|
131 |
?>
|
132 |
<a class="apsc-youtube-icon clearfix" href="<?php echo $social_profile_url; ?>" target="_blank"><div class="apsc-inner-block"><span class="social-icon"><i class="apsc-youtube fa fa-youtube"></i><span class="media-name">Youtube</span></span>
|
133 |
<?php
|
134 |
-
$youtube_count =
|
135 |
-
|
136 |
-
$api_url = 'https://gdata.youtube.com/feeds/api/users/' . $apsc_settings['social_profile']['youtube']['username'];
|
137 |
-
$params = array(
|
138 |
-
'sslverify' => false,
|
139 |
-
'timeout' => 60
|
140 |
-
);
|
141 |
-
$connection = wp_remote_get($api_url, $params);
|
142 |
-
if (is_wp_error($connection)) {
|
143 |
-
$count = 0;
|
144 |
-
} else {
|
145 |
-
try {
|
146 |
-
$body = str_replace('yt:', '', $connection['body']);
|
147 |
-
$xml = @new SimpleXmlElement($body, LIBXML_NOCDATA);
|
148 |
-
$count = (intval($xml->statistics['subscriberCount']));
|
149 |
-
set_transient('apsc_youtube',$count,$cache_period);
|
150 |
-
} catch (Exception $e) {
|
151 |
-
$count = 0;
|
152 |
-
}
|
153 |
-
}
|
154 |
-
} else {
|
155 |
-
$count = $youtube_count;
|
156 |
-
}
|
157 |
-
$count = $this->get_formatted_count($count,$format);
|
158 |
?><span class="apsc-count"><?php echo $count; ?></span><span class="apsc-media-type">Subscriber</span></div></a><?php
|
159 |
break;
|
160 |
case 'soundcloud':
|
22 |
$facebook_count = get_transient('apsc_facebook');
|
23 |
if (false === $facebook_count) {
|
24 |
|
25 |
+
$api_url = 'https://www.facebook.com/' . $facebook_page_id;
|
26 |
+
|
27 |
+
$count = $this->facebook_count($api_url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
set_transient('apsc_facebook', $count, $cache_period);
|
29 |
+
|
30 |
} else {
|
31 |
$count = $facebook_count;
|
32 |
}
|
123 |
?>
|
124 |
<a class="apsc-youtube-icon clearfix" href="<?php echo $social_profile_url; ?>" target="_blank"><div class="apsc-inner-block"><span class="social-icon"><i class="apsc-youtube fa fa-youtube"></i><span class="media-name">Youtube</span></span>
|
125 |
<?php
|
126 |
+
$youtube_count = $apsc_settings['social_profile']['youtube']['subscribers_count'];
|
127 |
+
$count = $this->get_formatted_count($youtube_count,$format);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
?><span class="apsc-count"><?php echo $count; ?></span><span class="apsc-media-type">Subscriber</span></div></a><?php
|
129 |
break;
|
130 |
case 'soundcloud':
|
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.2
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -125,6 +125,10 @@ Once you install the plugin , you can check some general documentation about how
|
|
125 |
5. Backend Cache Settings Section
|
126 |
|
127 |
== Changelog ==
|
|
|
|
|
|
|
|
|
128 |
= 1.1.9 =
|
129 |
* Added some missed text domain
|
130 |
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 1.2.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
125 |
5. Backend Cache Settings Section
|
126 |
|
127 |
== Changelog ==
|
128 |
+
= 1.2.0 =
|
129 |
+
* Updated Facebook API
|
130 |
+
* Added Youtube Subscribers field for mannual count
|
131 |
+
|
132 |
= 1.1.9 =
|
133 |
* Added some missed text domain
|
134 |
|