SNS Count Cache - Version 1.1.2

Version Description

  • Fixed: Facebook share count for HTTP URL is not migrated.
  • Fixed: Crawling of SNS count does not proceed with crawl throttling mode.
  • Changed: Crawl throttling mode is disabled by default.

=

Download this release

Release Info

Developer marubon
Plugin Icon SNS Count Cache
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.2

includes/admin-setting.php CHANGED
@@ -2331,7 +2331,7 @@ if ( ! empty( $_POST['_wpnonce'] ) && check_admin_referer( __FILE__, '_wpnonce'
2331
  <option value="1"<?php if ( self::OPT_COMMON_CRAWL_THROTTLING_MODE_OFF === $this->crawl_throttling_mode ) echo ' selected="selected"'; ?>><?php esc_html_e( 'Disabled', self::DOMAIN ); ?></option>
2332
  <option value="2"<?php if ( self::OPT_COMMON_CRAWL_THROTTLING_MODE_ON === $this->crawl_throttling_mode ) echo ' selected="selected"'; ?>><?php esc_html_e( 'Enabled', self::DOMAIN ); ?></option>
2333
  </select>
2334
- <span class="description"><?php esc_html_e( 'Default: Enabled', self::DOMAIN ); ?></span>
2335
  </td>
2336
  </tr>
2337
  </table>
2331
  <option value="1"<?php if ( self::OPT_COMMON_CRAWL_THROTTLING_MODE_OFF === $this->crawl_throttling_mode ) echo ' selected="selected"'; ?>><?php esc_html_e( 'Disabled', self::DOMAIN ); ?></option>
2332
  <option value="2"<?php if ( self::OPT_COMMON_CRAWL_THROTTLING_MODE_ON === $this->crawl_throttling_mode ) echo ' selected="selected"'; ?>><?php esc_html_e( 'Enabled', self::DOMAIN ); ?></option>
2333
  </select>
2334
+ <span class="description"><?php esc_html_e( 'Default: Disabled', self::DOMAIN ); ?></span>
2335
  </td>
2336
  </tr>
2337
  </table>
includes/class-scc-share-app-status-engine.php CHANGED
@@ -174,6 +174,8 @@ class SCC_Share_App_Status_Engine extends SCC_Engine {
174
 
175
  if ( ! empty( $app_info ) ) {
176
  update_option( SNS_Count_Cache::DB_SHARE_APP_STATUS, $app_info );
 
 
177
  }
178
 
179
  }
@@ -225,7 +227,11 @@ class SCC_Share_App_Status_Engine extends SCC_Engine {
225
  public function need_throttle( $options ) {
226
  SCC_Logger::log( '[' . __METHOD__ . '] (line=' . __LINE__ . ')' );
227
 
228
- $expected_call_count = $options['expected_call_count'];
 
 
 
 
229
 
230
  $app_info = get_option( SNS_Count_Cache::DB_SHARE_APP_STATUS );
231
 
@@ -246,10 +252,10 @@ class SCC_Share_App_Status_Engine extends SCC_Engine {
246
  $need_throttle[ SNS_Count_Cache::REF_SHARE_FACEBOOK ] = false;
247
  }
248
  } else {
249
- $need_throttle[ SNS_Count_Cache::REF_SHARE_FACEBOOK ] = true;
250
  }
251
  } else {
252
- $need_throttle[ SNS_Count_Cache::REF_SHARE_FACEBOOK ] = true;
253
  }
254
 
255
  return $need_throttle;
174
 
175
  if ( ! empty( $app_info ) ) {
176
  update_option( SNS_Count_Cache::DB_SHARE_APP_STATUS, $app_info );
177
+ } else {
178
+ delete_option( SNS_Count_Cache::DB_SHARE_APP_STATUS );
179
  }
180
 
181
  }
227
  public function need_throttle( $options ) {
228
  SCC_Logger::log( '[' . __METHOD__ . '] (line=' . __LINE__ . ')' );
229
 
230
+ $expected_call_count = 0;
231
+
232
+ if ( isset( $options['expected_call_count'] ) && is_numeric( $options['expected_call_count'] ) ) {
233
+ $expected_call_count = (int) $options['expected_call_count'];
234
+ }
235
 
236
  $app_info = get_option( SNS_Count_Cache::DB_SHARE_APP_STATUS );
237
 
252
  $need_throttle[ SNS_Count_Cache::REF_SHARE_FACEBOOK ] = false;
253
  }
254
  } else {
255
+ $need_throttle[ SNS_Count_Cache::REF_SHARE_FACEBOOK ] = false;
256
  }
257
  } else {
258
+ $need_throttle[ SNS_Count_Cache::REF_SHARE_FACEBOOK ] = false;
259
  }
260
 
261
  return $need_throttle;
includes/class-scc-share-base-cache-engine.php CHANGED
@@ -258,18 +258,55 @@ class SCC_Share_Base_Cache_Engine extends SCC_Share_Cache_Engine {
258
 
259
  $need_throttle = $this->delegate_order( SCC_Order::ORDER_CHECK_APP_STATUS, $options );
260
 
261
- SCC_Logger::log( '[' . __METHOD__ . '] need throttle: ' . $need_throttle );
 
262
 
263
  if ( in_array( true, $need_throttle, true ) ) {
264
 
265
- $option_key = $this->get_cache_key( $this->offset_suffix );
266
 
267
- update_option( $option_key, $posts_offset );
268
 
269
- SCC_Logger::log( '[' . __METHOD__ . '] Count retrieval was throttled to prevent or handle API rate limits.' );
 
 
 
 
 
 
 
 
270
 
271
  SCC_WP_Cron::clear_scheduled_hook( $this->execute_cron );
272
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  return;
274
  }
275
  }
258
 
259
  $need_throttle = $this->delegate_order( SCC_Order::ORDER_CHECK_APP_STATUS, $options );
260
 
261
+ SCC_Logger::log( '[' . __METHOD__ . '] need throttle: ' );
262
+ SCC_Logger::log( $need_throttle );
263
 
264
  if ( in_array( true, $need_throttle, true ) ) {
265
 
266
+ SCC_Logger::log( '[' . __METHOD__ . '] Count retrieval was throttled to prevent or handle API rate limits.' );
267
 
268
+ $crons = SCC_WP_Cron::get_scheduled_hook( $this->execute_cron );
269
 
270
+ SCC_Logger::log( '[' . __METHOD__ . '] before throttling ' );
271
+ SCC_Logger::log( '[' . __METHOD__ . '] posts_offset: ' . $posts_offset );
272
+ SCC_Logger::log( '[' . __METHOD__ . '] Scheduled: ' );
273
+
274
+ foreach ( $crons as $cron ) {
275
+ SCC_Logger::log( '[' . __METHOD__ . '] timestamp: ' . $cron['timestamp'] . ' hook: ' . $this->execute_cron );
276
+ SCC_Logger::log( '[' . __METHOD__ . '] args: ' );
277
+ SCC_Logger::log( $cron['args'] );
278
+ }
279
 
280
  SCC_WP_Cron::clear_scheduled_hook( $this->execute_cron );
281
 
282
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
283
+
284
+ wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( (int) $posts_offset ) );
285
+
286
+ $next_posts_offset = $posts_offset + $this->posts_per_check;
287
+
288
+ $posts_total = $this->get_posts_total();
289
+
290
+ if ( $next_posts_offset > $posts_total ) {
291
+ $next_posts_offset = 0;
292
+ }
293
+
294
+ $option_key = $this->get_cache_key( $this->offset_suffix );
295
+
296
+ update_option( $option_key, $next_posts_offset );
297
+
298
+ SCC_Logger::log( '[' . __METHOD__ . '] after throttling ' );
299
+ SCC_Logger::log( '[' . __METHOD__ . '] next_posts_offset: ' . $next_posts_offset );
300
+ SCC_Logger::log( '[' . __METHOD__ . '] Scheduled: ' );
301
+
302
+ $crons = SCC_WP_Cron::get_scheduled_hook( $this->execute_cron );
303
+
304
+ foreach ( $crons as $cron ) {
305
+ SCC_Logger::log( '[' . __METHOD__ . '] timestamp: ' . $cron['timestamp'] . ' hook: ' . $this->execute_cron );
306
+ SCC_Logger::log( '[' . __METHOD__ . '] args: ' );
307
+ SCC_Logger::log( $cron['args'] );
308
+ }
309
+
310
  return;
311
  }
312
  }
includes/class-scc-share-cache-engine.php CHANGED
@@ -125,6 +125,7 @@ abstract class SCC_Share_Cache_Engine extends SCC_Cache_Engine {
125
  $migrated_response = $this->get_data( $target_sns_migrated, $target_option );
126
 
127
  $migrated_sns_count = $migrated_response['count'];
 
128
 
129
  SCC_Logger::log( $migrated_sns_count );
130
 
@@ -153,6 +154,7 @@ abstract class SCC_Share_Cache_Engine extends SCC_Cache_Engine {
153
  $migrated_response = $this->get_data( $target_sns_migrated, $target_option );
154
 
155
  $migrated_sns_count = $migrated_response['count'];
 
156
 
157
  SCC_Logger::log( $migrated_sns_count );
158
 
@@ -180,6 +182,7 @@ abstract class SCC_Share_Cache_Engine extends SCC_Cache_Engine {
180
  $migrated_response = $this->get_data( $target_sns_migrated, $target_option );
181
 
182
  $migrated_sns_count = $migrated_response['count'];
 
183
 
184
  SCC_Logger::log( $migrated_sns_count );
185
 
@@ -205,6 +208,8 @@ abstract class SCC_Share_Cache_Engine extends SCC_Cache_Engine {
205
  $this->crawler->set_crawl_strategy_parameters( $sns, $query_parameters );
206
  }
207
  }
 
 
208
  } // End if().
209
 
210
  SCC_Logger::log( '[' . __METHOD__ . '] fault tolerance mode: ' . $this->fault_tolerance_mode );
@@ -266,12 +271,14 @@ abstract class SCC_Share_Cache_Engine extends SCC_Cache_Engine {
266
 
267
  SCC_Logger::log( $sns_count );
268
 
269
- if ( $sns_count ) {
270
  $result = set_transient( $cache_key, $sns_count, $cache_expiration );
271
  }
272
 
273
- if ( $sns_info ) {
274
  update_option( SNS_Count_Cache::DB_SHARE_APP_STATUS, $sns_info );
 
 
275
  }
276
 
277
  /*
125
  $migrated_response = $this->get_data( $target_sns_migrated, $target_option );
126
 
127
  $migrated_sns_count = $migrated_response['count'];
128
+ $migrated_sns_info = $migrated_response['info'];
129
 
130
  SCC_Logger::log( $migrated_sns_count );
131
 
154
  $migrated_response = $this->get_data( $target_sns_migrated, $target_option );
155
 
156
  $migrated_sns_count = $migrated_response['count'];
157
+ $migrated_sns_info = $migrated_response['info'];
158
 
159
  SCC_Logger::log( $migrated_sns_count );
160
 
182
  $migrated_response = $this->get_data( $target_sns_migrated, $target_option );
183
 
184
  $migrated_sns_count = $migrated_response['count'];
185
+ $migrated_sns_info = $migrated_response['info'];
186
 
187
  SCC_Logger::log( $migrated_sns_count );
188
 
208
  $this->crawler->set_crawl_strategy_parameters( $sns, $query_parameters );
209
  }
210
  }
211
+
212
+ $sns_info = array_merge( (array) $sns_info, (array) $migrated_sns_info );
213
  } // End if().
214
 
215
  SCC_Logger::log( '[' . __METHOD__ . '] fault tolerance mode: ' . $this->fault_tolerance_mode );
271
 
272
  SCC_Logger::log( $sns_count );
273
 
274
+ if ( ! empty( $sns_count ) ) {
275
  $result = set_transient( $cache_key, $sns_count, $cache_expiration );
276
  }
277
 
278
+ if ( ! empty( $sns_info ) ) {
279
  update_option( SNS_Count_Cache::DB_SHARE_APP_STATUS, $sns_info );
280
+ } else {
281
+ delete_option( SNS_Count_Cache::DB_SHARE_APP_STATUS );
282
  }
283
 
284
  /*
includes/class-scc-share-facebook-crawl-strategy.php CHANGED
@@ -47,7 +47,7 @@ class SCC_Share_Facebook_Crawl_Strategy extends SCC_Crawl_Strategy {
47
  SCC_Logger::log( '[' . __METHOD__ . '] (line=' . __LINE__ . ')' );
48
 
49
  $this->http_method = 'GET';
50
- $this->query_parameters['fields'] = 'og_object{engagement}';
51
  }
52
 
53
  /**
@@ -104,22 +104,42 @@ class SCC_Share_Facebook_Crawl_Strategy extends SCC_Crawl_Strategy {
104
  public function extract_response_body( $content ) {
105
  SCC_Logger::log( '[' . __METHOD__ . '] (line=' . __LINE__ . ')' );
106
 
107
- $count = (int) -1;
108
 
109
  if ( isset( $content['body'] ) && empty( $content['error'] ) ) {
110
  // SCC_Logger::log( '[' . __METHOD__ . '] X-App-Usage: ' . $content['header'][ strtolower( 'X-App-Usage' ) ] );
111
 
112
  $json = json_decode( $content['body'], true );
113
 
114
- if ( isset( $json['og_object']['engagement']['count'] ) && is_numeric( $json['og_object']['engagement']['count'] ) ) {
115
- $count = (int) $json['og_object']['engagement']['count'];
116
- } elseif ( isset( $json['id'] ) && ! isset( $json['og_object']['engagement']['count'] ) ) {
117
- $count = (int) 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  } else {
119
- $count = (int) - 1;
120
  }
121
  } else {
122
- $count = (int) - 1;
123
 
124
  if ( isset( $content['error'] ) ) {
125
  SCC_Logger::log( $content['error'] );
@@ -213,19 +233,18 @@ class SCC_Share_Facebook_Crawl_Strategy extends SCC_Crawl_Strategy {
213
  $threshold = 100;
214
 
215
  if ( $current_call_count + 20 > $threshold ) {
216
- SCC_Logger::log( '[' . __METHOD__ . '] hogehoge ' );
217
  return false;
218
  } else {
219
  return true;
220
  }
221
  } else {
222
- return false;
223
  }
224
  } else {
225
- return false;
226
  }
227
  } else {
228
- return false;
229
  }
230
  }
231
 
47
  SCC_Logger::log( '[' . __METHOD__ . '] (line=' . __LINE__ . ')' );
48
 
49
  $this->http_method = 'GET';
50
+ $this->query_parameters['fields'] = 'og_object{engagement},engagement';
51
  }
52
 
53
  /**
104
  public function extract_response_body( $content ) {
105
  SCC_Logger::log( '[' . __METHOD__ . '] (line=' . __LINE__ . ')' );
106
 
107
+ $count = -1;
108
 
109
  if ( isset( $content['body'] ) && empty( $content['error'] ) ) {
110
  // SCC_Logger::log( '[' . __METHOD__ . '] X-App-Usage: ' . $content['header'][ strtolower( 'X-App-Usage' ) ] );
111
 
112
  $json = json_decode( $content['body'], true );
113
 
114
+ if ( isset( $json['engagement'] ) ) {
115
+ if ( isset( $json['engagement']['reaction_count'] ) ) {
116
+ $reaction_count =(int) $json['engagement']['reaction_count'];
117
+ } else {
118
+ $reaction_count = 0;
119
+ }
120
+ if ( isset( $json['engagement']['comment_count'] ) ) {
121
+ $comment_count =(int) $json['engagement']['comment_count'];
122
+ } else {
123
+ $comment_count = 0;
124
+ }
125
+ if ( isset( $json['engagement']['share_count'] ) ) {
126
+ $share_count =(int) $json['engagement']['share_count'];
127
+ } else {
128
+ $share_count = 0;
129
+ }
130
+ if ( isset( $json['engagement']['comment_plugin_count'] ) ) {
131
+ $comment_plugin_count =(int) $json['engagement']['comment_plugin_count'];
132
+ } else {
133
+ $comment_plugin_count = 0;
134
+ }
135
+
136
+ $count = $reaction_count + $comment_count + $share_count + $comment_plugin_count;
137
+
138
  } else {
139
+ $count = -1;
140
  }
141
  } else {
142
+ $count = -1;
143
 
144
  if ( isset( $content['error'] ) ) {
145
  SCC_Logger::log( $content['error'] );
233
  $threshold = 100;
234
 
235
  if ( $current_call_count + 20 > $threshold ) {
 
236
  return false;
237
  } else {
238
  return true;
239
  }
240
  } else {
241
+ return true;
242
  }
243
  } else {
244
+ return true;
245
  }
246
  } else {
247
+ return true;
248
  }
249
  }
250
 
languages/sns-count-cache-ja.mo CHANGED
Binary file
languages/sns-count-cache-ja.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: SNS Count Cache\n"
4
- "POT-Creation-Date: 2019-05-11 12:12+0900\n"
5
- "PO-Revision-Date: 2019-05-11 12:13+0900\n"
6
  "Last-Translator: Daisuke Maruyama <marubon@gmail.com>\n"
7
  "Language-Team: Daisuke Maruyama <marubon@gmail.com>\n"
8
  "Language: ja\n"
@@ -24,14 +24,14 @@ msgstr ""
24
  #: includes/admin-cache-status.php:69 includes/admin-dashboard.php:45
25
  #: includes/admin-help.php:36 includes/admin-hot-content.php:70
26
  #: includes/admin-setting.php:532 includes/admin-share-count.php:69
27
- #: sns-count-cache.php:2009
28
  msgid "SNS Count Cache"
29
  msgstr "SNS Count Cache"
30
 
31
  #: includes/admin-cache-status.php:72 includes/admin-dashboard.php:49
32
  #: includes/admin-help.php:39 includes/admin-hot-content.php:73
33
  #: includes/admin-setting.php:639 includes/admin-share-count.php:72
34
- #: sns-count-cache.php:2010
35
  msgid "Dashboard"
36
  msgstr "ダッシュボード"
37
 
@@ -41,7 +41,7 @@ msgstr "ダッシュボード"
41
  #: includes/admin-dashboard.php:63 includes/admin-dashboard.php:153
42
  #: includes/admin-help.php:40 includes/admin-help.php:66
43
  #: includes/admin-hot-content.php:74 includes/admin-setting.php:640
44
- #: includes/admin-share-count.php:73 sns-count-cache.php:2011
45
  msgid "Cache Status"
46
  msgstr "キャッシュ状況"
47
 
@@ -50,28 +50,28 @@ msgstr "キャッシュ状況"
50
  #: includes/admin-dashboard.php:101 includes/admin-dashboard.php:124
51
  #: includes/admin-help.php:41 includes/admin-hot-content.php:75
52
  #: includes/admin-setting.php:641 includes/admin-share-count.php:74
53
- #: includes/admin-share-count.php:84 sns-count-cache.php:2012
54
  msgid "Share Count"
55
  msgstr "シェア数"
56
 
57
  #: includes/admin-cache-status.php:76 includes/admin-dashboard.php:53
58
  #: includes/admin-help.php:43 includes/admin-hot-content.php:76
59
  #: includes/admin-hot-content.php:83 includes/admin-setting.php:643
60
- #: includes/admin-share-count.php:76 sns-count-cache.php:2015
61
  msgid "Hot Content"
62
  msgstr "話題のコンテンツ"
63
 
64
  #: includes/admin-cache-status.php:78 includes/admin-dashboard.php:55
65
  #: includes/admin-help.php:45 includes/admin-hot-content.php:77
66
  #: includes/admin-setting.php:645 includes/admin-share-count.php:78
67
- #: sns-count-cache.php:2018 sns-count-cache.php:2033
68
  msgid "Setting"
69
  msgstr "設定"
70
 
71
  #: includes/admin-cache-status.php:79 includes/admin-dashboard.php:56
72
  #: includes/admin-help.php:46 includes/admin-help.php:51
73
  #: includes/admin-hot-content.php:78 includes/admin-setting.php:646
74
- #: includes/admin-share-count.php:79 sns-count-cache.php:2019
75
  msgid "Help"
76
  msgstr "ヘルプ"
77
 
@@ -668,12 +668,12 @@ msgid "Target SNS"
668
  msgstr "対象SNS"
669
 
670
  #: includes/admin-setting.php:675 includes/admin-setting.php:1134
671
- #: includes/admin-setting.php:1619 sns-count-cache.php:2826
672
- #: sns-count-cache.php:2850
673
  msgid "Facebook"
674
  msgstr "Facebook"
675
 
676
- #: includes/admin-setting.php:678 sns-count-cache.php:2829
677
  msgid "Google+"
678
  msgstr "Google+"
679
 
@@ -682,23 +682,23 @@ msgid "Hatena Bookmark"
682
  msgstr "はてなブックマーク"
683
 
684
  #: includes/admin-setting.php:684 includes/admin-setting.php:1142
685
- #: sns-count-cache.php:2841
686
  msgid "Linkedin"
687
  msgstr "Linkedin"
688
 
689
  #: includes/admin-setting.php:687 includes/admin-setting.php:1146
690
- #: sns-count-cache.php:2838
691
  msgid "Pinterest"
692
  msgstr "Pinterest"
693
 
694
  #: includes/admin-setting.php:690 includes/admin-setting.php:1150
695
- #: sns-count-cache.php:2832
696
  msgid "Pocket"
697
  msgstr "Pocket"
698
 
699
  #: includes/admin-setting.php:693 includes/admin-setting.php:1154
700
- #: includes/admin-setting.php:1639 sns-count-cache.php:2823
701
- #: sns-count-cache.php:2847
702
  msgid "Twitter"
703
  msgstr "Twitter"
704
 
@@ -1286,19 +1286,19 @@ msgstr "土曜日"
1286
  msgid "daily"
1287
  msgstr "毎日"
1288
 
1289
- #: includes/admin-setting.php:1623 sns-count-cache.php:2853
1290
  msgid "Feedly"
1291
  msgstr "Feedly"
1292
 
1293
- #: includes/admin-setting.php:1627 sns-count-cache.php:2856
1294
  msgid "Instagram"
1295
  msgstr "Instagram"
1296
 
1297
- #: includes/admin-setting.php:1631 sns-count-cache.php:2859
1298
  msgid "OneSignal"
1299
  msgstr "OneSignal"
1300
 
1301
- #: includes/admin-setting.php:1635 sns-count-cache.php:2862
1302
  msgid "Push7"
1303
  msgstr "Push7"
1304
 
@@ -1466,6 +1466,7 @@ msgid "Bearer Token for Twitter API"
1466
  msgstr "Twitter API用のBearer Token"
1467
 
1468
  #: includes/admin-setting.php:2253 includes/admin-setting.php:2274
 
1469
  msgid "Default: Disabled"
1470
  msgstr "既定値: 無効"
1471
 
@@ -1485,10 +1486,6 @@ msgstr "既定値: 再試行なし"
1485
  msgid "Default: On"
1486
  msgstr "既定値: 有効"
1487
 
1488
- #: includes/admin-setting.php:2334
1489
- msgid "Default: Enabled"
1490
- msgstr "既定値: 有効"
1491
-
1492
  #: includes/admin-setting.php:2355
1493
  msgid "Default: Manual"
1494
  msgstr "既定値: 手動"
@@ -1549,57 +1546,57 @@ msgid "Unexpected HTTP response code: %s"
1549
  msgstr "予期しないHTTPレスポンスコード: %s"
1550
 
1551
  #: includes/download.php:70 includes/download.php:73 index.php:42 index.php:50
1552
- #: index.php:53 index.php:56 index.php:59 sns-count-cache.php:2057
1553
- #: sns-count-cache.php:2070 sns-count-cache.php:2082 sns-count-cache.php:2094
1554
- #: sns-count-cache.php:2106 sns-count-cache.php:2118 sns-count-cache.php:2130
1555
- #: sns-count-cache.php:2142
1556
  msgid "You do not have sufficient permissions to access this page."
1557
  msgstr "このページにアクセスするために必要な権限がありません。"
1558
 
1559
- #: sns-count-cache.php:2010
1560
  msgid "Dashboard | SNS Count Cache"
1561
  msgstr "ダッシュボード | SNS Count Cache"
1562
 
1563
- #: sns-count-cache.php:2011
1564
  msgid "Cache Status | SNS Count Cache"
1565
  msgstr "キャッシュ状況 | SNS Count Cache"
1566
 
1567
- #: sns-count-cache.php:2012
1568
  msgid "Share Count | SNS Count Cache"
1569
  msgstr "シェア数 | SNS Count Cache"
1570
 
1571
- #: sns-count-cache.php:2015
1572
  msgid "Hot Content | SNS Count Cache"
1573
  msgstr "話題のコンテンツ | SNS Count Cache"
1574
 
1575
- #: sns-count-cache.php:2018
1576
  msgid "Setting | SNS Count Cache"
1577
  msgstr "設定 | SNS Count Cache"
1578
 
1579
- #: sns-count-cache.php:2019
1580
  msgid "Help | SNS Count Cache"
1581
  msgstr "ヘルプ | SNS Count Cache"
1582
 
1583
- #: sns-count-cache.php:2598 sns-count-cache.php:2606 sns-count-cache.php:2778
1584
- #: sns-count-cache.php:2786
1585
  msgid "Completed"
1586
  msgstr "完了"
1587
 
1588
- #: sns-count-cache.php:2600 sns-count-cache.php:2608 sns-count-cache.php:2780
1589
- #: sns-count-cache.php:2788
1590
  msgid "Partially Completed"
1591
  msgstr "部分完了"
1592
 
1593
- #: sns-count-cache.php:2602 sns-count-cache.php:2610 sns-count-cache.php:2782
1594
- #: sns-count-cache.php:2790
1595
  msgid "Ongoing"
1596
  msgstr "進行中"
1597
 
1598
- #: sns-count-cache.php:2835
1599
  msgid "Hatebu"
1600
  msgstr "はてブ"
1601
 
1602
- #: sns-count-cache.php:2844
1603
  msgid "Total"
1604
  msgstr "合計"
1605
 
@@ -1625,8 +1622,14 @@ msgid "Daisuke Maruyama"
1625
  msgstr "Daisuke Maruyama"
1626
 
1627
  #. Author URI of the plugin/theme
1628
- msgid "https://marubon.info/"
1629
- msgstr "https://marubon.info/"
 
 
 
 
 
 
1630
 
1631
  #~ msgid "App ID (Client ID)"
1632
  #~ msgstr "App ID (Client ID)"
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: SNS Count Cache\n"
4
+ "POT-Creation-Date: 2019-05-18 22:52+0900\n"
5
+ "PO-Revision-Date: 2019-05-18 22:52+0900\n"
6
  "Last-Translator: Daisuke Maruyama <marubon@gmail.com>\n"
7
  "Language-Team: Daisuke Maruyama <marubon@gmail.com>\n"
8
  "Language: ja\n"
24
  #: includes/admin-cache-status.php:69 includes/admin-dashboard.php:45
25
  #: includes/admin-help.php:36 includes/admin-hot-content.php:70
26
  #: includes/admin-setting.php:532 includes/admin-share-count.php:69
27
+ #: sns-count-cache.php:2019
28
  msgid "SNS Count Cache"
29
  msgstr "SNS Count Cache"
30
 
31
  #: includes/admin-cache-status.php:72 includes/admin-dashboard.php:49
32
  #: includes/admin-help.php:39 includes/admin-hot-content.php:73
33
  #: includes/admin-setting.php:639 includes/admin-share-count.php:72
34
+ #: sns-count-cache.php:2020
35
  msgid "Dashboard"
36
  msgstr "ダッシュボード"
37
 
41
  #: includes/admin-dashboard.php:63 includes/admin-dashboard.php:153
42
  #: includes/admin-help.php:40 includes/admin-help.php:66
43
  #: includes/admin-hot-content.php:74 includes/admin-setting.php:640
44
+ #: includes/admin-share-count.php:73 sns-count-cache.php:2021
45
  msgid "Cache Status"
46
  msgstr "キャッシュ状況"
47
 
50
  #: includes/admin-dashboard.php:101 includes/admin-dashboard.php:124
51
  #: includes/admin-help.php:41 includes/admin-hot-content.php:75
52
  #: includes/admin-setting.php:641 includes/admin-share-count.php:74
53
+ #: includes/admin-share-count.php:84 sns-count-cache.php:2022
54
  msgid "Share Count"
55
  msgstr "シェア数"
56
 
57
  #: includes/admin-cache-status.php:76 includes/admin-dashboard.php:53
58
  #: includes/admin-help.php:43 includes/admin-hot-content.php:76
59
  #: includes/admin-hot-content.php:83 includes/admin-setting.php:643
60
+ #: includes/admin-share-count.php:76 sns-count-cache.php:2025
61
  msgid "Hot Content"
62
  msgstr "話題のコンテンツ"
63
 
64
  #: includes/admin-cache-status.php:78 includes/admin-dashboard.php:55
65
  #: includes/admin-help.php:45 includes/admin-hot-content.php:77
66
  #: includes/admin-setting.php:645 includes/admin-share-count.php:78
67
+ #: sns-count-cache.php:2028 sns-count-cache.php:2043
68
  msgid "Setting"
69
  msgstr "設定"
70
 
71
  #: includes/admin-cache-status.php:79 includes/admin-dashboard.php:56
72
  #: includes/admin-help.php:46 includes/admin-help.php:51
73
  #: includes/admin-hot-content.php:78 includes/admin-setting.php:646
74
+ #: includes/admin-share-count.php:79 sns-count-cache.php:2029
75
  msgid "Help"
76
  msgstr "ヘルプ"
77
 
668
  msgstr "対象SNS"
669
 
670
  #: includes/admin-setting.php:675 includes/admin-setting.php:1134
671
+ #: includes/admin-setting.php:1619 sns-count-cache.php:2836
672
+ #: sns-count-cache.php:2860
673
  msgid "Facebook"
674
  msgstr "Facebook"
675
 
676
+ #: includes/admin-setting.php:678 sns-count-cache.php:2839
677
  msgid "Google+"
678
  msgstr "Google+"
679
 
682
  msgstr "はてなブックマーク"
683
 
684
  #: includes/admin-setting.php:684 includes/admin-setting.php:1142
685
+ #: sns-count-cache.php:2851
686
  msgid "Linkedin"
687
  msgstr "Linkedin"
688
 
689
  #: includes/admin-setting.php:687 includes/admin-setting.php:1146
690
+ #: sns-count-cache.php:2848
691
  msgid "Pinterest"
692
  msgstr "Pinterest"
693
 
694
  #: includes/admin-setting.php:690 includes/admin-setting.php:1150
695
+ #: sns-count-cache.php:2842
696
  msgid "Pocket"
697
  msgstr "Pocket"
698
 
699
  #: includes/admin-setting.php:693 includes/admin-setting.php:1154
700
+ #: includes/admin-setting.php:1639 sns-count-cache.php:2833
701
+ #: sns-count-cache.php:2857
702
  msgid "Twitter"
703
  msgstr "Twitter"
704
 
1286
  msgid "daily"
1287
  msgstr "毎日"
1288
 
1289
+ #: includes/admin-setting.php:1623 sns-count-cache.php:2863
1290
  msgid "Feedly"
1291
  msgstr "Feedly"
1292
 
1293
+ #: includes/admin-setting.php:1627 sns-count-cache.php:2866
1294
  msgid "Instagram"
1295
  msgstr "Instagram"
1296
 
1297
+ #: includes/admin-setting.php:1631 sns-count-cache.php:2869
1298
  msgid "OneSignal"
1299
  msgstr "OneSignal"
1300
 
1301
+ #: includes/admin-setting.php:1635 sns-count-cache.php:2872
1302
  msgid "Push7"
1303
  msgstr "Push7"
1304
 
1466
  msgstr "Twitter API用のBearer Token"
1467
 
1468
  #: includes/admin-setting.php:2253 includes/admin-setting.php:2274
1469
+ #: includes/admin-setting.php:2334
1470
  msgid "Default: Disabled"
1471
  msgstr "既定値: 無効"
1472
 
1486
  msgid "Default: On"
1487
  msgstr "既定値: 有効"
1488
 
 
 
 
 
1489
  #: includes/admin-setting.php:2355
1490
  msgid "Default: Manual"
1491
  msgstr "既定値: 手動"
1546
  msgstr "予期しないHTTPレスポンスコード: %s"
1547
 
1548
  #: includes/download.php:70 includes/download.php:73 index.php:42 index.php:50
1549
+ #: index.php:53 index.php:56 index.php:59 sns-count-cache.php:2067
1550
+ #: sns-count-cache.php:2080 sns-count-cache.php:2092 sns-count-cache.php:2104
1551
+ #: sns-count-cache.php:2116 sns-count-cache.php:2128 sns-count-cache.php:2140
1552
+ #: sns-count-cache.php:2152
1553
  msgid "You do not have sufficient permissions to access this page."
1554
  msgstr "このページにアクセスするために必要な権限がありません。"
1555
 
1556
+ #: sns-count-cache.php:2020
1557
  msgid "Dashboard | SNS Count Cache"
1558
  msgstr "ダッシュボード | SNS Count Cache"
1559
 
1560
+ #: sns-count-cache.php:2021
1561
  msgid "Cache Status | SNS Count Cache"
1562
  msgstr "キャッシュ状況 | SNS Count Cache"
1563
 
1564
+ #: sns-count-cache.php:2022
1565
  msgid "Share Count | SNS Count Cache"
1566
  msgstr "シェア数 | SNS Count Cache"
1567
 
1568
+ #: sns-count-cache.php:2025
1569
  msgid "Hot Content | SNS Count Cache"
1570
  msgstr "話題のコンテンツ | SNS Count Cache"
1571
 
1572
+ #: sns-count-cache.php:2028
1573
  msgid "Setting | SNS Count Cache"
1574
  msgstr "設定 | SNS Count Cache"
1575
 
1576
+ #: sns-count-cache.php:2029
1577
  msgid "Help | SNS Count Cache"
1578
  msgstr "ヘルプ | SNS Count Cache"
1579
 
1580
+ #: sns-count-cache.php:2608 sns-count-cache.php:2616 sns-count-cache.php:2788
1581
+ #: sns-count-cache.php:2796
1582
  msgid "Completed"
1583
  msgstr "完了"
1584
 
1585
+ #: sns-count-cache.php:2610 sns-count-cache.php:2618 sns-count-cache.php:2790
1586
+ #: sns-count-cache.php:2798
1587
  msgid "Partially Completed"
1588
  msgstr "部分完了"
1589
 
1590
+ #: sns-count-cache.php:2612 sns-count-cache.php:2620 sns-count-cache.php:2792
1591
+ #: sns-count-cache.php:2800
1592
  msgid "Ongoing"
1593
  msgstr "進行中"
1594
 
1595
+ #: sns-count-cache.php:2845
1596
  msgid "Hatebu"
1597
  msgstr "はてブ"
1598
 
1599
+ #: sns-count-cache.php:2854
1600
  msgid "Total"
1601
  msgstr "合計"
1602
 
1622
  msgstr "Daisuke Maruyama"
1623
 
1624
  #. Author URI of the plugin/theme
1625
+ msgid "https://logicore.cc/"
1626
+ msgstr ""
1627
+
1628
+ #~ msgid "Default: Enabled"
1629
+ #~ msgstr "既定値: 有効"
1630
+
1631
+ #~ msgid "https://marubon.info/"
1632
+ #~ msgstr "https://marubon.info/"
1633
 
1634
  #~ msgid "App ID (Client ID)"
1635
  #~ msgstr "App ID (Client ID)"
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: performance, SNS, social, cache, share, follower
5
  Requires at least: 3.7
6
  Tested up to: 5.2
7
- Stable tag: 1.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -200,6 +200,11 @@ There are no questions.
200
  = 1.1.1 =
201
  * Fixed: Error of "Fatal error: Declaration of SNS_Count_Cache::order ... ".
202
 
 
 
 
 
 
203
  == Upgrade Notice ==
204
  In the upgrade from Ver. 0.11.1 or below, Reregistration of information such as client ID, client secret, and access token is needed in the setting page.
205
 
4
  Tags: performance, SNS, social, cache, share, follower
5
  Requires at least: 3.7
6
  Tested up to: 5.2
7
+ Stable tag: 1.1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
200
  = 1.1.1 =
201
  * Fixed: Error of "Fatal error: Declaration of SNS_Count_Cache::order ... ".
202
 
203
+ = 1.1.2 =
204
+ * Fixed: Facebook share count for HTTP URL is not migrated.
205
+ * Fixed: Crawling of SNS count does not proceed with crawl throttling mode.
206
+ * Changed: Crawl throttling mode is disabled by default.
207
+
208
  == Upgrade Notice ==
209
  In the upgrade from Ver. 0.11.1 or below, Reregistration of information such as client ID, client secret, and access token is needed in the setting page.
210
 
sns-count-cache.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  Plugin Name: SNS Count Cache
4
  Description: SNS Count Cache gets share count for Twitter and Facebook, Pocket, Pinterest, Linkedin, Hatena Bookmark and caches these count in the background. This plugin may help you to shorten page loading time because the share count can be retrieved not through network but through the cache using given functions.
5
- Version: 1.1.1
6
  Plugin URI: https://wordpress.org/plugins/sns-count-cache/
7
  Author: Daisuke Maruyama
8
  Author URI: https://logicore.cc/
@@ -736,7 +736,7 @@ if ( ! class_exists( 'SNS_Count_Cache' ) ) {
736
  * Plugin version, used for cache-busting of style and script file references.
737
  * @var string
738
  */
739
- private $version = '1.1.1';
740
 
741
  /**
742
  * Instances of crawler
@@ -1069,7 +1069,14 @@ if ( ! class_exists( 'SNS_Count_Cache' ) ) {
1069
  *
1070
  * @var array
1071
  */
1072
- private $scheme_migration_exclude_keys = array();
 
 
 
 
 
 
 
1073
 
1074
  /**
1075
  * Max execution time
@@ -1267,7 +1274,7 @@ if ( ! class_exists( 'SNS_Count_Cache' ) ) {
1267
  if ( ! empty( $settings[ self::DB_COMMON_CRAWL_THROTTLING_MODE ] ) ) {
1268
  $this->crawl_throttling_mode = (int) $settings[ self::DB_COMMON_CRAWL_THROTTLING_MODE ];
1269
  } else {
1270
- $this->crawl_throttling_mode = self::OPT_COMMON_CRAWL_THROTTLING_MODE_ON;
1271
  }
1272
 
1273
  if ( ! empty( $settings[ self::DB_SHARE_RUSH_CHECK_INTERVAL ] ) ) {
@@ -1354,10 +1361,17 @@ if ( ! class_exists( 'SNS_Count_Cache' ) ) {
1354
  }
1355
 
1356
  // Pocket and Google+, Linkedin are excluded from migration target because they are migrated automatically.
1357
- $this->scheme_migration_exclude_keys = array(
1358
  self::REF_SHARE_POCKET,
1359
  self::REF_SHARE_GPLUS,
1360
  self::REF_SHARE_LINKEDIN,
 
 
 
 
 
 
 
1361
  self::REF_FOLLOW_TWITTER,
1362
  self::REF_FOLLOW_FACEBOOK,
1363
  self::REF_FOLLOW_PUSH7,
@@ -1365,10 +1379,6 @@ if ( ! class_exists( 'SNS_Count_Cache' ) ) {
1365
  self::REF_FOLLOW_ONESIGNAL,
1366
  );
1367
 
1368
- if ( self::OPT_SHARE_TWITTER_API_JSOON === $this->share_base_twitter_api ) {
1369
- $this->scheme_migration_exclude_keys[] = self::REF_SHARE_TWITTER;
1370
- }
1371
-
1372
  if ( ! empty( $settings[ self::DB_FOLLOW_CACHE_TARGET ] ) ) {
1373
  $this->follow_base_cache_target = $settings[ self::DB_FOLLOW_CACHE_TARGET ];
1374
  } else {
@@ -1645,7 +1655,7 @@ if ( ! class_exists( 'SNS_Count_Cache' ) ) {
1645
  'post_types' => $this->share_base_cache_post_types,
1646
  'scheme_migration_mode' => $this->scheme_migration_mode,
1647
  'scheme_migration_date' => $this->scheme_migration_date,
1648
- 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys,
1649
  'fault_tolerance_mode' => $this->fault_tolerance_mode,
1650
  'crawl_throttling_mode' => $this->crawl_throttling_mode,
1651
  );
@@ -1664,7 +1674,7 @@ if ( ! class_exists( 'SNS_Count_Cache' ) ) {
1664
  'post_types' => $this->share_base_cache_post_types,
1665
  'scheme_migration_mode' => $this->scheme_migration_mode,
1666
  'scheme_migration_date' => $this->scheme_migration_date,
1667
- 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys,
1668
  'fault_tolerance_mode' => $this->fault_tolerance_mode,
1669
  'crawl_throttling_mode' => $this->crawl_throttling_mode,
1670
  );
@@ -1682,7 +1692,7 @@ if ( ! class_exists( 'SNS_Count_Cache' ) ) {
1682
  'post_types' => $this->share_base_cache_post_types,
1683
  'scheme_migration_mode' => $this->scheme_migration_mode,
1684
  'scheme_migration_date' => $this->scheme_migration_date,
1685
- 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys,
1686
  'fault_tolerance_mode' => $this->fault_tolerance_mode,
1687
  'crawl_throttling_mode' => $this->crawl_throttling_mode,
1688
  );
@@ -1721,7 +1731,7 @@ if ( ! class_exists( 'SNS_Count_Cache' ) ) {
1721
  'target_sns' => $this->follow_base_cache_target,
1722
  'check_interval' => $this->follow_base_check_interval,
1723
  'scheme_migration_mode' => $this->scheme_migration_mode,
1724
- 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys,
1725
  'feed_type' => $this->follow_feed_type,
1726
  );
1727
 
@@ -1735,7 +1745,7 @@ if ( ! class_exists( 'SNS_Count_Cache' ) ) {
1735
  'target_sns' => $this->follow_base_cache_target,
1736
  'check_interval' => $this->follow_base_check_interval,
1737
  'scheme_migration_mode' => $this->scheme_migration_mode,
1738
- 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys,
1739
  'feed_type' => $this->follow_feed_type,
1740
  );
1741
 
2
  /**
3
  Plugin Name: SNS Count Cache
4
  Description: SNS Count Cache gets share count for Twitter and Facebook, Pocket, Pinterest, Linkedin, Hatena Bookmark and caches these count in the background. This plugin may help you to shorten page loading time because the share count can be retrieved not through network but through the cache using given functions.
5
+ Version: 1.1.2
6
  Plugin URI: https://wordpress.org/plugins/sns-count-cache/
7
  Author: Daisuke Maruyama
8
  Author URI: https://logicore.cc/
736
  * Plugin version, used for cache-busting of style and script file references.
737
  * @var string
738
  */
739
+ private $version = '1.1.2';
740
 
741
  /**
742
  * Instances of crawler
1069
  *
1070
  * @var array
1071
  */
1072
+ private $share_scheme_migration_exclude_keys = array();
1073
+
1074
+ /**
1075
+ * Excluded key in migration from http to https
1076
+ *
1077
+ * @var array
1078
+ */
1079
+ private $follow_scheme_migration_exclude_keys = array();
1080
 
1081
  /**
1082
  * Max execution time
1274
  if ( ! empty( $settings[ self::DB_COMMON_CRAWL_THROTTLING_MODE ] ) ) {
1275
  $this->crawl_throttling_mode = (int) $settings[ self::DB_COMMON_CRAWL_THROTTLING_MODE ];
1276
  } else {
1277
+ $this->crawl_throttling_mode = self::OPT_COMMON_CRAWL_THROTTLING_MODE_OFF;
1278
  }
1279
 
1280
  if ( ! empty( $settings[ self::DB_SHARE_RUSH_CHECK_INTERVAL ] ) ) {
1361
  }
1362
 
1363
  // Pocket and Google+, Linkedin are excluded from migration target because they are migrated automatically.
1364
+ $this->share_scheme_migration_exclude_keys = array(
1365
  self::REF_SHARE_POCKET,
1366
  self::REF_SHARE_GPLUS,
1367
  self::REF_SHARE_LINKEDIN,
1368
+ );
1369
+
1370
+ if ( self::OPT_SHARE_TWITTER_API_JSOON === $this->share_base_twitter_api ) {
1371
+ $this->share_scheme_migration_exclude_keys[] = self::REF_SHARE_TWITTER;
1372
+ }
1373
+
1374
+ $this->follow_scheme_migration_exclude_keys = array(
1375
  self::REF_FOLLOW_TWITTER,
1376
  self::REF_FOLLOW_FACEBOOK,
1377
  self::REF_FOLLOW_PUSH7,
1379
  self::REF_FOLLOW_ONESIGNAL,
1380
  );
1381
 
 
 
 
 
1382
  if ( ! empty( $settings[ self::DB_FOLLOW_CACHE_TARGET ] ) ) {
1383
  $this->follow_base_cache_target = $settings[ self::DB_FOLLOW_CACHE_TARGET ];
1384
  } else {
1655
  'post_types' => $this->share_base_cache_post_types,
1656
  'scheme_migration_mode' => $this->scheme_migration_mode,
1657
  'scheme_migration_date' => $this->scheme_migration_date,
1658
+ 'scheme_migration_exclude_keys' => $this->share_scheme_migration_exclude_keys,
1659
  'fault_tolerance_mode' => $this->fault_tolerance_mode,
1660
  'crawl_throttling_mode' => $this->crawl_throttling_mode,
1661
  );
1674
  'post_types' => $this->share_base_cache_post_types,
1675
  'scheme_migration_mode' => $this->scheme_migration_mode,
1676
  'scheme_migration_date' => $this->scheme_migration_date,
1677
+ 'scheme_migration_exclude_keys' => $this->share_scheme_migration_exclude_keys,
1678
  'fault_tolerance_mode' => $this->fault_tolerance_mode,
1679
  'crawl_throttling_mode' => $this->crawl_throttling_mode,
1680
  );
1692
  'post_types' => $this->share_base_cache_post_types,
1693
  'scheme_migration_mode' => $this->scheme_migration_mode,
1694
  'scheme_migration_date' => $this->scheme_migration_date,
1695
+ 'scheme_migration_exclude_keys' => $this->share_scheme_migration_exclude_keys,
1696
  'fault_tolerance_mode' => $this->fault_tolerance_mode,
1697
  'crawl_throttling_mode' => $this->crawl_throttling_mode,
1698
  );
1731
  'target_sns' => $this->follow_base_cache_target,
1732
  'check_interval' => $this->follow_base_check_interval,
1733
  'scheme_migration_mode' => $this->scheme_migration_mode,
1734
+ 'scheme_migration_exclude_keys' => $this->follow_scheme_migration_exclude_keys,
1735
  'feed_type' => $this->follow_feed_type,
1736
  );
1737
 
1745
  'target_sns' => $this->follow_base_cache_target,
1746
  'check_interval' => $this->follow_base_check_interval,
1747
  'scheme_migration_mode' => $this->scheme_migration_mode,
1748
+ 'scheme_migration_exclude_keys' => $this->follow_scheme_migration_exclude_keys,
1749
  'feed_type' => $this->follow_feed_type,
1750
  );
1751