SNS Count Cache - Version 0.10.0

Version Description

  • Fixed: Facebook share count can not be retrieved and cached.
  • Added: function to configure parameters for share rush cache.
  • Added: function to keep cached share counts when share count retrieval fails.
  • Added: function to retrieve share count of Pinterest.

=

Download this release

Release Info

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

Code changes from version 0.9.2 to 0.10.0

Files changed (55) hide show
  1. includes/admin-cache-status.php +1 -1
  2. includes/admin-dashboard-widget.php +3 -0
  3. includes/admin-dashboard.php +3 -0
  4. includes/admin-help.php +6 -1
  5. includes/admin-hot-content.php +6 -3
  6. includes/admin-setting.php +157 -60
  7. includes/admin-share-count.php +3 -0
  8. includes/{class-blowfish.php → class-crypt-blowfish.php} +4 -4
  9. includes/class-default-key.php +320 -320
  10. includes/class-mcrypt.php +0 -65
  11. includes/{class-analytical-engline.php → class-scc-analytical-engline.php} +102 -102
  12. includes/{class-cache-engine.php → class-scc-cache-engine.php} +107 -113
  13. includes/{class-common-data-export-engine.php → class-scc-common-data-export-engine.php} +30 -30
  14. includes/{class-common-job-reset-engine.php → class-scc-common-job-reset-engine.php} +11 -11
  15. includes/{class-common-util.php → class-scc-common-util.php} +11 -14
  16. includes/{class-crawl-strategy.php → class-scc-crawl-strategy.php} +229 -229
  17. includes/{class-crawler.php → class-scc-crawler.php} +199 -194
  18. includes/{class-engine.php → class-scc-engine.php} +158 -158
  19. includes/{class-export-engine.php → class-scc-export-engine.php} +2 -2
  20. includes/{class-follow-base-cache-engine.php → class-scc-follow-base-cache-engine.php} +229 -229
  21. includes/{class-follow-cache-engine.php → class-scc-follow-cache-engine.php} +201 -201
  22. includes/{class-follow-crawler.php → class-scc-follow-crawler.php} +297 -297
  23. includes/{class-follow-facebook-strategy.php → class-scc-follow-facebook-strategy.php} +9 -9
  24. includes/{class-follow-feedly-strategy.php → class-scc-follow-feedly-strategy.php} +8 -8
  25. includes/{class-follow-instagram-strategy.php → class-scc-follow-instagram-strategy.php} +8 -8
  26. includes/{class-follow-lazy-cache-engine.php → class-scc-follow-lazy-cache-engine.php} +25 -14
  27. includes/{class-follow-push7-strategy.php → class-scc-follow-push7-strategy.php} +8 -8
  28. includes/{class-follow-restore-cache-engine.php → class-scc-follow-restore-cache-engine.php} +25 -14
  29. includes/{class-follow-second-cache-engine.php → class-scc-follow-second-cache-engine.php} +13 -13
  30. includes/{class-follow-twitter-strategy.php → class-scc-follow-twitter-strategy.php} +8 -9
  31. includes/{class-share-analytical-engine.php → class-scc-share-analytical-engine.php} +36 -36
  32. includes/{class-share-base-cache-engine.php → class-scc-share-base-cache-engine.php} +48 -29
  33. includes/{class-share-cache-engine.php → class-scc-share-cache-engine.php} +76 -27
  34. includes/{class-share-crawler.php → class-scc-share-crawler.php} +307 -303
  35. includes/{class-share-facebook-strategy.php → class-scc-share-facebook-strategy.php} +11 -9
  36. includes/{class-share-google-strategy.php → class-scc-share-google-strategy.php} +8 -8
  37. includes/{class-share-hatebu-strategy.php → class-scc-share-hatebu-strategy.php} +8 -8
  38. includes/{class-share-lazy-cache-engine.php → class-scc-share-lazy-cache-engine.php} +39 -18
  39. includes/class-scc-share-pinterest-strategy.php +128 -0
  40. includes/{class-share-pocket-strategy.php → class-scc-share-pocket-strategy.php} +8 -8
  41. includes/{class-share-restore-cache-engine.php → class-scc-share-restore-cache-engine.php} +18 -18
  42. includes/{class-share-rush-cache-engine.php → class-scc-share-rush-cache-engine.php} +46 -26
  43. includes/{class-share-second-cache-engine.php → class-scc-share-second-cache-engine.php} +15 -16
  44. includes/{class-share-twitter-strategy.php → class-scc-share-twitter-strategy.php} +162 -162
  45. includes/{class-sleep-throttle.php → class-scc-sleep-throttle.php} +124 -124
  46. includes/{class-wp-cron-util.php → class-scc-wp-cron-util.php} +267 -267
  47. includes/class-share-rescue-cache-engine.php +0 -328
  48. includes/interface-order.php +0 -35
  49. includes/{interface-cache-order.php → interface-scc-order.php} +41 -34
  50. js/jquery.scc-cache-info.js +161 -153
  51. js/jquery.scc-cache-info.min.js +7 -7
  52. languages/sns-count-cache-ja.mo +0 -0
  53. languages/sns-count-cache-ja.po +530 -440
  54. readme.txt +12 -2
  55. sns-count-cache.php +392 -369
includes/admin-cache-status.php CHANGED
@@ -137,7 +137,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
137
  echo '</td>';
138
  }
139
  } else {
140
- Common_Util::log( '[' . __METHOD__ . '] : no transient' );
141
  echo '<td class="no-cache">';
142
  _e( 'no cache', self::DOMAIN );
143
  echo '</td>';
137
  echo '</td>';
138
  }
139
  } else {
140
+ SCC_Common_Util::log( '[' . __METHOD__ . '] : no transient' );
141
  echo '<td class="no-cache">';
142
  _e( 'no cache', self::DOMAIN );
143
  echo '</td>';
includes/admin-dashboard-widget.php CHANGED
@@ -107,6 +107,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
107
  case self::REF_SHARE_HATEBU:
108
  $sns_name = __( 'Hatebu', self::DOMAIN );
109
  break;
 
 
 
110
  case self::REF_SHARE_TOTAL:
111
  $sns_name = __( 'Total', self::DOMAIN );
112
  break;
107
  case self::REF_SHARE_HATEBU:
108
  $sns_name = __( 'Hatebu', self::DOMAIN );
109
  break;
110
+ case self::REF_SHARE_PINTEREST:
111
+ $sns_name = __( 'Pinterest', self::DOMAIN );
112
+ break;
113
  case self::REF_SHARE_TOTAL:
114
  $sns_name = __( 'Total', self::DOMAIN );
115
  break;
includes/admin-dashboard.php CHANGED
@@ -121,6 +121,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
121
  case self::REF_SHARE_HATEBU:
122
  $sns_name = __( 'Hatebu', self::DOMAIN );
123
  break;
 
 
 
124
  case self::REF_SHARE_TOTAL:
125
  $sns_name = __( 'Total', self::DOMAIN );
126
  break;
121
  case self::REF_SHARE_HATEBU:
122
  $sns_name = __( 'Hatebu', self::DOMAIN );
123
  break;
124
+ case self::REF_SHARE_PINTEREST:
125
+ $sns_name = __( 'Pinterest', self::DOMAIN );
126
+ break;
127
  case self::REF_SHARE_TOTAL:
128
  $sns_name = __( 'Total', self::DOMAIN );
129
  break;
includes/admin-help.php CHANGED
@@ -49,7 +49,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
49
  <h3 class="hndle"><span><?php _e( 'Help', self::DOMAIN ); ?></span></h3>
50
  <div class="inside">
51
  <h4><?php _e( 'What is WordPress plugin SNS Cout Cache?', self::DOMAIN ); ?></h4>
52
- <p><?php _e( 'WordPress plugin SNS Count Cache is a plugin which helps you to shorten page loading time when your site displays share and follower counts. This plugin gets share counts such as Twitter and Facebook, Google+, Pocket and caches these counts in the background. This plugin alse caches follower counts such as Twitter and Facebook, Feedly, Instagram, Push7 in the same way. The share and follower counts can be retrieved quickly not through network but through the cache using given functions.', self::DOMAIN ); ?></p>
53
  <h4><?php _e( 'How often does this plugin get and cache share counts?', self::DOMAIN ); ?></h4>
54
  <p><?php _e( 'Although this plugin gets share count of 20 posts at a time every 10 minutes by default, you can modify the setting in the "Setting" tab in the administration page.', self::DOMAIN ); ?></p>
55
  <h4><?php _e( 'How can I know whether share count of each post is cached or not?', self::DOMAIN ); ?></h4>
@@ -86,6 +86,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
86
  <tr><td>scc_get_share_gplus()</td><td><?php _e( 'Google Plus share count is returned from cache.', self::DOMAIN ); ?></td></tr>
87
  <tr><td>scc_get_share_hatebu()</td><td><?php _e( 'Hatena Bookmark share count is returned from cache.', self::DOMAIN ); ?></td></tr>
88
  <tr><td>scc_get_share_pocket()</td><td><?php _e( 'Pocket share count is returned from cache.', self::DOMAIN ); ?></td></tr>
 
89
  <tr><td>scc_get_share_total()</td><td><?php _e( 'Total share count of selected SNS is returned from cache.', self::DOMAIN ); ?></td></tr>
90
  </tbody>
91
  </table>
@@ -128,6 +129,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
128
  function_exists( &#039;scc_get_share_facebook&#039; ) &amp;&amp;
129
  function_exists( &#039;scc_get_share_gplus&#039; ) &amp;&amp;
130
  function_exists( &#039;scc_get_share_pocket&#039; ) &amp;&amp;
 
131
  function_exists( &#039;scc_get_share_total&#039; )
132
  ) {
133
  // In WordPress loop, you can use the given function
@@ -136,6 +138,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
136
  echo &#039;&lt;div&gt;Facebook share count: &#039; . scc_get_share_facebook() . &#039;&lt;/div&gt;&#039;;
137
  echo &#039;&lt;div&gt;Google+ share count: &#039; . scc_get_share_gplus() . &#039;&lt;/div&gt;&#039;;
138
  echo &#039;&lt;div&gt;Pocket share count: &#039; . scc_get_share_pocket() . &#039;&lt;/div&gt;&#039;;
 
139
  echo &#039;&lt;div&gt;Total of share count: &#039; . scc_get_share_total() . &#039;&lt;/div&gt;&#039;;
140
  }
141
  }
@@ -173,6 +176,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
173
  <tr><td>scc_share_count_google+</td><td><?php _e( 'A meta key to access Google+ share count', self::DOMAIN ); ?></td></tr>
174
  <tr><td>scc_share_count_hatebu</td><td><?php _e( 'A meta key to access Hatena Bookmark share count', self::DOMAIN ); ?></td></tr>
175
  <tr><td>scc_share_count_pocket</td><td><?php _e( 'A meta key to access Pocket share count', self::DOMAIN ); ?></td></tr>
 
176
  <tr><td>scc_share_count_total</td><td><?php _e( 'A meta key to access total share count', self::DOMAIN ); ?></td></tr>
177
  </tbody>
178
  </table>
@@ -191,6 +195,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
191
  <tr><td>scc_share_delta_google+</td><td><?php _e( 'A meta key to access variation of Google+ share count', self::DOMAIN ); ?></td></tr>
192
  <tr><td>scc_share_delta_hatebu</td><td><?php _e( 'A meta key to access variation of Hatena Bookmark share count', self::DOMAIN ); ?></td></tr>
193
  <tr><td>scc_share_delta_pocket</td><td><?php _e( 'A meta key to access variation of Pocket share count', self::DOMAIN ); ?></td></tr>
 
194
  <tr><td>scc_share_delta_total</td><td><?php _e( 'A meta key to access variation of total share count', self::DOMAIN ); ?></td></tr>
195
  </tbody>
196
  </table>
49
  <h3 class="hndle"><span><?php _e( 'Help', self::DOMAIN ); ?></span></h3>
50
  <div class="inside">
51
  <h4><?php _e( 'What is WordPress plugin SNS Cout Cache?', self::DOMAIN ); ?></h4>
52
+ <p><?php _e( 'WordPress plugin SNS Count Cache is a plugin which helps you to shorten page loading time when your site displays share and follower counts. This plugin gets share counts such as Twitter and Facebook, Google+, Pocket, Pinterest and caches these counts in the background. This plugin alse caches follower counts such as Twitter and Facebook, Feedly, Instagram, Push7 in the same way. The share and follower counts can be retrieved quickly not through network but through the cache using given functions.', self::DOMAIN ); ?></p>
53
  <h4><?php _e( 'How often does this plugin get and cache share counts?', self::DOMAIN ); ?></h4>
54
  <p><?php _e( 'Although this plugin gets share count of 20 posts at a time every 10 minutes by default, you can modify the setting in the "Setting" tab in the administration page.', self::DOMAIN ); ?></p>
55
  <h4><?php _e( 'How can I know whether share count of each post is cached or not?', self::DOMAIN ); ?></h4>
86
  <tr><td>scc_get_share_gplus()</td><td><?php _e( 'Google Plus share count is returned from cache.', self::DOMAIN ); ?></td></tr>
87
  <tr><td>scc_get_share_hatebu()</td><td><?php _e( 'Hatena Bookmark share count is returned from cache.', self::DOMAIN ); ?></td></tr>
88
  <tr><td>scc_get_share_pocket()</td><td><?php _e( 'Pocket share count is returned from cache.', self::DOMAIN ); ?></td></tr>
89
+ <tr><td>scc_get_share_pinterest()</td><td><?php _e( 'Pinterest share count is returned from cache.', self::DOMAIN ); ?></td></tr>
90
  <tr><td>scc_get_share_total()</td><td><?php _e( 'Total share count of selected SNS is returned from cache.', self::DOMAIN ); ?></td></tr>
91
  </tbody>
92
  </table>
129
  function_exists( &#039;scc_get_share_facebook&#039; ) &amp;&amp;
130
  function_exists( &#039;scc_get_share_gplus&#039; ) &amp;&amp;
131
  function_exists( &#039;scc_get_share_pocket&#039; ) &amp;&amp;
132
+ function_exists( &#039;scc_get_share_pinterest&#039; ) &amp;&amp;
133
  function_exists( &#039;scc_get_share_total&#039; )
134
  ) {
135
  // In WordPress loop, you can use the given function
138
  echo &#039;&lt;div&gt;Facebook share count: &#039; . scc_get_share_facebook() . &#039;&lt;/div&gt;&#039;;
139
  echo &#039;&lt;div&gt;Google+ share count: &#039; . scc_get_share_gplus() . &#039;&lt;/div&gt;&#039;;
140
  echo &#039;&lt;div&gt;Pocket share count: &#039; . scc_get_share_pocket() . &#039;&lt;/div&gt;&#039;;
141
+ echo &#039;&lt;div&gt;Pinterest share count: &#039; . scc_get_share_pinterest() . &#039;&lt;/div&gt;&#039;;
142
  echo &#039;&lt;div&gt;Total of share count: &#039; . scc_get_share_total() . &#039;&lt;/div&gt;&#039;;
143
  }
144
  }
176
  <tr><td>scc_share_count_google+</td><td><?php _e( 'A meta key to access Google+ share count', self::DOMAIN ); ?></td></tr>
177
  <tr><td>scc_share_count_hatebu</td><td><?php _e( 'A meta key to access Hatena Bookmark share count', self::DOMAIN ); ?></td></tr>
178
  <tr><td>scc_share_count_pocket</td><td><?php _e( 'A meta key to access Pocket share count', self::DOMAIN ); ?></td></tr>
179
+ <tr><td>scc_share_count_pinterest</td><td><?php _e( 'A meta key to access Pinterest share count', self::DOMAIN ); ?></td></tr>
180
  <tr><td>scc_share_count_total</td><td><?php _e( 'A meta key to access total share count', self::DOMAIN ); ?></td></tr>
181
  </tbody>
182
  </table>
195
  <tr><td>scc_share_delta_google+</td><td><?php _e( 'A meta key to access variation of Google+ share count', self::DOMAIN ); ?></td></tr>
196
  <tr><td>scc_share_delta_hatebu</td><td><?php _e( 'A meta key to access variation of Hatena Bookmark share count', self::DOMAIN ); ?></td></tr>
197
  <tr><td>scc_share_delta_pocket</td><td><?php _e( 'A meta key to access variation of Pocket share count', self::DOMAIN ); ?></td></tr>
198
+ <tr><td>scc_share_delta_pinterest</td><td><?php _e( 'A meta key to access variation of Pinterest share count', self::DOMAIN ); ?></td></tr>
199
  <tr><td>scc_share_delta_total</td><td><?php _e( 'A meta key to access variation of total share count', self::DOMAIN ); ?></td></tr>
200
  </tbody>
201
  </table>
includes/admin-hot-content.php CHANGED
@@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
  if ( ! defined( 'ABSPATH' ) ) exit(); // Exit if accessed directly
31
-
32
  $posts_per_page = 50;
33
 
34
  $sort_mode = false;
@@ -115,6 +115,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
115
  case self::REF_SHARE_HATEBU:
116
  $sns_name = __( 'Hatebu', self::DOMAIN );
117
  break;
 
 
 
118
  case self::REF_SHARE_TOTAL:
119
  $sns_name = __( 'Total', self::DOMAIN );
120
  break;
@@ -161,9 +164,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
161
  'type'=>'NUMERIC'
162
  );
163
 
164
- Common_Util::log( $meta_query );
165
 
166
- Common_Util::log( 'version: ' . get_bloginfo( 'version') );
167
 
168
  $query_args = array(
169
  'post_type' => $this->share_base_cache_post_types,
28
  */
29
 
30
  if ( ! defined( 'ABSPATH' ) ) exit(); // Exit if accessed directly
31
+
32
  $posts_per_page = 50;
33
 
34
  $sort_mode = false;
115
  case self::REF_SHARE_HATEBU:
116
  $sns_name = __( 'Hatebu', self::DOMAIN );
117
  break;
118
+ case self::REF_SHARE_PINTEREST:
119
+ $sns_name = __( 'Pinterest', self::DOMAIN );
120
+ break;
121
  case self::REF_SHARE_TOTAL:
122
  $sns_name = __( 'Total', self::DOMAIN );
123
  break;
164
  'type'=>'NUMERIC'
165
  );
166
 
167
+ SCC_Common_Util::log( $meta_query );
168
 
169
+ SCC_Common_Util::log( 'version: ' . get_bloginfo( 'version') );
170
 
171
  $query_args = array(
172
  'post_type' => $this->share_base_cache_post_types,
includes/admin-setting.php CHANGED
@@ -56,13 +56,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
56
  }
57
 
58
  if ( isset( $_POST["share_base_posts_per_check"] ) && $_POST["share_base_posts_per_check"] && is_numeric( $_POST["share_base_posts_per_check"] ) ) {
59
- $settings[self::DB_SHARE_POSTS_PER_CHECK] = $_POST["share_base_posts_per_check"];
60
  }
61
 
62
  if ( isset( $_POST["dynamic_cache_mode"] ) && $_POST["dynamic_cache_mode"] ) {
63
  $settings[self::DB_COMMON_DYNAMIC_CACHE_MODE] = $_POST["dynamic_cache_mode"];
64
  }
65
 
 
 
 
 
66
  if ( isset( $_POST["share_variation_analysis_mode"] ) && $_POST["share_variation_analysis_mode"] ) {
67
  $settings[self::DB_SHARE_VARIATION_ANALYSIS_MODE] = $_POST["share_variation_analysis_mode"];
68
  }
@@ -75,6 +79,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
75
  $settings[self::DB_SHARE_RUSH_CHECK_INTERVAL] = $_POST["share_rush_check_interval"];
76
  }
77
 
 
 
 
 
78
  if ( isset( $_POST["data_export_mode"] ) && $_POST["data_export_mode"] ) {
79
  $settings[self::DB_COMMON_DATA_EXPORT_MODE] = $_POST["data_export_mode"];
80
  }
@@ -117,13 +125,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
117
  $share_base_cache_target[self::REF_SHARE_HATEBU] = false;
118
  }
119
 
120
- /*
121
  if ( isset( $_POST["share_base_cache_target_pinterest"] ) && $_POST["share_base_cache_target_pinterest"] ) {
122
  $share_base_cache_target[self::REF_SHARE_PINTEREST] = true;
123
  } else {
124
  $share_base_cache_target[self::REF_SHARE_PINTEREST] = false;
125
  }
126
 
 
127
  if ( isset( $_POST["share_base_cache_target_linkedin"] ) && $_POST["share_base_cache_target_linkedin"] ) {
128
  $share_base_cache_target[self::REF_SHARE_LINKEDIN] = true;
129
  } else {
@@ -179,33 +187,41 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
179
 
180
  $follow_twitter_preparation_flag = true;
181
 
 
 
 
 
 
 
 
 
182
  if ( isset( $_POST["follow_twitter_screen_name"] ) && $_POST["follow_twitter_screen_name"] ) {
183
  $settings[self::DB_FOLLOW_TWITTER_SCREEN_NAME] = $_POST["follow_twitter_screen_name"];
184
  }
185
 
186
  if ( isset( $_POST["follow_twitter_consumer_key"] ) && $_POST["follow_twitter_consumer_key"] ) {
187
- $settings[self::DB_FOLLOW_TWITTER_CONSUMER_KEY] = Common_Util::encrypt_data( $_POST["follow_twitter_consumer_key"], AUTH_KEY );
188
  } else {
189
  $follow_twitter_preparation_flag = false;
190
  }
191
 
192
  if ( isset( $_POST["follow_twitter_consumer_secret"] ) && $_POST["follow_twitter_consumer_secret"] ) {
193
- $settings[self::DB_FOLLOW_TWITTER_CONSUMER_SECRET] = Common_Util::encrypt_data( $_POST["follow_twitter_consumer_secret"], AUTH_KEY );
194
  } else {
195
  $follow_twitter_preparation_flag = false;
196
  }
197
 
198
  if ( isset( $_POST["follow_twitter_bearer_token"] ) && $_POST["follow_twitter_bearer_token"] ) {
199
- $settings[self::DB_FOLLOW_TWITTER_BEARER_TOKEN] = Common_Util::encrypt_data( $_POST["follow_twitter_bearer_token"], AUTH_KEY );
200
  }
201
 
202
  /*
203
  if ( isset( $_POST["follow_twitter_access_token"] ) && $_POST["follow_twitter_access_token"] ) {
204
- $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN] = Common_Util::encrypt_data( $_POST["follow_twitter_access_token"], AUTH_KEY );
205
  }
206
 
207
  if ( isset( $_POST["follow_twitter_access_token_secret"] ) && $_POST["follow_twitter_access_token_secret"] ) {
208
- $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN_SECRET] = Common_Util::encrypt_data( $_POST["follow_twitter_access_token_secret"], AUTH_KEY );
209
  }
210
  */
211
 
@@ -214,31 +230,31 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
214
  }
215
 
216
  if ( isset( $_POST["follow_facebook_app_id"] ) && $_POST["follow_facebook_app_id"] ) {
217
- $settings[self::DB_FOLLOW_FACEBOOK_APP_ID] = Common_Util::encrypt_data( $_POST["follow_facebook_app_id"], AUTH_KEY );
218
  }
219
 
220
  if ( isset( $_POST["follow_facebook_app_secret"] ) && $_POST["follow_facebook_app_secret"] ) {
221
- $settings[self::DB_FOLLOW_FACEBOOK_APP_SECRET] = Common_Util::encrypt_data( $_POST["follow_facebook_app_secret"], AUTH_KEY );
222
  }
223
 
224
  if ( isset( $_POST["follow_facebook_access_token"] ) && $_POST["follow_facebook_access_token"] ) {
225
- $settings[self::DB_FOLLOW_FACEBOOK_ACCESS_TOKEN] = Common_Util::encrypt_data( $_POST["follow_facebook_access_token"], AUTH_KEY );
226
  }
227
 
228
  if ( isset( $_POST["follow_push7_appno"] ) && $_POST["follow_push7_appno"] ) {
229
- $settings[self::DB_FOLLOW_PUSH7_APPNO] = Common_Util::encrypt_data( $_POST["follow_push7_appno"], AUTH_KEY );
230
  }
231
 
232
  if ( isset( $_POST["follow_instagram_access_token"] ) && $_POST["follow_instagram_access_token"] ) {
233
- $settings[self::DB_FOLLOW_INSTAGRAM_ACCESS_TOKEN] = Common_Util::encrypt_data( $_POST["follow_instagram_access_token"], AUTH_KEY );
234
  }
235
 
236
  if ( isset( $_POST["follow_instagram_client_id"] ) && $_POST["follow_instagram_client_id"] ) {
237
- $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_ID] = Common_Util::encrypt_data( $_POST["follow_instagram_client_id"], AUTH_KEY );
238
  }
239
 
240
  if ( isset( $_POST["follow_instagram_client_secret"] ) && $_POST["follow_instagram_client_secret"] ) {
241
- $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_SECRET] = Common_Util::encrypt_data( $_POST["follow_instagram_client_secret"], AUTH_KEY );
242
  }
243
 
244
  if ( isset( $_POST["follow_feed_type"] ) && $_POST["follow_feed_type"] ) {
@@ -323,7 +339,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
323
  }
324
 
325
  if ( isset( $_POST["reset_data"] ) && $_POST["reset_data"] === __( 'Reset', self::DOMAIN ) ) {
326
- Common_Util::log( '[' . __METHOD__ . '] reset' );
327
 
328
  $this->export_engines[self::REF_COMMON_EXPORT]->reset_export();
329
 
@@ -331,7 +347,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
331
  }
332
 
333
  if ( isset( $_POST["export_data"] ) && $_POST["export_data"] === __( 'Export', self::DOMAIN ) ) {
334
- Common_Util::log( '[' . __METHOD__ . '] export' );
335
 
336
  set_time_limit( $this->extended_max_execution_time );
337
 
@@ -343,7 +359,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
343
  }
344
 
345
  if ( isset( $_POST["update_share_comparison_base"] ) && $_POST["update_share_comparison_base"] === __( 'Update Basis of Comparison', self::DOMAIN ) ) {
346
- Common_Util::log( '[' . __METHOD__ . '] base' );
347
 
348
  set_time_limit( $this->extended_max_execution_time );
349
 
@@ -355,7 +371,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
355
  }
356
 
357
  if ( isset( $_POST["clear_share_base_cache"] ) && $_POST["clear_share_base_cache"] === __( 'Clear Cache', self::DOMAIN ) ) {
358
- Common_Util::log( '[' . __METHOD__ . '] clear cache' );
359
 
360
  set_time_limit( $this->extended_max_execution_time );
361
 
@@ -370,7 +386,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
370
  }
371
 
372
  if ( isset( $_POST["clear_follow_base_cache"] ) && $_POST["clear_follow_base_cache"] === __( 'Clear Cache', self::DOMAIN ) ) {
373
- Common_Util::log( '[' . __METHOD__ . '] clear cache' );
374
 
375
  set_time_limit( $this->extended_max_execution_time );
376
 
@@ -384,7 +400,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
384
  }
385
 
386
  if ( isset( $_POST["direct_follow_base_cache"] ) && $_POST["direct_follow_base_cache"] === __( 'Cache', self::DOMAIN ) ) {
387
- Common_Util::log( '[' . __METHOD__ . '] cache' );
388
 
389
  set_time_limit( $this->extended_max_execution_time );
390
 
@@ -396,7 +412,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
396
  }
397
 
398
  if ( isset( $_POST["get_tiwtter_bearer_token"] ) && $_POST["get_tiwtter_bearer_token"] === __( 'Get Bearer Token', self::DOMAIN ) ) {
399
- $tmp_twitter_bearer_token = Common_Util::get_twitter_bearer_token( $this->follow_twitter_consumer_key, $this->follow_twitter_consumer_secret );
400
  }
401
 
402
  } elseif( isset( $_GET['_wpnonce'] ) && $_GET['_wpnonce'] && isset( $_GET['action'] ) && $_GET['action'] && isset( $_GET['code'] ) && $_GET['code'] ) {
@@ -404,14 +420,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
404
  if ( check_admin_referer( 'instagram-auth', '_wpnonce' ) ) {
405
  if ( current_user_can( self::OPT_COMMON_CAPABILITY ) ) {
406
  $redirect_uri = plugins_url() . '/sns-count-cache/?action=instagram-auth';
407
- $tmp_instagram_access_token = Common_Util::get_instagram_access_token( $this->follow_instagram_client_id, $this->follow_instagram_client_secret, $redirect_uri, $_GET['code'] );
408
  }
409
  }
410
  } elseif ( $_GET['action'] === 'facebook-auth' ) {
411
  if ( check_admin_referer( 'facebook-auth', '_wpnonce' ) ) {
412
  if ( current_user_can( self::OPT_COMMON_CAPABILITY ) ) {
413
  $redirect_uri = plugins_url() . '/sns-count-cache/?action=facebook-auth';
414
- $tmp_facebook_access_token = Common_Util::get_facebook_access_token( $this->follow_facebook_app_id, $this->follow_facebook_app_secret, $redirect_uri, $_GET['code'] );
415
  }
416
  }
417
  }
@@ -448,6 +464,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
448
  echo '.</p></div>';
449
  }
450
 
 
 
 
 
 
 
 
 
 
 
 
451
  if ( isset( $this->follow_base_cache_target[self::REF_FOLLOW_INSTAGRAM] ) && $this->follow_base_cache_target[self::REF_FOLLOW_INSTAGRAM] ) {
452
  $configuration_check = $this->crawlers[self::REF_FOLLOW]->check_crawl_strategy_configurations( self::REF_FOLLOW_INSTAGRAM);
453
 
@@ -506,7 +533,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
506
  <a class="nav-tab" href="admin.php?page=scc-help"><?php _e( 'Help', self::DOMAIN ); ?></a>
507
  </h3>
508
  <p id="options-menu">
509
- <a href="#current-parameter"><?php _e( 'Current Setting', self::DOMAIN ); ?></a> | <a href="#share-base-cache"><?php _e( 'Share Base Cache', self::DOMAIN ); ?></a> | <a href="#share-rush-cache"><?php _e( 'Share Rush Cache', self::DOMAIN ); ?></a> | <a href="#share-variation-analysis"><?php _e( 'Share Variation Analysis', self::DOMAIN ); ?></a> | <a href="#follow-base-cache"><?php _e( 'Follow Base Cache', self::DOMAIN ); ?></a> | <a href="#common-dynamic-cache"><?php _e( 'Dynamic Cache', self::DOMAIN ); ?></a> | <a href="#common-data-crawler"><?php _e( 'Data Crawler', self::DOMAIN ); ?></a> | <a href="#common-data-export"><?php _e( 'Data Export', self::DOMAIN ); ?></a> | <a href="#common-exported-file"><?php _e( 'Exported File', self::DOMAIN ); ?></a>
510
  </p>
511
  <div class="metabox-holder">
512
  <div id="current-parameter" class="postbox">
@@ -542,10 +569,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
542
  if ( isset( $this->share_base_cache_target[self::REF_SHARE_LINKEDIN] ) && $this->share_base_cache_target[self::REF_SHARE_LINKEDIN] ) {
543
  $target_sns[] = 'Linkedin';
544
  }
 
545
  if ( isset( $this->share_base_cache_target[self::REF_SHARE_PINTEREST] ) && $this->share_base_cache_target[self::REF_SHARE_PINTEREST] ) {
546
  $target_sns[] = 'Pinterest';
547
  }
548
- */
549
  if ( isset( $this->share_base_cache_target[self::REF_SHARE_POCKET] ) && $this->share_base_cache_target[self::REF_SHARE_POCKET] ) {
550
  $target_sns[] = 'Pocket';
551
  }
@@ -646,6 +673,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
646
  echo esc_html( $this->share_rush_check_interval ) . ' ' . __( 'seconds', self::DOMAIN );
647
  ?>
648
  </td>
 
 
 
 
 
649
  </tr>
650
  <tr>
651
  <td><?php _e( 'Share Variation Analysis', self::DOMAIN ); ?></td>
@@ -775,17 +807,32 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
775
  <td><?php _e( 'Dynamic caching based on user access', self::DOMAIN ); ?></td><td>
776
  <?php
777
  switch ( $this->dynamic_cache_mode ) {
778
- case self::OPT_COMMON_ACCESS_BASED_CACHE_NONE:
779
- _e( 'Disabled (None)', self::DOMAIN );
780
  break;
781
- case self::OPT_COMMON_ACCESS_BASED_SYNC_CACHE:
782
- _e( 'Enabled (Synchronous Cache)', self::DOMAIN );
783
  break;
784
- case self::OPT_COMMON_ACCESS_BASED_ASYNC_CACHE:
785
- _e( 'Enabled (Asynchronous Cache)', self::DOMAIN );
786
  break;
787
- case self::OPT_COMMON_ACCESS_BASED_2ND_CACHE:
788
- _e( 'Enabled (Asynchronous 2nd Cache)', self::DOMAIN );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
789
  break;
790
  }
791
  ?>
@@ -874,6 +921,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
874
  <input type="checkbox" value="1" name="share_base_cache_target_hatebu"<?php if ( isset( $this->share_base_cache_target[self::REF_SHARE_HATEBU] ) && $this->share_base_cache_target[self::REF_SHARE_HATEBU] ) echo ' checked="checked"'; ?> />
875
  <label><?php _e( 'Hatena Bookmark', self::DOMAIN ); ?></label>
876
  </div>
 
 
 
 
877
  <div class="sns-check">
878
  <input type="checkbox" value="1" name="share_base_cache_target_pocket"<?php if ( isset( $this->share_base_cache_target[self::REF_SHARE_POCKET] ) && $this->share_base_cache_target[self::REF_SHARE_POCKET] ) echo ' checked="checked"'; ?> />
879
  <label><?php _e( 'Pocket', self::DOMAIN ); ?></label>
@@ -939,6 +990,45 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
939
  </div>
940
  </div>
941
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
942
  <?php if ( isset( $this->share_base_cache_target[self::REF_SHARE_TWITTER] ) && $this->share_base_cache_target[self::REF_SHARE_TWITTER] ) { ?>
943
  <div id="share-base-cache-twitter" class="postbox">
944
  <div class="handlediv" title="Click to toggle"><br></div>
@@ -1009,9 +1099,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1009
  <tr>
1010
  <th><label><?php _e( 'Interval cheking share count (sec)', self::DOMAIN ); ?></label></th>
1011
  <td>
1012
- <?php
1013
- echo esc_html( $this->share_rush_check_interval ) . ' ' . __( 'seconds', self::DOMAIN );
1014
- ?>
 
 
 
 
 
 
1015
  </td>
1016
  </tr>
1017
  </table>
@@ -1557,24 +1653,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1557
  </td>
1558
  </tr>
1559
  <?php } ?>
1560
- <!--
1561
- <tr>
1562
- <th><label><?php /* _e( 'Access token', self::DOMAIN ); */ ?></label></th>
1563
- <td>
1564
- <input type="password" class="text" name="follow_twitter_access_token" size="60" value="<?php /* echo esc_attr( $this->follow_twitter_access_token ); */ ?>" />
1565
- <br>
1566
- <label><?php /* _e( 'Twitter access token for OAuth', self::DOMAIN ); */ ?></label>
1567
- </td>
1568
- </tr>
1569
- <tr>
1570
- <th><label><?php /* _e( 'Access token secret', self::DOMAIN ); */ ?></label></th>
1571
- <td>
1572
- <input type="password" class="text" name="follow_twitter_access_token_secret" size="60" value="<?php /* echo esc_attr( $this->follow_twitter_access_token_secret ); */ ?>" />
1573
- <br>
1574
- <label><?php /* _e( 'Twitter access token secret for OAuth', self::DOMAIN ); */ ?></label>
1575
- </td>
1576
- </tr>
1577
- -->
1578
  </table>
1579
  <div class="submit-button">
1580
  <input type="submit" class="button button-primary" name="update_all_options" value="<?php _e( 'Update All Options', self::DOMAIN ); ?>" />
@@ -1594,12 +1672,31 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1594
  <th><label><?php _e( 'Dynamic caching based on user access', self::DOMAIN ); ?></label></th>
1595
  <td>
1596
  <select name="dynamic_cache_mode">
1597
- <option value="1"<?php if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_CACHE_NONE ) echo ' selected="selected"'; ?>><?php _e( 'Disabled (None)', self::DOMAIN ); ?></option>
1598
- <option value="2"<?php if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_SYNC_CACHE ) echo ' selected="selected"'; ?>><?php _e( 'Enabled (Synchronous Cache)', self::DOMAIN ); ?></option>
1599
- <option value="3"<?php if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_ASYNC_CACHE ) echo ' selected="selected"'; ?>><?php _e( 'Enabled (Asynchronous Cache)', self::DOMAIN ); ?></option>
1600
- <option value="4"<?php if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_2ND_CACHE ) echo ' selected="selected"'; ?>><?php _e( 'Enabled (Asynchronous 2nd Cache)', self::DOMAIN ); ?></option>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1601
  </select>
1602
- <label><?php _e( 'Default: Enabled (Asynchronous 2nd Cache)', self::DOMAIN ); ?></label>
1603
  </td>
1604
  </tr>
1605
  </table>
@@ -1946,7 +2043,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1946
  <td>
1947
  <?php
1948
  $abs_path = WP_PLUGIN_DIR . '/sns-count-cache/data/sns-count-cache-data.csv';
1949
- $file_size = Common_Util::get_file_size( $abs_path );
1950
 
1951
  if ( isset( $file_size ) ) {
1952
  echo $file_size;
56
  }
57
 
58
  if ( isset( $_POST["share_base_posts_per_check"] ) && $_POST["share_base_posts_per_check"] && is_numeric( $_POST["share_base_posts_per_check"] ) ) {
59
+ $settings[self::DB_SHARE_BASE_POSTS_PER_CHECK] = $_POST["share_base_posts_per_check"];
60
  }
61
 
62
  if ( isset( $_POST["dynamic_cache_mode"] ) && $_POST["dynamic_cache_mode"] ) {
63
  $settings[self::DB_COMMON_DYNAMIC_CACHE_MODE] = $_POST["dynamic_cache_mode"];
64
  }
65
 
66
+ if ( isset( $_POST["fault_tolerance_mode"] ) && $_POST["fault_tolerance_mode"] ) {
67
+ $settings[self::DB_COMMON_FAULT_TOLERANCE_MODE] = $_POST["fault_tolerance_mode"];
68
+ }
69
+
70
  if ( isset( $_POST["share_variation_analysis_mode"] ) && $_POST["share_variation_analysis_mode"] ) {
71
  $settings[self::DB_SHARE_VARIATION_ANALYSIS_MODE] = $_POST["share_variation_analysis_mode"];
72
  }
79
  $settings[self::DB_SHARE_RUSH_CHECK_INTERVAL] = $_POST["share_rush_check_interval"];
80
  }
81
 
82
+ if ( isset( $_POST["share_rush_posts_per_check"] ) && $_POST["share_rush_posts_per_check"] && is_numeric( $_POST["share_rush_posts_per_check"] ) ) {
83
+ $settings[self::DB_SHARE_RUSH_POSTS_PER_CHECK] = $_POST["share_rush_posts_per_check"];
84
+ }
85
+
86
  if ( isset( $_POST["data_export_mode"] ) && $_POST["data_export_mode"] ) {
87
  $settings[self::DB_COMMON_DATA_EXPORT_MODE] = $_POST["data_export_mode"];
88
  }
125
  $share_base_cache_target[self::REF_SHARE_HATEBU] = false;
126
  }
127
 
 
128
  if ( isset( $_POST["share_base_cache_target_pinterest"] ) && $_POST["share_base_cache_target_pinterest"] ) {
129
  $share_base_cache_target[self::REF_SHARE_PINTEREST] = true;
130
  } else {
131
  $share_base_cache_target[self::REF_SHARE_PINTEREST] = false;
132
  }
133
 
134
+ /*
135
  if ( isset( $_POST["share_base_cache_target_linkedin"] ) && $_POST["share_base_cache_target_linkedin"] ) {
136
  $share_base_cache_target[self::REF_SHARE_LINKEDIN] = true;
137
  } else {
187
 
188
  $follow_twitter_preparation_flag = true;
189
 
190
+ if ( isset( $_POST["share_facebook_app_id"] ) && $_POST["share_facebook_app_id"] ) {
191
+ $settings[self::DB_SHARE_FACEBOOK_APP_ID] = SCC_Common_Util::encrypt_data( $_POST["share_facebook_app_id"], AUTH_KEY );
192
+ }
193
+
194
+ if ( isset( $_POST["share_facebook_app_secret"] ) && $_POST["share_facebook_app_secret"] ) {
195
+ $settings[self::DB_SHARE_FACEBOOK_APP_SECRET] = SCC_Common_Util::encrypt_data( $_POST["share_facebook_app_secret"], AUTH_KEY );
196
+ }
197
+
198
  if ( isset( $_POST["follow_twitter_screen_name"] ) && $_POST["follow_twitter_screen_name"] ) {
199
  $settings[self::DB_FOLLOW_TWITTER_SCREEN_NAME] = $_POST["follow_twitter_screen_name"];
200
  }
201
 
202
  if ( isset( $_POST["follow_twitter_consumer_key"] ) && $_POST["follow_twitter_consumer_key"] ) {
203
+ $settings[self::DB_FOLLOW_TWITTER_CONSUMER_KEY] = SCC_Common_Util::encrypt_data( $_POST["follow_twitter_consumer_key"], AUTH_KEY );
204
  } else {
205
  $follow_twitter_preparation_flag = false;
206
  }
207
 
208
  if ( isset( $_POST["follow_twitter_consumer_secret"] ) && $_POST["follow_twitter_consumer_secret"] ) {
209
+ $settings[self::DB_FOLLOW_TWITTER_CONSUMER_SECRET] = SCC_Common_Util::encrypt_data( $_POST["follow_twitter_consumer_secret"], AUTH_KEY );
210
  } else {
211
  $follow_twitter_preparation_flag = false;
212
  }
213
 
214
  if ( isset( $_POST["follow_twitter_bearer_token"] ) && $_POST["follow_twitter_bearer_token"] ) {
215
+ $settings[self::DB_FOLLOW_TWITTER_BEARER_TOKEN] = SCC_Common_Util::encrypt_data( $_POST["follow_twitter_bearer_token"], AUTH_KEY );
216
  }
217
 
218
  /*
219
  if ( isset( $_POST["follow_twitter_access_token"] ) && $_POST["follow_twitter_access_token"] ) {
220
+ $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN] = SCC_Common_Util::encrypt_data( $_POST["follow_twitter_access_token"], AUTH_KEY );
221
  }
222
 
223
  if ( isset( $_POST["follow_twitter_access_token_secret"] ) && $_POST["follow_twitter_access_token_secret"] ) {
224
+ $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN_SECRET] = SCC_Common_Util::encrypt_data( $_POST["follow_twitter_access_token_secret"], AUTH_KEY );
225
  }
226
  */
227
 
230
  }
231
 
232
  if ( isset( $_POST["follow_facebook_app_id"] ) && $_POST["follow_facebook_app_id"] ) {
233
+ $settings[self::DB_FOLLOW_FACEBOOK_APP_ID] = SCC_Common_Util::encrypt_data( $_POST["follow_facebook_app_id"], AUTH_KEY );
234
  }
235
 
236
  if ( isset( $_POST["follow_facebook_app_secret"] ) && $_POST["follow_facebook_app_secret"] ) {
237
+ $settings[self::DB_FOLLOW_FACEBOOK_APP_SECRET] = SCC_Common_Util::encrypt_data( $_POST["follow_facebook_app_secret"], AUTH_KEY );
238
  }
239
 
240
  if ( isset( $_POST["follow_facebook_access_token"] ) && $_POST["follow_facebook_access_token"] ) {
241
+ $settings[self::DB_FOLLOW_FACEBOOK_ACCESS_TOKEN] = SCC_Common_Util::encrypt_data( $_POST["follow_facebook_access_token"], AUTH_KEY );
242
  }
243
 
244
  if ( isset( $_POST["follow_push7_appno"] ) && $_POST["follow_push7_appno"] ) {
245
+ $settings[self::DB_FOLLOW_PUSH7_APPNO] = SCC_Common_Util::encrypt_data( $_POST["follow_push7_appno"], AUTH_KEY );
246
  }
247
 
248
  if ( isset( $_POST["follow_instagram_access_token"] ) && $_POST["follow_instagram_access_token"] ) {
249
+ $settings[self::DB_FOLLOW_INSTAGRAM_ACCESS_TOKEN] = SCC_Common_Util::encrypt_data( $_POST["follow_instagram_access_token"], AUTH_KEY );
250
  }
251
 
252
  if ( isset( $_POST["follow_instagram_client_id"] ) && $_POST["follow_instagram_client_id"] ) {
253
+ $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_ID] = SCC_Common_Util::encrypt_data( $_POST["follow_instagram_client_id"], AUTH_KEY );
254
  }
255
 
256
  if ( isset( $_POST["follow_instagram_client_secret"] ) && $_POST["follow_instagram_client_secret"] ) {
257
+ $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_SECRET] = SCC_Common_Util::encrypt_data( $_POST["follow_instagram_client_secret"], AUTH_KEY );
258
  }
259
 
260
  if ( isset( $_POST["follow_feed_type"] ) && $_POST["follow_feed_type"] ) {
339
  }
340
 
341
  if ( isset( $_POST["reset_data"] ) && $_POST["reset_data"] === __( 'Reset', self::DOMAIN ) ) {
342
+ SCC_Common_Util::log( '[' . __METHOD__ . '] reset' );
343
 
344
  $this->export_engines[self::REF_COMMON_EXPORT]->reset_export();
345
 
347
  }
348
 
349
  if ( isset( $_POST["export_data"] ) && $_POST["export_data"] === __( 'Export', self::DOMAIN ) ) {
350
+ SCC_Common_Util::log( '[' . __METHOD__ . '] export' );
351
 
352
  set_time_limit( $this->extended_max_execution_time );
353
 
359
  }
360
 
361
  if ( isset( $_POST["update_share_comparison_base"] ) && $_POST["update_share_comparison_base"] === __( 'Update Basis of Comparison', self::DOMAIN ) ) {
362
+ SCC_Common_Util::log( '[' . __METHOD__ . '] base' );
363
 
364
  set_time_limit( $this->extended_max_execution_time );
365
 
371
  }
372
 
373
  if ( isset( $_POST["clear_share_base_cache"] ) && $_POST["clear_share_base_cache"] === __( 'Clear Cache', self::DOMAIN ) ) {
374
+ SCC_Common_Util::log( '[' . __METHOD__ . '] clear cache' );
375
 
376
  set_time_limit( $this->extended_max_execution_time );
377
 
386
  }
387
 
388
  if ( isset( $_POST["clear_follow_base_cache"] ) && $_POST["clear_follow_base_cache"] === __( 'Clear Cache', self::DOMAIN ) ) {
389
+ SCC_Common_Util::log( '[' . __METHOD__ . '] clear cache' );
390
 
391
  set_time_limit( $this->extended_max_execution_time );
392
 
400
  }
401
 
402
  if ( isset( $_POST["direct_follow_base_cache"] ) && $_POST["direct_follow_base_cache"] === __( 'Cache', self::DOMAIN ) ) {
403
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cache' );
404
 
405
  set_time_limit( $this->extended_max_execution_time );
406
 
412
  }
413
 
414
  if ( isset( $_POST["get_tiwtter_bearer_token"] ) && $_POST["get_tiwtter_bearer_token"] === __( 'Get Bearer Token', self::DOMAIN ) ) {
415
+ $tmp_twitter_bearer_token = SCC_Common_Util::get_twitter_bearer_token( $this->follow_twitter_consumer_key, $this->follow_twitter_consumer_secret );
416
  }
417
 
418
  } elseif( isset( $_GET['_wpnonce'] ) && $_GET['_wpnonce'] && isset( $_GET['action'] ) && $_GET['action'] && isset( $_GET['code'] ) && $_GET['code'] ) {
420
  if ( check_admin_referer( 'instagram-auth', '_wpnonce' ) ) {
421
  if ( current_user_can( self::OPT_COMMON_CAPABILITY ) ) {
422
  $redirect_uri = plugins_url() . '/sns-count-cache/?action=instagram-auth';
423
+ $tmp_instagram_access_token = SCC_Common_Util::get_instagram_access_token( $this->follow_instagram_client_id, $this->follow_instagram_client_secret, $redirect_uri, $_GET['code'] );
424
  }
425
  }
426
  } elseif ( $_GET['action'] === 'facebook-auth' ) {
427
  if ( check_admin_referer( 'facebook-auth', '_wpnonce' ) ) {
428
  if ( current_user_can( self::OPT_COMMON_CAPABILITY ) ) {
429
  $redirect_uri = plugins_url() . '/sns-count-cache/?action=facebook-auth';
430
+ $tmp_facebook_access_token = SCC_Common_Util::get_facebook_access_token( $this->follow_facebook_app_id, $this->follow_facebook_app_secret, $redirect_uri, $_GET['code'] );
431
  }
432
  }
433
  }
464
  echo '.</p></div>';
465
  }
466
 
467
+ if ( isset( $this->share_base_cache_target[self::REF_SHARE_FACEBOOK] ) && $this->share_base_cache_target[self::REF_SHARE_FACEBOOK] ) {
468
+ $configuration_check = $this->crawlers[self::REF_SHARE]->check_crawl_strategy_configurations( self::REF_SHARE_FACEBOOK );
469
+
470
+ if ( ! $configuration_check ) {
471
+ echo '<div class="error"><p>';
472
+ _e( 'Configuratin is not enough to get share count. Please set required parameters at ', self::DOMAIN );
473
+ echo '<a href="#share-base-cache-facebook">' . __( 'Share Base Cache - Facebook', self::DOMAIN ) . '</a>';
474
+ echo '.</p></div>';
475
+ }
476
+ }
477
+
478
  if ( isset( $this->follow_base_cache_target[self::REF_FOLLOW_INSTAGRAM] ) && $this->follow_base_cache_target[self::REF_FOLLOW_INSTAGRAM] ) {
479
  $configuration_check = $this->crawlers[self::REF_FOLLOW]->check_crawl_strategy_configurations( self::REF_FOLLOW_INSTAGRAM);
480
 
533
  <a class="nav-tab" href="admin.php?page=scc-help"><?php _e( 'Help', self::DOMAIN ); ?></a>
534
  </h3>
535
  <p id="options-menu">
536
+ <a href="#current-parameter"><?php _e( 'Current Setting', self::DOMAIN ); ?></a> | <a href="#share-base-cache"><?php _e( 'Share Base Cache', self::DOMAIN ); ?></a> | <a href="#share-rush-cache"><?php _e( 'Share Rush Cache', self::DOMAIN ); ?></a> | <a href="#share-variation-analysis"><?php _e( 'Share Variation Analysis', self::DOMAIN ); ?></a> | <a href="#follow-base-cache"><?php _e( 'Follow Base Cache', self::DOMAIN ); ?></a> | <a href="#common-dynamic-cache"><?php _e( 'Dynamic Cache', self::DOMAIN ); ?></a> | <a href="#common-fault-tolerance"><?php _e( 'Fault Tolerance', self::DOMAIN ); ?></a> | <a href="#common-data-crawler"><?php _e( 'Data Crawler', self::DOMAIN ); ?></a> | <a href="#common-data-export"><?php _e( 'Data Export', self::DOMAIN ); ?></a> | <a href="#common-exported-file"><?php _e( 'Exported File', self::DOMAIN ); ?></a>
537
  </p>
538
  <div class="metabox-holder">
539
  <div id="current-parameter" class="postbox">
569
  if ( isset( $this->share_base_cache_target[self::REF_SHARE_LINKEDIN] ) && $this->share_base_cache_target[self::REF_SHARE_LINKEDIN] ) {
570
  $target_sns[] = 'Linkedin';
571
  }
572
+ */
573
  if ( isset( $this->share_base_cache_target[self::REF_SHARE_PINTEREST] ) && $this->share_base_cache_target[self::REF_SHARE_PINTEREST] ) {
574
  $target_sns[] = 'Pinterest';
575
  }
 
576
  if ( isset( $this->share_base_cache_target[self::REF_SHARE_POCKET] ) && $this->share_base_cache_target[self::REF_SHARE_POCKET] ) {
577
  $target_sns[] = 'Pocket';
578
  }
673
  echo esc_html( $this->share_rush_check_interval ) . ' ' . __( 'seconds', self::DOMAIN );
674
  ?>
675
  </td>
676
+ <tr>
677
+ <td><?php _e( 'Share Rush Cache', self::DOMAIN ); ?></td>
678
+ <td><?php _e( 'Number of contents to check at a time', self::DOMAIN ) ?></td>
679
+ <td><?php echo esc_html( $this->share_rush_posts_per_check ) . ' ' . __( 'contents', self::DOMAIN ); ?></td>
680
+ </tr>
681
  </tr>
682
  <tr>
683
  <td><?php _e( 'Share Variation Analysis', self::DOMAIN ); ?></td>
807
  <td><?php _e( 'Dynamic caching based on user access', self::DOMAIN ); ?></td><td>
808
  <?php
809
  switch ( $this->dynamic_cache_mode ) {
810
+ case self::OPT_COMMON_ACCESS_BASED_CACHE_OFF:
811
+ _e( 'Disabled', self::DOMAIN );
812
  break;
813
+ case self::OPT_COMMON_ACCESS_BASED_CACHE_ON:
814
+ _e( 'Enabled', self::DOMAIN );
815
  break;
816
+ default:
817
+ _e( 'Disabled', self::DOMAIN );
818
  break;
819
+ }
820
+ ?>
821
+ </td>
822
+ </tr>
823
+ <tr>
824
+ <td><?php _e( 'Fault Tolerance', self::DOMAIN); ?></td>
825
+ <td><?php _e( 'Fault tolerance of count retrieval', self::DOMAIN ); ?></td><td>
826
+ <?php
827
+ switch ( $this->fault_tolerance_mode ) {
828
+ case self::OPT_COMMON_FAULT_TOLERANCE_OFF:
829
+ _e( 'Disabled', self::DOMAIN );
830
+ break;
831
+ case self::OPT_COMMON_FAULT_TOLERANCE_ON:
832
+ _e( 'Enabled', self::DOMAIN );
833
+ break;
834
+ default:
835
+ _e( 'Disabled', self::DOMAIN );
836
  break;
837
  }
838
  ?>
921
  <input type="checkbox" value="1" name="share_base_cache_target_hatebu"<?php if ( isset( $this->share_base_cache_target[self::REF_SHARE_HATEBU] ) && $this->share_base_cache_target[self::REF_SHARE_HATEBU] ) echo ' checked="checked"'; ?> />
922
  <label><?php _e( 'Hatena Bookmark', self::DOMAIN ); ?></label>
923
  </div>
924
+ <div class="sns-check">
925
+ <input type="checkbox" value="1" name="share_base_cache_target_pinterest"<?php if ( isset( $this->share_base_cache_target[self::REF_SHARE_PINTEREST] ) && $this->share_base_cache_target[self::REF_SHARE_PINTEREST] ) echo ' checked="checked"'; ?> />
926
+ <label><?php _e( 'Pinterest', self::DOMAIN ); ?></label>
927
+ </div>
928
  <div class="sns-check">
929
  <input type="checkbox" value="1" name="share_base_cache_target_pocket"<?php if ( isset( $this->share_base_cache_target[self::REF_SHARE_POCKET] ) && $this->share_base_cache_target[self::REF_SHARE_POCKET] ) echo ' checked="checked"'; ?> />
930
  <label><?php _e( 'Pocket', self::DOMAIN ); ?></label>
990
  </div>
991
  </div>
992
  </div>
993
+ <?php if ( isset( $this->share_base_cache_target[self::REF_SHARE_FACEBOOK] ) && $this->share_base_cache_target[self::REF_SHARE_FACEBOOK] ) { ?>
994
+ <div id="share-base-cache-facebook" class="postbox">
995
+ <div class="handlediv" title="Click to toggle"><br></div>
996
+ <h3 class="hndle"><span><?php _e( 'Share Base Cache - Facebook', self::DOMAIN ); ?></span></h3>
997
+ <div class="inside">
998
+ <table class="form-table">
999
+ <tr>
1000
+ <th><label><?php _e( 'App ID (Client ID)', self::DOMAIN ); ?></label></th>
1001
+ <td>
1002
+ <input type="password" class="text" name="share_facebook_app_id" size="60" value="<?php echo esc_attr( $this->share_facebook_app_id ); ?>" />
1003
+ <br>
1004
+ <label><?php _e( 'Facebook app ID for OAuth', self::DOMAIN ); ?></label>
1005
+ </td>
1006
+ </tr>
1007
+ <tr>
1008
+ <th><label><?php _e( 'App secret (Client secret)', self::DOMAIN ); ?></label></th>
1009
+ <td>
1010
+ <input type="password" class="text" name="share_facebook_app_secret" size="60" value="<?php echo esc_attr( $this->share_facebook_app_secret ); ?>" />
1011
+ <br>
1012
+ <label><?php _e( 'Facebook app secret for OAuth', self::DOMAIN ); ?></label>
1013
+ </td>
1014
+ </tr>
1015
+ <?php if ( isset( $this->share_facebook_app_id ) && $this->share_facebook_app_id && isset( $this->share_facebook_app_secret ) && $this->share_facebook_app_secret ) { ?>
1016
+ <tr>
1017
+ <th><label><?php _e( 'Access token', self::DOMAIN ); ?></label></th>
1018
+ <td>
1019
+ <input type="password" class="text" name="tmp_share_facebook_access_token" size="60" value="<?php echo esc_attr( $this->share_facebook_access_token ); ?>" readonly />
1020
+ <br>
1021
+ <label><?php _e( 'Facebook access token for OAuth', self::DOMAIN ); ?></label>
1022
+ </td>
1023
+ </tr>
1024
+ <?php } ?>
1025
+ </table>
1026
+ <div class="submit-button">
1027
+ <input type="submit" class="button button-primary" name="update_all_options" value="<?php _e( 'Update All Options', self::DOMAIN ); ?>" />
1028
+ </div>
1029
+ </div>
1030
+ </div>
1031
+ <?php } ?>
1032
  <?php if ( isset( $this->share_base_cache_target[self::REF_SHARE_TWITTER] ) && $this->share_base_cache_target[self::REF_SHARE_TWITTER] ) { ?>
1033
  <div id="share-base-cache-twitter" class="postbox">
1034
  <div class="handlediv" title="Click to toggle"><br></div>
1099
  <tr>
1100
  <th><label><?php _e( 'Interval cheking share count (sec)', self::DOMAIN ); ?></label></th>
1101
  <td>
1102
+ <input type="text" class="text" name="share_rush_check_interval" size="20" value="<?php echo esc_attr( $this->share_rush_check_interval ); ?>" />
1103
+ <label><?php _e( 'Default: 600', self::DOMAIN ); ?></label>
1104
+ </td>
1105
+ </tr>
1106
+ <tr>
1107
+ <th><label><?php _e( 'Number of contents to check at a time', self::DOMAIN ); ?></label></th>
1108
+ <td>
1109
+ <input type="text" class="text" name="share_rush_posts_per_check" size="20" value="<?php echo esc_attr( $this->share_rush_posts_per_check ); ?>" />
1110
+ <label><?php _e( 'Default: 20', self::DOMAIN ); ?></label>
1111
  </td>
1112
  </tr>
1113
  </table>
1653
  </td>
1654
  </tr>
1655
  <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1656
  </table>
1657
  <div class="submit-button">
1658
  <input type="submit" class="button button-primary" name="update_all_options" value="<?php _e( 'Update All Options', self::DOMAIN ); ?>" />
1672
  <th><label><?php _e( 'Dynamic caching based on user access', self::DOMAIN ); ?></label></th>
1673
  <td>
1674
  <select name="dynamic_cache_mode">
1675
+ <option value="1"<?php if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_CACHE_OFF ) echo ' selected="selected"'; ?>><?php _e( 'Disabled', self::DOMAIN ); ?></option>
1676
+ <option value="5"<?php if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_CACHE_ON ) echo ' selected="selected"'; ?>><?php _e( 'Enabled', self::DOMAIN ); ?></option>
1677
+ </select>
1678
+ <label><?php _e( 'Default: Disabled', self::DOMAIN ); ?></label>
1679
+ </td>
1680
+ </tr>
1681
+ </table>
1682
+ <div class="submit-button">
1683
+ <input type="submit" class="button button-primary" name="update_all_options" value="<?php _e( 'Update All Options', self::DOMAIN ); ?>" />
1684
+ </div>
1685
+ </div>
1686
+ </div>
1687
+ <div id="common-fault-tolerance" class="postbox">
1688
+ <div class="handlediv" title="Click to toggle"><br></div>
1689
+ <h3 class="hndle"><span><?php _e( 'Fault Tolerance', self::DOMAIN ); ?></span></h3>
1690
+ <div class="inside">
1691
+ <table class="form-table">
1692
+ <tr>
1693
+ <th><label><?php _e( 'Fault tolerant mode of count retrieval', self::DOMAIN ); ?></label></th>
1694
+ <td>
1695
+ <select name="fault_tolerance_mode">
1696
+ <option value="1"<?php if ( $this->fault_tolerance_mode === self::OPT_COMMON_FAULT_TOLERANCE_OFF ) echo ' selected="selected"'; ?>><?php _e( 'Disabled', self::DOMAIN ); ?></option>
1697
+ <option value="2"<?php if ( $this->fault_tolerance_mode === self::OPT_COMMON_FAULT_TOLERANCE_ON ) echo ' selected="selected"'; ?>><?php _e( 'Enabled', self::DOMAIN ); ?></option>
1698
  </select>
1699
+ <label><?php _e( 'Default: Disabled', self::DOMAIN ); ?></label>
1700
  </td>
1701
  </tr>
1702
  </table>
2043
  <td>
2044
  <?php
2045
  $abs_path = WP_PLUGIN_DIR . '/sns-count-cache/data/sns-count-cache-data.csv';
2046
+ $file_size = SCC_Common_Util::get_file_size( $abs_path );
2047
 
2048
  if ( isset( $file_size ) ) {
2049
  echo $file_size;
includes/admin-share-count.php CHANGED
@@ -115,6 +115,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
115
  case self::REF_SHARE_HATEBU:
116
  $sns_name = __( 'Hatebu', self::DOMAIN );
117
  break;
 
 
 
118
  case self::REF_SHARE_TOTAL:
119
  $sns_name = __( 'Total', self::DOMAIN );
120
  break;
115
  case self::REF_SHARE_HATEBU:
116
  $sns_name = __( 'Hatebu', self::DOMAIN );
117
  break;
118
+ case self::REF_SHARE_PINTEREST:
119
+ $sns_name = __( 'Pinterest', self::DOMAIN );
120
+ break;
121
  case self::REF_SHARE_TOTAL:
122
  $sns_name = __( 'Total', self::DOMAIN );
123
  break;
includes/{class-blowfish.php → class-crypt-blowfish.php} RENAMED
@@ -150,7 +150,7 @@ class Crypt_Blowfish {
150
  */
151
  public function encrypt( $plainText ) {
152
  if ( ! is_string( $plainText ) ) {
153
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ') : Plain text must be a string' );
154
  //PEAR::raiseError('Plain text must be a string', 0, PEAR_ERROR_DIE);
155
  die();
156
  }
@@ -177,7 +177,7 @@ class Crypt_Blowfish {
177
  public function decrypt( $cipherText ) {
178
  if ( ! is_string( $cipherText ) ) {
179
  //PEAR::raiseError('Chiper text must be a string', 1, PEAR_ERROR_DIE);
180
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ') : Chiper text must be a string' );
181
  die();
182
  }
183
 
@@ -206,7 +206,7 @@ class Crypt_Blowfish {
206
  */
207
  public function setKey( $key ) {
208
  if ( ! is_string( $key ) ) {
209
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ') : Key must be a string' );
210
  //PEAR::raiseError('Key must be a string', 2, PEAR_ERROR_DIE);
211
  die();
212
  }
@@ -216,7 +216,7 @@ class Crypt_Blowfish {
216
  $len = strlen( $key );
217
 
218
  if ( $len > 56 || $len == 0 ) {
219
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ') : Key must be less than 56 characters and non-zero' );
220
  //PEAR::raiseError('Key must be less than 56 characters and non-zero. Supplied key length: ' . $len, 3, PEAR_ERROR_DIE);
221
  die();
222
  }
150
  */
151
  public function encrypt( $plainText ) {
152
  if ( ! is_string( $plainText ) ) {
153
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ') : Plain text must be a string' );
154
  //PEAR::raiseError('Plain text must be a string', 0, PEAR_ERROR_DIE);
155
  die();
156
  }
177
  public function decrypt( $cipherText ) {
178
  if ( ! is_string( $cipherText ) ) {
179
  //PEAR::raiseError('Chiper text must be a string', 1, PEAR_ERROR_DIE);
180
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ') : Chiper text must be a string' );
181
  die();
182
  }
183
 
206
  */
207
  public function setKey( $key ) {
208
  if ( ! is_string( $key ) ) {
209
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ') : Key must be a string' );
210
  //PEAR::raiseError('Key must be a string', 2, PEAR_ERROR_DIE);
211
  die();
212
  }
216
  $len = strlen( $key );
217
 
218
  if ( $len > 56 || $len == 0 ) {
219
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ') : Key must be less than 56 characters and non-zero' );
220
  //PEAR::raiseError('Key must be less than 56 characters and non-zero. Supplied key length: ' . $len, 3, PEAR_ERROR_DIE);
221
  die();
222
  }
includes/class-default-key.php CHANGED
@@ -1,320 +1,320 @@
1
- <?php
2
- /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
-
4
- /**
5
- * Crypt_Blowfish allows for encryption and decryption on the fly using
6
- * the Blowfish algorithm. Crypt_Blowfish does not require the mcrypt
7
- * PHP extension, it uses only PHP.
8
- * Crypt_Blowfish support encryption/decryption with or without a secret key.
9
- *
10
- *
11
- * PHP versions 4 and 5
12
- *
13
- *
14
- * @category Encryption
15
- * @package Crypt_Blowfish
16
- * @author Matthew Fonda <mfonda@php.net>
17
- * @copyright 2005 Matthew Fonda
18
- * @license http://www.opensource.org/licenses/mit-license.html MIT License
19
- * @version CVS: $Id: DefaultKey.php,v 1.81 2005/05/30 18:40:37 mfonda Exp $
20
- * @link http://pear.php.net/package/Crypt_Blowfish
21
- */
22
-
23
-
24
- /**
25
- * Class containing default key
26
- *
27
- * @category Encryption
28
- * @package Crypt_Blowfish
29
- * @author Matthew Fonda <mfonda@php.net>
30
- * @copyright 2005 Matthew Fonda
31
- * @license http://www.opensource.org/licenses/mit-license.html MIT License
32
- * @link http://pear.php.net/package/Crypt_Blowfish
33
- * @version @package_version@
34
- * @access public
35
- */
36
- class Crypt_Blowfish_DefaultKey {
37
- public $P = array();
38
-
39
- public $S = array();
40
-
41
- public function __construct() {
42
- $this->P = array(
43
- 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
44
- 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
45
- 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,
46
- 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
47
- 0x9216D5D9, 0x8979FB1B
48
- );
49
-
50
- $this->S = array(
51
- array(
52
- 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
53
- 0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99,
54
- 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16,
55
- 0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E,
56
- 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE,
57
- 0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013,
58
- 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF,
59
- 0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E,
60
- 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60,
61
- 0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440,
62
- 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE,
63
- 0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A,
64
- 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E,
65
- 0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677,
66
- 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193,
67
- 0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032,
68
- 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88,
69
- 0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239,
70
- 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E,
71
- 0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0,
72
- 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3,
73
- 0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98,
74
- 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88,
75
- 0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE,
76
- 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6,
77
- 0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D,
78
- 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B,
79
- 0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7,
80
- 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA,
81
- 0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463,
82
- 0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F,
83
- 0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09,
84
- 0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3,
85
- 0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB,
86
- 0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279,
87
- 0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8,
88
- 0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB,
89
- 0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82,
90
- 0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB,
91
- 0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573,
92
- 0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0,
93
- 0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B,
94
- 0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790,
95
- 0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8,
96
- 0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4,
97
- 0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0,
98
- 0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7,
99
- 0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C,
100
- 0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD,
101
- 0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1,
102
- 0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299,
103
- 0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9,
104
- 0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477,
105
- 0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF,
106
- 0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49,
107
- 0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF,
108
- 0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA,
109
- 0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5,
110
- 0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41,
111
- 0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915,
112
- 0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400,
113
- 0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915,
114
- 0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664,
115
- 0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A
116
- ),
117
- array(
118
- 0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623,
119
- 0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266,
120
- 0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1,
121
- 0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E,
122
- 0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6,
123
- 0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1,
124
- 0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E,
125
- 0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1,
126
- 0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737,
127
- 0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8,
128
- 0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF,
129
- 0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD,
130
- 0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701,
131
- 0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7,
132
- 0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41,
133
- 0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331,
134
- 0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF,
135
- 0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF,
136
- 0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E,
137
- 0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87,
138
- 0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C,
139
- 0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2,
140
- 0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16,
141
- 0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD,
142
- 0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B,
143
- 0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509,
144
- 0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E,
145
- 0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3,
146
- 0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F,
147
- 0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A,
148
- 0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4,
149
- 0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960,
150
- 0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66,
151
- 0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28,
152
- 0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802,
153
- 0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84,
154
- 0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510,
155
- 0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF,
156
- 0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14,
157
- 0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E,
158
- 0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50,
159
- 0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7,
160
- 0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8,
161
- 0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281,
162
- 0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99,
163
- 0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696,
164
- 0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128,
165
- 0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73,
166
- 0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0,
167
- 0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0,
168
- 0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105,
169
- 0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250,
170
- 0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3,
171
- 0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285,
172
- 0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00,
173
- 0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061,
174
- 0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB,
175
- 0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E,
176
- 0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735,
177
- 0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC,
178
- 0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9,
179
- 0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340,
180
- 0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20,
181
- 0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7
182
- ),
183
- array(
184
- 0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934,
185
- 0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068,
186
- 0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF,
187
- 0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840,
188
- 0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45,
189
- 0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504,
190
- 0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A,
191
- 0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB,
192
- 0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE,
193
- 0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6,
194
- 0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42,
195
- 0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B,
196
- 0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2,
197
- 0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB,
198
- 0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527,
199
- 0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B,
200
- 0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33,
201
- 0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C,
202
- 0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3,
203
- 0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC,
204
- 0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17,
205
- 0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564,
206
- 0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B,
207
- 0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115,
208
- 0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922,
209
- 0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728,
210
- 0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0,
211
- 0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E,
212
- 0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37,
213
- 0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D,
214
- 0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804,
215
- 0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B,
216
- 0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3,
217
- 0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB,
218
- 0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D,
219
- 0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C,
220
- 0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350,
221
- 0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9,
222
- 0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A,
223
- 0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE,
224
- 0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D,
225
- 0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC,
226
- 0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F,
227
- 0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61,
228
- 0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2,
229
- 0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9,
230
- 0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2,
231
- 0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C,
232
- 0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E,
233
- 0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633,
234
- 0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10,
235
- 0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169,
236
- 0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52,
237
- 0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027,
238
- 0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5,
239
- 0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62,
240
- 0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634,
241
- 0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76,
242
- 0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24,
243
- 0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC,
244
- 0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4,
245
- 0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C,
246
- 0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837,
247
- 0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0
248
- ),
249
- array(
250
- 0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B,
251
- 0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE,
252
- 0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B,
253
- 0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4,
254
- 0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8,
255
- 0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6,
256
- 0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304,
257
- 0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22,
258
- 0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4,
259
- 0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6,
260
- 0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9,
261
- 0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59,
262
- 0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593,
263
- 0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51,
264
- 0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28,
265
- 0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C,
266
- 0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B,
267
- 0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28,
268
- 0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C,
269
- 0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD,
270
- 0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A,
271
- 0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319,
272
- 0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB,
273
- 0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F,
274
- 0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991,
275
- 0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32,
276
- 0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680,
277
- 0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166,
278
- 0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE,
279
- 0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB,
280
- 0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5,
281
- 0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47,
282
- 0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370,
283
- 0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D,
284
- 0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84,
285
- 0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048,
286
- 0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8,
287
- 0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD,
288
- 0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9,
289
- 0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7,
290
- 0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38,
291
- 0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F,
292
- 0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C,
293
- 0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525,
294
- 0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1,
295
- 0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442,
296
- 0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964,
297
- 0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E,
298
- 0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8,
299
- 0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D,
300
- 0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F,
301
- 0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299,
302
- 0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02,
303
- 0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC,
304
- 0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614,
305
- 0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A,
306
- 0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6,
307
- 0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B,
308
- 0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0,
309
- 0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060,
310
- 0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E,
311
- 0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9,
312
- 0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F,
313
- 0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6
314
- )
315
- );
316
- }
317
-
318
- }
319
-
320
- ?>
1
+ <?php
2
+ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
+
4
+ /**
5
+ * Crypt_Blowfish allows for encryption and decryption on the fly using
6
+ * the Blowfish algorithm. Crypt_Blowfish does not require the mcrypt
7
+ * PHP extension, it uses only PHP.
8
+ * Crypt_Blowfish support encryption/decryption with or without a secret key.
9
+ *
10
+ *
11
+ * PHP versions 4 and 5
12
+ *
13
+ *
14
+ * @category Encryption
15
+ * @package Crypt_Blowfish
16
+ * @author Matthew Fonda <mfonda@php.net>
17
+ * @copyright 2005 Matthew Fonda
18
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
19
+ * @version CVS: $Id: DefaultKey.php,v 1.81 2005/05/30 18:40:37 mfonda Exp $
20
+ * @link http://pear.php.net/package/Crypt_Blowfish
21
+ */
22
+
23
+
24
+ /**
25
+ * Class containing default key
26
+ *
27
+ * @category Encryption
28
+ * @package Crypt_Blowfish
29
+ * @author Matthew Fonda <mfonda@php.net>
30
+ * @copyright 2005 Matthew Fonda
31
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
32
+ * @link http://pear.php.net/package/Crypt_Blowfish
33
+ * @version @package_version@
34
+ * @access public
35
+ */
36
+ class Crypt_Blowfish_DefaultKey {
37
+ public $P = array();
38
+
39
+ public $S = array();
40
+
41
+ public function __construct() {
42
+ $this->P = array(
43
+ 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
44
+ 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
45
+ 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,
46
+ 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
47
+ 0x9216D5D9, 0x8979FB1B
48
+ );
49
+
50
+ $this->S = array(
51
+ array(
52
+ 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
53
+ 0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99,
54
+ 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16,
55
+ 0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E,
56
+ 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE,
57
+ 0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013,
58
+ 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF,
59
+ 0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E,
60
+ 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60,
61
+ 0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440,
62
+ 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE,
63
+ 0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A,
64
+ 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E,
65
+ 0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677,
66
+ 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193,
67
+ 0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032,
68
+ 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88,
69
+ 0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239,
70
+ 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E,
71
+ 0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0,
72
+ 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3,
73
+ 0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98,
74
+ 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88,
75
+ 0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE,
76
+ 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6,
77
+ 0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D,
78
+ 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B,
79
+ 0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7,
80
+ 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA,
81
+ 0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463,
82
+ 0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F,
83
+ 0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09,
84
+ 0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3,
85
+ 0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB,
86
+ 0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279,
87
+ 0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8,
88
+ 0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB,
89
+ 0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82,
90
+ 0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB,
91
+ 0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573,
92
+ 0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0,
93
+ 0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B,
94
+ 0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790,
95
+ 0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8,
96
+ 0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4,
97
+ 0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0,
98
+ 0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7,
99
+ 0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C,
100
+ 0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD,
101
+ 0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1,
102
+ 0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299,
103
+ 0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9,
104
+ 0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477,
105
+ 0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF,
106
+ 0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49,
107
+ 0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF,
108
+ 0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA,
109
+ 0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5,
110
+ 0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41,
111
+ 0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915,
112
+ 0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400,
113
+ 0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915,
114
+ 0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664,
115
+ 0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A
116
+ ),
117
+ array(
118
+ 0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623,
119
+ 0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266,
120
+ 0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1,
121
+ 0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E,
122
+ 0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6,
123
+ 0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1,
124
+ 0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E,
125
+ 0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1,
126
+ 0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737,
127
+ 0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8,
128
+ 0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF,
129
+ 0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD,
130
+ 0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701,
131
+ 0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7,
132
+ 0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41,
133
+ 0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331,
134
+ 0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF,
135
+ 0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF,
136
+ 0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E,
137
+ 0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87,
138
+ 0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C,
139
+ 0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2,
140
+ 0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16,
141
+ 0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD,
142
+ 0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B,
143
+ 0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509,
144
+ 0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E,
145
+ 0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3,
146
+ 0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F,
147
+ 0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A,
148
+ 0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4,
149
+ 0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960,
150
+ 0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66,
151
+ 0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28,
152
+ 0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802,
153
+ 0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84,
154
+ 0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510,
155
+ 0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF,
156
+ 0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14,
157
+ 0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E,
158
+ 0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50,
159
+ 0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7,
160
+ 0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8,
161
+ 0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281,
162
+ 0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99,
163
+ 0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696,
164
+ 0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128,
165
+ 0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73,
166
+ 0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0,
167
+ 0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0,
168
+ 0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105,
169
+ 0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250,
170
+ 0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3,
171
+ 0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285,
172
+ 0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00,
173
+ 0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061,
174
+ 0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB,
175
+ 0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E,
176
+ 0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735,
177
+ 0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC,
178
+ 0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9,
179
+ 0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340,
180
+ 0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20,
181
+ 0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7
182
+ ),
183
+ array(
184
+ 0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934,
185
+ 0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068,
186
+ 0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF,
187
+ 0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840,
188
+ 0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45,
189
+ 0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504,
190
+ 0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A,
191
+ 0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB,
192
+ 0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE,
193
+ 0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6,
194
+ 0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42,
195
+ 0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B,
196
+ 0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2,
197
+ 0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB,
198
+ 0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527,
199
+ 0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B,
200
+ 0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33,
201
+ 0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C,
202
+ 0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3,
203
+ 0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC,
204
+ 0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17,
205
+ 0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564,
206
+ 0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B,
207
+ 0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115,
208
+ 0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922,
209
+ 0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728,
210
+ 0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0,
211
+ 0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E,
212
+ 0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37,
213
+ 0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D,
214
+ 0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804,
215
+ 0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B,
216
+ 0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3,
217
+ 0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB,
218
+ 0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D,
219
+ 0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C,
220
+ 0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350,
221
+ 0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9,
222
+ 0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A,
223
+ 0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE,
224
+ 0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D,
225
+ 0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC,
226
+ 0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F,
227
+ 0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61,
228
+ 0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2,
229
+ 0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9,
230
+ 0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2,
231
+ 0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C,
232
+ 0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E,
233
+ 0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633,
234
+ 0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10,
235
+ 0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169,
236
+ 0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52,
237
+ 0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027,
238
+ 0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5,
239
+ 0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62,
240
+ 0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634,
241
+ 0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76,
242
+ 0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24,
243
+ 0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC,
244
+ 0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4,
245
+ 0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C,
246
+ 0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837,
247
+ 0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0
248
+ ),
249
+ array(
250
+ 0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B,
251
+ 0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE,
252
+ 0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B,
253
+ 0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4,
254
+ 0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8,
255
+ 0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6,
256
+ 0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304,
257
+ 0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22,
258
+ 0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4,
259
+ 0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6,
260
+ 0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9,
261
+ 0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59,
262
+ 0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593,
263
+ 0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51,
264
+ 0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28,
265
+ 0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C,
266
+ 0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B,
267
+ 0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28,
268
+ 0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C,
269
+ 0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD,
270
+ 0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A,
271
+ 0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319,
272
+ 0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB,
273
+ 0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F,
274
+ 0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991,
275
+ 0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32,
276
+ 0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680,
277
+ 0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166,
278
+ 0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE,
279
+ 0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB,
280
+ 0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5,
281
+ 0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47,
282
+ 0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370,
283
+ 0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D,
284
+ 0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84,
285
+ 0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048,
286
+ 0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8,
287
+ 0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD,
288
+ 0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9,
289
+ 0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7,
290
+ 0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38,
291
+ 0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F,
292
+ 0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C,
293
+ 0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525,
294
+ 0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1,
295
+ 0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442,
296
+ 0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964,
297
+ 0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E,
298
+ 0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8,
299
+ 0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D,
300
+ 0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F,
301
+ 0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299,
302
+ 0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02,
303
+ 0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC,
304
+ 0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614,
305
+ 0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A,
306
+ 0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6,
307
+ 0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B,
308
+ 0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0,
309
+ 0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060,
310
+ 0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E,
311
+ 0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9,
312
+ 0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F,
313
+ 0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6
314
+ )
315
+ );
316
+ }
317
+
318
+ }
319
+
320
+ ?>
includes/class-mcrypt.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
- class Mcrypt {
3
-
4
- private $td;
5
- private $iv_size;
6
- private $algorithm;
7
- private $mode;
8
- private $init = false;
9
-
10
- function __construct( $algorithm = 'blowfish', $mode = 'ecb' ) {
11
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
12
- $this->algorithm = $algorithm;
13
- $this->mode = $mode;
14
- $this->td = mcrypt_module_open( $this->algorithm, '', $this->mode, '' );
15
- $this->iv_size = mcrypt_enc_get_iv_size( $this->td );
16
- }
17
-
18
- function __destruct(){
19
- if ( $this->init ) mcrypt_generic_deinit( $this->td );
20
- mcrypt_module_close( $this->td );
21
- }
22
-
23
- private function init( $pass, $iv = null ) {
24
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
25
- if ( is_null( $iv ) ) {
26
- $iv = mcrypt_create_iv( $this->iv_size, MCRYPT_DEV_RANDOM );
27
- } else {
28
- $iv = base64_decode( $iv );
29
- }
30
-
31
- if ( $this->iv_size !== strlen( $iv ) ) {
32
- throw new Exception( 'Incorrect IV size.' );
33
- }
34
-
35
- $key = substr( md5( $pass ), 0, mcrypt_enc_get_key_size( $this->td ) );
36
- mcrypt_generic_init( $this->td, $key, $iv );
37
- $this->init = true;
38
- }
39
-
40
- public function encrypt( $str, $pass, $iv = null ) {
41
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
42
- $iv = $this->init( $pass, $iv );
43
- Common_Util::log( '[' . __METHOD__ . '] iv' );
44
- $encrypted = mcrypt_generic( $this->td, $str );
45
- return base64_encode( $encrypted );
46
- }
47
-
48
- public function decrypt( $str, $pass, $iv = null ) {
49
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
50
- $iv = $this->init( $pass, $iv );
51
- Common_Util::log( '[' . __METHOD__ . '] iv' );
52
- $str = base64_decode( $str );
53
- $decrypted = mdecrypt_generic( $this->td, $str );
54
- Common_Util::log( '[' . __METHOD__ . '] decrypted: ' . $decrypted );
55
- return $decrypted;
56
- }
57
-
58
- public function create_iv() {
59
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
60
- $iv = mcrypt_create_iv( $this->iv_size, MCRYPT_DEV_RANDOM );
61
- return base64_encode( $iv );
62
- }
63
- }
64
-
65
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/{class-analytical-engline.php → class-scc-analytical-engline.php} RENAMED
@@ -1,102 +1,102 @@
1
- <?php
2
- /*
3
- class-analytical-engline.php
4
-
5
- Description: This class is a data analytical engine.
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- abstract class Analytical_Engine extends Engine {
31
-
32
- /**
33
- * Prefix of cache ID
34
- */
35
- protected $cache_prefix = NULL;
36
-
37
- /**
38
- * Prefix of base ID
39
- */
40
- protected $base_prefix = NULL;
41
-
42
- /**
43
- * Prefix of base ID
44
- */
45
- protected $delta_prefix = NULL;
46
-
47
- /**
48
- * instance for delegation
49
- */
50
- protected $delegate = NULL;
51
-
52
- /**
53
- * Get and cache data for a given post
54
- *
55
- * @since 0.1.1
56
- */
57
- abstract public function analyze( $options = array() );
58
-
59
- /**
60
- * Initialize cache
61
- *
62
- * @since 0.3.0
63
- */
64
- abstract public function initialize_base();
65
-
66
- /**
67
- * Clear cache
68
- *
69
- * @since 0.3.0
70
- */
71
- abstract public function clear_base();
72
-
73
- /**
74
- * Get cache key
75
- *
76
- * @since 0.6.0
77
- */
78
- public function get_cache_key( $suffix ) {
79
- return $this->cache_prefix . strtolower( $suffix );
80
- }
81
-
82
- /**
83
- * Get base key
84
- *
85
- * @since 0.6.1
86
- */
87
- public function get_base_key( $suffix ) {
88
- return $this->base_prefix . strtolower( $suffix );
89
- }
90
-
91
- /**
92
- * Get delta key
93
- *
94
- * @since 0.6.1
95
- */
96
- public function get_delta_key( $suffix ) {
97
- return $this->delta_prefix . strtolower( $suffix );
98
- }
99
-
100
- }
101
-
102
- ?>
1
+ <?php
2
+ /*
3
+ class-scc-analytical-engline.php
4
+
5
+ Description: This class is a data analytical engine.
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ abstract class SCC_Analytical_Engine extends SCC_Engine {
31
+
32
+ /**
33
+ * Prefix of cache ID
34
+ */
35
+ protected $cache_prefix = NULL;
36
+
37
+ /**
38
+ * Prefix of base ID
39
+ */
40
+ protected $base_prefix = NULL;
41
+
42
+ /**
43
+ * Prefix of base ID
44
+ */
45
+ protected $delta_prefix = NULL;
46
+
47
+ /**
48
+ * instance for delegation
49
+ */
50
+ protected $delegate = NULL;
51
+
52
+ /**
53
+ * Get and cache data for a given post
54
+ *
55
+ * @since 0.1.1
56
+ */
57
+ abstract public function analyze( $options = array() );
58
+
59
+ /**
60
+ * Initialize cache
61
+ *
62
+ * @since 0.3.0
63
+ */
64
+ abstract public function initialize_base();
65
+
66
+ /**
67
+ * Clear cache
68
+ *
69
+ * @since 0.3.0
70
+ */
71
+ abstract public function clear_base();
72
+
73
+ /**
74
+ * Get cache key
75
+ *
76
+ * @since 0.6.0
77
+ */
78
+ public function get_cache_key( $suffix ) {
79
+ return $this->cache_prefix . strtolower( $suffix );
80
+ }
81
+
82
+ /**
83
+ * Get base key
84
+ *
85
+ * @since 0.6.1
86
+ */
87
+ public function get_base_key( $suffix ) {
88
+ return $this->base_prefix . strtolower( $suffix );
89
+ }
90
+
91
+ /**
92
+ * Get delta key
93
+ *
94
+ * @since 0.6.1
95
+ */
96
+ public function get_delta_key( $suffix ) {
97
+ return $this->delta_prefix . strtolower( $suffix );
98
+ }
99
+
100
+ }
101
+
102
+ ?>
includes/{class-cache-engine.php → class-scc-cache-engine.php} RENAMED
@@ -1,113 +1,107 @@
1
- <?php
2
- /*
3
- class-cache-engine.php
4
-
5
- Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- abstract class Cache_Engine extends Engine {
31
-
32
- /**
33
- * Prefix of cache ID
34
- */
35
- protected $cache_prefix = NULL;
36
-
37
- /**
38
- * instance for delegation
39
- */
40
- protected $delegate = NULL;
41
-
42
- /**
43
- * retry of cache processing
44
- */
45
- protected $cache_retry = false;
46
-
47
- /**
48
- * limit of cache retry
49
- */
50
- protected $retry_limit = 3;
51
-
52
- /**
53
- * Get cache expiration based on current number of total post and page
54
- *
55
- * @since 0.1.1
56
- */
57
- abstract protected function get_cache_expiration();
58
-
59
- /**
60
- * Get and cache data for a given post
61
- *
62
- * @since 0.1.1
63
- */
64
- abstract public function cache( $options = array() );
65
-
66
- /**
67
- * Initialize cache
68
- *
69
- * @since 0.3.0
70
- */
71
- abstract public function initialize_cache();
72
-
73
- /**
74
- * Clear cache
75
- *
76
- * @since 0.3.0
77
- */
78
- abstract public function clear_cache();
79
-
80
- /**
81
- * Get cache key
82
- *
83
- * @since 0.6.0
84
- */
85
- public function get_cache_key( $suffix ) {
86
- return $this->cache_prefix . strtolower( $suffix );
87
- }
88
-
89
- /**
90
- * Order cache
91
- *
92
- * @since 0.5.1
93
- */
94
- protected function delegate_cache( $options = array() ) {
95
- if ( ! is_null( $this->delegate ) && method_exists( $this->delegate, 'order_cache' ) ) {
96
- $this->delegate->order_cache( $this, $options );
97
- }
98
- }
99
-
100
- /**
101
- * Order analysis
102
- *
103
- * @since 0.6.1
104
- */
105
- protected function delegate_analysis( $options = array() ) {
106
- if ( ! is_null( $this->delegate ) && method_exists( $this->delegate, 'order_analysis' ) ) {
107
- $this->delegate->order_analysis( $this, $options );
108
- }
109
- }
110
-
111
- }
112
-
113
- ?>
1
+ <?php
2
+ /*
3
+ class-scc-cache-engine.php
4
+
5
+ Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ abstract class SCC_Cache_Engine extends SCC_Engine {
31
+
32
+ /**
33
+ * Prefix of cache ID
34
+ */
35
+ protected $cache_prefix = NULL;
36
+
37
+ /**
38
+ * instance for delegation
39
+ */
40
+ protected $delegate = NULL;
41
+
42
+ /**
43
+ * retry of cache processing
44
+ */
45
+ protected $cache_retry = false;
46
+
47
+ /**
48
+ * limit of cache retry
49
+ */
50
+ protected $retry_limit = 3;
51
+
52
+ /**
53
+ * fault tolerance mode
54
+ */
55
+ protected $fault_tolerance = 1;
56
+
57
+ /**
58
+ * Get cache expiration based on current number of total post and page
59
+ *
60
+ * @since 0.1.1
61
+ */
62
+ abstract protected function get_cache_expiration();
63
+
64
+ /**
65
+ * Get and cache data for a given post
66
+ *
67
+ * @since 0.1.1
68
+ */
69
+ abstract public function cache( $options = array() );
70
+
71
+ /**
72
+ * Initialize cache
73
+ *
74
+ * @since 0.3.0
75
+ */
76
+ abstract public function initialize_cache();
77
+
78
+ /**
79
+ * Clear cache
80
+ *
81
+ * @since 0.3.0
82
+ */
83
+ abstract public function clear_cache();
84
+
85
+ /**
86
+ * Get cache key
87
+ *
88
+ * @since 0.6.0
89
+ */
90
+ public function get_cache_key( $suffix ) {
91
+ return $this->cache_prefix . strtolower( $suffix );
92
+ }
93
+
94
+ /**
95
+ * Order
96
+ *
97
+ * @since 0.6.1
98
+ */
99
+ protected function delegate_order( $order, $options = array() ) {
100
+ if ( ! is_null( $this->delegate ) && method_exists( $this->delegate, 'order' ) ) {
101
+ $this->delegate->order( $this, $order, $options );
102
+ }
103
+ }
104
+
105
+ }
106
+
107
+ ?>
 
 
 
 
 
 
includes/{class-common-data-export-engine.php → class-scc-common-data-export-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-common-data-export.php
4
 
5
  Description: This class is a data export engine whitch exports cached data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Common_Data_Export_Engine extends Export_Engine {
31
 
32
  /**
33
  * Meta key for share second cache
@@ -105,7 +105,7 @@ class Common_Data_Export_Engine extends Export_Engine {
105
  * @since 0.1.1
106
  */
107
  public function initialize( $options = array() ) {
108
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
109
 
110
  $this->share_cache_key_prefix = self::DEF_SHARE_META_KEY_PREFIX;
111
  $this->follow_cache_key_prefix = self::DEF_FOLLOW_META_KEY_PREFIX;
@@ -140,7 +140,7 @@ class Common_Data_Export_Engine extends Export_Engine {
140
  * @since 0.1.0
141
  */
142
  public function schedule_export_interval( $schedules ) {
143
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
144
 
145
  $schedules[$this->event_schedule] = array(
146
  'interval' => $this->export_interval,
@@ -156,24 +156,24 @@ class Common_Data_Export_Engine extends Export_Engine {
156
  * @since 0.4.0
157
  */
158
  public function prime_export() {
159
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
160
 
161
  //$next_exec_time = time() + $this->export_interval;
162
 
163
  //$next_exec_time = time() + 5;
164
 
165
- $next_exec_time = WP_Cron_Util::next_exec_time( $this->export_schedule );
166
 
167
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->export_interval );
168
 
169
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time (timesatamp): ' . $next_exec_time );
170
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time (date): ' . date_i18n( 'Y/m/d H:i:s', $next_exec_time ) );
171
 
172
- if ( ! WP_Cron_Util::is_scheduled_hook( $this->execute_cron ) ) {
173
- wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( Common_Util::short_hash( $next_exec_time ) ) );
174
  }
175
 
176
- //wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( Common_Util::short_hash( $next_exec_time ) ) );
177
  }
178
 
179
 
@@ -183,7 +183,7 @@ class Common_Data_Export_Engine extends Export_Engine {
183
  * @since 0.4.0
184
  */
185
  public function execute_export( $hash ) {
186
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
187
 
188
  $base_dir = WP_PLUGIN_DIR . '/sns-count-cache/data/';
189
 
@@ -194,31 +194,31 @@ class Common_Data_Export_Engine extends Export_Engine {
194
 
195
  if ( ! file_exists( $abs_path ) ) {
196
  if ( touch( $abs_path ) ) {
197
- Common_Util::log( '[' . __METHOD__ . '] export file creation succeeded: ' . $abs_path );
198
  } else {
199
- Common_Util::log( '[' . __METHOD__ . '] export file creation failed: ' . $abs_path );
200
  }
201
  if ( file_exists( $abs_path ) ) {
202
- Common_Util::log( '[' . __METHOD__ . '] file exists: ' . $abs_path );
203
  $fp = fopen( $abs_path, 'a' );
204
 
205
  $header = '"Retrieval Date","Post ID","Post Type","Post Title","Permalink","Post Date","SNS","Data Type","Data Value",' . "\r\n";
206
 
207
  if ( fwrite( $fp, mb_convert_encoding( $header, "SJIS", "UTF-8" ) ) ) {
208
- Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' . $header );
209
  } else {
210
- Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' . $header );
211
  }
212
  if ( fclose( $fp ) ) {
213
- Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $abs_path );
214
  } else {
215
- Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $abs_path );
216
  }
217
  }
218
  }
219
 
220
  if ( file_exists( $abs_path ) ) {
221
- Common_Util::log( '[' . __METHOD__ . '] file exists: ' . $abs_path );
222
 
223
  $fp = fopen( $abs_path, 'a' );
224
 
@@ -239,9 +239,9 @@ class Common_Data_Export_Engine extends Export_Engine {
239
  $data = $content . '","' . $sns . '","' . 'Share' . '","' . $data_value . '",' . "\r\n";
240
  }
241
  if ( fwrite( $fp, mb_convert_encoding( $data, "SJIS", "UTF-8" ) ) ) {
242
- Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' . $data );
243
  } else {
244
- Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' . $data );
245
  }
246
  }
247
  }
@@ -279,9 +279,9 @@ class Common_Data_Export_Engine extends Export_Engine {
279
  $data = $content . '","' . $sns . '","' . 'Share' . '","' . $data_value . '",' . "\r\n";
280
  }
281
  if ( fwrite( $fp, mb_convert_encoding( $data, "SJIS", "UTF-8" ) ) ) {
282
- Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' . $data );
283
  } else {
284
- Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' . $data );
285
  }
286
  }
287
  }
@@ -299,9 +299,9 @@ class Common_Data_Export_Engine extends Export_Engine {
299
  $data = $content . '","' . $key . '","' . 'Follow' . '","' . $data_value . '",' . "\r\n";
300
  }
301
  if ( fwrite( $fp, mb_convert_encoding( $data, "SJIS", "UTF-8" ) ) ) {
302
- Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' . $data );
303
  } else {
304
- Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' . $data );
305
  }
306
  }
307
  */
@@ -311,9 +311,9 @@ class Common_Data_Export_Engine extends Export_Engine {
311
  wp_reset_postdata();
312
 
313
  if ( fclose($fp) ) {
314
- Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $abs_path );
315
  } else {
316
- Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $abs_path );
317
  }
318
  }
319
  }
@@ -325,7 +325,7 @@ class Common_Data_Export_Engine extends Export_Engine {
325
  * @since 0.4.0
326
  */
327
  public function reset_export() {
328
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
329
 
330
  $base_dir = WP_PLUGIN_DIR . '/sns-count-cache/data/';
331
  $abs_path = $base_dir . $this->export_file_name;
1
  <?php
2
  /*
3
+ class-scc-common-data-export.php
4
 
5
  Description: This class is a data export engine whitch exports cached data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Common_Data_Export_Engine extends SCC_Export_Engine {
31
 
32
  /**
33
  * Meta key for share second cache
105
  * @since 0.1.1
106
  */
107
  public function initialize( $options = array() ) {
108
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
109
 
110
  $this->share_cache_key_prefix = self::DEF_SHARE_META_KEY_PREFIX;
111
  $this->follow_cache_key_prefix = self::DEF_FOLLOW_META_KEY_PREFIX;
140
  * @since 0.1.0
141
  */
142
  public function schedule_export_interval( $schedules ) {
143
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
144
 
145
  $schedules[$this->event_schedule] = array(
146
  'interval' => $this->export_interval,
156
  * @since 0.4.0
157
  */
158
  public function prime_export() {
159
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
160
 
161
  //$next_exec_time = time() + $this->export_interval;
162
 
163
  //$next_exec_time = time() + 5;
164
 
165
+ $next_exec_time = SCC_WP_Cron_Util::next_exec_time( $this->export_schedule );
166
 
167
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->export_interval );
168
 
169
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time (timesatamp): ' . $next_exec_time );
170
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time (date): ' . date_i18n( 'Y/m/d H:i:s', $next_exec_time ) );
171
 
172
+ if ( ! SCC_WP_Cron_Util::is_scheduled_hook( $this->execute_cron ) ) {
173
+ wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( SCC_Common_Util::short_hash( $next_exec_time ) ) );
174
  }
175
 
176
+ //wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( SCC_Common_Util::short_hash( $next_exec_time ) ) );
177
  }
178
 
179
 
183
  * @since 0.4.0
184
  */
185
  public function execute_export( $hash ) {
186
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
187
 
188
  $base_dir = WP_PLUGIN_DIR . '/sns-count-cache/data/';
189
 
194
 
195
  if ( ! file_exists( $abs_path ) ) {
196
  if ( touch( $abs_path ) ) {
197
+ SCC_Common_Util::log( '[' . __METHOD__ . '] export file creation succeeded: ' . $abs_path );
198
  } else {
199
+ SCC_Common_Util::log( '[' . __METHOD__ . '] export file creation failed: ' . $abs_path );
200
  }
201
  if ( file_exists( $abs_path ) ) {
202
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file exists: ' . $abs_path );
203
  $fp = fopen( $abs_path, 'a' );
204
 
205
  $header = '"Retrieval Date","Post ID","Post Type","Post Title","Permalink","Post Date","SNS","Data Type","Data Value",' . "\r\n";
206
 
207
  if ( fwrite( $fp, mb_convert_encoding( $header, "SJIS", "UTF-8" ) ) ) {
208
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' . $header );
209
  } else {
210
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' . $header );
211
  }
212
  if ( fclose( $fp ) ) {
213
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $abs_path );
214
  } else {
215
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $abs_path );
216
  }
217
  }
218
  }
219
 
220
  if ( file_exists( $abs_path ) ) {
221
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file exists: ' . $abs_path );
222
 
223
  $fp = fopen( $abs_path, 'a' );
224
 
239
  $data = $content . '","' . $sns . '","' . 'Share' . '","' . $data_value . '",' . "\r\n";
240
  }
241
  if ( fwrite( $fp, mb_convert_encoding( $data, "SJIS", "UTF-8" ) ) ) {
242
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' . $data );
243
  } else {
244
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' . $data );
245
  }
246
  }
247
  }
279
  $data = $content . '","' . $sns . '","' . 'Share' . '","' . $data_value . '",' . "\r\n";
280
  }
281
  if ( fwrite( $fp, mb_convert_encoding( $data, "SJIS", "UTF-8" ) ) ) {
282
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' . $data );
283
  } else {
284
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' . $data );
285
  }
286
  }
287
  }
299
  $data = $content . '","' . $key . '","' . 'Follow' . '","' . $data_value . '",' . "\r\n";
300
  }
301
  if ( fwrite( $fp, mb_convert_encoding( $data, "SJIS", "UTF-8" ) ) ) {
302
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' . $data );
303
  } else {
304
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' . $data );
305
  }
306
  }
307
  */
311
  wp_reset_postdata();
312
 
313
  if ( fclose($fp) ) {
314
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $abs_path );
315
  } else {
316
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $abs_path );
317
  }
318
  }
319
  }
325
  * @since 0.4.0
326
  */
327
  public function reset_export() {
328
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
329
 
330
  $base_dir = WP_PLUGIN_DIR . '/sns-count-cache/data/';
331
  $abs_path = $base_dir . $this->export_file_name;
includes/{class-common-job-reset-engine.php → class-scc-common-job-reset-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-common-job-reset-engine.php
4
 
5
  Description: This class is a job reset engine whitch reset expired jobs
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Common_Job_Reset_Engine extends Engine {
31
 
32
  /**
33
  * Cron name to schedule reset processing
@@ -75,7 +75,7 @@ class Common_Job_Reset_Engine extends Engine {
75
  * @since 0.1.1
76
  */
77
  public function initialize( $options = array() ) {
78
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
79
 
80
  $this->prime_cron = self::DEF_PRIME_CRON;
81
  $this->execute_cron = self::DEF_EXECUTE_CRON;
@@ -102,7 +102,7 @@ class Common_Job_Reset_Engine extends Engine {
102
  * @since 0.1.0
103
  */
104
  public function schedule_check_interval( $schedules ) {
105
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
106
 
107
  $schedules[$this->event_schedule] = array(
108
  'interval' => $this->check_interval,
@@ -118,12 +118,12 @@ class Common_Job_Reset_Engine extends Engine {
118
  * @since 0.2.0
119
  */
120
  public function prime_reset() {
121
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
122
 
123
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
124
 
125
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
126
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
127
 
128
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array() );
129
  }
@@ -134,11 +134,11 @@ class Common_Job_Reset_Engine extends Engine {
134
  * @since 0.2.0
135
  */
136
  public function execute_reset() {
137
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
138
 
139
  foreach ( $this->target_cron as $key => $hook ) {
140
- Common_Util::log( '[' . __METHOD__ . '] hook: ' . $hook );
141
- WP_Cron_Util::clear_expired_scheduled_hook( $hook, $this->expiration_time );
142
  }
143
  }
144
 
1
  <?php
2
  /*
3
+ class-scc-common-job-reset-engine.php
4
 
5
  Description: This class is a job reset engine whitch reset expired jobs
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Common_Job_Reset_Engine extends SCC_Engine {
31
 
32
  /**
33
  * Cron name to schedule reset processing
75
  * @since 0.1.1
76
  */
77
  public function initialize( $options = array() ) {
78
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
79
 
80
  $this->prime_cron = self::DEF_PRIME_CRON;
81
  $this->execute_cron = self::DEF_EXECUTE_CRON;
102
  * @since 0.1.0
103
  */
104
  public function schedule_check_interval( $schedules ) {
105
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
106
 
107
  $schedules[$this->event_schedule] = array(
108
  'interval' => $this->check_interval,
118
  * @since 0.2.0
119
  */
120
  public function prime_reset() {
121
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
122
 
123
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
124
 
125
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
126
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
127
 
128
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array() );
129
  }
134
  * @since 0.2.0
135
  */
136
  public function execute_reset() {
137
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
138
 
139
  foreach ( $this->target_cron as $key => $hook ) {
140
+ SCC_Common_Util::log( '[' . __METHOD__ . '] hook: ' . $hook );
141
+ SCC_WP_Cron_Util::clear_expired_scheduled_hook( $hook, $this->expiration_time );
142
  }
143
  }
144
 
includes/{class-common-util.php → class-scc-common-util.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-common-util.php
4
 
5
  Description: This class is a common utility
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Common_Util {
31
 
32
  /**
33
  * Class constarctor
@@ -35,7 +35,7 @@ class Common_Util {
35
  *
36
  */
37
  protected function __construct() {
38
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
39
  }
40
 
41
  /**
@@ -190,7 +190,7 @@ class Common_Util {
190
  }
191
 
192
  if ( $curl ) {
193
- Common_Util::log( '[' . __METHOD__ . '] cURL: On' );
194
 
195
  $mh = curl_multi_init();
196
  $ch = array();
@@ -257,7 +257,7 @@ class Common_Util {
257
  return $responses;
258
  } else {
259
 
260
- Common_Util::log( '[' . __METHOD__ . '] cURL: Off' );
261
 
262
  foreach ( $urls as $sns => $url ) {
263
 
@@ -338,9 +338,6 @@ class Common_Util {
338
  mcrypt_module_close( $td );
339
 
340
  return $encrypted_data;
341
-
342
- $crypt = new Mcrypt();
343
- return $crypt->encrypt( $input, $key );
344
  } else {
345
  self::log( 'mcrypt not loaded' );
346
  $crypt = new Crypt_Blowfish( $key );
@@ -427,7 +424,7 @@ class Common_Util {
427
 
428
  $response = wp_remote_post( $url, $options );
429
 
430
- self::log( $response );
431
 
432
  if ( ! is_wp_error( $response ) ) {
433
  if ( $response['response']['code'] === 200 ) {
@@ -483,7 +480,7 @@ class Common_Util {
483
 
484
  $response = wp_remote_post( $url, $options );
485
 
486
- self::log( $response );
487
 
488
  if ( ! is_wp_error( $response ) ) {
489
  if ( $response['response']['code'] === 200 ) {
@@ -510,7 +507,7 @@ class Common_Util {
510
  $extended_access_token = '';
511
  $access_token = '';
512
 
513
- $url = 'https://graph.facebook.com/v2.3/oauth/access_token';
514
 
515
  $options = array(
516
  'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
@@ -537,7 +534,7 @@ class Common_Util {
537
 
538
  $response = wp_remote_get( $request_url, $options );
539
 
540
- self::log( $response );
541
 
542
  if ( ! is_wp_error( $response ) ) {
543
  if ( $response['response']['code'] === 200 ) {
@@ -563,7 +560,7 @@ class Common_Util {
563
 
564
  $response = wp_remote_get( $request_url, $options );
565
 
566
- self::log( $response );
567
 
568
  $data = array();
569
 
@@ -588,7 +585,7 @@ class Common_Util {
588
 
589
  $response = wp_remote_get( $request_url, $options );
590
 
591
- self::log( $response );
592
 
593
  if ( ! is_wp_error( $response ) ) {
594
  if ( $response['response']['code'] === 200 ) {
1
  <?php
2
  /*
3
+ class-scc-common-util.php
4
 
5
  Description: This class is a common utility
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Common_Util {
31
 
32
  /**
33
  * Class constarctor
35
  *
36
  */
37
  protected function __construct() {
38
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
39
  }
40
 
41
  /**
190
  }
191
 
192
  if ( $curl ) {
193
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cURL: On' );
194
 
195
  $mh = curl_multi_init();
196
  $ch = array();
257
  return $responses;
258
  } else {
259
 
260
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cURL: Off' );
261
 
262
  foreach ( $urls as $sns => $url ) {
263
 
338
  mcrypt_module_close( $td );
339
 
340
  return $encrypted_data;
 
 
 
341
  } else {
342
  self::log( 'mcrypt not loaded' );
343
  $crypt = new Crypt_Blowfish( $key );
424
 
425
  $response = wp_remote_post( $url, $options );
426
 
427
+ //self::log( $response );
428
 
429
  if ( ! is_wp_error( $response ) ) {
430
  if ( $response['response']['code'] === 200 ) {
480
 
481
  $response = wp_remote_post( $url, $options );
482
 
483
+ //self::log( $response );
484
 
485
  if ( ! is_wp_error( $response ) ) {
486
  if ( $response['response']['code'] === 200 ) {
507
  $extended_access_token = '';
508
  $access_token = '';
509
 
510
+ $url = 'https://graph.facebook.com/oauth/access_token';
511
 
512
  $options = array(
513
  'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
534
 
535
  $response = wp_remote_get( $request_url, $options );
536
 
537
+ //self::log( $response );
538
 
539
  if ( ! is_wp_error( $response ) ) {
540
  if ( $response['response']['code'] === 200 ) {
560
 
561
  $response = wp_remote_get( $request_url, $options );
562
 
563
+ //self::log( $response );
564
 
565
  $data = array();
566
 
585
 
586
  $response = wp_remote_get( $request_url, $options );
587
 
588
+ //self::log( $response );
589
 
590
  if ( ! is_wp_error( $response ) ) {
591
  if ( $response['response']['code'] === 200 ) {
includes/{class-crawl-strategy.php → class-scc-crawl-strategy.php} RENAMED
@@ -1,229 +1,229 @@
1
- <?php
2
- /*
3
- class-crawl-strategy.php
4
-
5
- Description: This class is abstract class of a data crawler
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- abstract class Crawl_Strategy {
31
-
32
- /**
33
- * TODO Auto-generated comment.
34
- */
35
- protected $url;
36
-
37
- /**
38
- * TODO Auto-generated comment.
39
- */
40
- protected $method;
41
-
42
- /**
43
- * TODO Auto-generated comment.
44
- */
45
- protected $query_parameters = array();
46
-
47
- /**
48
- * TODO Auto-generated comment.
49
- */
50
- protected $parameters = array();
51
-
52
- /**
53
- * Instance
54
- */
55
- private static $instance = array();
56
-
57
- /**
58
- * Class constarctor
59
- * Hook onto all of the actions and filters needed by the plugin.
60
- *
61
- */
62
- protected function __construct() {
63
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
64
- //$this->get_object_id();
65
- }
66
-
67
- /**
68
- * Get instance
69
- *
70
- * @since 0.1.1
71
- */
72
- public static function get_instance() {
73
- $class_name = get_called_class();
74
-
75
- if ( ! isset( self::$instance[$class_name] ) ) {
76
- self::$instance[$class_name] = new $class_name();
77
- }
78
-
79
- return self::$instance[$class_name];
80
- }
81
-
82
- /**
83
- * Return object ID
84
- *
85
- * @since 0.6.0
86
- */
87
- public function get_object_id() {
88
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
89
-
90
- $object_id = spl_object_hash( $this );
91
-
92
- Common_Util::log( '[' . __METHOD__ . '] object ID: ' . $object_id );
93
-
94
- return $object_id;
95
- }
96
-
97
- /**
98
- * Inhibit clone
99
- *
100
- * @since 0.6.0
101
- */
102
- final public function __clone() {
103
- throw new Exception('Clone is not allowed against' . get_class( $this ) );
104
- }
105
-
106
- /**
107
- * Initialization
108
- *
109
- * @since 0.6.0
110
- */
111
- abstract public function initialize( $options = array() );
112
-
113
- /**
114
- * TODO Auto-generated comment.
115
- */
116
- public function get_url() {
117
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
118
- return $url;
119
- }
120
-
121
- /**
122
- * TODO Auto-generated comment.
123
- */
124
- public function set_url( $url) {
125
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
126
- $this->url = $url;
127
- }
128
-
129
- /**
130
- * TODO Auto-generated comment.
131
- */
132
- public function get_parameters() {
133
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
134
- return $this->parameters;
135
- }
136
-
137
- public function get_parameter( $key ) {
138
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
139
- return $this->parameters[$key];
140
- }
141
-
142
- /**
143
- * TODO Auto-generated comment.
144
- */
145
- public function set_parameters( $parameters = array() ) {
146
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
147
- //$this->parameters = array_merge( $this->parameters, $parameters );
148
- foreach ( $parameters as $key => $value ) {
149
- $this->set_parameter( $key, $value );
150
- }
151
- }
152
-
153
- /**
154
- * TODO Auto-generated comment.
155
- */
156
- public function set_parameter( $key, $value ) {
157
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
158
- $this->parameters[$key] = $value;
159
- }
160
-
161
- /**
162
- * TODO Auto-generated comment.
163
- */
164
- public function get_query_parameters() {
165
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
166
- return $this->query_parameters;
167
- }
168
-
169
- public function get_query_parameter( $key ) {
170
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
171
- return $this->query_parameters[$key];
172
- }
173
-
174
- /**
175
- * TODO Auto-generated comment.
176
- */
177
- public function set_query_parameters( $query_parameters = array() ) {
178
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
179
- //$this->query_parameters = array_merge( $this->query_parameters, $query_parameters );
180
- foreach( $query_parameters as $key => $value ) {
181
- $this->set_query_parameter( $key, $value );
182
- }
183
- }
184
-
185
- /**
186
- * TODO Auto-generated comment.
187
- */
188
- public function set_query_parameter( $key, $value ) {
189
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
190
- $this->query_parameters[$key] = $value;
191
- }
192
-
193
- /**
194
- * TODO Auto-generated comment.
195
- */
196
- public function get_method() {
197
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
198
- return $method;
199
- }
200
-
201
- /**
202
- * TODO Auto-generated comment.
203
- */
204
- public function set_method( $method) {
205
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
206
- $this->method = $method;
207
- }
208
-
209
- /**
210
- * TODO Auto-generated comment.
211
- */
212
- abstract public function build_query_url();
213
-
214
- /**
215
- * TODO Auto-generated comment.
216
- */
217
- abstract public function extract_count( $content );
218
-
219
- /**
220
- * TODO Auto-generated comment.
221
- */
222
- abstract public function build_header();
223
-
224
- /**
225
- * TODO Auto-generated comment.
226
- */
227
- abstract public function check_configuration();
228
-
229
- }
1
+ <?php
2
+ /*
3
+ class-scc-crawl-strategy.php
4
+
5
+ Description: This class is abstract class of a data crawler
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ abstract class SCC_Crawl_Strategy {
31
+
32
+ /**
33
+ * TODO Auto-generated comment.
34
+ */
35
+ protected $url;
36
+
37
+ /**
38
+ * TODO Auto-generated comment.
39
+ */
40
+ protected $method;
41
+
42
+ /**
43
+ * TODO Auto-generated comment.
44
+ */
45
+ protected $query_parameters = array();
46
+
47
+ /**
48
+ * TODO Auto-generated comment.
49
+ */
50
+ protected $parameters = array();
51
+
52
+ /**
53
+ * Instance
54
+ */
55
+ private static $instance = array();
56
+
57
+ /**
58
+ * Class constarctor
59
+ * Hook onto all of the actions and filters needed by the plugin.
60
+ *
61
+ */
62
+ protected function __construct() {
63
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
64
+ //$this->get_object_id();
65
+ }
66
+
67
+ /**
68
+ * Get instance
69
+ *
70
+ * @since 0.1.1
71
+ */
72
+ public static function get_instance() {
73
+ $class_name = get_called_class();
74
+
75
+ if ( ! isset( self::$instance[$class_name] ) ) {
76
+ self::$instance[$class_name] = new $class_name();
77
+ }
78
+
79
+ return self::$instance[$class_name];
80
+ }
81
+
82
+ /**
83
+ * Return object ID
84
+ *
85
+ * @since 0.6.0
86
+ */
87
+ public function get_object_id() {
88
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
89
+
90
+ $object_id = spl_object_hash( $this );
91
+
92
+ SCC_Common_Util::log( '[' . __METHOD__ . '] object ID: ' . $object_id );
93
+
94
+ return $object_id;
95
+ }
96
+
97
+ /**
98
+ * Inhibit clone
99
+ *
100
+ * @since 0.6.0
101
+ */
102
+ final public function __clone() {
103
+ throw new Exception('Clone is not allowed against' . get_class( $this ) );
104
+ }
105
+
106
+ /**
107
+ * Initialization
108
+ *
109
+ * @since 0.6.0
110
+ */
111
+ abstract public function initialize( $options = array() );
112
+
113
+ /**
114
+ * TODO Auto-generated comment.
115
+ */
116
+ public function get_url() {
117
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
118
+ return $url;
119
+ }
120
+
121
+ /**
122
+ * TODO Auto-generated comment.
123
+ */
124
+ public function set_url( $url) {
125
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
126
+ $this->url = $url;
127
+ }
128
+
129
+ /**
130
+ * TODO Auto-generated comment.
131
+ */
132
+ public function get_parameters() {
133
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
134
+ return $this->parameters;
135
+ }
136
+
137
+ public function get_parameter( $key ) {
138
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
139
+ return $this->parameters[$key];
140
+ }
141
+
142
+ /**
143
+ * TODO Auto-generated comment.
144
+ */
145
+ public function set_parameters( $parameters = array() ) {
146
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
147
+ //$this->parameters = array_merge( $this->parameters, $parameters );
148
+ foreach ( $parameters as $key => $value ) {
149
+ $this->set_parameter( $key, $value );
150
+ }
151
+ }
152
+
153
+ /**
154
+ * TODO Auto-generated comment.
155
+ */
156
+ public function set_parameter( $key, $value ) {
157
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
158
+ $this->parameters[$key] = $value;
159
+ }
160
+
161
+ /**
162
+ * TODO Auto-generated comment.
163
+ */
164
+ public function get_query_parameters() {
165
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
166
+ return $this->query_parameters;
167
+ }
168
+
169
+ public function get_query_parameter( $key ) {
170
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
171
+ return $this->query_parameters[$key];
172
+ }
173
+
174
+ /**
175
+ * TODO Auto-generated comment.
176
+ */
177
+ public function set_query_parameters( $query_parameters = array() ) {
178
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
179
+ //$this->query_parameters = array_merge( $this->query_parameters, $query_parameters );
180
+ foreach( $query_parameters as $key => $value ) {
181
+ $this->set_query_parameter( $key, $value );
182
+ }
183
+ }
184
+
185
+ /**
186
+ * TODO Auto-generated comment.
187
+ */
188
+ public function set_query_parameter( $key, $value ) {
189
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
190
+ $this->query_parameters[$key] = $value;
191
+ }
192
+
193
+ /**
194
+ * TODO Auto-generated comment.
195
+ */
196
+ public function get_method() {
197
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
198
+ return $method;
199
+ }
200
+
201
+ /**
202
+ * TODO Auto-generated comment.
203
+ */
204
+ public function set_method( $method) {
205
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
206
+ $this->method = $method;
207
+ }
208
+
209
+ /**
210
+ * TODO Auto-generated comment.
211
+ */
212
+ abstract public function build_query_url();
213
+
214
+ /**
215
+ * TODO Auto-generated comment.
216
+ */
217
+ abstract public function extract_count( $content );
218
+
219
+ /**
220
+ * TODO Auto-generated comment.
221
+ */
222
+ abstract public function build_header();
223
+
224
+ /**
225
+ * TODO Auto-generated comment.
226
+ */
227
+ abstract public function check_configuration();
228
+
229
+ }
includes/{class-crawler.php → class-scc-crawler.php} RENAMED
@@ -1,194 +1,199 @@
1
- <?php
2
- /*
3
- class-crawler.php
4
-
5
- Description: This class is abstract class of a data crawler
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- abstract class Crawler {
31
-
32
- /**
33
- * URL for data crawling
34
- */
35
- protected $url = '';
36
-
37
- /**
38
- * method to crawl
39
- */
40
- protected $crawl_method = 1;
41
-
42
- /**
43
- * Timeout
44
- */
45
- protected $timeout = 10;
46
-
47
- /**
48
- * ssl verification
49
- */
50
- protected $ssl_verification = true;
51
-
52
- /**
53
- * retry flag
54
- */
55
- protected $crawl_retry = false;
56
-
57
- /**
58
- * limit of crawl retry
59
- */
60
- protected $retry_limit = 2;
61
-
62
- /**
63
- * Instance
64
- */
65
- private static $instance = array();
66
-
67
- /**
68
- * Crawl strategies
69
- */
70
- protected $crawl_strategies = array();
71
-
72
- /**
73
- * Cache target
74
- */
75
- protected $target_sns = array();
76
-
77
- /**
78
- * Class constarctor
79
- * Hook onto all of the actions and filters needed by the plugin.
80
- *
81
- */
82
- protected function __construct() {
83
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
84
- //$this->get_object_id();
85
- }
86
-
87
- /**
88
- * Get instance
89
- *
90
- * @since 0.1.1
91
- */
92
- public static function get_instance() {
93
-
94
- $class_name = get_called_class();
95
-
96
- if ( ! isset( self::$instance[$class_name] ) ) {
97
- self::$instance[$class_name] = new $class_name();
98
- }
99
-
100
- return self::$instance[$class_name];
101
- }
102
-
103
- /**
104
- * Return object ID
105
- *
106
- * @since 0.6.0
107
- */
108
- public function get_object_id() {
109
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
110
-
111
- $object_id = spl_object_hash( $this );
112
-
113
- Common_Util::log( '[' . __METHOD__ . '] object ID: ' . $object_id );
114
-
115
- return $object_id;
116
- }
117
-
118
- /**
119
- * Inhibit clone
120
- *
121
- * @since 0.6.0
122
- */
123
- final public function __clone() {
124
- throw new Exception( 'Clone is not allowed against' . get_class( $this ) );
125
- }
126
-
127
- /**
128
- * Initialization
129
- *
130
- * @since 0.6.0
131
- */
132
- abstract public function initialize( $options = array() );
133
-
134
- /**
135
- * Abstract method for data crawling
136
- *
137
- * @since 0.1.1
138
- */
139
- abstract public function get_data( $target_sns, $options );
140
-
141
- /**
142
- * Set strategy option
143
- *
144
- * @since 0.9.0
145
- */
146
- public function initialize_crawl_strategy( $sns, $options ) {
147
- if ( isset( $this->crawl_strategies[$sns] ) ) {
148
- $this->crawl_strategies[$sns]->initialize( $options );
149
- }
150
- }
151
-
152
- /**
153
- * Set strategy option
154
- *
155
- * @since 0.9.0
156
- */
157
- public function set_crawl_strategy_parameters( $sns, $options ) {
158
- if ( isset( $this->crawl_strategies[$sns] ) ) {
159
- $this->crawl_strategies[$sns]->set_parameters( $options );
160
- }
161
- }
162
-
163
- /**
164
- * Set strategy option
165
- *
166
- * @since 0.9.0
167
- */
168
- public function set_crawl_strategy_query_parameters( $sns, $options ) {
169
- if ( isset( $this->crawl_strategies[$sns] ) ) {
170
- $this->crawl_strategies[$sns]->set_query_parameters( $options );
171
- }
172
- }
173
-
174
- /**
175
- * Get strategy option
176
- *
177
- * @since 0.9.0
178
- */
179
- public function get_crawl_strategy_query_parameters( $sns ) {
180
- return $this->crawl_strategies[$sns]->get_query_parameters();
181
- }
182
-
183
- /**
184
- * Set strategy option
185
- *
186
- * @since 0.9.0
187
- */
188
- public function check_crawl_strategy_configurations( $sns ) {
189
- return $this->crawl_strategies[$sns]->check_configuration();
190
- }
191
-
192
- }
193
-
194
- ?>
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ class-scc-crawler.php
4
+
5
+ Description: This class is abstract class of a data crawler
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ abstract class SCC_Crawler {
31
+
32
+ /**
33
+ * URL for data crawling
34
+ */
35
+ protected $url = '';
36
+
37
+ /**
38
+ * method to crawl
39
+ */
40
+ protected $crawl_method = 1;
41
+
42
+ /**
43
+ * Timeout
44
+ */
45
+ protected $timeout = 10;
46
+
47
+ /**
48
+ * ssl verification
49
+ */
50
+ protected $ssl_verification = true;
51
+
52
+ /**
53
+ * retry flag
54
+ */
55
+ protected $crawl_retry = false;
56
+
57
+ /**
58
+ * limit of crawl retry
59
+ */
60
+ protected $retry_limit = 0;
61
+
62
+ /**
63
+ * fault tolerance mode
64
+ */
65
+ protected $fault_tolerance = 1;
66
+
67
+ /**
68
+ * Instance
69
+ */
70
+ private static $instance = array();
71
+
72
+ /**
73
+ * Crawl strategies
74
+ */
75
+ protected $crawl_strategies = array();
76
+
77
+ /**
78
+ * Cache target
79
+ */
80
+ protected $target_sns = array();
81
+
82
+ /**
83
+ * Class constarctor
84
+ * Hook onto all of the actions and filters needed by the plugin.
85
+ *
86
+ */
87
+ protected function __construct() {
88
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
89
+ //$this->get_object_id();
90
+ }
91
+
92
+ /**
93
+ * Get instance
94
+ *
95
+ * @since 0.1.1
96
+ */
97
+ public static function get_instance() {
98
+
99
+ $class_name = get_called_class();
100
+
101
+ if ( ! isset( self::$instance[$class_name] ) ) {
102
+ self::$instance[$class_name] = new $class_name();
103
+ }
104
+
105
+ return self::$instance[$class_name];
106
+ }
107
+
108
+ /**
109
+ * Return object ID
110
+ *
111
+ * @since 0.6.0
112
+ */
113
+ public function get_object_id() {
114
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
115
+
116
+ $object_id = spl_object_hash( $this );
117
+
118
+ SCC_Common_Util::log( '[' . __METHOD__ . '] object ID: ' . $object_id );
119
+
120
+ return $object_id;
121
+ }
122
+
123
+ /**
124
+ * Inhibit clone
125
+ *
126
+ * @since 0.6.0
127
+ */
128
+ final public function __clone() {
129
+ throw new Exception( 'Clone is not allowed against' . get_class( $this ) );
130
+ }
131
+
132
+ /**
133
+ * Initialization
134
+ *
135
+ * @since 0.6.0
136
+ */
137
+ abstract public function initialize( $options = array() );
138
+
139
+ /**
140
+ * Abstract method for data crawling
141
+ *
142
+ * @since 0.1.1
143
+ */
144
+ abstract public function get_data( $target_sns, $options );
145
+
146
+ /**
147
+ * Set strategy option
148
+ *
149
+ * @since 0.9.0
150
+ */
151
+ public function initialize_crawl_strategy( $sns, $options ) {
152
+ if ( isset( $this->crawl_strategies[$sns] ) ) {
153
+ $this->crawl_strategies[$sns]->initialize( $options );
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Set strategy option
159
+ *
160
+ * @since 0.9.0
161
+ */
162
+ public function set_crawl_strategy_parameters( $sns, $options ) {
163
+ if ( isset( $this->crawl_strategies[$sns] ) ) {
164
+ $this->crawl_strategies[$sns]->set_parameters( $options );
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Set strategy option
170
+ *
171
+ * @since 0.9.0
172
+ */
173
+ public function set_crawl_strategy_query_parameters( $sns, $options ) {
174
+ if ( isset( $this->crawl_strategies[$sns] ) ) {
175
+ $this->crawl_strategies[$sns]->set_query_parameters( $options );
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Get strategy option
181
+ *
182
+ * @since 0.9.0
183
+ */
184
+ public function get_crawl_strategy_query_parameters( $sns ) {
185
+ return $this->crawl_strategies[$sns]->get_query_parameters();
186
+ }
187
+
188
+ /**
189
+ * Set strategy option
190
+ *
191
+ * @since 0.9.0
192
+ */
193
+ public function check_crawl_strategy_configurations( $sns ) {
194
+ return $this->crawl_strategies[$sns]->check_configuration();
195
+ }
196
+
197
+ }
198
+
199
+ ?>
includes/{class-engine.php → class-scc-engine.php} RENAMED
@@ -1,158 +1,158 @@
1
- <?php
2
- /*
3
- class-engine.php
4
-
5
- Description: This class is a engine
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- abstract class Engine {
31
-
32
- /**
33
- * Cron name to schedule cache processing
34
- */
35
- protected $prime_cron = NULL;
36
-
37
- /**
38
- * Cron name to execute cache processing
39
- */
40
- protected $execute_cron = NULL;
41
-
42
- /**
43
- * Schedule name for cache processing
44
- */
45
- protected $event_schedule = NULL;
46
-
47
- /**
48
- * Schedule description for cache processing
49
- */
50
- protected $event_description = NULL;
51
-
52
- /**
53
- * Instance
54
- */
55
- private static $instance = array();
56
-
57
- /**
58
- * Class constarctor
59
- * Hook onto all of the actions and filters needed by the plugin.
60
- *
61
- */
62
- protected function __construct() {
63
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
64
- //$this->get_object_id();
65
- }
66
-
67
- /**
68
- * Get instance
69
- *
70
- * @since 0.1.1
71
- */
72
- public static function get_instance() {
73
- $class_name = get_called_class();
74
-
75
- if ( ! isset( self::$instance[$class_name] ) ) {
76
- self::$instance[$class_name] = new $class_name();
77
- }
78
-
79
- return self::$instance[$class_name];
80
- }
81
-
82
- /**
83
- * Return object ID
84
- *
85
- * @since 0.6.0
86
- */
87
- public function get_object_id() {
88
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
89
-
90
- $object_id = spl_object_hash( $this );
91
-
92
- Common_Util::log( '[' . __METHOD__ . '] object ID: ' . $object_id );
93
-
94
- return $object_id;
95
- }
96
-
97
- /**
98
- * Inhibit clone
99
- *
100
- * @since 0.6.0
101
- */
102
- final public function __clone() {
103
- throw new Exception('Clone is not allowed against' . get_class( $this ) );
104
- }
105
-
106
- /**
107
- * Register base schedule for this engine
108
- *
109
- * @since 0.1.0
110
- */
111
- public function register_schedule() {
112
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
113
-
114
- if ( ! wp_next_scheduled( $this->prime_cron ) ) {
115
- wp_schedule_event( time(), $this->event_schedule, $this->prime_cron );
116
- }
117
- }
118
-
119
- /**
120
- * Unregister base schedule for this engine
121
- *
122
- * @since 0.1.0
123
- */
124
- public function unregister_schedule() {
125
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
126
-
127
- wp_clear_scheduled_hook( $this->prime_cron );
128
- WP_Cron_Util::clear_scheduled_hook( $this->execute_cron );
129
- }
130
-
131
- /**
132
- * Get name of prime cron
133
- *
134
- * @since 0.1.1
135
- */
136
- public function get_prime_cron() {
137
- return $this->prime_cron;
138
- }
139
-
140
- /**
141
- * Get name of execute cron
142
- *
143
- * @since 0.1.1
144
- */
145
- public function get_excute_cron() {
146
- return $this->execute_cron;
147
- }
148
-
149
- /**
150
- * Initialization
151
- *
152
- * @since 0.1.1
153
- */
154
- abstract public function initialize( $options = array() );
155
-
156
- }
157
-
158
- ?>
1
+ <?php
2
+ /*
3
+ class-scc-engine.php
4
+
5
+ Description: This class is a engine
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ abstract class SCC_Engine {
31
+
32
+ /**
33
+ * Cron name to schedule cache processing
34
+ */
35
+ protected $prime_cron = NULL;
36
+
37
+ /**
38
+ * Cron name to execute cache processing
39
+ */
40
+ protected $execute_cron = NULL;
41
+
42
+ /**
43
+ * Schedule name for cache processing
44
+ */
45
+ protected $event_schedule = NULL;
46
+
47
+ /**
48
+ * Schedule description for cache processing
49
+ */
50
+ protected $event_description = NULL;
51
+
52
+ /**
53
+ * Instance
54
+ */
55
+ private static $instance = array();
56
+
57
+ /**
58
+ * Class constarctor
59
+ * Hook onto all of the actions and filters needed by the plugin.
60
+ *
61
+ */
62
+ protected function __construct() {
63
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
64
+ //$this->get_object_id();
65
+ }
66
+
67
+ /**
68
+ * Get instance
69
+ *
70
+ * @since 0.1.1
71
+ */
72
+ public static function get_instance() {
73
+ $class_name = get_called_class();
74
+
75
+ if ( ! isset( self::$instance[$class_name] ) ) {
76
+ self::$instance[$class_name] = new $class_name();
77
+ }
78
+
79
+ return self::$instance[$class_name];
80
+ }
81
+
82
+ /**
83
+ * Return object ID
84
+ *
85
+ * @since 0.6.0
86
+ */
87
+ public function get_object_id() {
88
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
89
+
90
+ $object_id = spl_object_hash( $this );
91
+
92
+ SCC_Common_Util::log( '[' . __METHOD__ . '] object ID: ' . $object_id );
93
+
94
+ return $object_id;
95
+ }
96
+
97
+ /**
98
+ * Inhibit clone
99
+ *
100
+ * @since 0.6.0
101
+ */
102
+ final public function __clone() {
103
+ throw new Exception('Clone is not allowed against' . get_class( $this ) );
104
+ }
105
+
106
+ /**
107
+ * Register base schedule for this engine
108
+ *
109
+ * @since 0.1.0
110
+ */
111
+ public function register_schedule() {
112
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
113
+
114
+ if ( ! wp_next_scheduled( $this->prime_cron ) ) {
115
+ wp_schedule_event( time(), $this->event_schedule, $this->prime_cron );
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Unregister base schedule for this engine
121
+ *
122
+ * @since 0.1.0
123
+ */
124
+ public function unregister_schedule() {
125
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
126
+
127
+ wp_clear_scheduled_hook( $this->prime_cron );
128
+ SCC_WP_Cron_Util::clear_scheduled_hook( $this->execute_cron );
129
+ }
130
+
131
+ /**
132
+ * Get name of prime cron
133
+ *
134
+ * @since 0.1.1
135
+ */
136
+ public function get_prime_cron() {
137
+ return $this->prime_cron;
138
+ }
139
+
140
+ /**
141
+ * Get name of execute cron
142
+ *
143
+ * @since 0.1.1
144
+ */
145
+ public function get_excute_cron() {
146
+ return $this->execute_cron;
147
+ }
148
+
149
+ /**
150
+ * Initialization
151
+ *
152
+ * @since 0.1.1
153
+ */
154
+ abstract public function initialize( $options = array() );
155
+
156
+ }
157
+
158
+ ?>
includes/{class-export-engine.php → class-scc-export-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-export-engine.php
4
 
5
  Description: This class is a data export engine whitch exports cached data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- abstract class Export_Engine extends Engine {
31
 
32
  /**
33
  * Meta key for share second cache
1
  <?php
2
  /*
3
+ class-scc-export-engine.php
4
 
5
  Description: This class is a data export engine whitch exports cached data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ abstract class SCC_Export_Engine extends SCC_Engine {
31
 
32
  /**
33
  * Meta key for share second cache
includes/{class-follow-base-cache-engine.php → class-scc-follow-base-cache-engine.php} RENAMED
@@ -1,229 +1,229 @@
1
- <?php
2
- /*
3
- class-follow-base-cache-engine.php
4
-
5
- Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- class Follow_Base_Cache_Engine extends Follow_Cache_Engine {
31
-
32
- /**
33
- * Prefix of cache ID
34
- */
35
- const DEF_TRANSIENT_PREFIX = 'scc_follow_count_';
36
-
37
- /**
38
- * Cron name to schedule cache processing
39
- */
40
- const DEF_PRIME_CRON = 'scc_follow_basecache_prime';
41
-
42
- /**
43
- * Cron name to execute cache processing
44
- */
45
- const DEF_EXECUTE_CRON = 'scc_follow_basecache_exec';
46
-
47
- /**
48
- * Schedule name for cache processing
49
- */
50
- const DEF_EVENT_SCHEDULE = 'follow_base_cache_event';
51
-
52
- /**
53
- * Schedule description for cache processing
54
- */
55
- const DEF_EVENT_DESCRIPTION = '[SCC] Follow Base Cache Interval';
56
-
57
- /**
58
- * Interval cheking and caching target data
59
- */
60
- private $check_interval = 600;
61
-
62
- /**
63
- * Offset suffix
64
- */
65
- private $offset_suffix = 'follow_base_cache_offset';
66
-
67
- /**
68
- * Initialization
69
- *
70
- * @since 0.1.1
71
- */
72
- public function initialize( $options = array() ) {
73
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
74
-
75
- $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
76
- $this->prime_cron = self::DEF_PRIME_CRON;
77
- $this->execute_cron = self::DEF_EXECUTE_CRON;
78
- $this->event_schedule = self::DEF_EVENT_SCHEDULE;
79
- $this->event_description = self::DEF_EVENT_DESCRIPTION;
80
-
81
- $this->load_ratio = 0.5;
82
-
83
- if ( isset( $options['delegate'] ) ) $this->delegate = $options['delegate'];
84
- if ( isset( $options['crawler'] ) ) $this->crawler = $options['crawler'];
85
- if ( isset( $options['target_sns'] ) ) $this->target_sns = $options['target_sns'];
86
- if ( isset( $options['check_interval'] ) ) $this->check_interval = $options['check_interval'];
87
- if ( isset( $options['cache_prefix'] ) ) $this->cache_prefix = $options['cache_prefix'];
88
- if ( isset( $options['prime_cron'] ) ) $this->prime_cron = $options['prime_cron'];
89
- if ( isset( $options['execute_cron'] ) ) $this->execute_cron = $options['execute_cron'];
90
- if ( isset( $options['event_schedule'] ) ) $this->event_schedule = $options['event_schedule'];
91
- if ( isset( $options['event_description'] ) ) $this->event_description = $options['event_description'];
92
- if ( isset( $options['scheme_migration_mode'] ) ) $this->scheme_migration_mode = $options['scheme_migration_mode'];
93
- if ( isset( $options['scheme_migration_exclude_keys'] ) ) $this->scheme_migration_exclude_keys = $options['scheme_migration_exclude_keys'];
94
- if ( isset( $options['cache_retry'] ) ) $this->cache_retry = $options['cache_retry'];
95
- if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
96
-
97
- add_filter( 'cron_schedules', array( $this, 'schedule_check_interval' ) );
98
- add_action( $this->prime_cron, array( $this, 'prime_cache' ) );
99
- add_action( $this->execute_cron, array( $this, 'execute_cache' ), 10, 1 );
100
- }
101
-
102
- /**
103
- * Register event schedule for this engine
104
- *
105
- * @since 0.1.0
106
- */
107
- public function schedule_check_interval( $schedules ) {
108
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
109
-
110
- $schedules[$this->event_schedule] = array(
111
- 'interval' => $this->check_interval,
112
- 'display' => $this->event_description
113
- );
114
-
115
- return $schedules;
116
- }
117
-
118
- /**
119
- * Schedule data retrieval and cache processing
120
- *
121
- * @since 0.4.0
122
- */
123
- public function prime_cache() {
124
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
125
-
126
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
127
-
128
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
129
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
130
-
131
- wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( Common_Util::short_hash( $next_exec_time ) ) );
132
- }
133
-
134
- /**
135
- * Get and cache data of each published post and page
136
- *
137
- * @since 0.1.0
138
- */
139
- public function execute_cache( $hash ) {
140
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
141
-
142
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
143
-
144
- $cache_expiration = $this->get_cache_expiration();
145
-
146
- Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
147
-
148
- $transient_id = $this->get_cache_key( 'follow' );
149
-
150
- $options = array(
151
- 'cache_key' => $transient_id,
152
- 'target_sns' => $this->target_sns,
153
- 'cache_expiration' => $cache_expiration
154
- );
155
-
156
- // Primary cache
157
- $this->cache( $options );
158
-
159
- // Secondary cache
160
- $this->delegate_cache( $options );
161
- }
162
-
163
- /**
164
- * Get and cache data for a given post
165
- *
166
- * @since 0.4.0
167
- */
168
- public function direct_cache( $second_sync = false ) {
169
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
170
-
171
- $cache_expiration = $this->get_cache_expiration();
172
-
173
- Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
174
-
175
- $transient_id = $this->get_cache_key( 'follow' );
176
-
177
- $options = array(
178
- 'cache_key' => $transient_id,
179
- 'target_sns' => $this->target_sns,
180
- 'cache_expiration' => $cache_expiration
181
- );
182
-
183
- // Primary cache
184
- $result = $this->cache( $options );
185
-
186
- if ( $second_sync ) {
187
- // Secondary cache
188
- $this->delegate_cache( $options );
189
- }
190
-
191
- return $result;
192
- }
193
-
194
- /**
195
- * Get cache expiration based on current number of total post and page
196
- *
197
- * @since 0.4.0
198
- */
199
- protected function get_cache_expiration() {
200
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
201
-
202
- return 3 * $this->check_interval;
203
- }
204
-
205
- /**
206
- * Initialize meta key for ranking
207
- *
208
- * @since 0.3.0
209
- */
210
- public function initialize_cache() {
211
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
212
- }
213
-
214
- /**
215
- * Clear meta key for ranking
216
- *
217
- * @since 0.3.0
218
- */
219
- public function clear_cache() {
220
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
221
-
222
- $transient_id = $this->get_cache_key( 'follow' );
223
-
224
- delete_transient( $transient_id );
225
- }
226
-
227
- }
228
-
229
- ?>
1
+ <?php
2
+ /*
3
+ class-scc-follow-base-cache-engine.php
4
+
5
+ Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ class SCC_Follow_Base_Cache_Engine extends SCC_Follow_Cache_Engine {
31
+
32
+ /**
33
+ * Prefix of cache ID
34
+ */
35
+ const DEF_TRANSIENT_PREFIX = 'scc_follow_count_';
36
+
37
+ /**
38
+ * Cron name to schedule cache processing
39
+ */
40
+ const DEF_PRIME_CRON = 'scc_follow_basecache_prime';
41
+
42
+ /**
43
+ * Cron name to execute cache processing
44
+ */
45
+ const DEF_EXECUTE_CRON = 'scc_follow_basecache_exec';
46
+
47
+ /**
48
+ * Schedule name for cache processing
49
+ */
50
+ const DEF_EVENT_SCHEDULE = 'follow_base_cache_event';
51
+
52
+ /**
53
+ * Schedule description for cache processing
54
+ */
55
+ const DEF_EVENT_DESCRIPTION = '[SCC] Follow Base Cache Interval';
56
+
57
+ /**
58
+ * Interval cheking and caching target data
59
+ */
60
+ private $check_interval = 600;
61
+
62
+ /**
63
+ * Offset suffix
64
+ */
65
+ private $offset_suffix = 'follow_base_cache_offset';
66
+
67
+ /**
68
+ * Initialization
69
+ *
70
+ * @since 0.1.1
71
+ */
72
+ public function initialize( $options = array() ) {
73
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
74
+
75
+ $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
76
+ $this->prime_cron = self::DEF_PRIME_CRON;
77
+ $this->execute_cron = self::DEF_EXECUTE_CRON;
78
+ $this->event_schedule = self::DEF_EVENT_SCHEDULE;
79
+ $this->event_description = self::DEF_EVENT_DESCRIPTION;
80
+
81
+ $this->load_ratio = 0.5;
82
+
83
+ if ( isset( $options['delegate'] ) ) $this->delegate = $options['delegate'];
84
+ if ( isset( $options['crawler'] ) ) $this->crawler = $options['crawler'];
85
+ if ( isset( $options['target_sns'] ) ) $this->target_sns = $options['target_sns'];
86
+ if ( isset( $options['check_interval'] ) ) $this->check_interval = $options['check_interval'];
87
+ if ( isset( $options['cache_prefix'] ) ) $this->cache_prefix = $options['cache_prefix'];
88
+ if ( isset( $options['prime_cron'] ) ) $this->prime_cron = $options['prime_cron'];
89
+ if ( isset( $options['execute_cron'] ) ) $this->execute_cron = $options['execute_cron'];
90
+ if ( isset( $options['event_schedule'] ) ) $this->event_schedule = $options['event_schedule'];
91
+ if ( isset( $options['event_description'] ) ) $this->event_description = $options['event_description'];
92
+ if ( isset( $options['scheme_migration_mode'] ) ) $this->scheme_migration_mode = $options['scheme_migration_mode'];
93
+ if ( isset( $options['scheme_migration_exclude_keys'] ) ) $this->scheme_migration_exclude_keys = $options['scheme_migration_exclude_keys'];
94
+ if ( isset( $options['cache_retry'] ) ) $this->cache_retry = $options['cache_retry'];
95
+ if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
96
+
97
+ add_filter( 'cron_schedules', array( $this, 'schedule_check_interval' ) );
98
+ add_action( $this->prime_cron, array( $this, 'prime_cache' ) );
99
+ add_action( $this->execute_cron, array( $this, 'execute_cache' ), 10, 1 );
100
+ }
101
+
102
+ /**
103
+ * Register event schedule for this engine
104
+ *
105
+ * @since 0.1.0
106
+ */
107
+ public function schedule_check_interval( $schedules ) {
108
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
109
+
110
+ $schedules[$this->event_schedule] = array(
111
+ 'interval' => $this->check_interval,
112
+ 'display' => $this->event_description
113
+ );
114
+
115
+ return $schedules;
116
+ }
117
+
118
+ /**
119
+ * Schedule data retrieval and cache processing
120
+ *
121
+ * @since 0.4.0
122
+ */
123
+ public function prime_cache() {
124
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
125
+
126
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
127
+
128
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
129
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
130
+
131
+ wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( SCC_Common_Util::short_hash( $next_exec_time ) ) );
132
+ }
133
+
134
+ /**
135
+ * Get and cache data of each published post and page
136
+ *
137
+ * @since 0.1.0
138
+ */
139
+ public function execute_cache( $hash ) {
140
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
141
+
142
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
143
+
144
+ $cache_expiration = $this->get_cache_expiration();
145
+
146
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
147
+
148
+ $transient_id = $this->get_cache_key( 'follow' );
149
+
150
+ $options = array(
151
+ 'cache_key' => $transient_id,
152
+ 'target_sns' => $this->target_sns,
153
+ 'cache_expiration' => $cache_expiration
154
+ );
155
+
156
+ // Primary cache
157
+ $this->cache( $options );
158
+
159
+ // Secondary cache
160
+ $this->delegate_order( SCC_Order::ORDER_DO_SECOND_CACHE, $options );
161
+ }
162
+
163
+ /**
164
+ * Get and cache data for a given post
165
+ *
166
+ * @since 0.4.0
167
+ */
168
+ public function direct_cache( $second_sync = false ) {
169
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
170
+
171
+ $cache_expiration = $this->get_cache_expiration();
172
+
173
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
174
+
175
+ $transient_id = $this->get_cache_key( 'follow' );
176
+
177
+ $options = array(
178
+ 'cache_key' => $transient_id,
179
+ 'target_sns' => $this->target_sns,
180
+ 'cache_expiration' => $cache_expiration
181
+ );
182
+
183
+ // Primary cache
184
+ $result = $this->cache( $options );
185
+
186
+ if ( $second_sync ) {
187
+ // Secondary cache
188
+ $this->delegate_order( SCC_Order::ORDER_DO_SECOND_CACHE, $options );
189
+ }
190
+
191
+ return $result;
192
+ }
193
+
194
+ /**
195
+ * Get cache expiration based on current number of total post and page
196
+ *
197
+ * @since 0.4.0
198
+ */
199
+ protected function get_cache_expiration() {
200
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
201
+
202
+ return 3 * $this->check_interval;
203
+ }
204
+
205
+ /**
206
+ * Initialize meta key for ranking
207
+ *
208
+ * @since 0.3.0
209
+ */
210
+ public function initialize_cache() {
211
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
212
+ }
213
+
214
+ /**
215
+ * Clear meta key for ranking
216
+ *
217
+ * @since 0.3.0
218
+ */
219
+ public function clear_cache() {
220
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
221
+
222
+ $transient_id = $this->get_cache_key( 'follow' );
223
+
224
+ delete_transient( $transient_id );
225
+ }
226
+
227
+ }
228
+
229
+ ?>
includes/{class-follow-cache-engine.php → class-scc-follow-cache-engine.php} RENAMED
@@ -1,201 +1,201 @@
1
- <?php
2
- /*
3
- class-follow-cache-engine.php
4
-
5
- Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- abstract class Follow_Cache_Engine extends Cache_Engine {
31
-
32
- /**
33
- * Crawler instance
34
- */
35
- protected $crawler = NULL;
36
-
37
- /**
38
- * Cache target
39
- */
40
- protected $target_sns = array();
41
-
42
- /**
43
- * migration between http and https
44
- */
45
- protected $scheme_migration_mode = false;
46
-
47
- /**
48
- * excluded keys in scheme migration
49
- */
50
- protected $scheme_migration_exclude_keys = array();
51
-
52
- /**
53
- * load ratio for throttle
54
- */
55
- protected $load_ratio = 0.5;
56
-
57
- /**
58
- * Get and cache data for a given post
59
- *
60
- * @since 0.4.0
61
- */
62
- public function cache( $options = array() ) {
63
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
64
-
65
- $cache_key = $options['cache_key'];
66
- $target_sns = $options['target_sns'];
67
- $cache_expiration = $options['cache_expiration'];
68
-
69
- $data = $this->crawler->get_data( $target_sns, NULL );
70
-
71
- Common_Util::log( $data );
72
-
73
- $target_sns_base = $target_sns;
74
-
75
- unset( $target_sns_base[SNS_Count_Cache::REF_CRAWL_DATE] );
76
- unset( $target_sns_base[SNS_Count_Cache::REF_SHARE_TOTAL] );
77
-
78
- $target_sns_url = array();
79
-
80
- $query_parameters = array();
81
-
82
- $query_parameters_origin = array();
83
-
84
- $secure_url_flag = false;
85
-
86
- foreach ( $target_sns_base as $sns => $active ) {
87
- if ( $active ) {
88
- $query_parameters[$sns] = $this->crawler->get_crawl_strategy_query_parameters( $sns );
89
- Common_Util::log( $query_parameters[$sns] );
90
- if ( isset( $query_parameters[$sns]['url'] ) ) {
91
- $target_sns_url[$sns] = true;
92
- Common_Util::log( $query_parameters[$sns] );
93
- if ( Common_Util::is_secure_url( $query_parameters[$sns]['url'] ) ) {
94
- $secure_url_flag = true;
95
- }
96
- } elseif ( isset( $query_parameters[$sns]['urls'] ) ) {
97
- $target_sns_url[$sns] = true;
98
- Common_Util::log( $query_parameters[$sns] );
99
- if ( Common_Util::is_secure_url( $query_parameters[$sns]['urls'] ) ) {
100
- $secure_url_flag = true;
101
- }
102
- }
103
- }
104
- }
105
-
106
- foreach ( $target_sns_url as $sns => $active ) {
107
- if ( $active ) {
108
- $query_parameters_origin[$sns] = $this->crawler->get_crawl_strategy_query_parameters( $sns );
109
- }
110
- }
111
-
112
- if ( $this->scheme_migration_mode && $secure_url_flag ) {
113
-
114
- foreach ( $target_sns_url as $sns => $active ) {
115
- if ( $active ) {
116
- if ( isset( $query_parameters[$sns]['url'] ) ) {
117
- $query_parameters[$sns]['url'] = Common_Util::get_normal_url( $query_parameters[$sns]['url'] );
118
- } elseif ( isset( $query_parameters[$sns]['urls'] ) ) {
119
- $query_parameters[$sns]['urls'] = Common_Util::get_normal_url( $query_parameters[$sns]['urls'] );
120
- }
121
- }
122
- }
123
-
124
- $target_sns_migrated = $target_sns_url;
125
-
126
- foreach ( $this->scheme_migration_exclude_keys as $sns ) {
127
- unset( $target_sns_migrated[$sns] );
128
- }
129
-
130
- foreach( $target_sns_url as $sns => $active ) {
131
- if ( $active ) {
132
- $this->crawler->set_crawl_strategy_query_parameters( $sns, $query_parameters[$sns] );
133
- }
134
- }
135
-
136
- $migrated_data = $this->crawler->get_data( $target_sns_migrated, NULL );
137
-
138
- Common_Util::log( $migrated_data );
139
-
140
- foreach ( $target_sns_migrated as $sns => $active ) {
141
- if ( $active && isset( $migrated_data[$sns] ) && is_numeric( $migrated_data[$sns] ) && $migrated_data[$sns] > 0 ){
142
- $data[$sns] = $data[$sns] + $migrated_data[$sns];
143
- }
144
- }
145
-
146
- foreach ( $target_sns_url as $sns => $active ) {
147
- if ( $active ) {
148
- $this->crawler->set_crawl_strategy_query_parameters( $sns, $query_parameters_origin[$sns] );
149
- }
150
- }
151
- }
152
-
153
- Common_Util::log( $data );
154
-
155
- if ( $data ) {
156
- $throttle = new Sleep_Throttle( $this->load_ratio );
157
-
158
- $throttle->reset();
159
- $throttle->start();
160
-
161
- $result = set_transient( $cache_key, $data, $cache_expiration );
162
-
163
- $throttle->stop();
164
-
165
- $retry_count = 0;
166
-
167
- while ( true ) {
168
- Common_Util::log( '[' . __METHOD__ . '] set_transient result (' . $cache_key . '): ' . $result );
169
-
170
- if ( $result ) {
171
- break;
172
- } else {
173
- if ( $retry_count < $this->retry_limit ) {
174
- Common_Util::log( '[' . __METHOD__ . '] sleep before set_transient retry (' . $cache_key . '): ' . $throttle->get_sleep_time() . ' sec.' );
175
-
176
- $throttle->sleep();
177
-
178
- ++$retry_count;
179
-
180
- Common_Util::log( '[' . __METHOD__ . '] count of set_transient retry (' . $cache_key . '): ' . $retry_count );
181
-
182
- $throttle->reset();
183
- $throttle->start();
184
-
185
- $result = set_transient( $cache_key, $data, $cache_expiration );
186
-
187
- $throttle->stop();
188
- } else {
189
- Common_Util::log( '[' . __METHOD__ . '] set_transient result (' . $cache_key . '): retry failed' );
190
- break;
191
- }
192
- }
193
- }
194
- }
195
-
196
- return $data;
197
- }
198
-
199
- }
200
-
201
- ?>
1
+ <?php
2
+ /*
3
+ class-scc-follow-cache-engine.php
4
+
5
+ Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ abstract class SCC_Follow_Cache_Engine extends SCC_Cache_Engine {
31
+
32
+ /**
33
+ * Crawler instance
34
+ */
35
+ protected $crawler = NULL;
36
+
37
+ /**
38
+ * Cache target
39
+ */
40
+ protected $target_sns = array();
41
+
42
+ /**
43
+ * migration between http and https
44
+ */
45
+ protected $scheme_migration_mode = false;
46
+
47
+ /**
48
+ * excluded keys in scheme migration
49
+ */
50
+ protected $scheme_migration_exclude_keys = array();
51
+
52
+ /**
53
+ * load ratio for throttle
54
+ */
55
+ protected $load_ratio = 0.5;
56
+
57
+ /**
58
+ * Get and cache data for a given post
59
+ *
60
+ * @since 0.4.0
61
+ */
62
+ public function cache( $options = array() ) {
63
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
64
+
65
+ $cache_key = $options['cache_key'];
66
+ $target_sns = $options['target_sns'];
67
+ $cache_expiration = $options['cache_expiration'];
68
+
69
+ $data = $this->crawler->get_data( $target_sns, NULL );
70
+
71
+ SCC_Common_Util::log( $data );
72
+
73
+ $target_sns_base = $target_sns;
74
+
75
+ unset( $target_sns_base[SNS_Count_Cache::REF_CRAWL_DATE] );
76
+ unset( $target_sns_base[SNS_Count_Cache::REF_SHARE_TOTAL] );
77
+
78
+ $target_sns_url = array();
79
+
80
+ $query_parameters = array();
81
+
82
+ $query_parameters_origin = array();
83
+
84
+ $secure_url_flag = false;
85
+
86
+ foreach ( $target_sns_base as $sns => $active ) {
87
+ if ( $active ) {
88
+ $query_parameters[$sns] = $this->crawler->get_crawl_strategy_query_parameters( $sns );
89
+ SCC_Common_Util::log( $query_parameters[$sns] );
90
+ if ( isset( $query_parameters[$sns]['url'] ) ) {
91
+ $target_sns_url[$sns] = true;
92
+ SCC_Common_Util::log( $query_parameters[$sns] );
93
+ if ( SCC_Common_Util::is_secure_url( $query_parameters[$sns]['url'] ) ) {
94
+ $secure_url_flag = true;
95
+ }
96
+ } elseif ( isset( $query_parameters[$sns]['urls'] ) ) {
97
+ $target_sns_url[$sns] = true;
98
+ SCC_Common_Util::log( $query_parameters[$sns] );
99
+ if ( SCC_Common_Util::is_secure_url( $query_parameters[$sns]['urls'] ) ) {
100
+ $secure_url_flag = true;
101
+ }
102
+ }
103
+ }
104
+ }
105
+
106
+ foreach ( $target_sns_url as $sns => $active ) {
107
+ if ( $active ) {
108
+ $query_parameters_origin[$sns] = $this->crawler->get_crawl_strategy_query_parameters( $sns );
109
+ }
110
+ }
111
+
112
+ if ( $this->scheme_migration_mode && $secure_url_flag ) {
113
+
114
+ foreach ( $target_sns_url as $sns => $active ) {
115
+ if ( $active ) {
116
+ if ( isset( $query_parameters[$sns]['url'] ) ) {
117
+ $query_parameters[$sns]['url'] = SCC_Common_Util::get_normal_url( $query_parameters[$sns]['url'] );
118
+ } elseif ( isset( $query_parameters[$sns]['urls'] ) ) {
119
+ $query_parameters[$sns]['urls'] = SCC_Common_Util::get_normal_url( $query_parameters[$sns]['urls'] );
120
+ }
121
+ }
122
+ }
123
+
124
+ $target_sns_migrated = $target_sns_url;
125
+
126
+ foreach ( $this->scheme_migration_exclude_keys as $sns ) {
127
+ unset( $target_sns_migrated[$sns] );
128
+ }
129
+
130
+ foreach( $target_sns_url as $sns => $active ) {
131
+ if ( $active ) {
132
+ $this->crawler->set_crawl_strategy_query_parameters( $sns, $query_parameters[$sns] );
133
+ }
134
+ }
135
+
136
+ $migrated_data = $this->crawler->get_data( $target_sns_migrated, NULL );
137
+
138
+ SCC_Common_Util::log( $migrated_data );
139
+
140
+ foreach ( $target_sns_migrated as $sns => $active ) {
141
+ if ( $active && isset( $migrated_data[$sns] ) && is_numeric( $migrated_data[$sns] ) && $migrated_data[$sns] > 0 ){
142
+ $data[$sns] = $data[$sns] + $migrated_data[$sns];
143
+ }
144
+ }
145
+
146
+ foreach ( $target_sns_url as $sns => $active ) {
147
+ if ( $active ) {
148
+ $this->crawler->set_crawl_strategy_query_parameters( $sns, $query_parameters_origin[$sns] );
149
+ }
150
+ }
151
+ }
152
+
153
+ SCC_Common_Util::log( $data );
154
+
155
+ if ( $data ) {
156
+ $throttle = new SCC_Sleep_Throttle( $this->load_ratio );
157
+
158
+ $throttle->reset();
159
+ $throttle->start();
160
+
161
+ $result = set_transient( $cache_key, $data, $cache_expiration );
162
+
163
+ $throttle->stop();
164
+
165
+ $retry_count = 0;
166
+
167
+ while ( true ) {
168
+ SCC_Common_Util::log( '[' . __METHOD__ . '] set_transient result (' . $cache_key . '): ' . $result );
169
+
170
+ if ( $result ) {
171
+ break;
172
+ } else {
173
+ if ( $retry_count < $this->retry_limit ) {
174
+ SCC_Common_Util::log( '[' . __METHOD__ . '] sleep before set_transient retry (' . $cache_key . '): ' . $throttle->get_sleep_time() . ' sec.' );
175
+
176
+ $throttle->sleep();
177
+
178
+ ++$retry_count;
179
+
180
+ SCC_Common_Util::log( '[' . __METHOD__ . '] count of set_transient retry (' . $cache_key . '): ' . $retry_count );
181
+
182
+ $throttle->reset();
183
+ $throttle->start();
184
+
185
+ $result = set_transient( $cache_key, $data, $cache_expiration );
186
+
187
+ $throttle->stop();
188
+ } else {
189
+ SCC_Common_Util::log( '[' . __METHOD__ . '] set_transient result (' . $cache_key . '): retry failed' );
190
+ break;
191
+ }
192
+ }
193
+ }
194
+ }
195
+
196
+ return $data;
197
+ }
198
+
199
+ }
200
+
201
+ ?>
includes/{class-follow-crawler.php → class-scc-follow-crawler.php} RENAMED
@@ -1,297 +1,297 @@
1
- <?php
2
- /*
3
- class-follow-crawler.php
4
-
5
- Description: This class is a data crawler whitch get share count using given API and cURL
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- class Follow_Crawler extends Crawler {
31
-
32
- /**
33
- * Initialization
34
- *
35
- * @since 0.5.1
36
- */
37
- public function initialize( $options = array() ) {
38
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
39
-
40
- //$this->throttle = new Sleep_Throttle( 0.9 );
41
-
42
- if ( isset( $options['target_sns'] ) ) $this->target_sns = $options['target_sns'];
43
- if ( isset( $options['crawl_method'] ) ) $this->crawl_method = $options['crawl_method'];
44
- if ( isset( $options['timeout'] ) ) $this->timeout = $options['timeout'];
45
- if ( isset( $options['ssl_verification'] ) ) $this->ssl_verification = $options['ssl_verification'];
46
- if ( isset( $options['crawl_retry'] ) ) $this->crawl_retry = $options['crawl_retry'];
47
- if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
48
-
49
- $target_sns = $this->target_sns;
50
-
51
- unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
52
-
53
- foreach ( $target_sns as $sns => $active ) {
54
- if ( $active ) {
55
- $this->crawl_strategies[$sns] = $this->create_crawl_strategy( $sns );
56
- }
57
- }
58
-
59
- }
60
-
61
- /**
62
- * Carete crawl strategy
63
- *
64
- * @since 0.9.0
65
- */
66
- private function create_crawl_strategy( $sns ) {
67
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
-
69
- switch ( $sns ) {
70
- case SNS_Count_Cache::REF_FOLLOW_TWITTER:
71
- Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
72
- return Follow_Twitter_Strategy::get_instance();
73
- break;
74
- case SNS_Count_Cache::REF_FOLLOW_FACEBOOK:
75
- Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
76
- return Follow_Facebook_Strategy::get_instance();
77
- break;
78
- case SNS_Count_Cache::REF_FOLLOW_FEEDLY:
79
- Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
80
- return Follow_Feedly_Strategy::get_instance();
81
- break;
82
- case SNS_Count_Cache::REF_FOLLOW_INSTAGRAM:
83
- Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
84
- return Follow_Instagram_Strategy::get_instance();
85
- break;
86
- case SNS_Count_Cache::REF_FOLLOW_PUSH7:
87
- Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
88
- return Follow_Push7_Strategy::get_instance();
89
- break;
90
- }
91
- }
92
-
93
- /**
94
- * Check configuration
95
- *
96
- * @since 0.9.0
97
- */
98
- private function check_configurations( $target_sns ) {
99
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
100
-
101
- //$checked_target_sns = array();
102
-
103
- unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
104
-
105
- Common_Util::log( $target_sns );
106
-
107
- foreach ( $target_sns as $sns => $active ) {
108
- if ( $active ) {
109
- $target_sns[$sns] = $this->crawl_strategies[$sns]->check_configuration();
110
- }
111
- }
112
-
113
- $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] = true;
114
-
115
- return $target_sns;
116
-
117
- }
118
-
119
- /**
120
- * Implementation of abstract method. this method gets each share count
121
- *
122
- * @since 0.1.1
123
- */
124
- public function get_data( $target_sns, $options ) {
125
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
126
-
127
- Common_Util::log( $target_sns );
128
-
129
- $target_sns = $this->check_configurations( $target_sns );
130
-
131
- Common_Util::log( $target_sns );
132
-
133
- $query_urls = $this->build_query_urls( $target_sns );
134
-
135
- Common_Util::log( $query_urls );
136
-
137
- $query_headers = $this->build_query_headers( $target_sns );
138
-
139
- Common_Util::log( $query_headers );
140
-
141
- $data = array();
142
-
143
- $throttle = new Sleep_Throttle( 0.9 );
144
-
145
- $throttle->reset();
146
- $throttle->start();
147
-
148
- if ( $this->crawl_method === SNS_Count_Cache::OPT_COMMON_CRAWLER_METHOD_CURL ) {
149
- $data = Common_Util::multi_remote_get( $query_urls, $query_headers, $this->timeout, $this->ssl_verification, true );
150
- } else {
151
- $data = Common_Util::multi_remote_get( $query_urls, $query_headers, $this->timeout, $this->ssl_verification, false );
152
- }
153
-
154
- $throttle->stop();
155
-
156
- $retry_count = 0;
157
-
158
- while( true ) {
159
- $target_sns_retry = array();
160
-
161
- $tmp_count = $this->extract_count( $target_sns, $data );
162
-
163
- foreach ( $target_sns as $sns => $active ){
164
- if ( $active ) {
165
- if ( $tmp_count[$sns] === -1 ) {
166
- $target_sns_retry[$sns] = true;
167
- }
168
- }
169
- }
170
-
171
- if ( empty( $target_sns_retry ) ) {
172
- break;
173
- } else {
174
- Common_Util::log( '[' . __METHOD__ . '] crawl failure' );
175
- Common_Util::log( $target_sns_retry );
176
-
177
- if ( $retry_count < $this->retry_limit ) {
178
-
179
- Common_Util::log( '[' . __METHOD__ . '] sleep before crawl retry: ' . $throttle->get_sleep_time() . ' sec.' );
180
-
181
- $throttle->sleep();
182
-
183
- ++$retry_count;
184
-
185
- Common_Util::log( '[' . __METHOD__ . '] count of crawl retry: ' . $retry_count );
186
-
187
- $query_urls_retry = $this->build_query_urls( $target_sns_retry );
188
-
189
- $query_headers_retry = $this->build_query_headers( $target_sns_retry );
190
-
191
- $data_retry = array();
192
-
193
- $throttle->reset();
194
- $throttle->start();
195
-
196
- if ( $this->crawl_method === SNS_Count_Cache::OPT_COMMON_CRAWLER_METHOD_CURL ) {
197
- $data_retry = Common_Util::multi_remote_get( $query_urls_retry, $query_headers_retry, $this->timeout, $this->ssl_verification, true );
198
- } else {
199
- $data_retry = Common_Util::multi_remote_get( $query_urls_retry, $query_headers_retry, $this->timeout, $this->ssl_verification, false );
200
- }
201
-
202
- $throttle->stop();
203
-
204
- $data = array_merge( $data, $data_retry );
205
- } else {
206
- Common_Util::log( '[' . __METHOD__ . '] crawling: retry failed' );
207
- break;
208
- }
209
- }
210
- }
211
-
212
- return $this->extract_count( $target_sns, $data );
213
- }
214
-
215
- /**
216
- * build query
217
- *
218
- * @since 0.5.1
219
- */
220
- private function build_query_urls( $target_sns ) {
221
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
222
-
223
- $query_urls = array();
224
-
225
- unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
226
-
227
- Common_Util::log( $target_sns );
228
-
229
-
230
- foreach ( $target_sns as $sns => $active ) {
231
- if ( $active ) {
232
- $query_urls[$sns] = $this->crawl_strategies[$sns]->build_query_url();
233
- }
234
- }
235
-
236
- return $query_urls;
237
- }
238
-
239
- /**
240
- * build query
241
- *
242
- * @since 0.5.1
243
- */
244
- private function build_query_headers( $target_sns ) {
245
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
246
-
247
- $query_headers = array();
248
-
249
- unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
250
-
251
- Common_Util::log( $target_sns );
252
-
253
- foreach ( $target_sns as $sns => $active ) {
254
- if ( $active ) {
255
- $query_headers[$sns] = $this->crawl_strategies[$sns]->build_header();
256
- }
257
- }
258
-
259
- return $query_headers;
260
- }
261
-
262
- /**
263
- * extract count data from retrieved content
264
- *
265
- * @since 0.5.1
266
- */
267
- private function extract_count( $target_sns, $contents ) {
268
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
269
-
270
- $sns_counts = array();
271
-
272
- $extract_date = date_i18n( 'Y/m/d H:i:s' );
273
-
274
- Common_Util::log( $contents );
275
-
276
- foreach ( $target_sns as $sns => $active ) {
277
- if ( $active ) {
278
- if ( isset( $contents[$sns] ) ) {
279
- $sns_counts[$sns] = $this->crawl_strategies[$sns]->extract_count( $contents[$sns] );
280
- } else {
281
- $sns_counts[$sns] = (int) -1;
282
- }
283
- }
284
- }
285
-
286
- if ( isset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] ) && $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] ) {
287
- $sns_counts[SNS_Count_Cache::REF_CRAWL_DATE] = $extract_date;
288
- } else {
289
- $sns_counts[SNS_Count_Cache::REF_CRAWL_DATE] = '';
290
- }
291
-
292
- return $sns_counts;
293
- }
294
-
295
- }
296
-
297
- ?>
1
+ <?php
2
+ /*
3
+ class-scc-follow-crawler.php
4
+
5
+ Description: This class is a data crawler whitch get share count using given API and cURL
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ class SCC_Follow_Crawler extends SCC_Crawler {
31
+
32
+ /**
33
+ * Initialization
34
+ *
35
+ * @since 0.5.1
36
+ */
37
+ public function initialize( $options = array() ) {
38
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
39
+
40
+ //$this->throttle = new Sleep_Throttle( 0.9 );
41
+
42
+ if ( isset( $options['target_sns'] ) ) $this->target_sns = $options['target_sns'];
43
+ if ( isset( $options['crawl_method'] ) ) $this->crawl_method = $options['crawl_method'];
44
+ if ( isset( $options['timeout'] ) ) $this->timeout = $options['timeout'];
45
+ if ( isset( $options['ssl_verification'] ) ) $this->ssl_verification = $options['ssl_verification'];
46
+ if ( isset( $options['crawl_retry'] ) ) $this->crawl_retry = $options['crawl_retry'];
47
+ if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
48
+
49
+ $target_sns = $this->target_sns;
50
+
51
+ unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
52
+
53
+ foreach ( $target_sns as $sns => $active ) {
54
+ if ( $active ) {
55
+ $this->crawl_strategies[$sns] = $this->create_crawl_strategy( $sns );
56
+ }
57
+ }
58
+
59
+ }
60
+
61
+ /**
62
+ * Carete crawl strategy
63
+ *
64
+ * @since 0.9.0
65
+ */
66
+ private function create_crawl_strategy( $sns ) {
67
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
+
69
+ switch ( $sns ) {
70
+ case SNS_Count_Cache::REF_FOLLOW_TWITTER:
71
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
72
+ return SCC_Follow_Twitter_Strategy::get_instance();
73
+ break;
74
+ case SNS_Count_Cache::REF_FOLLOW_FACEBOOK:
75
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
76
+ return SCC_Follow_Facebook_Strategy::get_instance();
77
+ break;
78
+ case SNS_Count_Cache::REF_FOLLOW_FEEDLY:
79
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
80
+ return SCC_Follow_Feedly_Strategy::get_instance();
81
+ break;
82
+ case SNS_Count_Cache::REF_FOLLOW_INSTAGRAM:
83
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
84
+ return SCC_Follow_Instagram_Strategy::get_instance();
85
+ break;
86
+ case SNS_Count_Cache::REF_FOLLOW_PUSH7:
87
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
88
+ return SCC_Follow_Push7_Strategy::get_instance();
89
+ break;
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Check configuration
95
+ *
96
+ * @since 0.9.0
97
+ */
98
+ private function check_configurations( $target_sns ) {
99
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
100
+
101
+ //$checked_target_sns = array();
102
+
103
+ unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
104
+
105
+ SCC_Common_Util::log( $target_sns );
106
+
107
+ foreach ( $target_sns as $sns => $active ) {
108
+ if ( $active ) {
109
+ $target_sns[$sns] = $this->crawl_strategies[$sns]->check_configuration();
110
+ }
111
+ }
112
+
113
+ $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] = true;
114
+
115
+ return $target_sns;
116
+
117
+ }
118
+
119
+ /**
120
+ * Implementation of abstract method. this method gets each share count
121
+ *
122
+ * @since 0.1.1
123
+ */
124
+ public function get_data( $target_sns, $options ) {
125
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
126
+
127
+ SCC_Common_Util::log( $target_sns );
128
+
129
+ $valid_target_sns = $this->check_configurations( $target_sns );
130
+
131
+ SCC_Common_Util::log( $valid_target_sns );
132
+
133
+ $query_urls = $this->build_query_urls( $valid_target_sns );
134
+
135
+ SCC_Common_Util::log( $query_urls );
136
+
137
+ $query_headers = $this->build_query_headers( $valid_target_sns );
138
+
139
+ SCC_Common_Util::log( $query_headers );
140
+
141
+ $data = array();
142
+
143
+ $throttle = new SCC_Sleep_Throttle( 0.9 );
144
+
145
+ $throttle->reset();
146
+ $throttle->start();
147
+
148
+ if ( $this->crawl_method === SNS_Count_Cache::OPT_COMMON_CRAWLER_METHOD_CURL ) {
149
+ $data = SCC_Common_Util::multi_remote_get( $query_urls, $query_headers, $this->timeout, $this->ssl_verification, true );
150
+ } else {
151
+ $data = SCC_Common_Util::multi_remote_get( $query_urls, $query_headers, $this->timeout, $this->ssl_verification, false );
152
+ }
153
+
154
+ $throttle->stop();
155
+
156
+ $retry_count = 0;
157
+
158
+ while( true ) {
159
+ $target_sns_retry = array();
160
+
161
+ $tmp_count = $this->extract_count( $valid_target_sns, $data );
162
+
163
+ foreach ( $valid_target_sns as $sns => $active ){
164
+ if ( $active ) {
165
+ if ( $tmp_count[$sns] === -1 ) {
166
+ $target_sns_retry[$sns] = true;
167
+ }
168
+ }
169
+ }
170
+
171
+ if ( empty( $target_sns_retry ) ) {
172
+ break;
173
+ } else {
174
+ SCC_Common_Util::log( '[' . __METHOD__ . '] crawl failure' );
175
+ SCC_Common_Util::log( $target_sns_retry );
176
+
177
+ if ( $retry_count < $this->retry_limit ) {
178
+
179
+ SCC_Common_Util::log( '[' . __METHOD__ . '] sleep before crawl retry: ' . $throttle->get_sleep_time() . ' sec.' );
180
+
181
+ $throttle->sleep();
182
+
183
+ ++$retry_count;
184
+
185
+ SCC_Common_Util::log( '[' . __METHOD__ . '] count of crawl retry: ' . $retry_count );
186
+
187
+ $query_urls_retry = $this->build_query_urls( $target_sns_retry );
188
+
189
+ $query_headers_retry = $this->build_query_headers( $target_sns_retry );
190
+
191
+ $data_retry = array();
192
+
193
+ $throttle->reset();
194
+ $throttle->start();
195
+
196
+ if ( $this->crawl_method === SNS_Count_Cache::OPT_COMMON_CRAWLER_METHOD_CURL ) {
197
+ $data_retry = SCC_Common_Util::multi_remote_get( $query_urls_retry, $query_headers_retry, $this->timeout, $this->ssl_verification, true );
198
+ } else {
199
+ $data_retry = SCC_Common_Util::multi_remote_get( $query_urls_retry, $query_headers_retry, $this->timeout, $this->ssl_verification, false );
200
+ }
201
+
202
+ $throttle->stop();
203
+
204
+ $data = array_merge( $data, $data_retry );
205
+ } else {
206
+ SCC_Common_Util::log( '[' . __METHOD__ . '] crawling: retry failed' );
207
+ break;
208
+ }
209
+ }
210
+ }
211
+
212
+ return $this->extract_count( $target_sns, $data );
213
+ }
214
+
215
+ /**
216
+ * build query
217
+ *
218
+ * @since 0.5.1
219
+ */
220
+ private function build_query_urls( $target_sns ) {
221
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
222
+
223
+ $query_urls = array();
224
+
225
+ unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
226
+
227
+ SCC_Common_Util::log( $target_sns );
228
+
229
+
230
+ foreach ( $target_sns as $sns => $active ) {
231
+ if ( $active ) {
232
+ $query_urls[$sns] = $this->crawl_strategies[$sns]->build_query_url();
233
+ }
234
+ }
235
+
236
+ return $query_urls;
237
+ }
238
+
239
+ /**
240
+ * build query
241
+ *
242
+ * @since 0.5.1
243
+ */
244
+ private function build_query_headers( $target_sns ) {
245
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
246
+
247
+ $query_headers = array();
248
+
249
+ unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
250
+
251
+ SCC_Common_Util::log( $target_sns );
252
+
253
+ foreach ( $target_sns as $sns => $active ) {
254
+ if ( $active ) {
255
+ $query_headers[$sns] = $this->crawl_strategies[$sns]->build_header();
256
+ }
257
+ }
258
+
259
+ return $query_headers;
260
+ }
261
+
262
+ /**
263
+ * extract count data from retrieved content
264
+ *
265
+ * @since 0.5.1
266
+ */
267
+ private function extract_count( $target_sns, $contents ) {
268
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
269
+
270
+ $sns_counts = array();
271
+
272
+ $extract_date = date_i18n( 'Y/m/d H:i:s' );
273
+
274
+ SCC_Common_Util::log( $contents );
275
+
276
+ foreach ( $target_sns as $sns => $active ) {
277
+ if ( $active ) {
278
+ if ( isset( $contents[$sns] ) ) {
279
+ $sns_counts[$sns] = $this->crawl_strategies[$sns]->extract_count( $contents[$sns] );
280
+ } else {
281
+ $sns_counts[$sns] = (int) -1;
282
+ }
283
+ }
284
+ }
285
+
286
+ if ( isset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] ) && $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] ) {
287
+ $sns_counts[SNS_Count_Cache::REF_CRAWL_DATE] = $extract_date;
288
+ } else {
289
+ $sns_counts[SNS_Count_Cache::REF_CRAWL_DATE] = '';
290
+ }
291
+
292
+ return $sns_counts;
293
+ }
294
+
295
+ }
296
+
297
+ ?>
includes/{class-follow-facebook-strategy.php → class-scc-follow-facebook-strategy.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-follow-facebook-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Follow_Facebook_Strategy extends Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
@@ -40,7 +40,7 @@ class Follow_Facebook_Strategy extends Crawl_Strategy {
40
  *
41
  */
42
  protected function __construct() {
43
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
@@ -51,7 +51,7 @@ class Follow_Facebook_Strategy extends Crawl_Strategy {
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
@@ -64,7 +64,7 @@ class Follow_Facebook_Strategy extends Crawl_Strategy {
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
@@ -74,7 +74,7 @@ class Follow_Facebook_Strategy extends Crawl_Strategy {
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . $this->parameters['page_id'] . '/insights/page_fans/lifetime' . '?' . http_build_query( $this->query_parameters , '' , '&' );
80
 
@@ -87,7 +87,7 @@ class Follow_Facebook_Strategy extends Crawl_Strategy {
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
@@ -95,7 +95,7 @@ class Follow_Facebook_Strategy extends Crawl_Strategy {
95
 
96
  $json = json_decode( $content['data'], true );
97
 
98
- Common_Util::log( $json );
99
 
100
  if ( isset( $json['data'][0]['values'][2]['value'] ) && is_numeric( $json['data'][0]['values'][2]['value'] ) ) {
101
  $count = (int) $json['data'][0]['values'][2]['value'];
@@ -117,7 +117,7 @@ class Follow_Facebook_Strategy extends Crawl_Strategy {
117
  * @since 0.9.0
118
  */
119
  public function check_configuration() {
120
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
121
 
122
  if ( isset( $this->parameters['client_id'] ) && $this->parameters['client_id'] &&
123
  isset( $this->parameters['client_secret'] ) && $this->parameters['client_secret'] &&
1
  <?php
2
  /*
3
+ class-scc-follow-facebook-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Follow_Facebook_Strategy extends SCC_Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
40
  *
41
  */
42
  protected function __construct() {
43
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . $this->parameters['page_id'] . '/insights/page_fans/lifetime' . '?' . http_build_query( $this->query_parameters , '' , '&' );
80
 
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
95
 
96
  $json = json_decode( $content['data'], true );
97
 
98
+ SCC_Common_Util::log( $json );
99
 
100
  if ( isset( $json['data'][0]['values'][2]['value'] ) && is_numeric( $json['data'][0]['values'][2]['value'] ) ) {
101
  $count = (int) $json['data'][0]['values'][2]['value'];
117
  * @since 0.9.0
118
  */
119
  public function check_configuration() {
120
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
121
 
122
  if ( isset( $this->parameters['client_id'] ) && $this->parameters['client_id'] &&
123
  isset( $this->parameters['client_secret'] ) && $this->parameters['client_secret'] &&
includes/{class-follow-feedly-strategy.php → class-scc-follow-feedly-strategy.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-follow-feedly-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Follow_Feedly_Strategy extends Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
@@ -40,7 +40,7 @@ class Follow_Feedly_Strategy extends Crawl_Strategy {
40
  *
41
  */
42
  protected function __construct() {
43
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
@@ -51,7 +51,7 @@ class Follow_Feedly_Strategy extends Crawl_Strategy {
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
@@ -64,7 +64,7 @@ class Follow_Feedly_Strategy extends Crawl_Strategy {
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
@@ -74,7 +74,7 @@ class Follow_Feedly_Strategy extends Crawl_Strategy {
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . rawurlencode( $this->query_parameters['url'] );
80
 
@@ -87,7 +87,7 @@ class Follow_Feedly_Strategy extends Crawl_Strategy {
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
@@ -112,7 +112,7 @@ class Follow_Feedly_Strategy extends Crawl_Strategy {
112
  * @since 0.9.0
113
  */
114
  public function check_configuration() {
115
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
116
 
117
  if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
118
  return true;
1
  <?php
2
  /*
3
+ class-scc-follow-feedly-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Follow_Feedly_Strategy extends SCC_Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
40
  *
41
  */
42
  protected function __construct() {
43
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . rawurlencode( $this->query_parameters['url'] );
80
 
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
112
  * @since 0.9.0
113
  */
114
  public function check_configuration() {
115
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
116
 
117
  if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
118
  return true;
includes/{class-follow-instagram-strategy.php → class-scc-follow-instagram-strategy.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-follow-instagram-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Follow_Instagram_Strategy extends Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
@@ -40,7 +40,7 @@ class Follow_Instagram_Strategy extends Crawl_Strategy {
40
  *
41
  */
42
  protected function __construct() {
43
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
@@ -51,7 +51,7 @@ class Follow_Instagram_Strategy extends Crawl_Strategy {
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
@@ -64,7 +64,7 @@ class Follow_Instagram_Strategy extends Crawl_Strategy {
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
@@ -74,7 +74,7 @@ class Follow_Instagram_Strategy extends Crawl_Strategy {
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
80
 
@@ -87,7 +87,7 @@ class Follow_Instagram_Strategy extends Crawl_Strategy {
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
@@ -112,7 +112,7 @@ class Follow_Instagram_Strategy extends Crawl_Strategy {
112
  * @since 0.9.0
113
  */
114
  public function check_configuration() {
115
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
116
 
117
  if ( isset( $this->parameters['client_id'] ) && $this->parameters['client_id'] &&
118
  isset( $this->parameters['client_secret'] ) && $this->parameters['client_secret'] &&
1
  <?php
2
  /*
3
+ class-scc-follow-instagram-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Follow_Instagram_Strategy extends SCC_Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
40
  *
41
  */
42
  protected function __construct() {
43
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
80
 
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
112
  * @since 0.9.0
113
  */
114
  public function check_configuration() {
115
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
116
 
117
  if ( isset( $this->parameters['client_id'] ) && $this->parameters['client_id'] &&
118
  isset( $this->parameters['client_secret'] ) && $this->parameters['client_secret'] &&
includes/{class-follow-lazy-cache-engine.php → class-scc-follow-lazy-cache-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-follow-lazy-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Follow_Lazy_Cache_Engine extends Follow_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
@@ -70,7 +70,7 @@ class Follow_Lazy_Cache_Engine extends Follow_Cache_Engine {
70
  * @since 0.1.1
71
  */
72
  public function initialize( $options = array() ) {
73
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
74
 
75
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
76
  $this->prime_cron = self::DEF_PRIME_CRON;
@@ -101,7 +101,18 @@ class Follow_Lazy_Cache_Engine extends Follow_Cache_Engine {
101
  * @since 0.1.0
102
  */
103
  public function register_schedule() {
104
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
  /**
@@ -110,12 +121,12 @@ class Follow_Lazy_Cache_Engine extends Follow_Cache_Engine {
110
  * @since 0.4.0
111
  */
112
  public function prime_cache() {
113
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
114
 
115
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
116
 
117
- Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
118
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
119
 
120
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array() );
121
  }
@@ -126,11 +137,11 @@ class Follow_Lazy_Cache_Engine extends Follow_Cache_Engine {
126
  * @since 0.4.0
127
  */
128
  public function execute_cache() {
129
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
130
 
131
  $cache_expiration = $this->get_cache_expiration();
132
 
133
- Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
134
 
135
  $transient_id = $this->get_cache_key( 'follow' );
136
 
@@ -144,7 +155,7 @@ class Follow_Lazy_Cache_Engine extends Follow_Cache_Engine {
144
  $this->cache( $options );
145
 
146
  // Secondary cache
147
- $this->delegate_cache( $options );
148
  }
149
 
150
  /**
@@ -153,7 +164,7 @@ class Follow_Lazy_Cache_Engine extends Follow_Cache_Engine {
153
  * @since 0.4.0
154
  */
155
  protected function get_cache_expiration() {
156
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
157
 
158
  return 3 * $this->check_interval;
159
  }
@@ -164,7 +175,7 @@ class Follow_Lazy_Cache_Engine extends Follow_Cache_Engine {
164
  * @since 0.3.0
165
  */
166
  public function initialize_cache() {
167
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
168
  }
169
 
170
  /**
@@ -173,7 +184,7 @@ class Follow_Lazy_Cache_Engine extends Follow_Cache_Engine {
173
  * @since 0.3.0
174
  */
175
  public function clear_cache() {
176
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
177
  }
178
 
179
  }
1
  <?php
2
  /*
3
+ class-scc-follow-lazy-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Follow_Lazy_Cache_Engine extends SCC_Follow_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
70
  * @since 0.1.1
71
  */
72
  public function initialize( $options = array() ) {
73
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
74
 
75
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
76
  $this->prime_cron = self::DEF_PRIME_CRON;
101
  * @since 0.1.0
102
  */
103
  public function register_schedule() {
104
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
105
+ }
106
+
107
+ /**
108
+ * Unregister base schedule for this engine
109
+ *
110
+ * @since 0.1.0
111
+ */
112
+ public function unregister_schedule() {
113
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
114
+
115
+ SCC_WP_Cron_Util::clear_scheduled_hook( $this->execute_cron );
116
  }
117
 
118
  /**
121
  * @since 0.4.0
122
  */
123
  public function prime_cache() {
124
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
125
 
126
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
127
 
128
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
129
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
130
 
131
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array() );
132
  }
137
  * @since 0.4.0
138
  */
139
  public function execute_cache() {
140
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
141
 
142
  $cache_expiration = $this->get_cache_expiration();
143
 
144
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
145
 
146
  $transient_id = $this->get_cache_key( 'follow' );
147
 
155
  $this->cache( $options );
156
 
157
  // Secondary cache
158
+ $this->delegate_order( SCC_Order::ORDER_DO_SECOND_CACHE, $options );
159
  }
160
 
161
  /**
164
  * @since 0.4.0
165
  */
166
  protected function get_cache_expiration() {
167
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
168
 
169
  return 3 * $this->check_interval;
170
  }
175
  * @since 0.3.0
176
  */
177
  public function initialize_cache() {
178
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
179
  }
180
 
181
  /**
184
  * @since 0.3.0
185
  */
186
  public function clear_cache() {
187
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
188
  }
189
 
190
  }
includes/{class-follow-push7-strategy.php → class-scc-follow-push7-strategy.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-follow-push7-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Follow_Push7_Strategy extends Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
@@ -40,7 +40,7 @@ class Follow_Push7_Strategy extends Crawl_Strategy {
40
  *
41
  */
42
  protected function __construct() {
43
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
@@ -51,7 +51,7 @@ class Follow_Push7_Strategy extends Crawl_Strategy {
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
@@ -64,7 +64,7 @@ class Follow_Push7_Strategy extends Crawl_Strategy {
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
@@ -74,7 +74,7 @@ class Follow_Push7_Strategy extends Crawl_Strategy {
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . $this->parameters['appno'] . '/head';
80
 
@@ -87,7 +87,7 @@ class Follow_Push7_Strategy extends Crawl_Strategy {
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
@@ -112,7 +112,7 @@ class Follow_Push7_Strategy extends Crawl_Strategy {
112
  * @since 0.9.0
113
  */
114
  public function check_configuration() {
115
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
116
 
117
  if ( isset( $this->parameters['appno'] ) && $this->parameters['appno'] ) {
118
  return true;
1
  <?php
2
  /*
3
+ class-scc-follow-push7-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Follow_Push7_Strategy extends SCC_Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
40
  *
41
  */
42
  protected function __construct() {
43
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . $this->parameters['appno'] . '/head';
80
 
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
112
  * @since 0.9.0
113
  */
114
  public function check_configuration() {
115
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
116
 
117
  if ( isset( $this->parameters['appno'] ) && $this->parameters['appno'] ) {
118
  return true;
includes/{class-follow-restore-cache-engine.php → class-scc-follow-restore-cache-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-follow-restore-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch restore cache data from second cache.
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Follow_Restore_Cache_Engine extends Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
@@ -70,7 +70,7 @@ class Follow_Restore_Cache_Engine extends Cache_Engine {
70
  * @since 0.1.1
71
  */
72
  public function initialize( $options = array() ) {
73
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
74
 
75
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
76
  $this->prime_cron = self::DEF_PRIME_CRON;
@@ -93,7 +93,18 @@ class Follow_Restore_Cache_Engine extends Cache_Engine {
93
  * @since 0.1.0
94
  */
95
  public function register_schedule() {
96
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
 
 
 
 
 
 
 
 
 
 
 
97
  }
98
 
99
  /**
@@ -102,12 +113,12 @@ class Follow_Restore_Cache_Engine extends Cache_Engine {
102
  * @since 0.4.0
103
  */
104
  public function prime_cache() {
105
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
106
 
107
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
108
 
109
- Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
110
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
111
 
112
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array() );
113
  }
@@ -118,11 +129,11 @@ class Follow_Restore_Cache_Engine extends Cache_Engine {
118
  * @since 0.4.0
119
  */
120
  public function execute_cache() {
121
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
122
 
123
  $cache_expiration = $this->get_cache_expiration();
124
 
125
- Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
126
 
127
  $transient_id = $this->get_cache_key( 'follow' );
128
 
@@ -141,7 +152,7 @@ class Follow_Restore_Cache_Engine extends Cache_Engine {
141
  * @since 0.1.1
142
  */
143
  public function cache( $options = array() ) {
144
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
145
 
146
  $transient_id = $options['cache_key'];
147
  $target_sns = $options['target_sns'];
@@ -169,7 +180,7 @@ class Follow_Restore_Cache_Engine extends Cache_Engine {
169
  * @since 0.4.0
170
  */
171
  protected function get_cache_expiration() {
172
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
173
 
174
  return 3 * $this->check_interval;
175
  }
@@ -180,7 +191,7 @@ class Follow_Restore_Cache_Engine extends Cache_Engine {
180
  * @since 0.3.0
181
  */
182
  public function initialize_cache() {
183
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
184
  }
185
 
186
  /**
@@ -189,7 +200,7 @@ class Follow_Restore_Cache_Engine extends Cache_Engine {
189
  * @since 0.3.0
190
  */
191
  public function clear_cache() {
192
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
193
  }
194
 
195
  }
1
  <?php
2
  /*
3
+ class-scc-follow-restore-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch restore cache data from second cache.
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Follow_Restore_Cache_Engine extends SCC_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
70
  * @since 0.1.1
71
  */
72
  public function initialize( $options = array() ) {
73
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
74
 
75
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
76
  $this->prime_cron = self::DEF_PRIME_CRON;
93
  * @since 0.1.0
94
  */
95
  public function register_schedule() {
96
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
97
+ }
98
+
99
+ /**
100
+ * Unregister base schedule for this engine
101
+ *
102
+ * @since 0.1.0
103
+ */
104
+ public function unregister_schedule() {
105
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
106
+
107
+ SCC_WP_Cron_Util::clear_scheduled_hook( $this->execute_cron );
108
  }
109
 
110
  /**
113
  * @since 0.4.0
114
  */
115
  public function prime_cache() {
116
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
117
 
118
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
119
 
120
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
121
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
122
 
123
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array() );
124
  }
129
  * @since 0.4.0
130
  */
131
  public function execute_cache() {
132
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
133
 
134
  $cache_expiration = $this->get_cache_expiration();
135
 
136
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
137
 
138
  $transient_id = $this->get_cache_key( 'follow' );
139
 
152
  * @since 0.1.1
153
  */
154
  public function cache( $options = array() ) {
155
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
156
 
157
  $transient_id = $options['cache_key'];
158
  $target_sns = $options['target_sns'];
180
  * @since 0.4.0
181
  */
182
  protected function get_cache_expiration() {
183
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
184
 
185
  return 3 * $this->check_interval;
186
  }
191
  * @since 0.3.0
192
  */
193
  public function initialize_cache() {
194
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
195
  }
196
 
197
  /**
200
  * @since 0.3.0
201
  */
202
  public function clear_cache() {
203
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
204
  }
205
 
206
  }
includes/{class-follow-second-cache-engine.php → class-scc-follow-second-cache-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-follow-second-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Follow_Second_Cache_Engine extends Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
@@ -75,7 +75,7 @@ class Follow_Second_Cache_Engine extends Cache_Engine {
75
  * @since 0.1.1
76
  */
77
  public function initialize( $options = array() ) {
78
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
79
 
80
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
81
  $this->prime_cron = self::DEF_PRIME_CRON;
@@ -103,7 +103,7 @@ class Follow_Second_Cache_Engine extends Cache_Engine {
103
  * @since 0.1.0
104
  */
105
  public function schedule_check_interval( $schedules ) {
106
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
107
 
108
  $schedules[$this->event_schedule] = array(
109
  'interval' => $this->check_interval,
@@ -119,12 +119,12 @@ class Follow_Second_Cache_Engine extends Cache_Engine {
119
  * @since 0.3.0
120
  */
121
  public function prime_cache() {
122
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
123
 
124
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
125
 
126
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
127
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
128
 
129
  wp_schedule_single_event( $next_exec_time, $this->execute_cron );
130
  }
@@ -135,7 +135,7 @@ class Follow_Second_Cache_Engine extends Cache_Engine {
135
  * @since 0.4.0
136
  */
137
  public function execute_cache() {
138
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
139
 
140
  $url = get_feed_link();
141
 
@@ -155,7 +155,7 @@ class Follow_Second_Cache_Engine extends Cache_Engine {
155
  * @since 0.1.1
156
  */
157
  public function cache( $options = array() ) {
158
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
159
 
160
  $transient_id = $options['cache_key'];
161
  $target_sns = $options['target_sns'];
@@ -174,7 +174,7 @@ class Follow_Second_Cache_Engine extends Cache_Engine {
174
  * @since 0.2.0
175
  */
176
  protected function get_cache_expiration() {
177
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
178
 
179
  return 0;
180
  }
@@ -185,7 +185,7 @@ class Follow_Second_Cache_Engine extends Cache_Engine {
185
  * @since 0.3.0
186
  */
187
  public function initialize_cache() {
188
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
189
 
190
  $option_key = $this->get_cache_key( 'follow' );
191
 
@@ -206,7 +206,7 @@ class Follow_Second_Cache_Engine extends Cache_Engine {
206
  * @since 0.3.0
207
  */
208
  public function clear_cache() {
209
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
210
 
211
  $option_key = $this->get_cache_key( 'follow' );
212
 
1
  <?php
2
  /*
3
+ class-scc-follow-second-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Follow_Second_Cache_Engine extends SCC_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
75
  * @since 0.1.1
76
  */
77
  public function initialize( $options = array() ) {
78
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
79
 
80
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
81
  $this->prime_cron = self::DEF_PRIME_CRON;
103
  * @since 0.1.0
104
  */
105
  public function schedule_check_interval( $schedules ) {
106
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
107
 
108
  $schedules[$this->event_schedule] = array(
109
  'interval' => $this->check_interval,
119
  * @since 0.3.0
120
  */
121
  public function prime_cache() {
122
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
123
 
124
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
125
 
126
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
127
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
128
 
129
  wp_schedule_single_event( $next_exec_time, $this->execute_cron );
130
  }
135
  * @since 0.4.0
136
  */
137
  public function execute_cache() {
138
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
139
 
140
  $url = get_feed_link();
141
 
155
  * @since 0.1.1
156
  */
157
  public function cache( $options = array() ) {
158
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
159
 
160
  $transient_id = $options['cache_key'];
161
  $target_sns = $options['target_sns'];
174
  * @since 0.2.0
175
  */
176
  protected function get_cache_expiration() {
177
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
178
 
179
  return 0;
180
  }
185
  * @since 0.3.0
186
  */
187
  public function initialize_cache() {
188
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
189
 
190
  $option_key = $this->get_cache_key( 'follow' );
191
 
206
  * @since 0.3.0
207
  */
208
  public function clear_cache() {
209
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
210
 
211
  $option_key = $this->get_cache_key( 'follow' );
212
 
includes/{class-follow-twitter-strategy.php → class-scc-follow-twitter-strategy.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-follow-twitter-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
@@ -27,21 +27,20 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Follow_Twitter_Strategy extends Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
34
  */
35
  const DEF_BASE_URL = 'https://api.twitter.com/1.1/users/show.json';
36
 
37
-
38
  /**
39
  * Class constarctor
40
  * Hook onto all of the actions and filters needed by the plugin.
41
  *
42
  */
43
  protected function __construct() {
44
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
45
 
46
  $this->method = 'GET';
47
  }
@@ -52,7 +51,7 @@ class Follow_Twitter_Strategy extends Crawl_Strategy {
52
  * @since 0.9.0
53
  */
54
  public function initialize( $options = array() ) {
55
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
56
 
57
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
58
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
@@ -65,7 +64,7 @@ class Follow_Twitter_Strategy extends Crawl_Strategy {
65
  * @since 0.9.0
66
  */
67
  public function build_header() {
68
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
69
 
70
  $headers = array();
71
 
@@ -111,7 +110,7 @@ class Follow_Twitter_Strategy extends Crawl_Strategy {
111
  * @since 0.9.0
112
  */
113
  public function build_query_url() {
114
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
115
 
116
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
117
 
@@ -124,7 +123,7 @@ class Follow_Twitter_Strategy extends Crawl_Strategy {
124
  * @since 0.9.0
125
  */
126
  public function extract_count( $content ) {
127
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
128
 
129
  $count = (int) -1;
130
 
@@ -149,7 +148,7 @@ class Follow_Twitter_Strategy extends Crawl_Strategy {
149
  * @since 0.9.0
150
  */
151
  public function check_configuration() {
152
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
153
 
154
  /*
155
  // vesion using user auth
1
  <?php
2
  /*
3
+ class-scc-follow-twitter-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Follow_Twitter_Strategy extends SCC_Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
34
  */
35
  const DEF_BASE_URL = 'https://api.twitter.com/1.1/users/show.json';
36
 
 
37
  /**
38
  * Class constarctor
39
  * Hook onto all of the actions and filters needed by the plugin.
40
  *
41
  */
42
  protected function __construct() {
43
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
 
69
  $headers = array();
70
 
110
  * @since 0.9.0
111
  */
112
  public function build_query_url() {
113
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
114
 
115
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
116
 
123
  * @since 0.9.0
124
  */
125
  public function extract_count( $content ) {
126
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
127
 
128
  $count = (int) -1;
129
 
148
  * @since 0.9.0
149
  */
150
  public function check_configuration() {
151
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
152
 
153
  /*
154
  // vesion using user auth
includes/{class-share-analytical-engine.php → class-scc-share-analytical-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-analytical-engine.php
4
 
5
  Description: This class is a data analytical engine.
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Share_Analytical_Engine extends Analytical_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
@@ -90,7 +90,7 @@ class Share_Analytical_Engine extends Analytical_Engine {
90
  * @since 0.1.1
91
  */
92
  public function initialize( $options = array() ) {
93
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
94
 
95
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
96
  $this->base_prefix = self::DEF_BASE_PREFIX;
@@ -124,7 +124,7 @@ class Share_Analytical_Engine extends Analytical_Engine {
124
  * @since 0.1.0
125
  */
126
  public function schedule_check_interval( $schedules ) {
127
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
128
 
129
  $schedules[$this->event_schedule] = array(
130
  'interval' => $this->check_interval,
@@ -140,15 +140,15 @@ class Share_Analytical_Engine extends Analytical_Engine {
140
  * @since 0.1.0
141
  */
142
  public function prime_base() {
143
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
144
 
145
- $next_exec_time = WP_Cron_Util::next_exec_time( $this->base_schedule );
146
 
147
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time (timesatamp): ' . $next_exec_time );
148
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time (date): ' . date_i18n( 'Y/m/d H:i:s', $next_exec_time ) );
149
 
150
- if ( ! WP_Cron_Util::is_scheduled_hook( $this->execute_cron ) ) {
151
- wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( Common_Util::short_hash( $next_exec_time ) ) );
152
  }
153
  }
154
 
@@ -158,7 +158,7 @@ class Share_Analytical_Engine extends Analytical_Engine {
158
  * @since 0.1.0
159
  */
160
  public function execute_base( $hash ) {
161
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
162
 
163
  $current_date = date_i18n( 'Y/m/d H:i:s' );
164
 
@@ -167,14 +167,14 @@ class Share_Analytical_Engine extends Analytical_Engine {
167
 
168
  if ( ! file_exists( $base_file ) ) {
169
  if ( touch( $base_file ) ) {
170
- Common_Util::log( '[' . __METHOD__ . '] file creation succeeded: ' . $base_file );
171
  } else {
172
- Common_Util::log( '[' . __METHOD__ . '] file creation failed: ' . $base_file );
173
  }
174
  }
175
 
176
  if ( file_exists( $base_file ) ) {
177
- Common_Util::log( '[' . __METHOD__ . '] file exists: ' . $base_file );
178
 
179
  $option_key = $this->get_cache_key( 'home' );
180
 
@@ -199,15 +199,15 @@ class Share_Analytical_Engine extends Analytical_Engine {
199
  $fp = fopen( $base_file, 'w' );
200
 
201
  if ( fwrite( $fp, $data ) ) {
202
- Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ');
203
  } else {
204
- Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ');
205
  }
206
 
207
  if ( fclose( $fp ) ) {
208
- Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $base_file );
209
  } else {
210
- Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $base_file );
211
  }
212
  }
213
  }
@@ -233,9 +233,9 @@ class Share_Analytical_Engine extends Analytical_Engine {
233
 
234
  if ( ! file_exists( $base_file ) ) {
235
  if ( touch( $base_file ) ) {
236
- Common_Util::log( '[' . __METHOD__ . '] export file creation succeeded: ' . $base_file );
237
  } else {
238
- Common_Util::log( '[' . __METHOD__ . '] export file creation failed: ' . $base_file );
239
  }
240
  }
241
 
@@ -275,15 +275,15 @@ class Share_Analytical_Engine extends Analytical_Engine {
275
  $fp = fopen( $base_file, 'w' );
276
 
277
  if ( fwrite( $fp, $data ) ) {
278
- Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' );
279
  } else {
280
- Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' );
281
  }
282
 
283
  if ( fclose( $fp ) ) {
284
- Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $base_file );
285
  } else {
286
- Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $base_file );
287
  }
288
  }
289
  }
@@ -316,9 +316,9 @@ class Share_Analytical_Engine extends Analytical_Engine {
316
  $data = fread( $fp, filesize( $base_file ) );
317
 
318
  if ( fclose( $fp ) ) {
319
- Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $base_file );
320
  } else {
321
- Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $base_file );
322
  }
323
 
324
  $sns_base_counts = unserialize( $data );
@@ -326,9 +326,9 @@ class Share_Analytical_Engine extends Analytical_Engine {
326
  // if there is no base file.
327
 
328
  if ( touch( $base_file ) ) {
329
- Common_Util::log( '[' . __METHOD__ . '] file creation succeeded: ' . $base_file );
330
  } else {
331
- Common_Util::log( '[' . __METHOD__ . '] file creation failed: ' . $base_file );
332
  }
333
 
334
  if ( file_exists( $base_file ) ) {
@@ -346,7 +346,7 @@ class Share_Analytical_Engine extends Analytical_Engine {
346
  if ( isset( $sns_count ) && $sns_count !== '' && $sns_count >= 0 ) {
347
  $sns_counts[$sns] = (int) $sns_count;
348
  } else {
349
- $sns_count[$sns] = (int) -1;
350
  }
351
  } else {
352
  $meta_key = $this->get_cache_key( $sns );
@@ -387,15 +387,15 @@ class Share_Analytical_Engine extends Analytical_Engine {
387
  $fp = fopen( $base_file, 'w' );
388
 
389
  if ( fwrite( $fp, $data ) ) {
390
- Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' );
391
  } else {
392
- Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' );
393
  }
394
 
395
  if ( fclose( $fp ) ) {
396
- Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $base_file );
397
  } else {
398
- Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $base_file );
399
  }
400
  }
401
  }
@@ -527,7 +527,7 @@ class Share_Analytical_Engine extends Analytical_Engine {
527
  * @since 0.3.0
528
  */
529
  public function initialize_base() {
530
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
531
 
532
  /*
533
  $option_key = $this->get_cache_key( $this->offset_suffix );
@@ -542,7 +542,7 @@ class Share_Analytical_Engine extends Analytical_Engine {
542
  * @since 0.3.0
543
  */
544
  public function clear_base() {
545
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
546
 
547
  $option_key = $this->get_delta_key( 'home' );
548
 
@@ -564,7 +564,7 @@ class Share_Analytical_Engine extends Analytical_Engine {
564
  * @since 0.7.0
565
  */
566
  public function clear_base_by_post_id( $post_id ) {
567
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
568
 
569
  foreach ( $this->target_sns as $sns => $active ) {
570
  if ( $active ) {
1
  <?php
2
  /*
3
+ class-scc-share-analytical-engine.php
4
 
5
  Description: This class is a data analytical engine.
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Share_Analytical_Engine extends SCC_Analytical_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
90
  * @since 0.1.1
91
  */
92
  public function initialize( $options = array() ) {
93
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
94
 
95
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
96
  $this->base_prefix = self::DEF_BASE_PREFIX;
124
  * @since 0.1.0
125
  */
126
  public function schedule_check_interval( $schedules ) {
127
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
128
 
129
  $schedules[$this->event_schedule] = array(
130
  'interval' => $this->check_interval,
140
  * @since 0.1.0
141
  */
142
  public function prime_base() {
143
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
144
 
145
+ $next_exec_time = SCC_WP_Cron_Util::next_exec_time( $this->base_schedule );
146
 
147
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time (timesatamp): ' . $next_exec_time );
148
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time (date): ' . date_i18n( 'Y/m/d H:i:s', $next_exec_time ) );
149
 
150
+ if ( ! SCC_WP_Cron_Util::is_scheduled_hook( $this->execute_cron ) ) {
151
+ wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( SCC_Common_Util::short_hash( $next_exec_time ) ) );
152
  }
153
  }
154
 
158
  * @since 0.1.0
159
  */
160
  public function execute_base( $hash ) {
161
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
162
 
163
  $current_date = date_i18n( 'Y/m/d H:i:s' );
164
 
167
 
168
  if ( ! file_exists( $base_file ) ) {
169
  if ( touch( $base_file ) ) {
170
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file creation succeeded: ' . $base_file );
171
  } else {
172
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file creation failed: ' . $base_file );
173
  }
174
  }
175
 
176
  if ( file_exists( $base_file ) ) {
177
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file exists: ' . $base_file );
178
 
179
  $option_key = $this->get_cache_key( 'home' );
180
 
199
  $fp = fopen( $base_file, 'w' );
200
 
201
  if ( fwrite( $fp, $data ) ) {
202
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ');
203
  } else {
204
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ');
205
  }
206
 
207
  if ( fclose( $fp ) ) {
208
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $base_file );
209
  } else {
210
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $base_file );
211
  }
212
  }
213
  }
233
 
234
  if ( ! file_exists( $base_file ) ) {
235
  if ( touch( $base_file ) ) {
236
+ SCC_Common_Util::log( '[' . __METHOD__ . '] export file creation succeeded: ' . $base_file );
237
  } else {
238
+ SCC_Common_Util::log( '[' . __METHOD__ . '] export file creation failed: ' . $base_file );
239
  }
240
  }
241
 
275
  $fp = fopen( $base_file, 'w' );
276
 
277
  if ( fwrite( $fp, $data ) ) {
278
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' );
279
  } else {
280
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' );
281
  }
282
 
283
  if ( fclose( $fp ) ) {
284
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $base_file );
285
  } else {
286
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $base_file );
287
  }
288
  }
289
  }
316
  $data = fread( $fp, filesize( $base_file ) );
317
 
318
  if ( fclose( $fp ) ) {
319
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $base_file );
320
  } else {
321
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $base_file );
322
  }
323
 
324
  $sns_base_counts = unserialize( $data );
326
  // if there is no base file.
327
 
328
  if ( touch( $base_file ) ) {
329
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file creation succeeded: ' . $base_file );
330
  } else {
331
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file creation failed: ' . $base_file );
332
  }
333
 
334
  if ( file_exists( $base_file ) ) {
346
  if ( isset( $sns_count ) && $sns_count !== '' && $sns_count >= 0 ) {
347
  $sns_counts[$sns] = (int) $sns_count;
348
  } else {
349
+ $sns_counts[$sns] = (int) -1;
350
  }
351
  } else {
352
  $meta_key = $this->get_cache_key( $sns );
387
  $fp = fopen( $base_file, 'w' );
388
 
389
  if ( fwrite( $fp, $data ) ) {
390
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file write succeeded: ' );
391
  } else {
392
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file wrote failed: ' );
393
  }
394
 
395
  if ( fclose( $fp ) ) {
396
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close succeeded: ' . $base_file );
397
  } else {
398
+ SCC_Common_Util::log( '[' . __METHOD__ . '] file close failed: ' . $base_file );
399
  }
400
  }
401
  }
527
  * @since 0.3.0
528
  */
529
  public function initialize_base() {
530
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
531
 
532
  /*
533
  $option_key = $this->get_cache_key( $this->offset_suffix );
542
  * @since 0.3.0
543
  */
544
  public function clear_base() {
545
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
546
 
547
  $option_key = $this->get_delta_key( 'home' );
548
 
564
  * @since 0.7.0
565
  */
566
  public function clear_base_by_post_id( $post_id ) {
567
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
568
 
569
  foreach ( $this->target_sns as $sns => $active ) {
570
  if ( $active ) {
includes/{class-share-base-cache-engine.php → class-scc-share-base-cache-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-base-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Share_Base_Cache_Engine extends Share_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
@@ -75,7 +75,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
75
  * @since 0.1.1
76
  */
77
  public function initialize( $options = array() ) {
78
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
79
 
80
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
81
  $this->prime_cron = self::DEF_PRIME_CRON;
@@ -101,6 +101,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
101
  if ( isset( $options['scheme_migration_exclude_keys'] ) ) $this->scheme_migration_exclude_keys = $options['scheme_migration_exclude_keys'];
102
  if ( isset( $options['cache_retry'] ) ) $this->cache_retry = $options['cache_retry'];
103
  if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
 
104
 
105
  add_filter( 'cron_schedules', array( $this, 'schedule_check_interval' ) );
106
  add_action( $this->prime_cron, array( $this, 'prime_cache' ) );
@@ -113,7 +114,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
113
  * @since 0.1.0
114
  */
115
  public function schedule_check_interval( $schedules ) {
116
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
117
 
118
  $schedules[$this->event_schedule] = array(
119
  'interval' => $this->check_interval,
@@ -129,15 +130,15 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
129
  * @since 0.1.0
130
  */
131
  public function prime_cache() {
132
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
133
 
134
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
135
  $posts_total = $this->get_posts_total();
136
 
137
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
138
- Common_Util::log( '[' . __METHOD__ . '] posts_per_check: ' . $this->posts_per_check );
139
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
140
- Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
141
 
142
  $option_key = $this->get_cache_key( $this->offset_suffix );
143
 
@@ -145,7 +146,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
145
  $posts_offset = 0;
146
  }
147
 
148
- Common_Util::log( '[' . __METHOD__ . '] posts_offset: ' . $posts_offset );
149
 
150
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( (int) $posts_offset ) );
151
 
@@ -164,15 +165,15 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
164
  * @since 0.1.0
165
  */
166
  public function execute_cache( $posts_offset ) {
167
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
168
 
169
- Common_Util::log( '[' . __METHOD__ . '] posts_offset: ' . $posts_offset );
170
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
171
- Common_Util::log( '[' . __METHOD__ . '] posts_per_check: ' . $this->posts_per_check );
172
 
173
  $cache_expiration = $this->get_cache_expiration();
174
 
175
- Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
176
 
177
  // Cache home url
178
  if ( $posts_offset == 0 ) {
@@ -194,8 +195,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
194
  $this->cache( $options );
195
 
196
  // Secondary cache
197
- $this->delegate_cache( $options );
198
-
199
  }
200
 
201
  $query_args = array(
@@ -216,7 +216,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
216
 
217
  $post_ID = get_the_ID();
218
 
219
- Common_Util::log( '[' . __METHOD__ . '] post_id: ' . $post_ID );
220
 
221
  $transient_id = $this->get_cache_key( $post_ID );
222
 
@@ -235,7 +235,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
235
  $this->cache( $options );
236
 
237
  // Secondary cache
238
- $this->delegate_cache( $options );
239
  }
240
  }
241
  wp_reset_postdata();
@@ -247,11 +247,11 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
247
  * @since 0.1.1
248
  */
249
  public function direct_cache( $post_ID, $second_sync = false ) {
250
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
251
 
252
  $cache_expiration = $this->get_cache_expiration();
253
 
254
- Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
255
 
256
  $transient_id = $this->get_cache_key( $post_ID );
257
 
@@ -277,7 +277,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
277
 
278
  if ( $second_sync ) {
279
  // Secondary cache
280
- $this->delegate_cache( $options );
281
  }
282
 
283
  return $result;
@@ -289,11 +289,11 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
289
  * @since 0.1.1
290
  */
291
  protected function get_cache_expiration() {
292
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
293
 
294
  $posts_total = $this->get_posts_total();
295
 
296
- Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
297
 
298
  return ceil( $posts_total / $this->posts_per_check ) * $this->check_interval * 3;
299
  }
@@ -304,7 +304,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
304
  * @since 0.3.0
305
  */
306
  public function initialize_cache() {
307
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
308
 
309
  $option_key = $this->get_cache_key( $this->offset_suffix );
310
 
@@ -317,7 +317,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
317
  * @since 0.3.0
318
  */
319
  public function clear_cache() {
320
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
321
 
322
  $transient_id = $this->get_cache_key( 'home' );
323
 
@@ -358,7 +358,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
358
  * @since 0.7.0
359
  */
360
  public function clear_cache_by_post_id( $post_id ) {
361
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
362
 
363
  $transient_id = $this->get_cache_key( $post_id );
364
 
@@ -371,7 +371,7 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
371
  * @since 0.1.0
372
  */
373
  private function get_posts_total() {
374
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
375
 
376
  $query_args = array(
377
  'post_type' => $this->post_types,
@@ -386,6 +386,25 @@ class Share_Base_Cache_Engine extends Share_Cache_Engine {
386
  return $posts_query->found_posts;
387
  }
388
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  }
390
 
391
  ?>
1
  <?php
2
  /*
3
+ class-scc-share-base-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Share_Base_Cache_Engine extends SCC_Share_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
75
  * @since 0.1.1
76
  */
77
  public function initialize( $options = array() ) {
78
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
79
 
80
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
81
  $this->prime_cron = self::DEF_PRIME_CRON;
101
  if ( isset( $options['scheme_migration_exclude_keys'] ) ) $this->scheme_migration_exclude_keys = $options['scheme_migration_exclude_keys'];
102
  if ( isset( $options['cache_retry'] ) ) $this->cache_retry = $options['cache_retry'];
103
  if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
104
+ if ( isset( $options['fault_tolerance'] ) ) $this->fault_tolerance = $options['fault_tolerance'];
105
 
106
  add_filter( 'cron_schedules', array( $this, 'schedule_check_interval' ) );
107
  add_action( $this->prime_cron, array( $this, 'prime_cache' ) );
114
  * @since 0.1.0
115
  */
116
  public function schedule_check_interval( $schedules ) {
117
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
118
 
119
  $schedules[$this->event_schedule] = array(
120
  'interval' => $this->check_interval,
130
  * @since 0.1.0
131
  */
132
  public function prime_cache() {
133
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
134
 
135
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
136
  $posts_total = $this->get_posts_total();
137
 
138
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
139
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_per_check: ' . $this->posts_per_check );
140
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
141
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
142
 
143
  $option_key = $this->get_cache_key( $this->offset_suffix );
144
 
146
  $posts_offset = 0;
147
  }
148
 
149
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_offset: ' . $posts_offset );
150
 
151
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( (int) $posts_offset ) );
152
 
165
  * @since 0.1.0
166
  */
167
  public function execute_cache( $posts_offset ) {
168
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
169
 
170
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_offset: ' . $posts_offset );
171
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
172
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_per_check: ' . $this->posts_per_check );
173
 
174
  $cache_expiration = $this->get_cache_expiration();
175
 
176
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
177
 
178
  // Cache home url
179
  if ( $posts_offset == 0 ) {
195
  $this->cache( $options );
196
 
197
  // Secondary cache
198
+ $this->delegate_order( SCC_Order::ORDER_DO_SECOND_CACHE, $options );
 
199
  }
200
 
201
  $query_args = array(
216
 
217
  $post_ID = get_the_ID();
218
 
219
+ SCC_Common_Util::log( '[' . __METHOD__ . '] post_id: ' . $post_ID );
220
 
221
  $transient_id = $this->get_cache_key( $post_ID );
222
 
235
  $this->cache( $options );
236
 
237
  // Secondary cache
238
+ $this->delegate_order( SCC_Order::ORDER_DO_SECOND_CACHE, $options );
239
  }
240
  }
241
  wp_reset_postdata();
247
  * @since 0.1.1
248
  */
249
  public function direct_cache( $post_ID, $second_sync = false ) {
250
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
251
 
252
  $cache_expiration = $this->get_cache_expiration();
253
 
254
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
255
 
256
  $transient_id = $this->get_cache_key( $post_ID );
257
 
277
 
278
  if ( $second_sync ) {
279
  // Secondary cache
280
+ $this->delegate_order( SCC_Order::ORDER_DO_SECOND_CACHE, $options );
281
  }
282
 
283
  return $result;
289
  * @since 0.1.1
290
  */
291
  protected function get_cache_expiration() {
292
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
293
 
294
  $posts_total = $this->get_posts_total();
295
 
296
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
297
 
298
  return ceil( $posts_total / $this->posts_per_check ) * $this->check_interval * 3;
299
  }
304
  * @since 0.3.0
305
  */
306
  public function initialize_cache() {
307
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
308
 
309
  $option_key = $this->get_cache_key( $this->offset_suffix );
310
 
317
  * @since 0.3.0
318
  */
319
  public function clear_cache() {
320
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
321
 
322
  $transient_id = $this->get_cache_key( 'home' );
323
 
358
  * @since 0.7.0
359
  */
360
  public function clear_cache_by_post_id( $post_id ) {
361
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
362
 
363
  $transient_id = $this->get_cache_key( $post_id );
364
 
371
  * @since 0.1.0
372
  */
373
  private function get_posts_total() {
374
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
375
 
376
  $query_args = array(
377
  'post_type' => $this->post_types,
386
  return $posts_query->found_posts;
387
  }
388
 
389
+ /**
390
+ * Get current cache
391
+ *
392
+ * @since 0.9.3
393
+ */
394
+ protected function get_current_cache( $options = array() ) {
395
+ $post_id = $options['post_id'];
396
+
397
+ $transient_id = $this->get_cache_key( $post_id );
398
+
399
+ $sns_counts = array();
400
+
401
+ if ( false !== ( $sns_counts = get_transient( $transient_id ) ) ) {
402
+ return $sns_counts;
403
+ } else {
404
+ return $this->delegate_order( SCC_Order::ORDER_GET_SECOND_CACHE, $options );
405
+ }
406
+ }
407
+
408
  }
409
 
410
  ?>
includes/{class-share-cache-engine.php → class-scc-share-cache-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- abstract class Share_Cache_Engine extends Cache_Engine {
31
 
32
  /**
33
  * Crawler instance
@@ -70,37 +70,38 @@ abstract class Share_Cache_Engine extends Cache_Engine {
70
  * @since 0.1.1
71
  */
72
  public function cache( $options = array() ) {
73
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
74
 
75
  $cache_key = $options['cache_key'];
 
76
  $target_url = $options['target_url'];
77
  $target_sns = $options['target_sns'];
78
  $cache_expiration = $options['cache_expiration'];
79
  $publish_date = $options['publish_date'];
80
 
81
- Common_Util::log( '[' . __METHOD__ . '] current memory usage: ' . round( memory_get_usage( true )/1024/1024, 2 ) . ' MB' );
82
- Common_Util::log( '[' . __METHOD__ . '] target url: ' . $target_url );
83
 
84
  $data = $this->get_data( $target_sns, $target_url );
85
 
86
- Common_Util::log( $data );
87
- Common_Util::log( '[' . __METHOD__ . '] scheme migration date: ' . $this->scheme_migration_date );
88
- Common_Util::log( '[' . __METHOD__ . '] publish date: ' . $publish_date );
89
 
90
- if ( $this->scheme_migration_mode && Common_Util::is_secure_url( $target_url ) ) {
91
  if ( ! isset( $this->scheme_migration_date ) ) {
92
- $target_normal_url = Common_Util::get_normal_url( $target_url );
93
  $target_sns_migrated = $target_sns;
94
 
95
  foreach ( $this->scheme_migration_exclude_keys as $sns ) {
96
  unset( $target_sns_migrated[$sns] );
97
  }
98
 
99
- Common_Util::log( '[' . __METHOD__ . '] target url: ' . $target_normal_url );
100
 
101
  $migrated_data = $this->get_data( $target_sns_migrated, $target_normal_url );
102
 
103
- Common_Util::log( $migrated_data );
104
 
105
  foreach ( $target_sns_migrated as $sns => $active ) {
106
  if ( $active && isset( $migrated_data[$sns] ) && is_numeric( $migrated_data[$sns] ) && $migrated_data[$sns] > 0 ){
@@ -111,18 +112,18 @@ abstract class Share_Cache_Engine extends Cache_Engine {
111
  } else {
112
  if ( isset( $publish_date ) ) {
113
  if ( strtotime( $publish_date ) <= strtotime( $this->scheme_migration_date ) ) {
114
- $target_normal_url = Common_Util::get_normal_url( $target_url );
115
  $target_sns_migrated = $target_sns;
116
 
117
  foreach ( $this->scheme_migration_exclude_keys as $sns ) {
118
  unset( $target_sns_migrated[$sns] );
119
  }
120
 
121
- Common_Util::log( '[' . __METHOD__ . '] target url: ' . $target_normal_url );
122
 
123
  $migrated_data = $this->get_data( $target_sns_migrated, $target_normal_url );
124
 
125
- Common_Util::log( $migrated_data );
126
 
127
  foreach ( $target_sns_migrated as $sns => $active ) {
128
  if ( $active && isset( $migrated_data[$sns] ) && is_numeric( $migrated_data[$sns] ) && $migrated_data[$sns] > 0 ){
@@ -131,18 +132,18 @@ abstract class Share_Cache_Engine extends Cache_Engine {
131
  }
132
  }
133
  } else {
134
- $target_normal_url = Common_Util::get_normal_url( $target_url );
135
  $target_sns_migrated = $target_sns;
136
 
137
  foreach ( $this->scheme_migration_exclude_keys as $sns ) {
138
  unset( $target_sns_migrated[$sns] );
139
  }
140
 
141
- Common_Util::log( '[' . __METHOD__ . '] target url: ' . $target_url );
142
 
143
  $migrated_data = $this->get_data( $target_sns_migrated, $target_url );
144
 
145
- Common_Util::log( $migrated_data );
146
 
147
  foreach ( $target_sns_migrated as $sns => $active ) {
148
  if ( $active && isset( $migrated_data[$sns] ) && is_numeric( $migrated_data[$sns] ) && $migrated_data[$sns] > 0 ){
@@ -168,10 +169,51 @@ abstract class Share_Cache_Engine extends Cache_Engine {
168
  }
169
  }
170
 
171
- Common_Util::log( $data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
  if ( $data ) {
174
- $throttle = new Sleep_Throttle( $this->load_ratio );
175
 
176
  $throttle->reset();
177
  $throttle->start();
@@ -183,18 +225,18 @@ abstract class Share_Cache_Engine extends Cache_Engine {
183
 
184
  while ( true ) {
185
 
186
- Common_Util::log( '[' . __METHOD__ . '] set_transient result (' . $cache_key . '): ' . $result );
187
 
188
  if ( $result ) {
189
  break;
190
  } else {
191
  if ( $retry_count < $this->retry_limit ) {
192
- Common_Util::log( '[' . __METHOD__ . '] sleep before set_transient retry (' . $cache_key . '): ' . $throttle->get_sleep_time() . ' sec.' );
193
 
194
  $throttle->sleep();
195
  ++$retry_count;
196
 
197
- Common_Util::log( '[' . __METHOD__ . '] count of set_transient retry (' . $cache_key . '): ' . $retry_count );
198
 
199
  $throttle->reset();
200
  $throttle->start();
@@ -203,15 +245,15 @@ abstract class Share_Cache_Engine extends Cache_Engine {
203
 
204
  $throttle->stop();
205
  } else {
206
- Common_Util::log( '[' . __METHOD__ . '] set_transient result (' . $cache_key . '): retry failed' );
207
  break;
208
  }
209
  }
210
  }
211
  }
212
 
213
- Common_Util::log( '[' . __METHOD__ . '] current memory usage: ' . round( memory_get_usage( true )/1024/1024, 2 ) . ' MB' );
214
- Common_Util::log( '[' . __METHOD__ . '] max memory usage: ' . round( memory_get_peak_usage( true )/1024/1024, 2 ) . ' MB' );
215
 
216
  return $data;
217
  }
@@ -222,7 +264,7 @@ abstract class Share_Cache_Engine extends Cache_Engine {
222
  * @since 0.9.0
223
  */
224
  private function get_data( $target_sns, $target_url ) {
225
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
226
 
227
  $target_sns_base = $target_sns;
228
 
@@ -242,6 +284,13 @@ abstract class Share_Cache_Engine extends Cache_Engine {
242
  return $this->crawler->get_data( $target_sns, NULL );
243
  }
244
 
 
 
 
 
 
 
 
245
  }
246
 
247
  ?>
1
  <?php
2
  /*
3
+ class-scc-share-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ abstract class SCC_Share_Cache_Engine extends SCC_Cache_Engine {
31
 
32
  /**
33
  * Crawler instance
70
  * @since 0.1.1
71
  */
72
  public function cache( $options = array() ) {
73
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
74
 
75
  $cache_key = $options['cache_key'];
76
+ $post_id = $options['post_id'];
77
  $target_url = $options['target_url'];
78
  $target_sns = $options['target_sns'];
79
  $cache_expiration = $options['cache_expiration'];
80
  $publish_date = $options['publish_date'];
81
 
82
+ SCC_Common_Util::log( '[' . __METHOD__ . '] current memory usage: ' . round( memory_get_usage( true )/1024/1024, 2 ) . ' MB' );
83
+ SCC_Common_Util::log( '[' . __METHOD__ . '] target url: ' . $target_url );
84
 
85
  $data = $this->get_data( $target_sns, $target_url );
86
 
87
+ SCC_Common_Util::log( $data );
88
+ SCC_Common_Util::log( '[' . __METHOD__ . '] scheme migration date: ' . $this->scheme_migration_date );
89
+ SCC_Common_Util::log( '[' . __METHOD__ . '] publish date: ' . $publish_date );
90
 
91
+ if ( $this->scheme_migration_mode && SCC_Common_Util::is_secure_url( $target_url ) ) {
92
  if ( ! isset( $this->scheme_migration_date ) ) {
93
+ $target_normal_url = SCC_Common_Util::get_normal_url( $target_url );
94
  $target_sns_migrated = $target_sns;
95
 
96
  foreach ( $this->scheme_migration_exclude_keys as $sns ) {
97
  unset( $target_sns_migrated[$sns] );
98
  }
99
 
100
+ SCC_Common_Util::log( '[' . __METHOD__ . '] target url: ' . $target_normal_url );
101
 
102
  $migrated_data = $this->get_data( $target_sns_migrated, $target_normal_url );
103
 
104
+ SCC_Common_Util::log( $migrated_data );
105
 
106
  foreach ( $target_sns_migrated as $sns => $active ) {
107
  if ( $active && isset( $migrated_data[$sns] ) && is_numeric( $migrated_data[$sns] ) && $migrated_data[$sns] > 0 ){
112
  } else {
113
  if ( isset( $publish_date ) ) {
114
  if ( strtotime( $publish_date ) <= strtotime( $this->scheme_migration_date ) ) {
115
+ $target_normal_url = SCC_Common_Util::get_normal_url( $target_url );
116
  $target_sns_migrated = $target_sns;
117
 
118
  foreach ( $this->scheme_migration_exclude_keys as $sns ) {
119
  unset( $target_sns_migrated[$sns] );
120
  }
121
 
122
+ SCC_Common_Util::log( '[' . __METHOD__ . '] target url: ' . $target_normal_url );
123
 
124
  $migrated_data = $this->get_data( $target_sns_migrated, $target_normal_url );
125
 
126
+ SCC_Common_Util::log( $migrated_data );
127
 
128
  foreach ( $target_sns_migrated as $sns => $active ) {
129
  if ( $active && isset( $migrated_data[$sns] ) && is_numeric( $migrated_data[$sns] ) && $migrated_data[$sns] > 0 ){
132
  }
133
  }
134
  } else {
135
+ $target_normal_url = SCC_Common_Util::get_normal_url( $target_url );
136
  $target_sns_migrated = $target_sns;
137
 
138
  foreach ( $this->scheme_migration_exclude_keys as $sns ) {
139
  unset( $target_sns_migrated[$sns] );
140
  }
141
 
142
+ SCC_Common_Util::log( '[' . __METHOD__ . '] target url: ' . $target_url );
143
 
144
  $migrated_data = $this->get_data( $target_sns_migrated, $target_url );
145
 
146
+ SCC_Common_Util::log( $migrated_data );
147
 
148
  foreach ( $target_sns_migrated as $sns => $active ) {
149
  if ( $active && isset( $migrated_data[$sns] ) && is_numeric( $migrated_data[$sns] ) && $migrated_data[$sns] > 0 ){
169
  }
170
  }
171
 
172
+ if ( $this->fault_tolerance === SNS_Count_Cache::OPT_COMMON_FAULT_TOLERANCE_ON ) {
173
+
174
+ $target_sns_tmp = $target_sns;
175
+ unset( $target_sns_tmp[SNS_Count_Cache::REF_CRAWL_DATE] );
176
+ unset( $target_sns_tmp[SNS_Count_Cache::REF_SHARE_TOTAL] );
177
+
178
+ $target_sns_tolerance = array();
179
+
180
+ foreach ( $target_sns_tmp as $sns => $active ){
181
+ if ( $active ) {
182
+ if ( ! isset( $data[$sns] ) || $data[$sns] === -1 ) {
183
+ $target_sns_tolerance[$sns] = true;
184
+ }
185
+ }
186
+ }
187
+
188
+ if ( ! empty( $target_sns_tolerance) ) {
189
+ $current_data = $this->get_current_cache( $options );
190
+
191
+ foreach ( $target_sns_tolerance as $sns => $active ){
192
+ if ( $active ) {
193
+ if ( isset( $current_data[$sns] ) && $current_data[$sns] >= 0 ) {
194
+ $data[$sns] = $current_data[$sns];
195
+ }
196
+ }
197
+ }
198
+
199
+ $total = 0;
200
+
201
+ foreach ( $target_sns_tmp as $sns => $active ){
202
+ if ( $active ) {
203
+ if ( isset( $data[$sns] ) && $data[$sns] >= 0 ) {
204
+ $total = $total + $data[$sns];
205
+ }
206
+ }
207
+ }
208
+
209
+ $data[SNS_Count_Cache::REF_SHARE_TOTAL] = $total;
210
+ }
211
+ }
212
+
213
+ SCC_Common_Util::log( $data );
214
 
215
  if ( $data ) {
216
+ $throttle = new SCC_Sleep_Throttle( $this->load_ratio );
217
 
218
  $throttle->reset();
219
  $throttle->start();
225
 
226
  while ( true ) {
227
 
228
+ SCC_Common_Util::log( '[' . __METHOD__ . '] set_transient result (' . $cache_key . '): ' . $result );
229
 
230
  if ( $result ) {
231
  break;
232
  } else {
233
  if ( $retry_count < $this->retry_limit ) {
234
+ SCC_Common_Util::log( '[' . __METHOD__ . '] sleep before set_transient retry (' . $cache_key . '): ' . $throttle->get_sleep_time() . ' sec.' );
235
 
236
  $throttle->sleep();
237
  ++$retry_count;
238
 
239
+ SCC_Common_Util::log( '[' . __METHOD__ . '] count of set_transient retry (' . $cache_key . '): ' . $retry_count );
240
 
241
  $throttle->reset();
242
  $throttle->start();
245
 
246
  $throttle->stop();
247
  } else {
248
+ SCC_Common_Util::log( '[' . __METHOD__ . '] set_transient result (' . $cache_key . '): retry failed' );
249
  break;
250
  }
251
  }
252
  }
253
  }
254
 
255
+ SCC_Common_Util::log( '[' . __METHOD__ . '] current memory usage: ' . round( memory_get_usage( true )/1024/1024, 2 ) . ' MB' );
256
+ SCC_Common_Util::log( '[' . __METHOD__ . '] max memory usage: ' . round( memory_get_peak_usage( true )/1024/1024, 2 ) . ' MB' );
257
 
258
  return $data;
259
  }
264
  * @since 0.9.0
265
  */
266
  private function get_data( $target_sns, $target_url ) {
267
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
268
 
269
  $target_sns_base = $target_sns;
270
 
284
  return $this->crawler->get_data( $target_sns, NULL );
285
  }
286
 
287
+ /**
288
+ * Get current cache
289
+ *
290
+ * @since 0.9.3
291
+ */
292
+ abstract protected function get_current_cache( $options = array() );
293
+
294
  }
295
 
296
  ?>
includes/{class-share-crawler.php → class-scc-share-crawler.php} RENAMED
@@ -1,303 +1,307 @@
1
- <?php
2
- /*
3
- class-share-crawler.php
4
-
5
- Description: This class is a data crawler whitch get share count using given API and cURL
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- class Share_Crawler extends Crawler {
31
-
32
- /**
33
- * Initialization
34
- *
35
- * @since 0.5.1
36
- */
37
- public function initialize( $options = array() ) {
38
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
39
-
40
- //$this->throttle = new Sleep_Throttle( 0.9 );
41
-
42
- if ( isset( $options['target_sns'] ) ) $this->target_sns = $options['target_sns'];
43
- if ( isset( $options['crawl_method'] ) ) $this->crawl_method = $options['crawl_method'];
44
- if ( isset( $options['timeout'] ) ) $this->timeout = $options['timeout'];
45
- if ( isset( $options['ssl_verification'] ) ) $this->ssl_verification = $options['ssl_verification'];
46
- if ( isset( $options['crawl_retry'] ) ) $this->crawl_retry = $options['crawl_retry'];
47
- if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
48
-
49
- $target_sns = $this->target_sns;
50
-
51
- unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
52
- unset( $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] );
53
-
54
- foreach ( $target_sns as $sns => $active ) {
55
- if ( $active ) {
56
- $this->crawl_strategies[$sns] = $this->create_crawl_strategy( $sns );
57
- }
58
- }
59
-
60
- }
61
-
62
- /**
63
- * Carete crawl strategy
64
- *
65
- * @since 0.9.0
66
- */
67
- private function create_crawl_strategy( $sns ) {
68
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
69
-
70
- switch ( $sns ) {
71
- case SNS_Count_Cache::REF_SHARE_TWITTER:
72
- Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
73
- return Share_Twitter_Strategy::get_instance();
74
- break;
75
- case SNS_Count_Cache::REF_SHARE_FACEBOOK:
76
- Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
77
- return Share_Facebook_Strategy::get_instance();
78
- break;
79
- case SNS_Count_Cache::REF_SHARE_GPLUS:
80
- Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
81
- return Share_Google_Strategy::get_instance();
82
- break;
83
- case SNS_Count_Cache::REF_SHARE_POCKET:
84
- Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
85
- return Share_Pocket_Strategy::get_instance();
86
- break;
87
- case SNS_Count_Cache::REF_SHARE_HATEBU:
88
- Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
89
- return Share_Hatebu_Strategy::get_instance();
90
- break;
91
- }
92
- }
93
-
94
- /**
95
- * Check configuration
96
- *
97
- * @since 0.9.0
98
- */
99
- private function check_configurations( $target_sns ) {
100
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
101
-
102
- //$checked_target_sns = array();
103
-
104
- unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
105
- unset( $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] );
106
-
107
- Common_Util::log( $target_sns );
108
-
109
- foreach ( $target_sns as $sns => $active ) {
110
- if ( $active ) {
111
- $target_sns[$sns] = $this->crawl_strategies[$sns]->check_configuration();
112
- }
113
- }
114
-
115
- $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] = true;
116
- $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] = true;
117
-
118
- return $target_sns;
119
-
120
- }
121
-
122
- /**
123
- * Implementation of abstract method. this method gets each share count
124
- *
125
- * @since 0.1.1
126
- */
127
- public function get_data( $target_sns, $options ) {
128
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
129
-
130
- Common_Util::log( $target_sns );
131
-
132
- $target_sns = $this->check_configurations( $target_sns );
133
- Common_Util::log( $target_sns );
134
-
135
- $query_urls = $this->build_query_urls( $target_sns );
136
- Common_Util::log( $query_urls );
137
-
138
- $query_headers = $this->build_query_headers( $target_sns );
139
- Common_Util::log( $query_headers );
140
-
141
- $data = array();
142
-
143
- $throttle = new Sleep_Throttle( 0.9 );
144
- $throttle->reset();
145
- $throttle->start();
146
-
147
- if ( $this->crawl_method === SNS_Count_Cache::OPT_COMMON_CRAWLER_METHOD_CURL ) {
148
- $data = Common_Util::multi_remote_get( $query_urls, $query_headers, $this->timeout, $this->ssl_verification, true );
149
- } else {
150
- $data = Common_Util::multi_remote_get( $query_urls, $query_headers, $this->timeout, $this->ssl_verification, false );
151
- }
152
-
153
- $throttle->stop();
154
- $retry_count = 0;
155
-
156
- while( true ) {
157
- $target_sns_retry = array();
158
- $tmp_count = $this->extract_count( $target_sns, $data );
159
-
160
- foreach ( $target_sns as $sns => $active ){
161
- if ( $active ) {
162
- if( $tmp_count[$sns] === -1 ) {
163
- $target_sns_retry[$sns] = true;
164
- }
165
- }
166
- }
167
-
168
- if ( empty( $target_sns_retry ) ) {
169
- break;
170
- } else {
171
- Common_Util::log( '[' . __METHOD__ . '] crawl failure' );
172
- Common_Util::log( $target_sns_retry );
173
-
174
- if ( $retry_count < $this->retry_limit ) {
175
- Common_Util::log( '[' . __METHOD__ . '] sleep before crawl retry: ' . $throttle->get_sleep_time() . ' sec.' );
176
-
177
- $throttle->sleep();
178
-
179
- ++$retry_count;
180
- Common_Util::log( '[' . __METHOD__ . '] count of crawl retry: ' . $retry_count );
181
-
182
- $query_urls_retry = $this->build_query_urls( $target_sns_retry );
183
- $query_headers_retry = $this->build_query_headers( $target_sns_retry );
184
-
185
- $data_retry = array();
186
-
187
- $throttle->reset();
188
- $throttle->start();
189
-
190
- if ( $this->crawl_method === SNS_Count_Cache::OPT_COMMON_CRAWLER_METHOD_CURL ) {
191
- $data_retry = Common_Util::multi_remote_get( $query_urls_retry, $query_headers_retry, $this->timeout, $this->ssl_verification, true );
192
- } else {
193
- $data_retry = Common_Util::multi_remote_get( $query_urls_retry, $query_headers_retry, $this->timeout, $this->ssl_verification, false );
194
- }
195
-
196
- $throttle->stop();
197
- $data = array_merge( $data, $data_retry );
198
- } else {
199
- Common_Util::log( '[' . __METHOD__ . '] crawling: retry failed' );
200
- break;
201
- }
202
- }
203
- }
204
-
205
- return $this->extract_count( $target_sns, $data );
206
- }
207
-
208
- /**
209
- * build query
210
- *
211
- * @since 0.5.1
212
- */
213
- private function build_query_urls( $target_sns ) {
214
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
215
-
216
- $query_urls = array();
217
-
218
- unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
219
- unset( $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] );
220
-
221
- Common_Util::log( $target_sns );
222
-
223
- foreach ( $target_sns as $sns => $active ) {
224
- if ( $active ) {
225
- $query_urls[$sns] = $this->crawl_strategies[$sns]->build_query_url();
226
- }
227
- }
228
-
229
- return $query_urls;
230
- }
231
-
232
- /**
233
- * build query
234
- *
235
- * @since 0.5.1
236
- */
237
- private function build_query_headers( $target_sns ) {
238
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
239
-
240
- $query_headers = array();
241
-
242
- unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
243
- unset( $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] );
244
-
245
- Common_Util::log( $target_sns );
246
-
247
- foreach ( $target_sns as $sns => $active ) {
248
- if ( $active ) {
249
- $query_headers[$sns] = $this->crawl_strategies[$sns]->build_header();
250
- }
251
- }
252
-
253
- return $query_headers;
254
- }
255
-
256
- /**
257
- * extract count data from retrieved content
258
- *
259
- * @since 0.5.1
260
- */
261
- private function extract_count( $target_sns, $contents ) {
262
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
263
-
264
- $sns_counts = array();
265
-
266
- $extract_date = date_i18n( 'Y/m/d H:i:s' );
267
-
268
- Common_Util::log( $contents );
269
-
270
- foreach ( $target_sns as $sns => $active ) {
271
- if ( $active ) {
272
- if ( isset( $contents[$sns] ) ) {
273
- $sns_counts[$sns] = $this->crawl_strategies[$sns]->extract_count( $contents[$sns] );
274
- } else {
275
- $sns_counts[$sns] = (int) -1;
276
- }
277
- }
278
- }
279
-
280
- if ( isset( $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] ) && $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] ) {
281
- $total = 0;
282
-
283
- foreach ( $sns_counts as $sns => $count ) {
284
- if ( isset( $count ) && $count >= 0 ) {
285
- $total = $total + $count;
286
- }
287
- }
288
-
289
- $sns_counts[SNS_Count_Cache::REF_SHARE_TOTAL] = (int) $total;
290
- }
291
-
292
- if ( isset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] ) && $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] ) {
293
- $sns_counts[SNS_Count_Cache::REF_CRAWL_DATE] = $extract_date;
294
- } else {
295
- $sns_counts[SNS_Count_Cache::REF_CRAWL_DATE] = '';
296
- }
297
-
298
- return $sns_counts;
299
- }
300
-
301
- }
302
-
303
- ?>
 
 
 
 
1
+ <?php
2
+ /*
3
+ class-scc-share-crawler.php
4
+
5
+ Description: This class is a data crawler whitch get share count using given API and cURL
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ class SCC_Share_Crawler extends SCC_Crawler {
31
+
32
+ /**
33
+ * Initialization
34
+ *
35
+ * @since 0.5.1
36
+ */
37
+ public function initialize( $options = array() ) {
38
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
39
+
40
+ //$this->throttle = new Sleep_Throttle( 0.9 );
41
+
42
+ if ( isset( $options['target_sns'] ) ) $this->target_sns = $options['target_sns'];
43
+ if ( isset( $options['crawl_method'] ) ) $this->crawl_method = $options['crawl_method'];
44
+ if ( isset( $options['timeout'] ) ) $this->timeout = $options['timeout'];
45
+ if ( isset( $options['ssl_verification'] ) ) $this->ssl_verification = $options['ssl_verification'];
46
+ if ( isset( $options['crawl_retry'] ) ) $this->crawl_retry = $options['crawl_retry'];
47
+ if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
48
+
49
+ $target_sns = $this->target_sns;
50
+
51
+ unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
52
+ unset( $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] );
53
+
54
+ foreach ( $target_sns as $sns => $active ) {
55
+ if ( $active ) {
56
+ $this->crawl_strategies[$sns] = $this->create_crawl_strategy( $sns );
57
+ }
58
+ }
59
+
60
+ }
61
+
62
+ /**
63
+ * Carete crawl strategy
64
+ *
65
+ * @since 0.9.0
66
+ */
67
+ private function create_crawl_strategy( $sns ) {
68
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
69
+
70
+ switch ( $sns ) {
71
+ case SNS_Count_Cache::REF_SHARE_TWITTER:
72
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
73
+ return SCC_Share_Twitter_Strategy::get_instance();
74
+ break;
75
+ case SNS_Count_Cache::REF_SHARE_FACEBOOK:
76
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
77
+ return SCC_Share_Facebook_Strategy::get_instance();
78
+ break;
79
+ case SNS_Count_Cache::REF_SHARE_GPLUS:
80
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
81
+ return SCC_Share_Google_Strategy::get_instance();
82
+ break;
83
+ case SNS_Count_Cache::REF_SHARE_POCKET:
84
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
85
+ return SCC_Share_Pocket_Strategy::get_instance();
86
+ break;
87
+ case SNS_Count_Cache::REF_SHARE_HATEBU:
88
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
89
+ return SCC_Share_Hatebu_Strategy::get_instance();
90
+ break;
91
+ case SNS_Count_Cache::REF_SHARE_PINTEREST:
92
+ SCC_Common_Util::log( '[' . __METHOD__ . '] create crawl strategy: ' . $sns );
93
+ return SCC_Share_Pinterest_Strategy::get_instance();
94
+ break;
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Check configuration
100
+ *
101
+ * @since 0.9.0
102
+ */
103
+ private function check_configurations( $target_sns ) {
104
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
105
+
106
+ //$checked_target_sns = array();
107
+
108
+ unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
109
+ unset( $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] );
110
+
111
+ SCC_Common_Util::log( $target_sns );
112
+
113
+ foreach ( $target_sns as $sns => $active ) {
114
+ if ( $active ) {
115
+ $target_sns[$sns] = $this->crawl_strategies[$sns]->check_configuration();
116
+ }
117
+ }
118
+
119
+ $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] = true;
120
+ $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] = true;
121
+
122
+ return $target_sns;
123
+
124
+ }
125
+
126
+ /**
127
+ * Implementation of abstract method. this method gets each share count
128
+ *
129
+ * @since 0.1.1
130
+ */
131
+ public function get_data( $target_sns, $options ) {
132
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
133
+
134
+ SCC_Common_Util::log( $target_sns );
135
+
136
+ $valid_target_sns = $this->check_configurations( $target_sns );
137
+ SCC_Common_Util::log( $valid_target_sns );
138
+
139
+ $query_urls = $this->build_query_urls( $valid_target_sns );
140
+ SCC_Common_Util::log( $query_urls );
141
+
142
+ $query_headers = $this->build_query_headers( $valid_target_sns );
143
+ SCC_Common_Util::log( $query_headers );
144
+
145
+ $data = array();
146
+
147
+ $throttle = new SCC_Sleep_Throttle( 0.9 );
148
+ $throttle->reset();
149
+ $throttle->start();
150
+
151
+ if ( $this->crawl_method === SNS_Count_Cache::OPT_COMMON_CRAWLER_METHOD_CURL ) {
152
+ $data = SCC_Common_Util::multi_remote_get( $query_urls, $query_headers, $this->timeout, $this->ssl_verification, true );
153
+ } else {
154
+ $data = SCC_Common_Util::multi_remote_get( $query_urls, $query_headers, $this->timeout, $this->ssl_verification, false );
155
+ }
156
+
157
+ $throttle->stop();
158
+ $retry_count = 0;
159
+
160
+ while( true ) {
161
+ $target_sns_retry = array();
162
+ $tmp_count = $this->extract_count( $valid_target_sns, $data );
163
+
164
+ foreach ( $valid_target_sns as $sns => $active ){
165
+ if ( $active ) {
166
+ if( $tmp_count[$sns] === -1 ) {
167
+ $target_sns_retry[$sns] = true;
168
+ }
169
+ }
170
+ }
171
+
172
+ if ( empty( $target_sns_retry ) ) {
173
+ break;
174
+ } else {
175
+ SCC_Common_Util::log( '[' . __METHOD__ . '] crawl failure' );
176
+ SCC_Common_Util::log( $target_sns_retry );
177
+
178
+ if ( $retry_count < $this->retry_limit ) {
179
+ SCC_Common_Util::log( '[' . __METHOD__ . '] sleep before crawl retry: ' . $throttle->get_sleep_time() . ' sec.' );
180
+
181
+ $throttle->sleep();
182
+
183
+ ++$retry_count;
184
+ SCC_Common_Util::log( '[' . __METHOD__ . '] count of crawl retry: ' . $retry_count );
185
+
186
+ $query_urls_retry = $this->build_query_urls( $target_sns_retry );
187
+ $query_headers_retry = $this->build_query_headers( $target_sns_retry );
188
+
189
+ $data_retry = array();
190
+
191
+ $throttle->reset();
192
+ $throttle->start();
193
+
194
+ if ( $this->crawl_method === SNS_Count_Cache::OPT_COMMON_CRAWLER_METHOD_CURL ) {
195
+ $data_retry = SCC_Common_Util::multi_remote_get( $query_urls_retry, $query_headers_retry, $this->timeout, $this->ssl_verification, true );
196
+ } else {
197
+ $data_retry = SCC_Common_Util::multi_remote_get( $query_urls_retry, $query_headers_retry, $this->timeout, $this->ssl_verification, false );
198
+ }
199
+
200
+ $throttle->stop();
201
+ $data = array_merge( $data, $data_retry );
202
+ } else {
203
+ SCC_Common_Util::log( '[' . __METHOD__ . '] crawl retry ended' );
204
+ break;
205
+ }
206
+ }
207
+ }
208
+
209
+ return $this->extract_count( $target_sns, $data );
210
+ }
211
+
212
+ /**
213
+ * build query
214
+ *
215
+ * @since 0.5.1
216
+ */
217
+ private function build_query_urls( $target_sns ) {
218
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
219
+
220
+ $query_urls = array();
221
+
222
+ unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
223
+ unset( $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] );
224
+
225
+ SCC_Common_Util::log( $target_sns );
226
+
227
+ foreach ( $target_sns as $sns => $active ) {
228
+ if ( $active ) {
229
+ $query_urls[$sns] = $this->crawl_strategies[$sns]->build_query_url();
230
+ }
231
+ }
232
+
233
+ return $query_urls;
234
+ }
235
+
236
+ /**
237
+ * build query
238
+ *
239
+ * @since 0.5.1
240
+ */
241
+ private function build_query_headers( $target_sns ) {
242
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
243
+
244
+ $query_headers = array();
245
+
246
+ unset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] );
247
+ unset( $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] );
248
+
249
+ SCC_Common_Util::log( $target_sns );
250
+
251
+ foreach ( $target_sns as $sns => $active ) {
252
+ if ( $active ) {
253
+ $query_headers[$sns] = $this->crawl_strategies[$sns]->build_header();
254
+ }
255
+ }
256
+
257
+ return $query_headers;
258
+ }
259
+
260
+ /**
261
+ * extract count data from retrieved content
262
+ *
263
+ * @since 0.5.1
264
+ */
265
+ private function extract_count( $target_sns, $contents ) {
266
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
267
+
268
+ $sns_counts = array();
269
+
270
+ $extract_date = date_i18n( 'Y/m/d H:i:s' );
271
+
272
+ SCC_Common_Util::log( $contents );
273
+
274
+ foreach ( $target_sns as $sns => $active ) {
275
+ if ( $active ) {
276
+ if ( isset( $contents[$sns] ) ) {
277
+ $sns_counts[$sns] = $this->crawl_strategies[$sns]->extract_count( $contents[$sns] );
278
+ } else {
279
+ $sns_counts[$sns] = (int) -1;
280
+ }
281
+ }
282
+ }
283
+
284
+ if ( isset( $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] ) && $target_sns[SNS_Count_Cache::REF_SHARE_TOTAL] ) {
285
+ $total = 0;
286
+
287
+ foreach ( $sns_counts as $sns => $count ) {
288
+ if ( isset( $count ) && $count >= 0 ) {
289
+ $total = $total + $count;
290
+ }
291
+ }
292
+
293
+ $sns_counts[SNS_Count_Cache::REF_SHARE_TOTAL] = (int) $total;
294
+ }
295
+
296
+ if ( isset( $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] ) && $target_sns[SNS_Count_Cache::REF_CRAWL_DATE] ) {
297
+ $sns_counts[SNS_Count_Cache::REF_CRAWL_DATE] = $extract_date;
298
+ } else {
299
+ $sns_counts[SNS_Count_Cache::REF_CRAWL_DATE] = '';
300
+ }
301
+
302
+ return $sns_counts;
303
+ }
304
+
305
+ }
306
+
307
+ ?>
includes/{class-share-facebook-strategy.php → class-scc-share-facebook-strategy.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-facebook-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Share_Facebook_Strategy extends Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
@@ -40,7 +40,7 @@ class Share_Facebook_Strategy extends Crawl_Strategy {
40
  *
41
  */
42
  protected function __construct() {
43
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
@@ -51,7 +51,7 @@ class Share_Facebook_Strategy extends Crawl_Strategy {
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
@@ -64,7 +64,7 @@ class Share_Facebook_Strategy extends Crawl_Strategy {
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
@@ -74,7 +74,7 @@ class Share_Facebook_Strategy extends Crawl_Strategy {
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
80
 
@@ -87,7 +87,7 @@ class Share_Facebook_Strategy extends Crawl_Strategy {
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
@@ -121,9 +121,11 @@ class Share_Facebook_Strategy extends Crawl_Strategy {
121
  * @since 0.9.0
122
  */
123
  public function check_configuration() {
124
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
125
 
126
- if ( isset( $this->query_parameters['id'] ) && $this->query_parameters['id'] ) {
 
 
127
  return true;
128
  } else {
129
  return false;
1
  <?php
2
  /*
3
+ class-scc-share-facebook-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Share_Facebook_Strategy extends SCC_Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
40
  *
41
  */
42
  protected function __construct() {
43
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
80
 
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
121
  * @since 0.9.0
122
  */
123
  public function check_configuration() {
124
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
125
 
126
+ if ( isset( $this->parameters['app_id'] ) && $this->parameters['app_id'] &&
127
+ isset( $this->parameters['app_secret'] ) && $this->parameters['app_secret'] &&
128
+ isset( $this->query_parameters['access_token'] ) && $this->query_parameters['access_token'] ) {
129
  return true;
130
  } else {
131
  return false;
includes/{class-share-google-strategy.php → class-scc-share-google-strategy.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-google-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Share_Google_Strategy extends Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
@@ -40,7 +40,7 @@ class Share_Google_Strategy extends Crawl_Strategy {
40
  *
41
  */
42
  protected function __construct() {
43
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
44
 
45
  $this->method = 'GET';
46
  }
@@ -51,7 +51,7 @@ class Share_Google_Strategy extends Crawl_Strategy {
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
@@ -64,7 +64,7 @@ class Share_Google_Strategy extends Crawl_Strategy {
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
@@ -74,7 +74,7 @@ class Share_Google_Strategy extends Crawl_Strategy {
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters, '' , '&' );
80
 
@@ -87,7 +87,7 @@ class Share_Google_Strategy extends Crawl_Strategy {
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
@@ -112,7 +112,7 @@ class Share_Google_Strategy extends Crawl_Strategy {
112
  * @since 0.9.0
113
  */
114
  public function check_configuration() {
115
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
116
 
117
  if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
118
  return true;
1
  <?php
2
  /*
3
+ class-scc-share-google-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Share_Google_Strategy extends SCC_Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
40
  *
41
  */
42
  protected function __construct() {
43
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
44
 
45
  $this->method = 'GET';
46
  }
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters, '' , '&' );
80
 
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
112
  * @since 0.9.0
113
  */
114
  public function check_configuration() {
115
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
116
 
117
  if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
118
  return true;
includes/{class-share-hatebu-strategy.php → class-scc-share-hatebu-strategy.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-hatebu-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Share_Hatebu_Strategy extends Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
@@ -40,7 +40,7 @@ class Share_Hatebu_Strategy extends Crawl_Strategy {
40
  *
41
  */
42
  protected function __construct() {
43
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
@@ -51,7 +51,7 @@ class Share_Hatebu_Strategy extends Crawl_Strategy {
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
@@ -64,7 +64,7 @@ class Share_Hatebu_Strategy extends Crawl_Strategy {
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
@@ -74,7 +74,7 @@ class Share_Hatebu_Strategy extends Crawl_Strategy {
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
80
 
@@ -87,7 +87,7 @@ class Share_Hatebu_Strategy extends Crawl_Strategy {
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
@@ -108,7 +108,7 @@ class Share_Hatebu_Strategy extends Crawl_Strategy {
108
  * @since 0.9.0
109
  */
110
  public function check_configuration() {
111
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
112
 
113
  if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
114
  return true;
1
  <?php
2
  /*
3
+ class-scc-share-hatebu-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Share_Hatebu_Strategy extends SCC_Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
40
  *
41
  */
42
  protected function __construct() {
43
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  }
51
  * @since 0.9.0
52
  */
53
  public function initialize( $options = array() ) {
54
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
 
56
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
64
  * @since 0.9.0
65
  */
66
  public function build_header() {
67
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
  return null;
69
  }
70
 
74
  * @since 0.9.0
75
  */
76
  public function build_query_url() {
77
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
 
79
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
80
 
87
  * @since 0.9.0
88
  */
89
  public function extract_count( $content ) {
90
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
 
92
  $count = (int) -1;
93
 
108
  * @since 0.9.0
109
  */
110
  public function check_configuration() {
111
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
112
 
113
  if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
114
  return true;
includes/{class-share-lazy-cache-engine.php → class-scc-share-lazy-cache-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-lazy-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
@@ -75,7 +75,7 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
75
  * @since 0.1.1
76
  */
77
  public function initialize( $options = array() ) {
78
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
79
 
80
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
81
  $this->prime_cron = self::DEF_PRIME_CRON;
@@ -99,6 +99,7 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
99
  if ( isset( $options['scheme_migration_exclude_keys'] ) ) $this->scheme_migration_exclude_keys = $options['scheme_migration_exclude_keys'];
100
  if ( isset( $options['cache_retry'] ) ) $this->cache_retry = $options['cache_retry'];
101
  if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
 
102
 
103
  add_action( $this->execute_cron, array( $this, 'execute_cache' ), 10, 1 );
104
  }
@@ -109,7 +110,7 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
109
  * @since 0.1.0
110
  */
111
  public function register_schedule() {
112
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
113
  }
114
 
115
  /**
@@ -118,9 +119,9 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
118
  * @since 0.1.0
119
  */
120
  public function unregister_schedule() {
121
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
122
 
123
- WP_Cron_Util::clear_scheduled_hook( $this->execute_cron );
124
  }
125
 
126
  /**
@@ -129,12 +130,12 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
129
  * @since 0.2.0
130
  */
131
  public function prime_cache( $post_ID ) {
132
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
133
 
134
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
135
 
136
- Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
137
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
138
 
139
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( $post_ID ) );
140
  }
@@ -145,11 +146,11 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
145
  * @since 0.2.0
146
  */
147
  public function execute_cache( $post_ID ) {
148
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
149
 
150
  $cache_expiration = $this->get_cache_expiration();
151
 
152
- Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
153
 
154
  $transient_id = $this->get_cache_key( $post_ID );
155
 
@@ -174,7 +175,7 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
174
  $this->cache( $options );
175
 
176
  // Secondary cache
177
- $this->delegate_cache( $options );
178
  }
179
 
180
  /**
@@ -183,11 +184,11 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
183
  * @since 0.1.1
184
  */
185
  protected function get_cache_expiration() {
186
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
187
 
188
  $posts_total = $this->get_posts_total();
189
 
190
- Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
191
 
192
  return ceil( $posts_total / $this->posts_per_check ) * $this->check_interval * 3;
193
  }
@@ -198,7 +199,7 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
198
  * @since 0.1.0
199
  */
200
  private function get_posts_total() {
201
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
202
 
203
  $query_args = array(
204
  'post_type' => $this->post_types,
@@ -219,7 +220,7 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
219
  * @since 0.3.0
220
  */
221
  public function initialize_cache() {
222
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
223
  }
224
 
225
  /**
@@ -228,9 +229,29 @@ class Share_Lazy_Cache_Engine extends Share_Cache_Engine {
228
  * @since 0.3.0
229
  */
230
  public function clear_cache() {
231
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
232
  }
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  }
235
 
236
  ?>
1
  <?php
2
  /*
3
+ class-scc-share-lazy-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Share_Lazy_Cache_Engine extends SCC_Share_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
75
  * @since 0.1.1
76
  */
77
  public function initialize( $options = array() ) {
78
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
79
 
80
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
81
  $this->prime_cron = self::DEF_PRIME_CRON;
99
  if ( isset( $options['scheme_migration_exclude_keys'] ) ) $this->scheme_migration_exclude_keys = $options['scheme_migration_exclude_keys'];
100
  if ( isset( $options['cache_retry'] ) ) $this->cache_retry = $options['cache_retry'];
101
  if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
102
+ if ( isset( $options['fault_tolerance'] ) ) $this->fault_tolerance = $options['fault_tolerance'];
103
 
104
  add_action( $this->execute_cron, array( $this, 'execute_cache' ), 10, 1 );
105
  }
110
  * @since 0.1.0
111
  */
112
  public function register_schedule() {
113
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
114
  }
115
 
116
  /**
119
  * @since 0.1.0
120
  */
121
  public function unregister_schedule() {
122
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
123
 
124
+ SCC_WP_Cron_Util::clear_scheduled_hook( $this->execute_cron );
125
  }
126
 
127
  /**
130
  * @since 0.2.0
131
  */
132
  public function prime_cache( $post_ID ) {
133
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
134
 
135
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
136
 
137
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
138
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
139
 
140
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( $post_ID ) );
141
  }
146
  * @since 0.2.0
147
  */
148
  public function execute_cache( $post_ID ) {
149
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
150
 
151
  $cache_expiration = $this->get_cache_expiration();
152
 
153
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
154
 
155
  $transient_id = $this->get_cache_key( $post_ID );
156
 
175
  $this->cache( $options );
176
 
177
  // Secondary cache
178
+ $this->delegate_order( SCC_Order::ORDER_DO_SECOND_CACHE, $options );
179
  }
180
 
181
  /**
184
  * @since 0.1.1
185
  */
186
  protected function get_cache_expiration() {
187
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
188
 
189
  $posts_total = $this->get_posts_total();
190
 
191
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
192
 
193
  return ceil( $posts_total / $this->posts_per_check ) * $this->check_interval * 3;
194
  }
199
  * @since 0.1.0
200
  */
201
  private function get_posts_total() {
202
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
203
 
204
  $query_args = array(
205
  'post_type' => $this->post_types,
220
  * @since 0.3.0
221
  */
222
  public function initialize_cache() {
223
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
224
  }
225
 
226
  /**
229
  * @since 0.3.0
230
  */
231
  public function clear_cache() {
232
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
233
  }
234
 
235
+ /**
236
+ * Get current cache
237
+ *
238
+ * @since 0.9.3
239
+ */
240
+ protected function get_current_cache( $options = array() ) {
241
+ $post_id = $options['post_id'];
242
+
243
+ $transient_id = $this->get_cache_key( $post_id );
244
+
245
+ $sns_counts = array();
246
+
247
+ if ( false !== ( $sns_counts = get_transient( $transient_id ) ) ) {
248
+ return $sns_counts;
249
+ } else {
250
+ return $this->delegate_order( SCC_Order::ORDER_GET_SECOND_CACHE, $options );
251
+ }
252
+ }
253
+
254
+
255
  }
256
 
257
  ?>
includes/class-scc-share-pinterest-strategy.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ class-scc-share-pinterest-strategy.php
4
+
5
+ Description: This class is abstract class of a data crawler
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ class SCC_Share_Pinterest_Strategy extends SCC_Crawl_Strategy {
31
+
32
+ /**
33
+ * SNS base url
34
+ */
35
+ const DEF_BASE_URL = 'https://api.pinterest.com/v1/urls/count.json';
36
+
37
+ /**
38
+ * Class constarctor
39
+ * Hook onto all of the actions and filters needed by the plugin.
40
+ *
41
+ */
42
+ protected function __construct() {
43
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
+
45
+ $this->method = 'GET';
46
+ }
47
+
48
+ /**
49
+ * Initialization
50
+ *
51
+ * @since 0.9.0
52
+ */
53
+ public function initialize( $options = array() ) {
54
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
55
+
56
+ if ( isset( $options['url'] ) ) $this->url = $options['url'];
57
+ if ( isset( $options['method'] ) ) $this->method = $options['method'];
58
+ if ( isset( $options['parameters'] ) ) $this->parameters = $options['parameters'];
59
+ }
60
+
61
+ /**
62
+ * Build header
63
+ *
64
+ * @since 0.9.0
65
+ */
66
+ public function build_header() {
67
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
68
+ return null;
69
+ }
70
+
71
+ /**
72
+ * Build query url
73
+ *
74
+ * @since 0.9.0
75
+ */
76
+ public function build_query_url() {
77
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
78
+
79
+ $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
80
+
81
+ return $url;
82
+ }
83
+
84
+ /**
85
+ * Extract count
86
+ *
87
+ * @since 0.9.0
88
+ */
89
+ public function extract_count( $content ) {
90
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
91
+
92
+ $count = (int) -1;
93
+
94
+ if ( isset( $content['data'] ) && empty( $content['error'] ) ) {
95
+
96
+ $data = rtrim( $content['data'], ');' );
97
+ $data = ltrim( $data, 'receiveCount(' );
98
+
99
+ $json = json_decode( $data, true );
100
+
101
+ if ( isset( $json['count'] ) && is_numeric( $json['count'] ) ) {
102
+ $count = (int) $json['count'];
103
+ } else {
104
+ $count = (int) -1;
105
+ }
106
+ } else {
107
+ $count = (int) -1;
108
+ }
109
+
110
+ return $count;
111
+ }
112
+
113
+ /**
114
+ * Check if required paramters are included or not.
115
+ *
116
+ * @since 0.9.0
117
+ */
118
+ public function check_configuration() {
119
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
120
+
121
+ if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
122
+ return true;
123
+ } else {
124
+ return false;
125
+ }
126
+ }
127
+
128
+ }
includes/{class-share-pocket-strategy.php → class-scc-share-pocket-strategy.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-pocket-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Share_Pocket_Strategy extends Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
@@ -40,7 +40,7 @@ class Share_Pocket_Strategy extends Crawl_Strategy {
40
  *
41
  */
42
  protected function __construct() {
43
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  $this->query_parameters['v'] = '1';
@@ -53,7 +53,7 @@ class Share_Pocket_Strategy extends Crawl_Strategy {
53
  * @since 0.9.0
54
  */
55
  public function initialize( $options = array() ) {
56
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
57
 
58
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
59
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
@@ -66,7 +66,7 @@ class Share_Pocket_Strategy extends Crawl_Strategy {
66
  * @since 0.9.0
67
  */
68
  public function build_header() {
69
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
70
  return null;
71
  }
72
 
@@ -76,7 +76,7 @@ class Share_Pocket_Strategy extends Crawl_Strategy {
76
  * @since 0.9.0
77
  */
78
  public function build_query_url() {
79
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
80
 
81
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
82
 
@@ -89,7 +89,7 @@ class Share_Pocket_Strategy extends Crawl_Strategy {
89
  * @since 0.9.0
90
  */
91
  public function extract_count( $content ) {
92
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
93
 
94
  $count = (int) -1;
95
 
@@ -115,7 +115,7 @@ class Share_Pocket_Strategy extends Crawl_Strategy {
115
  * @since 0.9.0
116
  */
117
  public function check_configuration() {
118
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
119
 
120
  if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
121
  return true;
1
  <?php
2
  /*
3
+ class-scc-share-pocket-strategy.php
4
 
5
  Description: This class is abstract class of a data crawler
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Share_Pocket_Strategy extends SCC_Crawl_Strategy {
31
 
32
  /**
33
  * SNS base url
40
  *
41
  */
42
  protected function __construct() {
43
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
44
 
45
  $this->method = 'GET';
46
  $this->query_parameters['v'] = '1';
53
  * @since 0.9.0
54
  */
55
  public function initialize( $options = array() ) {
56
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
57
 
58
  if ( isset( $options['url'] ) ) $this->url = $options['url'];
59
  if ( isset( $options['method'] ) ) $this->method = $options['method'];
66
  * @since 0.9.0
67
  */
68
  public function build_header() {
69
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
70
  return null;
71
  }
72
 
76
  * @since 0.9.0
77
  */
78
  public function build_query_url() {
79
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
80
 
81
  $url = self::DEF_BASE_URL . '?' . http_build_query( $this->query_parameters , '' , '&' );
82
 
89
  * @since 0.9.0
90
  */
91
  public function extract_count( $content ) {
92
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
93
 
94
  $count = (int) -1;
95
 
115
  * @since 0.9.0
116
  */
117
  public function check_configuration() {
118
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
119
 
120
  if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
121
  return true;
includes/{class-share-restore-cache-engine.php → class-scc-share-restore-cache-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-restore-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch restore cache data from second cache.
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Share_Restore_Cache_Engine extends Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
@@ -80,7 +80,7 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
80
  * @since 0.1.1
81
  */
82
  public function initialize( $options = array() ) {
83
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
84
 
85
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
86
  $this->prime_cron = self::DEF_PRIME_CRON;
@@ -105,7 +105,7 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
105
  * @since 0.1.0
106
  */
107
  public function register_schedule() {
108
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
109
  }
110
 
111
  /**
@@ -114,9 +114,9 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
114
  * @since 0.1.0
115
  */
116
  public function unregister_schedule() {
117
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
118
 
119
- WP_Cron_Util::clear_scheduled_hook( $this->execute_cron );
120
  }
121
 
122
  /**
@@ -125,12 +125,12 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
125
  * @since 0.2.0
126
  */
127
  public function prime_cache( $post_ID ) {
128
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
129
 
130
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
131
 
132
- Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
133
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
134
 
135
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( $post_ID ) );
136
  }
@@ -141,11 +141,11 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
141
  * @since 0.2.0
142
  */
143
  public function execute_cache( $post_ID ) {
144
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
145
 
146
  $cache_expiration = $this->get_cache_expiration();
147
 
148
- Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
149
 
150
  $transient_id = $this->get_cache_key( $post_ID );
151
 
@@ -165,7 +165,7 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
165
  * @since 0.1.1
166
  */
167
  public function cache( $options = array() ) {
168
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
169
 
170
  $transient_id = $options['cache_key'];
171
  $target_sns = $options['target_sns'];
@@ -214,11 +214,11 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
214
  * @since 0.1.1
215
  */
216
  protected function get_cache_expiration() {
217
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
218
 
219
  $posts_total = $this->get_posts_total();
220
 
221
- Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
222
 
223
  return ceil( $posts_total / $this->posts_per_check ) * $this->check_interval * 3;
224
  }
@@ -229,7 +229,7 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
229
  * @since 0.1.0
230
  */
231
  private function get_posts_total() {
232
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
233
 
234
  $query_args = array(
235
  'post_type' => $this->post_types,
@@ -250,7 +250,7 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
250
  * @since 0.3.0
251
  */
252
  public function initialize_cache() {
253
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
254
  }
255
 
256
  /**
@@ -259,7 +259,7 @@ class Share_Restore_Cache_Engine extends Cache_Engine {
259
  * @since 0.3.0
260
  */
261
  public function clear_cache() {
262
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
263
  }
264
 
265
  }
1
  <?php
2
  /*
3
+ class-scc-share-restore-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch restore cache data from second cache.
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Share_Restore_Cache_Engine extends SCC_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
80
  * @since 0.1.1
81
  */
82
  public function initialize( $options = array() ) {
83
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
84
 
85
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
86
  $this->prime_cron = self::DEF_PRIME_CRON;
105
  * @since 0.1.0
106
  */
107
  public function register_schedule() {
108
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
109
  }
110
 
111
  /**
114
  * @since 0.1.0
115
  */
116
  public function unregister_schedule() {
117
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
118
 
119
+ SCC_WP_Cron_Util::clear_scheduled_hook( $this->execute_cron );
120
  }
121
 
122
  /**
125
  * @since 0.2.0
126
  */
127
  public function prime_cache( $post_ID ) {
128
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
129
 
130
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_latency;
131
 
132
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_latency: ' . $this->check_latency );
133
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
134
 
135
  wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( $post_ID ) );
136
  }
141
  * @since 0.2.0
142
  */
143
  public function execute_cache( $post_ID ) {
144
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
145
 
146
  $cache_expiration = $this->get_cache_expiration();
147
 
148
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
149
 
150
  $transient_id = $this->get_cache_key( $post_ID );
151
 
165
  * @since 0.1.1
166
  */
167
  public function cache( $options = array() ) {
168
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
169
 
170
  $transient_id = $options['cache_key'];
171
  $target_sns = $options['target_sns'];
214
  * @since 0.1.1
215
  */
216
  protected function get_cache_expiration() {
217
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
218
 
219
  $posts_total = $this->get_posts_total();
220
 
221
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
222
 
223
  return ceil( $posts_total / $this->posts_per_check ) * $this->check_interval * 3;
224
  }
229
  * @since 0.1.0
230
  */
231
  private function get_posts_total() {
232
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
233
 
234
  $query_args = array(
235
  'post_type' => $this->post_types,
250
  * @since 0.3.0
251
  */
252
  public function initialize_cache() {
253
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
254
  }
255
 
256
  /**
259
  * @since 0.3.0
260
  */
261
  public function clear_cache() {
262
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
263
  }
264
 
265
  }
includes/{class-share-rush-cache-engine.php → class-scc-share-rush-cache-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-rush-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Share_Rush_Cache_Engine extends Share_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
@@ -80,7 +80,7 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
80
  * @since 0.1.1
81
  */
82
  public function initialize( $options = array() ) {
83
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
84
 
85
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
86
  $this->prime_cron = self::DEF_PRIME_CRON;
@@ -107,6 +107,7 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
107
  if ( isset( $options['scheme_migration_exclude_keys'] ) ) $this->scheme_migration_exclude_keys = $options['scheme_migration_exclude_keys'];
108
  if ( isset( $options['cache_retry'] ) ) $this->cache_retry = $options['cache_retry'];
109
  if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
 
110
 
111
  add_filter( 'cron_schedules', array( $this, 'schedule_check_interval' ) );
112
  add_action( $this->prime_cron, array( $this, 'prime_cache' ) );
@@ -119,7 +120,7 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
119
  * @since 0.1.0
120
  */
121
  public function schedule_check_interval( $schedules ) {
122
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
123
 
124
  $schedules[$this->event_schedule] = array(
125
  'interval' => $this->check_interval,
@@ -135,15 +136,15 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
135
  * @since 0.2.0
136
  */
137
  public function prime_cache() {
138
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
139
 
140
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
141
  $posts_total = $this->get_posts_total();
142
 
143
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
144
- Common_Util::log( '[' . __METHOD__ . '] posts_per_check: ' . $this->posts_per_check );
145
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
146
- Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
147
 
148
  $option_key = $this->get_cache_key($this->offset_suffix);
149
 
@@ -151,9 +152,9 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
151
  $posts_offset = 0;
152
  }
153
 
154
- Common_Util::log( '[' . __METHOD__ . '] posts_offset: ' . $posts_offset );
155
 
156
- wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( (int) $posts_offset, Common_Util::short_hash( $next_exec_time ) ) );
157
 
158
  $posts_offset = $posts_offset + $this->posts_per_check;
159
 
@@ -170,19 +171,19 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
170
  * @since 0.2.0
171
  */
172
  public function execute_cache( $posts_offset, $hash ) {
173
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
174
 
175
- Common_Util::log( '[' . __METHOD__ . '] posts_offset: ' . $posts_offset );
176
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
177
- Common_Util::log( '[' . __METHOD__ . '] posts_per_check: ' . $this->posts_per_check );
178
 
179
  $cache_expiration = $this->get_cache_expiration();
180
 
181
  $term_threshold = $this->get_new_contet_term();
182
 
183
- Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
184
 
185
- Common_Util::log( '[' . __METHOD__ . '] term_threshold: ' . $term_threshold );
186
 
187
  $query_args = array(
188
  'post_type' => $this->post_types,
@@ -206,7 +207,7 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
206
 
207
  $post_ID = get_the_ID();
208
 
209
- Common_Util::log( '[' . __METHOD__ . '] post_id: ' . $post_ID );
210
 
211
  $transient_id = $this->get_cache_key( $post_ID );
212
 
@@ -225,7 +226,7 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
225
  $this->cache( $options );
226
 
227
  // Secondary cache
228
- $this->delegate_cache( $options );
229
  }
230
  }
231
  wp_reset_postdata();
@@ -237,7 +238,7 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
237
  * @since 0.4.0
238
  */
239
  private function get_new_contet_term() {
240
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
241
 
242
  $term_threshold = '3 days ago';
243
 
@@ -256,11 +257,11 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
256
  * @since 0.2.0
257
  */
258
  protected function get_cache_expiration() {
259
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
260
 
261
  $posts_total = $this->get_posts_total();
262
 
263
- Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
264
 
265
  return ceil( $posts_total / $this->posts_per_check ) * $this->check_interval * 3;
266
  }
@@ -271,7 +272,7 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
271
  * @since 0.2.0
272
  */
273
  private function get_posts_total() {
274
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
275
 
276
  $term_threshold = $this->get_new_contet_term();
277
 
@@ -299,7 +300,7 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
299
  * @since 0.3.0
300
  */
301
  public function initialize_cache() {
302
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
303
 
304
  $option_key = $this->get_cache_key( $this->offset_suffix );
305
 
@@ -312,7 +313,7 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
312
  * @since 0.3.0
313
  */
314
  public function clear_cache() {
315
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
316
 
317
  $option_key = $this->get_cache_key( $this->offset_suffix );
318
 
@@ -320,6 +321,25 @@ class Share_Rush_Cache_Engine extends Share_Cache_Engine {
320
 
321
  }
322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  }
324
 
325
  ?>
1
  <?php
2
  /*
3
+ class-scc-share-rush-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Share_Rush_Cache_Engine extends SCC_Share_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
80
  * @since 0.1.1
81
  */
82
  public function initialize( $options = array() ) {
83
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
84
 
85
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
86
  $this->prime_cron = self::DEF_PRIME_CRON;
107
  if ( isset( $options['scheme_migration_exclude_keys'] ) ) $this->scheme_migration_exclude_keys = $options['scheme_migration_exclude_keys'];
108
  if ( isset( $options['cache_retry'] ) ) $this->cache_retry = $options['cache_retry'];
109
  if ( isset( $options['retry_limit'] ) ) $this->retry_limit = $options['retry_limit'];
110
+ if ( isset( $options['fault_tolerance'] ) ) $this->fault_tolerance = $options['fault_tolerance'];
111
 
112
  add_filter( 'cron_schedules', array( $this, 'schedule_check_interval' ) );
113
  add_action( $this->prime_cron, array( $this, 'prime_cache' ) );
120
  * @since 0.1.0
121
  */
122
  public function schedule_check_interval( $schedules ) {
123
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
124
 
125
  $schedules[$this->event_schedule] = array(
126
  'interval' => $this->check_interval,
136
  * @since 0.2.0
137
  */
138
  public function prime_cache() {
139
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
140
 
141
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
142
  $posts_total = $this->get_posts_total();
143
 
144
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
145
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_per_check: ' . $this->posts_per_check );
146
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
147
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
148
 
149
  $option_key = $this->get_cache_key($this->offset_suffix);
150
 
152
  $posts_offset = 0;
153
  }
154
 
155
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_offset: ' . $posts_offset );
156
 
157
+ wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( (int) $posts_offset, SCC_Common_Util::short_hash( $next_exec_time ) ) );
158
 
159
  $posts_offset = $posts_offset + $this->posts_per_check;
160
 
171
  * @since 0.2.0
172
  */
173
  public function execute_cache( $posts_offset, $hash ) {
174
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
175
 
176
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_offset: ' . $posts_offset );
177
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
178
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_per_check: ' . $this->posts_per_check );
179
 
180
  $cache_expiration = $this->get_cache_expiration();
181
 
182
  $term_threshold = $this->get_new_contet_term();
183
 
184
+ SCC_Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
185
 
186
+ SCC_Common_Util::log( '[' . __METHOD__ . '] term_threshold: ' . $term_threshold );
187
 
188
  $query_args = array(
189
  'post_type' => $this->post_types,
207
 
208
  $post_ID = get_the_ID();
209
 
210
+ SCC_Common_Util::log( '[' . __METHOD__ . '] post_id: ' . $post_ID );
211
 
212
  $transient_id = $this->get_cache_key( $post_ID );
213
 
226
  $this->cache( $options );
227
 
228
  // Secondary cache
229
+ $this->delegate_order( SCC_Order::ORDER_DO_SECOND_CACHE, $options );
230
  }
231
  }
232
  wp_reset_postdata();
238
  * @since 0.4.0
239
  */
240
  private function get_new_contet_term() {
241
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
242
 
243
  $term_threshold = '3 days ago';
244
 
257
  * @since 0.2.0
258
  */
259
  protected function get_cache_expiration() {
260
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
261
 
262
  $posts_total = $this->get_posts_total();
263
 
264
+ SCC_Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
265
 
266
  return ceil( $posts_total / $this->posts_per_check ) * $this->check_interval * 3;
267
  }
272
  * @since 0.2.0
273
  */
274
  private function get_posts_total() {
275
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
276
 
277
  $term_threshold = $this->get_new_contet_term();
278
 
300
  * @since 0.3.0
301
  */
302
  public function initialize_cache() {
303
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
304
 
305
  $option_key = $this->get_cache_key( $this->offset_suffix );
306
 
313
  * @since 0.3.0
314
  */
315
  public function clear_cache() {
316
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
317
 
318
  $option_key = $this->get_cache_key( $this->offset_suffix );
319
 
321
 
322
  }
323
 
324
+ /**
325
+ * Get current cache
326
+ *
327
+ * @since 0.9.3
328
+ */
329
+ protected function get_current_cache( $options = array() ) {
330
+ $post_id = $options['post_id'];
331
+
332
+ $transient_id = $this->get_cache_key( $post_id );
333
+
334
+ $sns_counts = array();
335
+
336
+ if ( false !== ( $sns_counts = get_transient( $transient_id ) ) ) {
337
+ return $sns_counts;
338
+ } else {
339
+ return $this->delegate_order( SCC_Order::ORDER_GET_SECOND_CACHE, $options );
340
+ }
341
+ }
342
+
343
  }
344
 
345
  ?>
includes/{class-share-second-cache-engine.php → class-scc-share-second-cache-engine.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- class-share-second-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
@@ -27,7 +27,7 @@ along with this program; if not, write to the Free Software
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
- class Share_Second_Cache_Engine extends Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
@@ -85,7 +85,7 @@ class Share_Second_Cache_Engine extends Cache_Engine {
85
  * @since 0.1.1
86
  */
87
  public function initialize( $options = array() ) {
88
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
89
 
90
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
91
  $this->prime_cron = self::DEF_PRIME_CRON;
@@ -116,7 +116,7 @@ class Share_Second_Cache_Engine extends Cache_Engine {
116
  * @since 0.1.0
117
  */
118
  public function schedule_check_interval( $schedules ) {
119
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
120
 
121
  $schedules[$this->event_schedule] = array(
122
  'interval' => $this->check_interval,
@@ -132,12 +132,12 @@ class Share_Second_Cache_Engine extends Cache_Engine {
132
  * @since 0.3.0
133
  */
134
  public function prime_cache() {
135
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
136
 
137
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
138
 
139
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
140
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
141
 
142
  wp_schedule_single_event( $next_exec_time, $this->execute_cron );
143
  }
@@ -148,7 +148,7 @@ class Share_Second_Cache_Engine extends Cache_Engine {
148
  * @since 0.3.0
149
  */
150
  public function execute_cache() {
151
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
152
 
153
  $query_args = array(
154
  'post_type' => $this->post_types,
@@ -189,7 +189,7 @@ class Share_Second_Cache_Engine extends Cache_Engine {
189
  * @since 0.1.1
190
  */
191
  public function cache( $options = array() ) {
192
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
193
 
194
  $transient_id = $options['cache_key'];
195
  $target_sns = $options['target_sns'];
@@ -243,8 +243,7 @@ class Share_Second_Cache_Engine extends Cache_Engine {
243
  }
244
  }
245
 
246
- // Analysis
247
- $this->delegate_analysis( $options );
248
 
249
  }
250
 
@@ -254,7 +253,7 @@ class Share_Second_Cache_Engine extends Cache_Engine {
254
  * @since 0.2.0
255
  */
256
  protected function get_cache_expiration() {
257
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
258
 
259
  return 0;
260
  }
@@ -265,7 +264,7 @@ class Share_Second_Cache_Engine extends Cache_Engine {
265
  * @since 0.3.0
266
  */
267
  public function initialize_cache() {
268
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
269
 
270
  $option_key = $this->get_cache_key( 'home' );
271
 
@@ -313,7 +312,7 @@ class Share_Second_Cache_Engine extends Cache_Engine {
313
  * @since 0.3.0
314
  */
315
  public function clear_cache() {
316
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
317
 
318
  $option_key = $this->get_cache_key( 'home' );
319
  delete_option( $option_key );
@@ -332,7 +331,7 @@ class Share_Second_Cache_Engine extends Cache_Engine {
332
  * @since 0.7.0
333
  */
334
  public function clear_cache_by_post_id( $post_id ) {
335
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
336
 
337
  foreach ( $this->target_sns as $sns => $active ) {
338
  if ( $active ) {
1
  <?php
2
  /*
3
+ class-scc-share-second-cache-engine.php
4
 
5
  Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
  Author: Daisuke Maruyama
27
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  */
29
 
30
+ class SCC_Share_Second_Cache_Engine extends SCC_Cache_Engine {
31
 
32
  /**
33
  * Prefix of cache ID
85
  * @since 0.1.1
86
  */
87
  public function initialize( $options = array() ) {
88
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
89
 
90
  $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
91
  $this->prime_cron = self::DEF_PRIME_CRON;
116
  * @since 0.1.0
117
  */
118
  public function schedule_check_interval( $schedules ) {
119
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
120
 
121
  $schedules[$this->event_schedule] = array(
122
  'interval' => $this->check_interval,
132
  * @since 0.3.0
133
  */
134
  public function prime_cache() {
135
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
136
 
137
+ $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
138
 
139
+ SCC_Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
140
+ SCC_Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
141
 
142
  wp_schedule_single_event( $next_exec_time, $this->execute_cron );
143
  }
148
  * @since 0.3.0
149
  */
150
  public function execute_cache() {
151
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
152
 
153
  $query_args = array(
154
  'post_type' => $this->post_types,
189
  * @since 0.1.1
190
  */
191
  public function cache( $options = array() ) {
192
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
193
 
194
  $transient_id = $options['cache_key'];
195
  $target_sns = $options['target_sns'];
243
  }
244
  }
245
 
246
+ $this->delegate_order( SCC_Order::ORDER_DO_ANALYSIS, $options );
 
247
 
248
  }
249
 
253
  * @since 0.2.0
254
  */
255
  protected function get_cache_expiration() {
256
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
257
 
258
  return 0;
259
  }
264
  * @since 0.3.0
265
  */
266
  public function initialize_cache() {
267
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
268
 
269
  $option_key = $this->get_cache_key( 'home' );
270
 
312
  * @since 0.3.0
313
  */
314
  public function clear_cache() {
315
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
316
 
317
  $option_key = $this->get_cache_key( 'home' );
318
  delete_option( $option_key );
331
  * @since 0.7.0
332
  */
333
  public function clear_cache_by_post_id( $post_id ) {
334
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
335
 
336
  foreach ( $this->target_sns as $sns => $active ) {
337
  if ( $active ) {
includes/{class-share-twitter-strategy.php → class-scc-share-twitter-strategy.php} RENAMED
@@ -1,162 +1,162 @@
1
- <?php
2
- /*
3
- class-share-twitter-strategy.php
4
-
5
- Description: This class is abstract class of a data crawler
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- class Share_Twitter_Strategy extends Crawl_Strategy {
31
-
32
- /**
33
- * SNS base url
34
- */
35
- const DEF_BASE_URL_JSOON = 'http://jsoon.digitiminimi.com/twitter/count.json';
36
-
37
- const DEF_BASE_URL_OPENSHARECOUNT = 'http://opensharecount.com/count.json';
38
-
39
- const DEF_BASE_URL_TWITCOUNT = 'http://opensharecount.com/count.json';
40
-
41
- /**
42
- * Class constarctor
43
- * Hook onto all of the actions and filters needed by the plugin.
44
- *
45
- */
46
- protected function __construct() {
47
- Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
48
- $this->method = 'GET';
49
- }
50
-
51
- /**
52
- * Initialization
53
- *
54
- * @since 0.9.0
55
- */
56
- public function initialize( $options = array() ) {
57
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
58
-
59
- if ( isset( $options['url'] ) ) $this->url = $options['url'];
60
- if ( isset( $options['method'] ) ) $this->method = $options['method'];
61
- if ( isset( $options['parameters'] ) ) $this->parameters = $options['parameters'];
62
- if ( isset( $options['twitter_api'] ) ) $this->twitter_api = $options['twitter_api'];
63
- }
64
-
65
- /**
66
- * Build header
67
- *
68
- * @since 0.9.0
69
- */
70
- public function build_header() {
71
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
72
- return null;
73
- }
74
-
75
- /**
76
- * Build query url
77
- *
78
- * @since 0.9.0
79
- */
80
- public function build_query_url() {
81
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
82
-
83
- $base_url = self::DEF_BASE_URL_JSOON;
84
-
85
- if ( isset( $this->twitter_api ) && $this->twitter_api ) {
86
- if ( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_JSOON ) {
87
- $base_url = self::DEF_BASE_URL_JSOON;
88
- } elseif ( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_OPENSHARECOUNT ) {
89
- $base_url = self::DEF_BASE_URL_OPENSHARECOUNT;
90
- } elseif( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_TWITCOUNT ) {
91
- $base_url = self::DEF_BASE_URL_TWITCOUNT;
92
- }
93
- }
94
-
95
- $url = $base_url . '?' . http_build_query( $this->query_parameters , '' , '&' );
96
-
97
- return $url;
98
- }
99
-
100
- /**
101
- * Extract count
102
- *
103
- * @since 0.9.0
104
- */
105
- public function extract_count( $content ) {
106
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
107
-
108
- $count = (int) -1;
109
-
110
- if ( isset( $content['data'] ) && empty( $content['error'] ) ) {
111
- $json = json_decode( $content['data'], true );
112
-
113
- if ( isset( $json['count'] ) && is_numeric( $json['count'] ) ) {
114
- $count = (int) $json['count'];
115
- } else {
116
- $count = (int) -1;
117
- }
118
- } else {
119
- $count = (int) -1;
120
- }
121
-
122
- return $count;
123
- }
124
-
125
- public function set_query_parameter( $key, $value ) {
126
- if ( isset( $this->twitter_api ) && $this->twitter_api ) {
127
- if ( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_JSOON ) {
128
- if ( $key === 'url' ) {
129
- if ( $value === home_url( '/', 'http' ) || $value === home_url( '/', 'https' ) ) {
130
- $this->query_parameters[$key] = '"' . $value . '"';
131
- } else {
132
- $this->query_parameters[$key] = $value;
133
- }
134
- } else {
135
- $this->query_parameters[$key] = $value;
136
- }
137
- } elseif ( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_OPENSHARECOUNT ) {
138
- $this->query_parameters[$key] = $value;
139
- } elseif( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_TWITCOUNT ) {
140
- $this->query_parameters[$key] = $value;
141
- }
142
- } else {
143
- $this->query_parameters[$key] = $value;
144
- }
145
- }
146
-
147
- /**
148
- * Check if required paramters are included or not.
149
- *
150
- * @since 0.9.0
151
- */
152
- public function check_configuration() {
153
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
154
-
155
- if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
156
- return true;
157
- } else {
158
- return false;
159
- }
160
- }
161
-
162
- }
1
+ <?php
2
+ /*
3
+ class-scc-share-twitter-strategy.php
4
+
5
+ Description: This class is abstract class of a data crawler
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ class SCC_Share_Twitter_Strategy extends SCC_Crawl_Strategy {
31
+
32
+ /**
33
+ * SNS base url
34
+ */
35
+ const DEF_BASE_URL_JSOON = 'http://jsoon.digitiminimi.com/twitter/count.json';
36
+
37
+ const DEF_BASE_URL_OPENSHARECOUNT = 'http://opensharecount.com/count.json';
38
+
39
+ const DEF_BASE_URL_TWITCOUNT = 'http://opensharecount.com/count.json';
40
+
41
+ /**
42
+ * Class constarctor
43
+ * Hook onto all of the actions and filters needed by the plugin.
44
+ *
45
+ */
46
+ protected function __construct() {
47
+ SCC_Common_Util::log('[' . __METHOD__ . '] (line='. __LINE__ . ')');
48
+ $this->method = 'GET';
49
+ }
50
+
51
+ /**
52
+ * Initialization
53
+ *
54
+ * @since 0.9.0
55
+ */
56
+ public function initialize( $options = array() ) {
57
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
58
+
59
+ if ( isset( $options['url'] ) ) $this->url = $options['url'];
60
+ if ( isset( $options['method'] ) ) $this->method = $options['method'];
61
+ if ( isset( $options['parameters'] ) ) $this->parameters = $options['parameters'];
62
+ if ( isset( $options['twitter_api'] ) ) $this->twitter_api = $options['twitter_api'];
63
+ }
64
+
65
+ /**
66
+ * Build header
67
+ *
68
+ * @since 0.9.0
69
+ */
70
+ public function build_header() {
71
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
72
+ return null;
73
+ }
74
+
75
+ /**
76
+ * Build query url
77
+ *
78
+ * @since 0.9.0
79
+ */
80
+ public function build_query_url() {
81
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
82
+
83
+ $base_url = self::DEF_BASE_URL_JSOON;
84
+
85
+ if ( isset( $this->twitter_api ) && $this->twitter_api ) {
86
+ if ( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_JSOON ) {
87
+ $base_url = self::DEF_BASE_URL_JSOON;
88
+ } elseif ( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_OPENSHARECOUNT ) {
89
+ $base_url = self::DEF_BASE_URL_OPENSHARECOUNT;
90
+ } elseif( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_TWITCOUNT ) {
91
+ $base_url = self::DEF_BASE_URL_TWITCOUNT;
92
+ }
93
+ }
94
+
95
+ $url = $base_url . '?' . http_build_query( $this->query_parameters , '' , '&' );
96
+
97
+ return $url;
98
+ }
99
+
100
+ /**
101
+ * Extract count
102
+ *
103
+ * @since 0.9.0
104
+ */
105
+ public function extract_count( $content ) {
106
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
107
+
108
+ $count = (int) -1;
109
+
110
+ if ( isset( $content['data'] ) && empty( $content['error'] ) ) {
111
+ $json = json_decode( $content['data'], true );
112
+
113
+ if ( isset( $json['count'] ) && is_numeric( $json['count'] ) ) {
114
+ $count = (int) $json['count'];
115
+ } else {
116
+ $count = (int) -1;
117
+ }
118
+ } else {
119
+ $count = (int) -1;
120
+ }
121
+
122
+ return $count;
123
+ }
124
+
125
+ public function set_query_parameter( $key, $value ) {
126
+ if ( isset( $this->twitter_api ) && $this->twitter_api ) {
127
+ if ( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_JSOON ) {
128
+ if ( $key === 'url' ) {
129
+ if ( $value === home_url( '/', 'http' ) || $value === home_url( '/', 'https' ) ) {
130
+ $this->query_parameters[$key] = '"' . $value . '"';
131
+ } else {
132
+ $this->query_parameters[$key] = $value;
133
+ }
134
+ } else {
135
+ $this->query_parameters[$key] = $value;
136
+ }
137
+ } elseif ( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_OPENSHARECOUNT ) {
138
+ $this->query_parameters[$key] = $value;
139
+ } elseif( $this->twitter_api === SNS_Count_Cache::OPT_SHARE_TWITTER_API_TWITCOUNT ) {
140
+ $this->query_parameters[$key] = $value;
141
+ }
142
+ } else {
143
+ $this->query_parameters[$key] = $value;
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Check if required paramters are included or not.
149
+ *
150
+ * @since 0.9.0
151
+ */
152
+ public function check_configuration() {
153
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
154
+
155
+ if ( isset( $this->query_parameters['url'] ) && $this->query_parameters['url'] ) {
156
+ return true;
157
+ } else {
158
+ return false;
159
+ }
160
+ }
161
+
162
+ }
includes/{class-sleep-throttle.php → class-scc-sleep-throttle.php} RENAMED
@@ -1,124 +1,124 @@
1
- <?php
2
- /*
3
- class-sleep-throttle.php
4
-
5
- Description: sleep utility
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- final class Sleep_Throttle {
31
-
32
- /*
33
- *
34
- */
35
- const SECOND_TO_MICRO_SECONDS = 1000000;
36
-
37
- /*
38
- *
39
- */
40
- private $load_ratio = 0.9;
41
-
42
- /*
43
- *
44
- */
45
- private $start_time = null;
46
-
47
- /*
48
- *
49
- */
50
- private $stop_time = null;
51
-
52
- /*
53
- *
54
- */
55
- private $sleep_time = null;
56
-
57
- /*
58
- *
59
- */
60
- function __construct( $load_ratio ) {
61
- $this->load_ratio = $load_ratio;
62
- }
63
-
64
- /*
65
- *
66
- */
67
- public function reset() {
68
- $this->start_time = null;
69
- $this->stop_time = null;
70
- $this->sleep_time = null;
71
- }
72
-
73
- /*
74
- *
75
- */
76
- public function start() {
77
- $this->start_time = gettimeofday( true );
78
- }
79
-
80
- /*
81
- *
82
- */
83
- public function stop() {
84
- $this->stop_time = gettimeofday( true );
85
-
86
- if ( ! is_null( $this->start_time ) && ! is_null( $this->stop_time ) ) {
87
- $this->sleep_time = $this->calculate_sleep_time( $this->load_ratio, $this->stop_time - $this->start_time );
88
- }
89
- }
90
-
91
- /*
92
- *
93
- */
94
- public function sleep() {
95
- if ( ! is_null( $this->sleep_time) && $this->sleep_time > 0 ) {
96
- usleep( $this->sleep_time * self::SECOND_TO_MICRO_SECONDS );
97
- }
98
- }
99
-
100
- /*
101
- *
102
- */
103
- public function get_sleep_time() {
104
- if ( ! is_null( $this->sleep_time) && $this->sleep_time > 0 ) {
105
- return $this->sleep_time;
106
- } else {
107
- return 0;
108
- }
109
- }
110
-
111
- /*
112
- *
113
- */
114
- private function calculate_sleep_time( $load_ratio, $time ) {
115
- if ( $time > 0.0 ) {
116
- return $time * ( 1 - $load_ratio ) / $load_ratio;
117
- } else {
118
- return 0;
119
- }
120
- }
121
-
122
- }
123
-
124
- ?>
1
+ <?php
2
+ /*
3
+ class-scc-sleep-throttle.php
4
+
5
+ Description: sleep utility
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ final class SCC_Sleep_Throttle {
31
+
32
+ /*
33
+ *
34
+ */
35
+ const SECOND_TO_MICRO_SECONDS = 1000000;
36
+
37
+ /*
38
+ *
39
+ */
40
+ private $load_ratio = 0.9;
41
+
42
+ /*
43
+ *
44
+ */
45
+ private $start_time = null;
46
+
47
+ /*
48
+ *
49
+ */
50
+ private $stop_time = null;
51
+
52
+ /*
53
+ *
54
+ */
55
+ private $sleep_time = null;
56
+
57
+ /*
58
+ *
59
+ */
60
+ function __construct( $load_ratio ) {
61
+ $this->load_ratio = $load_ratio;
62
+ }
63
+
64
+ /*
65
+ *
66
+ */
67
+ public function reset() {
68
+ $this->start_time = null;
69
+ $this->stop_time = null;
70
+ $this->sleep_time = null;
71
+ }
72
+
73
+ /*
74
+ *
75
+ */
76
+ public function start() {
77
+ $this->start_time = gettimeofday( true );
78
+ }
79
+
80
+ /*
81
+ *
82
+ */
83
+ public function stop() {
84
+ $this->stop_time = gettimeofday( true );
85
+
86
+ if ( ! is_null( $this->start_time ) && ! is_null( $this->stop_time ) ) {
87
+ $this->sleep_time = $this->calculate_sleep_time( $this->load_ratio, $this->stop_time - $this->start_time );
88
+ }
89
+ }
90
+
91
+ /*
92
+ *
93
+ */
94
+ public function sleep() {
95
+ if ( ! is_null( $this->sleep_time) && $this->sleep_time > 0 ) {
96
+ usleep( $this->sleep_time * self::SECOND_TO_MICRO_SECONDS );
97
+ }
98
+ }
99
+
100
+ /*
101
+ *
102
+ */
103
+ public function get_sleep_time() {
104
+ if ( ! is_null( $this->sleep_time) && $this->sleep_time > 0 ) {
105
+ return $this->sleep_time;
106
+ } else {
107
+ return 0;
108
+ }
109
+ }
110
+
111
+ /*
112
+ *
113
+ */
114
+ private function calculate_sleep_time( $load_ratio, $time ) {
115
+ if ( $time > 0.0 ) {
116
+ return $time * ( 1 - $load_ratio ) / $load_ratio;
117
+ } else {
118
+ return 0;
119
+ }
120
+ }
121
+
122
+ }
123
+
124
+ ?>
includes/{class-wp-cron-util.php → class-scc-wp-cron-util.php} RENAMED
@@ -1,267 +1,267 @@
1
- <?php
2
- /*
3
- class-wp-cron-util.php
4
-
5
- Description: This class is a utility for WP-Cron
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- class WP_Cron_Util {
31
-
32
- /**
33
- * Class constarctor
34
- * Hook onto all of the actions and filters needed by the plugin.
35
- *
36
- */
37
- protected function __construct() {
38
-
39
- }
40
-
41
-
42
- /**
43
- * Clear expired scheduled hook based related to specified hook name
44
- *
45
- * @since 0.4.1
46
- */
47
- public static function clear_expired_scheduled_hook( $hook, $elapsed_time ) {
48
- $crons = _get_cron_array();
49
-
50
- if ( empty( $crons ) ) {
51
- return;
52
- }
53
-
54
- $current_time = (int) current_time( 'timestamp', 1 );
55
-
56
- foreach( $crons as $timestamp => $cron ) {
57
- if ( isset( $cron[$hook] ) ) {
58
- $duration = $current_time - $timestamp;
59
-
60
- if ( $duration > $elapsed_time ) {
61
- foreach ( $cron[$hook] as $signature => $data ) {
62
- wp_unschedule_event( $timestamp, $hook, $data['args'] );
63
- }
64
- }
65
- }
66
- }
67
- }
68
-
69
-
70
- /**
71
- * Clear scheduled hook based related to specified hook name
72
- *
73
- * @since 0.1.1
74
- */
75
- public static function clear_scheduled_hook( $hook ) {
76
- $crons = _get_cron_array();
77
-
78
- if ( empty( $crons ) ) return;
79
-
80
- foreach( $crons as $timestamp => $cron ) {
81
- if ( isset( $cron[$hook] ) ) {
82
- foreach ( $cron[$hook] as $signature => $data ) {
83
- wp_unschedule_event( $timestamp, $hook, $data['args'] );
84
- }
85
- }
86
- }
87
- }
88
-
89
- /**
90
- * Return if there is the given hook or not
91
- *
92
- * @since 0.1.1
93
- */
94
- public static function is_scheduled_hook( $hook ) {
95
- $crons = _get_cron_array();
96
-
97
- if ( empty( $crons ) ) return false;
98
-
99
- foreach( $crons as $timestamp => $cron ) {
100
- if ( isset( $cron[$hook] ) ) {
101
- return true;
102
- }
103
- }
104
-
105
- return false;
106
- }
107
-
108
- /**
109
- * Get scheduled hook related to specified hook name
110
- *
111
- * @since 0.1.1
112
- */
113
- public static function get_scheduled_hook( $hook ) {
114
- //Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
115
-
116
- $crons = _get_cron_array();
117
-
118
- $info = array();
119
- $index = 0;
120
-
121
- if ( empty( $crons ) ) return;
122
-
123
- foreach( $crons as $timestamp => $cron ) {
124
- if ( isset( $cron[$hook] ) ) {
125
- //Common_Util::log( $cron[$hook] );
126
- foreach ( $cron[$hook] as $signature => $data ) {
127
-
128
- //Common_Util::log( '[' . __METHOD__ . '] hook: ' . $hook . ' offset: ' . $data['args'][0]. ' timestamp: ' . $timestamp );
129
-
130
- $info[$index]['hook'] = $hook;
131
- $info[$index]['timestamp'] = $timestamp;
132
- $info[$index]['args'] = $data['args'];
133
- //wp_unschedule_event( $timestamp, $hook, $data['args'] );
134
- }
135
- $index++;
136
- }
137
- }
138
-
139
- return $info;
140
- }
141
-
142
- /**
143
- *
144
- * Get the local time timestamp of the next cron execution
145
- * This code is cited from wordpress plugin BackWPup
146
- *
147
- * @param string $cronstring cron (* * * * *)
148
- * @return int timestamp
149
- */
150
- public static function next_exec_time( $cronstring ) {
151
- $cron = array();
152
- $cronarray = array();
153
- //Cron string
154
- list( $cronstr[ 'minutes' ], $cronstr[ 'hours' ], $cronstr[ 'mday' ], $cronstr[ 'mon' ], $cronstr[ 'wday' ] ) = explode( ' ', trim( $cronstring ), 5 );
155
-
156
- //make arrays form string
157
- foreach ( $cronstr as $key => $value ) {
158
- if ( strstr( $value, ',' ) ) {
159
- $cronarray[ $key ] = explode( ',', $value );
160
- } else {
161
- $cronarray[ $key ] = array( 0 => $value );
162
- }
163
- }
164
-
165
- //make arrays complete with ranges and steps
166
- foreach ( $cronarray as $cronarraykey => $cronarrayvalue ) {
167
- $cron[ $cronarraykey ] = array();
168
- foreach ( $cronarrayvalue as $value ) {
169
- //steps
170
- $step = 1;
171
- if ( strstr( $value, '/' ) ) {
172
- list( $value, $step ) = explode( '/', $value, 2 );
173
- }
174
- //replace weekday 7 with 0 for sundays
175
- if ( $cronarraykey === 'wday' ) {
176
- $value = str_replace( '7', '0', $value );
177
- }
178
- //ranges
179
- if ( strstr( $value, '-' ) ) {
180
- list( $first, $last ) = explode( '-', $value, 2 );
181
- if ( ! is_numeric( $first ) || ! is_numeric( $last ) || $last > 60 || $first > 60 ) { //check
182
- return PHP_INT_MAX;
183
- }
184
- if ( $cronarraykey === 'minutes' && $step < 5 ) { //set step minimum to 5 min.
185
- $step = 5;
186
- }
187
- $range = array();
188
- for ( $i = $first; $i <= $last; $i = $i + $step ) {
189
- $range[ ] = $i;
190
- }
191
- $cron[ $cronarraykey ] = array_merge( $cron[ $cronarraykey ], $range );
192
- }
193
- elseif ( $value === '*' ) {
194
- $range = array();
195
- if ( $cronarraykey === 'minutes' ) {
196
- if ( $step < 10 ) { //set step minimum to 5 min.
197
- $step = 10;
198
- }
199
- for ( $i = 0; $i <= 59; $i = $i + $step ) {
200
- $range[ ] = $i;
201
- }
202
- }
203
- if ( $cronarraykey === 'hours' ) {
204
- for ( $i = 0; $i <= 23; $i = $i + $step ) {
205
- $range[ ] = $i;
206
- }
207
- }
208
- if ( $cronarraykey === 'mday' ) {
209
- for ( $i = $step; $i <= 31; $i = $i + $step ) {
210
- $range[ ] = $i;
211
- }
212
- }
213
- if ( $cronarraykey === 'mon' ) {
214
- for ( $i = $step; $i <= 12; $i = $i + $step ) {
215
- $range[ ] = $i;
216
- }
217
- }
218
- if ( $cronarraykey === 'wday' ) {
219
- for ( $i = 0; $i <= 6; $i = $i + $step ) {
220
- $range[ ] = $i;
221
- }
222
- }
223
- $cron[ $cronarraykey ] = array_merge( $cron[ $cronarraykey ], $range );
224
- }
225
- else {
226
- if ( ! is_numeric( $value ) || (int) $value > 60 ) {
227
- return PHP_INT_MAX;
228
- }
229
- $cron[ $cronarraykey ] = array_merge( $cron[ $cronarraykey ], array( 0 => absint( $value ) ) );
230
- }
231
- }
232
- }
233
-
234
- //generate years
235
- $year = (int) gmdate( 'Y' );
236
- for ( $i = $year; $i < $year + 100; $i ++ ) {
237
- $cron[ 'year' ][ ] = $i;
238
- }
239
-
240
- //calc next timestamp
241
- $current_timestamp = (int) current_time( 'timestamp' );
242
- foreach ( $cron[ 'year' ] as $year ) {
243
- foreach ( $cron[ 'mon' ] as $mon ) {
244
- foreach ( $cron[ 'mday' ] as $mday ) {
245
- if ( ! checkdate( $mon, $mday, $year ) ) {
246
- continue;
247
- }
248
- foreach ( $cron[ 'hours' ] as $hours ) {
249
- foreach ( $cron[ 'minutes' ] as $minutes ) {
250
- $timestamp = gmmktime( $hours, $minutes, 0, $mon, $mday, $year );
251
- if ( $timestamp && in_array( (int) gmdate( 'j', $timestamp ), $cron[ 'mday' ], true ) && in_array( (int) gmdate( 'w', $timestamp ), $cron[ 'wday' ], true ) && $timestamp > $current_timestamp ) {
252
- return $timestamp - ( (int) get_option( 'gmt_offset' ) * 3600 );
253
- }
254
- }
255
- }
256
- }
257
- }
258
- }
259
-
260
- return PHP_INT_MAX;
261
- }
262
-
263
- }
264
-
265
-
266
-
267
- ?>
1
+ <?php
2
+ /*
3
+ class-scc-wp-cron-util.php
4
+
5
+ Description: This class is a utility for WP-Cron
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ class SCC_WP_Cron_Util {
31
+
32
+ /**
33
+ * Class constarctor
34
+ * Hook onto all of the actions and filters needed by the plugin.
35
+ *
36
+ */
37
+ protected function __construct() {
38
+
39
+ }
40
+
41
+
42
+ /**
43
+ * Clear expired scheduled hook based related to specified hook name
44
+ *
45
+ * @since 0.4.1
46
+ */
47
+ public static function clear_expired_scheduled_hook( $hook, $elapsed_time ) {
48
+ $crons = _get_cron_array();
49
+
50
+ if ( empty( $crons ) ) {
51
+ return;
52
+ }
53
+
54
+ $current_time = (int) current_time( 'timestamp', 1 );
55
+
56
+ foreach( $crons as $timestamp => $cron ) {
57
+ if ( isset( $cron[$hook] ) ) {
58
+ $duration = $current_time - $timestamp;
59
+
60
+ if ( $duration > $elapsed_time ) {
61
+ foreach ( $cron[$hook] as $signature => $data ) {
62
+ wp_unschedule_event( $timestamp, $hook, $data['args'] );
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+
69
+
70
+ /**
71
+ * Clear scheduled hook based related to specified hook name
72
+ *
73
+ * @since 0.1.1
74
+ */
75
+ public static function clear_scheduled_hook( $hook ) {
76
+ $crons = _get_cron_array();
77
+
78
+ if ( empty( $crons ) ) return;
79
+
80
+ foreach( $crons as $timestamp => $cron ) {
81
+ if ( isset( $cron[$hook] ) ) {
82
+ foreach ( $cron[$hook] as $signature => $data ) {
83
+ wp_unschedule_event( $timestamp, $hook, $data['args'] );
84
+ }
85
+ }
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Return if there is the given hook or not
91
+ *
92
+ * @since 0.1.1
93
+ */
94
+ public static function is_scheduled_hook( $hook ) {
95
+ $crons = _get_cron_array();
96
+
97
+ if ( empty( $crons ) ) return false;
98
+
99
+ foreach( $crons as $timestamp => $cron ) {
100
+ if ( isset( $cron[$hook] ) ) {
101
+ return true;
102
+ }
103
+ }
104
+
105
+ return false;
106
+ }
107
+
108
+ /**
109
+ * Get scheduled hook related to specified hook name
110
+ *
111
+ * @since 0.1.1
112
+ */
113
+ public static function get_scheduled_hook( $hook ) {
114
+ //SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
115
+
116
+ $crons = _get_cron_array();
117
+
118
+ $info = array();
119
+ $index = 0;
120
+
121
+ if ( empty( $crons ) ) return;
122
+
123
+ foreach( $crons as $timestamp => $cron ) {
124
+ if ( isset( $cron[$hook] ) ) {
125
+ //SCC_Common_Util::log( $cron[$hook] );
126
+ foreach ( $cron[$hook] as $signature => $data ) {
127
+
128
+ //SCC_Common_Util::log( '[' . __METHOD__ . '] hook: ' . $hook . ' offset: ' . $data['args'][0]. ' timestamp: ' . $timestamp );
129
+
130
+ $info[$index]['hook'] = $hook;
131
+ $info[$index]['timestamp'] = $timestamp;
132
+ $info[$index]['args'] = $data['args'];
133
+ //wp_unschedule_event( $timestamp, $hook, $data['args'] );
134
+ }
135
+ $index++;
136
+ }
137
+ }
138
+
139
+ return $info;
140
+ }
141
+
142
+ /**
143
+ *
144
+ * Get the local time timestamp of the next cron execution
145
+ * This code is cited from wordpress plugin BackWPup
146
+ *
147
+ * @param string $cronstring cron (* * * * *)
148
+ * @return int timestamp
149
+ */
150
+ public static function next_exec_time( $cronstring ) {
151
+ $cron = array();
152
+ $cronarray = array();
153
+ //Cron string
154
+ list( $cronstr[ 'minutes' ], $cronstr[ 'hours' ], $cronstr[ 'mday' ], $cronstr[ 'mon' ], $cronstr[ 'wday' ] ) = explode( ' ', trim( $cronstring ), 5 );
155
+
156
+ //make arrays form string
157
+ foreach ( $cronstr as $key => $value ) {
158
+ if ( strstr( $value, ',' ) ) {
159
+ $cronarray[ $key ] = explode( ',', $value );
160
+ } else {
161
+ $cronarray[ $key ] = array( 0 => $value );
162
+ }
163
+ }
164
+
165
+ //make arrays complete with ranges and steps
166
+ foreach ( $cronarray as $cronarraykey => $cronarrayvalue ) {
167
+ $cron[ $cronarraykey ] = array();
168
+ foreach ( $cronarrayvalue as $value ) {
169
+ //steps
170
+ $step = 1;
171
+ if ( strstr( $value, '/' ) ) {
172
+ list( $value, $step ) = explode( '/', $value, 2 );
173
+ }
174
+ //replace weekday 7 with 0 for sundays
175
+ if ( $cronarraykey === 'wday' ) {
176
+ $value = str_replace( '7', '0', $value );
177
+ }
178
+ //ranges
179
+ if ( strstr( $value, '-' ) ) {
180
+ list( $first, $last ) = explode( '-', $value, 2 );
181
+ if ( ! is_numeric( $first ) || ! is_numeric( $last ) || $last > 60 || $first > 60 ) { //check
182
+ return PHP_INT_MAX;
183
+ }
184
+ if ( $cronarraykey === 'minutes' && $step < 5 ) { //set step minimum to 5 min.
185
+ $step = 5;
186
+ }
187
+ $range = array();
188
+ for ( $i = $first; $i <= $last; $i = $i + $step ) {
189
+ $range[ ] = $i;
190
+ }
191
+ $cron[ $cronarraykey ] = array_merge( $cron[ $cronarraykey ], $range );
192
+ }
193
+ elseif ( $value === '*' ) {
194
+ $range = array();
195
+ if ( $cronarraykey === 'minutes' ) {
196
+ if ( $step < 10 ) { //set step minimum to 5 min.
197
+ $step = 10;
198
+ }
199
+ for ( $i = 0; $i <= 59; $i = $i + $step ) {
200
+ $range[ ] = $i;
201
+ }
202
+ }
203
+ if ( $cronarraykey === 'hours' ) {
204
+ for ( $i = 0; $i <= 23; $i = $i + $step ) {
205
+ $range[ ] = $i;
206
+ }
207
+ }
208
+ if ( $cronarraykey === 'mday' ) {
209
+ for ( $i = $step; $i <= 31; $i = $i + $step ) {
210
+ $range[ ] = $i;
211
+ }
212
+ }
213
+ if ( $cronarraykey === 'mon' ) {
214
+ for ( $i = $step; $i <= 12; $i = $i + $step ) {
215
+ $range[ ] = $i;
216
+ }
217
+ }
218
+ if ( $cronarraykey === 'wday' ) {
219
+ for ( $i = 0; $i <= 6; $i = $i + $step ) {
220
+ $range[ ] = $i;
221
+ }
222
+ }
223
+ $cron[ $cronarraykey ] = array_merge( $cron[ $cronarraykey ], $range );
224
+ }
225
+ else {
226
+ if ( ! is_numeric( $value ) || (int) $value > 60 ) {
227
+ return PHP_INT_MAX;
228
+ }
229
+ $cron[ $cronarraykey ] = array_merge( $cron[ $cronarraykey ], array( 0 => absint( $value ) ) );
230
+ }
231
+ }
232
+ }
233
+
234
+ //generate years
235
+ $year = (int) gmdate( 'Y' );
236
+ for ( $i = $year; $i < $year + 100; $i ++ ) {
237
+ $cron[ 'year' ][ ] = $i;
238
+ }
239
+
240
+ //calc next timestamp
241
+ $current_timestamp = (int) current_time( 'timestamp' );
242
+ foreach ( $cron[ 'year' ] as $year ) {
243
+ foreach ( $cron[ 'mon' ] as $mon ) {
244
+ foreach ( $cron[ 'mday' ] as $mday ) {
245
+ if ( ! checkdate( $mon, $mday, $year ) ) {
246
+ continue;
247
+ }
248
+ foreach ( $cron[ 'hours' ] as $hours ) {
249
+ foreach ( $cron[ 'minutes' ] as $minutes ) {
250
+ $timestamp = gmmktime( $hours, $minutes, 0, $mon, $mday, $year );
251
+ if ( $timestamp && in_array( (int) gmdate( 'j', $timestamp ), $cron[ 'mday' ], true ) && in_array( (int) gmdate( 'w', $timestamp ), $cron[ 'wday' ], true ) && $timestamp > $current_timestamp ) {
252
+ return $timestamp - ( (int) get_option( 'gmt_offset' ) * 3600 );
253
+ }
254
+ }
255
+ }
256
+ }
257
+ }
258
+ }
259
+
260
+ return PHP_INT_MAX;
261
+ }
262
+
263
+ }
264
+
265
+
266
+
267
+ ?>
includes/class-share-rescue-cache-engine.php DELETED
@@ -1,328 +0,0 @@
1
- <?php
2
- /*
3
- class-share-rescue-cache-engine.php
4
-
5
- Description: This class is a data cache engine whitch get and cache data using wp-cron at regular intervals
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- class Share_Rescue_Cache_Engine extends Share_Cache_Engine {
31
-
32
- /**
33
- * Prefix of cache ID
34
- */
35
- const DEF_TRANSIENT_PREFIX = 'scc_share_count_';
36
-
37
- /**
38
- * Cron name to schedule cache processing
39
- */
40
- const DEF_PRIME_CRON = 'scc_share_rescuecache_prime';
41
-
42
- /**
43
- * Cron name to execute cache processing
44
- */
45
- const DEF_EXECUTE_CRON = 'scc_share_rescuecache_exec';
46
-
47
- /**
48
- * Schedule name for cache processing
49
- */
50
- const DEF_EVENT_SCHEDULE = 'share_rescue_cache_event';
51
-
52
- /**
53
- * Schedule description for cache processing
54
- */
55
- const DEF_EVENT_DESCRIPTION = '[SCC] Share Rescue Cache Interval';
56
-
57
- /**
58
- * Interval cheking and caching target data
59
- */
60
- private $check_interval = 600;
61
-
62
- /**
63
- * Number of posts to check at a time
64
- */
65
- private $posts_per_check = 20;
66
-
67
- /**
68
- * Prefix of cache ID
69
- */
70
- private $meta_key_prefix = 'scc_share_count_';
71
-
72
- /**
73
- * Initialization
74
- *
75
- * @since 0.1.1
76
- */
77
- public function initialize( $options = array() ) {
78
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
79
-
80
- $this->cache_prefix = self::DEF_TRANSIENT_PREFIX;
81
- $this->prime_cron = self::DEF_PRIME_CRON;
82
- $this->execute_cron = self::DEF_EXECUTE_CRON;
83
- $this->event_schedule = self::DEF_EVENT_SCHEDULE;
84
- $this->event_description = self::DEF_EVENT_DESCRIPTION;
85
-
86
- if ( isset( $options['delegate'] ) ) $this->delegate = $options['delegate'];
87
- if ( isset( $options['crawler'] ) ) $this->crawler = $options['crawler'];
88
- if ( isset( $options['target_sns'] ) ) $this->target_sns = $options['target_sns'];
89
- if ( isset( $options['check_interval'] ) ) $this->check_interval = $options['check_interval'];
90
- if ( isset( $options['posts_per_check'] ) ) $this->posts_per_check = $options['posts_per_check'];
91
- if ( isset( $options['cache_prefix'] ) ) $this->cache_prefix = $options['cache_prefix'];
92
- if ( isset( $options['prime_cron'] ) ) $this->prime_cron = $options['prime_cron'];
93
- if ( isset( $options['execute_cron'] ) ) $this->execute_cron = $options['execute_cron'];
94
- if ( isset( $options['event_schedule'] ) ) $this->event_schedule = $options['event_schedule'];
95
- if ( isset( $options['event_description'] ) ) $this->event_description = $options['event_description'];
96
- if ( isset( $options['post_types'] ) ) $this->post_types = $options['post_types'];
97
- if ( isset( $options['meta_key_prefix'] ) ) $this->meta_key_prefix = $options['meta_key_prefix'];
98
- if ( isset( $options['scheme_migration_mode'] ) ) $this->scheme_migration_mode = $options['scheme_migration_mode'];
99
- if ( isset( $options['scheme_migration_exclude_keys'] ) ) $this->scheme_migration_exclude_keys = $options['scheme_migration_exclude_keys'];
100
-
101
- add_filter( 'cron_schedules', array( $this, 'schedule_check_interval' ) );
102
- add_action( $this->prime_cron, array( $this, 'prime_cache' ) );
103
- add_action( $this->execute_cron, array( $this, 'execute_cache' ), 10, 1 );
104
- }
105
-
106
- /**
107
- * Register event schedule for this engine
108
- *
109
- * @since 0.1.0
110
- */
111
- public function schedule_check_interval( $schedules ) {
112
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
113
-
114
- $schedules[$this->event_schedule] = array(
115
- 'interval' => $this->check_interval,
116
- 'display' => $this->event_description
117
- );
118
-
119
- return $schedules;
120
- }
121
-
122
- /**
123
- * Schedule data retrieval and cache processing
124
- *
125
- * @since 0.1.0
126
- */
127
- public function prime_cache() {
128
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
129
-
130
- $next_exec_time = (int) current_time( 'timestamp', 1 ) + $this->check_interval;
131
- $posts_total = $this->get_posts_total();
132
-
133
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
134
- Common_Util::log( '[' . __METHOD__ . '] posts_per_check: ' . $this->posts_per_check );
135
- Common_Util::log( '[' . __METHOD__ . '] next_exec_time: ' . $next_exec_time );
136
- Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
137
-
138
- wp_schedule_single_event( $next_exec_time, $this->execute_cron, array( Common_Util::short_hash( $next_exec_time ) ) );
139
- }
140
-
141
- /**
142
- * Get and cache data of each published post and page
143
- *
144
- * @since 0.1.0
145
- */
146
- public function execute_cache( $hash ) {
147
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
148
-
149
- Common_Util::log( '[' . __METHOD__ . '] check_interval: ' . $this->check_interval );
150
- Common_Util::log( '[' . __METHOD__ . '] posts_per_check: ' . $this->posts_per_check );
151
-
152
- $no_cache_post_IDs = array();
153
-
154
- $cache_expiration = $this->get_cache_expiration();
155
-
156
- Common_Util::log( '[' . __METHOD__ . '] cache_expiration: ' . $cache_expiration );
157
-
158
- $check_range_min = 0;
159
- $check_range_max = 0;
160
-
161
- $crons = WP_Cron_Util::get_scheduled_hook( 'scc_share_basecache_exec' );
162
-
163
- foreach ( $crons as $key => $cron ) {
164
- $hook = $cron['hook'];
165
- $timestamp = $cron['timestamp'];
166
- $offset = $cron['args'][0];
167
-
168
- Common_Util::log( '[' . __METHOD__ . '] hook: ' . $hook . ' offset: ' . $offset . ' timestamp: ' . $timestamp );
169
-
170
- //if ( time() + 300 < $timestamp ) {
171
- $check_range_min = $offset;
172
- $check_range_max = $offset + $this->posts_per_check;
173
- //}
174
- }
175
-
176
- $query_args = array(
177
- 'post_type' => $this->post_types,
178
- 'post_status' => 'publish',
179
- 'nopaging' => true,
180
- 'update_post_term_cache' => false,
181
- 'update_post_meta_cache' => false
182
- );
183
-
184
- $posts_query = new WP_Query( $query_args );
185
-
186
- if ( $posts_query->have_posts() ) {
187
- while ( $posts_query->have_posts() ) {
188
- $posts_query->the_post();
189
-
190
- $post_ID = get_the_ID();
191
-
192
- $full_cache_flag = true;
193
- $partial_cache_flag = false;
194
-
195
- foreach ( $this->target_sns as $sns => $active ) {
196
- if ( $active ) {
197
- $meta_key = $this->get_cache_key( $sns );
198
-
199
- $sns_count = get_post_meta( get_the_ID(), $meta_key, true );
200
-
201
- if ( isset( $sns_count ) && $sns_count >= 0 ) {
202
- $partial_cache_flag = true;
203
- } else {
204
- $full_cache_flag = false;
205
- }
206
- }
207
- }
208
-
209
- if ( $partial_cache_flag && $full_cache_flag ) {
210
- //full cache
211
- $transient_id = $this->get_cache_key( $post_ID );
212
-
213
- if ( false === ( $sns_counts = get_transient( $transient_id ) ) ) {
214
- if ( $post_ID < $check_range_min || $post_ID > $check_range_max ) {
215
- $no_cache_post_IDs[$post_ID] = 1;
216
- }
217
- }
218
- } elseif ( $partial_cache_flag && ! $full_cache_flag ) {
219
- //partial cache
220
- $transient_id = $this->get_cache_key( $post_ID );
221
-
222
- if ( false === ( $sns_counts = get_transient( $transient_id ) ) ) {
223
- if ( $post_ID < $check_range_min || $post_ID > $check_range_max ) {
224
- $no_cache_post_IDs[$post_ID] = 2;
225
- }
226
- }
227
- } else {
228
- if ( $post_ID < $check_range_min || $post_ID > $check_range_max ) {
229
- $no_cache_post_IDs[$post_ID] = 3;
230
- }
231
- }
232
- }
233
- }
234
- wp_reset_postdata();
235
-
236
- Common_Util::log( '[' . __METHOD__ . '] no cache post IDs:');
237
-
238
- Common_Util::log( $no_cache_post_IDs );
239
-
240
- arsort( $no_cache_post_IDs, SORT_NUMERIC );
241
-
242
- $rescue_post_IDs = array_slice( $no_cache_post_IDs, 0, $this->posts_per_check, true );
243
-
244
- unset( $no_cache_post_IDs );
245
-
246
- Common_Util::log( $rescue_post_IDs );
247
-
248
- foreach ( $rescue_post_IDs as $post_ID => $priority ) {
249
- Common_Util::log( '[' . __METHOD__ . '] post_id: ' . $post_ID );
250
-
251
- $transient_id = $this->get_cache_key( $post_ID );
252
-
253
- $url = get_permalink( $post_ID );
254
-
255
- $options = array(
256
- 'cache_key' => $transient_id,
257
- 'post_id' => $post_ID,
258
- 'target_url' => $url,
259
- 'target_sns' => $this->target_sns,
260
- 'cache_expiration' => $cache_expiration
261
- );
262
-
263
- // Primary cache
264
- $this->cache( $options );
265
-
266
- // Secondary cache
267
- $this->delegate_cache( $options );
268
- }
269
-
270
- }
271
-
272
- /**
273
- * Get cache expiration based on current number of total post and page
274
- *
275
- * @since 0.1.1
276
- */
277
- protected function get_cache_expiration() {
278
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
279
-
280
- $posts_total = $this->get_posts_total();
281
-
282
- Common_Util::log( '[' . __METHOD__ . '] posts_total: ' . $posts_total );
283
-
284
- return ( ( ceil( $posts_total / $this->posts_per_check ) + 2 ) * $this->check_interval ) + 2 * $this->check_interval;
285
- }
286
-
287
- /**
288
- * Initialize meta key for ranking
289
- *
290
- * @since 0.3.0
291
- */
292
- public function initialize_cache() {
293
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
294
- }
295
-
296
- /**
297
- * Clear meta key for ranking
298
- *
299
- * @since 0.3.0
300
- */
301
- public function clear_cache() {
302
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
303
- }
304
-
305
- /**
306
- * Get total count of current published post and page
307
- *
308
- * @since 0.1.0
309
- */
310
- private function get_posts_total() {
311
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
312
-
313
- $query_args = array(
314
- 'post_type' => $this->post_types,
315
- 'post_status' => 'publish',
316
- 'nopaging' => true,
317
- 'update_post_term_cache' => false,
318
- 'update_post_meta_cache' => false
319
- );
320
-
321
- $posts_query = new WP_Query( $query_args );
322
-
323
- return $posts_query->found_posts;
324
- }
325
-
326
- }
327
-
328
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/interface-order.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
- /*
3
- interface-cache-order.php
4
-
5
- Description: This is a interface
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- interface Order {
31
- public function order_cache( Cache_Engine $engine, $options = array() );
32
- public function order_analysis( Cache_Engine $engine, $options = array() );
33
- }
34
-
35
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/{interface-cache-order.php → interface-scc-order.php} RENAMED
@@ -1,34 +1,41 @@
1
- <?php
2
- /*
3
- interface-cache-order.php
4
-
5
- Description: This is a interface
6
- Author: Daisuke Maruyama
7
- Author URI: http://marubon.info/
8
- License: GPL2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
- */
11
-
12
- /*
13
- Copyright (C) 2014 - 2016 Daisuke Maruyama
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- as published by the Free Software Foundation; either version 2
18
- of the License, or (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
- */
29
-
30
- interface Cache_Order {
31
- public function order_cache( Cache_Engine $engine, $options = array() );
32
- }
33
-
34
- ?>
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ interface-scc-order.php
4
+
5
+ Description: This is a interface
6
+ Author: Daisuke Maruyama
7
+ Author URI: http://marubon.info/
8
+ License: GPL2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10
+ */
11
+
12
+ /*
13
+ Copyright (C) 2014 - 2016 Daisuke Maruyama
14
+
15
+ This program is free software; you can redistribute it and/or
16
+ modify it under the terms of the GNU General Public License
17
+ as published by the Free Software Foundation; either version 2
18
+ of the License, or (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
+ */
29
+
30
+ interface SCC_Order {
31
+
32
+ const ORDER_DO_SECOND_CACHE = 'do_second_cache';
33
+
34
+ const ORDER_GET_SECOND_CACHE = 'get_second_cache';
35
+
36
+ const ORDER_DO_ANALYSIS = 'do_analysis';
37
+
38
+ public function order( SCC_Cache_Engine $engine, $order, $options = array() );
39
+ }
40
+
41
+ ?>
js/jquery.scc-cache-info.js CHANGED
@@ -1,153 +1,161 @@
1
- /*
2
- jquery.scc-cache-info.js
3
- Author: Daisuke Maruyama
4
- Author URI: http://marubon.info/
5
- License: GPL2 or later
6
- License URI: http://www.gnu.org/licenses/gpl-2.0.txt
7
- */
8
- ;jQuery(document).ready(function ($) {
9
- return $('#scc-dashboard,#scc-dashboard-widget').each(function() {
10
- $("span[data-scc]").css('display', 'none');
11
-
12
- function isset( data ){
13
- return ( typeof( data ) != 'undefined' );
14
- }
15
-
16
- $.ajax({
17
- url: scc.endpoint + '?action=' + scc.action + '&nonce=' + scc.nonce,
18
- dataType: 'jsonp',
19
- cache: false,
20
- success: function(res) {
21
- if (res) {
22
- console.log(res);
23
- $("span[data-scc='spc']").text(res.share.post_count);
24
- $("span[data-scc='spfcc']").text(res.share.primary.full_cache_count);
25
- $("span[data-scc='sppcc']").text(res.share.primary.partial_cache_count);
26
- $("span[data-scc='spncc']").text(res.share.primary.no_cache_count);
27
- $("span[data-scc='spcs']").text(res.share.primary.cache_status);
28
-
29
- $("span[data-scc='ssfcc']").text(res.share.secondary.full_cache_count);
30
- $("span[data-scc='sspcc']").text(res.share.secondary.partial_cache_count);
31
- $("span[data-scc='ssncc']").text(res.share.secondary.no_cache_count);
32
- $("span[data-scc='sscs']").text(res.share.secondary.cache_status);
33
-
34
- if ( res.share_delta.twitter > 0) {
35
- $("span[data-scc='stwitter']").html(res.share_count.twitter + ' (<span class="delta-rise">+' + res.share_delta.twitter + '</span>)');
36
- } else if (res.share_delta.twitter < 0) {
37
- $("span[data-scc='stwitter']").html(res.share_count.twitter + ' (<span class="delta-fall">' + res.share_delta.twitter + '</span>)');
38
- } else {
39
- $("span[data-scc='stwitter']").html(res.share_count.twitter);
40
- }
41
- if (res.share_delta.facebook > 0) {
42
- $("span[data-scc='sfacebook']").html(res.share_count.facebook + ' (<span class="delta-rise">+' + res.share_delta.facebook + '</span>)');
43
- } else if (res.share_delta.facebook < 0) {
44
- $("span[data-scc='sfacebook']").html(res.share_count.facebook + ' (<span class="delta-fall">' + res.share_delta.facebook + '</span>)');
45
- } else {
46
- $("span[data-scc='sfacebook']").html(res.share_count.facebook);
47
- }
48
-
49
- if (res.share_delta.gplus > 0) {
50
- $("span[data-scc='sgplus']").html(res.share_count.gplus + ' (<span class="delta-rise">+' + res.share_delta.gplus + '</span>)');
51
- } else if (res.share_delta.gplus < 0) {
52
- $("span[data-scc='sgplus']").html(res.share_count.gplus + ' (<span class="delta-fall">' + res.share_delta.gplus + '</span>)');
53
- } else {
54
- $("span[data-scc='sgplus']").html(res.share_count.gplus);
55
- }
56
-
57
- if (res.share_delta.pocket > 0) {
58
- $("span[data-scc='spocket']").html(res.share_count.pocket + ' (<span class="delta-rise">+' + res.share_delta.pocket + '</span>)');
59
- } else if (res.share_delta.pocket < 0) {
60
- $("span[data-scc='spocket']").html(res.share_count.pocket + ' (<span class="delta-fall">' + res.share_delta.pocket + '</span>)');
61
- } else {
62
- $("span[data-scc='spocket']").html(res.share_count.pocket);
63
- }
64
-
65
- if (res.share_delta.hatebu > 0) {
66
- $("span[data-scc='shatebu']").html(res.share_count.hatebu + ' (<span class="delta-rise">+' + res.share_delta.hatebu + '</span>)');
67
- } else if (res.share_delta.hatebu < 0) {
68
- $("span[data-scc='shatebu']").html(res.share_count.hatebu + ' (<span class="delta-fall">' + res.share_delta.hatebu + '</span>)');
69
- } else {
70
- $("span[data-scc='shatebu']").html(res.share_count.hatebu);
71
- }
72
-
73
- if (res.share_delta.total > 0) {
74
- $("span[data-scc='stotal']").html(res.share_count.total + ' (<span class="delta-rise">+' + res.share_delta.total + '</span>)');
75
- } else if (res.share_delta.total < 0) {
76
- $("span[data-scc='stotal']").html(res.share_count.total + ' (<span class="delta-fall">' + res.share_delta.total + '</span>)');
77
- } else {
78
- $("span[data-scc='stotal']").html(res.share_count.total);
79
- }
80
-
81
- $("span[data-scc='fpc']").text(res.follow.post_count);
82
- $("span[data-scc='fpfcc']").text(res.follow.primary.full_cache_count);
83
- $("span[data-scc='fppcc']").text(res.follow.primary.partial_cache_count);
84
- $("span[data-scc='fpncc']").text(res.follow.primary.no_cache_count);
85
- $("span[data-scc='fpcs']").text(res.follow.primary.cache_status);
86
-
87
- $("span[data-scc='fsfcc']").text(res.follow.secondary.full_cache_count);
88
- $("span[data-scc='fspcc']").text(res.follow.secondary.partial_cache_count);
89
- $("span[data-scc='fsncc']").text(res.follow.secondary.no_cache_count);
90
- $("span[data-scc='fscs']").text(res.follow.secondary.cache_status);
91
-
92
- if (isset(res.follow_count)) {
93
- if (isset(res.follow_delta) && res.follow_delta.twitter > 0) {
94
- $("span[data-scc='ftwitter']").html(res.follow_count.twitter + ' (<span class="delta-rise">+' + res.follow_delta.twitter + '</span>)');
95
- } else if (isset(res.follow_delta) && res.follow_delta.twitter < 0) {
96
- $("span[data-scc='ftwitter']").html(res.follow_count.twitter + ' (<span class="delta-fall">' + res.follow_delta.twitter + '</span>)');
97
- } else {
98
- $("span[data-scc='ftwitter']").html(res.follow_count.twitter);
99
- }
100
- }
101
-
102
- if (isset(res.follow_count)) {
103
- if (isset(res.follow_delta) && res.follow_delta.facebook > 0) {
104
- $("span[data-scc='ffacebook']").html(res.follow_count.facebook + ' (<span class="delta-rise">+' + res.follow_delta.facebook + '</span>)');
105
- } else if (isset(res.follow_delta) && res.follow_delta.facebook < 0) {
106
- $("span[data-scc='ffacebook']").html(res.follow_count.facebook + ' (<span class="delta-fall">' + res.follow_delta.facebook + '</span>)');
107
- } else {
108
- $("span[data-scc='ffacebook']").html(res.follow_count.facebook);
109
- }
110
- }
111
-
112
- if ( isset( res.follow_count ) ) {
113
- if (isset(res.follow_delta) && res.follow_delta.feedly > 0) {
114
- $("span[data-scc='ffeedly']").html(res.follow_count.feedly + ' (<span class="delta-rise">+' + res.follow_delta.feedly + '</span>)');
115
- } else if (isset(res.follow_delta) && res.follow_delta.feedly < 0) {
116
- $("span[data-scc='ffeedly']").html(res.follow_count.feedly + ' (<span class="delta-fall">' + res.follow_delta.feedly + '</span>)');
117
- } else {
118
- $("span[data-scc='ffeedly']").html(res.follow_count.feedly);
119
- }
120
- }
121
-
122
- if ( isset( res.follow_count ) ) {
123
- if (isset(res.follow_delta) && res.follow_delta.push7 > 0) {
124
- $("span[data-scc='fpush7']").html(res.follow_count.push7 + ' (<span class="delta-rise">+' + res.follow_delta.push7 + '</span>)');
125
- } else if (isset(res.follow_delta) && res.follow_delta.push7 < 0) {
126
- $("span[data-scc='fpush7']").html(res.follow_count.push7 + ' (<span class="delta-fall">' + res.follow_delta.push7 + '</span>)');
127
- } else {
128
- $("span[data-scc='fpush7']").html(res.follow_count.push7);
129
- }
130
- }
131
-
132
- if ( isset( res.follow_count ) ) {
133
- if (isset(res.follow_delta) && res.follow_delta.instagram > 0) {
134
- $("span[data-scc='finstagram']").html(res.follow_count.instagram + ' (<span class="delta-rise">+' + res.follow_delta.instagram + '</span>)');
135
- } else if (isset(res.follow_delta) && res.follow_delta.instagram < 0) {
136
- $("span[data-scc='finstagram']").html(res.follow_count.instagram + ' (<span class="delta-fall">' + res.follow_delta.instagram + '</span>)');
137
- } else {
138
- $("span[data-scc='finstagram']").html(res.follow_count.instagram);
139
- }
140
- }
141
-
142
- $(".loading").css('display', 'none');
143
- $("span[data-scc]").fadeIn();
144
- } else {
145
- $("span[data-scc]").text('?');
146
- }
147
- },
148
- error: function(res) {
149
- $("span[data-scc]").text('?');
150
- }
151
- });
152
- });
153
- });
 
 
 
 
 
 
 
 
1
+ /*
2
+ jquery.scc-cache-info.js
3
+ Author: Daisuke Maruyama
4
+ Author URI: http://marubon.info/
5
+ License: GPL2 or later
6
+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt
7
+ */
8
+ ;jQuery(document).ready(function ($) {
9
+ return $('#scc-dashboard,#scc-dashboard-widget').each(function() {
10
+ $("span[data-scc]").css('display', 'none');
11
+
12
+ function isset( data ){
13
+ return ( typeof( data ) != 'undefined' );
14
+ }
15
+
16
+ $.ajax({
17
+ url: scc.endpoint + '?action=' + scc.action + '&nonce=' + scc.nonce,
18
+ dataType: 'jsonp',
19
+ cache: false,
20
+ success: function(res) {
21
+ if (res) {
22
+ console.log(res);
23
+ $("span[data-scc='spc']").text(res.share.post_count);
24
+ $("span[data-scc='spfcc']").text(res.share.primary.full_cache_count);
25
+ $("span[data-scc='sppcc']").text(res.share.primary.partial_cache_count);
26
+ $("span[data-scc='spncc']").text(res.share.primary.no_cache_count);
27
+ $("span[data-scc='spcs']").text(res.share.primary.cache_status);
28
+
29
+ $("span[data-scc='ssfcc']").text(res.share.secondary.full_cache_count);
30
+ $("span[data-scc='sspcc']").text(res.share.secondary.partial_cache_count);
31
+ $("span[data-scc='ssncc']").text(res.share.secondary.no_cache_count);
32
+ $("span[data-scc='sscs']").text(res.share.secondary.cache_status);
33
+
34
+ if ( res.share_delta.twitter > 0) {
35
+ $("span[data-scc='stwitter']").html(res.share_count.twitter + ' (<span class="delta-rise">+' + res.share_delta.twitter + '</span>)');
36
+ } else if (res.share_delta.twitter < 0) {
37
+ $("span[data-scc='stwitter']").html(res.share_count.twitter + ' (<span class="delta-fall">' + res.share_delta.twitter + '</span>)');
38
+ } else {
39
+ $("span[data-scc='stwitter']").html(res.share_count.twitter);
40
+ }
41
+ if (res.share_delta.facebook > 0) {
42
+ $("span[data-scc='sfacebook']").html(res.share_count.facebook + ' (<span class="delta-rise">+' + res.share_delta.facebook + '</span>)');
43
+ } else if (res.share_delta.facebook < 0) {
44
+ $("span[data-scc='sfacebook']").html(res.share_count.facebook + ' (<span class="delta-fall">' + res.share_delta.facebook + '</span>)');
45
+ } else {
46
+ $("span[data-scc='sfacebook']").html(res.share_count.facebook);
47
+ }
48
+
49
+ if (res.share_delta.gplus > 0) {
50
+ $("span[data-scc='sgplus']").html(res.share_count.gplus + ' (<span class="delta-rise">+' + res.share_delta.gplus + '</span>)');
51
+ } else if (res.share_delta.gplus < 0) {
52
+ $("span[data-scc='sgplus']").html(res.share_count.gplus + ' (<span class="delta-fall">' + res.share_delta.gplus + '</span>)');
53
+ } else {
54
+ $("span[data-scc='sgplus']").html(res.share_count.gplus);
55
+ }
56
+
57
+ if (res.share_delta.pocket > 0) {
58
+ $("span[data-scc='spocket']").html(res.share_count.pocket + ' (<span class="delta-rise">+' + res.share_delta.pocket + '</span>)');
59
+ } else if (res.share_delta.pocket < 0) {
60
+ $("span[data-scc='spocket']").html(res.share_count.pocket + ' (<span class="delta-fall">' + res.share_delta.pocket + '</span>)');
61
+ } else {
62
+ $("span[data-scc='spocket']").html(res.share_count.pocket);
63
+ }
64
+
65
+ if (res.share_delta.hatebu > 0) {
66
+ $("span[data-scc='shatebu']").html(res.share_count.hatebu + ' (<span class="delta-rise">+' + res.share_delta.hatebu + '</span>)');
67
+ } else if (res.share_delta.hatebu < 0) {
68
+ $("span[data-scc='shatebu']").html(res.share_count.hatebu + ' (<span class="delta-fall">' + res.share_delta.hatebu + '</span>)');
69
+ } else {
70
+ $("span[data-scc='shatebu']").html(res.share_count.hatebu);
71
+ }
72
+
73
+ if (res.share_delta.pinterest > 0) {
74
+ $("span[data-scc='spinterest']").html(res.share_count.pinterest + ' (<span class="delta-rise">+' + res.share_delta.pinterest + '</span>)');
75
+ } else if (res.share_delta.pinterest < 0) {
76
+ $("span[data-scc='spinterest']").html(res.share_count.pinterest + ' (<span class="delta-fall">' + res.share_delta.pinterest + '</span>)');
77
+ } else {
78
+ $("span[data-scc='spinterest']").html(res.share_count.pinterest);
79
+ }
80
+
81
+ if (res.share_delta.total > 0) {
82
+ $("span[data-scc='stotal']").html(res.share_count.total + ' (<span class="delta-rise">+' + res.share_delta.total + '</span>)');
83
+ } else if (res.share_delta.total < 0) {
84
+ $("span[data-scc='stotal']").html(res.share_count.total + ' (<span class="delta-fall">' + res.share_delta.total + '</span>)');
85
+ } else {
86
+ $("span[data-scc='stotal']").html(res.share_count.total);
87
+ }
88
+
89
+ $("span[data-scc='fpc']").text(res.follow.post_count);
90
+ $("span[data-scc='fpfcc']").text(res.follow.primary.full_cache_count);
91
+ $("span[data-scc='fppcc']").text(res.follow.primary.partial_cache_count);
92
+ $("span[data-scc='fpncc']").text(res.follow.primary.no_cache_count);
93
+ $("span[data-scc='fpcs']").text(res.follow.primary.cache_status);
94
+
95
+ $("span[data-scc='fsfcc']").text(res.follow.secondary.full_cache_count);
96
+ $("span[data-scc='fspcc']").text(res.follow.secondary.partial_cache_count);
97
+ $("span[data-scc='fsncc']").text(res.follow.secondary.no_cache_count);
98
+ $("span[data-scc='fscs']").text(res.follow.secondary.cache_status);
99
+
100
+ if (isset(res.follow_count)) {
101
+ if (isset(res.follow_delta) && res.follow_delta.twitter > 0) {
102
+ $("span[data-scc='ftwitter']").html(res.follow_count.twitter + ' (<span class="delta-rise">+' + res.follow_delta.twitter + '</span>)');
103
+ } else if (isset(res.follow_delta) && res.follow_delta.twitter < 0) {
104
+ $("span[data-scc='ftwitter']").html(res.follow_count.twitter + ' (<span class="delta-fall">' + res.follow_delta.twitter + '</span>)');
105
+ } else {
106
+ $("span[data-scc='ftwitter']").html(res.follow_count.twitter);
107
+ }
108
+ }
109
+
110
+ if (isset(res.follow_count)) {
111
+ if (isset(res.follow_delta) && res.follow_delta.facebook > 0) {
112
+ $("span[data-scc='ffacebook']").html(res.follow_count.facebook + ' (<span class="delta-rise">+' + res.follow_delta.facebook + '</span>)');
113
+ } else if (isset(res.follow_delta) && res.follow_delta.facebook < 0) {
114
+ $("span[data-scc='ffacebook']").html(res.follow_count.facebook + ' (<span class="delta-fall">' + res.follow_delta.facebook + '</span>)');
115
+ } else {
116
+ $("span[data-scc='ffacebook']").html(res.follow_count.facebook);
117
+ }
118
+ }
119
+
120
+ if ( isset( res.follow_count ) ) {
121
+ if (isset(res.follow_delta) && res.follow_delta.feedly > 0) {
122
+ $("span[data-scc='ffeedly']").html(res.follow_count.feedly + ' (<span class="delta-rise">+' + res.follow_delta.feedly + '</span>)');
123
+ } else if (isset(res.follow_delta) && res.follow_delta.feedly < 0) {
124
+ $("span[data-scc='ffeedly']").html(res.follow_count.feedly + ' (<span class="delta-fall">' + res.follow_delta.feedly + '</span>)');
125
+ } else {
126
+ $("span[data-scc='ffeedly']").html(res.follow_count.feedly);
127
+ }
128
+ }
129
+
130
+ if ( isset( res.follow_count ) ) {
131
+ if (isset(res.follow_delta) && res.follow_delta.push7 > 0) {
132
+ $("span[data-scc='fpush7']").html(res.follow_count.push7 + ' (<span class="delta-rise">+' + res.follow_delta.push7 + '</span>)');
133
+ } else if (isset(res.follow_delta) && res.follow_delta.push7 < 0) {
134
+ $("span[data-scc='fpush7']").html(res.follow_count.push7 + ' (<span class="delta-fall">' + res.follow_delta.push7 + '</span>)');
135
+ } else {
136
+ $("span[data-scc='fpush7']").html(res.follow_count.push7);
137
+ }
138
+ }
139
+
140
+ if ( isset( res.follow_count ) ) {
141
+ if (isset(res.follow_delta) && res.follow_delta.instagram > 0) {
142
+ $("span[data-scc='finstagram']").html(res.follow_count.instagram + ' (<span class="delta-rise">+' + res.follow_delta.instagram + '</span>)');
143
+ } else if (isset(res.follow_delta) && res.follow_delta.instagram < 0) {
144
+ $("span[data-scc='finstagram']").html(res.follow_count.instagram + ' (<span class="delta-fall">' + res.follow_delta.instagram + '</span>)');
145
+ } else {
146
+ $("span[data-scc='finstagram']").html(res.follow_count.instagram);
147
+ }
148
+ }
149
+
150
+ $(".loading").css('display', 'none');
151
+ $("span[data-scc]").fadeIn();
152
+ } else {
153
+ $("span[data-scc]").text('?');
154
+ }
155
+ },
156
+ error: function(res) {
157
+ $("span[data-scc]").text('?');
158
+ }
159
+ });
160
+ });
161
+ });
js/jquery.scc-cache-info.min.js CHANGED
@@ -3,10 +3,10 @@ b("span[data-scc='spncc']").text(a.share.primary.no_cache_count),b("span[data-sc
3
  a.share_delta.twitter+"</span>)"):0>a.share_delta.twitter?b("span[data-scc='stwitter']").html(a.share_count.twitter+' (<span class="delta-fall">'+a.share_delta.twitter+"</span>)"):b("span[data-scc='stwitter']").html(a.share_count.twitter),0<a.share_delta.facebook?b("span[data-scc='sfacebook']").html(a.share_count.facebook+' (<span class="delta-rise">+'+a.share_delta.facebook+"</span>)"):0>a.share_delta.facebook?b("span[data-scc='sfacebook']").html(a.share_count.facebook+' (<span class="delta-fall">'+
4
  a.share_delta.facebook+"</span>)"):b("span[data-scc='sfacebook']").html(a.share_count.facebook),0<a.share_delta.gplus?b("span[data-scc='sgplus']").html(a.share_count.gplus+' (<span class="delta-rise">+'+a.share_delta.gplus+"</span>)"):0>a.share_delta.gplus?b("span[data-scc='sgplus']").html(a.share_count.gplus+' (<span class="delta-fall">'+a.share_delta.gplus+"</span>)"):b("span[data-scc='sgplus']").html(a.share_count.gplus),0<a.share_delta.pocket?b("span[data-scc='spocket']").html(a.share_count.pocket+
5
  ' (<span class="delta-rise">+'+a.share_delta.pocket+"</span>)"):0>a.share_delta.pocket?b("span[data-scc='spocket']").html(a.share_count.pocket+' (<span class="delta-fall">'+a.share_delta.pocket+"</span>)"):b("span[data-scc='spocket']").html(a.share_count.pocket),0<a.share_delta.hatebu?b("span[data-scc='shatebu']").html(a.share_count.hatebu+' (<span class="delta-rise">+'+a.share_delta.hatebu+"</span>)"):0>a.share_delta.hatebu?b("span[data-scc='shatebu']").html(a.share_count.hatebu+' (<span class="delta-fall">'+
6
- a.share_delta.hatebu+"</span>)"):b("span[data-scc='shatebu']").html(a.share_count.hatebu),0<a.share_delta.total?b("span[data-scc='stotal']").html(a.share_count.total+' (<span class="delta-rise">+'+a.share_delta.total+"</span>)"):0>a.share_delta.total?b("span[data-scc='stotal']").html(a.share_count.total+' (<span class="delta-fall">'+a.share_delta.total+"</span>)"):b("span[data-scc='stotal']").html(a.share_count.total),b("span[data-scc='fpc']").text(a.follow.post_count),b("span[data-scc='fpfcc']").text(a.follow.primary.full_cache_count),
7
- b("span[data-scc='fppcc']").text(a.follow.primary.partial_cache_count),b("span[data-scc='fpncc']").text(a.follow.primary.no_cache_count),b("span[data-scc='fpcs']").text(a.follow.primary.cache_status),b("span[data-scc='fsfcc']").text(a.follow.secondary.full_cache_count),b("span[data-scc='fspcc']").text(a.follow.secondary.partial_cache_count),b("span[data-scc='fsncc']").text(a.follow.secondary.no_cache_count),b("span[data-scc='fscs']").text(a.follow.secondary.cache_status),c(a.follow_count)&&(c(a.follow_delta)&&
8
- 0<a.follow_delta.twitter?b("span[data-scc='ftwitter']").html(a.follow_count.twitter+' (<span class="delta-rise">+'+a.follow_delta.twitter+"</span>)"):c(a.follow_delta)&&0>a.follow_delta.twitter?b("span[data-scc='ftwitter']").html(a.follow_count.twitter+' (<span class="delta-fall">'+a.follow_delta.twitter+"</span>)"):b("span[data-scc='ftwitter']").html(a.follow_count.twitter)),c(a.follow_count)&&(c(a.follow_delta)&&0<a.follow_delta.facebook?b("span[data-scc='ffacebook']").html(a.follow_count.facebook+
9
- ' (<span class="delta-rise">+'+a.follow_delta.facebook+"</span>)"):c(a.follow_delta)&&0>a.follow_delta.facebook?b("span[data-scc='ffacebook']").html(a.follow_count.facebook+' (<span class="delta-fall">'+a.follow_delta.facebook+"</span>)"):b("span[data-scc='ffacebook']").html(a.follow_count.facebook)),c(a.follow_count)&&(c(a.follow_delta)&&0<a.follow_delta.feedly?b("span[data-scc='ffeedly']").html(a.follow_count.feedly+' (<span class="delta-rise">+'+a.follow_delta.feedly+"</span>)"):c(a.follow_delta)&&
10
- 0>a.follow_delta.feedly?b("span[data-scc='ffeedly']").html(a.follow_count.feedly+' (<span class="delta-fall">'+a.follow_delta.feedly+"</span>)"):b("span[data-scc='ffeedly']").html(a.follow_count.feedly)),c(a.follow_count)&&(c(a.follow_delta)&&0<a.follow_delta.push7?b("span[data-scc='fpush7']").html(a.follow_count.push7+' (<span class="delta-rise">+'+a.follow_delta.push7+"</span>)"):c(a.follow_delta)&&0>a.follow_delta.push7?b("span[data-scc='fpush7']").html(a.follow_count.push7+' (<span class="delta-fall">'+
11
- a.follow_delta.push7+"</span>)"):b("span[data-scc='fpush7']").html(a.follow_count.push7)),c(a.follow_count)&&(c(a.follow_delta)&&0<a.follow_delta.instagram?b("span[data-scc='finstagram']").html(a.follow_count.instagram+' (<span class="delta-rise">+'+a.follow_delta.instagram+"</span>)"):c(a.follow_delta)&&0>a.follow_delta.instagram?b("span[data-scc='finstagram']").html(a.follow_count.instagram+' (<span class="delta-fall">'+a.follow_delta.instagram+"</span>)"):b("span[data-scc='finstagram']").html(a.follow_count.instagram)),
12
- b(".loading").css("display","none"),b("span[data-scc]").fadeIn()):b("span[data-scc]").text("?")},error:function(a){b("span[data-scc]").text("?")}})})});
3
  a.share_delta.twitter+"</span>)"):0>a.share_delta.twitter?b("span[data-scc='stwitter']").html(a.share_count.twitter+' (<span class="delta-fall">'+a.share_delta.twitter+"</span>)"):b("span[data-scc='stwitter']").html(a.share_count.twitter),0<a.share_delta.facebook?b("span[data-scc='sfacebook']").html(a.share_count.facebook+' (<span class="delta-rise">+'+a.share_delta.facebook+"</span>)"):0>a.share_delta.facebook?b("span[data-scc='sfacebook']").html(a.share_count.facebook+' (<span class="delta-fall">'+
4
  a.share_delta.facebook+"</span>)"):b("span[data-scc='sfacebook']").html(a.share_count.facebook),0<a.share_delta.gplus?b("span[data-scc='sgplus']").html(a.share_count.gplus+' (<span class="delta-rise">+'+a.share_delta.gplus+"</span>)"):0>a.share_delta.gplus?b("span[data-scc='sgplus']").html(a.share_count.gplus+' (<span class="delta-fall">'+a.share_delta.gplus+"</span>)"):b("span[data-scc='sgplus']").html(a.share_count.gplus),0<a.share_delta.pocket?b("span[data-scc='spocket']").html(a.share_count.pocket+
5
  ' (<span class="delta-rise">+'+a.share_delta.pocket+"</span>)"):0>a.share_delta.pocket?b("span[data-scc='spocket']").html(a.share_count.pocket+' (<span class="delta-fall">'+a.share_delta.pocket+"</span>)"):b("span[data-scc='spocket']").html(a.share_count.pocket),0<a.share_delta.hatebu?b("span[data-scc='shatebu']").html(a.share_count.hatebu+' (<span class="delta-rise">+'+a.share_delta.hatebu+"</span>)"):0>a.share_delta.hatebu?b("span[data-scc='shatebu']").html(a.share_count.hatebu+' (<span class="delta-fall">'+
6
+ a.share_delta.hatebu+"</span>)"):b("span[data-scc='shatebu']").html(a.share_count.hatebu),0<a.share_delta.pinterest?b("span[data-scc='spinterest']").html(a.share_count.pinterest+' (<span class="delta-rise">+'+a.share_delta.pinterest+"</span>)"):0>a.share_delta.pinterest?b("span[data-scc='spinterest']").html(a.share_count.pinterest+' (<span class="delta-fall">'+a.share_delta.pinterest+"</span>)"):b("span[data-scc='spinterest']").html(a.share_count.pinterest),0<a.share_delta.total?b("span[data-scc='stotal']").html(a.share_count.total+
7
+ ' (<span class="delta-rise">+'+a.share_delta.total+"</span>)"):0>a.share_delta.total?b("span[data-scc='stotal']").html(a.share_count.total+' (<span class="delta-fall">'+a.share_delta.total+"</span>)"):b("span[data-scc='stotal']").html(a.share_count.total),b("span[data-scc='fpc']").text(a.follow.post_count),b("span[data-scc='fpfcc']").text(a.follow.primary.full_cache_count),b("span[data-scc='fppcc']").text(a.follow.primary.partial_cache_count),b("span[data-scc='fpncc']").text(a.follow.primary.no_cache_count),
8
+ b("span[data-scc='fpcs']").text(a.follow.primary.cache_status),b("span[data-scc='fsfcc']").text(a.follow.secondary.full_cache_count),b("span[data-scc='fspcc']").text(a.follow.secondary.partial_cache_count),b("span[data-scc='fsncc']").text(a.follow.secondary.no_cache_count),b("span[data-scc='fscs']").text(a.follow.secondary.cache_status),c(a.follow_count)&&(c(a.follow_delta)&&0<a.follow_delta.twitter?b("span[data-scc='ftwitter']").html(a.follow_count.twitter+' (<span class="delta-rise">+'+a.follow_delta.twitter+
9
+ "</span>)"):c(a.follow_delta)&&0>a.follow_delta.twitter?b("span[data-scc='ftwitter']").html(a.follow_count.twitter+' (<span class="delta-fall">'+a.follow_delta.twitter+"</span>)"):b("span[data-scc='ftwitter']").html(a.follow_count.twitter)),c(a.follow_count)&&(c(a.follow_delta)&&0<a.follow_delta.facebook?b("span[data-scc='ffacebook']").html(a.follow_count.facebook+' (<span class="delta-rise">+'+a.follow_delta.facebook+"</span>)"):c(a.follow_delta)&&0>a.follow_delta.facebook?b("span[data-scc='ffacebook']").html(a.follow_count.facebook+
10
+ ' (<span class="delta-fall">'+a.follow_delta.facebook+"</span>)"):b("span[data-scc='ffacebook']").html(a.follow_count.facebook)),c(a.follow_count)&&(c(a.follow_delta)&&0<a.follow_delta.feedly?b("span[data-scc='ffeedly']").html(a.follow_count.feedly+' (<span class="delta-rise">+'+a.follow_delta.feedly+"</span>)"):c(a.follow_delta)&&0>a.follow_delta.feedly?b("span[data-scc='ffeedly']").html(a.follow_count.feedly+' (<span class="delta-fall">'+a.follow_delta.feedly+"</span>)"):b("span[data-scc='ffeedly']").html(a.follow_count.feedly)),
11
+ c(a.follow_count)&&(c(a.follow_delta)&&0<a.follow_delta.push7?b("span[data-scc='fpush7']").html(a.follow_count.push7+' (<span class="delta-rise">+'+a.follow_delta.push7+"</span>)"):c(a.follow_delta)&&0>a.follow_delta.push7?b("span[data-scc='fpush7']").html(a.follow_count.push7+' (<span class="delta-fall">'+a.follow_delta.push7+"</span>)"):b("span[data-scc='fpush7']").html(a.follow_count.push7)),c(a.follow_count)&&(c(a.follow_delta)&&0<a.follow_delta.instagram?b("span[data-scc='finstagram']").html(a.follow_count.instagram+
12
+ ' (<span class="delta-rise">+'+a.follow_delta.instagram+"</span>)"):c(a.follow_delta)&&0>a.follow_delta.instagram?b("span[data-scc='finstagram']").html(a.follow_count.instagram+' (<span class="delta-fall">'+a.follow_delta.instagram+"</span>)"):b("span[data-scc='finstagram']").html(a.follow_count.instagram)),b(".loading").css("display","none"),b("span[data-scc]").fadeIn()):b("span[data-scc]").text("?")},error:function(a){b("span[data-scc]").text("?")}})})});
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: 2016-05-14 15:20+0900\n"
5
- "PO-Revision-Date: 2016-05-14 15:20+0900\n"
6
  "Last-Translator: Daisuke Maruyama <marubon@gmail.com>\n"
7
  "Language-Team: Daisuke Maruyama <marubon@gmail.com>\n"
8
  "Language: ja\n"
@@ -21,240 +21,246 @@ msgstr ""
21
  "X-Poedit-SearchPathExcluded-0: *.js\n"
22
 
23
  #. Plugin Name of the plugin/theme
24
- #: includes/admin-cache-status.php:63 includes/admin-dashboard.php:42
25
- #: includes/admin-help.php:33 includes/admin-hot-content.php:67
26
- #: includes/admin-setting.php:419 includes/admin-share-count.php:65
27
- #: sns-count-cache.php:1590
28
  msgid "SNS Count Cache"
29
  msgstr "SNS Count Cache"
30
 
31
- #: includes/admin-cache-status.php:66 includes/admin-dashboard.php:46
32
- #: includes/admin-help.php:36 includes/admin-hot-content.php:70
33
- #: includes/admin-setting.php:497 includes/admin-share-count.php:68
34
- #: sns-count-cache.php:1591
35
  msgid "Dashboard"
36
  msgstr "ダッシュボード"
37
 
38
- #: includes/admin-cache-status.php:67 includes/admin-cache-status.php:78
39
- #: includes/admin-dashboard-widget.php:45
40
- #: includes/admin-dashboard-widget.php:142 includes/admin-dashboard.php:47
41
- #: includes/admin-dashboard.php:60 includes/admin-dashboard.php:162
42
- #: includes/admin-help.php:37 includes/admin-help.php:63
43
- #: includes/admin-hot-content.php:71 includes/admin-setting.php:498
44
- #: includes/admin-share-count.php:69 sns-count-cache.php:1592
45
  msgid "Cache Status"
46
  msgstr "キャッシュ状況"
47
 
48
- #: includes/admin-cache-status.php:68 includes/admin-dashboard-widget.php:80
49
- #: includes/admin-dashboard.php:48 includes/admin-dashboard.php:95
50
- #: includes/admin-help.php:38 includes/admin-hot-content.php:72
51
- #: includes/admin-setting.php:499 includes/admin-share-count.php:70
52
- #: includes/admin-share-count.php:80 sns-count-cache.php:1593
53
  msgid "Share Count"
54
  msgstr "シェア数"
55
 
56
- #: includes/admin-cache-status.php:70 includes/admin-dashboard.php:50
57
- #: includes/admin-help.php:40 includes/admin-hot-content.php:73
58
- #: includes/admin-hot-content.php:80 includes/admin-setting.php:501
59
- #: includes/admin-share-count.php:72 sns-count-cache.php:1596
60
  msgid "Hot Content"
61
  msgstr "話題のコンテンツ"
62
 
63
- #: includes/admin-cache-status.php:72 includes/admin-dashboard.php:52
64
- #: includes/admin-help.php:42 includes/admin-hot-content.php:74
65
- #: includes/admin-setting.php:503 includes/admin-share-count.php:74
66
- #: sns-count-cache.php:1599
67
  msgid "Setting"
68
  msgstr "設定"
69
 
70
- #: includes/admin-cache-status.php:73 includes/admin-dashboard.php:53
71
- #: includes/admin-help.php:43 includes/admin-help.php:48
72
- #: includes/admin-hot-content.php:75 includes/admin-setting.php:504
73
- #: includes/admin-share-count.php:75 sns-count-cache.php:1600
74
  msgid "Help"
75
  msgstr "ヘルプ"
76
 
77
- #: includes/admin-cache-status.php:84 includes/admin-hot-content.php:86
78
- #: includes/admin-share-count.php:86
79
  msgid "Content"
80
  msgstr "コンテンツ"
81
 
82
- #: includes/admin-cache-status.php:85 includes/admin-dashboard-widget.php:59
83
- #: includes/admin-dashboard-widget.php:156 includes/admin-dashboard.php:74
84
- #: includes/admin-dashboard.php:176
85
  msgid "Primary Cache"
86
  msgstr "一次キャッシュ"
87
 
88
- #: includes/admin-cache-status.php:86 includes/admin-dashboard-widget.php:69
89
- #: includes/admin-dashboard-widget.php:166 includes/admin-dashboard.php:84
90
- #: includes/admin-dashboard.php:186
91
  msgid "Secondary Cache"
92
  msgstr "二次キャッシュ"
93
 
94
- #: includes/admin-cache-status.php:87
95
  msgid "Crawl Date"
96
  msgstr "クロール日時"
97
 
98
- #: includes/admin-cache-status.php:126 includes/admin-cache-status.php:165
99
- #: includes/admin-cache-status.php:223 includes/admin-cache-status.php:255
100
- #: includes/admin-help.php:68
101
  msgid "full cache"
102
  msgstr "完全キャッシュ"
103
 
104
- #: includes/admin-cache-status.php:130 includes/admin-cache-status.php:169
105
- #: includes/admin-cache-status.php:227 includes/admin-cache-status.php:259
106
- #: includes/admin-help.php:69
107
  msgid "partial cache"
108
  msgstr "部分キャッシュ"
109
 
110
- #: includes/admin-cache-status.php:134 includes/admin-cache-status.php:140
111
- #: includes/admin-cache-status.php:173 includes/admin-cache-status.php:205
112
- #: includes/admin-cache-status.php:231 includes/admin-cache-status.php:263
113
- #: includes/admin-help.php:70
114
  msgid "no cache"
115
  msgstr "未キャッシュ"
116
 
117
- #: includes/admin-cache-status.php:182 includes/admin-cache-status.php:282
118
  msgid "no data"
119
  msgstr "データなし"
120
 
121
- #: includes/admin-cache-status.php:189 includes/admin-cache-status.php:290
122
- #: includes/admin-setting.php:384 includes/admin-setting.php:1323
123
  msgid "Cache"
124
  msgstr "キャッシュ"
125
 
126
- #: includes/admin-dashboard-widget.php:44 includes/admin-dashboard.php:58
127
  msgid "Share"
128
  msgstr "Share"
129
 
130
- #: includes/admin-dashboard-widget.php:49
131
- #: includes/admin-dashboard-widget.php:146 includes/admin-dashboard.php:64
132
- #: includes/admin-dashboard.php:166
133
  msgid "Cache Type"
134
  msgstr "キャッシュタイプ"
135
 
136
- #: includes/admin-dashboard-widget.php:50
137
- #: includes/admin-dashboard-widget.php:147 includes/admin-dashboard.php:65
138
- #: includes/admin-dashboard.php:167
139
  msgid "Cache Progress"
140
  msgstr "キャッシュ進捗"
141
 
142
- #: includes/admin-dashboard-widget.php:51
143
- #: includes/admin-dashboard-widget.php:148 includes/admin-dashboard.php:66
144
- #: includes/admin-dashboard.php:168
145
  msgid "Total Content"
146
  msgstr "総コンテンツ数"
147
 
148
- #: includes/admin-dashboard-widget.php:52
149
- #: includes/admin-dashboard-widget.php:149 includes/admin-dashboard.php:67
150
- #: includes/admin-dashboard.php:169
151
  msgid "State - Full Cache"
152
  msgstr "状態 - 完全キャッシュ"
153
 
154
- #: includes/admin-dashboard-widget.php:53
155
- #: includes/admin-dashboard-widget.php:150 includes/admin-dashboard.php:68
156
- #: includes/admin-dashboard.php:170
157
  msgid "State - Partial Cache"
158
  msgstr "状態 - 部分キャッシュ"
159
 
160
- #: includes/admin-dashboard-widget.php:54
161
- #: includes/admin-dashboard-widget.php:151 includes/admin-dashboard.php:69
162
- #: includes/admin-dashboard.php:171
163
  msgid "State - No Cache"
164
  msgstr "状態 - 未キャッシュ"
165
 
166
- #: includes/admin-dashboard-widget.php:94
167
- #: includes/admin-dashboard-widget.php:191 includes/admin-dashboard.php:109
168
- #: includes/admin-dashboard.php:211 includes/admin-hot-content.php:102
169
- #: includes/admin-setting.php:881 includes/admin-setting.php:1309
170
- #: includes/admin-share-count.php:102
171
  msgid "Twitter"
172
  msgstr "Twitter"
173
 
174
- #: includes/admin-dashboard-widget.php:97
175
- #: includes/admin-dashboard-widget.php:194 includes/admin-dashboard.php:112
176
- #: includes/admin-dashboard.php:214 includes/admin-hot-content.php:105
177
- #: includes/admin-setting.php:865 includes/admin-setting.php:1297
178
- #: includes/admin-share-count.php:105
179
  msgid "Facebook"
180
  msgstr "Facebook"
181
 
182
- #: includes/admin-dashboard-widget.php:100 includes/admin-dashboard.php:115
183
- #: includes/admin-hot-content.php:108 includes/admin-setting.php:869
184
- #: includes/admin-share-count.php:108
185
  msgid "Google+"
186
  msgstr "Google+"
187
 
188
- #: includes/admin-dashboard-widget.php:103 includes/admin-dashboard.php:118
189
- #: includes/admin-hot-content.php:111 includes/admin-setting.php:877
190
- #: includes/admin-share-count.php:111
191
  msgid "Pocket"
192
  msgstr "Pocket"
193
 
194
- #: includes/admin-dashboard-widget.php:106 includes/admin-dashboard.php:121
195
- #: includes/admin-hot-content.php:114 includes/admin-share-count.php:114
196
  msgid "Hatebu"
197
  msgstr "はてブ"
198
 
199
- #: includes/admin-dashboard-widget.php:109 includes/admin-dashboard.php:124
200
- #: includes/admin-hot-content.php:117 includes/admin-share-count.php:117
 
 
 
 
 
 
201
  msgid "Total"
202
  msgstr "合計"
203
 
204
- #: includes/admin-dashboard-widget.php:141 includes/admin-dashboard.php:160
205
  msgid "Follow"
206
  msgstr "Follow"
207
 
208
- #: includes/admin-dashboard-widget.php:177
209
  msgid "Follower Count"
210
  msgstr "フォロワー数"
211
 
212
- #: includes/admin-dashboard-widget.php:197 includes/admin-dashboard.php:217
213
- #: includes/admin-setting.php:1301
214
  msgid "Feedly"
215
  msgstr "Feedly"
216
 
217
- #: includes/admin-dashboard-widget.php:200 includes/admin-dashboard.php:220
218
- #: includes/admin-setting.php:1293
219
  msgid "Instagram"
220
  msgstr "Instagram"
221
 
222
- #: includes/admin-dashboard-widget.php:203 includes/admin-dashboard.php:223
223
- #: includes/admin-setting.php:1305
224
  msgid "Push7"
225
  msgstr "Push7"
226
 
227
- #: includes/admin-dashboard.php:197
228
  msgid "Follow Count"
229
  msgstr "フォロー数"
230
 
231
- #: includes/admin-help.php:50
232
  msgid "What is WordPress plugin SNS Cout Cache?"
233
  msgstr "WordPressプラグイン SNS Count Cacheとは何か?"
234
 
235
- #: includes/admin-help.php:51
236
  msgid ""
237
  "WordPress plugin SNS Count Cache is a plugin which helps you to shorten page "
238
  "loading time when your site displays share and follower counts. This plugin "
239
- "gets share counts such as Twitter and Facebook, Google+, Pocket and caches "
240
- "these counts in the background. This plugin alse caches follower counts such "
241
- "as Twitter and Facebook, Feedly, Instagram, Push7 in the same way. The share "
242
- "and follower counts can be retrieved quickly not through network but through "
243
- "the cache using given functions."
244
  msgstr ""
245
  "WordPressプラグイン SNS Count Cacheは、シェア数やフォロワー数を表示している場"
246
  "合にページの表示時間を高速化するプラグインです。このプラグインは、Twitter、"
247
- "Facebook、Google+、Pocket、はてなブックマークのシェア数をバックグラウンドで取"
248
- "得し、キャッシュします。またTwitter、Facebook、Feedly、Instagram、Push7のフォ"
249
- "ロワー数も同様の方法でキャッシュします。これらのシェア数とフォロワー数は、所"
250
- "定の関数を用いることでネットワークからではなくキャッシュ経由で迅速に取得可能"
251
- "になります。"
252
 
253
- #: includes/admin-help.php:52
254
  msgid "How often does this plugin get and cache share counts?"
255
  msgstr "シェア数を取得、キャッシュする頻度は?"
256
 
257
- #: includes/admin-help.php:53
258
  msgid ""
259
  "Although this plugin gets share count of 20 posts at a time every 10 minutes "
260
  "by default, you can modify the setting in the \"Setting\" tab in the "
@@ -263,21 +269,21 @@ msgstr ""
263
  "デフォルトで10分ごとに20記事のシェア数を取得しますが、管理ページの「設定」タ"
264
  "ブにてその取得間隔と一度に取得対象とする記事数を変更できます。"
265
 
266
- #: includes/admin-help.php:54
267
  msgid "How can I know whether share count of each post is cached or not?"
268
  msgstr "各記事のシェア数のキャッシュ有無を確認する方法は?"
269
 
270
- #: includes/admin-help.php:55
271
  msgid ""
272
  "Cache status is described in the \"Cache Status\" tab in the administration "
273
  "page."
274
  msgstr "キャッシュ状況は、管理ページの「キャッシュ状況」タブにて確認可能です。"
275
 
276
- #: includes/admin-help.php:56
277
  msgid "How often does this plugin get and cache follower counts?"
278
  msgstr "フォロワー数を取得、キャッシュする頻度は?"
279
 
280
- #: includes/admin-help.php:57
281
  msgid ""
282
  "Although this plugin gets follower count once a day by default, you can "
283
  "modify the setting in the \"Setting\" tab in the administration page."
@@ -285,7 +291,7 @@ msgstr ""
285
  "デフォルトで1日に一回フォロワー数を取得しますが、管理ページの「設定」タブにて"
286
  "その取得間隔を変更できます。"
287
 
288
- #: includes/admin-help.php:58
289
  msgid ""
290
  "What is cache status such as \"full cache\", \"partial cache\" and \"no cache"
291
  "\"?"
@@ -293,33 +299,33 @@ msgstr ""
293
  "「完全キャッシュ」、「部分キャッシュ」、「未キャッシュ」等のキャッシュ状況と"
294
  "は何か?"
295
 
296
- #: includes/admin-help.php:59
297
  msgid "The following is the explanation of the cache status."
298
  msgstr "以下は、そのキャッシュ状況に関する説明です。"
299
 
300
- #: includes/admin-help.php:64 includes/admin-help.php:79
301
- #: includes/admin-help.php:97 includes/admin-help.php:166
302
- #: includes/admin-help.php:184
303
  msgid "Description"
304
  msgstr "説明"
305
 
306
- #: includes/admin-help.php:68
307
  msgid "Counts for selected all SNS are cached."
308
  msgstr "選択された全てのSNSのカウントがキャッシュされています。"
309
 
310
- #: includes/admin-help.php:69
311
  msgid "A subset of counts for selected SNS are cached."
312
  msgstr "選択された一部のSNSのカウントがキャッシュされています。"
313
 
314
- #: includes/admin-help.php:70
315
  msgid "Count for selected SNS are not cached at all."
316
  msgstr "選択されたSNSのカウントが全くキャッシュされていません。"
317
 
318
- #: includes/admin-help.php:73
319
  msgid "How can I get share count from the cache?"
320
  msgstr "キャッシュからSNSカウントを参照する方法は?"
321
 
322
- #: includes/admin-help.php:74
323
  msgid ""
324
  "The share count is retrieved from the cache using the following functions in "
325
  "the WordPress loop such as query_posts(), get_posts() and WP_Query()."
@@ -327,68 +333,72 @@ msgstr ""
327
  "WordPressのquery_posts()、get_posts()、WP_Query()等のループ内で下記の関数を使"
328
  "うことでキャッシュからSNSカウントを参照できます。"
329
 
330
- #: includes/admin-help.php:78 includes/admin-help.php:96
331
  msgid "Function"
332
  msgstr "関数"
333
 
334
- #: includes/admin-help.php:83
335
  msgid "Twitter share count is returned from cache."
336
  msgstr "キャッシュからTwitterのシェア数を取得します。"
337
 
338
- #: includes/admin-help.php:84
339
  msgid "Facebook share count is returned from cache."
340
  msgstr "キャッシュからFacebookのシェア数を取得します。"
341
 
342
- #: includes/admin-help.php:85
343
  msgid "Google Plus share count is returned from cache."
344
  msgstr "キャッシュからGoogle+のシェア数を取得します。"
345
 
346
- #: includes/admin-help.php:86
347
  msgid "Hatena Bookmark share count is returned from cache."
348
  msgstr "キャッシュからはてなブックマークのシェア数を取得します。"
349
 
350
- #: includes/admin-help.php:87
351
  msgid "Pocket share count is returned from cache."
352
  msgstr "キャッシュからPocketのシェア数を取得します。"
353
 
354
- #: includes/admin-help.php:88
 
 
 
 
355
  msgid "Total share count of selected SNS is returned from cache."
356
  msgstr "キャッシュから対象として設定されたSNSのカウントの総和を取得します。"
357
 
358
- #: includes/admin-help.php:91
359
  msgid "How can I get follower count from the cache?"
360
  msgstr "キャッシュからフォロワーの数を参照する方法は?"
361
 
362
- #: includes/admin-help.php:92
363
  msgid ""
364
  "The follower count is retrieved from the cache using the following functions."
365
  msgstr "フォロワーの数は、以下の関数を用いることでキャッシュから参照可能です。"
366
 
367
- #: includes/admin-help.php:101
368
  msgid "Feedly follower count is returned from cache."
369
  msgstr "キャッシュからFeedlyのフォロワーの数を取得します。"
370
 
371
- #: includes/admin-help.php:102
372
  msgid "Twitter follower count is returned from cache."
373
  msgstr "キャッシュからTwitterのフォロワーの数を取得します。"
374
 
375
- #: includes/admin-help.php:103
376
  msgid "Facebook follower count is returned from cache."
377
  msgstr "キャッシュからFacebookのフォロワーの数を取得します。"
378
 
379
- #: includes/admin-help.php:104
380
  msgid "Instagram follower count is returned from cache."
381
  msgstr "キャッシュからInstagramのフォロワーの数を取得します。"
382
 
383
- #: includes/admin-help.php:105
384
  msgid "Push7 follower count is returned from cache."
385
  msgstr "キャッシュからPush7のフォロワーの数を取得します。"
386
 
387
- #: includes/admin-help.php:108
388
  msgid "Example Code"
389
  msgstr "サンプルコード"
390
 
391
- #: includes/admin-help.php:109
392
  msgid ""
393
  "The code below describes a simple example which displays share count and "
394
  "follower count using the above functions."
@@ -396,52 +406,56 @@ msgstr ""
396
  "以下のコードは、上述した関数を用いてシェア数やフォロワー数を表示する簡単な例"
397
  "です。"
398
 
399
- #: includes/admin-help.php:160
400
  msgid "How can I access specific custom field containing each share count?"
401
  msgstr "シェア数を含むカスタムフィールドにアクセスする方法は?"
402
 
403
- #: includes/admin-help.php:161
404
  msgid ""
405
  "Custom fields including share count are accessed using the following meta "
406
  "keys."
407
  msgstr ""
408
  "シェア数を含むカスタムフィールドは、以下のmeta keyを用いて参照可能です。"
409
 
410
- #: includes/admin-help.php:165 includes/admin-help.php:183
411
  msgid "Meta Key"
412
  msgstr "Meta Key"
413
 
414
- #: includes/admin-help.php:170
415
  msgid "A meta key to access Twitter share count"
416
  msgstr "Twitterのシェア数にアクセスするためのMeta Keyです。"
417
 
418
- #: includes/admin-help.php:171
419
  msgid "A meta key to access Facebook share count"
420
  msgstr "Facebookのシェア数にアクセスするためのMeta Keyです。"
421
 
422
- #: includes/admin-help.php:172
423
  msgid "A meta key to access Google+ share count"
424
  msgstr "Google+のシェア数にアクセスするためのMeta Keyです。"
425
 
426
- #: includes/admin-help.php:173
427
  msgid "A meta key to access Hatena Bookmark share count"
428
  msgstr "はてなブックマークのシェア数にアクセスするためのMeta Keyです。"
429
 
430
- #: includes/admin-help.php:174
431
  msgid "A meta key to access Pocket share count"
432
  msgstr "Pocketのシェア数にアクセスするためのMeta Keyです。"
433
 
434
- #: includes/admin-help.php:175
 
 
 
 
435
  msgid "A meta key to access total share count"
436
  msgstr "シェア数の合計にアクセスするためのMeta Keyです。"
437
 
438
- #: includes/admin-help.php:178
439
  msgid ""
440
  "How can I access specific custom field containing each variation of share "
441
  "count?"
442
  msgstr "シェア数の増減を含むカスタムフィールドにアクセスする方法は?"
443
 
444
- #: includes/admin-help.php:179
445
  msgid ""
446
  "Custom fields including variation of share count are accessed using the "
447
  "following meta keys."
@@ -449,80 +463,85 @@ msgstr ""
449
  "シェア数の増減を含むカスタムフィールドは、以下のmeta keyを用いて参照可能で"
450
  "す。"
451
 
452
- #: includes/admin-help.php:188
453
  msgid "A meta key to access variation of Twitter share count"
454
  msgstr "Twitterのシェア数の増減数にアクセスするためのMeta Keyです。"
455
 
456
- #: includes/admin-help.php:189
457
  msgid "A meta key to access variation of Facebook share count"
458
  msgstr "Facebookのシェア数の増減数にアクセスするためのMeta Keyです。"
459
 
460
- #: includes/admin-help.php:190
461
  msgid "A meta key to access variation of Google+ share count"
462
  msgstr "Google+のシェア数の増減数にアクセスするためのMeta Keyです。"
463
 
464
- #: includes/admin-help.php:191
465
  msgid "A meta key to access variation of Hatena Bookmark share count"
466
  msgstr "はてなブックマークのシェア数の増減数にアクセスするためのMeta Keyです。"
467
 
468
- #: includes/admin-help.php:192
469
  msgid "A meta key to access variation of Pocket share count"
470
  msgstr "Pocketのシェア数の増減数にアクセスするためのMeta Keyです。"
471
 
472
- #: includes/admin-help.php:193
 
 
 
 
473
  msgid "A meta key to access variation of total share count"
474
  msgstr "シェア数合計の増減数にアクセスするためのMeta Keyです。"
475
 
476
- #: includes/admin-hot-content.php:262 includes/admin-hot-content.php:291
477
- #: includes/admin-hot-content.php:309 includes/admin-setting.php:565
478
- #: includes/admin-setting.php:602 includes/admin-setting.php:750
479
- #: includes/admin-setting.php:765 includes/admin-share-count.php:186
480
- #: includes/admin-share-count.php:200 includes/admin-share-count.php:228
481
- #: includes/admin-share-count.php:242 includes/admin-share-count.php:252
482
- #: includes/admin-share-count.php:280 includes/admin-share-count.php:294
483
- #: includes/admin-share-count.php:322 includes/admin-share-count.php:336
484
- #: includes/admin-share-count.php:346 includes/admin-share-count.php:389
485
- #: includes/admin-share-count.php:420
486
  msgid "N/A"
487
  msgstr "N/A"
488
 
489
- #: includes/admin-hot-content.php:305
490
  msgid "No hot content."
491
  msgstr "話題のコンテンツはありません。"
492
 
493
- #: includes/admin-setting.php:35 includes/admin-setting.php:935
494
- #: includes/admin-setting.php:975 includes/admin-setting.php:1017
495
- #: includes/admin-setting.php:1278 includes/admin-setting.php:1322
496
- #: includes/admin-setting.php:1380 includes/admin-setting.php:1448
497
- #: includes/admin-setting.php:1481 includes/admin-setting.php:1502
498
- #: includes/admin-setting.php:1578 includes/admin-setting.php:1605
499
- #: includes/admin-setting.php:1641 includes/admin-setting.php:1929
 
500
  msgid "Update All Options"
501
  msgstr "設定の更新"
502
 
503
- #: includes/admin-setting.php:323 includes/admin-setting.php:1984
504
  msgid "Reset"
505
  msgstr "リセット"
506
 
507
- #: includes/admin-setting.php:331 includes/admin-setting.php:1966
508
  msgid "Export"
509
  msgstr "エクスポート"
510
 
511
- #: includes/admin-setting.php:343 includes/admin-setting.php:1279
512
  msgid "Update Basis of Comparison"
513
  msgstr "比較基準の更新"
514
 
515
- #: includes/admin-setting.php:355 includes/admin-setting.php:370
516
- #: includes/admin-setting.php:936 includes/admin-setting.php:1324
517
  msgid "Clear Cache"
518
  msgstr "キャッシュの消去"
519
 
520
- #: includes/admin-setting.php:396 includes/admin-setting.php:1538
521
- #: includes/admin-setting.php:1580
522
  msgid "Get Bearer Token"
523
  msgstr "Bearer Tokenの取得"
524
 
525
- #: includes/admin-setting.php:444
526
  msgid ""
527
  "There was a problem spawning a call to the WP-Cron system on your site. This "
528
  "means WP-Cron jobs on your site may not work. The problem was: "
@@ -530,8 +549,20 @@ msgstr ""
530
  "あなたのサイト上でWP-Cronシステムの呼び出し処理に問題が見つかりました。あなた"
531
  "のサイト上でWP-Cronジョブが動作しない可能性があります。問題は次の通りです。"
532
 
533
- #: includes/admin-setting.php:454 includes/admin-setting.php:465
534
- #: includes/admin-setting.php:476 includes/admin-setting.php:487
 
 
 
 
 
 
 
 
 
 
 
 
535
  msgid ""
536
  "Configuratin is not enough to get follower count. Please set required "
537
  "parameters at "
@@ -539,299 +570,334 @@ msgstr ""
539
  "フォロワー数を取得するために必要な設定が不足しています。次のセクションで必要"
540
  "なパラメータを設定して下さい。"
541
 
542
- #: includes/admin-setting.php:455 includes/admin-setting.php:1331
543
  msgid "Follow Base Cache - Instagram"
544
  msgstr "フォロー基本キャシュ機能 - Instagram"
545
 
546
- #: includes/admin-setting.php:466 includes/admin-setting.php:758
547
- #: includes/admin-setting.php:1391
548
  msgid "Follow Base Cache - Facebook"
549
  msgstr "フォロー基本キャッシュ機能 - Facebook"
550
 
551
- #: includes/admin-setting.php:477 includes/admin-setting.php:1489
552
  msgid "Follow Base Cache - Push7"
553
  msgstr "フォロー基本キャッシュ機能 - Push7"
554
 
555
- #: includes/admin-setting.php:488 includes/admin-setting.php:743
556
- #: includes/admin-setting.php:1510
557
  msgid "Follow Base Cache - Twitter"
558
  msgstr "フォロー基本キャッシュ機能 - Twitter"
559
 
560
- #: includes/admin-setting.php:507 includes/admin-setting.php:512
561
  msgid "Current Setting"
562
  msgstr "現在の設定"
563
 
564
- #: includes/admin-setting.php:507 includes/admin-setting.php:524
565
- #: includes/admin-setting.php:558 includes/admin-setting.php:571
566
- #: includes/admin-setting.php:576 includes/admin-setting.php:581
567
- #: includes/admin-setting.php:595 includes/admin-setting.php:857
568
  msgid "Share Base Cache"
569
  msgstr "シェア基本キャッシュ機能"
570
 
571
- #: includes/admin-setting.php:507 includes/admin-setting.php:627
572
- #: includes/admin-setting.php:640 includes/admin-setting.php:982
 
573
  msgid "Share Rush Cache"
574
  msgstr "シェア臨時キャッシュ機能"
575
 
576
- #: includes/admin-setting.php:507 includes/admin-setting.php:649
577
- #: includes/admin-setting.php:670 includes/admin-setting.php:1023
578
  msgid "Share Variation Analysis"
579
  msgstr "シェア変動分析機能"
580
 
581
- #: includes/admin-setting.php:507 includes/admin-setting.php:678
582
- #: includes/admin-setting.php:703 includes/admin-setting.php:1285
583
  msgid "Follow Base Cache"
584
  msgstr "フォロー基本キャッシュ機能"
585
 
586
- #: includes/admin-setting.php:507 includes/admin-setting.php:772
587
- #: includes/admin-setting.php:1588
588
  msgid "Dynamic Cache"
589
  msgstr "動的キャッシュ機能"
590
 
591
- #: includes/admin-setting.php:507 includes/admin-setting.php:793
592
- #: includes/admin-setting.php:809 includes/admin-setting.php:1611
 
 
 
 
 
593
  msgid "Data Crawler"
594
  msgstr "データクローラ機能"
595
 
596
- #: includes/admin-setting.php:507 includes/admin-setting.php:822
597
- #: includes/admin-setting.php:840 includes/admin-setting.php:1647
598
  msgid "Data Export"
599
  msgstr "データエクスポート機能"
600
 
601
- #: includes/admin-setting.php:507 includes/admin-setting.php:1938
602
  msgid "Exported File"
603
  msgstr "エクスポートされたファイル"
604
 
605
- #: includes/admin-setting.php:517
606
  msgid "Capability"
607
  msgstr "機能"
608
 
609
- #: includes/admin-setting.php:518
610
  msgid "Parameter"
611
  msgstr "パラメータ"
612
 
613
- #: includes/admin-setting.php:519
614
  msgid "Value"
615
  msgstr "値"
616
 
617
- #: includes/admin-setting.php:525 includes/admin-setting.php:679
618
- #: includes/admin-setting.php:861 includes/admin-setting.php:1289
619
  msgid "Target SNS"
620
  msgstr "対象SNS"
621
 
622
- #: includes/admin-setting.php:537 includes/admin-setting.php:873
623
  msgid "Hatena Bookmark"
624
  msgstr "はてなブックマーク"
625
 
626
- #: includes/admin-setting.php:559 includes/admin-setting.php:886
627
  msgid "Custom post types"
628
  msgstr "カスタム投稿タイプ"
629
 
630
- #: includes/admin-setting.php:572 includes/admin-setting.php:641
631
- #: includes/admin-setting.php:894 includes/admin-setting.php:1008
632
  msgid "Interval cheking share count (sec)"
633
  msgstr "シェア数のチェック間隔(秒)"
634
 
635
- #: includes/admin-setting.php:573 includes/admin-setting.php:644
636
- #: includes/admin-setting.php:705 includes/admin-setting.php:1011
637
  msgid "seconds"
638
  msgstr "秒"
639
 
640
- #: includes/admin-setting.php:577 includes/admin-setting.php:901
 
641
  msgid "Number of contents to check at a time"
642
  msgstr "一度にチェックするコンテンツ数"
643
 
644
- #: includes/admin-setting.php:578
645
  msgid "contents"
646
  msgstr "コンテンツ"
647
 
648
- #: includes/admin-setting.php:582 includes/admin-setting.php:908
649
  msgid "Scheme migration mode from http to https"
650
  msgstr "HTTPからHTTPSへのスキーム移行モード"
651
 
652
- #: includes/admin-setting.php:586 includes/admin-setting.php:814
653
- #: includes/admin-setting.php:912 includes/admin-setting.php:1634
654
  msgid "On"
655
  msgstr "有効"
656
 
657
- #: includes/admin-setting.php:588 includes/admin-setting.php:816
658
- #: includes/admin-setting.php:911 includes/admin-setting.php:1633
659
  msgid "Off"
660
  msgstr "無効"
661
 
662
- #: includes/admin-setting.php:596 includes/admin-setting.php:919
663
  msgid "Scheme migration date from http to https"
664
  msgstr "HTTPからHTTPSへのスキーム移行日"
665
 
666
- #: includes/admin-setting.php:611 includes/admin-setting.php:943
667
  msgid "Share Base Cache - Twitter"
668
  msgstr "シェア基本キャッシュ機能 - Twitter"
669
 
670
- #: includes/admin-setting.php:612 includes/admin-setting.php:947
671
  msgid "Alternative Twitter API"
672
  msgstr "代替Twitter API"
673
 
674
- #: includes/admin-setting.php:628 includes/admin-setting.php:986
675
  msgid "Term considering posted content as new content"
676
  msgstr "投稿日からコンテンツを新着とみなす期間"
677
 
678
- #: includes/admin-setting.php:632
679
  msgid "day"
680
  msgstr "日"
681
 
682
- #: includes/admin-setting.php:634
683
  msgid "days"
684
  msgstr "日"
685
 
686
- #: includes/admin-setting.php:650 includes/admin-setting.php:1027
687
  msgid "Method to update basis of comparison"
688
  msgstr "比較基準の更新方式"
689
 
690
- #: includes/admin-setting.php:654 includes/admin-setting.php:777
691
- #: includes/admin-setting.php:1030 includes/admin-setting.php:1595
692
  msgid "Disabled (None)"
693
  msgstr "無効(なし)"
694
 
695
- #: includes/admin-setting.php:657 includes/admin-setting.php:1031
696
  msgid "Enabled (Manual)"
697
  msgstr "有効(手動)"
698
 
699
- #: includes/admin-setting.php:660 includes/admin-setting.php:1032
700
  msgid "Enabled (Scheduler)"
701
  msgstr "有効(スケジューラ)"
702
 
703
- #: includes/admin-setting.php:671
704
  msgid "Schedule"
705
  msgstr "スケジュール"
706
 
707
- #: includes/admin-setting.php:704 includes/admin-setting.php:1314
708
  msgid "Interval cheking follower count (sec)"
709
  msgstr "フォロワー数のチェック間隔(秒)"
710
 
711
- #: includes/admin-setting.php:709 includes/admin-setting.php:736
712
- #: includes/admin-setting.php:1459
713
  msgid "Follow Base Cache - Feedly"
714
  msgstr "フォロー基本キャッシュ機能 - Feedly"
715
 
716
- #: includes/admin-setting.php:710 includes/admin-setting.php:1463
717
  msgid "Target feed type"
718
  msgstr "対象フィードタイプ"
719
 
720
- #: includes/admin-setting.php:715 includes/admin-setting.php:730
721
- #: includes/admin-setting.php:1466
722
  msgid "Default"
723
  msgstr "デフォルト"
724
 
725
- #: includes/admin-setting.php:718 includes/admin-setting.php:1467
726
  msgid "RSS"
727
  msgstr "RSS"
728
 
729
- #: includes/admin-setting.php:721 includes/admin-setting.php:1468
730
  msgid "RSS2"
731
  msgstr "RSS2"
732
 
733
- #: includes/admin-setting.php:724 includes/admin-setting.php:1469
734
  msgid "RDF"
735
  msgstr "RDF"
736
 
737
- #: includes/admin-setting.php:727 includes/admin-setting.php:1470
738
  msgid "ATOM"
739
  msgstr "ATOM"
740
 
741
- #: includes/admin-setting.php:737 includes/admin-setting.php:1476
742
  msgid "Target feed"
743
  msgstr "対象フィード"
744
 
745
- #: includes/admin-setting.php:744
746
  msgid "Target screen name"
747
  msgstr "対象スクリーンネーム"
748
 
749
- #: includes/admin-setting.php:759 includes/admin-setting.php:1395
750
  msgid "Page ID"
751
  msgstr "対象ページID"
752
 
753
- #: includes/admin-setting.php:773 includes/admin-setting.php:1592
754
  msgid "Dynamic caching based on user access"
755
  msgstr "ユーザアクセスをトリガとする動的キャッシュ"
756
 
757
- #: includes/admin-setting.php:780 includes/admin-setting.php:1596
758
- msgid "Enabled (Synchronous Cache)"
759
- msgstr "有効(同期キャッシュ)"
 
 
760
 
761
- #: includes/admin-setting.php:783 includes/admin-setting.php:1597
762
- msgid "Enabled (Asynchronous Cache)"
763
- msgstr "有効(非同期キャッシュ)"
 
764
 
765
- #: includes/admin-setting.php:786 includes/admin-setting.php:1598
766
- msgid "Enabled (Asynchronous 2nd Cache)"
767
- msgstr "有効(非同期2次キャッシュ)"
768
 
769
- #: includes/admin-setting.php:794 includes/admin-setting.php:1615
770
  msgid "Crawl method"
771
  msgstr "クロールの方式"
772
 
773
- #: includes/admin-setting.php:799 includes/admin-setting.php:1620
774
  msgid "Normal (Sequential Retrieval)"
775
  msgstr "標準(逐次検索)"
776
 
777
- #: includes/admin-setting.php:802 includes/admin-setting.php:1623
778
  msgid "Extended (Parallel Retrieval)"
779
  msgstr "拡張(並列検索)"
780
 
781
- #: includes/admin-setting.php:810 includes/admin-setting.php:1630
782
  msgid "SSL verification"
783
  msgstr "SSL証明書の検証"
784
 
785
- #: includes/admin-setting.php:823 includes/admin-setting.php:1651
786
  msgid "Method of data export"
787
  msgstr "データのエクスポート方式"
788
 
789
- #: includes/admin-setting.php:827 includes/admin-setting.php:1654
790
  msgid "Manual"
791
  msgstr "手動"
792
 
793
- #: includes/admin-setting.php:830 includes/admin-setting.php:1067
794
- #: includes/admin-setting.php:1655 includes/admin-setting.php:1690
795
  msgid "Scheduler"
796
  msgstr "有効(スケジューラ)"
797
 
798
- #: includes/admin-setting.php:841
799
  msgid "Interval exporting share count to a csv file"
800
  msgstr "シェア数をCSVファイルにエクスポートする間隔"
801
 
802
- #: includes/admin-setting.php:842
803
  msgid "hours"
804
  msgstr "時間"
805
 
806
- #: includes/admin-setting.php:890
807
  msgid "e.g. aaa, bbb, ccc (comma-delimited)"
808
  msgstr "例. aaa, bbb, ccc(カンマ区切り)"
809
 
810
- #: includes/admin-setting.php:897
811
  msgid "Default: 600"
812
  msgstr "既定値: 600"
813
 
814
- #: includes/admin-setting.php:904
815
  msgid "Default: 20"
816
  msgstr "既定値: 20"
817
 
818
- #: includes/admin-setting.php:914
819
  msgid "Default: Off"
820
  msgstr "既定値: 無効"
821
 
822
- #: includes/admin-setting.php:922
823
  msgid "Default: N/A"
824
  msgstr "既定値: N/A"
825
 
826
- #: includes/admin-setting.php:954
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
827
  msgid "Default: "
828
  msgstr "規定値: "
829
 
830
- #: includes/admin-setting.php:958
831
  msgid "Registration destination"
832
  msgstr "登録先"
833
 
834
- #: includes/admin-setting.php:970
835
  msgid ""
836
  "You need to register information such as your domain with the above site in "
837
  "order to start counting."
@@ -839,279 +905,279 @@ msgstr ""
839
  "カウントを開始するためには、上記サイトにドメイン等の情報を登録する必要があり"
840
  "ます。"
841
 
842
- #: includes/admin-setting.php:989
843
  msgid "1 day"
844
  msgstr "1日"
845
 
846
- #: includes/admin-setting.php:990
847
  msgid "2 days"
848
  msgstr "2日"
849
 
850
- #: includes/admin-setting.php:991
851
  msgid "3 days"
852
  msgstr "3日"
853
 
854
- #: includes/admin-setting.php:992
855
  msgid "4 days"
856
  msgstr "4日"
857
 
858
- #: includes/admin-setting.php:993
859
  msgid "5 days"
860
  msgstr "5日"
861
 
862
- #: includes/admin-setting.php:994
863
  msgid "6 days"
864
  msgstr "6日"
865
 
866
- #: includes/admin-setting.php:995
867
  msgid "7 days"
868
  msgstr "7日"
869
 
870
- #: includes/admin-setting.php:996
871
  msgid "8 days"
872
  msgstr "8日"
873
 
874
- #: includes/admin-setting.php:997
875
  msgid "9 days"
876
  msgstr "9日"
877
 
878
- #: includes/admin-setting.php:998
879
  msgid "10 days"
880
  msgstr "10日"
881
 
882
- #: includes/admin-setting.php:999
883
  msgid "11 days"
884
  msgstr "11日"
885
 
886
- #: includes/admin-setting.php:1000
887
  msgid "12 days"
888
  msgstr "12日"
889
 
890
- #: includes/admin-setting.php:1001
891
  msgid "13 days"
892
  msgstr "13日"
893
 
894
- #: includes/admin-setting.php:1002
895
  msgid "14 days"
896
  msgstr "14日"
897
 
898
- #: includes/admin-setting.php:1004
899
  msgid "Default: 3 days"
900
  msgstr "既定値: 3日"
901
 
902
- #: includes/admin-setting.php:1034
903
  msgid "Default: None"
904
  msgstr "既定値: なし"
905
 
906
- #: includes/admin-setting.php:1072 includes/admin-setting.php:1695
907
  msgid "Type"
908
  msgstr "タイプ"
909
 
910
- #: includes/admin-setting.php:1077 includes/admin-setting.php:1700
911
  msgid "Hour"
912
  msgstr "時"
913
 
914
- #: includes/admin-setting.php:1080 includes/admin-setting.php:1703
915
  msgid "Minute"
916
  msgstr "分"
917
 
918
- #: includes/admin-setting.php:1086 includes/admin-setting.php:1709
919
  msgid "monthly"
920
  msgstr "毎月"
921
 
922
- #: includes/admin-setting.php:1097 includes/admin-setting.php:1720
923
  msgid "on 1."
924
  msgstr "1日"
925
 
926
- #: includes/admin-setting.php:1100 includes/admin-setting.php:1723
927
  msgid "on 2."
928
  msgstr "2日"
929
 
930
- #: includes/admin-setting.php:1103 includes/admin-setting.php:1726
931
  msgid "on 3."
932
  msgstr "3日"
933
 
934
- #: includes/admin-setting.php:1106 includes/admin-setting.php:1729
935
  msgid "on 4."
936
  msgstr "4日"
937
 
938
- #: includes/admin-setting.php:1109 includes/admin-setting.php:1732
939
  msgid "on 5."
940
  msgstr "5日"
941
 
942
- #: includes/admin-setting.php:1112 includes/admin-setting.php:1735
943
  msgid "on 6."
944
  msgstr "6日"
945
 
946
- #: includes/admin-setting.php:1115 includes/admin-setting.php:1738
947
  msgid "on 7."
948
  msgstr "7日"
949
 
950
- #: includes/admin-setting.php:1118 includes/admin-setting.php:1741
951
  msgid "on 8."
952
  msgstr "8日"
953
 
954
- #: includes/admin-setting.php:1121 includes/admin-setting.php:1744
955
  msgid "on 9."
956
  msgstr "9日"
957
 
958
- #: includes/admin-setting.php:1124 includes/admin-setting.php:1747
959
  msgid "on 10."
960
  msgstr "10日"
961
 
962
- #: includes/admin-setting.php:1127 includes/admin-setting.php:1750
963
  msgid "on 11."
964
  msgstr "11日"
965
 
966
- #: includes/admin-setting.php:1130 includes/admin-setting.php:1753
967
  msgid "on 12."
968
  msgstr "12日"
969
 
970
- #: includes/admin-setting.php:1133 includes/admin-setting.php:1756
971
  msgid "on 13."
972
  msgstr "13日"
973
 
974
- #: includes/admin-setting.php:1136 includes/admin-setting.php:1759
975
  msgid "on 14."
976
  msgstr "14日"
977
 
978
- #: includes/admin-setting.php:1139 includes/admin-setting.php:1762
979
  msgid "on 15."
980
  msgstr "15日"
981
 
982
- #: includes/admin-setting.php:1142 includes/admin-setting.php:1765
983
  msgid "on 16."
984
  msgstr "16日"
985
 
986
- #: includes/admin-setting.php:1145 includes/admin-setting.php:1768
987
  msgid "on 17."
988
  msgstr "17日"
989
 
990
- #: includes/admin-setting.php:1148 includes/admin-setting.php:1771
991
  msgid "on 18."
992
  msgstr "18日"
993
 
994
- #: includes/admin-setting.php:1151 includes/admin-setting.php:1774
995
  msgid "on 19."
996
  msgstr "19日"
997
 
998
- #: includes/admin-setting.php:1154 includes/admin-setting.php:1777
999
  msgid "on 20."
1000
  msgstr "20日"
1001
 
1002
- #: includes/admin-setting.php:1157 includes/admin-setting.php:1780
1003
  msgid "on 21."
1004
  msgstr "21日"
1005
 
1006
- #: includes/admin-setting.php:1160 includes/admin-setting.php:1783
1007
  msgid "on 22."
1008
  msgstr "22日"
1009
 
1010
- #: includes/admin-setting.php:1163 includes/admin-setting.php:1786
1011
  msgid "on 23."
1012
  msgstr "23日"
1013
 
1014
- #: includes/admin-setting.php:1166 includes/admin-setting.php:1789
1015
  msgid "on 24."
1016
  msgstr "24日"
1017
 
1018
- #: includes/admin-setting.php:1169 includes/admin-setting.php:1792
1019
  msgid "on 25."
1020
  msgstr "25日"
1021
 
1022
- #: includes/admin-setting.php:1172 includes/admin-setting.php:1795
1023
  msgid "on 26."
1024
  msgstr "26日"
1025
 
1026
- #: includes/admin-setting.php:1175 includes/admin-setting.php:1798
1027
  msgid "on 27."
1028
  msgstr "27日"
1029
 
1030
- #: includes/admin-setting.php:1178 includes/admin-setting.php:1801
1031
  msgid "on 28."
1032
  msgstr "28日"
1033
 
1034
- #: includes/admin-setting.php:1181 includes/admin-setting.php:1804
1035
  msgid "on 29."
1036
  msgstr "29日"
1037
 
1038
- #: includes/admin-setting.php:1184 includes/admin-setting.php:1807
1039
  msgid "on 30."
1040
  msgstr "30日"
1041
 
1042
- #: includes/admin-setting.php:1187 includes/admin-setting.php:1810
1043
  msgid "on 31."
1044
  msgstr "31日"
1045
 
1046
- #: includes/admin-setting.php:1214 includes/admin-setting.php:1841
1047
  msgid "weekly"
1048
  msgstr "毎週"
1049
 
1050
- #: includes/admin-setting.php:1220 includes/admin-setting.php:1847
1051
  msgid "Sunday"
1052
  msgstr "日曜日"
1053
 
1054
- #: includes/admin-setting.php:1221 includes/admin-setting.php:1848
1055
  msgid "Monday"
1056
  msgstr "月曜日"
1057
 
1058
- #: includes/admin-setting.php:1222 includes/admin-setting.php:1849
1059
  msgid "Tuesday"
1060
  msgstr "火曜日"
1061
 
1062
- #: includes/admin-setting.php:1223 includes/admin-setting.php:1850
1063
  msgid "Wednesday"
1064
  msgstr "水曜日"
1065
 
1066
- #: includes/admin-setting.php:1224 includes/admin-setting.php:1851
1067
  msgid "Thursday"
1068
  msgstr "木曜日"
1069
 
1070
- #: includes/admin-setting.php:1225 includes/admin-setting.php:1852
1071
  msgid "Friday"
1072
  msgstr "金曜日"
1073
 
1074
- #: includes/admin-setting.php:1226 includes/admin-setting.php:1853
1075
  msgid "Saturday"
1076
  msgstr "土曜日"
1077
 
1078
- #: includes/admin-setting.php:1248 includes/admin-setting.php:1879
1079
  msgid "daily"
1080
  msgstr "毎日"
1081
 
1082
- #: includes/admin-setting.php:1317
1083
  msgid "Default: 86400 Minimum: 3600"
1084
  msgstr "既定値: 86400 最小値: 3600"
1085
 
1086
- #: includes/admin-setting.php:1335
1087
  msgid "Client ID"
1088
  msgstr "Client ID"
1089
 
1090
- #: includes/admin-setting.php:1339
1091
  msgid "Instagram client ID for OAuth"
1092
  msgstr "OAuth認証のためのInstagram client ID"
1093
 
1094
- #: includes/admin-setting.php:1343
1095
  msgid "Client secret"
1096
  msgstr "Client secret"
1097
 
1098
- #: includes/admin-setting.php:1347
1099
  msgid "Instagram client secret for OAuth"
1100
  msgstr "OAuth認証のためのInstagram client secret"
1101
 
1102
- #: includes/admin-setting.php:1351 includes/admin-setting.php:1419
1103
  msgid "Redirect URI"
1104
  msgstr "Redirect URI"
1105
 
1106
- #: includes/admin-setting.php:1353 includes/admin-setting.php:1362
1107
- #: includes/admin-setting.php:1421 includes/admin-setting.php:1430
1108
- #: includes/admin-setting.php:1542
1109
  msgid "To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."
1110
  msgstr ""
1111
  "フィールドをクリック後、Ctrl + C (PC)、またはCmd + C (Mac)を押下しコピーして"
1112
  "下さい。"
1113
 
1114
- #: includes/admin-setting.php:1355
1115
  msgid ""
1116
  "Copy and set this to the field of \"Valid redirect URIs\" in the client "
1117
  "management page of Instagram developer page."
@@ -1119,45 +1185,24 @@ msgstr ""
1119
  "Instagram開発者向けページ内のクライアント管理ページにて「Valid redirect "
1120
  "URIs」フィールドにこのURIを設定して下さい。"
1121
 
1122
- #: includes/admin-setting.php:1360 includes/admin-setting.php:1370
1123
- #: includes/admin-setting.php:1428 includes/admin-setting.php:1438
1124
- msgid "Access token"
1125
- msgstr "Access Token"
1126
-
1127
- #: includes/admin-setting.php:1364 includes/admin-setting.php:1432
1128
- #: includes/admin-setting.php:1544
1129
  msgid "Copy and pase this into the fields below."
1130
  msgstr "以下のフィールドにコピー&ペーストして下さい。"
1131
 
1132
- #: includes/admin-setting.php:1374
1133
  msgid "Instagram access token for OAuth"
1134
  msgstr "OAuth認証のためのInstagram access token"
1135
 
1136
- #: includes/admin-setting.php:1382 includes/admin-setting.php:1450
1137
  msgid "Get Access Token"
1138
  msgstr "Access Tokenの取得"
1139
 
1140
- #: includes/admin-setting.php:1399
1141
  msgid "Facebook page ID that you want to get follower count"
1142
  msgstr "フォロワー数を取得するFacebookページID"
1143
 
1144
- #: includes/admin-setting.php:1403
1145
- msgid "App ID (Client ID)"
1146
- msgstr "App ID (Client ID)"
1147
-
1148
- #: includes/admin-setting.php:1407
1149
- msgid "Facebook app ID for OAuth"
1150
- msgstr "OAuth認証のためのFacebook app ID"
1151
-
1152
- #: includes/admin-setting.php:1411
1153
- msgid "App secret (Client secret)"
1154
- msgstr "App secret (Client secret)"
1155
-
1156
- #: includes/admin-setting.php:1415
1157
- msgid "Facebook app secret for OAuth"
1158
- msgstr "OAuth認証のためのFacebook app secret"
1159
-
1160
- #: includes/admin-setting.php:1423
1161
  msgid ""
1162
  "Copy and set this to the field of \"Valid OAuth redirect URIs\" in client "
1163
  "management page of Facebook developer page"
@@ -1165,149 +1210,149 @@ msgstr ""
1165
  "Facebook開発者向けページ内のクライアント管理ページにて「Valid OAuth redirect "
1166
  "URIs」フィールドにこのURIを設定して下さい。"
1167
 
1168
- #: includes/admin-setting.php:1442
1169
- msgid "Facebook access token for OAuth"
1170
- msgstr "OAuth認証のためのFacebook access token"
1171
-
1172
- #: includes/admin-setting.php:1472
1173
  msgid "Default: Default"
1174
  msgstr "規定値: デフォルト"
1175
 
1176
- #: includes/admin-setting.php:1493
1177
  msgid "AppNo"
1178
  msgstr "AppNo"
1179
 
1180
- #: includes/admin-setting.php:1497
1181
  msgid "Push7 appno to access Push7 API"
1182
  msgstr "Push7 APIにアクセスするためのAppNo"
1183
 
1184
- #: includes/admin-setting.php:1514
1185
  msgid "Screen name"
1186
  msgstr "スクリーン名"
1187
 
1188
- #: includes/admin-setting.php:1519
1189
  msgid "Twitter screen name that you want to get follower count"
1190
  msgstr "フォロワー数を取得するTwitterのスクリーン名"
1191
 
1192
- #: includes/admin-setting.php:1523
1193
  msgid "Consumer key (API Key)"
1194
  msgstr "Consumer key (API Key)"
1195
 
1196
- #: includes/admin-setting.php:1527
1197
  msgid "Twitter consumer key for OAuth"
1198
  msgstr "OAuth認証のためのTwitter consumer key"
1199
 
1200
- #: includes/admin-setting.php:1531
1201
  msgid "Consumer secret (API Secret)"
1202
  msgstr "Consumer secret (API Secret)"
1203
 
1204
- #: includes/admin-setting.php:1535
1205
  msgid "Twitter consumer secret for OAuth"
1206
  msgstr "OAuth認証のためのTwitter consumer secret"
1207
 
1208
- #: includes/admin-setting.php:1540 includes/admin-setting.php:1550
1209
  msgid "Bearer token"
1210
  msgstr "Bearer token"
1211
 
1212
- #: includes/admin-setting.php:1554
1213
  msgid "Twitter bearer token for OAuth"
1214
  msgstr "OAuth認証のためのTwitter bearer token"
1215
 
1216
- #: includes/admin-setting.php:1600
1217
- msgid "Default: Enabled (Asynchronous 2nd Cache)"
1218
- msgstr "既定値: 有効(非同期2次キャッシュ)"
 
 
 
 
1219
 
1220
- #: includes/admin-setting.php:1636
1221
  msgid "Default: On"
1222
  msgstr "既定値: 有効"
1223
 
1224
- #: includes/admin-setting.php:1657
1225
  msgid "Default: Manual"
1226
  msgstr "既定値: 手動"
1227
 
1228
- #: includes/admin-setting.php:1906
1229
  msgid "hourly"
1230
  msgstr "毎時"
1231
 
1232
- #: includes/admin-setting.php:1943
1233
  msgid "Disk usage of exported file"
1234
  msgstr "エクスポートされたファイルのディスク使用量"
1235
 
1236
- #: includes/admin-setting.php:1952
1237
  msgid "No exported file"
1238
  msgstr "エクスポートされたファイルは存在しません。"
1239
 
1240
- #: includes/admin-setting.php:1964
1241
  msgid "Manual export"
1242
  msgstr "手動エクスポート"
1243
 
1244
- #: includes/admin-setting.php:1968
1245
  msgid "Export share count to a csv file."
1246
  msgstr "シェア数をCSVファイルにエクスポートします。"
1247
 
1248
- #: includes/admin-setting.php:1982
1249
  msgid "Reset of exported file"
1250
  msgstr "エクスポートされたファイルのリセット"
1251
 
1252
- #: includes/admin-setting.php:1986
1253
  msgid "Clear exported csv file."
1254
  msgstr "エクスポートされたCSVファイルを削除します。"
1255
 
1256
- #: includes/admin-setting.php:1997
1257
  msgid "Download of exported file"
1258
  msgstr "エクスポートされたファイルのダウンロード"
1259
 
1260
- #: includes/admin-setting.php:1999 includes/download.php:36
1261
  msgid "Download"
1262
  msgstr "ダウンロード"
1263
 
1264
- #: includes/admin-setting.php:2001
1265
  msgid "Download the exported csv file."
1266
  msgstr "エクスポートされたCSVファイルをダウンロードします。"
1267
 
1268
- #: includes/download.php:66 includes/download.php:69 index.php:47 index.php:50
1269
- #: index.php:53 sns-count-cache.php:1622 sns-count-cache.php:1635
1270
- #: sns-count-cache.php:1647 sns-count-cache.php:1659 sns-count-cache.php:1671
1271
- #: sns-count-cache.php:1683 sns-count-cache.php:1695 sns-count-cache.php:1707
1272
  msgid "You do not have sufficient permissions to access this page."
1273
  msgstr "このページにアクセスするために必要な権限がありません。"
1274
 
1275
- #: sns-count-cache.php:1591
1276
  msgid "Dashboard | SNS Count Cache"
1277
  msgstr "ダッシュボード | SNS Count Cache"
1278
 
1279
- #: sns-count-cache.php:1592
1280
  msgid "Cache Status | SNS Count Cache"
1281
  msgstr "キャッシュ状況 | SNS Count Cache"
1282
 
1283
- #: sns-count-cache.php:1593
1284
  msgid "Share Count | SNS Count Cache"
1285
  msgstr "シェア数 | SNS Count Cache"
1286
 
1287
- #: sns-count-cache.php:1596
1288
  msgid "Hot Content | SNS Count Cache"
1289
  msgstr "話題のコンテンツ | SNS Count Cache"
1290
 
1291
- #: sns-count-cache.php:1599
1292
  msgid "Setting | SNS Count Cache"
1293
  msgstr "設定 | SNS Count Cache"
1294
 
1295
- #: sns-count-cache.php:1600
1296
  msgid "Help | SNS Count Cache"
1297
  msgstr "ヘルプ | SNS Count Cache"
1298
 
1299
- #: sns-count-cache.php:2169 sns-count-cache.php:2177 sns-count-cache.php:2309
1300
- #: sns-count-cache.php:2317
1301
  msgid "Completed"
1302
  msgstr "完了"
1303
 
1304
- #: sns-count-cache.php:2171 sns-count-cache.php:2179 sns-count-cache.php:2311
1305
- #: sns-count-cache.php:2319
1306
  msgid "Partially Completed"
1307
  msgstr "部分的完了"
1308
 
1309
- #: sns-count-cache.php:2173 sns-count-cache.php:2181 sns-count-cache.php:2313
1310
- #: sns-count-cache.php:2321
1311
  msgid "Ongoing"
1312
  msgstr "進行中"
1313
 
@@ -1318,22 +1363,67 @@ msgstr "https://wordpress.org/plugins/sns-count-cache/"
1318
  #. Description of the plugin/theme
1319
  msgid ""
1320
  "SNS Count Cache gets share count for Twitter and Facebook, Google Plus, "
1321
- "Pocket, Hatena Bookmark and caches these count in the background. This "
1322
- "plugin may help you to shorten page loading time because the share count can "
1323
- "be retrieved not through network but through the cache using given functions."
 
1324
  msgstr ""
1325
- "SNS Count Cacheは、Twitter、Facebook、Google+、Pocket、はてなブックマークの"
1326
- "シェア数を取得し、バックグラウンドでキャッシュします。用意された関数を利用す"
1327
- "ることで、ネットワーク経由でなくキャッシュからシェア数を参照できようになるた"
1328
- "め、ページ読み込みの高速化が見込めます。"
1329
 
1330
  #. Author of the plugin/theme
1331
  msgid "Daisuke Maruyama"
1332
  msgstr "Daisuke Maruyama"
1333
 
1334
  #. Author URI of the plugin/theme
1335
- msgid "http://marubon.info/"
1336
- msgstr "http://marubon.info/"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1337
 
1338
  #~ msgid ""
1339
  #~ "WordPress plugin SNS Count Cache is a plugin which helps you to shorten "
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: SNS Count Cache\n"
4
+ "POT-Creation-Date: 2016-09-26 01:16+0900\n"
5
+ "PO-Revision-Date: 2016-09-26 01:17+0900\n"
6
  "Last-Translator: Daisuke Maruyama <marubon@gmail.com>\n"
7
  "Language-Team: Daisuke Maruyama <marubon@gmail.com>\n"
8
  "Language: ja\n"
21
  "X-Poedit-SearchPathExcluded-0: *.js\n"
22
 
23
  #. Plugin Name of the plugin/theme
24
+ #: includes/admin-cache-status.php:65 includes/admin-dashboard.php:43
25
+ #: includes/admin-help.php:34 includes/admin-hot-content.php:69
26
+ #: includes/admin-setting.php:437 includes/admin-share-count.php:67
27
+ #: sns-count-cache.php:1670
28
  msgid "SNS Count Cache"
29
  msgstr "SNS Count Cache"
30
 
31
+ #: includes/admin-cache-status.php:68 includes/admin-dashboard.php:47
32
+ #: includes/admin-help.php:37 includes/admin-hot-content.php:72
33
+ #: includes/admin-setting.php:526 includes/admin-share-count.php:70
34
+ #: sns-count-cache.php:1671
35
  msgid "Dashboard"
36
  msgstr "ダッシュボード"
37
 
38
+ #: includes/admin-cache-status.php:69 includes/admin-cache-status.php:80
39
+ #: includes/admin-dashboard-widget.php:47
40
+ #: includes/admin-dashboard-widget.php:147 includes/admin-dashboard.php:48
41
+ #: includes/admin-dashboard.php:61 includes/admin-dashboard.php:166
42
+ #: includes/admin-help.php:38 includes/admin-help.php:64
43
+ #: includes/admin-hot-content.php:73 includes/admin-setting.php:527
44
+ #: includes/admin-share-count.php:71 sns-count-cache.php:1672
45
  msgid "Cache Status"
46
  msgstr "キャッシュ状況"
47
 
48
+ #: includes/admin-cache-status.php:70 includes/admin-dashboard-widget.php:82
49
+ #: includes/admin-dashboard.php:49 includes/admin-dashboard.php:96
50
+ #: includes/admin-help.php:39 includes/admin-hot-content.php:74
51
+ #: includes/admin-setting.php:528 includes/admin-share-count.php:72
52
+ #: includes/admin-share-count.php:82 sns-count-cache.php:1673
53
  msgid "Share Count"
54
  msgstr "シェア数"
55
 
56
+ #: includes/admin-cache-status.php:72 includes/admin-dashboard.php:51
57
+ #: includes/admin-help.php:41 includes/admin-hot-content.php:75
58
+ #: includes/admin-hot-content.php:82 includes/admin-setting.php:530
59
+ #: includes/admin-share-count.php:74 sns-count-cache.php:1676
60
  msgid "Hot Content"
61
  msgstr "話題のコンテンツ"
62
 
63
+ #: includes/admin-cache-status.php:74 includes/admin-dashboard.php:53
64
+ #: includes/admin-help.php:43 includes/admin-hot-content.php:76
65
+ #: includes/admin-setting.php:532 includes/admin-share-count.php:76
66
+ #: sns-count-cache.php:1679
67
  msgid "Setting"
68
  msgstr "設定"
69
 
70
+ #: includes/admin-cache-status.php:75 includes/admin-dashboard.php:54
71
+ #: includes/admin-help.php:44 includes/admin-help.php:49
72
+ #: includes/admin-hot-content.php:77 includes/admin-setting.php:533
73
+ #: includes/admin-share-count.php:77 sns-count-cache.php:1680
74
  msgid "Help"
75
  msgstr "ヘルプ"
76
 
77
+ #: includes/admin-cache-status.php:86 includes/admin-hot-content.php:88
78
+ #: includes/admin-share-count.php:88
79
  msgid "Content"
80
  msgstr "コンテンツ"
81
 
82
+ #: includes/admin-cache-status.php:87 includes/admin-dashboard-widget.php:61
83
+ #: includes/admin-dashboard-widget.php:161 includes/admin-dashboard.php:75
84
+ #: includes/admin-dashboard.php:180
85
  msgid "Primary Cache"
86
  msgstr "一次キャッシュ"
87
 
88
+ #: includes/admin-cache-status.php:88 includes/admin-dashboard-widget.php:71
89
+ #: includes/admin-dashboard-widget.php:171 includes/admin-dashboard.php:85
90
+ #: includes/admin-dashboard.php:190
91
  msgid "Secondary Cache"
92
  msgstr "二次キャッシュ"
93
 
94
+ #: includes/admin-cache-status.php:89
95
  msgid "Crawl Date"
96
  msgstr "クロール日時"
97
 
98
+ #: includes/admin-cache-status.php:128 includes/admin-cache-status.php:167
99
+ #: includes/admin-cache-status.php:225 includes/admin-cache-status.php:257
100
+ #: includes/admin-help.php:69
101
  msgid "full cache"
102
  msgstr "完全キャッシュ"
103
 
104
+ #: includes/admin-cache-status.php:132 includes/admin-cache-status.php:171
105
+ #: includes/admin-cache-status.php:229 includes/admin-cache-status.php:261
106
+ #: includes/admin-help.php:70
107
  msgid "partial cache"
108
  msgstr "部分キャッシュ"
109
 
110
+ #: includes/admin-cache-status.php:136 includes/admin-cache-status.php:142
111
+ #: includes/admin-cache-status.php:175 includes/admin-cache-status.php:207
112
+ #: includes/admin-cache-status.php:233 includes/admin-cache-status.php:265
113
+ #: includes/admin-help.php:71
114
  msgid "no cache"
115
  msgstr "未キャッシュ"
116
 
117
+ #: includes/admin-cache-status.php:184 includes/admin-cache-status.php:284
118
  msgid "no data"
119
  msgstr "データなし"
120
 
121
+ #: includes/admin-cache-status.php:191 includes/admin-cache-status.php:292
122
+ #: includes/admin-setting.php:402 includes/admin-setting.php:1421
123
  msgid "Cache"
124
  msgstr "キャッシュ"
125
 
126
+ #: includes/admin-dashboard-widget.php:46 includes/admin-dashboard.php:59
127
  msgid "Share"
128
  msgstr "Share"
129
 
130
+ #: includes/admin-dashboard-widget.php:51
131
+ #: includes/admin-dashboard-widget.php:151 includes/admin-dashboard.php:65
132
+ #: includes/admin-dashboard.php:170
133
  msgid "Cache Type"
134
  msgstr "キャッシュタイプ"
135
 
136
+ #: includes/admin-dashboard-widget.php:52
137
+ #: includes/admin-dashboard-widget.php:152 includes/admin-dashboard.php:66
138
+ #: includes/admin-dashboard.php:171
139
  msgid "Cache Progress"
140
  msgstr "キャッシュ進捗"
141
 
142
+ #: includes/admin-dashboard-widget.php:53
143
+ #: includes/admin-dashboard-widget.php:153 includes/admin-dashboard.php:67
144
+ #: includes/admin-dashboard.php:172
145
  msgid "Total Content"
146
  msgstr "総コンテンツ数"
147
 
148
+ #: includes/admin-dashboard-widget.php:54
149
+ #: includes/admin-dashboard-widget.php:154 includes/admin-dashboard.php:68
150
+ #: includes/admin-dashboard.php:173
151
  msgid "State - Full Cache"
152
  msgstr "状態 - 完全キャッシュ"
153
 
154
+ #: includes/admin-dashboard-widget.php:55
155
+ #: includes/admin-dashboard-widget.php:155 includes/admin-dashboard.php:69
156
+ #: includes/admin-dashboard.php:174
157
  msgid "State - Partial Cache"
158
  msgstr "状態 - 部分キャッシュ"
159
 
160
+ #: includes/admin-dashboard-widget.php:56
161
+ #: includes/admin-dashboard-widget.php:156 includes/admin-dashboard.php:70
162
+ #: includes/admin-dashboard.php:175
163
  msgid "State - No Cache"
164
  msgstr "状態 - 未キャッシュ"
165
 
166
+ #: includes/admin-dashboard-widget.php:96
167
+ #: includes/admin-dashboard-widget.php:196 includes/admin-dashboard.php:110
168
+ #: includes/admin-dashboard.php:215 includes/admin-hot-content.php:104
169
+ #: includes/admin-setting.php:934 includes/admin-setting.php:1407
170
+ #: includes/admin-share-count.php:104
171
  msgid "Twitter"
172
  msgstr "Twitter"
173
 
174
+ #: includes/admin-dashboard-widget.php:99
175
+ #: includes/admin-dashboard-widget.php:199 includes/admin-dashboard.php:113
176
+ #: includes/admin-dashboard.php:218 includes/admin-hot-content.php:107
177
+ #: includes/admin-setting.php:914 includes/admin-setting.php:1395
178
+ #: includes/admin-share-count.php:107
179
  msgid "Facebook"
180
  msgstr "Facebook"
181
 
182
+ #: includes/admin-dashboard-widget.php:102 includes/admin-dashboard.php:116
183
+ #: includes/admin-hot-content.php:110 includes/admin-setting.php:918
184
+ #: includes/admin-share-count.php:110
185
  msgid "Google+"
186
  msgstr "Google+"
187
 
188
+ #: includes/admin-dashboard-widget.php:105 includes/admin-dashboard.php:119
189
+ #: includes/admin-hot-content.php:113 includes/admin-setting.php:930
190
+ #: includes/admin-share-count.php:113
191
  msgid "Pocket"
192
  msgstr "Pocket"
193
 
194
+ #: includes/admin-dashboard-widget.php:108 includes/admin-dashboard.php:122
195
+ #: includes/admin-hot-content.php:116 includes/admin-share-count.php:116
196
  msgid "Hatebu"
197
  msgstr "はてブ"
198
 
199
+ #: includes/admin-dashboard-widget.php:111 includes/admin-dashboard.php:125
200
+ #: includes/admin-hot-content.php:119 includes/admin-setting.php:926
201
+ #: includes/admin-share-count.php:119
202
+ msgid "Pinterest"
203
+ msgstr "Pinterest"
204
+
205
+ #: includes/admin-dashboard-widget.php:114 includes/admin-dashboard.php:128
206
+ #: includes/admin-hot-content.php:122 includes/admin-share-count.php:122
207
  msgid "Total"
208
  msgstr "合計"
209
 
210
+ #: includes/admin-dashboard-widget.php:146 includes/admin-dashboard.php:164
211
  msgid "Follow"
212
  msgstr "Follow"
213
 
214
+ #: includes/admin-dashboard-widget.php:182
215
  msgid "Follower Count"
216
  msgstr "フォロワー数"
217
 
218
+ #: includes/admin-dashboard-widget.php:202 includes/admin-dashboard.php:221
219
+ #: includes/admin-setting.php:1399
220
  msgid "Feedly"
221
  msgstr "Feedly"
222
 
223
+ #: includes/admin-dashboard-widget.php:205 includes/admin-dashboard.php:224
224
+ #: includes/admin-setting.php:1391
225
  msgid "Instagram"
226
  msgstr "Instagram"
227
 
228
+ #: includes/admin-dashboard-widget.php:208 includes/admin-dashboard.php:227
229
+ #: includes/admin-setting.php:1403
230
  msgid "Push7"
231
  msgstr "Push7"
232
 
233
+ #: includes/admin-dashboard.php:201
234
  msgid "Follow Count"
235
  msgstr "フォロー数"
236
 
237
+ #: includes/admin-help.php:51
238
  msgid "What is WordPress plugin SNS Cout Cache?"
239
  msgstr "WordPressプラグイン SNS Count Cacheとは何か?"
240
 
241
+ #: includes/admin-help.php:52
242
  msgid ""
243
  "WordPress plugin SNS Count Cache is a plugin which helps you to shorten page "
244
  "loading time when your site displays share and follower counts. This plugin "
245
+ "gets share counts such as Twitter and Facebook, Google+, Pocket, Pinterest "
246
+ "and caches these counts in the background. This plugin alse caches follower "
247
+ "counts such as Twitter and Facebook, Feedly, Instagram, Push7 in the same "
248
+ "way. The share and follower counts can be retrieved quickly not through "
249
+ "network but through the cache using given functions."
250
  msgstr ""
251
  "WordPressプラグイン SNS Count Cacheは、シェア数やフォロワー数を表示している場"
252
  "合にページの表示時間を高速化するプラグインです。このプラグインは、Twitter、"
253
+ "Facebook、Google+、Pocket、Pinterest、はてなブックマークのシェア数をバックグ"
254
+ "ラウンドで取得し、キャッシュします。またTwitter、Facebook、Feedly、"
255
+ "Instagram、Push7のフォロワー数も同様の方法でキャッシュします。これらのシェア"
256
+ "数とフォロワー数は、所定の関数を用いることでネットワークからではなくキャッ"
257
+ "シュ経由で迅速に取得可能になります。"
258
 
259
+ #: includes/admin-help.php:53
260
  msgid "How often does this plugin get and cache share counts?"
261
  msgstr "シェア数を取得、キャッシュする頻度は?"
262
 
263
+ #: includes/admin-help.php:54
264
  msgid ""
265
  "Although this plugin gets share count of 20 posts at a time every 10 minutes "
266
  "by default, you can modify the setting in the \"Setting\" tab in the "
269
  "デフォルトで10分ごとに20記事のシェア数を取得しますが、管理ページの「設定」タ"
270
  "ブにてその取得間隔と一度に取得対象とする記事数を変更できます。"
271
 
272
+ #: includes/admin-help.php:55
273
  msgid "How can I know whether share count of each post is cached or not?"
274
  msgstr "各記事のシェア数のキャッシュ有無を確認する方法は?"
275
 
276
+ #: includes/admin-help.php:56
277
  msgid ""
278
  "Cache status is described in the \"Cache Status\" tab in the administration "
279
  "page."
280
  msgstr "キャッシュ状況は、管理ページの「キャッシュ状況」タブにて確認可能です。"
281
 
282
+ #: includes/admin-help.php:57
283
  msgid "How often does this plugin get and cache follower counts?"
284
  msgstr "フォロワー数を取得、キャッシュする頻度は?"
285
 
286
+ #: includes/admin-help.php:58
287
  msgid ""
288
  "Although this plugin gets follower count once a day by default, you can "
289
  "modify the setting in the \"Setting\" tab in the administration page."
291
  "デフォルトで1日に一回フォロワー数を取得しますが、管理ページの「設定」タブにて"
292
  "その取得間隔を変更できます。"
293
 
294
+ #: includes/admin-help.php:59
295
  msgid ""
296
  "What is cache status such as \"full cache\", \"partial cache\" and \"no cache"
297
  "\"?"
299
  "「完全キャッシュ」、「部分キャッシュ」、「未キャッシュ」等のキャッシュ状況と"
300
  "は何か?"
301
 
302
+ #: includes/admin-help.php:60
303
  msgid "The following is the explanation of the cache status."
304
  msgstr "以下は、そのキャッシュ状況に関する説明です。"
305
 
306
+ #: includes/admin-help.php:65 includes/admin-help.php:80
307
+ #: includes/admin-help.php:99 includes/admin-help.php:170
308
+ #: includes/admin-help.php:189
309
  msgid "Description"
310
  msgstr "説明"
311
 
312
+ #: includes/admin-help.php:69
313
  msgid "Counts for selected all SNS are cached."
314
  msgstr "選択された全てのSNSのカウントがキャッシュされています。"
315
 
316
+ #: includes/admin-help.php:70
317
  msgid "A subset of counts for selected SNS are cached."
318
  msgstr "選択された一部のSNSのカウントがキャッシュされています。"
319
 
320
+ #: includes/admin-help.php:71
321
  msgid "Count for selected SNS are not cached at all."
322
  msgstr "選択されたSNSのカウントが全くキャッシュされていません。"
323
 
324
+ #: includes/admin-help.php:74
325
  msgid "How can I get share count from the cache?"
326
  msgstr "キャッシュからSNSカウントを参照する方法は?"
327
 
328
+ #: includes/admin-help.php:75
329
  msgid ""
330
  "The share count is retrieved from the cache using the following functions in "
331
  "the WordPress loop such as query_posts(), get_posts() and WP_Query()."
333
  "WordPressのquery_posts()、get_posts()、WP_Query()等のループ内で下記の関数を使"
334
  "うことでキャッシュからSNSカウントを参照できます。"
335
 
336
+ #: includes/admin-help.php:79 includes/admin-help.php:98
337
  msgid "Function"
338
  msgstr "関数"
339
 
340
+ #: includes/admin-help.php:84
341
  msgid "Twitter share count is returned from cache."
342
  msgstr "キャッシュからTwitterのシェア数を取得します。"
343
 
344
+ #: includes/admin-help.php:85
345
  msgid "Facebook share count is returned from cache."
346
  msgstr "キャッシュからFacebookのシェア数を取得します。"
347
 
348
+ #: includes/admin-help.php:86
349
  msgid "Google Plus share count is returned from cache."
350
  msgstr "キャッシュからGoogle+のシェア数を取得します。"
351
 
352
+ #: includes/admin-help.php:87
353
  msgid "Hatena Bookmark share count is returned from cache."
354
  msgstr "キャッシュからはてなブックマークのシェア数を取得します。"
355
 
356
+ #: includes/admin-help.php:88
357
  msgid "Pocket share count is returned from cache."
358
  msgstr "キャッシュからPocketのシェア数を取得します。"
359
 
360
+ #: includes/admin-help.php:89
361
+ msgid "Pinterest share count is returned from cache."
362
+ msgstr "キャッシュからPinterestのシェア数を取得します。"
363
+
364
+ #: includes/admin-help.php:90
365
  msgid "Total share count of selected SNS is returned from cache."
366
  msgstr "キャッシュから対象として設定されたSNSのカウントの総和を取得します。"
367
 
368
+ #: includes/admin-help.php:93
369
  msgid "How can I get follower count from the cache?"
370
  msgstr "キャッシュからフォロワーの数を参照する方法は?"
371
 
372
+ #: includes/admin-help.php:94
373
  msgid ""
374
  "The follower count is retrieved from the cache using the following functions."
375
  msgstr "フォロワーの数は、以下の関数を用いることでキャッシュから参照可能です。"
376
 
377
+ #: includes/admin-help.php:103
378
  msgid "Feedly follower count is returned from cache."
379
  msgstr "キャッシュからFeedlyのフォロワーの数を取得します。"
380
 
381
+ #: includes/admin-help.php:104
382
  msgid "Twitter follower count is returned from cache."
383
  msgstr "キャッシュからTwitterのフォロワーの数を取得します。"
384
 
385
+ #: includes/admin-help.php:105
386
  msgid "Facebook follower count is returned from cache."
387
  msgstr "キャッシュからFacebookのフォロワーの数を取得します。"
388
 
389
+ #: includes/admin-help.php:106
390
  msgid "Instagram follower count is returned from cache."
391
  msgstr "キャッシュからInstagramのフォロワーの数を取得します。"
392
 
393
+ #: includes/admin-help.php:107
394
  msgid "Push7 follower count is returned from cache."
395
  msgstr "キャッシュからPush7のフォロワーの数を取得します。"
396
 
397
+ #: includes/admin-help.php:110
398
  msgid "Example Code"
399
  msgstr "サンプルコード"
400
 
401
+ #: includes/admin-help.php:111
402
  msgid ""
403
  "The code below describes a simple example which displays share count and "
404
  "follower count using the above functions."
406
  "以下のコードは、上述した関数を用いてシェア数やフォロワー数を表示する簡単な例"
407
  "です。"
408
 
409
+ #: includes/admin-help.php:164
410
  msgid "How can I access specific custom field containing each share count?"
411
  msgstr "シェア数を含むカスタムフィールドにアクセスする方法は?"
412
 
413
+ #: includes/admin-help.php:165
414
  msgid ""
415
  "Custom fields including share count are accessed using the following meta "
416
  "keys."
417
  msgstr ""
418
  "シェア数を含むカスタムフィールドは、以下のmeta keyを用いて参照可能です。"
419
 
420
+ #: includes/admin-help.php:169 includes/admin-help.php:188
421
  msgid "Meta Key"
422
  msgstr "Meta Key"
423
 
424
+ #: includes/admin-help.php:174
425
  msgid "A meta key to access Twitter share count"
426
  msgstr "Twitterのシェア数にアクセスするためのMeta Keyです。"
427
 
428
+ #: includes/admin-help.php:175
429
  msgid "A meta key to access Facebook share count"
430
  msgstr "Facebookのシェア数にアクセスするためのMeta Keyです。"
431
 
432
+ #: includes/admin-help.php:176
433
  msgid "A meta key to access Google+ share count"
434
  msgstr "Google+のシェア数にアクセスするためのMeta Keyです。"
435
 
436
+ #: includes/admin-help.php:177
437
  msgid "A meta key to access Hatena Bookmark share count"
438
  msgstr "はてなブックマークのシェア数にアクセスするためのMeta Keyです。"
439
 
440
+ #: includes/admin-help.php:178
441
  msgid "A meta key to access Pocket share count"
442
  msgstr "Pocketのシェア数にアクセスするためのMeta Keyです。"
443
 
444
+ #: includes/admin-help.php:179
445
+ msgid "A meta key to access Pinterest share count"
446
+ msgstr "Pinterestのシェア数にアクセスするためのMeta Keyです。"
447
+
448
+ #: includes/admin-help.php:180
449
  msgid "A meta key to access total share count"
450
  msgstr "シェア数の合計にアクセスするためのMeta Keyです。"
451
 
452
+ #: includes/admin-help.php:183
453
  msgid ""
454
  "How can I access specific custom field containing each variation of share "
455
  "count?"
456
  msgstr "シェア数の増減を含むカスタムフィールドにアクセスする方法は?"
457
 
458
+ #: includes/admin-help.php:184
459
  msgid ""
460
  "Custom fields including variation of share count are accessed using the "
461
  "following meta keys."
463
  "シェア数の増減を含むカスタムフィールドは、以下のmeta keyを用いて参照可能で"
464
  "す。"
465
 
466
+ #: includes/admin-help.php:193
467
  msgid "A meta key to access variation of Twitter share count"
468
  msgstr "Twitterのシェア数の増減数にアクセスするためのMeta Keyです。"
469
 
470
+ #: includes/admin-help.php:194
471
  msgid "A meta key to access variation of Facebook share count"
472
  msgstr "Facebookのシェア数の増減数にアクセスするためのMeta Keyです。"
473
 
474
+ #: includes/admin-help.php:195
475
  msgid "A meta key to access variation of Google+ share count"
476
  msgstr "Google+のシェア数の増減数にアクセスするためのMeta Keyです。"
477
 
478
+ #: includes/admin-help.php:196
479
  msgid "A meta key to access variation of Hatena Bookmark share count"
480
  msgstr "はてなブックマークのシェア数の増減数にアクセスするためのMeta Keyです。"
481
 
482
+ #: includes/admin-help.php:197
483
  msgid "A meta key to access variation of Pocket share count"
484
  msgstr "Pocketのシェア数の増減数にアクセスするためのMeta Keyです。"
485
 
486
+ #: includes/admin-help.php:198
487
+ msgid "A meta key to access variation of Pinterest share count"
488
+ msgstr "Pinterestのシェア数の増減数にアクセスするためのMeta Keyです。"
489
+
490
+ #: includes/admin-help.php:199
491
  msgid "A meta key to access variation of total share count"
492
  msgstr "シェア数合計の増減数にアクセスするためのMeta Keyです。"
493
 
494
+ #: includes/admin-hot-content.php:267 includes/admin-hot-content.php:296
495
+ #: includes/admin-hot-content.php:314 includes/admin-setting.php:594
496
+ #: includes/admin-setting.php:631 includes/admin-setting.php:784
497
+ #: includes/admin-setting.php:799 includes/admin-share-count.php:191
498
+ #: includes/admin-share-count.php:205 includes/admin-share-count.php:233
499
+ #: includes/admin-share-count.php:247 includes/admin-share-count.php:257
500
+ #: includes/admin-share-count.php:285 includes/admin-share-count.php:299
501
+ #: includes/admin-share-count.php:327 includes/admin-share-count.php:341
502
+ #: includes/admin-share-count.php:351 includes/admin-share-count.php:394
503
+ #: includes/admin-share-count.php:425
504
  msgid "N/A"
505
  msgstr "N/A"
506
 
507
+ #: includes/admin-hot-content.php:310
508
  msgid "No hot content."
509
  msgstr "話題のコンテンツはありません。"
510
 
511
+ #: includes/admin-setting.php:37 includes/admin-setting.php:988
512
+ #: includes/admin-setting.php:1027 includes/admin-setting.php:1067
513
+ #: includes/admin-setting.php:1115 includes/admin-setting.php:1376
514
+ #: includes/admin-setting.php:1420 includes/admin-setting.php:1478
515
+ #: includes/admin-setting.php:1546 includes/admin-setting.php:1579
516
+ #: includes/admin-setting.php:1600 includes/admin-setting.php:1658
517
+ #: includes/admin-setting.php:1683 includes/admin-setting.php:1704
518
+ #: includes/admin-setting.php:1740 includes/admin-setting.php:2028
519
  msgid "Update All Options"
520
  msgstr "設定の更新"
521
 
522
+ #: includes/admin-setting.php:341 includes/admin-setting.php:2083
523
  msgid "Reset"
524
  msgstr "リセット"
525
 
526
+ #: includes/admin-setting.php:349 includes/admin-setting.php:2065
527
  msgid "Export"
528
  msgstr "エクスポート"
529
 
530
+ #: includes/admin-setting.php:361 includes/admin-setting.php:1377
531
  msgid "Update Basis of Comparison"
532
  msgstr "比較基準の更新"
533
 
534
+ #: includes/admin-setting.php:373 includes/admin-setting.php:388
535
+ #: includes/admin-setting.php:989 includes/admin-setting.php:1422
536
  msgid "Clear Cache"
537
  msgstr "キャッシュの消去"
538
 
539
+ #: includes/admin-setting.php:414 includes/admin-setting.php:1636
540
+ #: includes/admin-setting.php:1660
541
  msgid "Get Bearer Token"
542
  msgstr "Bearer Tokenの取得"
543
 
544
+ #: includes/admin-setting.php:462
545
  msgid ""
546
  "There was a problem spawning a call to the WP-Cron system on your site. This "
547
  "means WP-Cron jobs on your site may not work. The problem was: "
549
  "あなたのサイト上でWP-Cronシステムの呼び出し処理に問題が見つかりました。あなた"
550
  "のサイト上でWP-Cronジョブが動作しない可能性があります。問題は次の通りです。"
551
 
552
+ #: includes/admin-setting.php:472
553
+ msgid ""
554
+ "Configuratin is not enough to get share count. Please set required "
555
+ "parameters at "
556
+ msgstr ""
557
+ "シェア数を取得するために必要な設定が不足しています。次のセクションで必要なパ"
558
+ "ラメータを設定して下さい。"
559
+
560
+ #: includes/admin-setting.php:473 includes/admin-setting.php:996
561
+ msgid "Share Base Cache - Facebook"
562
+ msgstr "シェア基本キャッシュ - Facebook"
563
+
564
+ #: includes/admin-setting.php:483 includes/admin-setting.php:494
565
+ #: includes/admin-setting.php:505 includes/admin-setting.php:516
566
  msgid ""
567
  "Configuratin is not enough to get follower count. Please set required "
568
  "parameters at "
570
  "フォロワー数を取得するために必要な設定が不足しています。次のセクションで必要"
571
  "なパラメータを設定して下さい。"
572
 
573
+ #: includes/admin-setting.php:484 includes/admin-setting.php:1429
574
  msgid "Follow Base Cache - Instagram"
575
  msgstr "フォロー基本キャシュ機能 - Instagram"
576
 
577
+ #: includes/admin-setting.php:495 includes/admin-setting.php:792
578
+ #: includes/admin-setting.php:1489
579
  msgid "Follow Base Cache - Facebook"
580
  msgstr "フォロー基本キャッシュ機能 - Facebook"
581
 
582
+ #: includes/admin-setting.php:506 includes/admin-setting.php:1587
583
  msgid "Follow Base Cache - Push7"
584
  msgstr "フォロー基本キャッシュ機能 - Push7"
585
 
586
+ #: includes/admin-setting.php:517 includes/admin-setting.php:777
587
+ #: includes/admin-setting.php:1608
588
  msgid "Follow Base Cache - Twitter"
589
  msgstr "フォロー基本キャッシュ機能 - Twitter"
590
 
591
+ #: includes/admin-setting.php:536 includes/admin-setting.php:541
592
  msgid "Current Setting"
593
  msgstr "現在の設定"
594
 
595
+ #: includes/admin-setting.php:536 includes/admin-setting.php:553
596
+ #: includes/admin-setting.php:587 includes/admin-setting.php:600
597
+ #: includes/admin-setting.php:605 includes/admin-setting.php:610
598
+ #: includes/admin-setting.php:624 includes/admin-setting.php:906
599
  msgid "Share Base Cache"
600
  msgstr "シェア基本キャッシュ機能"
601
 
602
+ #: includes/admin-setting.php:536 includes/admin-setting.php:656
603
+ #: includes/admin-setting.php:669 includes/admin-setting.php:677
604
+ #: includes/admin-setting.php:1074
605
  msgid "Share Rush Cache"
606
  msgstr "シェア臨時キャッシュ機能"
607
 
608
+ #: includes/admin-setting.php:536 includes/admin-setting.php:683
609
+ #: includes/admin-setting.php:704 includes/admin-setting.php:1121
610
  msgid "Share Variation Analysis"
611
  msgstr "シェア変動分析機能"
612
 
613
+ #: includes/admin-setting.php:536 includes/admin-setting.php:712
614
+ #: includes/admin-setting.php:737 includes/admin-setting.php:1383
615
  msgid "Follow Base Cache"
616
  msgstr "フォロー基本キャッシュ機能"
617
 
618
+ #: includes/admin-setting.php:536 includes/admin-setting.php:806
619
+ #: includes/admin-setting.php:1668
620
  msgid "Dynamic Cache"
621
  msgstr "動的キャッシュ機能"
622
 
623
+ #: includes/admin-setting.php:536 includes/admin-setting.php:824
624
+ #: includes/admin-setting.php:1689
625
+ msgid "Fault Tolerance"
626
+ msgstr "フォールトトレランス機能"
627
+
628
+ #: includes/admin-setting.php:536 includes/admin-setting.php:842
629
+ #: includes/admin-setting.php:858 includes/admin-setting.php:1710
630
  msgid "Data Crawler"
631
  msgstr "データクローラ機能"
632
 
633
+ #: includes/admin-setting.php:536 includes/admin-setting.php:871
634
+ #: includes/admin-setting.php:889 includes/admin-setting.php:1746
635
  msgid "Data Export"
636
  msgstr "データエクスポート機能"
637
 
638
+ #: includes/admin-setting.php:536 includes/admin-setting.php:2037
639
  msgid "Exported File"
640
  msgstr "エクスポートされたファイル"
641
 
642
+ #: includes/admin-setting.php:546
643
  msgid "Capability"
644
  msgstr "機能"
645
 
646
+ #: includes/admin-setting.php:547
647
  msgid "Parameter"
648
  msgstr "パラメータ"
649
 
650
+ #: includes/admin-setting.php:548
651
  msgid "Value"
652
  msgstr "値"
653
 
654
+ #: includes/admin-setting.php:554 includes/admin-setting.php:713
655
+ #: includes/admin-setting.php:910 includes/admin-setting.php:1387
656
  msgid "Target SNS"
657
  msgstr "対象SNS"
658
 
659
+ #: includes/admin-setting.php:566 includes/admin-setting.php:922
660
  msgid "Hatena Bookmark"
661
  msgstr "はてなブックマーク"
662
 
663
+ #: includes/admin-setting.php:588 includes/admin-setting.php:939
664
  msgid "Custom post types"
665
  msgstr "カスタム投稿タイプ"
666
 
667
+ #: includes/admin-setting.php:601 includes/admin-setting.php:670
668
+ #: includes/admin-setting.php:947 includes/admin-setting.php:1100
669
  msgid "Interval cheking share count (sec)"
670
  msgstr "シェア数のチェック間隔(秒)"
671
 
672
+ #: includes/admin-setting.php:602 includes/admin-setting.php:673
673
+ #: includes/admin-setting.php:739
674
  msgid "seconds"
675
  msgstr "秒"
676
 
677
+ #: includes/admin-setting.php:606 includes/admin-setting.php:678
678
+ #: includes/admin-setting.php:954 includes/admin-setting.php:1107
679
  msgid "Number of contents to check at a time"
680
  msgstr "一度にチェックするコンテンツ数"
681
 
682
+ #: includes/admin-setting.php:607 includes/admin-setting.php:679
683
  msgid "contents"
684
  msgstr "コンテンツ"
685
 
686
+ #: includes/admin-setting.php:611 includes/admin-setting.php:961
687
  msgid "Scheme migration mode from http to https"
688
  msgstr "HTTPからHTTPSへのスキーム移行モード"
689
 
690
+ #: includes/admin-setting.php:615 includes/admin-setting.php:863
691
+ #: includes/admin-setting.php:965 includes/admin-setting.php:1733
692
  msgid "On"
693
  msgstr "有効"
694
 
695
+ #: includes/admin-setting.php:617 includes/admin-setting.php:865
696
+ #: includes/admin-setting.php:964 includes/admin-setting.php:1732
697
  msgid "Off"
698
  msgstr "無効"
699
 
700
+ #: includes/admin-setting.php:625 includes/admin-setting.php:972
701
  msgid "Scheme migration date from http to https"
702
  msgstr "HTTPからHTTPSへのスキーム移行日"
703
 
704
+ #: includes/admin-setting.php:640 includes/admin-setting.php:1035
705
  msgid "Share Base Cache - Twitter"
706
  msgstr "シェア基本キャッシュ機能 - Twitter"
707
 
708
+ #: includes/admin-setting.php:641 includes/admin-setting.php:1039
709
  msgid "Alternative Twitter API"
710
  msgstr "代替Twitter API"
711
 
712
+ #: includes/admin-setting.php:657 includes/admin-setting.php:1078
713
  msgid "Term considering posted content as new content"
714
  msgstr "投稿日からコンテンツを新着とみなす期間"
715
 
716
+ #: includes/admin-setting.php:661
717
  msgid "day"
718
  msgstr "日"
719
 
720
+ #: includes/admin-setting.php:663
721
  msgid "days"
722
  msgstr "日"
723
 
724
+ #: includes/admin-setting.php:684 includes/admin-setting.php:1125
725
  msgid "Method to update basis of comparison"
726
  msgstr "比較基準の更新方式"
727
 
728
+ #: includes/admin-setting.php:688 includes/admin-setting.php:1128
 
729
  msgid "Disabled (None)"
730
  msgstr "無効(なし)"
731
 
732
+ #: includes/admin-setting.php:691 includes/admin-setting.php:1129
733
  msgid "Enabled (Manual)"
734
  msgstr "有効(手動)"
735
 
736
+ #: includes/admin-setting.php:694 includes/admin-setting.php:1130
737
  msgid "Enabled (Scheduler)"
738
  msgstr "有効(スケジューラ)"
739
 
740
+ #: includes/admin-setting.php:705
741
  msgid "Schedule"
742
  msgstr "スケジュール"
743
 
744
+ #: includes/admin-setting.php:738 includes/admin-setting.php:1412
745
  msgid "Interval cheking follower count (sec)"
746
  msgstr "フォロワー数のチェック間隔(秒)"
747
 
748
+ #: includes/admin-setting.php:743 includes/admin-setting.php:770
749
+ #: includes/admin-setting.php:1557
750
  msgid "Follow Base Cache - Feedly"
751
  msgstr "フォロー基本キャッシュ機能 - Feedly"
752
 
753
+ #: includes/admin-setting.php:744 includes/admin-setting.php:1561
754
  msgid "Target feed type"
755
  msgstr "対象フィードタイプ"
756
 
757
+ #: includes/admin-setting.php:749 includes/admin-setting.php:764
758
+ #: includes/admin-setting.php:1564
759
  msgid "Default"
760
  msgstr "デフォルト"
761
 
762
+ #: includes/admin-setting.php:752 includes/admin-setting.php:1565
763
  msgid "RSS"
764
  msgstr "RSS"
765
 
766
+ #: includes/admin-setting.php:755 includes/admin-setting.php:1566
767
  msgid "RSS2"
768
  msgstr "RSS2"
769
 
770
+ #: includes/admin-setting.php:758 includes/admin-setting.php:1567
771
  msgid "RDF"
772
  msgstr "RDF"
773
 
774
+ #: includes/admin-setting.php:761 includes/admin-setting.php:1568
775
  msgid "ATOM"
776
  msgstr "ATOM"
777
 
778
+ #: includes/admin-setting.php:771 includes/admin-setting.php:1574
779
  msgid "Target feed"
780
  msgstr "対象フィード"
781
 
782
+ #: includes/admin-setting.php:778
783
  msgid "Target screen name"
784
  msgstr "対象スクリーンネーム"
785
 
786
+ #: includes/admin-setting.php:793 includes/admin-setting.php:1493
787
  msgid "Page ID"
788
  msgstr "対象ページID"
789
 
790
+ #: includes/admin-setting.php:807 includes/admin-setting.php:1672
791
  msgid "Dynamic caching based on user access"
792
  msgstr "ユーザアクセスをトリガとする動的キャッシュ"
793
 
794
+ #: includes/admin-setting.php:811 includes/admin-setting.php:817
795
+ #: includes/admin-setting.php:829 includes/admin-setting.php:835
796
+ #: includes/admin-setting.php:1675 includes/admin-setting.php:1696
797
+ msgid "Disabled"
798
+ msgstr "無効"
799
 
800
+ #: includes/admin-setting.php:814 includes/admin-setting.php:832
801
+ #: includes/admin-setting.php:1676 includes/admin-setting.php:1697
802
+ msgid "Enabled"
803
+ msgstr "有効"
804
 
805
+ #: includes/admin-setting.php:825
806
+ msgid "Fault tolerance of count retrieval"
807
+ msgstr "カウント取得における障害耐性"
808
 
809
+ #: includes/admin-setting.php:843 includes/admin-setting.php:1714
810
  msgid "Crawl method"
811
  msgstr "クロールの方式"
812
 
813
+ #: includes/admin-setting.php:848 includes/admin-setting.php:1719
814
  msgid "Normal (Sequential Retrieval)"
815
  msgstr "標準(逐次検索)"
816
 
817
+ #: includes/admin-setting.php:851 includes/admin-setting.php:1722
818
  msgid "Extended (Parallel Retrieval)"
819
  msgstr "拡張(並列検索)"
820
 
821
+ #: includes/admin-setting.php:859 includes/admin-setting.php:1729
822
  msgid "SSL verification"
823
  msgstr "SSL証明書の検証"
824
 
825
+ #: includes/admin-setting.php:872 includes/admin-setting.php:1750
826
  msgid "Method of data export"
827
  msgstr "データのエクスポート方式"
828
 
829
+ #: includes/admin-setting.php:876 includes/admin-setting.php:1753
830
  msgid "Manual"
831
  msgstr "手動"
832
 
833
+ #: includes/admin-setting.php:879 includes/admin-setting.php:1165
834
+ #: includes/admin-setting.php:1754 includes/admin-setting.php:1789
835
  msgid "Scheduler"
836
  msgstr "有効(スケジューラ)"
837
 
838
+ #: includes/admin-setting.php:890
839
  msgid "Interval exporting share count to a csv file"
840
  msgstr "シェア数をCSVファイルにエクスポートする間隔"
841
 
842
+ #: includes/admin-setting.php:891
843
  msgid "hours"
844
  msgstr "時間"
845
 
846
+ #: includes/admin-setting.php:943
847
  msgid "e.g. aaa, bbb, ccc (comma-delimited)"
848
  msgstr "例. aaa, bbb, ccc(カンマ区切り)"
849
 
850
+ #: includes/admin-setting.php:950 includes/admin-setting.php:1103
851
  msgid "Default: 600"
852
  msgstr "既定値: 600"
853
 
854
+ #: includes/admin-setting.php:957 includes/admin-setting.php:1110
855
  msgid "Default: 20"
856
  msgstr "既定値: 20"
857
 
858
+ #: includes/admin-setting.php:967
859
  msgid "Default: Off"
860
  msgstr "既定値: 無効"
861
 
862
+ #: includes/admin-setting.php:975
863
  msgid "Default: N/A"
864
  msgstr "既定値: N/A"
865
 
866
+ #: includes/admin-setting.php:1000 includes/admin-setting.php:1501
867
+ msgid "App ID (Client ID)"
868
+ msgstr "App ID (Client ID)"
869
+
870
+ #: includes/admin-setting.php:1004 includes/admin-setting.php:1505
871
+ msgid "Facebook app ID for OAuth"
872
+ msgstr "OAuth認証のためのFacebook app ID"
873
+
874
+ #: includes/admin-setting.php:1008 includes/admin-setting.php:1509
875
+ msgid "App secret (Client secret)"
876
+ msgstr "App secret (Client secret)"
877
+
878
+ #: includes/admin-setting.php:1012 includes/admin-setting.php:1513
879
+ msgid "Facebook app secret for OAuth"
880
+ msgstr "OAuth認証のためのFacebook app secret"
881
+
882
+ #: includes/admin-setting.php:1017 includes/admin-setting.php:1458
883
+ #: includes/admin-setting.php:1468 includes/admin-setting.php:1526
884
+ #: includes/admin-setting.php:1536
885
+ msgid "Access token"
886
+ msgstr "Access Token"
887
+
888
+ #: includes/admin-setting.php:1021 includes/admin-setting.php:1540
889
+ msgid "Facebook access token for OAuth"
890
+ msgstr "OAuth認証のためのFacebook access token"
891
+
892
+ #: includes/admin-setting.php:1046
893
  msgid "Default: "
894
  msgstr "規定値: "
895
 
896
+ #: includes/admin-setting.php:1050
897
  msgid "Registration destination"
898
  msgstr "登録先"
899
 
900
+ #: includes/admin-setting.php:1062
901
  msgid ""
902
  "You need to register information such as your domain with the above site in "
903
  "order to start counting."
905
  "カウントを開始するためには、上記サイトにドメイン等の情報を登録する必要があり"
906
  "ます。"
907
 
908
+ #: includes/admin-setting.php:1081
909
  msgid "1 day"
910
  msgstr "1日"
911
 
912
+ #: includes/admin-setting.php:1082
913
  msgid "2 days"
914
  msgstr "2日"
915
 
916
+ #: includes/admin-setting.php:1083
917
  msgid "3 days"
918
  msgstr "3日"
919
 
920
+ #: includes/admin-setting.php:1084
921
  msgid "4 days"
922
  msgstr "4日"
923
 
924
+ #: includes/admin-setting.php:1085
925
  msgid "5 days"
926
  msgstr "5日"
927
 
928
+ #: includes/admin-setting.php:1086
929
  msgid "6 days"
930
  msgstr "6日"
931
 
932
+ #: includes/admin-setting.php:1087
933
  msgid "7 days"
934
  msgstr "7日"
935
 
936
+ #: includes/admin-setting.php:1088
937
  msgid "8 days"
938
  msgstr "8日"
939
 
940
+ #: includes/admin-setting.php:1089
941
  msgid "9 days"
942
  msgstr "9日"
943
 
944
+ #: includes/admin-setting.php:1090
945
  msgid "10 days"
946
  msgstr "10日"
947
 
948
+ #: includes/admin-setting.php:1091
949
  msgid "11 days"
950
  msgstr "11日"
951
 
952
+ #: includes/admin-setting.php:1092
953
  msgid "12 days"
954
  msgstr "12日"
955
 
956
+ #: includes/admin-setting.php:1093
957
  msgid "13 days"
958
  msgstr "13日"
959
 
960
+ #: includes/admin-setting.php:1094
961
  msgid "14 days"
962
  msgstr "14日"
963
 
964
+ #: includes/admin-setting.php:1096
965
  msgid "Default: 3 days"
966
  msgstr "既定値: 3日"
967
 
968
+ #: includes/admin-setting.php:1132
969
  msgid "Default: None"
970
  msgstr "既定値: なし"
971
 
972
+ #: includes/admin-setting.php:1170 includes/admin-setting.php:1794
973
  msgid "Type"
974
  msgstr "タイプ"
975
 
976
+ #: includes/admin-setting.php:1175 includes/admin-setting.php:1799
977
  msgid "Hour"
978
  msgstr "時"
979
 
980
+ #: includes/admin-setting.php:1178 includes/admin-setting.php:1802
981
  msgid "Minute"
982
  msgstr "分"
983
 
984
+ #: includes/admin-setting.php:1184 includes/admin-setting.php:1808
985
  msgid "monthly"
986
  msgstr "毎月"
987
 
988
+ #: includes/admin-setting.php:1195 includes/admin-setting.php:1819
989
  msgid "on 1."
990
  msgstr "1日"
991
 
992
+ #: includes/admin-setting.php:1198 includes/admin-setting.php:1822
993
  msgid "on 2."
994
  msgstr "2日"
995
 
996
+ #: includes/admin-setting.php:1201 includes/admin-setting.php:1825
997
  msgid "on 3."
998
  msgstr "3日"
999
 
1000
+ #: includes/admin-setting.php:1204 includes/admin-setting.php:1828
1001
  msgid "on 4."
1002
  msgstr "4日"
1003
 
1004
+ #: includes/admin-setting.php:1207 includes/admin-setting.php:1831
1005
  msgid "on 5."
1006
  msgstr "5日"
1007
 
1008
+ #: includes/admin-setting.php:1210 includes/admin-setting.php:1834
1009
  msgid "on 6."
1010
  msgstr "6日"
1011
 
1012
+ #: includes/admin-setting.php:1213 includes/admin-setting.php:1837
1013
  msgid "on 7."
1014
  msgstr "7日"
1015
 
1016
+ #: includes/admin-setting.php:1216 includes/admin-setting.php:1840
1017
  msgid "on 8."
1018
  msgstr "8日"
1019
 
1020
+ #: includes/admin-setting.php:1219 includes/admin-setting.php:1843
1021
  msgid "on 9."
1022
  msgstr "9日"
1023
 
1024
+ #: includes/admin-setting.php:1222 includes/admin-setting.php:1846
1025
  msgid "on 10."
1026
  msgstr "10日"
1027
 
1028
+ #: includes/admin-setting.php:1225 includes/admin-setting.php:1849
1029
  msgid "on 11."
1030
  msgstr "11日"
1031
 
1032
+ #: includes/admin-setting.php:1228 includes/admin-setting.php:1852
1033
  msgid "on 12."
1034
  msgstr "12日"
1035
 
1036
+ #: includes/admin-setting.php:1231 includes/admin-setting.php:1855
1037
  msgid "on 13."
1038
  msgstr "13日"
1039
 
1040
+ #: includes/admin-setting.php:1234 includes/admin-setting.php:1858
1041
  msgid "on 14."
1042
  msgstr "14日"
1043
 
1044
+ #: includes/admin-setting.php:1237 includes/admin-setting.php:1861
1045
  msgid "on 15."
1046
  msgstr "15日"
1047
 
1048
+ #: includes/admin-setting.php:1240 includes/admin-setting.php:1864
1049
  msgid "on 16."
1050
  msgstr "16日"
1051
 
1052
+ #: includes/admin-setting.php:1243 includes/admin-setting.php:1867
1053
  msgid "on 17."
1054
  msgstr "17日"
1055
 
1056
+ #: includes/admin-setting.php:1246 includes/admin-setting.php:1870
1057
  msgid "on 18."
1058
  msgstr "18日"
1059
 
1060
+ #: includes/admin-setting.php:1249 includes/admin-setting.php:1873
1061
  msgid "on 19."
1062
  msgstr "19日"
1063
 
1064
+ #: includes/admin-setting.php:1252 includes/admin-setting.php:1876
1065
  msgid "on 20."
1066
  msgstr "20日"
1067
 
1068
+ #: includes/admin-setting.php:1255 includes/admin-setting.php:1879
1069
  msgid "on 21."
1070
  msgstr "21日"
1071
 
1072
+ #: includes/admin-setting.php:1258 includes/admin-setting.php:1882
1073
  msgid "on 22."
1074
  msgstr "22日"
1075
 
1076
+ #: includes/admin-setting.php:1261 includes/admin-setting.php:1885
1077
  msgid "on 23."
1078
  msgstr "23日"
1079
 
1080
+ #: includes/admin-setting.php:1264 includes/admin-setting.php:1888
1081
  msgid "on 24."
1082
  msgstr "24日"
1083
 
1084
+ #: includes/admin-setting.php:1267 includes/admin-setting.php:1891
1085
  msgid "on 25."
1086
  msgstr "25日"
1087
 
1088
+ #: includes/admin-setting.php:1270 includes/admin-setting.php:1894
1089
  msgid "on 26."
1090
  msgstr "26日"
1091
 
1092
+ #: includes/admin-setting.php:1273 includes/admin-setting.php:1897
1093
  msgid "on 27."
1094
  msgstr "27日"
1095
 
1096
+ #: includes/admin-setting.php:1276 includes/admin-setting.php:1900
1097
  msgid "on 28."
1098
  msgstr "28日"
1099
 
1100
+ #: includes/admin-setting.php:1279 includes/admin-setting.php:1903
1101
  msgid "on 29."
1102
  msgstr "29日"
1103
 
1104
+ #: includes/admin-setting.php:1282 includes/admin-setting.php:1906
1105
  msgid "on 30."
1106
  msgstr "30日"
1107
 
1108
+ #: includes/admin-setting.php:1285 includes/admin-setting.php:1909
1109
  msgid "on 31."
1110
  msgstr "31日"
1111
 
1112
+ #: includes/admin-setting.php:1312 includes/admin-setting.php:1940
1113
  msgid "weekly"
1114
  msgstr "毎週"
1115
 
1116
+ #: includes/admin-setting.php:1318 includes/admin-setting.php:1946
1117
  msgid "Sunday"
1118
  msgstr "日曜日"
1119
 
1120
+ #: includes/admin-setting.php:1319 includes/admin-setting.php:1947
1121
  msgid "Monday"
1122
  msgstr "月曜日"
1123
 
1124
+ #: includes/admin-setting.php:1320 includes/admin-setting.php:1948
1125
  msgid "Tuesday"
1126
  msgstr "火曜日"
1127
 
1128
+ #: includes/admin-setting.php:1321 includes/admin-setting.php:1949
1129
  msgid "Wednesday"
1130
  msgstr "水曜日"
1131
 
1132
+ #: includes/admin-setting.php:1322 includes/admin-setting.php:1950
1133
  msgid "Thursday"
1134
  msgstr "木曜日"
1135
 
1136
+ #: includes/admin-setting.php:1323 includes/admin-setting.php:1951
1137
  msgid "Friday"
1138
  msgstr "金曜日"
1139
 
1140
+ #: includes/admin-setting.php:1324 includes/admin-setting.php:1952
1141
  msgid "Saturday"
1142
  msgstr "土曜日"
1143
 
1144
+ #: includes/admin-setting.php:1346 includes/admin-setting.php:1978
1145
  msgid "daily"
1146
  msgstr "毎日"
1147
 
1148
+ #: includes/admin-setting.php:1415
1149
  msgid "Default: 86400 Minimum: 3600"
1150
  msgstr "既定値: 86400 最小値: 3600"
1151
 
1152
+ #: includes/admin-setting.php:1433
1153
  msgid "Client ID"
1154
  msgstr "Client ID"
1155
 
1156
+ #: includes/admin-setting.php:1437
1157
  msgid "Instagram client ID for OAuth"
1158
  msgstr "OAuth認証のためのInstagram client ID"
1159
 
1160
+ #: includes/admin-setting.php:1441
1161
  msgid "Client secret"
1162
  msgstr "Client secret"
1163
 
1164
+ #: includes/admin-setting.php:1445
1165
  msgid "Instagram client secret for OAuth"
1166
  msgstr "OAuth認証のためのInstagram client secret"
1167
 
1168
+ #: includes/admin-setting.php:1449 includes/admin-setting.php:1517
1169
  msgid "Redirect URI"
1170
  msgstr "Redirect URI"
1171
 
1172
+ #: includes/admin-setting.php:1451 includes/admin-setting.php:1460
1173
+ #: includes/admin-setting.php:1519 includes/admin-setting.php:1528
1174
+ #: includes/admin-setting.php:1640
1175
  msgid "To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."
1176
  msgstr ""
1177
  "フィールドをクリック後、Ctrl + C (PC)、またはCmd + C (Mac)を押下しコピーして"
1178
  "下さい。"
1179
 
1180
+ #: includes/admin-setting.php:1453
1181
  msgid ""
1182
  "Copy and set this to the field of \"Valid redirect URIs\" in the client "
1183
  "management page of Instagram developer page."
1185
  "Instagram開発者向けページ内のクライアント管理ページにて「Valid redirect "
1186
  "URIs」フィールドにこのURIを設定して下さい。"
1187
 
1188
+ #: includes/admin-setting.php:1462 includes/admin-setting.php:1530
1189
+ #: includes/admin-setting.php:1642
 
 
 
 
 
1190
  msgid "Copy and pase this into the fields below."
1191
  msgstr "以下のフィールドにコピー&ペーストして下さい。"
1192
 
1193
+ #: includes/admin-setting.php:1472
1194
  msgid "Instagram access token for OAuth"
1195
  msgstr "OAuth認証のためのInstagram access token"
1196
 
1197
+ #: includes/admin-setting.php:1480 includes/admin-setting.php:1548
1198
  msgid "Get Access Token"
1199
  msgstr "Access Tokenの取得"
1200
 
1201
+ #: includes/admin-setting.php:1497
1202
  msgid "Facebook page ID that you want to get follower count"
1203
  msgstr "フォロワー数を取得するFacebookページID"
1204
 
1205
+ #: includes/admin-setting.php:1521
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1206
  msgid ""
1207
  "Copy and set this to the field of \"Valid OAuth redirect URIs\" in client "
1208
  "management page of Facebook developer page"
1210
  "Facebook開発者向けページ内のクライアント管理ページにて「Valid OAuth redirect "
1211
  "URIs」フィールドにこのURIを設定して下さい。"
1212
 
1213
+ #: includes/admin-setting.php:1570
 
 
 
 
1214
  msgid "Default: Default"
1215
  msgstr "規定値: デフォルト"
1216
 
1217
+ #: includes/admin-setting.php:1591
1218
  msgid "AppNo"
1219
  msgstr "AppNo"
1220
 
1221
+ #: includes/admin-setting.php:1595
1222
  msgid "Push7 appno to access Push7 API"
1223
  msgstr "Push7 APIにアクセスするためのAppNo"
1224
 
1225
+ #: includes/admin-setting.php:1612
1226
  msgid "Screen name"
1227
  msgstr "スクリーン名"
1228
 
1229
+ #: includes/admin-setting.php:1617
1230
  msgid "Twitter screen name that you want to get follower count"
1231
  msgstr "フォロワー数を取得するTwitterのスクリーン名"
1232
 
1233
+ #: includes/admin-setting.php:1621
1234
  msgid "Consumer key (API Key)"
1235
  msgstr "Consumer key (API Key)"
1236
 
1237
+ #: includes/admin-setting.php:1625
1238
  msgid "Twitter consumer key for OAuth"
1239
  msgstr "OAuth認証のためのTwitter consumer key"
1240
 
1241
+ #: includes/admin-setting.php:1629
1242
  msgid "Consumer secret (API Secret)"
1243
  msgstr "Consumer secret (API Secret)"
1244
 
1245
+ #: includes/admin-setting.php:1633
1246
  msgid "Twitter consumer secret for OAuth"
1247
  msgstr "OAuth認証のためのTwitter consumer secret"
1248
 
1249
+ #: includes/admin-setting.php:1638 includes/admin-setting.php:1648
1250
  msgid "Bearer token"
1251
  msgstr "Bearer token"
1252
 
1253
+ #: includes/admin-setting.php:1652
1254
  msgid "Twitter bearer token for OAuth"
1255
  msgstr "OAuth認証のためのTwitter bearer token"
1256
 
1257
+ #: includes/admin-setting.php:1678 includes/admin-setting.php:1699
1258
+ msgid "Default: Disabled"
1259
+ msgstr "規定値: 無効"
1260
+
1261
+ #: includes/admin-setting.php:1693
1262
+ msgid "Fault tolerant mode of count retrieval"
1263
+ msgstr "カウント取得における耐障害モード"
1264
 
1265
+ #: includes/admin-setting.php:1735
1266
  msgid "Default: On"
1267
  msgstr "既定値: 有効"
1268
 
1269
+ #: includes/admin-setting.php:1756
1270
  msgid "Default: Manual"
1271
  msgstr "既定値: 手動"
1272
 
1273
+ #: includes/admin-setting.php:2005
1274
  msgid "hourly"
1275
  msgstr "毎時"
1276
 
1277
+ #: includes/admin-setting.php:2042
1278
  msgid "Disk usage of exported file"
1279
  msgstr "エクスポートされたファイルのディスク使用量"
1280
 
1281
+ #: includes/admin-setting.php:2051
1282
  msgid "No exported file"
1283
  msgstr "エクスポートされたファイルは存在しません。"
1284
 
1285
+ #: includes/admin-setting.php:2063
1286
  msgid "Manual export"
1287
  msgstr "手動エクスポート"
1288
 
1289
+ #: includes/admin-setting.php:2067
1290
  msgid "Export share count to a csv file."
1291
  msgstr "シェア数をCSVファイルにエクスポートします。"
1292
 
1293
+ #: includes/admin-setting.php:2081
1294
  msgid "Reset of exported file"
1295
  msgstr "エクスポートされたファイルのリセット"
1296
 
1297
+ #: includes/admin-setting.php:2085
1298
  msgid "Clear exported csv file."
1299
  msgstr "エクスポートされたCSVファイルを削除します。"
1300
 
1301
+ #: includes/admin-setting.php:2096
1302
  msgid "Download of exported file"
1303
  msgstr "エクスポートされたファイルのダウンロード"
1304
 
1305
+ #: includes/admin-setting.php:2098 includes/download.php:38
1306
  msgid "Download"
1307
  msgstr "ダウンロード"
1308
 
1309
+ #: includes/admin-setting.php:2100
1310
  msgid "Download the exported csv file."
1311
  msgstr "エクスポートされたCSVファイルをダウンロードします。"
1312
 
1313
+ #: includes/download.php:68 includes/download.php:71 index.php:49 index.php:52
1314
+ #: index.php:55 sns-count-cache.php:1702 sns-count-cache.php:1715
1315
+ #: sns-count-cache.php:1727 sns-count-cache.php:1739 sns-count-cache.php:1751
1316
+ #: sns-count-cache.php:1763 sns-count-cache.php:1775 sns-count-cache.php:1787
1317
  msgid "You do not have sufficient permissions to access this page."
1318
  msgstr "このページにアクセスするために必要な権限がありません。"
1319
 
1320
+ #: sns-count-cache.php:1671
1321
  msgid "Dashboard | SNS Count Cache"
1322
  msgstr "ダッシュボード | SNS Count Cache"
1323
 
1324
+ #: sns-count-cache.php:1672
1325
  msgid "Cache Status | SNS Count Cache"
1326
  msgstr "キャッシュ状況 | SNS Count Cache"
1327
 
1328
+ #: sns-count-cache.php:1673
1329
  msgid "Share Count | SNS Count Cache"
1330
  msgstr "シェア数 | SNS Count Cache"
1331
 
1332
+ #: sns-count-cache.php:1676
1333
  msgid "Hot Content | SNS Count Cache"
1334
  msgstr "話題のコンテンツ | SNS Count Cache"
1335
 
1336
+ #: sns-count-cache.php:1679
1337
  msgid "Setting | SNS Count Cache"
1338
  msgstr "設定 | SNS Count Cache"
1339
 
1340
+ #: sns-count-cache.php:1680
1341
  msgid "Help | SNS Count Cache"
1342
  msgstr "ヘルプ | SNS Count Cache"
1343
 
1344
+ #: sns-count-cache.php:2275 sns-count-cache.php:2283 sns-count-cache.php:2415
1345
+ #: sns-count-cache.php:2423
1346
  msgid "Completed"
1347
  msgstr "完了"
1348
 
1349
+ #: sns-count-cache.php:2277 sns-count-cache.php:2285 sns-count-cache.php:2417
1350
+ #: sns-count-cache.php:2425
1351
  msgid "Partially Completed"
1352
  msgstr "部分的完了"
1353
 
1354
+ #: sns-count-cache.php:2279 sns-count-cache.php:2287 sns-count-cache.php:2419
1355
+ #: sns-count-cache.php:2427
1356
  msgid "Ongoing"
1357
  msgstr "進行中"
1358
 
1363
  #. Description of the plugin/theme
1364
  msgid ""
1365
  "SNS Count Cache gets share count for Twitter and Facebook, Google Plus, "
1366
+ "Pocket, Pinterest, Hatena Bookmark and caches these count in the background. "
1367
+ "This plugin may help you to shorten page loading time because the share "
1368
+ "count can be retrieved not through network but through the cache using given "
1369
+ "functions."
1370
  msgstr ""
1371
+ "SNS Count Cacheは、Twitter、Facebook、Google+、Pocket、Pinterest、はてなブッ"
1372
+ "クマークのシェア数を取得し、バックグラウンドでキャッシュします。用意された関"
1373
+ "数を利用することで、ネットワーク経由でなくキャッシュからシェア数を参照できよ"
1374
+ "うになるため、ページ読み込みの高速化が見込めます。"
1375
 
1376
  #. Author of the plugin/theme
1377
  msgid "Daisuke Maruyama"
1378
  msgstr "Daisuke Maruyama"
1379
 
1380
  #. Author URI of the plugin/theme
1381
+ msgid "https://marubon.info/"
1382
+ msgstr "https://marubon.info/"
1383
+
1384
+ #~ msgid ""
1385
+ #~ "SNS Count Cache gets share count for Twitter and Facebook, Google Plus, "
1386
+ #~ "Pocket, Hatena Bookmark and caches these count in the background. This "
1387
+ #~ "plugin may help you to shorten page loading time because the share count "
1388
+ #~ "can be retrieved not through network but through the cache using given "
1389
+ #~ "functions."
1390
+ #~ msgstr ""
1391
+ #~ "SNS Count Cacheは、Twitter、Facebook、Google+、Pocket、はてなブックマーク"
1392
+ #~ "のシェア数を取得し、バックグラウンドでキャッシュします。用意された関数を利"
1393
+ #~ "用することで、ネットワーク経由でなくキャッシュからシェア数を参照できように"
1394
+ #~ "なるため、ページ読み込みの高速化が見込めます。"
1395
+
1396
+ #~ msgid ""
1397
+ #~ "WordPress plugin SNS Count Cache is a plugin which helps you to shorten "
1398
+ #~ "page loading time when your site displays share and follower counts. This "
1399
+ #~ "plugin gets share counts such as Twitter and Facebook, Google+, Pocket "
1400
+ #~ "and caches these counts in the background. This plugin alse caches "
1401
+ #~ "follower counts such as Twitter and Facebook, Feedly, Instagram, Push7 in "
1402
+ #~ "the same way. The share and follower counts can be retrieved quickly not "
1403
+ #~ "through network but through the cache using given functions."
1404
+ #~ msgstr ""
1405
+ #~ "WordPressプラグイン SNS Count Cacheは、シェア数やフォロワー数を表示してい"
1406
+ #~ "る場合にページの表示時間を高速化するプラグインです。このプラグインは、"
1407
+ #~ "Twitter、Facebook、Google+、Pocket、はてなブックマークのシェア数をバックグ"
1408
+ #~ "ラウンドで取得し、キャッシュします。またTwitter、Facebook、Feedly、"
1409
+ #~ "Instagram、Push7のフォロワー数も同様の方法でキャッシュします。これらのシェ"
1410
+ #~ "ア数とフォロワー数は、所定の関数を用いることでネットワークからではなく"
1411
+ #~ "キャッシュ経由で迅速に取得可能になります。"
1412
+
1413
+ #~ msgid "http://marubon.info/"
1414
+ #~ msgstr "http://marubon.info/"
1415
+
1416
+ #~ msgid "Enabled (Synchronous Cache)"
1417
+ #~ msgstr "有効(同期キャッシュ)"
1418
+
1419
+ #~ msgid "Enabled (Asynchronous Cache)"
1420
+ #~ msgstr "有効(非同期キャッシュ)"
1421
+
1422
+ #~ msgid "Enabled (Asynchronous 2nd Cache)"
1423
+ #~ msgstr "有効(非同期2次キャッシュ)"
1424
+
1425
+ #~ msgid "Default: Enabled (Asynchronous 2nd Cache)"
1426
+ #~ msgstr "既定値: 有効(非同期2次キャッシュ)"
1427
 
1428
  #~ msgid ""
1429
  #~ "WordPress plugin SNS Count Cache is a plugin which helps you to shorten "
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: marubon
3
  Donate link:
4
  Tags: performance, SNS, social, cache, share, follower
5
  Requires at least: 3.7
6
- Tested up to: 4.6
7
- Stable tag: 0.9.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -22,6 +22,7 @@ The plugin gets share counts for the following SNS and caches these counts in th
22
  * Facebook
23
  * Google+
24
  * Pocket
 
25
  * Hatena Bookmark
26
 
27
  Note: You can select alternative Twitter API for share count retrieval from among alternatives such as "widgetoon.js & count.jsoon", "OpenShareCount", and "TwitCount".
@@ -42,6 +43,7 @@ The following shows functions to get share count from the cache:
42
  * scc_get_share_facebook()
43
  * scc_get_share_gplus()
44
  * scc_get_share_pocket()
 
45
  * scc_get_share_hatebu()
46
  * scc_get_share_total()
47
 
@@ -59,6 +61,7 @@ The following describes meta keys to get share count from custom field.
59
  * scc_share_count_facebook
60
  * scc_share_count_google+
61
  * scc_share_count_pocket
 
62
  * scc_share_count_hatebu
63
  * scc_share_count_total
64
 
@@ -68,6 +71,7 @@ The following describes meta keys to get delta of share count from custom field.
68
  * scc_share_delta_facebook
69
  * scc_share_delta_google+
70
  * scc_share_delta_pocket
 
71
  * scc_share_delta_hatebu
72
  * scc_share_delta_total
73
 
@@ -157,6 +161,12 @@ There are no questions.
157
  = 0.9.2 =
158
  * Fixed: Facebook share count is not retrieved and cached.
159
 
 
 
 
 
 
 
160
  == Upgrade Notice ==
161
  The following functions are deprecated.
162
 
3
  Donate link:
4
  Tags: performance, SNS, social, cache, share, follower
5
  Requires at least: 3.7
6
+ Tested up to: 4.6.1
7
+ Stable tag: 0.10.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
22
  * Facebook
23
  * Google+
24
  * Pocket
25
+ * Pinterest
26
  * Hatena Bookmark
27
 
28
  Note: You can select alternative Twitter API for share count retrieval from among alternatives such as "widgetoon.js & count.jsoon", "OpenShareCount", and "TwitCount".
43
  * scc_get_share_facebook()
44
  * scc_get_share_gplus()
45
  * scc_get_share_pocket()
46
+ * scc_get_share_pinterest()
47
  * scc_get_share_hatebu()
48
  * scc_get_share_total()
49
 
61
  * scc_share_count_facebook
62
  * scc_share_count_google+
63
  * scc_share_count_pocket
64
+ * scc_share_count_pinterest
65
  * scc_share_count_hatebu
66
  * scc_share_count_total
67
 
71
  * scc_share_delta_facebook
72
  * scc_share_delta_google+
73
  * scc_share_delta_pocket
74
+ * scc_share_delta_pinterest
75
  * scc_share_delta_hatebu
76
  * scc_share_delta_total
77
 
161
  = 0.9.2 =
162
  * Fixed: Facebook share count is not retrieved and cached.
163
 
164
+ = 0.10.0 =
165
+ * Fixed: Facebook share count can not be retrieved and cached.
166
+ * Added: function to configure parameters for share rush cache.
167
+ * Added: function to keep cached share counts when share count retrieval fails.
168
+ * Added: function to retrieve share count of Pinterest.
169
+
170
  == Upgrade Notice ==
171
  The following functions are deprecated.
172
 
sns-count-cache.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /*
3
  Plugin Name: SNS Count Cache
4
- Description: SNS Count Cache gets share count for Twitter and Facebook, Google Plus, Pocket, 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: 0.9.2
6
  Plugin URI: https://wordpress.org/plugins/sns-count-cache/
7
  Author: Daisuke Maruyama
8
- Author URI: http://marubon.info/
9
  License: GPL2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11
  Text Domain: sns-count-cache
@@ -29,63 +29,63 @@ along with this program; if not, write to the Free Software
29
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30
  */
31
 
32
- require_once ( dirname( __FILE__ ) . '/includes/class-common-util.php' );
33
- require_once ( dirname( __FILE__ ) . '/includes/class-wp-cron-util.php' );
34
- require_once ( dirname( __FILE__ ) . '/includes/class-sleep-throttle.php' );
35
 
36
- require_once ( dirname( __FILE__ ) . '/includes/interface-order.php' );
37
 
38
- require_once ( dirname( __FILE__ ) . '/includes/class-engine.php' );
39
- require_once ( dirname( __FILE__ ) . '/includes/class-cache-engine.php' );
40
 
41
- require_once ( dirname( __FILE__ ) . '/includes/class-share-cache-engine.php' );
42
- require_once ( dirname( __FILE__ ) . '/includes/class-share-base-cache-engine.php' );
43
- require_once ( dirname( __FILE__ ) . '/includes/class-share-rush-cache-engine.php' );
44
- require_once ( dirname( __FILE__ ) . '/includes/class-share-lazy-cache-engine.php' );
45
- require_once ( dirname( __FILE__ ) . '/includes/class-share-second-cache-engine.php' );
46
- require_once ( dirname( __FILE__ ) . '/includes/class-share-restore-cache-engine.php' );
47
 
48
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-cache-engine.php' );
49
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-base-cache-engine.php' );
50
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-lazy-cache-engine.php' );
51
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-second-cache-engine.php' );
52
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-restore-cache-engine.php' );
53
 
54
- require_once ( dirname( __FILE__ ) . '/includes/class-export-engine.php' );
55
- require_once ( dirname( __FILE__ ) . '/includes/class-common-data-export-engine.php' );
56
 
57
- require_once ( dirname( __FILE__ ) . '/includes/class-common-job-reset-engine.php' );
58
 
59
- require_once ( dirname( __FILE__ ) . '/includes/class-crawler.php' );
60
- require_once ( dirname( __FILE__ ) . '/includes/class-share-crawler.php' );
61
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-crawler.php' );
62
 
63
- require_once ( dirname( __FILE__ ) . '/includes/class-analytical-engline.php' );
64
- require_once ( dirname( __FILE__ ) . '/includes/class-share-analytical-engine.php' );
65
 
66
- require_once ( dirname( __FILE__ ) . '/includes/class-crawl-strategy.php' );
67
 
68
- require_once ( dirname( __FILE__ ) . '/includes/class-share-facebook-strategy.php' );
69
- require_once ( dirname( __FILE__ ) . '/includes/class-share-twitter-strategy.php' );
70
- require_once ( dirname( __FILE__ ) . '/includes/class-share-pocket-strategy.php' );
71
- require_once ( dirname( __FILE__ ) . '/includes/class-share-google-strategy.php' );
72
- require_once ( dirname( __FILE__ ) . '/includes/class-share-hatebu-strategy.php' );
 
73
 
74
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-twitter-strategy.php' );
75
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-feedly-strategy.php' );
76
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-facebook-strategy.php' );
77
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-push7-strategy.php' );
78
- require_once ( dirname( __FILE__ ) . '/includes/class-follow-instagram-strategy.php' );
79
 
80
- require_once ( dirname( __FILE__ ) . '/includes/class-mcrypt.php' );
81
- require_once ( dirname( __FILE__ ) . '/includes/class-blowfish.php' );
82
  require_once ( dirname( __FILE__ ) . '/includes/class-default-key.php' );
83
 
84
  if ( ! defined( 'ABSPATH' ) ) exit(); // Exit if accessed directly
85
 
86
  if ( ! class_exists( 'SNS_Count_Cache' ) ) {
87
 
88
- final class SNS_Count_Cache implements Order {
89
 
90
  /**
91
  * Prefix of share cache ID
@@ -120,7 +120,12 @@ final class SNS_Count_Cache implements Order {
120
  /**
121
  * Interval cheking and caching share count for share rush cache
122
  */
123
- const OPT_SHARE_RUSH_CHECK_INTERVAL = 300;
 
 
 
 
 
124
 
125
  /**
126
  * Term that a content is considered as new content in share rush cache
@@ -204,22 +209,37 @@ final class SNS_Count_Cache implements Order {
204
  /**
205
  * Type of dynamic cache processing
206
  */
207
- const OPT_COMMON_ACCESS_BASED_CACHE_NONE = 1;
208
 
209
  /**
210
  * Type of dynamic cache processing
211
  */
212
- const OPT_COMMON_ACCESS_BASED_SYNC_CACHE = 2;
 
 
 
 
 
 
 
 
 
 
213
 
214
  /**
215
  * Type of dynamic cache processing
216
  */
217
- const OPT_COMMON_ACCESS_BASED_ASYNC_CACHE = 3;
218
 
219
  /**
220
  * Type of dynamic cache processing
221
  */
222
- const OPT_COMMON_ACCESS_BASED_2ND_CACHE = 4;
 
 
 
 
 
223
 
224
  /**
225
  * Type of scheme migration mode
@@ -319,13 +339,18 @@ final class SNS_Count_Cache implements Order {
319
  /**
320
  * Option key for number of posts to check at a time for share base cache
321
  */
322
- const DB_SHARE_POSTS_PER_CHECK = 'share_posts_per_check';
323
 
324
  /**
325
  * Option key for dynamic cache
326
  */
327
  const DB_COMMON_DYNAMIC_CACHE_MODE = 'common_dynamic_cache_mode';
328
 
 
 
 
 
 
329
  /**
330
  * Option key for new content term for share rush cache
331
  */
@@ -336,6 +361,11 @@ final class SNS_Count_Cache implements Order {
336
  */
337
  const DB_SHARE_RUSH_CHECK_INTERVAL = 'share_rush_check_interval';
338
 
 
 
 
 
 
339
  /**
340
  * Option key of cache target for share base cache
341
  */
@@ -441,6 +471,21 @@ final class SNS_Count_Cache implements Order {
441
  */
442
  const DB_FOLLOW_FACEBOOK_ACCESS_TOKEN = 'follow_facebook_access_token';
443
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  /**
445
  * Option key of push7 appno
446
  */
@@ -619,7 +664,7 @@ final class SNS_Count_Cache implements Order {
619
  /**
620
  * Plugin version, used for cache-busting of style and script file references.
621
  */
622
- private $version = '0.9.2';
623
 
624
  /**
625
  * Instances of crawler
@@ -689,7 +734,27 @@ final class SNS_Count_Cache implements Order {
689
  /**
690
  *Check interval for share rush cahce
691
  */
692
- private $share_rush_check_interval = 300;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
693
 
694
  /**
695
  * Cache target for follow base cache
@@ -781,6 +846,11 @@ final class SNS_Count_Cache implements Order {
781
  */
782
  private $dynamic_cache_mode = 1;
783
 
 
 
 
 
 
784
  /**
785
  * Data export mode
786
  */
@@ -856,7 +926,7 @@ final class SNS_Count_Cache implements Order {
856
  * Hook onto all of the actions and filters needed by the plugin.
857
  */
858
  private function __construct() {
859
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
860
 
861
  load_plugin_textdomain( self::DOMAIN, false, basename( dirname( __FILE__ ) ) . '/languages' );
862
 
@@ -894,11 +964,11 @@ final class SNS_Count_Cache implements Order {
894
  * @since 0.6.0
895
  */
896
  public function get_object_id() {
897
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
898
 
899
  $object_id = spl_object_hash( $this );
900
 
901
- Common_Util::log( '[' . __METHOD__ . '] object ID: ' . $object_id );
902
 
903
  return $object_id;
904
  }
@@ -918,7 +988,7 @@ final class SNS_Count_Cache implements Order {
918
  * @since 0.1.1
919
  */
920
  public function initialize() {
921
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
922
 
923
  $settings = get_option( self::DB_SETTINGS );
924
 
@@ -928,8 +998,8 @@ final class SNS_Count_Cache implements Order {
928
  $this->share_base_check_interval = self::OPT_SHARE_BASE_CHECK_INTERVAL;
929
  }
930
 
931
- if ( isset( $settings[self::DB_SHARE_POSTS_PER_CHECK] ) && $settings[self::DB_SHARE_POSTS_PER_CHECK] ) {
932
- $this->share_base_posts_per_check = (int) $settings[self::DB_SHARE_POSTS_PER_CHECK];
933
  } else {
934
  $this->share_base_posts_per_check = self::OPT_SHARE_BASE_POSTS_PER_CHECK;
935
  }
@@ -946,7 +1016,13 @@ final class SNS_Count_Cache implements Order {
946
  if ( isset( $settings[self::DB_COMMON_DYNAMIC_CACHE_MODE] ) && $settings[self::DB_COMMON_DYNAMIC_CACHE_MODE] ) {
947
  $this->dynamic_cache_mode = (int) $settings[self::DB_COMMON_DYNAMIC_CACHE_MODE];
948
  } else {
949
- $this->dynamic_cache_mode = self::OPT_COMMON_ACCESS_BASED_2ND_CACHE;
 
 
 
 
 
 
950
  }
951
 
952
  if ( isset( $settings[self::DB_SHARE_RUSH_CHECK_INTERVAL] ) && $settings[self::DB_SHARE_RUSH_CHECK_INTERVAL] ) {
@@ -955,6 +1031,12 @@ final class SNS_Count_Cache implements Order {
955
  $this->share_rush_check_interval = self::OPT_SHARE_RUSH_CHECK_INTERVAL;
956
  }
957
 
 
 
 
 
 
 
958
  if ( isset( $settings[self::DB_SHARE_RUSH_NEW_CONTENT_TERM] ) && $settings[self::DB_SHARE_RUSH_NEW_CONTENT_TERM] ) {
959
  $this->share_rush_new_content_term = (int) $settings[self::DB_SHARE_RUSH_NEW_CONTENT_TERM];
960
  } else {
@@ -1066,57 +1148,71 @@ final class SNS_Count_Cache implements Order {
1066
  }
1067
 
1068
  if ( isset( $settings[self::DB_FOLLOW_TWITTER_CONSUMER_KEY] ) && $settings[self::DB_FOLLOW_TWITTER_CONSUMER_KEY] ) {
1069
- $this->follow_twitter_consumer_key = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_TWITTER_CONSUMER_KEY], AUTH_KEY ) );
1070
  }
1071
 
1072
  if ( isset( $settings[self::DB_FOLLOW_TWITTER_CONSUMER_SECRET] ) && $settings[self::DB_FOLLOW_TWITTER_CONSUMER_SECRET] ) {
1073
- $this->follow_twitter_consumer_secret = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_TWITTER_CONSUMER_SECRET], AUTH_KEY ) );
1074
  }
1075
 
1076
  if ( isset( $settings[self::DB_FOLLOW_TWITTER_BEARER_TOKEN] ) && $settings[self::DB_FOLLOW_TWITTER_BEARER_TOKEN] ) {
1077
- $this->follow_twitter_bearer_token = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_TWITTER_BEARER_TOKEN], AUTH_KEY ) );
1078
  }
1079
 
1080
  /*
1081
  if ( isset( $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN] ) && $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN] ) {
1082
- $this->follow_twitter_access_token = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN], AUTH_KEY ) );
1083
  }
1084
 
1085
  if ( isset( $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN_SECRET] ) && $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN_SECRET] ) {
1086
- $this->follow_twitter_access_token_secret = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN_SECRET], AUTH_KEY ) );
1087
  }
1088
  */
1089
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1090
  if ( isset( $settings[self::DB_FOLLOW_FACEBOOK_PAGE_ID] ) && $settings[self::DB_FOLLOW_FACEBOOK_PAGE_ID] ) {
1091
  $this->follow_facebook_page_id = $settings[self::DB_FOLLOW_FACEBOOK_PAGE_ID];
1092
  }
1093
 
1094
  if ( isset( $settings[self::DB_FOLLOW_FACEBOOK_APP_ID] ) && $settings[self::DB_FOLLOW_FACEBOOK_APP_ID] ) {
1095
- $this->follow_facebook_app_id = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_FACEBOOK_APP_ID], AUTH_KEY ) );
1096
  }
1097
 
1098
  if ( isset( $settings[self::DB_FOLLOW_FACEBOOK_APP_SECRET] ) && $settings[self::DB_FOLLOW_FACEBOOK_APP_SECRET] ) {
1099
- $this->follow_facebook_app_secret = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_FACEBOOK_APP_SECRET], AUTH_KEY ) );
1100
  }
1101
 
1102
  if ( isset( $settings[self::DB_FOLLOW_FACEBOOK_ACCESS_TOKEN] ) && $settings[self::DB_FOLLOW_FACEBOOK_ACCESS_TOKEN] ) {
1103
- $this->follow_facebook_access_token = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_FACEBOOK_ACCESS_TOKEN], AUTH_KEY ) );
1104
  }
1105
 
1106
  if ( isset( $settings[self::DB_FOLLOW_PUSH7_APPNO] ) && $settings[self::DB_FOLLOW_PUSH7_APPNO] ) {
1107
- $this->follow_push7_appno = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_PUSH7_APPNO], AUTH_KEY ) );
1108
  }
1109
 
1110
  if ( isset( $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_ID] ) && $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_ID] ) {
1111
- $this->follow_instagram_client_id = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_ID], AUTH_KEY ) );
1112
  }
1113
 
1114
  if ( isset( $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_SECRET] ) && $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_SECRET] ) {
1115
- $this->follow_instagram_client_secret = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_SECRET], AUTH_KEY ) );
1116
  }
1117
 
1118
  if ( isset( $settings[self::DB_FOLLOW_INSTAGRAM_ACCESS_TOKEN] ) && $settings[self::DB_FOLLOW_INSTAGRAM_ACCESS_TOKEN] ) {
1119
- $this->follow_instagram_access_token = trim( Common_Util::decrypt_data( $settings[self::DB_FOLLOW_INSTAGRAM_ACCESS_TOKEN], AUTH_KEY ) );
1120
  }
1121
 
1122
  // Share Crawler
@@ -1128,7 +1224,7 @@ final class SNS_Count_Cache implements Order {
1128
  'ssl_verification' => $this->crawler_ssl_verification,
1129
  );
1130
 
1131
- $this->crawlers[self::REF_SHARE] = Share_Crawler::get_instance();
1132
  $this->crawlers[self::REF_SHARE]->initialize( $options );
1133
 
1134
  // Share Twitter Crawl Strategy
@@ -1138,6 +1234,19 @@ final class SNS_Count_Cache implements Order {
1138
 
1139
  $this->crawlers[self::REF_SHARE]->initialize_crawl_strategy( self::REF_SHARE_TWITTER, $options );
1140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1141
  // Follow Crawler
1142
  $options = array(
1143
  'target_sns' => $this->follow_base_cache_target,
@@ -1147,7 +1256,7 @@ final class SNS_Count_Cache implements Order {
1147
  'ssl_verification' => $this->crawler_ssl_verification
1148
  );
1149
 
1150
- $this->crawlers[self::REF_FOLLOW] = Follow_Crawler::get_instance();
1151
  $this->crawlers[self::REF_FOLLOW]->initialize( $options );
1152
 
1153
  // Follow Twitter Crawl Strategy
@@ -1227,10 +1336,11 @@ final class SNS_Count_Cache implements Order {
1227
  'post_types' => $this->share_base_cache_post_types,
1228
  'scheme_migration_mode' => $this->scheme_migration_mode,
1229
  'scheme_migration_date' => $this->scheme_migration_date,
1230
- 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys
 
1231
  );
1232
 
1233
- $this->cache_engines[self::REF_SHARE_BASE] = Share_Base_Cache_Engine::get_instance();
1234
  $this->cache_engines[self::REF_SHARE_BASE]->initialize( $options );
1235
 
1236
  // Share rush cache engine
@@ -1239,15 +1349,16 @@ final class SNS_Count_Cache implements Order {
1239
  'crawler' => $this->crawlers[self::REF_SHARE],
1240
  'target_sns' => $this->share_base_cache_target,
1241
  'check_interval' => $this->share_rush_check_interval,
1242
- 'posts_per_check' => 30,
1243
  'new_content_term' => $this->share_rush_new_content_term,
1244
  'post_types' => $this->share_base_cache_post_types,
1245
  'scheme_migration_mode' => $this->scheme_migration_mode,
1246
  'scheme_migration_date' => $this->scheme_migration_date,
1247
- 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys
 
1248
  );
1249
 
1250
- $this->cache_engines[self::REF_SHARE_RUSH] = Share_Rush_Cache_Engine::get_instance();
1251
  $this->cache_engines[self::REF_SHARE_RUSH]->initialize( $options );
1252
 
1253
  // Share lazy cache engine
@@ -1260,10 +1371,11 @@ final class SNS_Count_Cache implements Order {
1260
  'post_types' => $this->share_base_cache_post_types,
1261
  'scheme_migration_mode' => $this->scheme_migration_mode,
1262
  'scheme_migration_date' => $this->scheme_migration_date,
1263
- 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys
 
1264
  );
1265
 
1266
- $this->cache_engines[self::REF_SHARE_LAZY] = Share_Lazy_Cache_Engine::get_instance();
1267
  $this->cache_engines[self::REF_SHARE_LAZY]->initialize( $options );
1268
 
1269
  // Share second cache engine
@@ -1276,7 +1388,7 @@ final class SNS_Count_Cache implements Order {
1276
  'crawl_date_key' => self::REF_CRAWL_DATE
1277
  );
1278
 
1279
- $this->cache_engines[self::REF_SHARE_2ND] = Share_Second_Cache_Engine::get_instance();
1280
  $this->cache_engines[self::REF_SHARE_2ND]->initialize( $options );
1281
 
1282
  // Share restore cache engine
@@ -1287,7 +1399,7 @@ final class SNS_Count_Cache implements Order {
1287
  'post_types' => $this->share_base_cache_post_types,
1288
  );
1289
 
1290
- $this->cache_engines[self::REF_SHARE_RESTORE] = Share_Restore_Cache_Engine::get_instance();
1291
  $this->cache_engines[self::REF_SHARE_RESTORE]->initialize( $options );
1292
 
1293
  // Follow base cache engine
@@ -1301,7 +1413,7 @@ final class SNS_Count_Cache implements Order {
1301
  'feed_type' => $this->follow_feed_type
1302
  );
1303
 
1304
- $this->cache_engines[self::REF_FOLLOW_BASE] = Follow_Base_Cache_Engine::get_instance();
1305
  $this->cache_engines[self::REF_FOLLOW_BASE]->initialize( $options );
1306
 
1307
  // Follow lazy cache engine
@@ -1315,7 +1427,7 @@ final class SNS_Count_Cache implements Order {
1315
  'feed_type' => $this->follow_feed_type
1316
  );
1317
 
1318
- $this->cache_engines[self::REF_FOLLOW_LAZY] = Follow_Lazy_Cache_Engine::get_instance();
1319
  $this->cache_engines[self::REF_FOLLOW_LAZY]->initialize( $options );
1320
 
1321
  // Follow second cache engine
@@ -1326,7 +1438,7 @@ final class SNS_Count_Cache implements Order {
1326
  'cache_prefix' => self::OPT_FOLLOW_2ND_META_KEY_PREFIX
1327
  );
1328
 
1329
- $this->cache_engines[self::REF_FOLLOW_2ND] = Follow_Second_Cache_Engine::get_instance();
1330
  $this->cache_engines[self::REF_FOLLOW_2ND]->initialize( $options );
1331
 
1332
  // Follow restore cache engine
@@ -1335,7 +1447,7 @@ final class SNS_Count_Cache implements Order {
1335
  'check_interval' => $this->follow_base_check_interval,
1336
  );
1337
 
1338
- $this->cache_engines[self::REF_FOLLOW_RESTORE] = Follow_Restore_Cache_Engine::get_instance();
1339
  $this->cache_engines[self::REF_FOLLOW_RESTORE]->initialize( $options );
1340
 
1341
  // Data export engine
@@ -1349,7 +1461,7 @@ final class SNS_Count_Cache implements Order {
1349
  'post_types' => $this->share_base_cache_post_types
1350
  );
1351
 
1352
- $this->export_engines[self::REF_COMMON_EXPORT] = Common_Data_Export_Engine::get_instance();
1353
  $this->export_engines[self::REF_COMMON_EXPORT]->initialize( $options );
1354
 
1355
  // Share analytical engine
@@ -1362,7 +1474,7 @@ final class SNS_Count_Cache implements Order {
1362
  'crawl_date_key' => self::REF_CRAWL_DATE
1363
  );
1364
 
1365
- $this->analytical_engines[self::REF_SHARE_ANALYSIS] = Share_Analytical_Engine::get_instance();
1366
  $this->analytical_engines[self::REF_SHARE_ANALYSIS]->initialize( $options );
1367
 
1368
  // Job reset engine
@@ -1391,7 +1503,7 @@ final class SNS_Count_Cache implements Order {
1391
  'target_cron' => $target_crons
1392
  );
1393
 
1394
- $this->control_engines[self::REF_COMMON_CONTROL] = Common_Job_Reset_Engine::get_instance();
1395
  $this->control_engines[self::REF_COMMON_CONTROL]->initialize( $options );
1396
 
1397
  $tmp_max_execution_time = ini_get( 'max_execution_time' );
@@ -1404,11 +1516,6 @@ final class SNS_Count_Cache implements Order {
1404
 
1405
  $this->loading_img_url = plugins_url( '/images/loading.gif', __FILE__ );
1406
 
1407
- // delete old hooks
1408
- WP_Cron_Util::clear_scheduled_hook( 'scc_basecache_prime' );
1409
- WP_Cron_Util::clear_scheduled_hook( 'scc_rushcache_prime' );
1410
- WP_Cron_Util::clear_scheduled_hook( 'scc_2ndcache_prime' );
1411
- WP_Cron_Util::clear_scheduled_hook( 'scc_share_rescuecache_prime' );
1412
  }
1413
 
1414
  /**
@@ -1417,7 +1524,7 @@ final class SNS_Count_Cache implements Order {
1417
  * @since 0.1.0
1418
  */
1419
  public function register_admin_styles() {
1420
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1421
 
1422
  if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
1423
  return;
@@ -1438,7 +1545,7 @@ final class SNS_Count_Cache implements Order {
1438
  * @since 0.1.0
1439
  */
1440
  public function register_admin_scripts() {
1441
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1442
 
1443
  if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
1444
  return;
@@ -1449,7 +1556,7 @@ final class SNS_Count_Cache implements Order {
1449
  if ( in_array( $screen->id, $this->plugin_screen_hook_suffix ) ) {
1450
  wp_enqueue_script( self::DOMAIN . '-admin-script-1', plugins_url( ltrim( '/js/highlight.pack.js', '/' ) , __FILE__ ), array( 'jquery' ) );
1451
 
1452
- wp_enqueue_script( self::DOMAIN . '-admin-script-2', plugins_url( ltrim( '/js/jquery.scc-cache-info.js', '/' ), __FILE__ ), array( 'jquery' ) );
1453
  wp_localize_script( self::DOMAIN . '-admin-script-2', 'scc', array( 'endpoint' => admin_url( 'admin-ajax.php' ), 'action' => $this->ajax_action, 'nonce' => wp_create_nonce( $this->ajax_action ) ) );
1454
 
1455
  wp_enqueue_script( 'jquery-ui-datepicker' );
@@ -1462,7 +1569,7 @@ final class SNS_Count_Cache implements Order {
1462
  * @since 0.1.1
1463
  */
1464
  public function activate_plugin() {
1465
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1466
 
1467
  $this->initialize();
1468
 
@@ -1503,7 +1610,7 @@ final class SNS_Count_Cache implements Order {
1503
  * @since 0.1.1
1504
  */
1505
  public function deactivate_plugin() {
1506
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1507
 
1508
  set_time_limit( $this->extended_max_execution_time );
1509
 
@@ -1512,35 +1619,6 @@ final class SNS_Count_Cache implements Order {
1512
  $cache_engine->clear_cache();
1513
  }
1514
 
1515
- // compatibility for old version
1516
- $query_args = array(
1517
- 'post_type' => $this->share_base_cache_post_types,
1518
- 'post_status' => 'publish',
1519
- 'nopaging' => true,
1520
- 'update_post_term_cache' => false,
1521
- 'update_post_meta_cache' => false
1522
- );
1523
-
1524
- $posts_query = new WP_Query( $query_args );
1525
-
1526
- if ( $posts_query->have_posts() ) {
1527
- while ( $posts_query->have_posts() ) {
1528
- $posts_query->the_post();
1529
-
1530
- $post_ID = get_the_ID();
1531
-
1532
- foreach ( $this->follow_base_cache_target as $sns => $active ) {
1533
-
1534
- if ( $active ) {
1535
- $meta_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( $sns );
1536
-
1537
- delete_post_meta( $post_ID, $meta_key );
1538
- }
1539
- }
1540
- }
1541
- }
1542
- wp_reset_postdata();
1543
-
1544
  foreach ( $this->control_engines as $key => $control_engine ) {
1545
  $control_engine->unregister_schedule();
1546
  }
@@ -1559,7 +1637,7 @@ final class SNS_Count_Cache implements Order {
1559
  * @since 0.1.1
1560
  */
1561
  function reactivate_plugin() {
1562
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1563
 
1564
  $this->deactivate_plugin();
1565
  $this->activate_plugin();
@@ -1586,7 +1664,7 @@ final class SNS_Count_Cache implements Order {
1586
  * @since 0.1.0
1587
  */
1588
  public function register_admin_menu() {
1589
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1590
 
1591
  $this->plugin_screen_hook_suffix[] = 'dashboard';
1592
  $this->plugin_screen_hook_suffix[] = add_menu_page( __( 'SNS Count Cache', self::DOMAIN ), __( 'SNS Count Cache', self::DOMAIN ), self::OPT_COMMON_CAPABILITY, 'scc-dashboard', array( $this, 'dashboard_page' ), 'dashicons-share' );
@@ -1718,7 +1796,7 @@ final class SNS_Count_Cache implements Order {
1718
  * @since 0.2.0
1719
  */
1720
  private function retrieve_share_cache( $post_ID, $second_sync = false ) {
1721
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1722
  return $this->cache_engines[self::REF_SHARE_BASE]->direct_cache( $post_ID, $second_sync );
1723
  }
1724
 
@@ -1728,7 +1806,7 @@ final class SNS_Count_Cache implements Order {
1728
  * @since 0.2.0
1729
  */
1730
  private function retrieve_follow_cache( $second_sync = false ) {
1731
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1732
  return $this->cache_engines[self::REF_FOLLOW_BASE]->direct_cache( $second_sync );
1733
  }
1734
 
@@ -1738,7 +1816,7 @@ final class SNS_Count_Cache implements Order {
1738
  * @since 0.2.0
1739
  */
1740
  private function reserve_share_cache( $post_ID ) {
1741
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1742
  $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
1743
  }
1744
 
@@ -1748,55 +1826,81 @@ final class SNS_Count_Cache implements Order {
1748
  * @since 0.4.0
1749
  */
1750
  private function reserve_follow_cache() {
1751
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1752
  $this->cache_engines[self::REF_FOLLOW_LAZY]->prime_cache();
1753
  }
1754
 
1755
  /**
1756
  * Method call between one cache engine and another
1757
  *
1758
- * @since 0.4.0
1759
  */
1760
- public function order_cache( Cache_Engine $engine, $options = array() ) {
1761
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1762
 
1763
  switch ( get_class( $engine ) ) {
1764
- case 'Share_Lazy_Cache_Engine':
1765
- $this->cache_engines[self::REF_SHARE_2ND]->cache( $options );
 
 
 
 
1766
  break;
1767
- case 'Share_Rescue_Cache_Engine':
1768
- $this->cache_engines[self::REF_SHARE_2ND]->cache( $options );
 
 
 
 
1769
  break;
1770
- case 'Share_Base_Cache_Engine':
1771
- $this->cache_engines[self::REF_SHARE_2ND]->cache( $options );
 
 
 
 
1772
  break;
1773
- case 'Share_Rush_Cache_Engine':
1774
- $this->cache_engines[self::REF_SHARE_2ND]->cache( $options );
 
 
 
 
1775
  break;
1776
- case 'Follow_Lazy_Cache_Engine':
1777
- $this->cache_engines[self::REF_FOLLOW_2ND]->cache( $options );
 
 
1778
  break;
1779
- case 'Follow_Base_Cache_Engine':
1780
- $this->cache_engines[self::REF_FOLLOW_2ND]->cache( $options );
 
 
1781
  break;
1782
  }
1783
  }
1784
 
1785
  /**
1786
- * Method call between one cache engine and another
1787
  *
1788
- * @since 0.6.1
1789
  */
1790
- public function order_analysis( Cache_Engine $engine, $options = array() ) {
1791
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
 
1792
 
1793
- if ( $this->share_variation_analysis_mode !== self::OPT_SHARE_VARIATION_ANALYSIS_NONE ) {
1794
- switch ( get_class( $engine ) ) {
1795
- case 'Share_Second_Cache_Engine':
1796
- $this->analytical_engines[self::REF_SHARE_ANALYSIS]->analyze( $options );
1797
- break;
 
1798
  }
 
 
 
1799
  }
 
1800
  }
1801
 
1802
  /**
@@ -1805,7 +1909,7 @@ final class SNS_Count_Cache implements Order {
1805
  * @since 0.4.0
1806
  */
1807
  private function pagination( $numpages = '', $pagerange = '', $paged='', $inherit_param = true ) {
1808
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1809
 
1810
  if ( empty( $pagerange ) ) {
1811
  $pagerange = 2;
@@ -1838,7 +1942,7 @@ final class SNS_Count_Cache implements Order {
1838
 
1839
  $base_url = $base_url . '?page=' . $query['page'];
1840
 
1841
- Common_Util::log( '[' . __METHOD__ . '] base url: ' . $base_url );
1842
 
1843
  $pagination_args = array(
1844
  'base' => $base_url . '%_%',
@@ -1859,9 +1963,9 @@ final class SNS_Count_Cache implements Order {
1859
  $paginate_links = paginate_links( $pagination_args );
1860
 
1861
  if ( $inherit_param ) {
1862
- Common_Util::log( '[' . __METHOD__ . '] inherit param: true' );
1863
  } else {
1864
- Common_Util::log( '[' . __METHOD__ . '] inherit param: false' );
1865
 
1866
  $pattern = '/(?:&#038;action=cache&#038;post_id=[0-9]+&#038;_wpnonce=.{10})/';
1867
  $paginate_links = preg_replace( $pattern, '', $paginate_links );
@@ -1881,7 +1985,7 @@ final class SNS_Count_Cache implements Order {
1881
  * @since 0.5.1
1882
  */
1883
  public function get_cache_info() {
1884
- Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1885
 
1886
  if ( isset( $_REQUEST['nonce'] ) && wp_verify_nonce( $_REQUEST['nonce'], $this->ajax_action ) ) {
1887
  if ( current_user_can( self::OPT_COMMON_CAPABILITY ) ) {
@@ -2323,7 +2427,7 @@ final class SNS_Count_Cache implements Order {
2323
  $return['follow']['secondary']['cache_status'] = __( 'Ongoing', self::DOMAIN );
2324
  }
2325
 
2326
- Common_Util::log( $return );
2327
 
2328
  $callback = $_REQUEST["callback"];
2329
 
@@ -2370,162 +2474,119 @@ final class SNS_Count_Cache implements Order {
2370
  return $sns_counts;
2371
  }
2372
  } else {
2373
- switch ( $this->dynamic_cache_mode ) {
2374
- case self::OPT_COMMON_ACCESS_BASED_2ND_CACHE:
2375
- if ( $sns_key ) {
2376
- if ( $post_ID !== 'home' ) {
2377
- $meta_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( $sns_key );
2378
- $sns_count = get_post_meta( $post_ID, $meta_key, true );
2379
-
2380
- $second_cache_flag = false;
2381
 
2382
- if ( isset( $sns_count ) && $sns_count !== '' ) {
2383
- if ( $sns_count >= 0 ) {
2384
- $sns_counts[$sns_key] = $sns_count;
2385
- $second_cache_flag = true;
2386
- } else {
2387
- $sns_counts[$sns_key] = 0;
2388
- }
2389
- } else {
2390
- $sns_counts[$sns_key] = 0;
2391
- }
2392
 
2393
- if ( $second_cache_flag ) {
2394
- $this->cache_engines[self::REF_SHARE_RESTORE]->prime_cache( $post_ID );
2395
- } else {
2396
- $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
2397
- }
2398
  } else {
2399
- $option_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( 'home' );
 
 
 
 
2400
 
2401
- $second_cache_flag = false;
 
 
 
 
 
 
 
 
2402
 
2403
- if ( false !== ( $sns_counts = get_option( $option_key ) ) ) {
2404
- if ( ! isset( $sns_counts[$sns_key] ) || $sns_counts[$sns_key] < 0 ) {
2405
- $sns_counts[$sns_key] = 0;
2406
- } else {
2407
- $second_cache_flag = true;
2408
- }
2409
- }else {
2410
- $sns_counts[$sns_key] = 0;
2411
- }
2412
 
2413
- if ( $second_cache_flag ) {
2414
- $this->cache_engines[self::REF_SHARE_RESTORE]->prime_cache( $post_ID );
2415
- } else {
2416
- $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
2417
- }
2418
  }
2419
-
2420
- return $sns_counts[$sns_key];
2421
  } else {
2422
- if ( $post_ID !== 'home' ) {
2423
-
2424
- $second_cache_flag = false;
2425
 
2426
- foreach ( $this->share_base_cache_target as $sns => $active ) {
2427
- if ( $active ) {
2428
- $meta_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( $sns );
 
 
 
 
 
2429
 
2430
- $sns_count = get_post_meta( $post_ID, $meta_key, true );
 
 
2431
 
2432
- if ( isset( $sns_count ) && $sns_count !== '' ) {
2433
- if ( $sns_count >= 0 ) {
2434
- $sns_counts[$sns] = $sns_count;
2435
- $second_cache_flag = true;
2436
- } else {
2437
- $sns_counts[$sns] = 0;
2438
- }
2439
- } else {
2440
- $sns_counts[$sns] = 0;
2441
- }
2442
- }
2443
- }
2444
 
2445
- if ( $second_cache_flag ) {
2446
- $this->cache_engines[self::REF_SHARE_RESTORE]->prime_cache( $post_ID );
2447
- } else {
2448
- $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
2449
- }
2450
- } else {
2451
- $option_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( 'home' );
2452
 
2453
- $second_cache_flag = false;
2454
 
2455
- if ( false !== ( $sns_counts = get_option( $option_key ) ) ) {
2456
- foreach ( $this->share_base_cache_target as $sns => $active ) {
2457
- if ( $active ) {
2458
- if ( ! isset( $sns_counts[$sns] ) || $sns_counts[$sns] < 0 ) {
2459
- $sns_counts[$sns] = 0;
2460
- } else {
2461
- $second_cache_flag = true;
2462
- }
2463
- }
2464
- }
2465
- } else {
2466
- foreach ( $this->share_base_cache_target as $sns => $active ) {
2467
- if ( $active ) {
2468
- $sns_counts[$sns] = 0;
2469
- }
2470
  }
2471
- }
2472
-
2473
- if ( $second_cache_flag ) {
2474
- $this->cache_engines[self::REF_SHARE_RESTORE]->prime_cache( $post_ID );
2475
  } else {
2476
- $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
2477
  }
2478
  }
2479
- return $sns_counts;
2480
  }
2481
- break;
2482
- case self::OPT_COMMON_ACCESS_BASED_ASYNC_CACHE:
2483
- $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
2484
 
2485
- if ( $sns_key ) {
2486
- $sns_counts[$sns_key] = 0;
2487
- return $sns_counts[$sns_key];
2488
  } else {
2489
- foreach ( $this->share_base_cache_target as $sns => $active ) {
2490
- if ( $active ) {
2491
- $sns_counts[$sns] = 0;
2492
- }
2493
  }
2494
- return $sns_counts;
2495
  }
2496
- break;
2497
- case self::OPT_COMMON_ACCESS_BASED_SYNC_CACHE:
2498
- $sns_counts = $this->cache_engines[self::REF_SHARE_BASE]->direct_cache( $post_ID, true );
2499
 
2500
- if ( $sns_key ) {
2501
- if ( ! isset( $sns_counts[$sns_key] ) || $sns_counts[$sns_key] < 0 ) {
2502
- $sns_counts[$sns_key] = 0;
2503
- }
2504
- return $sns_counts[$sns_key];
2505
- } else {
2506
  foreach ( $this->share_base_cache_target as $sns => $active ) {
2507
  if ( $active ) {
2508
  if ( ! isset( $sns_counts[$sns] ) || $sns_counts[$sns] < 0 ) {
2509
  $sns_counts[$sns] = 0;
 
 
2510
  }
2511
  }
2512
  }
2513
- return $sns_counts;
2514
- }
2515
- break;
2516
- case self::OPT_COMMON_ACCESS_BASED_CACHE_NONE:
2517
- if ( $sns_key ) {
2518
- $sns_counts[$sns_key] = 0;
2519
- return $sns_counts[$sns_key];
2520
  } else {
2521
  foreach ( $this->share_base_cache_target as $sns => $active ) {
2522
  if ( $active ) {
2523
  $sns_counts[$sns] = 0;
2524
  }
2525
  }
2526
- return $sns_counts;
2527
  }
2528
- break;
 
 
 
 
 
 
 
 
 
2529
  }
2530
  }
2531
  }
@@ -2557,107 +2618,58 @@ final class SNS_Count_Cache implements Order {
2557
  return $sns_followers;
2558
  }
2559
  } else {
2560
- switch ( $this->dynamic_cache_mode ) {
2561
- case self::OPT_COMMON_ACCESS_BASED_2ND_CACHE:
2562
- $option_key = $this->cache_engines[self::REF_FOLLOW_2ND]->get_cache_key( 'follow' );
2563
-
2564
- if ( $sns_key ) {
2565
- $second_cache_flag = false;
2566
-
2567
- if ( false !== ( $sns_followers = get_option( $option_key ) ) ) {
2568
- if ( ! isset( $sns_followers[$sns_key] ) || $sns_followers[$sns_key] < 0 ) {
2569
- $sns_followers[$sns_key] = 0;
2570
- } else {
2571
- $second_cache_flag = true;
2572
- }
2573
- } else {
2574
- $sns_followers[$sns_key] = 0;
2575
- }
2576
 
2577
- if ( $second_cache_flag ) {
2578
- $this->cache_engines[self::REF_FOLLOW_RESTORE]->prime_cache();
2579
- } else {
2580
- $this->cache_engines[self::REF_FOLLOW_LAZY]->prime_cache();
2581
- }
2582
 
2583
- return $sns_followers[$sns_key];
 
 
2584
  } else {
2585
- $second_cache_flag = false;
2586
-
2587
- if ( false !== ( $sns_followers = get_option( $option_key ) ) ) {
2588
- foreach ( $this->follow_base_cache_target as $sns => $active ) {
2589
- if ( $active ) {
2590
- if ( ! isset( $sns_followers[$sns] ) || $sns_followers[$sns] < 0 ) {
2591
- $sns_followers[$sns] = 0;
2592
- } else {
2593
- $second_cache_flag = true;
2594
- }
2595
- }
2596
- }
2597
- } else {
2598
- foreach ( $this->follow_base_cache_target as $sns => $active ) {
2599
- if ( $active ) {
2600
- $sns_followers[$sns] = 0;
2601
- }
2602
- }
2603
- }
2604
-
2605
- if ( $second_cache_flag ) {
2606
- $this->cache_engines[self::REF_FOLLOW_RESTORE]->prime_cache();
2607
- } else {
2608
- $this->cache_engines[self::REF_FOLLOW_LAZY]->prime_cache();
2609
- }
2610
-
2611
- return $sns_followers;
2612
  }
2613
- break;
2614
- case self::OPT_COMMON_ACCESS_BASED_ASYNC_CACHE:
 
 
 
 
 
2615
  $this->cache_engines[self::REF_FOLLOW_LAZY]->prime_cache();
 
2616
 
2617
- if ( $sns_key ) {
2618
- $sns_followers[$sns_key] = 0;
2619
- return $sns_followers[$sns_key];
2620
- } else {
2621
- foreach ( $this->follow_base_cache_target as $sns => $active ) {
2622
- if ( $active ) {
 
 
2623
  $sns_followers[$sns] = 0;
 
 
2624
  }
2625
  }
2626
- return $sns_followers;
2627
  }
2628
- break;
2629
- case self::OPT_COMMON_ACCESS_BASED_SYNC_CACHE:
2630
- $sns_followers = $this->cache_engines[self::REF_FOLLOW_BASE]->direct_cache( true );
2631
-
2632
- if ( $sns_key ) {
2633
- if ( ! isset( $sns_followers[$sns_key] ) || $sns_followers[$sns_key] < 0 ) {
2634
- $sns_followers[$sns_key] = 0;
2635
- }
2636
- return $sns_followers[$sns_key];
2637
- } else {
2638
- foreach ( $this->follow_base_cache_target as $sns => $active ) {
2639
- if ( $active ) {
2640
- if ( ! isset( $sns_followers[$sns] ) || $sns_followers[$sns] < 0 ) {
2641
- $sns_followers[$sns] = 0;
2642
- }
2643
- }
2644
  }
2645
- return $sns_followers;
2646
  }
2647
- break;
2648
- case self::OPT_COMMON_ACCESS_BASED_CACHE_NONE:
2649
- if ( $sns_key ) {
2650
- $sns_followers[$sns_key] = 0;
2651
- return $sns_followers[$sns_key];
2652
- } else {
2653
- foreach ( $this->follow_base_cache_target as $sns => $active ) {
2654
- if ( $active ) {
2655
- $sns_followers[$sns] = 0;
2656
- }
2657
- }
2658
- return $sns_followers;
2659
  }
2660
- break;
 
 
2661
  }
2662
  }
2663
  }
@@ -2682,8 +2694,9 @@ final class SNS_Count_Cache implements Order {
2682
  */
2683
  private function test_cron_capability() {
2684
 
2685
- if ( defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON )
2686
  return true;
 
2687
 
2688
  $doing_wp_cron = sprintf( '%.22F', microtime( true ) );
2689
 
@@ -2804,6 +2817,16 @@ function scc_get_share_pocket( $options = array( 'post_id' => '', 'url' => '' )
2804
  return scc_get_share( $options );
2805
  }
2806
 
 
 
 
 
 
 
 
 
 
 
2807
  /**
2808
  * Get share count from cache (Pocket)
2809
  *
1
  <?php
2
  /*
3
  Plugin Name: SNS Count Cache
4
+ Description: SNS Count Cache gets share count for Twitter and Facebook, Google Plus, Pocket, Pinterest, 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: 0.10.0
6
  Plugin URI: https://wordpress.org/plugins/sns-count-cache/
7
  Author: Daisuke Maruyama
8
+ Author URI: https://marubon.info/
9
  License: GPL2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11
  Text Domain: sns-count-cache
29
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30
  */
31
 
32
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-common-util.php' );
33
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-wp-cron-util.php' );
34
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-sleep-throttle.php' );
35
 
36
+ require_once ( dirname( __FILE__ ) . '/includes/interface-scc-order.php' );
37
 
38
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-engine.php' );
39
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-cache-engine.php' );
40
 
41
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-cache-engine.php' );
42
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-base-cache-engine.php' );
43
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-rush-cache-engine.php' );
44
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-lazy-cache-engine.php' );
45
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-second-cache-engine.php' );
46
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-restore-cache-engine.php' );
47
 
48
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-cache-engine.php' );
49
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-base-cache-engine.php' );
50
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-lazy-cache-engine.php' );
51
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-second-cache-engine.php' );
52
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-restore-cache-engine.php' );
53
 
54
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-export-engine.php' );
55
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-common-data-export-engine.php' );
56
 
57
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-common-job-reset-engine.php' );
58
 
59
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-crawler.php' );
60
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-crawler.php' );
61
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-crawler.php' );
62
 
63
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-analytical-engline.php' );
64
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-analytical-engine.php' );
65
 
66
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-crawl-strategy.php' );
67
 
68
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-facebook-strategy.php' );
69
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-twitter-strategy.php' );
70
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-pocket-strategy.php' );
71
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-google-strategy.php' );
72
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-hatebu-strategy.php' );
73
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-share-pinterest-strategy.php' );
74
 
75
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-twitter-strategy.php' );
76
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-feedly-strategy.php' );
77
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-facebook-strategy.php' );
78
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-push7-strategy.php' );
79
+ require_once ( dirname( __FILE__ ) . '/includes/class-scc-follow-instagram-strategy.php' );
80
 
81
+ require_once ( dirname( __FILE__ ) . '/includes/class-crypt-blowfish.php' );
 
82
  require_once ( dirname( __FILE__ ) . '/includes/class-default-key.php' );
83
 
84
  if ( ! defined( 'ABSPATH' ) ) exit(); // Exit if accessed directly
85
 
86
  if ( ! class_exists( 'SNS_Count_Cache' ) ) {
87
 
88
+ final class SNS_Count_Cache implements SCC_Order {
89
 
90
  /**
91
  * Prefix of share cache ID
120
  /**
121
  * Interval cheking and caching share count for share rush cache
122
  */
123
+ const OPT_SHARE_RUSH_CHECK_INTERVAL = 600;
124
+
125
+ /**
126
+ * Number of posts to check at a time for share rush cache
127
+ */
128
+ const OPT_SHARE_RUSH_POSTS_PER_CHECK = 20;
129
 
130
  /**
131
  * Term that a content is considered as new content in share rush cache
209
  /**
210
  * Type of dynamic cache processing
211
  */
212
+ const OPT_COMMON_ACCESS_BASED_CACHE_OFF = 1;
213
 
214
  /**
215
  * Type of dynamic cache processing
216
  */
217
+ const OPT_COMMON_ACCESS_BASED_CACHE_ON = 5;
218
+
219
+ /**
220
+ * Type of fault tolerance processing
221
+ */
222
+ const OPT_COMMON_FAULT_TOLERANCE_OFF = 1;
223
+
224
+ /**
225
+ * Type of fault tolerance processing
226
+ */
227
+ const OPT_COMMON_FAULT_TOLERANCE_ON = 2;
228
 
229
  /**
230
  * Type of dynamic cache processing
231
  */
232
+ //const OPT_COMMON_ACCESS_BASED_SYNC_CACHE = 2;
233
 
234
  /**
235
  * Type of dynamic cache processing
236
  */
237
+ //const OPT_COMMON_ACCESS_BASED_ASYNC_CACHE = 3;
238
+
239
+ /**
240
+ * Type of dynamic cache processing
241
+ */
242
+ //const OPT_COMMON_ACCESS_BASED_2ND_CACHE = 4;
243
 
244
  /**
245
  * Type of scheme migration mode
339
  /**
340
  * Option key for number of posts to check at a time for share base cache
341
  */
342
+ const DB_SHARE_BASE_POSTS_PER_CHECK = 'share_posts_per_check';
343
 
344
  /**
345
  * Option key for dynamic cache
346
  */
347
  const DB_COMMON_DYNAMIC_CACHE_MODE = 'common_dynamic_cache_mode';
348
 
349
+ /**
350
+ * Option key for fault tolerance
351
+ */
352
+ const DB_COMMON_FAULT_TOLERANCE_MODE = 'common_fault_tolerance_mode';
353
+
354
  /**
355
  * Option key for new content term for share rush cache
356
  */
361
  */
362
  const DB_SHARE_RUSH_CHECK_INTERVAL = 'share_rush_check_interval';
363
 
364
+ /**
365
+ * Option key for number of posts to check at a time for share rush cache
366
+ */
367
+ const DB_SHARE_RUSH_POSTS_PER_CHECK = 'share_rush_posts_per_check';
368
+
369
  /**
370
  * Option key of cache target for share base cache
371
  */
471
  */
472
  const DB_FOLLOW_FACEBOOK_ACCESS_TOKEN = 'follow_facebook_access_token';
473
 
474
+ /**
475
+ * Option key of facebook app ID
476
+ */
477
+ const DB_SHARE_FACEBOOK_APP_ID = 'share_facebook_app_id';
478
+
479
+ /**
480
+ * Option key of facebook app secret
481
+ */
482
+ const DB_SHARE_FACEBOOK_APP_SECRET = 'share_facebook_app_secret';
483
+
484
+ /**
485
+ * Option key of facebook access token
486
+ */
487
+ const DB_SHARE_FACEBOOK_ACCESS_TOKEN = 'share_facebook_access_token';
488
+
489
  /**
490
  * Option key of push7 appno
491
  */
664
  /**
665
  * Plugin version, used for cache-busting of style and script file references.
666
  */
667
+ private $version = '0.10.0';
668
 
669
  /**
670
  * Instances of crawler
734
  /**
735
  *Check interval for share rush cahce
736
  */
737
+ private $share_rush_check_interval = 600;
738
+
739
+ /**
740
+ * Post per check for share rush cache
741
+ */
742
+ private $share_rush_posts_per_check = 20;
743
+
744
+ /**
745
+ * Facebook app ID
746
+ */
747
+ private $share_facebook_app_id = '';
748
+
749
+ /**
750
+ * Facebook app ID
751
+ */
752
+ private $share_facebook_app_secret = '';
753
+
754
+ /**
755
+ * Facebook access token
756
+ */
757
+ private $share_facebook_access_token = '';
758
 
759
  /**
760
  * Cache target for follow base cache
846
  */
847
  private $dynamic_cache_mode = 1;
848
 
849
+ /**
850
+ * Fault tolerance mode
851
+ */
852
+ private $fault_tolerance_mode = 1;
853
+
854
  /**
855
  * Data export mode
856
  */
926
  * Hook onto all of the actions and filters needed by the plugin.
927
  */
928
  private function __construct() {
929
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
930
 
931
  load_plugin_textdomain( self::DOMAIN, false, basename( dirname( __FILE__ ) ) . '/languages' );
932
 
964
  * @since 0.6.0
965
  */
966
  public function get_object_id() {
967
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
968
 
969
  $object_id = spl_object_hash( $this );
970
 
971
+ SCC_Common_Util::log( '[' . __METHOD__ . '] object ID: ' . $object_id );
972
 
973
  return $object_id;
974
  }
988
  * @since 0.1.1
989
  */
990
  public function initialize() {
991
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
992
 
993
  $settings = get_option( self::DB_SETTINGS );
994
 
998
  $this->share_base_check_interval = self::OPT_SHARE_BASE_CHECK_INTERVAL;
999
  }
1000
 
1001
+ if ( isset( $settings[self::DB_SHARE_BASE_POSTS_PER_CHECK] ) && $settings[self::DB_SHARE_BASE_POSTS_PER_CHECK] ) {
1002
+ $this->share_base_posts_per_check = (int) $settings[self::DB_SHARE_BASE_POSTS_PER_CHECK];
1003
  } else {
1004
  $this->share_base_posts_per_check = self::OPT_SHARE_BASE_POSTS_PER_CHECK;
1005
  }
1016
  if ( isset( $settings[self::DB_COMMON_DYNAMIC_CACHE_MODE] ) && $settings[self::DB_COMMON_DYNAMIC_CACHE_MODE] ) {
1017
  $this->dynamic_cache_mode = (int) $settings[self::DB_COMMON_DYNAMIC_CACHE_MODE];
1018
  } else {
1019
+ $this->dynamic_cache_mode = self::OPT_COMMON_ACCESS_BASED_CACHE_OFF;
1020
+ }
1021
+
1022
+ if ( isset( $settings[self::DB_COMMON_FAULT_TOLERANCE_MODE] ) && $settings[self::DB_COMMON_FAULT_TOLERANCE_MODE] ) {
1023
+ $this->fault_tolerance_mode = (int) $settings[self::DB_COMMON_FAULT_TOLERANCE_MODE];
1024
+ } else {
1025
+ $this->fault_tolerance_mode = self::OPT_COMMON_FAULT_TOLERANCE_OFF;
1026
  }
1027
 
1028
  if ( isset( $settings[self::DB_SHARE_RUSH_CHECK_INTERVAL] ) && $settings[self::DB_SHARE_RUSH_CHECK_INTERVAL] ) {
1031
  $this->share_rush_check_interval = self::OPT_SHARE_RUSH_CHECK_INTERVAL;
1032
  }
1033
 
1034
+ if ( isset( $settings[self::DB_SHARE_RUSH_POSTS_PER_CHECK] ) && $settings[self::DB_SHARE_RUSH_POSTS_PER_CHECK] ) {
1035
+ $this->share_rush_posts_per_check = (int) $settings[self::DB_SHARE_RUSH_POSTS_PER_CHECK];
1036
+ } else {
1037
+ $this->share_rush_posts_per_check = self::OPT_SHARE_RUSH_POSTS_PER_CHECK;
1038
+ }
1039
+
1040
  if ( isset( $settings[self::DB_SHARE_RUSH_NEW_CONTENT_TERM] ) && $settings[self::DB_SHARE_RUSH_NEW_CONTENT_TERM] ) {
1041
  $this->share_rush_new_content_term = (int) $settings[self::DB_SHARE_RUSH_NEW_CONTENT_TERM];
1042
  } else {
1148
  }
1149
 
1150
  if ( isset( $settings[self::DB_FOLLOW_TWITTER_CONSUMER_KEY] ) && $settings[self::DB_FOLLOW_TWITTER_CONSUMER_KEY] ) {
1151
+ $this->follow_twitter_consumer_key = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_TWITTER_CONSUMER_KEY], AUTH_KEY ) );
1152
  }
1153
 
1154
  if ( isset( $settings[self::DB_FOLLOW_TWITTER_CONSUMER_SECRET] ) && $settings[self::DB_FOLLOW_TWITTER_CONSUMER_SECRET] ) {
1155
+ $this->follow_twitter_consumer_secret = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_TWITTER_CONSUMER_SECRET], AUTH_KEY ) );
1156
  }
1157
 
1158
  if ( isset( $settings[self::DB_FOLLOW_TWITTER_BEARER_TOKEN] ) && $settings[self::DB_FOLLOW_TWITTER_BEARER_TOKEN] ) {
1159
+ $this->follow_twitter_bearer_token = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_TWITTER_BEARER_TOKEN], AUTH_KEY ) );
1160
  }
1161
 
1162
  /*
1163
  if ( isset( $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN] ) && $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN] ) {
1164
+ $this->follow_twitter_access_token = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN], AUTH_KEY ) );
1165
  }
1166
 
1167
  if ( isset( $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN_SECRET] ) && $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN_SECRET] ) {
1168
+ $this->follow_twitter_access_token_secret = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_TWITTER_ACCESS_TOKEN_SECRET], AUTH_KEY ) );
1169
  }
1170
  */
1171
 
1172
+ if ( isset( $settings[self::DB_SHARE_FACEBOOK_APP_ID] ) && $settings[self::DB_SHARE_FACEBOOK_APP_ID] ) {
1173
+ $this->share_facebook_app_id = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_SHARE_FACEBOOK_APP_ID], AUTH_KEY ) );
1174
+ }
1175
+
1176
+ if ( isset( $settings[self::DB_SHARE_FACEBOOK_APP_SECRET] ) && $settings[self::DB_SHARE_FACEBOOK_APP_SECRET] ) {
1177
+ $this->share_facebook_app_secret = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_SHARE_FACEBOOK_APP_SECRET], AUTH_KEY ) );
1178
+ }
1179
+
1180
+ if ( isset( $this->share_facebook_app_id ) && $this->share_facebook_app_id && isset( $this->share_facebook_app_secret ) && $this->share_facebook_app_secret ) {
1181
+ $this->share_facebook_access_token = $this->share_facebook_app_id . '|' . $this->share_facebook_app_secret;
1182
+ } else {
1183
+ $this->share_facebook_access_token = '';
1184
+ }
1185
+
1186
  if ( isset( $settings[self::DB_FOLLOW_FACEBOOK_PAGE_ID] ) && $settings[self::DB_FOLLOW_FACEBOOK_PAGE_ID] ) {
1187
  $this->follow_facebook_page_id = $settings[self::DB_FOLLOW_FACEBOOK_PAGE_ID];
1188
  }
1189
 
1190
  if ( isset( $settings[self::DB_FOLLOW_FACEBOOK_APP_ID] ) && $settings[self::DB_FOLLOW_FACEBOOK_APP_ID] ) {
1191
+ $this->follow_facebook_app_id = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_FACEBOOK_APP_ID], AUTH_KEY ) );
1192
  }
1193
 
1194
  if ( isset( $settings[self::DB_FOLLOW_FACEBOOK_APP_SECRET] ) && $settings[self::DB_FOLLOW_FACEBOOK_APP_SECRET] ) {
1195
+ $this->follow_facebook_app_secret = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_FACEBOOK_APP_SECRET], AUTH_KEY ) );
1196
  }
1197
 
1198
  if ( isset( $settings[self::DB_FOLLOW_FACEBOOK_ACCESS_TOKEN] ) && $settings[self::DB_FOLLOW_FACEBOOK_ACCESS_TOKEN] ) {
1199
+ $this->follow_facebook_access_token = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_FACEBOOK_ACCESS_TOKEN], AUTH_KEY ) );
1200
  }
1201
 
1202
  if ( isset( $settings[self::DB_FOLLOW_PUSH7_APPNO] ) && $settings[self::DB_FOLLOW_PUSH7_APPNO] ) {
1203
+ $this->follow_push7_appno = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_PUSH7_APPNO], AUTH_KEY ) );
1204
  }
1205
 
1206
  if ( isset( $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_ID] ) && $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_ID] ) {
1207
+ $this->follow_instagram_client_id = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_ID], AUTH_KEY ) );
1208
  }
1209
 
1210
  if ( isset( $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_SECRET] ) && $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_SECRET] ) {
1211
+ $this->follow_instagram_client_secret = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_INSTAGRAM_CLIENT_SECRET], AUTH_KEY ) );
1212
  }
1213
 
1214
  if ( isset( $settings[self::DB_FOLLOW_INSTAGRAM_ACCESS_TOKEN] ) && $settings[self::DB_FOLLOW_INSTAGRAM_ACCESS_TOKEN] ) {
1215
+ $this->follow_instagram_access_token = trim( SCC_Common_Util::decrypt_data( $settings[self::DB_FOLLOW_INSTAGRAM_ACCESS_TOKEN], AUTH_KEY ) );
1216
  }
1217
 
1218
  // Share Crawler
1224
  'ssl_verification' => $this->crawler_ssl_verification,
1225
  );
1226
 
1227
+ $this->crawlers[self::REF_SHARE] = SCC_Share_Crawler::get_instance();
1228
  $this->crawlers[self::REF_SHARE]->initialize( $options );
1229
 
1230
  // Share Twitter Crawl Strategy
1234
 
1235
  $this->crawlers[self::REF_SHARE]->initialize_crawl_strategy( self::REF_SHARE_TWITTER, $options );
1236
 
1237
+ // Share Facebook Crawl Strategy
1238
+ $parameters = array(
1239
+ 'app_id' => $this->follow_facebook_app_id,
1240
+ 'app_secret' => $this->follow_facebook_app_secret
1241
+ );
1242
+
1243
+ $query_parameters = array(
1244
+ 'access_token' => $this->share_facebook_access_token
1245
+ );
1246
+
1247
+ $this->crawlers[self::REF_SHARE]->set_crawl_strategy_query_parameters( self::REF_SHARE_FACEBOOK, $query_parameters );
1248
+ $this->crawlers[self::REF_SHARE]->set_crawl_strategy_parameters( self::REF_SHARE_FACEBOOK, $parameters );
1249
+
1250
  // Follow Crawler
1251
  $options = array(
1252
  'target_sns' => $this->follow_base_cache_target,
1256
  'ssl_verification' => $this->crawler_ssl_verification
1257
  );
1258
 
1259
+ $this->crawlers[self::REF_FOLLOW] = SCC_Follow_Crawler::get_instance();
1260
  $this->crawlers[self::REF_FOLLOW]->initialize( $options );
1261
 
1262
  // Follow Twitter Crawl Strategy
1336
  'post_types' => $this->share_base_cache_post_types,
1337
  'scheme_migration_mode' => $this->scheme_migration_mode,
1338
  'scheme_migration_date' => $this->scheme_migration_date,
1339
+ 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys,
1340
+ 'fault_tolerance' => $this->fault_tolerance_mode
1341
  );
1342
 
1343
+ $this->cache_engines[self::REF_SHARE_BASE] = SCC_Share_Base_Cache_Engine::get_instance();
1344
  $this->cache_engines[self::REF_SHARE_BASE]->initialize( $options );
1345
 
1346
  // Share rush cache engine
1349
  'crawler' => $this->crawlers[self::REF_SHARE],
1350
  'target_sns' => $this->share_base_cache_target,
1351
  'check_interval' => $this->share_rush_check_interval,
1352
+ 'posts_per_check' => $this->share_rush_posts_per_check,
1353
  'new_content_term' => $this->share_rush_new_content_term,
1354
  'post_types' => $this->share_base_cache_post_types,
1355
  'scheme_migration_mode' => $this->scheme_migration_mode,
1356
  'scheme_migration_date' => $this->scheme_migration_date,
1357
+ 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys,
1358
+ 'fault_tolerance' => $this->fault_tolerance_mode
1359
  );
1360
 
1361
+ $this->cache_engines[self::REF_SHARE_RUSH] = SCC_Share_Rush_Cache_Engine::get_instance();
1362
  $this->cache_engines[self::REF_SHARE_RUSH]->initialize( $options );
1363
 
1364
  // Share lazy cache engine
1371
  'post_types' => $this->share_base_cache_post_types,
1372
  'scheme_migration_mode' => $this->scheme_migration_mode,
1373
  'scheme_migration_date' => $this->scheme_migration_date,
1374
+ 'scheme_migration_exclude_keys' => $this->scheme_migration_exclude_keys,
1375
+ 'fault_tolerance' => $this->fault_tolerance_mode
1376
  );
1377
 
1378
+ $this->cache_engines[self::REF_SHARE_LAZY] = SCC_Share_Lazy_Cache_Engine::get_instance();
1379
  $this->cache_engines[self::REF_SHARE_LAZY]->initialize( $options );
1380
 
1381
  // Share second cache engine
1388
  'crawl_date_key' => self::REF_CRAWL_DATE
1389
  );
1390
 
1391
+ $this->cache_engines[self::REF_SHARE_2ND] = SCC_Share_Second_Cache_Engine::get_instance();
1392
  $this->cache_engines[self::REF_SHARE_2ND]->initialize( $options );
1393
 
1394
  // Share restore cache engine
1399
  'post_types' => $this->share_base_cache_post_types,
1400
  );
1401
 
1402
+ $this->cache_engines[self::REF_SHARE_RESTORE] = SCC_Share_Restore_Cache_Engine::get_instance();
1403
  $this->cache_engines[self::REF_SHARE_RESTORE]->initialize( $options );
1404
 
1405
  // Follow base cache engine
1413
  'feed_type' => $this->follow_feed_type
1414
  );
1415
 
1416
+ $this->cache_engines[self::REF_FOLLOW_BASE] = SCC_Follow_Base_Cache_Engine::get_instance();
1417
  $this->cache_engines[self::REF_FOLLOW_BASE]->initialize( $options );
1418
 
1419
  // Follow lazy cache engine
1427
  'feed_type' => $this->follow_feed_type
1428
  );
1429
 
1430
+ $this->cache_engines[self::REF_FOLLOW_LAZY] = SCC_Follow_Lazy_Cache_Engine::get_instance();
1431
  $this->cache_engines[self::REF_FOLLOW_LAZY]->initialize( $options );
1432
 
1433
  // Follow second cache engine
1438
  'cache_prefix' => self::OPT_FOLLOW_2ND_META_KEY_PREFIX
1439
  );
1440
 
1441
+ $this->cache_engines[self::REF_FOLLOW_2ND] = SCC_Follow_Second_Cache_Engine::get_instance();
1442
  $this->cache_engines[self::REF_FOLLOW_2ND]->initialize( $options );
1443
 
1444
  // Follow restore cache engine
1447
  'check_interval' => $this->follow_base_check_interval,
1448
  );
1449
 
1450
+ $this->cache_engines[self::REF_FOLLOW_RESTORE] = SCC_Follow_Restore_Cache_Engine::get_instance();
1451
  $this->cache_engines[self::REF_FOLLOW_RESTORE]->initialize( $options );
1452
 
1453
  // Data export engine
1461
  'post_types' => $this->share_base_cache_post_types
1462
  );
1463
 
1464
+ $this->export_engines[self::REF_COMMON_EXPORT] = SCC_Common_Data_Export_Engine::get_instance();
1465
  $this->export_engines[self::REF_COMMON_EXPORT]->initialize( $options );
1466
 
1467
  // Share analytical engine
1474
  'crawl_date_key' => self::REF_CRAWL_DATE
1475
  );
1476
 
1477
+ $this->analytical_engines[self::REF_SHARE_ANALYSIS] = SCC_Share_Analytical_Engine::get_instance();
1478
  $this->analytical_engines[self::REF_SHARE_ANALYSIS]->initialize( $options );
1479
 
1480
  // Job reset engine
1503
  'target_cron' => $target_crons
1504
  );
1505
 
1506
+ $this->control_engines[self::REF_COMMON_CONTROL] = SCC_Common_Job_Reset_Engine::get_instance();
1507
  $this->control_engines[self::REF_COMMON_CONTROL]->initialize( $options );
1508
 
1509
  $tmp_max_execution_time = ini_get( 'max_execution_time' );
1516
 
1517
  $this->loading_img_url = plugins_url( '/images/loading.gif', __FILE__ );
1518
 
 
 
 
 
 
1519
  }
1520
 
1521
  /**
1524
  * @since 0.1.0
1525
  */
1526
  public function register_admin_styles() {
1527
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1528
 
1529
  if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
1530
  return;
1545
  * @since 0.1.0
1546
  */
1547
  public function register_admin_scripts() {
1548
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1549
 
1550
  if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
1551
  return;
1556
  if ( in_array( $screen->id, $this->plugin_screen_hook_suffix ) ) {
1557
  wp_enqueue_script( self::DOMAIN . '-admin-script-1', plugins_url( ltrim( '/js/highlight.pack.js', '/' ) , __FILE__ ), array( 'jquery' ) );
1558
 
1559
+ wp_enqueue_script( self::DOMAIN . '-admin-script-2', plugins_url( ltrim( '/js/jquery.scc-cache-info.min.js', '/' ), __FILE__ ), array( 'jquery' ) );
1560
  wp_localize_script( self::DOMAIN . '-admin-script-2', 'scc', array( 'endpoint' => admin_url( 'admin-ajax.php' ), 'action' => $this->ajax_action, 'nonce' => wp_create_nonce( $this->ajax_action ) ) );
1561
 
1562
  wp_enqueue_script( 'jquery-ui-datepicker' );
1569
  * @since 0.1.1
1570
  */
1571
  public function activate_plugin() {
1572
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1573
 
1574
  $this->initialize();
1575
 
1610
  * @since 0.1.1
1611
  */
1612
  public function deactivate_plugin() {
1613
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1614
 
1615
  set_time_limit( $this->extended_max_execution_time );
1616
 
1619
  $cache_engine->clear_cache();
1620
  }
1621
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1622
  foreach ( $this->control_engines as $key => $control_engine ) {
1623
  $control_engine->unregister_schedule();
1624
  }
1637
  * @since 0.1.1
1638
  */
1639
  function reactivate_plugin() {
1640
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1641
 
1642
  $this->deactivate_plugin();
1643
  $this->activate_plugin();
1664
  * @since 0.1.0
1665
  */
1666
  public function register_admin_menu() {
1667
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1668
 
1669
  $this->plugin_screen_hook_suffix[] = 'dashboard';
1670
  $this->plugin_screen_hook_suffix[] = add_menu_page( __( 'SNS Count Cache', self::DOMAIN ), __( 'SNS Count Cache', self::DOMAIN ), self::OPT_COMMON_CAPABILITY, 'scc-dashboard', array( $this, 'dashboard_page' ), 'dashicons-share' );
1796
  * @since 0.2.0
1797
  */
1798
  private function retrieve_share_cache( $post_ID, $second_sync = false ) {
1799
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1800
  return $this->cache_engines[self::REF_SHARE_BASE]->direct_cache( $post_ID, $second_sync );
1801
  }
1802
 
1806
  * @since 0.2.0
1807
  */
1808
  private function retrieve_follow_cache( $second_sync = false ) {
1809
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1810
  return $this->cache_engines[self::REF_FOLLOW_BASE]->direct_cache( $second_sync );
1811
  }
1812
 
1816
  * @since 0.2.0
1817
  */
1818
  private function reserve_share_cache( $post_ID ) {
1819
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1820
  $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
1821
  }
1822
 
1826
  * @since 0.4.0
1827
  */
1828
  private function reserve_follow_cache() {
1829
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1830
  $this->cache_engines[self::REF_FOLLOW_LAZY]->prime_cache();
1831
  }
1832
 
1833
  /**
1834
  * Method call between one cache engine and another
1835
  *
1836
+ * @since 0.9.3
1837
  */
1838
+ public function order( SCC_Cache_Engine $engine, $order, $options = array() ) {
1839
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1840
 
1841
  switch ( get_class( $engine ) ) {
1842
+ case 'SCC_Share_Lazy_Cache_Engine':
1843
+ if ( $order === SCC_Order::ORDER_DO_SECOND_CACHE ) {
1844
+ $this->cache_engines[self::REF_SHARE_2ND]->cache( $options );
1845
+ } elseif ( $order === SCC_Order::ORDER_GET_SECOND_CACHE ) {
1846
+ return $this->get_second_cache( $options );
1847
+ }
1848
  break;
1849
+ case 'SCC_Share_Base_Cache_Engine':
1850
+ if ( $order === SCC_Order::ORDER_DO_SECOND_CACHE) {
1851
+ $this->cache_engines[self::REF_SHARE_2ND]->cache( $options );
1852
+ } elseif ( $order === SCC_Order::ORDER_GET_SECOND_CACHE ) {
1853
+ return $this->get_second_cache( $options );
1854
+ }
1855
  break;
1856
+ case 'SCC_Share_Second_Cache_Engine':
1857
+ if ( $order === SCC_Order::ORDER_DO_ANALYSIS ) {
1858
+ if ( $this->share_variation_analysis_mode !== self::OPT_SHARE_VARIATION_ANALYSIS_NONE ) {
1859
+ $this->analytical_engines[self::REF_SHARE_ANALYSIS]->analyze( $options );
1860
+ }
1861
+ }
1862
  break;
1863
+ case 'SCC_Share_Rush_Cache_Engine':
1864
+ if ( $order === SCC_Order::ORDER_DO_SECOND_CACHE) {
1865
+ $this->cache_engines[self::REF_SHARE_2ND]->cache( $options );
1866
+ } elseif ( $order === SCC_Order::ORDER_GET_SECOND_CACHE ) {
1867
+ return $this->get_second_cache( $options );
1868
+ }
1869
  break;
1870
+ case 'SCC_Follow_Lazy_Cache_Engine':
1871
+ if ( $order === SCC_Order::ORDER_DO_SECOND_CACHE) {
1872
+ $this->cache_engines[self::REF_FOLLOW_2ND]->cache( $options );
1873
+ }
1874
  break;
1875
+ case 'SCC_Follow_Base_Cache_Engine':
1876
+ if ( $order === SCC_Order::ORDER_DO_SECOND_CACHE) {
1877
+ $this->cache_engines[self::REF_FOLLOW_2ND]->cache( $options );
1878
+ }
1879
  break;
1880
  }
1881
  }
1882
 
1883
  /**
1884
+ * Return second cache
1885
  *
1886
+ * @since 0.9.3
1887
  */
1888
+ private function get_second_cache( $options = array() ) {
1889
+ $post_id = $options['post_id'];
1890
+ $sns_counts = array();
1891
 
1892
+ if ( $post_id !== 'home' ) {
1893
+ foreach ( $this->share_base_cache_target as $sns => $active ) {
1894
+ if ( $active ) {
1895
+ $meta_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( $sns );
1896
+ $sns_counts[$sns] = get_post_meta( $post_id, $meta_key, true );
1897
+ }
1898
  }
1899
+ } else {
1900
+ $option_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( 'home' );
1901
+ $sns_counts = get_option( $option_key );
1902
  }
1903
+ return $sns_counts;
1904
  }
1905
 
1906
  /**
1909
  * @since 0.4.0
1910
  */
1911
  private function pagination( $numpages = '', $pagerange = '', $paged='', $inherit_param = true ) {
1912
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1913
 
1914
  if ( empty( $pagerange ) ) {
1915
  $pagerange = 2;
1942
 
1943
  $base_url = $base_url . '?page=' . $query['page'];
1944
 
1945
+ SCC_Common_Util::log( '[' . __METHOD__ . '] base url: ' . $base_url );
1946
 
1947
  $pagination_args = array(
1948
  'base' => $base_url . '%_%',
1963
  $paginate_links = paginate_links( $pagination_args );
1964
 
1965
  if ( $inherit_param ) {
1966
+ SCC_Common_Util::log( '[' . __METHOD__ . '] inherit param: true' );
1967
  } else {
1968
+ SCC_Common_Util::log( '[' . __METHOD__ . '] inherit param: false' );
1969
 
1970
  $pattern = '/(?:&#038;action=cache&#038;post_id=[0-9]+&#038;_wpnonce=.{10})/';
1971
  $paginate_links = preg_replace( $pattern, '', $paginate_links );
1985
  * @since 0.5.1
1986
  */
1987
  public function get_cache_info() {
1988
+ SCC_Common_Util::log( '[' . __METHOD__ . '] (line='. __LINE__ . ')' );
1989
 
1990
  if ( isset( $_REQUEST['nonce'] ) && wp_verify_nonce( $_REQUEST['nonce'], $this->ajax_action ) ) {
1991
  if ( current_user_can( self::OPT_COMMON_CAPABILITY ) ) {
2427
  $return['follow']['secondary']['cache_status'] = __( 'Ongoing', self::DOMAIN );
2428
  }
2429
 
2430
+ SCC_Common_Util::log( $return );
2431
 
2432
  $callback = $_REQUEST["callback"];
2433
 
2474
  return $sns_counts;
2475
  }
2476
  } else {
2477
+ if ( $sns_key ) {
2478
+ if ( $post_ID !== 'home' ) {
2479
+ $meta_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( $sns_key );
2480
+ $sns_count = get_post_meta( $post_ID, $meta_key, true );
 
 
 
 
2481
 
2482
+ $second_cache_flag = false;
 
 
 
 
 
 
 
 
 
2483
 
2484
+ if ( isset( $sns_count ) && $sns_count !== '' ) {
2485
+ if ( $sns_count >= 0 ) {
2486
+ $sns_counts[$sns_key] = $sns_count;
2487
+ $second_cache_flag = true;
 
2488
  } else {
2489
+ $sns_counts[$sns_key] = 0;
2490
+ }
2491
+ } else {
2492
+ $sns_counts[$sns_key] = 0;
2493
+ }
2494
 
2495
+ if ( $second_cache_flag ) {
2496
+ $this->cache_engines[self::REF_SHARE_RESTORE]->prime_cache( $post_ID );
2497
+ } else {
2498
+ if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_CACHE_ON ) {
2499
+ $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
2500
+ }
2501
+ }
2502
+ } else {
2503
+ $option_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( 'home' );
2504
 
2505
+ $second_cache_flag = false;
 
 
 
 
 
 
 
 
2506
 
2507
+ if ( false !== ( $sns_counts = get_option( $option_key ) ) ) {
2508
+ if ( ! isset( $sns_counts[$sns_key] ) || $sns_counts[$sns_key] < 0 ) {
2509
+ $sns_counts[$sns_key] = 0;
2510
+ } else {
2511
+ $second_cache_flag = true;
2512
  }
 
 
2513
  } else {
2514
+ $sns_counts[$sns_key] = 0;
2515
+ }
 
2516
 
2517
+ if ( $second_cache_flag ) {
2518
+ $this->cache_engines[self::REF_SHARE_RESTORE]->prime_cache( $post_ID );
2519
+ } else {
2520
+ if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_CACHE_ON ) {
2521
+ $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
2522
+ }
2523
+ }
2524
+ }
2525
 
2526
+ return $sns_counts[$sns_key];
2527
+ } else {
2528
+ if ( $post_ID !== 'home' ) {
2529
 
2530
+ $second_cache_flag = false;
 
 
 
 
 
 
 
 
 
 
 
2531
 
2532
+ foreach ( $this->share_base_cache_target as $sns => $active ) {
2533
+ if ( $active ) {
2534
+ $meta_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( $sns );
 
 
 
 
2535
 
2536
+ $sns_count = get_post_meta( $post_ID, $meta_key, true );
2537
 
2538
+ if ( isset( $sns_count ) && $sns_count !== '' ) {
2539
+ if ( $sns_count >= 0 ) {
2540
+ $sns_counts[$sns] = $sns_count;
2541
+ $second_cache_flag = true;
2542
+ } else {
2543
+ $sns_counts[$sns] = 0;
 
 
 
 
 
 
 
 
 
2544
  }
 
 
 
 
2545
  } else {
2546
+ $sns_counts[$sns] = 0;
2547
  }
2548
  }
 
2549
  }
 
 
 
2550
 
2551
+ if ( $second_cache_flag ) {
2552
+ $this->cache_engines[self::REF_SHARE_RESTORE]->prime_cache( $post_ID );
 
2553
  } else {
2554
+ if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_CACHE_ON ) {
2555
+ $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
 
 
2556
  }
 
2557
  }
2558
+ } else {
2559
+ $option_key = $this->cache_engines[self::REF_SHARE_2ND]->get_cache_key( 'home' );
 
2560
 
2561
+ $second_cache_flag = false;
2562
+
2563
+ if ( false !== ( $sns_counts = get_option( $option_key ) ) ) {
 
 
 
2564
  foreach ( $this->share_base_cache_target as $sns => $active ) {
2565
  if ( $active ) {
2566
  if ( ! isset( $sns_counts[$sns] ) || $sns_counts[$sns] < 0 ) {
2567
  $sns_counts[$sns] = 0;
2568
+ } else {
2569
+ $second_cache_flag = true;
2570
  }
2571
  }
2572
  }
 
 
 
 
 
 
 
2573
  } else {
2574
  foreach ( $this->share_base_cache_target as $sns => $active ) {
2575
  if ( $active ) {
2576
  $sns_counts[$sns] = 0;
2577
  }
2578
  }
 
2579
  }
2580
+
2581
+ if ( $second_cache_flag ) {
2582
+ $this->cache_engines[self::REF_SHARE_RESTORE]->prime_cache( $post_ID );
2583
+ } else {
2584
+ if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_CACHE_ON ) {
2585
+ $this->cache_engines[self::REF_SHARE_LAZY]->prime_cache( $post_ID );
2586
+ }
2587
+ }
2588
+ }
2589
+ return $sns_counts;
2590
  }
2591
  }
2592
  }
2618
  return $sns_followers;
2619
  }
2620
  } else {
2621
+ $option_key = $this->cache_engines[self::REF_FOLLOW_2ND]->get_cache_key( 'follow' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2622
 
2623
+ if ( $sns_key ) {
2624
+ $second_cache_flag = false;
 
 
 
2625
 
2626
+ if ( false !== ( $sns_followers = get_option( $option_key ) ) ) {
2627
+ if ( ! isset( $sns_followers[$sns_key] ) || $sns_followers[$sns_key] < 0 ) {
2628
+ $sns_followers[$sns_key] = 0;
2629
  } else {
2630
+ $second_cache_flag = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2631
  }
2632
+ } else {
2633
+ $sns_followers[$sns_key] = 0;
2634
+ }
2635
+
2636
+ if ( $second_cache_flag ) {
2637
+ $this->cache_engines[self::REF_FOLLOW_RESTORE]->prime_cache();
2638
+ } else {
2639
  $this->cache_engines[self::REF_FOLLOW_LAZY]->prime_cache();
2640
+ }
2641
 
2642
+ return $sns_followers[$sns_key];
2643
+ } else {
2644
+ $second_cache_flag = false;
2645
+
2646
+ if ( false !== ( $sns_followers = get_option( $option_key ) ) ) {
2647
+ foreach ( $this->follow_base_cache_target as $sns => $active ) {
2648
+ if ( $active ) {
2649
+ if ( ! isset( $sns_followers[$sns] ) || $sns_followers[$sns] < 0 ) {
2650
  $sns_followers[$sns] = 0;
2651
+ } else {
2652
+ $second_cache_flag = true;
2653
  }
2654
  }
 
2655
  }
2656
+ } else {
2657
+ foreach ( $this->follow_base_cache_target as $sns => $active ) {
2658
+ if ( $active ) {
2659
+ $sns_followers[$sns] = 0;
 
 
 
 
 
 
 
 
 
 
 
 
2660
  }
 
2661
  }
2662
+ }
2663
+
2664
+ if ( $second_cache_flag ) {
2665
+ $this->cache_engines[self::REF_FOLLOW_RESTORE]->prime_cache();
2666
+ } else {
2667
+ if ( $this->dynamic_cache_mode === self::OPT_COMMON_ACCESS_BASED_CACHE_ON ) {
2668
+ $this->cache_engines[self::REF_FOLLOW_LAZY]->prime_cache();
 
 
 
 
 
2669
  }
2670
+ }
2671
+
2672
+ return $sns_followers;
2673
  }
2674
  }
2675
  }
2694
  */
2695
  private function test_cron_capability() {
2696
 
2697
+ if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
2698
  return true;
2699
+ }
2700
 
2701
  $doing_wp_cron = sprintf( '%.22F', microtime( true ) );
2702
 
2817
  return scc_get_share( $options );
2818
  }
2819
 
2820
+ /**
2821
+ * Get share count from cache (Pinterest)
2822
+ *
2823
+ * @since 0.9.3
2824
+ */
2825
+ function scc_get_share_pinterest( $options = array( 'post_id' => '', 'url' => '' ) ) {
2826
+ $options['sns'] = SNS_Count_Cache::REF_SHARE_PINTEREST;
2827
+ return scc_get_share( $options );
2828
+ }
2829
+
2830
  /**
2831
  * Get share count from cache (Pocket)
2832
  *