Pz-LinkCard - Version 1.7.3

Version Description

  • Fixed: Fixed a bug that domain-name disappears.

*

Download this release

Release Info

Developer poporon
Plugin Icon 128x128 Pz-LinkCard
Version 1.7.3
Comparing to
See all releases

Code changes from version 1.7.1 to 1.7.3

pz-linkcard-cacheman.php → lib/pz-linkcard-cacheman.php RENAMED
@@ -284,7 +284,7 @@ echo '</div>';
284
  <th class="hb" style="width: 2em;"><?php echo_THC('sns_hatena', __('B!', $this->text_domain) ); ?></th>
285
  <th class="regist" style="width: 5em;"><?php echo_THC('regist', __('Regist', $this->text_domain) ); ?></th>
286
  <th class="postid" style="width: 3em;"><?php echo_THC('post_id', __('Post ID', $this->text_domain) ); ?></th>
287
- <th class="result" style="width: 2em;"><?php echo_THC('result_code', __('Result code', $this->text_domain) ); ?><br><?php echo_THC('alive_result', __('(last)', $this->text_domain) ); ?></th>
288
  </tr>
289
  </thead>
290
  <tbody>
284
  <th class="hb" style="width: 2em;"><?php echo_THC('sns_hatena', __('B!', $this->text_domain) ); ?></th>
285
  <th class="regist" style="width: 5em;"><?php echo_THC('regist', __('Regist', $this->text_domain) ); ?></th>
286
  <th class="postid" style="width: 3em;"><?php echo_THC('post_id', __('Post ID', $this->text_domain) ); ?></th>
287
+ <th class="result" style="width: 2.5em;"><?php echo_THC('result_code', __('Result code', $this->text_domain) ); ?><br><?php echo_THC('alive_result', __('(last)', $this->text_domain) ); ?></th>
288
  </tr>
289
  </thead>
290
  <tbody>
lib/pz-linkcard-cron-alive.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die;
3
+
lib/pz-linkcard-cron-sns.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || die;
3
+
pz-linkcard-edit.php → lib/pz-linkcard-edit.php RENAMED
File without changes
pz-linkcard-settings.php → lib/pz-linkcard-settings.php RENAMED
@@ -7,6 +7,14 @@
7
  if ( isset($_POST['properties'])) {
8
  check_admin_referer('pz_options');
9
  $this->options = $_POST['properties'];
 
 
 
 
 
 
 
 
10
  if (isset($this->options['initialize']) && $this->options['initialize'] == '1') {
11
  delete_option('Pz_LinkCard_options');
12
  $this->options = $this->defaults;
@@ -70,7 +78,7 @@
70
  } else {
71
  echo '<div class="error fade"><p><strong>'.__('Not changed.', $this->text_domain).'</strong></p></div>';
72
  }
73
- require_once ('pz-linkcard-style.php');
74
  }
75
  }
76
  // if ((isset($this->options['sns-position']) ? $this->options['sns-position'] : null) && (isset($this->options['sns-tw']) ? $this->options['sns-tw'] : null)) {
7
  if ( isset($_POST['properties'])) {
8
  check_admin_referer('pz_options');
9
  $this->options = $_POST['properties'];
10
+
11
+ // �Z�b�g����Ă��Ȃ��I�v�V�������ڂ�null�ŃZ�b�g����
12
+ foreach ($this->defaults as $key => $value) {
13
+ if (!isset($this->options[$key])) {
14
+ $this->options[$key] = null;
15
+ }
16
+ }
17
+
18
  if (isset($this->options['initialize']) && $this->options['initialize'] == '1') {
19
  delete_option('Pz_LinkCard_options');
20
  $this->options = $this->defaults;
78
  } else {
79
  echo '<div class="error fade"><p><strong>'.__('Not changed.', $this->text_domain).'</strong></p></div>';
80
  }
81
+ $this->pz_SetStyle();
82
  }
83
  }
84
  // if ((isset($this->options['sns-position']) ? $this->options['sns-position'] : null) && (isset($this->options['sns-tw']) ? $this->options['sns-tw'] : null)) {
pz-linkcard-style.php → lib/pz-linkcard-style.php RENAMED
@@ -17,10 +17,10 @@
17
  if (is_null($this->options['css-path']) || is_null($this->options['css-url']) || $this->options['css-path'] <> $css_path || $this->options['css-url'] <> $css_url) {
18
  $this->options['css-path'] = $css_path;
19
  $this->options['css-url'] = $css_url;
20
- update_option('Pz_LinkCard_options', $this->options);
21
  }
22
 
23
- $temp_name = $this->plugin_dir_path.'pz-linkcard-templete.css'; // 元となるテンプレート
24
 
25
  $file_text = file_get_contents($temp_name);
26
  if ($file_text) {
@@ -285,7 +285,10 @@
285
 
286
  // サムネイルのリサイズ
287
  if (isset($this->options['thumbnail-resize']) && $this->options['thumbnail-resize'] == '1') {
288
- $file_text = str_replace('/*RESIZE*/', '@media screen and (max-width: 1024px) {'.PHP_EOL.'.lkc-thumbnail {'.PHP_EOL.'max-width: 70px;'.PHP_EOL.'max-height: 70px;'.PHP_EOL.'}'.PHP_EOL.'.lkc-thumbnail-img {'.PHP_EOL.'max-width: 70px;'.PHP_EOL.'max-height: 70px;'.PHP_EOL.'}'.PHP_EOL.'}'.PHP_EOL.'@media screen and (max-width: 640px) {'.PHP_EOL.'.lkc-thumbnail {'.PHP_EOL.'max-width: 60px;'.PHP_EOL.'max-height: 60px;'.PHP_EOL.'}'.PHP_EOL.'.lkc-thumbnail-img {'.PHP_EOL.'max-width: 60px;'.PHP_EOL.'max-height: 60px;'.PHP_EOL.'}'.PHP_EOL.'}'.PHP_EOL.'@media screen and (max-width: 480px) {'.PHP_EOL.'.lkc-thumbnail {'.PHP_EOL.'max-width: 50px;'.PHP_EOL.'max-height: 50px;'.PHP_EOL.'}'.PHP_EOL.'.lkc-thumbnail-img {'.PHP_EOL.'max-width: 50px;'.PHP_EOL.'max-height: 50px;'.PHP_EOL.'}'.PHP_EOL.'}',$file_text );
 
 
 
289
  }
290
 
291
  // 横幅
17
  if (is_null($this->options['css-path']) || is_null($this->options['css-url']) || $this->options['css-path'] <> $css_path || $this->options['css-url'] <> $css_url) {
18
  $this->options['css-path'] = $css_path;
19
  $this->options['css-url'] = $css_url;
20
+ update_site_option('Pz_LinkCard_options', $this->options);
21
  }
22
 
23
+ $temp_name = $this->plugin_dir_path.'templete/pz-linkcard-templete.css'; // 元となるテンプレート
24
 
25
  $file_text = file_get_contents($temp_name);
26
  if ($file_text) {
285
 
286
  // サムネイルのリサイズ
287
  if (isset($this->options['thumbnail-resize']) && $this->options['thumbnail-resize'] == '1') {
288
+ $file_text = str_replace('/*RESIZE*/',
289
+ '@media screen and (max-width: 1024px) {'.PHP_EOL.'.lkc-title {'.PHP_EOL.'font-size: 90%;'.PHP_EOL.'line-height: 90%;'.PHP_EOL.'}'.PHP_EOL.'.lkc-excerpt {'.PHP_EOL.'font-size: 80%;'.PHP_EOL.'}'.PHP_EOL.'.lkc-thumbnail {'.PHP_EOL.'max-width: 70px;'.PHP_EOL.'max-height: 70px;'.PHP_EOL.'}'.PHP_EOL.'.lkc-thumbnail-img {'.PHP_EOL.'max-width: 70px;'.PHP_EOL.'max-height: 70px;'.PHP_EOL.'}'.PHP_EOL.'}'.PHP_EOL.
290
+ '@media screen and (max-width: 640px) {'.PHP_EOL.'.lkc-title {'.PHP_EOL.'font-size: 80%;'.PHP_EOL.'line-height: 80%;'.PHP_EOL.'}'.PHP_EOL.'.lkc-excerpt {'.PHP_EOL.'font-size: 65%;'.PHP_EOL.'}'.PHP_EOL.'.lkc-thumbnail {'.PHP_EOL.'max-width: 60px;'.PHP_EOL.'max-height: 60px;'.PHP_EOL.'}'.PHP_EOL.'.lkc-thumbnail-img {'.PHP_EOL.'max-width: 60px;'.PHP_EOL.'max-height: 60px;'.PHP_EOL.'}'.PHP_EOL.'}'.PHP_EOL.
291
+ '@media screen and (max-width: 480px) {'.PHP_EOL.'.lkc-title {'.PHP_EOL.'font-size: 70%;'.PHP_EOL.'line-height: 70%;'.PHP_EOL.'}'.PHP_EOL.'.lkc-excerpt {'.PHP_EOL.'font-size: 50%;'.PHP_EOL.'}'.PHP_EOL.'.lkc-thumbnail {'.PHP_EOL.'max-width: 50px;'.PHP_EOL.'max-height: 50px;'.PHP_EOL.'}'.PHP_EOL.'.lkc-thumbnail-img {'.PHP_EOL.'max-width: 50px;'.PHP_EOL.'max-height: 50px;'.PHP_EOL.'}'.PHP_EOL.'}',$file_text );
292
  }
293
 
294
  // 横幅
pz-linkcard.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Pz-LinkCard
4
  Plugin URI: http://poporon.poponet.jp/pz-linkcard
5
  Description: リンクをカード形式で表示します。
6
- Version: 1.7.1
7
  Author: poporon
8
  Author URI: http://poporon.poponet.jp
9
  License: GPLv2 or later
@@ -61,19 +61,19 @@ class Pz_LinkCard {
61
  'size-excerpt' => '11px',
62
  'size-info' => '12px',
63
  'size-plugin' => '9px',
64
- 'color-title' => '#111111',
65
- 'color-url' => '#4466ff',
66
- 'color-excerpt' => '#333333',
67
- 'color-info' => '#222222',
68
- 'color-plugin' => '#888888',
69
- 'outline-color-title' => '#ffffff',
70
- 'outline-color-url' => '#ffffff',
71
- 'outline-color-excerpt' => '#ffffff',
72
- 'outline-color-info' => '#ffffff',
73
- 'outline-color-plugin' => '#ffffff',
74
- 'ex-bgcolor' => '#fff',
75
- 'in-bgcolor' => '#fff',
76
- 'th-bgcolor' => '#eee',
77
  'in-get' => null,
78
  'ex-image' => '',
79
  'in-image' => '',
@@ -112,7 +112,7 @@ class Pz_LinkCard {
112
  'presence' => null,
113
  'plugin-link' => null,
114
  'plugin-name' => 'Pz-LinkCard',
115
- 'plugin-version' => '1.7.1',
116
  'plugin-url' => 'http://poporon.poponet.jp/pz-linkcard',
117
  'pz-hbc-options' => null,
118
  'debug-time' => null
@@ -121,34 +121,34 @@ class Pz_LinkCard {
121
  public function __construct() {
122
  $this->slug = basename(dirname(__FILE__));
123
  $this->text_domain = $this->slug;
124
-
125
  $this->charset = get_bloginfo('charset');
126
-
127
  $this->plugin_basename = plugin_basename(__FILE__);
128
  $this->plugin_dir_path = plugin_dir_path(__FILE__);
129
  $this->plugin_dir_url = plugin_dir_url (__FILE__);
130
-
131
  $this->options = get_option('Pz_LinkCard_options', $this->defaults );
132
  foreach ($this->defaults as $key => $value) {
133
  if (!isset($this->options[$key])) {
134
  $this->options[$key] = null;
135
  }
136
  }
137
-
138
  // DB
139
  global $wpdb;
140
  $this->db_name = $wpdb->prefix.'pz_linkcard';
141
-
142
  // バージョンが違っていたら、DBとオプションを更新する
143
  if ($this->options['plugin-version'] <> $this->defaults['plugin-version']) {
144
  $this->activation();
145
  }
146
-
147
  // CSS URLが空だったら生成
148
  if (isset($this->options['style']) && isset($this->options['style']) == '1' && !isset($this->options['css-url'])) {
149
- require_once ('pz-linkcard-style.php');
150
  }
151
-
152
  // ショートコードの設定
153
  if ($this->options['code1'] <> '') {
154
  add_shortcode($this->options['code1'], array($this, 'shortcode'));
@@ -162,7 +162,7 @@ class Pz_LinkCard {
162
  if ($this->options['code4'] <> '') {
163
  add_shortcode($this->options['code4'], array($this, 'shortcode'));
164
  }
165
-
166
  // 管理画面のとき
167
  if (is_admin()) {
168
  load_plugin_textdomain ($this->text_domain, false, $this->slug.'/languages'); // 管理画面のみ日本語化
@@ -171,65 +171,65 @@ class Pz_LinkCard {
171
  add_action ('admin_menu', array($this, 'add_menu')); // 設定メニュー
172
  add_action ('admin_enqueue_scripts', array($this, 'enqueue_admin')); // 設定メニュー用スクリプト
173
  add_filter ('plugin_action_links_'.$this->plugin_basename, array($this, 'action_links')); // プラグイン画面
174
-
175
  if ((isset($this->options['style']) ? $this->options['style'] : '') == '') {
176
  if (is_null($this->options['css-path']) || !file_exists($this->options['css-path'])) {
177
- require_once ('pz-linkcard-style.php');
178
  }
179
  }
180
  } else {
181
  if (!isset($this->options['style'])) {
182
  if (!isset($this->options['css-url'])) {
183
- require_once ('pz-linkcard-style.php');
184
  }
185
  }
186
  add_action('wp_enqueue_scripts', array($this, 'enqueue'));
187
  }
188
 
189
- add_action('pz_linkcard_check', array($this, 'schedule_hook_sns'));
190
- // add_action('pz_linkcard_alive', array($this, 'schedule_hook_alive'));
191
 
192
  if (!wp_next_scheduled('pz_linkcard_check')) {
193
- wp_schedule_event( time(), 'hourly', 'pz_linkcard_check');
194
- wp_schedule_single_event( time() + 15, 'pz_linkcard_check');
 
 
 
 
195
  }
196
- // if (!wp_next_scheduled('pz_linkcard_alive')) {
197
- // wp_schedule_event( time(), 'hourly', 'pz_linkcard_alive');
198
- // wp_schedule_single_event( time() + 10, 'pz_linkcard_alive');
199
- // }
200
  }
201
 
202
  // ショートコード処理
203
  public function shortcode($atts, $content = null, $shortcode) {
204
- // 時間計測
205
- if (is_user_logged_in()) {
206
  $start_time = microtime(true);
207
  }
208
 
209
  // URL
210
- $url = isset($atts['url']) ? $this->pz_TrimURL($atts['url']) : null;
211
  // 密かに記述ミス対応(URIでもUR1でもURLとして判定する)
212
- if (is_null($url)) {
213
- $url = isset($atts['ur1']) ? $this->pz_TrimURL($atts['ur1']) : null;
214
- if (is_null($url)) {
215
- $url = isset($atts['uri']) ? $this->pz_TrimURL($atts['uri']) : null;
216
  }
217
  $atts['url'] = $url;
218
  }
219
- if (is_null($url)) {
220
  return 'Pz-LinkCard: URLの指定が誤っています';
221
  }
222
 
223
  // パラメータ
224
- $s_title = isset($atts['title']) ? $atts['title'] : null;
225
- if (isset($atts['content'])) {
226
- $s_excerpt = $atts['content'];
227
- } elseif (isset($atts['contents'])) {
228
- $s_excerpt = $atts['contents'];
229
- } elseif (isset($atts['description'])) {
230
- $s_excerpt = $atts['description'];
231
  } else {
232
- $s_excerpt = null;
233
  }
234
 
235
  // 囲まれ文字(ショートコード1のみ有効)
@@ -247,21 +247,17 @@ class Pz_LinkCard {
247
  // 記事内容取得
248
  $data = $this->pz_GetHTML ( $atts );
249
 
 
 
 
 
 
 
 
250
  return $data;
251
  }
252
 
253
- // $data['domain'] = $domain;
254
- // $data['thumbnail'] = $thumbnail_url;
255
- // $data['favicon'] = $favicon_url;
256
- // $data['sns_twitter'] = $sns_tw;
257
- // $data['sns_facebook'] = $sns_fb;
258
- // $data['sns_hatena'] = $sns_hb;
259
- // $data['uptime'] = $uptime;
260
- // $data['nexttime'] = $nexttime;
261
- // $data['alive_time'] = $alive_time;
262
- // $data['alive_result'] = $alive_result;
263
-
264
-
265
  function pz_GetHTML($atts, $content = null) {
266
  $url = $this->pz_TrimURL( $atts['url'] );
267
  if (!isset($url) || $url == '' ) {
@@ -472,7 +468,7 @@ class Pz_LinkCard {
472
  // 更新あり
473
  if ( $update ) {
474
  $data = $this->pz_SetCache( $data );
475
- //wp_schedule_single_event(time() + 10, 'pz_linkcard_check');
476
 
477
  if (isset($data['id'])) {
478
  $update = false;
@@ -480,7 +476,7 @@ class Pz_LinkCard {
480
  }
481
 
482
  // サムネイル取得
483
- if ( !$this->options['thumbnail-position'] || $result_code <> 200) {
484
  $thumbnail = null;
485
  } else {
486
  if ($sw_thumbnail == '3') {
@@ -583,23 +579,25 @@ class Pz_LinkCard {
583
  $a_cl_all = '';
584
  }
585
 
586
- // ソーシャルカウント(class="no_icon"は他プラグインの対応)
587
  $sns = null;
588
  $sns_info = null;
589
  $sns_title = null;
590
  if ( isset($this->options['sns-position']) ? $this->options['sns-position'] : null ) {
591
  $sns = '<span class="lkc-share">';
 
592
  if ((isset($this->options['link-all']) ? $this->options['link-all'] : null) == '1') {
593
  if (isset($this->options['sns-tw']) && !is_null($this->options['sns-tw']) && $sns_tw > 0) {
594
- $sns .= ' <span class="lkc-sns-tw no_icon">'.$sns_tw.'&nbsp;tweet'.(($sns_tw > 1) ? 's' : '').'</span>';
595
  }
596
  if (isset($this->options['sns-fb']) && !is_null($this->options['sns-fb']) && $sns_fb > 0) {
597
- $sns .= ' <span class="lkc-sns-fb no_icon">'.$sns_fb.'&nbsp;share'.(($sns_fb > 1) ? 's' : '').'</span>';
598
  }
599
  if (isset($this->options['sns-hb']) && !is_null($this->options['sns-hb']) && $sns_hb > 0) {
600
- $sns .= ' <span class="lkc-sns-hb no_icon">'.$sns_hb.'&nbsp;user'.(($sns_hb > 1) ? 's' : '').'</span>';
601
  }
602
  } else {
 
603
  if (isset($this->options['sns-tw']) && !is_null($this->options['sns-tw']) && $sns_tw > 0) {
604
  $sns .= ' <a class="lkc-sns-tw no_icon" href="https://twitter.com/intent/tweet?url=' .rawurlencode($url).'&text='.esc_html($title).'" target="_blank">'.$sns_tw.'&nbsp;tweet'.(($sns_tw > 1) ? 's' : '').'</a>';
605
  }
@@ -648,14 +646,6 @@ class Pz_LinkCard {
648
  $tag = '<div class="'.$class_id.'">'.$tag.'</div>';
649
  }
650
 
651
- // 実行時間
652
- if (is_user_logged_in()) {
653
- if (isset($this->options['debug-time'])) {
654
- $end_time = microtime(true);
655
- $elasped_time = number_format($end_time - $start_time, 8, '.', ',');
656
- $tag = PHP_EOL.'<!-- Pz-LkC -->'.PHP_EOL.$tag.PHP_EOL.'<!-- /Pz-LkC ('.$elasped_time.'sec) -->'.PHP_EOL;
657
- }
658
- }
659
  return $tag;
660
  }
661
 
@@ -900,41 +890,50 @@ class Pz_LinkCard {
900
  $charset = null;
901
  $result_code = null;
902
 
903
- $data['id'] = null;
904
- $data['url_key'] = null;
905
- $data['site_name'] = null;
906
- $data['title'] = null;
907
- $data['excerpt'] = null;
908
- $data['charset'] = null;
909
- $data['thumbnail'] = null;
910
- $data['favicon'] = null;
911
- $data['result_code'] = null;
912
- $data['post_id'] = get_the_ID();
913
- $data['sns_twitter'] = -1;
914
- $data['sns_facebook'] = -1;
915
- $data['sns_hatena'] = -1;
916
- $data['uptime'] = null;
917
- $data['nexttime'] = 0;
918
- $data['alive_time'] = 0;
919
- $data['alive_result'] = 0;
920
-
921
- if (function_exists('curl_init')) { // cURLを使用する
922
- $result_code = 0;
923
- $ch = curl_init($url);
924
- curl_setopt($ch, CURLOPT_TIMEOUT, 8);
925
- curl_setopt($ch, CURLOPT_USERAGENT, esc_html($_SERVER['HTTP_USER_AGENT']));
926
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
927
- curl_setopt($ch, CURLOPT_MAXREDIRS, 8);
928
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
929
- if (isset($this->options['flg-ssl']) ? $this->options['flg-ssl'] : null) {
930
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // SSL検証なし
931
  } else {
932
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); // SSL検証あり
 
933
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
934
  $html = curl_exec($ch);
935
- if (curl_errno($ch)) {
 
936
  $html = ''; // cURLエラー
937
- $result_code = 0 - intval(curl_errno($ch));
 
938
  } else {
939
  $header = curl_getinfo($ch);
940
  $result_code = $header['http_code']; // HTTPステータス
@@ -942,18 +941,19 @@ class Pz_LinkCard {
942
  }
943
  curl_close($ch);
944
  } else { // cURLを使用しない
945
- $result = wp_remote_get($url);
946
- if (!is_wp_error($result)) {
 
 
 
 
947
  $html = $result['body'];
948
  $result_code = $result['response']['code']; // HTTPステータス
949
  $error = false;
950
- } else {
951
- $html = '';
952
- $result_code = -1; // wp_remote_getエラー
953
  }
954
  }
955
 
956
- // 文字コード判定
957
  $charset = null;
958
  if ($html <> '') {
959
  if (preg_match('/charset\s*=\s*([^>\/\s]*).*<\/head/si', $html, $m)) {
@@ -997,10 +997,12 @@ class Pz_LinkCard {
997
  }
998
 
999
  // // OGPから画像URL取得
1000
- // if ($sw_thumbnail == '1' && isset($tags['og:image'])) {
1001
- // $thumbnail_url = $tags['og:image'];
1002
- // $thumbnail = '<img class="lkc-thumbnail-img" src="'.$thumbnail_url.'" alt="" />';
1003
- // }
 
 
1004
 
1005
  // サイト名
1006
  if (isset( $tags['og:site_name'] ) && $tags['og:site_name'] ) {
@@ -1014,17 +1016,21 @@ class Pz_LinkCard {
1014
  if (isset($url_key) && !is_null($url_key)) {
1015
  $data['url_key'] = $url_key;
1016
  }
1017
- $data['url'] = $url;
1018
  $data['site_name'] = $site_name;
1019
  $data['title'] = $title;
1020
  $data['excerpt'] = $excerpt;
1021
  $data['charset'] = $charset;
1022
- $data['result_code'] = $result_code;
1023
  if (isset($atts['force']) && $atts['force'] == true) {
1024
  $data['regist'] = current_time('mysql'); // 登録日
1025
  }
1026
  }
1027
- return $data;
 
 
 
 
 
 
1028
  }
1029
 
1030
  // 管理画面時のスタイルシート、スクリプト設定
@@ -1046,12 +1052,12 @@ class Pz_LinkCard {
1046
 
1047
  // 管理画面のサブメニュー追加
1048
  public function add_menu() {
1049
- add_management_page (__('LinkCard cache manager', $this->text_domain),__('Pz LkC Cache', $this->text_domain),'manage_options', 'pz-linkcard-cache', array($this, 'page_cacheman') );
1050
- add_options_page (__('LinkCard Settings', $this->text_domain),__('Pz LinkCard', $this->text_domain),'manage_options', 'pz-linkcard-settings', array($this, 'page_settings') );
1051
  }
1052
 
1053
  // WP-CRONスケジュール(SNSカウント取得)
1054
- public function schedule_hook_sns() {
1055
  if (!isset($this->options['sns-position']) || $this->options['sns-position'] == '') {
1056
  return null;
1057
  }
@@ -1064,7 +1070,7 @@ class Pz_LinkCard {
1064
  foreach($result as $data) {
1065
  $i++;
1066
  if ($i > 10) {
1067
- // wp_schedule_single_event(time() + 30, 'pz_linkcard_check');
1068
  break;
1069
  }
1070
  if (isset($data) && isset($data->url)) {
@@ -1082,84 +1088,95 @@ class Pz_LinkCard {
1082
 
1083
  global $wpdb;
1084
  $now = current_time('timestamp');
1085
-
1086
  $result = (array) $wpdb->get_results($wpdb->prepare("SELECT url,alive_time FROM $this->db_name WHERE alive_time<%d ORDER BY alive_time ASC", $now));
1087
-
1088
  $i = 0;
1089
- if (isset($result) && is_array($result) && count($result) > 0) {
1090
- foreach($result as $check_data) {
1091
- $i++;
1092
- if ($i > 5) {
1093
- wp_schedule_single_event(time() + 10, 'pz_linkcard_alive');
1094
- break;
1095
- }
1096
- if (isset($check_data) && isset($check_data->url)) {
1097
- $before = array( 'url' => $check_data->url );
1098
- $after = $before;
1099
- $before = $this->pz_GetCache( $before );
1100
- $after = $this->pz_GetCURL ( $after );
1101
- $before['alive_result'] = $after['result_code'];
1102
- $before['alive_time'] = $now;
1103
- $after = $this->pz_pz_SetCache( $before );
1104
- }
1105
- }
1106
- }
 
 
 
1107
  }
1108
 
1109
  // Pz カード管理 キャッシュ・マネージャ
1110
  public function page_cacheman() {
1111
- require_once ('pz-linkcard-cacheman.php');
1112
  }
1113
 
 
1114
  public function page_settings() {
1115
- require_once ('pz-linkcard-settings.php');
1116
  }
1117
 
 
1118
  public function activation() {
1119
- $this->options = get_option('Pz_LinkCard_options', $this->defaults);
1120
- if ($this->options['plugin-version'] < '1.0.2') {
1121
- $this->options['sns-tw'] =$this->options['sns-twitter'];
1122
- $this->options['sns-fb'] =$this->options['sns-facebook'];
1123
- $this->options['sns-hb'] =$this->options['sns-hatena'];
1124
- }
1125
- // $this->options += $this->defaults;
1126
-
1127
- foreach ($this->defaults as $key => $value) {
1128
- if (!isset($this->options[$key])) {
1129
  $this->options[$key] = null;
1130
  }
1131
  }
1132
-
1133
  $this->options['plugin-version'] = $this->defaults['plugin-version'];
1134
  update_option('Pz_LinkCard_options', $this->options);
1135
-
1136
- require_once ('pz-linkcard-style.php');
1137
-
1138
  global $wpdb;
1139
  $wpdb->hide_errors();
 
1140
  $this->db_name = $wpdb->prefix.'pz_linkcard';
1141
  $sql = "CREATE TABLE ".$this->db_name." (
1142
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
1143
  url_key VARBINARY(255) NOT NULL,
1144
  url VARCHAR(2048) NOT NULL DEFAULT '',
1145
- link_type INT UNSIGNED,
1146
  site_name VARCHAR(100) ,
1147
  domain VARCHAR(253) ,
1148
  title VARCHAR(200) ,
1149
  excerpt VARCHAR(500) ,
1150
- charset VARCHAR(32) ,
1151
  thumbnail VARCHAR(2048) ,
1152
  favicon VARCHAR(2048) ,
1153
- result_code INT ,
1154
- new_code INT ,
1155
- post_id INT UNSIGNED,
 
1156
  sns_twitter INT ,
1157
  sns_facebook INT ,
1158
  sns_hatena INT ,
1159
- alive_time BIGINT UNSIGNED NOT NULL DEFAULT 0,
1160
- alive_result INT ,
 
 
 
 
 
 
1161
  uptime BIGINT UNSIGNED NOT NULL DEFAULT 0,
1162
  nexttime BIGINT UNSIGNED NOT NULL DEFAULT 0,
 
 
1163
  regist DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1164
  PRIMARY KEY ( id ),
1165
  UNIQUE KEY ( url_key )
@@ -1168,16 +1185,21 @@ class Pz_LinkCard {
1168
  dbDelta($sql);
1169
 
1170
  wp_clear_scheduled_hook('pz_linkcard_check');
1171
- wp_schedule_event(time() + 30, 'hourly', 'pz_linkcard_check');
 
 
1172
  }
1173
 
 
1174
  public function deactivation() {
1175
  wp_clear_scheduled_hook('pz_linkcard_check');
 
1176
  }
1177
 
 
1178
  public function action_links($links) {
1179
  $links = array('<a href="options-general.php?page=pz-linkcard-settings">'.__('Settings', $this->text_domain).'</a>' , '<a href="tools.php?page=pz-linkcard-cache">'.__('Manage', $this->text_domain).'</a>' ) + $links;
1180
  return $links;
1181
  }
1182
  }
1183
- $Pz_LinkCard = new Pz_LinkCard;
3
  Plugin Name: Pz-LinkCard
4
  Plugin URI: http://poporon.poponet.jp/pz-linkcard
5
  Description: リンクをカード形式で表示します。
6
+ Version: 1.7.3
7
  Author: poporon
8
  Author URI: http://poporon.poponet.jp
9
  License: GPLv2 or later
61
  'size-excerpt' => '11px',
62
  'size-info' => '12px',
63
  'size-plugin' => '9px',
64
+ 'color-title' => '#111111',
65
+ 'color-url' => '#4466ff',
66
+ 'color-excerpt' => '#333333',
67
+ 'color-info' => '#222222',
68
+ 'color-plugin' => '#888888',
69
+ 'outline-color-title' => '#ffffff',
70
+ 'outline-color-url' => '#ffffff',
71
+ 'outline-color-excerpt' => '#ffffff',
72
+ 'outline-color-info' => '#ffffff',
73
+ 'outline-color-plugin' => '#ffffff',
74
+ 'ex-bgcolor' => '#ffffff',
75
+ 'in-bgcolor' => '#ffffff',
76
+ 'th-bgcolor' => '#eeeeee',
77
  'in-get' => null,
78
  'ex-image' => '',
79
  'in-image' => '',
112
  'presence' => null,
113
  'plugin-link' => null,
114
  'plugin-name' => 'Pz-LinkCard',
115
+ 'plugin-version' => '1.7.2',
116
  'plugin-url' => 'http://poporon.poponet.jp/pz-linkcard',
117
  'pz-hbc-options' => null,
118
  'debug-time' => null
121
  public function __construct() {
122
  $this->slug = basename(dirname(__FILE__));
123
  $this->text_domain = $this->slug;
124
+
125
  $this->charset = get_bloginfo('charset');
126
+
127
  $this->plugin_basename = plugin_basename(__FILE__);
128
  $this->plugin_dir_path = plugin_dir_path(__FILE__);
129
  $this->plugin_dir_url = plugin_dir_url (__FILE__);
130
+
131
  $this->options = get_option('Pz_LinkCard_options', $this->defaults );
132
  foreach ($this->defaults as $key => $value) {
133
  if (!isset($this->options[$key])) {
134
  $this->options[$key] = null;
135
  }
136
  }
137
+
138
  // DB
139
  global $wpdb;
140
  $this->db_name = $wpdb->prefix.'pz_linkcard';
141
+
142
  // バージョンが違っていたら、DBとオプションを更新する
143
  if ($this->options['plugin-version'] <> $this->defaults['plugin-version']) {
144
  $this->activation();
145
  }
146
+
147
  // CSS URLが空だったら生成
148
  if (isset($this->options['style']) && isset($this->options['style']) == '1' && !isset($this->options['css-url'])) {
149
+ $this->pz_SetStyle();
150
  }
151
+
152
  // ショートコードの設定
153
  if ($this->options['code1'] <> '') {
154
  add_shortcode($this->options['code1'], array($this, 'shortcode'));
162
  if ($this->options['code4'] <> '') {
163
  add_shortcode($this->options['code4'], array($this, 'shortcode'));
164
  }
165
+
166
  // 管理画面のとき
167
  if (is_admin()) {
168
  load_plugin_textdomain ($this->text_domain, false, $this->slug.'/languages'); // 管理画面のみ日本語化
171
  add_action ('admin_menu', array($this, 'add_menu')); // 設定メニュー
172
  add_action ('admin_enqueue_scripts', array($this, 'enqueue_admin')); // 設定メニュー用スクリプト
173
  add_filter ('plugin_action_links_'.$this->plugin_basename, array($this, 'action_links')); // プラグイン画面
174
+
175
  if ((isset($this->options['style']) ? $this->options['style'] : '') == '') {
176
  if (is_null($this->options['css-path']) || !file_exists($this->options['css-path'])) {
177
+ $this->pz_SetStyle();
178
  }
179
  }
180
  } else {
181
  if (!isset($this->options['style'])) {
182
  if (!isset($this->options['css-url'])) {
183
+ $this->pz_SetStyle();
184
  }
185
  }
186
  add_action('wp_enqueue_scripts', array($this, 'enqueue'));
187
  }
188
 
189
+ add_action( 'pz_linkcard_check', array( $this, 'schedule_hook_check' ) );
190
+ add_action( 'pz_linkcard_alive', array( $this, 'schedule_hook_alive' ) );
191
 
192
  if (!wp_next_scheduled('pz_linkcard_check')) {
193
+ wp_schedule_event ( time() + 10 , 'hourly', 'pz_linkcard_check');
194
+ // wp_schedule_single_event( time() + 10 , 'pz_linkcard_check');
195
+ }
196
+ if (!wp_next_scheduled('pz_linkcard_alive')) {
197
+ wp_schedule_event ( time() + 30 , 'hourly', 'pz_linkcard_alive');
198
+ // wp_schedule_single_event( time() + 30 , 'pz_linkcard_alive');
199
  }
 
 
 
 
200
  }
201
 
202
  // ショートコード処理
203
  public function shortcode($atts, $content = null, $shortcode) {
204
+ // 実行時間
205
+ if (isset($this->options['debug-time']) && !is_null($this->options['debug-time'])) {
206
  $start_time = microtime(true);
207
  }
208
 
209
  // URL
210
+ $url = isset( $atts['url'] ) ? $this->pz_TrimURL( $atts['url'] ) : null;
211
  // 密かに記述ミス対応(URIでもUR1でもURLとして判定する)
212
+ if ( is_null( $url ) ) {
213
+ $url = isset( $atts['uri'] ) ? $this->pz_TrimURL( $atts['uri'] ) : null;
214
+ if ( is_null( $url ) ) {
215
+ $url = isset( $atts['ur1'] ) ? $this->pz_TrimURL( $atts['ur1'] ) : null;
216
  }
217
  $atts['url'] = $url;
218
  }
219
+ if ( is_null( $url ) ) {
220
  return 'Pz-LinkCard: URLの指定が誤っています';
221
  }
222
 
223
  // パラメータ
224
+ $s_title = isset($atts['title'] ) ? $atts['title'] : null;
225
+ if ( isset($atts['content'] ) ) {
226
+ $s_excerpt = $atts['content'];
227
+ } elseif ( isset($atts['contents'] ) ) {
228
+ $s_excerpt = $atts['contents'];
229
+ } elseif ( isset($atts['description'] ) ) {
230
+ $s_excerpt = $atts['description'];
231
  } else {
232
+ $s_excerpt = null;
233
  }
234
 
235
  // 囲まれ文字(ショートコード1のみ有効)
247
  // 記事内容取得
248
  $data = $this->pz_GetHTML ( $atts );
249
 
250
+ // 実行時間
251
+ if (isset($this->options['debug-time']) && !is_null($this->options['debug-time'])) {
252
+ $end_time = microtime(true);
253
+ $elasped_time = number_format($end_time - $start_time, 8, '.', ',');
254
+ $data = PHP_EOL.'<!-- Pz-LkC -->'.PHP_EOL.$data.PHP_EOL.'<!-- /Pz-LkC ('.$elasped_time.'sec) -->'.PHP_EOL;
255
+ }
256
+
257
  return $data;
258
  }
259
 
260
+ // キャッシュやリンク先からリンクカードのHTMLを生成
 
 
 
 
 
 
 
 
 
 
 
261
  function pz_GetHTML($atts, $content = null) {
262
  $url = $this->pz_TrimURL( $atts['url'] );
263
  if (!isset($url) || $url == '' ) {
468
  // 更新あり
469
  if ( $update ) {
470
  $data = $this->pz_SetCache( $data );
471
+ wp_schedule_single_event(time() + 1, 'pz_linkcard_check');
472
 
473
  if (isset($data['id'])) {
474
  $update = false;
476
  }
477
 
478
  // サムネイル取得
479
+ if ( !$this->options['thumbnail-position'] || ( $result_code <> 0 && $result_code <> 200 ) ) {
480
  $thumbnail = null;
481
  } else {
482
  if ($sw_thumbnail == '3') {
579
  $a_cl_all = '';
580
  }
581
 
582
+ // ソーシャルカウントの表示
583
  $sns = null;
584
  $sns_info = null;
585
  $sns_title = null;
586
  if ( isset($this->options['sns-position']) ? $this->options['sns-position'] : null ) {
587
  $sns = '<span class="lkc-share">';
588
+ // カード全体をリンクにするときは表示のみ
589
  if ((isset($this->options['link-all']) ? $this->options['link-all'] : null) == '1') {
590
  if (isset($this->options['sns-tw']) && !is_null($this->options['sns-tw']) && $sns_tw > 0) {
591
+ $sns .= ' <span class="lkc-sns-tw">'.$sns_tw.'&nbsp;tweet'.(($sns_tw > 1) ? 's' : '').'</span>';
592
  }
593
  if (isset($this->options['sns-fb']) && !is_null($this->options['sns-fb']) && $sns_fb > 0) {
594
+ $sns .= ' <span class="lkc-sns-fb">'.$sns_fb.'&nbsp;share'.(($sns_fb > 1) ? 's' : '').'</span>';
595
  }
596
  if (isset($this->options['sns-hb']) && !is_null($this->options['sns-hb']) && $sns_hb > 0) {
597
+ $sns .= ' <span class="lkc-sns-hb">'.$sns_hb.'&nbsp;user'.(($sns_hb > 1) ? 's' : '').'</span>';
598
  }
599
  } else {
600
+ // 外部リンクアイコンを表示させるプラグイン対応のため no_icon を付与
601
  if (isset($this->options['sns-tw']) && !is_null($this->options['sns-tw']) && $sns_tw > 0) {
602
  $sns .= ' <a class="lkc-sns-tw no_icon" href="https://twitter.com/intent/tweet?url=' .rawurlencode($url).'&text='.esc_html($title).'" target="_blank">'.$sns_tw.'&nbsp;tweet'.(($sns_tw > 1) ? 's' : '').'</a>';
603
  }
646
  $tag = '<div class="'.$class_id.'">'.$tag.'</div>';
647
  }
648
 
 
 
 
 
 
 
 
 
649
  return $tag;
650
  }
651
 
890
  $charset = null;
891
  $result_code = null;
892
 
893
+ $data['id'] = (isset( $data['id'] ) ? $data['id'] : null );
894
+ $data['url_key'] = (isset( $data['url_key'] ) ? $data['url_key'] : null );
895
+ $data['site_name'] = (isset( $data['site_name'] ) ? $data['site_name'] : null );
896
+ $data['title'] = (isset( $data['title'] ) ? $data['title'] : null );
897
+ $data['excerpt'] = (isset( $data['excerpt'] ) ? $data['excerpt'] : null );
898
+ $data['charset'] = (isset( $data['charset'] ) ? $data['charset'] : null );
899
+ $data['thumbnail'] = (isset( $data['thumbnail'] ) ? $data['thumbnail'] : null );
900
+ $data['favicon'] = (isset( $data['favicon'] ) ? $data['favicon'] : null );
901
+ $data['result_code'] = (isset( $data['result_code'] ) ? $data['result_code'] : null );
902
+ $data['post_id'] = (isset( $data['post_id'] ) ? $data['post_id'] : get_the_ID() );
903
+ $data['sns_twitter'] = (isset( $data['sns_twitter'] ) ? $data['sns_twitter'] : -1 );
904
+ $data['sns_facebook'] = (isset( $data['sns_facebook'] ) ? $data['sns_facebook'] : -1 );
905
+ $data['sns_hatena'] = (isset( $data['sns_hatena'] ) ? $data['sns_hatena'] : -1 );
906
+ $data['uptime'] = (isset( $data['uptime'] ) ? $data['uptime'] : 0 );
907
+ $data['nexttime'] = (isset( $data['nexttime'] ) ? $data['nexttime'] : 0 );
908
+ $data['alive_time'] = (isset( $data['alive_time'] ) ? $data['alive_time'] : 0 );
909
+ $data['alive_result'] = (isset( $data['alive_result'] ) ? $data['alive_result'] : 0 );
910
+ if ( !isset( $data['domain'] ) ) {
911
+ if (preg_match('{https?://(.+?)/}i', $url.'/',$m)) {
912
+ $domain_url = $m[0];
913
+ $domain = $m[1];
 
 
 
 
 
 
 
914
  } else {
915
+ $domain_url = null;
916
+ $domain = null;
917
  }
918
+ }
919
+
920
+ if ( function_exists( 'curl_init' ) ) { // cURLを使用する
921
+ $result_code = 0;
922
+ $ch = curl_init($url);
923
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); // データで取得
924
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 8 ); // タイムアウト
925
+ curl_setopt( $ch, CURLOPT_USERAGENT, esc_html( $_SERVER['HTTP_USER_AGENT'] ) ); // ユーザーエージェント
926
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); // リダイレクトを処理する
927
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 8 ); // リダイレクトを処理する階層
928
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true ); // リダイレクト用リファラを自動セット
929
+ curl_setopt( $ch, CURLOPT_COOKIESESSION, true ); // セッションCOOKIEを使用する
930
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, (isset($this->options['flg-ssl']) ? false : true) ); // SSL検証
931
  $html = curl_exec($ch);
932
+ $errno = intval( curl_errno( $ch ) );
933
+ if ( $errno ) {
934
  $html = ''; // cURLエラー
935
+ $result_code = 0 - $errno;
936
+ $error = true;
937
  } else {
938
  $header = curl_getinfo($ch);
939
  $result_code = $header['http_code']; // HTTPステータス
941
  }
942
  curl_close($ch);
943
  } else { // cURLを使用しない
944
+ $result = wp_remote_get( $url );
945
+ if ( is_wp_error( $result ) ) {
946
+ $html = '';
947
+ $result_code = -1; // wp_remote_getエラー
948
+ $error = true;
949
+ } else {
950
  $html = $result['body'];
951
  $result_code = $result['response']['code']; // HTTPステータス
952
  $error = false;
 
 
 
953
  }
954
  }
955
 
956
+ // 文字コード判定(タグはいい加減なサイトが多いので変換して判定する)
957
  $charset = null;
958
  if ($html <> '') {
959
  if (preg_match('/charset\s*=\s*([^>\/\s]*).*<\/head/si', $html, $m)) {
997
  }
998
 
999
  // // OGPから画像URL取得
1000
+ if (isset( $tags['og:image'] ) && $tags['og:image'] ) {
1001
+ $thumbnail_url = $tags['og:image'];
1002
+ // if ( $sw_thumbnail == '1' ) {
1003
+ // $thumbnail = '<img class="lkc-thumbnail-img" src="'.$thumbnail_url.'" alt="" />';
1004
+ // }
1005
+ }
1006
 
1007
  // サイト名
1008
  if (isset( $tags['og:site_name'] ) && $tags['og:site_name'] ) {
1016
  if (isset($url_key) && !is_null($url_key)) {
1017
  $data['url_key'] = $url_key;
1018
  }
 
1019
  $data['site_name'] = $site_name;
1020
  $data['title'] = $title;
1021
  $data['excerpt'] = $excerpt;
1022
  $data['charset'] = $charset;
 
1023
  if (isset($atts['force']) && $atts['force'] == true) {
1024
  $data['regist'] = current_time('mysql'); // 登録日
1025
  }
1026
  }
1027
+ $data['url'] = $url;
1028
+ $data['thumbnail'] = $thumbnail_url;
1029
+ $data['result_code'] = $result_code;
1030
+ $data['domain'] = $domain;
1031
+ // $data['favicon'] = $favicon_url;
1032
+
1033
+ return $data;
1034
  }
1035
 
1036
  // 管理画面時のスタイルシート、スクリプト設定
1052
 
1053
  // 管理画面のサブメニュー追加
1054
  public function add_menu() {
1055
+ add_management_page (__('LinkCard cache manager', $this->text_domain),__('Pz LkC Cache', $this->text_domain),'manage_options', 'pz-linkcard-cache', array($this, 'page_cacheman') );
1056
+ add_options_page (__('LinkCard Settings', $this->text_domain),__('Pz LinkCard', $this->text_domain),'manage_options', 'pz-linkcard-settings', array($this, 'page_settings') );
1057
  }
1058
 
1059
  // WP-CRONスケジュール(SNSカウント取得)
1060
+ public function schedule_hook_check() {
1061
  if (!isset($this->options['sns-position']) || $this->options['sns-position'] == '') {
1062
  return null;
1063
  }
1070
  foreach($result as $data) {
1071
  $i++;
1072
  if ($i > 10) {
1073
+ wp_schedule_single_event(time() + 30, 'pz_linkcard_check');
1074
  break;
1075
  }
1076
  if (isset($data) && isset($data->url)) {
1088
 
1089
  global $wpdb;
1090
  $now = current_time('timestamp');
 
1091
  $result = (array) $wpdb->get_results($wpdb->prepare("SELECT url,alive_time FROM $this->db_name WHERE alive_time<%d ORDER BY alive_time ASC", $now));
 
1092
  $i = 0;
1093
+ // if (isset($result) && is_array($result) && count($result) > 0) {
1094
+ // foreach($result as $data) {
1095
+ // $i++;
1096
+ // if ($i > 5) {
1097
+ // wp_schedule_single_event(time() + 10, 'pz_linkcard_alive');
1098
+ // break;
1099
+ // }
1100
+ // if (isset($data) && isset($data->url)) {
1101
+ // $before = array( 'url' => $data->url );
1102
+ // $before = $this->pz_GetCache( $before );
1103
+ // $before['alive_result'] = $before['result_code'];
1104
+ // $before['alive_time'] = $now;
1105
+ // $after = $this->pz_SetCache( $before );
1106
+ // }
1107
+ // }
1108
+ // }
1109
+ }
1110
+
1111
+ // スタイルシート生成
1112
+ public function pz_SetStyle() {
1113
+ require_once ('lib/pz-linkcard-style.php');
1114
  }
1115
 
1116
  // Pz カード管理 キャッシュ・マネージャ
1117
  public function page_cacheman() {
1118
+ require_once ('lib/pz-linkcard-cacheman.php');
1119
  }
1120
 
1121
+ // Pz カード 設定画面
1122
  public function page_settings() {
1123
+ require_once ('lib/pz-linkcard-settings.php');
1124
  }
1125
 
1126
+ // プラグイン有効化
1127
  public function activation() {
1128
+ // if ( is_multisite() ) {
1129
+ // global $current_site , $current_blog ;
1130
+ // if ( !$blog_id ) {
1131
+ // return;
1132
+ // }
1133
+ // }
1134
+
1135
+ $this->options = get_option( 'Pz_LinkCard_options', $this->defaults );
1136
+ foreach( $this->defaults as $key => $value ) {
1137
+ if ( !isset( $this->options[$key] ) ) {
1138
  $this->options[$key] = null;
1139
  }
1140
  }
1141
+
1142
  $this->options['plugin-version'] = $this->defaults['plugin-version'];
1143
  update_option('Pz_LinkCard_options', $this->options);
1144
+
1145
+ $this->pz_SetStyle();
1146
+
1147
  global $wpdb;
1148
  $wpdb->hide_errors();
1149
+
1150
  $this->db_name = $wpdb->prefix.'pz_linkcard';
1151
  $sql = "CREATE TABLE ".$this->db_name." (
1152
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
1153
  url_key VARBINARY(255) NOT NULL,
1154
  url VARCHAR(2048) NOT NULL DEFAULT '',
 
1155
  site_name VARCHAR(100) ,
1156
  domain VARCHAR(253) ,
1157
  title VARCHAR(200) ,
1158
  excerpt VARCHAR(500) ,
 
1159
  thumbnail VARCHAR(2048) ,
1160
  favicon VARCHAR(2048) ,
1161
+ means VARCGAR(32) ,
1162
+ charset VARCHAR(32) ,
1163
+ sns_time BIGINT UNSIGNED NOT NULL DEFAULT 0,
1164
+ sns_nexttime BIGINT UNSIGNED NOT NULL DEFAULT 0,
1165
  sns_twitter INT ,
1166
  sns_facebook INT ,
1167
  sns_hatena INT ,
1168
+ post_id INT UNSIGNED,
1169
+ regist_time BIGINT UNSIGNED NOT NULL DEFAULT 0,
1170
+ regist_result INT ,
1171
+ update_time BIGINT UNSIGNED NOT NULL DEFAULT 0,
1172
+ update_result INT ,
1173
+ alive_time BIGINT UNSIGNED NOT NULL DEFAULT 0,
1174
+ alive_result INT ,
1175
+ update DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1176
  uptime BIGINT UNSIGNED NOT NULL DEFAULT 0,
1177
  nexttime BIGINT UNSIGNED NOT NULL DEFAULT 0,
1178
+ link_type INT UNSIGNED,
1179
+ result_code INT ,
1180
  regist DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1181
  PRIMARY KEY ( id ),
1182
  UNIQUE KEY ( url_key )
1185
  dbDelta($sql);
1186
 
1187
  wp_clear_scheduled_hook('pz_linkcard_check');
1188
+ wp_clear_scheduled_hook('pz_linkcard_alive');
1189
+ // wp_schedule_event(time() , 'hourly', 'pz_linkcard_check');
1190
+ // wp_schedule_event(time() , 'hourly', 'pz_linkcard_alive');
1191
  }
1192
 
1193
+ // プラグイン停止
1194
  public function deactivation() {
1195
  wp_clear_scheduled_hook('pz_linkcard_check');
1196
+ wp_clear_scheduled_hook('pz_linkcard_alive');
1197
  }
1198
 
1199
+ // プラグイン一覧のクイックメニュー
1200
  public function action_links($links) {
1201
  $links = array('<a href="options-general.php?page=pz-linkcard-settings">'.__('Settings', $this->text_domain).'</a>' , '<a href="tools.php?page=pz-linkcard-cache">'.__('Manage', $this->text_domain).'</a>' ) + $links;
1202
  return $links;
1203
  }
1204
  }
1205
+ $Class_Pz_LinkCard = new Pz_LinkCard;
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: poporon
3
  Tags: post, internal link, external link, blogcard, linkcard
4
  Requires at least: 4.3
5
- Tested up to: 4.5.3
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -171,10 +171,32 @@ A5.
171
 
172
  == Changelog ==
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  = 1.7.1 =
175
- * Fixed: debug.
 
 
176
 
177
- * 不具合を修正。
 
 
178
 
179
  = 1.7.0 =
180
  * Added: Added setting. `In the case of domain names, to ignore the trailing-slash`.
2
  Contributors: poporon
3
  Tags: post, internal link, external link, blogcard, linkcard
4
  Requires at least: 4.3
5
+ Tested up to: 4.6
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
171
 
172
  == Changelog ==
173
 
174
+ = 1.7.3 =
175
+ * Fixed: Fixed a bug that domain-name disappears.
176
+
177
+ * ドメイン名が取得できていない不具合を修正。
178
+
179
+ = 1.7.2 =
180
+ * Compatible with WordPress 4.6.
181
+ * Modefied: Modified so as also to small character size to fit the size of screen.
182
+ * Fixed: Fixed a bug that social count disappears.
183
+ * Fixed: Fixed a bug that thumbnail can not display.
184
+ * Fixed: When the multi-site, fixes a bug that setting is not properly reflected.
185
+
186
+ * WordPress 4.6 での動作確認。
187
+ * 幅に合わせて縮小を有効にしたとき、サムネイルと合わせて文字サイズも小さくするように修正。(Thanks @fumieblog)
188
+ * 管理画面で再取得時にソーシャルカウントが消えてしまう不具合を修正。(1.7.1で発生)(Thanks @i_tsu_tsu)
189
+ * 内部リンクの画像が取得できない不具合を修正。(1.7.1で発生)(Thanks @i_tsu_tsu)
190
+ * マルチサイトへの対応方法が誤っていたため修正。(1.7.1で発生)(Thanks @kyutechnabe)
191
+
192
  = 1.7.1 =
193
+ * Fixed: Fixed a bug that article content can not be acquired.
194
+ * Modefied: Time of the error, modified so that it does not display the thumbnail.
195
+ * Modefied: Modification of the order to respond to multi-site.
196
 
197
+ * 記事内容がキャッシュされない不具合を修正。(Thanks @i_tsu_tsu)
198
+ * 取得時エラーのもののサムネイル表示をしないように修正。(Thanks @misoji_13)
199
+ * マルチサイトへの仮対応。(Thanks @kyutechnabe)
200
 
201
  = 1.7.0 =
202
  * Added: Added setting. `In the case of domain names, to ignore the trailing-slash`.
pz-linkcard-templete.css → templete/pz-linkcard-templete.css RENAMED
@@ -1,4 +1,4 @@
1
- /* [Pz-LkC][1.6.9] CSS */
2
  .linkcard {
3
  /*MARGIN-TOP*/
4
  /*MARGIN-BOTTOM*/
@@ -248,4 +248,5 @@ blockquote.lkc-quote {
248
  width: 100%;
249
  }
250
  /*OPTION*/
251
- /*RESIZE*/
 
1
+ /* [Pz-LkC][1.7.3] CSS */
2
  .linkcard {
3
  /*MARGIN-TOP*/
4
  /*MARGIN-BOTTOM*/
248
  width: 100%;
249
  }
250
  /*OPTION*/
251
+
252
+ /*RESIZE*/
uninstall.php CHANGED
@@ -7,10 +7,6 @@ $css_dir = $wp_upload_dir['basedir'].'/'.$slug;
7
  $css_path1 = $css_dir.'/style.css';
8
  $css_path2 = $css_dir.'/'.$slug.'-style.css';
9
 
10
- // Clear Schedule
11
- wp_clear_scheduled_hook('pz_linkcard_alive');
12
- wp_clear_scheduled_hook('pz_linkcard_check');
13
-
14
  // Delete options
15
  delete_option('Pz_LinkCard_options');
16
 
7
  $css_path1 = $css_dir.'/style.css';
8
  $css_path2 = $css_dir.'/'.$slug.'-style.css';
9
 
 
 
 
 
10
  // Delete options
11
  delete_option('Pz_LinkCard_options');
12