Pz-LinkCard - Version 2.2.2

Version Description

Download this release

Release Info

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

Code changes from version 2.2.1 to 2.2.2

{js → img}/button.png RENAMED
File without changes
js/mce-pz-lkc.js DELETED
@@ -1,21 +0,0 @@
1
- (function() {
2
- tinymce.create('tinymce.plugins.pzlinkcard', {
3
- init: function(ed, url){
4
- ed.addButton('pz_linkcard',{
5
- title: 'Insert Pz-LinkCard',
6
- image: url + '/button.png',
7
- cmd: 'insert_pz_linkcard'
8
- });
9
- ed.addCommand('insert_pz_linkcard', function() {
10
- var insert_tag = window.prompt('Input URL', 'http://');
11
- if (insert_tag !== null) {
12
- ed.execCommand('mceInsertContent', 0, '[blogcard url="' + insert_tag + '"]');
13
- }
14
- });
15
- },
16
- createControl: function(n, cm) {
17
- return null;
18
- }
19
- });
20
- tinymce.PluginManager.add('pz_linkcard',tinymce.plugins.pzlinkcard);
21
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/pz-linkcard-js.php CHANGED
@@ -4,15 +4,22 @@
4
  return;
5
  }
6
 
7
- $temp_file = $this->plugin_dir_path.'templete/mce-pz-lkc-templete.js';
8
- $js_file = $this->plugin_dir_path.'js/mce-pz-lkc.js';
9
-
 
 
 
 
 
 
 
10
  $file_text = file_get_contents($temp_file);
11
  if ($file_text) {
12
  $file_text = str_replace('/*TITLE*/', __('Insert Pz-LinkCard', $this->text_domain), $file_text );
13
  $file_text = str_replace('/*PROMPT*/', __('Input URL', $this->text_domain), $file_text );
14
  $file_text = str_replace('/*CODE*/', $this->options['code1'], $file_text );
15
-
16
  $result = file_put_contents($js_file, $file_text );
17
  global $pagenow;
18
  if (isset($pagenow) && $pagenow == 'options-general.php') {
4
  return;
5
  }
6
 
7
+ $temp_file = $this->plugin_dir_path.'templete/mce-pz-lkc-templete.js';
8
+
9
+ $js_dir = $this->upload_dir_path.'js/';
10
+ if (!is_dir($js_dir)) {
11
+ wp_mkdir_p($js_dir);
12
+ }
13
+ $js_file = $js_dir.'mce-pz-lkc.js';
14
+
15
+ copy($this->plugin_dir_path.'img/button.png' , $js_dir.'button.png' );
16
+
17
  $file_text = file_get_contents($temp_file);
18
  if ($file_text) {
19
  $file_text = str_replace('/*TITLE*/', __('Insert Pz-LinkCard', $this->text_domain), $file_text );
20
  $file_text = str_replace('/*PROMPT*/', __('Input URL', $this->text_domain), $file_text );
21
  $file_text = str_replace('/*CODE*/', $this->options['code1'], $file_text );
22
+
23
  $result = file_put_contents($js_file, $file_text );
24
  global $pagenow;
25
  if (isset($pagenow) && $pagenow == 'options-general.php') {
lib/pz-linkcard-settings.php CHANGED
@@ -94,10 +94,9 @@
94
  $this->options['color-excerpt'] = '#'.$color_code;
95
 
96
  // サムネイルのキャッシュディレクトリの用意
97
- $wp_upload_dir = wp_upload_dir();
98
- $thumbnail_dir = $wp_upload_dir['basedir'].'/'.$this->slug.'/cache/';
99
- $thumbnail_url = $wp_upload_dir['baseurl'].'/'.$this->slug.'/cache/';
100
- if (!is_dir($thumbnail_dir)) {
101
  $thumbnail_dir = $this->plugin_dir_path.'cache/';
102
  $thumbnail_url = $this->plugin_dir_url .'cache/';
103
  if (!is_dir($thumbnail_dir)) {
94
  $this->options['color-excerpt'] = '#'.$color_code;
95
 
96
  // サムネイルのキャッシュディレクトリの用意
97
+ $thumbnail_dir = $this->upload_dir_path.'cache/';
98
+ $thumbnail_url = $this->upload_dir_url .'cache/';
99
+ if (!is_dir($thumbnail_dir) && !wp_mkdir_p($thumbnail_dir)) {
 
100
  $thumbnail_dir = $this->plugin_dir_path.'cache/';
101
  $thumbnail_url = $this->plugin_dir_url .'cache/';
102
  if (!is_dir($thumbnail_dir)) {
lib/pz-linkcard-style.php CHANGED
@@ -4,15 +4,12 @@
4
 
5
  // $css_file = plugin_dir_path(__FILE__).'style.css';
6
  // $css_url = plugin_dir_url(__FILE__).'style.css';
7
- $wp_upload_dir = wp_upload_dir();
8
- $css_dir = $wp_upload_dir['basedir'].'/'.$this->slug;
9
- $css_path = $wp_upload_dir['basedir'].'/'.$this->slug.'/style.css';
10
- $css_url = $wp_upload_dir['baseurl'].'/'.$this->slug.'/style.css';
11
- if (!is_dir($css_dir)) {
12
- if (!wp_mkdir_p($css_dir)) {
13
- $css_path = $wp_upload_dir['basedir'].'/'.$this->slug.'-style.css';
14
- $css_url = $wp_upload_dir['baseurl'].'/'.$this->slug.'-style.css';
15
- }
16
  }
17
  if (preg_match('/.*(\/\/.*)/', $css_url, $m)) {
18
  $css_url = $m[1];
4
 
5
  // $css_file = plugin_dir_path(__FILE__).'style.css';
6
  // $css_url = plugin_dir_url(__FILE__).'style.css';
7
+ $css_dir = $this->upload_dir_path;
8
+ $css_path = $this->upload_dir_path.'style.css';
9
+ $css_url = $this->upload_dir_url .'style.css';
10
+ if (!is_dir($css_dir) && !wp_mkdir_p($css_dir)) {
11
+ $css_path = $wp_upload_dir['basedir'].'/'.$this->slug.'-style.css';
12
+ $css_url = $wp_upload_dir['baseurl'].'/'.$this->slug.'-style.css';
 
 
 
13
  }
14
  if (preg_match('/.*(\/\/.*)/', $css_url, $m)) {
15
  $css_url = $m[1];
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.2.1
7
  Author: poporon
8
  Author URI: http://poporon.poponet.jp
9
  License: GPLv2 or later
@@ -12,22 +12,25 @@ License: GPLv2 or later
12
  defined('ABSPATH') || die;
13
 
14
  class Pz_LinkCard {
15
- public $slug; // slug
16
- public $text_domain; // as slug
17
 
18
- public $charset;
19
 
20
- public $amp; // Google AMP
21
 
22
- public $now; // 現在日時(ローカル時間)
23
- public $now_mysql; // 現在日時(SQL形式)
24
 
25
- public $plugin_basename;
26
- public $plugin_dir_path;
27
- public $plugin_dir_url;
28
- public $plugin_link; // link to plugin page
29
 
30
- private $db_name;
 
 
 
31
 
32
  public $options;
33
  protected $defaults = array(
@@ -165,7 +168,7 @@ class Pz_LinkCard {
165
  'invalid-time' => null,
166
  'plugin-link' => null,
167
  'plugin-name' => 'Pz-LinkCard',
168
- 'plugin-version' => '2.2.1',
169
  'plugin-url' => 'https://popozure.info/pz-linkcard',
170
  'pz-hbc-options' => null,
171
  'debug-time' => null
@@ -186,6 +189,10 @@ class Pz_LinkCard {
186
  $this->plugin_dir_path = plugin_dir_path(__FILE__);
187
  $this->plugin_dir_url = plugin_dir_url (__FILE__);
188
 
 
 
 
 
189
  $this->options = get_option('Pz_LinkCard_options', $this->defaults );
190
  foreach ($this->defaults as $key => $value) {
191
  if (!isset($this->options[$key])) {
@@ -209,7 +216,7 @@ class Pz_LinkCard {
209
 
210
  // ショートコードの設定
211
  if ($this->options['auto-atag'] || $this->options['auto-url']) {
212
- add_filter ('the_content', array($this, 'auto_replace'), 10 ); // 自動置き換え
213
  add_shortcode ('pz-linkcard-auto-replace', array($this, 'shortcode') ); // 自動置き換え専用ショートコード
214
  }
215
  if ($this->options['code1']) {
@@ -1648,7 +1655,7 @@ class Pz_LinkCard {
1648
  return $buttons;
1649
  }
1650
  public function add_mce_plugin($plugins) {
1651
- $plugins['pz_linkcard'] = $this->plugin_dir_url.'js/mce-pz-lkc.js';
1652
  return $plugins;
1653
  }
1654
 
3
  Plugin Name: Pz-LinkCard
4
  Plugin URI: http://poporon.poponet.jp/pz-linkcard
5
  Description: リンクをカード形式で表示します。
6
+ Version: 2.2.2
7
  Author: poporon
8
  Author URI: http://poporon.poponet.jp
9
  License: GPLv2 or later
12
  defined('ABSPATH') || die;
13
 
14
  class Pz_LinkCard {
15
+ public $slug; // スラッグ
16
+ public $text_domain; // テキスト ドメイン(スラッグと同じ内容)
17
 
18
+ public $charset; // 文字セット
19
 
20
+ public $amp; // Google AMP
21
 
22
+ public $now; // 現在日時(ローカル時間)
23
+ public $now_mysql; // 現在日時(SQL形式)
24
 
25
+ public $plugin_basename; // プラグイン ディレクトリの名前
26
+ public $plugin_dir_path; // プラグイン ディレクトリのパス
27
+ public $plugin_dir_url; // プラグイン ディレクトリのURL
28
+ public $plugin_link; // プラグインページのURL
29
 
30
+ public $upload_dir_path; // アップロード ディレクトリのパス
31
+ public $upload_dir_url; // アップロード ディレクトリのURL
32
+
33
+ private $db_name; // DB名
34
 
35
  public $options;
36
  protected $defaults = array(
168
  'invalid-time' => null,
169
  'plugin-link' => null,
170
  'plugin-name' => 'Pz-LinkCard',
171
+ 'plugin-version' => '2.2.2',
172
  'plugin-url' => 'https://popozure.info/pz-linkcard',
173
  'pz-hbc-options' => null,
174
  'debug-time' => null
189
  $this->plugin_dir_path = plugin_dir_path(__FILE__);
190
  $this->plugin_dir_url = plugin_dir_url (__FILE__);
191
 
192
+ $wp_upload_dir = wp_upload_dir();
193
+ $this->upload_dir_path = $wp_upload_dir['basedir'].'/'.$this->slug.'/';
194
+ $this->upload_dir_url = $wp_upload_dir['baseurl'].'/'.$this->slug.'/';
195
+
196
  $this->options = get_option('Pz_LinkCard_options', $this->defaults );
197
  foreach ($this->defaults as $key => $value) {
198
  if (!isset($this->options[$key])) {
216
 
217
  // ショートコードの設定
218
  if ($this->options['auto-atag'] || $this->options['auto-url']) {
219
+ add_filter ('the_content', array($this, 'auto_replace') ); // 自動置き換え
220
  add_shortcode ('pz-linkcard-auto-replace', array($this, 'shortcode') ); // 自動置き換え専用ショートコード
221
  }
222
  if ($this->options['code1']) {
1655
  return $buttons;
1656
  }
1657
  public function add_mce_plugin($plugins) {
1658
+ $plugins['pz_linkcard'] = $this->upload_dir_url.'js/mce-pz-lkc.js';
1659
  return $plugins;
1660
  }
1661
 
readme.txt CHANGED
@@ -163,6 +163,10 @@ A7.
163
  5. "Write shortcode and url"
164
 
165
  == Changelog ==
 
 
 
 
166
  Ver2.2.1
167
  * WordPress 5.0.1 での動作確認。
168
  Compatible with WordPress 5.0.1.
163
  5. "Write shortcode and url"
164
 
165
  == Changelog ==
166
+ Ver2.2.2
167
+ * ビジュアルエディタの挿入ボタンの仕組みを見直しました。
168
+ Modified: Review the mechanism of the insert button in the visual editor.
169
+
170
  Ver2.2.1
171
  * WordPress 5.0.1 での動作確認。
172
  Compatible with WordPress 5.0.1.