Pz-LinkCard - Version 2.4.5.4

Version Description

  • Fixed: Fixed a bug that caused uninstallation to fail.
  • Thanks @OrganicRelife on Twitter Fixed: Fixed a bug that article information could not be cached.
  • Fixed: Fixed a bug that prevented moving by specifying the number of pages.
Download this release

Release Info

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

Code changes from version 2.4.5.3 to 2.4.5.4

lib/pz-linkcard-cacheman-list.php CHANGED
@@ -118,6 +118,9 @@
118
  $count_now = count($data_now );
119
 
120
  // ページ数
 
 
 
121
  $page_limit = 10; // ページ内の行数
122
  $page_min = intval(($count_now > 0 ) ? 1 : 0 ); // 最初のページ数
123
  $page_max = intval(ceil($count_now / $page_limit ) ); // 最後のページ数
@@ -209,7 +212,7 @@
209
  <?php echo strPageButton('prev-page', $href, $page_now, $page_min); ?>
210
  &nbsp;
211
  <span class="paging-input">
212
- <input type="text" name="paged" id="current-page-selector" class="current-page" value="<?php echo $page_now; ?>" size="2" aria-describedby="table-paging" />
213
  &nbsp;/&nbsp;
214
  <span class="total-pages"><?php echo $page_max; ?></span>
215
  </span>
118
  $count_now = count($data_now );
119
 
120
  // ページ数
121
+ if ($paged_no <> 0) {
122
+ $paged = $paged_no;
123
+ }
124
  $page_limit = 10; // ページ内の行数
125
  $page_min = intval(($count_now > 0 ) ? 1 : 0 ); // 最初のページ数
126
  $page_max = intval(ceil($count_now / $page_limit ) ); // 最後のページ数
212
  <?php echo strPageButton('prev-page', $href, $page_now, $page_min); ?>
213
  &nbsp;
214
  <span class="paging-input">
215
+ <input type="text" name="paged_no" id="current-page-selector" class="current-page" value="<?php echo $page_now; ?>" size="2" aria-describedby="table-paging" />
216
  &nbsp;/&nbsp;
217
  <span class="total-pages"><?php echo $page_max; ?></span>
218
  </span>
lib/pz-linkcard-cacheman.php CHANGED
@@ -34,8 +34,8 @@
34
  $update_result = isset($_REQUEST['update_result'] ) ? $_REQUEST['update_result'] : null;
35
  $alive_result = isset($_REQUEST['alive_result'] ) ? $_REQUEST['alive_result'] : null;
36
 
37
- $paged = isset($_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1;
38
- $paged = intval($paged ) - 0;
39
 
40
  $mydomain = null;
41
  if (preg_match('{https?://(.*)/}i', $this->home_url.'/',$m ) ) {
34
  $update_result = isset($_REQUEST['update_result'] ) ? $_REQUEST['update_result'] : null;
35
  $alive_result = isset($_REQUEST['alive_result'] ) ? $_REQUEST['alive_result'] : null;
36
 
37
+ $paged_no = intval(isset($_REQUEST['paged_no'] ) ? $_REQUEST['paged_no'] : 0);
38
+ $paged = intval(isset($_REQUEST['paged'] ) ? $_REQUEST['paged'] : 0);
39
 
40
  $mydomain = null;
41
  if (preg_match('{https?://(.*)/}i', $this->home_url.'/',$m ) ) {
lib/pz-linkcard-init.php CHANGED
@@ -116,6 +116,8 @@
116
  charset VARCHAR(32) DEFAULT NULL,
117
  thumbnail VARCHAR(2048) DEFAULT NULL,
118
  favicon VARCHAR(2048) DEFAULT NULL,
 
 
119
  no_failure INT UNSIGNED DEFAULT 0,
120
  alive_result INT DEFAULT -1,
121
  alive_time BIGINT UNSIGNED NOT NULL DEFAULT 0,
@@ -203,23 +205,6 @@
203
  // 古い項目から新しい項目へ転記(post_id → use_post_id1)
204
  $result = $wpdb->get_results("UPDATE $this->db_name SET use_post_id1 = post_id , post_id = 0 WHERE (use_post_id1 IS NULL OR use_post_id1 = 0 ) AND post_id > 0" );
205
 
206
- // 過去バージョンからのコンバート(生存確認用のデータ作成)
207
- $result = $wpdb->get_results("UPDATE $this->db_name SET update_result = 200 WHERE update_result IS NULL OR update_result = 0" );
208
- $result = $wpdb->get_results("UPDATE $this->db_name SET alive_result = update_result , alive_time = update_time WHERE alive_result IS NULL OR alive_result = 0 OR alive_time = 0" );
209
- $result = $wpdb->get_results("UPDATE $this->db_name SET alive_nexttime = alive_time WHERE alive_nexttime IS NULL OR alive_nexttime = 0" );
210
-
211
- // 過去バージョンからのコンバート(取得時テキストの作成)
212
- $result = $wpdb->get_results("UPDATE $this->db_name SET regist_title = title , regist_excerpt = excerpt , regist_time = update_time , regist_result = update_result , regist_charset = charset WHERE (regist_title = NULL AND regist_excerpt = NULL ) AND (title <> NULL OR excerpt <> NULL )" );
213
-
214
- // 過去バージョンからのコンバート(次回SNS取得日時)
215
- $result = $wpdb->get_results("UPDATE $this->db_name SET sns_time = update_time , sns_nexttime = nexttime WHERE sns_nexttime = 0" );
216
-
217
- // 未使用になった列を削除する
218
- $drop_field = array('link_type' , 'location' , 'post_id' , 'post_date' , 'address' , 'means' , 'nexttime' , 'regist' , 'result_code' , 'uptime' );
219
- foreach($drop_field as $name ) {
220
- $result = $wpdb->query("ALTER TABLE $this->db_name DROP COLUMN ".$name );
221
- }
222
-
223
  // 文字コードの表記ぶれを修正
224
  $result = $wpdb->get_results("UPDATE $this->db_name SET charset = 'UTF-8' WHERE charset like 'UTF-8%'" );
225
  $result = $wpdb->get_results("UPDATE $this->db_name SET charset = 'EUC-JP' WHERE charset like 'EUC-JP%'" );
116
  charset VARCHAR(32) DEFAULT NULL,
117
  thumbnail VARCHAR(2048) DEFAULT NULL,
118
  favicon VARCHAR(2048) DEFAULT NULL,
119
+ post_date BIGINT UNSIGNED NOT NULL DEFAULT 0,
120
+ post_modified BIGINT UNSIGNED NOT NULL DEFAULT 0,
121
  no_failure INT UNSIGNED DEFAULT 0,
122
  alive_result INT DEFAULT -1,
123
  alive_time BIGINT UNSIGNED NOT NULL DEFAULT 0,
205
  // 古い項目から新しい項目へ転記(post_id → use_post_id1)
206
  $result = $wpdb->get_results("UPDATE $this->db_name SET use_post_id1 = post_id , post_id = 0 WHERE (use_post_id1 IS NULL OR use_post_id1 = 0 ) AND post_id > 0" );
207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  // 文字コードの表記ぶれを修正
209
  $result = $wpdb->get_results("UPDATE $this->db_name SET charset = 'UTF-8' WHERE charset like 'UTF-8%'" );
210
  $result = $wpdb->get_results("UPDATE $this->db_name SET charset = 'EUC-JP' WHERE charset like 'EUC-JP%'" );
lib/pz-linkcard-settings-admin.php CHANGED
@@ -64,6 +64,18 @@
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 ) ) { ?>
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
+ <tr>
68
+ <th scope="row"><?php echo __('WordPress', $this->text_domain ).' '.__('Version', $this->text_domain ); ?></th>
69
+ <td><input type="text" size="20" value="<?php echo bloginfo('version' ); ?>" readonly="readonly" ?></td>
70
+ </tr>
71
+ <tr>
72
+ <th scope="row"><?php echo __('PHP', $this->text_domain ).' '.__('Version', $this->text_domain ); ?></th>
73
+ <td><input type="text" size="20" value="<?php echo phpversion(); ?>" readonly="readonly" ?></td>
74
+ </tr>
75
+ <tr>
76
+ <th scope="row"><?php echo __('DB', $this->text_domain ).' '.__('Version', $this->text_domain ); ?></th>
77
+ <td><input type="text" size="20" value="<?php global $wpdb; echo $wpdb->db_version(); ?>" readonly="readonly" ?></td>
78
+ </tr>
79
  </table>
80
 
81
  <?php if (isset($cron_log ) ) { ?>
lib/pz-linkcard-settings.php CHANGED
@@ -248,10 +248,13 @@
248
  <p><a href="<?php echo esc_attr($plugin_url ); ?>" rel="external noopener" target="_blank"><?php echo esc_attr($plugin_url ); ?></a></p>
249
  </td>
250
  </tr>
251
-
252
- <tr class="pz-lkc-admin-only">
253
- <th scope="row"><?php _e('PHP Version', $this->text_domain ); ?></th>
254
- <td><input type="text" size="20" value="<?php echo phpversion(); ?>" readonly="readonly" ?></td>
 
 
 
255
  </tr>
256
 
257
  <tr class="pz-lkc-admin-only">
@@ -274,7 +277,6 @@
274
  <th scope="row"><?php _e('Plugin Path', $this->text_domain ); ?></th>
275
  <td><input name="properties[plugin-path]" type="text" size="80" value="<?php echo esc_attr($this->options['plugin-path'] ); ?>" readonly="readonly" <?php if ($this->options['admin-mode'] ) { echo 'ondblclick="this.readOnly=false;" '; }?>/></td>
276
  </tr>
277
-
278
  <tr class="pz-lkc-admin-only">
279
  <th scope="row"><?php _e('Author Name', $this->text_domain ); ?></th>
280
  <td><input name="properties[author-name]" type="text" size="40" value="<?php echo esc_attr($this->options['author-name'] ); ?>" readonly="readonly" <?php if ($this->options['admin-mode'] ) { echo 'ondblclick="this.readOnly=false;" '; }?>/></td>
@@ -283,18 +285,11 @@
283
  <th scope="row"><?php _e('Author Twitter', $this->text_domain ); ?></th>
284
  <td><input name="properties[author-twitter]" type="text" size="40" value="<?php echo esc_attr($this->options['author-twitter'] ); ?>" readonly="readonly" <?php if ($this->options['admin-mode'] ) { echo 'ondblclick="this.readOnly=false;" '; }?>/></td>
285
  </tr>
286
- <tr>
287
- <th scope="row"><?php _e("Author's Site", $this->text_domain ); ?></th>
288
- <td><?php echo __('Popozure.', $this->text_domain ).' ('.__("Poporon's PC Daily Diary", $this->text_domain ).')'; ?><BR><a href="<?php echo $url; ?>" rel="external noopener" target="_blank"><?php echo $url; ?></A></td>
289
- </tr>
290
- <tr>
291
- <th scope="row"><?php _e('When in Trouble', $this->text_domain ); ?></th>
292
- <td><?php echo __('Twitter Account', $this->text_domain ); ?><BR><a href="https://twitter.com/<?php echo $this->options['author-twitter']; ?>" rel="external noopener" target="_blank">@<?php echo $this->options['author-twitter']; ?></A></td>
293
- </tr>
294
  <tr class="pz-lkc-admin-only">
295
  <th scope="row"><?php _e('Donation', $this->text_domain ); ?></th>
296
  <td><a href="https://www.amazon.co.jp/gp/registry/wishlist/2KIBQLC1VLA9X" rel="external noopenner noreferrer" target="_blank" target="_blank"><?php _e('Wishlist', $this->text_domain ); ?></a></td>
297
  </tr>
 
298
  </table>
299
  <div class="pz-lkc-changelog-tab">
300
  <?php _e('Changelog', $this->text_domain ); ?>
248
  <p><a href="<?php echo esc_attr($plugin_url ); ?>" rel="external noopener" target="_blank"><?php echo esc_attr($plugin_url ); ?></a></p>
249
  </td>
250
  </tr>
251
+ <tr>
252
+ <th scope="row"><?php _e("Author's Site", $this->text_domain ); ?></th>
253
+ <td><?php echo __('Popozure.', $this->text_domain ).' ('.__("Poporon's PC Daily Diary", $this->text_domain ).')'; ?><BR><a href="<?php echo $url; ?>" rel="external noopener" target="_blank"><?php echo $url; ?></A></td>
254
+ </tr>
255
+ <tr>
256
+ <th scope="row"><?php _e('When in Trouble', $this->text_domain ); ?></th>
257
+ <td><?php echo __('Twitter Account', $this->text_domain ); ?><BR><a href="https://twitter.com/<?php echo $this->options['author-twitter']; ?>" rel="external noopener" target="_blank">@<?php echo $this->options['author-twitter']; ?></A></td>
258
  </tr>
259
 
260
  <tr class="pz-lkc-admin-only">
277
  <th scope="row"><?php _e('Plugin Path', $this->text_domain ); ?></th>
278
  <td><input name="properties[plugin-path]" type="text" size="80" value="<?php echo esc_attr($this->options['plugin-path'] ); ?>" readonly="readonly" <?php if ($this->options['admin-mode'] ) { echo 'ondblclick="this.readOnly=false;" '; }?>/></td>
279
  </tr>
 
280
  <tr class="pz-lkc-admin-only">
281
  <th scope="row"><?php _e('Author Name', $this->text_domain ); ?></th>
282
  <td><input name="properties[author-name]" type="text" size="40" value="<?php echo esc_attr($this->options['author-name'] ); ?>" readonly="readonly" <?php if ($this->options['admin-mode'] ) { echo 'ondblclick="this.readOnly=false;" '; }?>/></td>
285
  <th scope="row"><?php _e('Author Twitter', $this->text_domain ); ?></th>
286
  <td><input name="properties[author-twitter]" type="text" size="40" value="<?php echo esc_attr($this->options['author-twitter'] ); ?>" readonly="readonly" <?php if ($this->options['admin-mode'] ) { echo 'ondblclick="this.readOnly=false;" '; }?>/></td>
287
  </tr>
 
 
 
 
 
 
 
 
288
  <tr class="pz-lkc-admin-only">
289
  <th scope="row"><?php _e('Donation', $this->text_domain ); ?></th>
290
  <td><a href="https://www.amazon.co.jp/gp/registry/wishlist/2KIBQLC1VLA9X" rel="external noopenner noreferrer" target="_blank" target="_blank"><?php _e('Wishlist', $this->text_domain ); ?></a></td>
291
  </tr>
292
+
293
  </table>
294
  <div class="pz-lkc-changelog-tab">
295
  <?php _e('Changelog', $this->text_domain ); ?>
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.5.3
7
  Author: Poporon
8
  Author URI: http://poporon.poponet.jp
9
  Text Domain: pz-linkcard
@@ -16,7 +16,7 @@ class class_pz_linkcard {
16
  // 設定値
17
  protected $defaults =
18
  array(
19
- 'plugin-version' => '2.4.5.3',
20
  'plugin-name' => 'Pz-LinkCard',
21
  'plugin-abbreviation' => 'Pz-LkC',
22
  'plugin-path' => '/pz-linkcard',
@@ -255,6 +255,7 @@ class class_pz_linkcard {
255
  }
256
 
257
  // バージョンが違っていたら、DBとオプションを更新する
 
258
  if ($this->options['plugin-version'] <> $this->defaults['plugin-version'] ) {
259
  $this->activate();
260
  }
@@ -511,13 +512,14 @@ class class_pz_linkcard {
511
  $excerpt = null;
512
  $thumbnail_url = null;
513
  $favicon_url = null;
 
 
514
  $update_result = null;
515
  $sns_tw = null;
516
  $sns_fb = null;
517
  $sns_hb = null;
518
  $sns_po = null;
519
  $alive_result = null;
520
- $post_date = null;
521
 
522
  // モバイルチェック
523
  if (function_exists('wp_is_mobile' ) && wp_is_mobile() ) {
@@ -628,6 +630,7 @@ class class_pz_linkcard {
628
  $site_name = isset($data['site_name'] ) ? $data['site_name'] : null ;
629
  $thumbnail_url = isset($data['thumbnail'] ) ? $data['thumbnail'] : null ;
630
  $post_date = isset($data['post_date'] ) ? $data['post_date'] : null ;
 
631
  $update_result = isset($data['update_result'] ) ? $data['update_result'] : null ;
632
  $alive_result = isset($data['alive_result'] ) ? $data['alive_result'] : null ;
633
  $no_failure = !empty($data['no_failure'] ) ? true : false ;
@@ -1529,6 +1532,7 @@ class class_pz_linkcard {
1529
  $thumbnail = null;
1530
  $favicon = null;
1531
  $post_date = 0;
 
1532
 
1533
  // サイト名取得
1534
  $site_name = get_bloginfo('name' );
@@ -1567,6 +1571,7 @@ class class_pz_linkcard {
1567
  $excerpt = $post->post_excerpt; // 抜粋文
1568
  }
1569
  $post_date = $post->post_date; // 投稿日
 
1570
  $thumbnail_id = get_post_thumbnail_id($post_id ); // サムネイル
1571
  if ($thumbnail_id ) {
1572
  $thumbnail_size = $this->options['in-thumbnail-size'] ? $this->options['in-thumbnail-size'] : 'thumbnail' ;
@@ -1584,6 +1589,7 @@ class class_pz_linkcard {
1584
  $title = get_bloginfo('name' );
1585
  $excerpt = get_bloginfo('description' );
1586
  $post_date = 0;
 
1587
  $thumbnail = null;
1588
 
1589
  // カテゴリ ページの処理
@@ -1685,6 +1691,7 @@ class class_pz_linkcard {
1685
  $data['favicon'] = $favicon;
1686
  $data['use_post_id1'] = $post_id;
1687
  $data['post_date'] = $post_date;
 
1688
  return $data;
1689
  }
1690
 
@@ -2363,6 +2370,11 @@ class class_pz_linkcard {
2363
  include('lib/pz-linkcard-init.php' );
2364
  }
2365
 
 
 
 
 
 
2366
  // 管理画面>プラグイン>停止
2367
  public function deactivate() {
2368
  wp_clear_scheduled_hook('pz_linkcard_check' );
3
  Plugin Name: Pz-LinkCard
4
  Plugin URI: http://poporon.poponet.jp/pz-linkcard
5
  Description: リンクをカード形式で表示します。
6
+ Version: 2.4.5.4
7
  Author: Poporon
8
  Author URI: http://poporon.poponet.jp
9
  Text Domain: pz-linkcard
16
  // 設定値
17
  protected $defaults =
18
  array(
19
+ 'plugin-version' => '2.4.5.4',
20
  'plugin-name' => 'Pz-LinkCard',
21
  'plugin-abbreviation' => 'Pz-LkC',
22
  'plugin-path' => '/pz-linkcard',
255
  }
256
 
257
  // バージョンが違っていたら、DBとオプションを更新する
258
+ add_action ('upgrader_process_complete', array($this, 'upgrade' ) ); // アップデート
259
  if ($this->options['plugin-version'] <> $this->defaults['plugin-version'] ) {
260
  $this->activate();
261
  }
512
  $excerpt = null;
513
  $thumbnail_url = null;
514
  $favicon_url = null;
515
+ $post_date = null;
516
+ $post_modified = null;
517
  $update_result = null;
518
  $sns_tw = null;
519
  $sns_fb = null;
520
  $sns_hb = null;
521
  $sns_po = null;
522
  $alive_result = null;
 
523
 
524
  // モバイルチェック
525
  if (function_exists('wp_is_mobile' ) && wp_is_mobile() ) {
630
  $site_name = isset($data['site_name'] ) ? $data['site_name'] : null ;
631
  $thumbnail_url = isset($data['thumbnail'] ) ? $data['thumbnail'] : null ;
632
  $post_date = isset($data['post_date'] ) ? $data['post_date'] : null ;
633
+ $post_modified = isset($data['post_modified'] ) ? $data['post_modified'] : null ;
634
  $update_result = isset($data['update_result'] ) ? $data['update_result'] : null ;
635
  $alive_result = isset($data['alive_result'] ) ? $data['alive_result'] : null ;
636
  $no_failure = !empty($data['no_failure'] ) ? true : false ;
1532
  $thumbnail = null;
1533
  $favicon = null;
1534
  $post_date = 0;
1535
+ $post_fodified = 0;
1536
 
1537
  // サイト名取得
1538
  $site_name = get_bloginfo('name' );
1571
  $excerpt = $post->post_excerpt; // 抜粋文
1572
  }
1573
  $post_date = $post->post_date; // 投稿日
1574
+ $post_modified = $post->post_modified; // 更新日
1575
  $thumbnail_id = get_post_thumbnail_id($post_id ); // サムネイル
1576
  if ($thumbnail_id ) {
1577
  $thumbnail_size = $this->options['in-thumbnail-size'] ? $this->options['in-thumbnail-size'] : 'thumbnail' ;
1589
  $title = get_bloginfo('name' );
1590
  $excerpt = get_bloginfo('description' );
1591
  $post_date = 0;
1592
+ $post_modified = 0;
1593
  $thumbnail = null;
1594
 
1595
  // カテゴリ ページの処理
1691
  $data['favicon'] = $favicon;
1692
  $data['use_post_id1'] = $post_id;
1693
  $data['post_date'] = $post_date;
1694
+ $data['post_modified'] = $post_modified;
1695
  return $data;
1696
  }
1697
 
2370
  include('lib/pz-linkcard-init.php' );
2371
  }
2372
 
2373
+ // プラグイン更新時
2374
+ public function upgrade() {
2375
+ $this->activate();
2376
+ }
2377
+
2378
  // 管理画面>プラグイン>停止
2379
  public function deactivate() {
2380
  wp_clear_scheduled_hook('pz_linkcard_check' );
readme.txt CHANGED
@@ -151,8 +151,16 @@ Ver.2.1.2から200px四方に変更、Ver.2.4.1から自由に指定できるよ
151
 
152
  == Changelog ==
153
 
 
 
 
 
 
 
 
 
154
  = 2.4.5.3 =
155
- * 相対指定のURLを使用した場合に致命的エラーが出る不具合を修正しました。(Thanks @wiashia on Twitter)
156
  Fixed: Fixed a bug that caused a fatal error when using a relative URL.
157
 
158
  = 2.4.5.2 =
151
 
152
  == Changelog ==
153
 
154
+ = 2.4.5.4 =
155
+ * プラグインのアンインストールが失敗する不具合を修正。
156
+ Fixed: Fixed a bug that caused uninstallation to fail.
157
+ * 管理画面に記事情報が登録されない不具合を修正。(Thanks @OrganicRelife on Twitter)
158
+ Fixed: Fixed a bug that article information could not be cached.
159
+ * 管理画面で入力したページ数に移動しなかったのを修正。
160
+ Fixed: Fixed a bug that prevented moving by specifying the number of pages.
161
+
162
  = 2.4.5.3 =
163
+ * 相対指定のURLを使用した場合に致命的エラーが出る不具合を修正。(Thanks @wiashia on Twitter)
164
  Fixed: Fixed a bug that caused a fatal error when using a relative URL.
165
 
166
  = 2.4.5.2 =
templete/pz-linkcard-templete.css CHANGED
@@ -3,7 +3,7 @@
3
  /*MARGIN-BOTTOM*/
4
  /*MARGIN-LEFT*/
5
  /*MARGIN-RIGHT*/
6
- }//testtest
7
  .linkcard img {
8
  /*RESET-IMG*/
9
  }
3
  /*MARGIN-BOTTOM*/
4
  /*MARGIN-LEFT*/
5
  /*MARGIN-RIGHT*/
6
+ }
7
  .linkcard img {
8
  /*RESET-IMG*/
9
  }
uninstall.php CHANGED
@@ -1,32 +1,34 @@
1
- <?php if (!function_exists('get_option' ) ) die; ?>
2
  <?php
3
  // パラメータ準備
4
- $slug = basename(dirname(__FILE__));
5
- $wp_upload_dir = wp_upload_dir();
6
- $upload_dir_path = $wp_upload_dir['basedir'].'/'.$slug.'/';
7
-
8
- // ディレクトリの削除(画像キャッシュ、スタイルシート)
9
- $result = remove_directory($upload_dir_path);
10
 
11
  // 設定の削除
12
- delete_option('Pz_LinkCard_options');
13
 
14
  // DBの削除
15
- global $wpdb;
16
- $sql = "DROP TABLE ".$wpdb->prefix.'pz_linkcard';
17
- $wpdb->query($sql);
 
 
 
 
18
 
19
  // ディレクトリの削除
20
- function remove_directory($dir) {
 
 
 
21
  $files = array_diff(scandir($dir), array('.','..'));
22
- foreach ($files as $file) {
23
- if (is_dir($dir.'/'.$file)) {
24
- remove_directory($dir.'/'.$file);
25
  } else {
26
- unlink($dir.'/'.$file);
27
- echo 'delete "'.$dir.'/'.$file.'"<br>';
28
  }
29
  }
30
- echo 'rmdir "'.$dir.'"<br>';
31
- return rmdir($dir);
32
  }
1
+ <?php defined('ABSPATH' ) || wp_die; ?>
2
  <?php
3
  // パラメータ準備
4
+ $slug = basename(dirname(__FILE__ ) );
5
+ $wp_upload_dir = wp_upload_dir();
6
+ $upload_dir_path = $wp_upload_dir['basedir'].'/'.$slug;
 
 
 
7
 
8
  // 設定の削除
9
+ delete_option('Pz_LinkCard_options' );
10
 
11
  // DBの削除
12
+ global $wpdb;
13
+ $db_name = $wpdb->prefix.'pz_linkcard';
14
+ $sql = "DROP TABLE ".$db_name;
15
+ $wpdb->query($sql );
16
+
17
+ // ディレクトリの削除(画像キャッシュ、スタイルシート)
18
+ $result = remove_directory($upload_dir_path );
19
 
20
  // ディレクトリの削除
21
+ function remove_directory($dir ) {
22
+ if (mb_substr($dir, -1, 1) <> '/' ) {
23
+ $dir = $dir.'/';
24
+ }
25
  $files = array_diff(scandir($dir), array('.','..'));
26
+ foreach ($files as $file ) {
27
+ if (is_dir($dir.$file ) ) {
28
+ remove_directory($dir.$file);
29
  } else {
30
+ unlink($dir.$file );
 
31
  }
32
  }
33
+ return rmdir($dir );
 
34
  }