Pz-LinkCard - Version 2.4.4.2

Version Description

  • URL%20 Modified: Corresponds to the case where the URL contains a half-width space.
  • Modified: Corresponds to the case of using double-byte quotes for shortcodes.
Download this release

Release Info

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

Code changes from version 2.4.4.1 to 2.4.4.2

lib/pz-linkcard-settings-admin.php CHANGED
@@ -1,9 +1,32 @@
1
  <?php defined('ABSPATH' ) || wp_die; ?>
2
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  // WP-Cronスケジュールを取得
4
  $cron_schedule = _get_cron_array();
5
  $schedules = wp_get_schedules();
6
- $prefix = 'pz_linkcard_';
7
  foreach ($cron_schedule as $timestamp => $cronhooks ) {
8
  foreach ($cronhooks as $hook => $dings ) {
9
  foreach ($dings as $signature => $data ) {
@@ -34,22 +57,26 @@
34
  }
35
  asort($cron_list );
36
 
37
- // WP-Cron の実行結果
38
- if (isset($run_log ) ) {
39
- $run_log = esc_html($run_log );
40
- $run_log = str_replace(PHP_EOL, '<br>', $run_log );
41
- ?>
42
- <h2><?php echo __('Execution Result', $this->text_domain ); ?></h3>
43
- <div>
44
- <?php _e('Run Log', $this->text_domain ); ?>
45
- </div>
46
- <div class="pz-lkc-cron-log">
47
- <?php echo $run_log; ?>
48
- </div>
49
- <?php
50
- }
51
  ?>
52
- <h2><?php echo __('WP-Cron Settings', $this->text_domain ); ?></h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  <div class="pz-lkc-cron-margin"><label><input type="checkbox" value="1" class="pz-lkc-cron-all" /><?php _e('View all schedules.', $this->text_domain ); ?></label></div>
54
  <table class="pz-lkc-cron-list widefat striped">
55
  <thead>
@@ -62,20 +89,61 @@
62
  </thead>
63
  <tbody>
64
  <?php foreach ($cron_list as $key => $cron ) { ?>
65
- <tr <?php echo $cron['display']; ?>>
66
- <td class="pz-lkc-cron-body-run"><?php echo $cron['button']; ?></td>
67
- <td class="pz-lkc-cron-body-hook"><?php echo $cron['hook']; ?></td>
68
- <td class="pz-lkc-cron-body-next-time"><?php echo $cron['next_time']; ?></td>
69
- <td class="pz-lkc-cron-body-schedule"><?php echo $cron['schedule']; ?></td>
70
- </tr>
71
  <?php } ?>
72
  </tbody>
73
  </table>
74
 
75
- <h2><?php echo __('Information', $this->text_domain ); ?></h3>
76
- <table class="form-table">
77
- <tr>
78
- <th scope="row"><?php _e('Table Name', $this->text_domain ); ?></th>
79
- <td><input type="text" size="40" value="<?php echo esc_html($this->db_name ); ?>" readonly="readonly" /></td>
80
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  </table>
 
 
 
 
 
 
 
 
 
 
 
1
  <?php defined('ABSPATH' ) || wp_die; ?>
2
  <?php
3
+ switch ($action) {
4
+ case 'run-pz_linkcard_check':
5
+ wp_clear_scheduled_hook('pz_linkcard_check' );
6
+ $cron_log = $this->schedule_hook_check();
7
+ if ($this->options['sns-position'] && !wp_next_scheduled('pz_linkcard_check' ) ) {
8
+ wp_schedule_event(time() + HOUR_IN_SECONDS, 'hourly', 'pz_linkcard_check' );
9
+ }
10
+ break;
11
+ case 'run-pz_linkcard_alive':
12
+ wp_clear_scheduled_hook('pz_linkcard_alive' );
13
+ $cron_log = $this->schedule_hook_alive();
14
+ if ($this->options['flg-alive'] && !wp_next_scheduled('pz_linkcard_alive' ) ) {
15
+ wp_schedule_event(time() + DAY_IN_SECONDS, 'daily', 'pz_linkcard_alive' );
16
+ }
17
+ break;
18
+ }
19
+
20
+ // WP-Cron の実行結果
21
+ if (isset($cron_log ) ) {
22
+ $cron_log = esc_html($cron_log );
23
+ $cron_log = str_replace(PHP_EOL, '<br>', $cron_log );
24
+ }
25
+
26
  // WP-Cronスケジュールを取得
27
  $cron_schedule = _get_cron_array();
28
  $schedules = wp_get_schedules();
29
+ $prefix = 'pz_';
30
  foreach ($cron_schedule as $timestamp => $cronhooks ) {
31
  foreach ($cronhooks as $hook => $dings ) {
32
  foreach ($dings as $signature => $data ) {
57
  }
58
  asort($cron_list );
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  ?>
61
+ <h2><?php echo __('Information', $this->text_domain ); ?></h3>
62
+ <table class="form-table">
63
+ <tr>
64
+ <th scope="row"><?php _e('Table Name', $this->text_domain ); ?></th>
65
+ <td><input type="text" size="40" value="<?php echo esc_html($this->db_name ); ?>" readonly="readonly" /></td>
66
+ </tr>
67
+ </table>
68
+
69
+ <?php if (isset($cron_log ) ) { ?>
70
+ <h2><?php echo __('Execution Result', $this->text_domain ); ?></h3>
71
+ <div>
72
+ <?php _e('Execution Result', $this->text_domain ); ?>
73
+ </div>
74
+ <div class="pz-lkc-cron-log">
75
+ <?php echo $cron_log; ?>
76
+ </div>
77
+ <?php } ?>
78
+
79
+ <h2><?php echo __('WP-Cron Information', $this->text_domain ); ?></h3>
80
  <div class="pz-lkc-cron-margin"><label><input type="checkbox" value="1" class="pz-lkc-cron-all" /><?php _e('View all schedules.', $this->text_domain ); ?></label></div>
81
  <table class="pz-lkc-cron-list widefat striped">
82
  <thead>
89
  </thead>
90
  <tbody>
91
  <?php foreach ($cron_list as $key => $cron ) { ?>
92
+ <tr <?php echo $cron['display']; ?>>
93
+ <td class="pz-lkc-cron-body-run"><?php echo $cron['button']; ?></td>
94
+ <td class="pz-lkc-cron-body-hook"><?php echo $cron['hook']; ?></td>
95
+ <td class="pz-lkc-cron-body-next-time"><?php echo $cron['next_time']; ?></td>
96
+ <td class="pz-lkc-cron-body-schedule"><?php echo $cron['schedule']; ?></td>
97
+ </tr>
98
  <?php } ?>
99
  </tbody>
100
  </table>
101
 
102
+ <h2><?php echo __('WP-Options Information', $this->text_domain ); ?></h3>
103
+ <table class="pz-lkc-cron-list widefat striped">
104
+ <thead>
105
+ <tr>
106
+ <th scope="col" class="pz-lkc-cron-head-run"><?php _e('ID', $this->text_domain ); ?></th>
107
+ <th scope="col" class="pz-lkc-cron-head-hook"><?php _e('Name', $this->text_domain ); ?></th>
108
+ <th scope="col" class="pz-lkc-cron-head-next-time"><?php _e('Size', $this->text_domain ); ?></th>
109
+ <th scope="col" class="pz-lkc-cron-head-schedule"><?php _e('Auto Load', $this->text_domain ); ?></th>
110
+ </tr>
111
+ </thead>
112
+ <tbody>
113
+ <?php
114
+ // WP_Options テーブルの使用状況
115
+ global $wpdb;
116
+ $wp_options = $wpdb->prefix.'options';
117
+ $options_list = $wpdb->get_results("SELECT option_id AS id , option_name AS name , option_value AS value , LENGTH(option_value) AS size , autoload FROM {$wp_options}", ARRAY_A );
118
+ // echo '<pre>[DEBUG]wp_options='.esc_html(print_r($options_list, true ) ).'<br></pre>';
119
+ // $options_size = $wpdb->get_results("SELECT SUM(LENGTH(option_value)) AS res FROM $wp_options", ARRAY_A )[0]['res'];
120
+ // echo '<pre>[DEBUG]options size='.$options_size.'<br></pre>';
121
+ // $options_count = $wpdb->get_results("SELECT COUNT(*) AS res FROM $wp_options", ARRAY_A )[0]['res'];
122
+ // echo '<pre>[DEBUG]options count='.$options_count.'<br></pre>';
123
+ // $autoload_size = $wpdb->get_results("SELECT SUM(LENGTH(option_value)) AS res FROM $wp_options WHERE autoload='yes'", ARRAY_A )[0]['res'];
124
+ // echo '<pre>[DEBUG]autoloaded size='.$autoload_size.'<br></pre>';
125
+ // $autoload_count = $wpdb->get_results("SELECT COUNT(*) AS res FROM $wp_options WHERE autoload='yes'", ARRAY_A )[0]['res'];
126
+ // echo '<pre>[DEBUG]autoloaded count='.$autoload_count.'<br></pre>';
127
+ foreach ($options_list as $key => $item ) {
128
+ ?>
129
+ <tr>
130
+ <td class="pz-lkc-cron-body-run"><?php echo $item['id']; ?></td>
131
+ <td class="pz-lkc-cron-body-run"><?php echo $item['name']; ?></td>
132
+ <td class="pz-lkc-cron-body-run"><?php echo $item['size']; ?></td>
133
+ <td class="pz-lkc-cron-body-run"><?php echo $item['autoload']; ?></td>
134
+ </tr>
135
+ <?php
136
+ } ?>
137
+ </tbody>
138
  </table>
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
lib/pz-linkcard-settings.php CHANGED
@@ -26,25 +26,15 @@
26
  break;
27
  case 'clear-error':
28
  $this->options['error-mode'] = null;
29
- $result = $this->pz_UpdateOption(); // オプションの更新
30
 
31
  break;
32
  case 'run-pz_linkcard_check':
33
- wp_clear_scheduled_hook('pz_linkcard_check' );
34
- $run_log = $this->schedule_hook_check();
35
- if (!wp_next_scheduled('pz_linkcard_check' ) ) {
36
- wp_schedule_event(time() + HOUR_IN_SECONDS, 'hourly', 'pz_linkcard_check' );
37
- }
38
  break;
39
  case 'run-pz_linkcard_alive':
40
- wp_clear_scheduled_hook('pz_linkcard_alive' );
41
- $run_log = $this->schedule_hook_alive();
42
- if (!wp_next_scheduled('pz_linkcard_alive' ) ) {
43
- wp_schedule_event(time() + DAY_IN_SECONDS, 'daily', 'pz_linkcard_alive' );
44
- }
45
  break;
46
  default:
47
- // 「変更を保存」または「プラグインの再起動」を押した時
48
  $this->options = $properties;
49
 
50
  // 無いキーを生成
26
  break;
27
  case 'clear-error':
28
  $this->options['error-mode'] = null;
29
+ $result = $this->pz_UpdateOption(); // オプションの更新
30
 
31
  break;
32
  case 'run-pz_linkcard_check':
 
 
 
 
 
33
  break;
34
  case 'run-pz_linkcard_alive':
 
 
 
 
 
35
  break;
36
  default:
37
+ // 「変更を保存」もしくは「プラグインの再起動」をクリックしたとき
38
  $this->options = $properties;
39
 
40
  // 無いキーを生成
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: 2.4.4.1
7
  Author: Poporon
8
  Author URI: http://poporon.poponet.jp
9
  Text Domain: pz-linkcard
@@ -17,7 +17,7 @@ class Pz_LinkCard {
17
  protected $defaults = array(
18
  'plugin-abbreviation' => 'Pz-LkC',
19
  'plugin-name' => 'Pz-LinkCard',
20
- 'plugin-version' => '2.4.4.1',
21
  'plugin-path' => '/pz-linkcard',
22
  'author-url' => 'https://popozure.info',
23
  'author-name' => 'Poporon',
@@ -991,6 +991,9 @@ class Pz_LinkCard {
991
  $url = rawurldecode($url );
992
  } while (mb_strpos($url, '%25' ) !== false ); // %25 = % が残っていたら、再度デコード
993
 
 
 
 
994
  // デコードしたURLを返却
995
  return $url;
996
  }
@@ -1004,7 +1007,8 @@ class Pz_LinkCard {
1004
 
1005
  // クォート文字の除去
1006
  $url = html_entity_decode($url );
1007
- $url = preg_replace('/^[\'"‘’“”]+|[\'"‘’“”]+$/', '', $url );
 
1008
 
1009
  // エンティティ文字がある
1010
  if (mb_strpos($url, '%' ) !== false) {
3
  Plugin Name: Pz-LinkCard
4
  Plugin URI: http://poporon.poponet.jp/pz-linkcard
5
  Description: リンクをカード形式で表示します。
6
+ Version: 2.4.4.2
7
  Author: Poporon
8
  Author URI: http://poporon.poponet.jp
9
  Text Domain: pz-linkcard
17
  protected $defaults = array(
18
  'plugin-abbreviation' => 'Pz-LkC',
19
  'plugin-name' => 'Pz-LinkCard',
20
+ 'plugin-version' => '2.4.4.2',
21
  'plugin-path' => '/pz-linkcard',
22
  'author-url' => 'https://popozure.info',
23
  'author-name' => 'Poporon',
991
  $url = rawurldecode($url );
992
  } while (mb_strpos($url, '%25' ) !== false ); // %25 = % が残っていたら、再度デコード
993
 
994
+ // 半角空白があったらエンティティ化(エンコード)
995
+ $url = str_replace(' ', '%20', $url );
996
+
997
  // デコードしたURLを返却
998
  return $url;
999
  }
1007
 
1008
  // クォート文字の除去
1009
  $url = html_entity_decode($url );
1010
+ $url = str_replace(' ', '%20', $url );
1011
+ $url = preg_replace('/^[\'"‘’“”″]+|[\'"‘’“”″]+$/', '', $url );
1012
 
1013
  // エンティティ文字がある
1014
  if (mb_strpos($url, '%' ) !== false) {
readme.txt CHANGED
@@ -151,6 +151,12 @@ Ver.2.1.2から200px四方に変更、Ver.2.4.1から自由に指定できるよ
151
 
152
  == Changelog ==
153
 
 
 
 
 
 
 
154
  = 2.4.4.1 =
155
  * WordPress 5.7 での動作確認。
156
  Compatible with WordPress 5.7.
151
 
152
  == Changelog ==
153
 
154
+ = 2.4.4.2 =
155
+ * URLに%20(半角スペース)が含まれていた場合、除去しないように修正。
156
+ Modified: Corresponds to the case where the URL contains a half-width space.
157
+ * ショートコードの閉じに全角ダブルクォートを指定してもリンクが機能するように修正。(「“」と「”」は対応していましたが「″」の対応が抜けていました)
158
+ Modified: Corresponds to the case of using double-byte quotes for shortcodes.
159
+
160
  = 2.4.4.1 =
161
  * WordPress 5.7 での動作確認。
162
  Compatible with WordPress 5.7.