VK All in One Expansion Unit - Version 9.42.1.0

Version Description

[ Bug fix ] Fix Customize error ( ad vk customize helpers )

Download this release

Release Info

Developer kurudrive
Plugin Icon 128x128 VK All in One Expansion Unit
Version 9.42.1.0
Comparing to
See all releases

Code changes from version 9.42.0.0 to 9.42.1.0

inc/term-color/package/class.term-color.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ このファイルの元ファイルは
5
+ https://github.com/vektor-inc/vektor-wp-libraries
6
+ にあります。修正の際は上記リポジトリのデータを修正してください。
7
+ */
8
+
9
+ if ( ! class_exists( 'Vk_term_color' ) ) {
10
+
11
+ class Vk_term_color {
12
+
13
+ /*
14
+ REGISTER TERM META
15
+ /*-------------------------------------------*/
16
+
17
+ function term_meta_color() {
18
+
19
+ register_meta( 'term', 'term_color', array( $this, 'sanitize_hex' ) );
20
+ }
21
+
22
+ /*
23
+ SANITIZE DATA
24
+ /*-------------------------------------------*/
25
+
26
+ public static function sanitize_hex( $color ) {
27
+ // sanitize_hex_color() は undefined function くらう
28
+ $color = ltrim( $color, '#' );
29
+ return preg_match( '/([A-Fa-f0-9]{3}){1,2}$/', $color ) ? $color : '';
30
+ }
31
+
32
+ /*
33
+ タクソノミー新規追加ページでの日本語入力フォーム
34
+ /*-------------------------------------------*/
35
+ function taxonomy_add_new_meta_field_color() {
36
+
37
+ // this will add the custom meta field to the add new term page
38
+ ?>
39
+ <div class="form-field">
40
+ <?php wp_nonce_field( basename( __FILE__ ), 'term_color_nonce' ); ?>
41
+ <label for="term_color"><?php _e( 'Color', 'vk_term_color_textdomain' ); ?></label>
42
+ <input type="text" name="term_color" id="term_color" class="term_color" value="">
43
+ </div>
44
+ <?php
45
+ }
46
+
47
+ /*
48
+ タクソノミー編集ページでのフォーム
49
+ /*-------------------------------------------*/
50
+ function taxonomy_add_edit_meta_field_color( $term ) {
51
+
52
+ // put the term ID into a variable
53
+ $term_color = self::get_term_color( $term->term_id );
54
+ ?>
55
+ <tr class="form-field">
56
+ <th scope="row" valign="top"><label for="term_color"><?php _e( 'Color', 'vk_term_color_textdomain' ); ?></label></th>
57
+ <td>
58
+ <?php wp_nonce_field( basename( __FILE__ ), 'term_color_nonce' ); ?>
59
+ <input type="text" name="term_color" id="term_color" class="term_color" value="<?php echo $term_color; ?>">
60
+ </td>
61
+ </tr>
62
+ <?php
63
+ }
64
+
65
+ /*
66
+ カラーの保存処理
67
+ /*-------------------------------------------*/
68
+ // Save extra taxonomy fields callback function.
69
+ function save_term_meta_color( $term_id ) {
70
+
71
+ // verify the nonce --- remove if you don't care
72
+ if ( ! isset( $_POST['term_color_nonce'] ) || ! wp_verify_nonce( $_POST['term_color_nonce'], basename( __FILE__ ) ) ) {
73
+ return;
74
+ }
75
+
76
+ if ( isset( $_POST['term_color'] ) ) {
77
+ $now_value = get_term_meta( $term_id, 'term_color', true );
78
+ $new_value = $_POST['term_color'];
79
+ if ( $now_value != $new_value ) {
80
+ update_term_meta( $term_id, 'term_color', $new_value );
81
+ } else {
82
+ add_term_meta( $term_id, 'term_color', $new_value );
83
+ }
84
+ }
85
+ }
86
+
87
+ /*
88
+ 管理画面 _ カラーピッカーのスクリプトの読み込み
89
+ /*-------------------------------------------*/
90
+
91
+ function admin_enqueue_scripts( $hook_suffix ) {
92
+
93
+ // if ( 'edit-tags.php' !== $hook_suffix || 'category' !== get_current_screen()->taxonomy )
94
+ // return;
95
+
96
+ wp_enqueue_style( 'wp-color-picker' );
97
+ wp_enqueue_script( 'wp-color-picker' );
98
+
99
+ // add_action( 'admin_head', 'lmu_term_colors_print_styles' );
100
+ add_action( 'admin_footer', array( $this, 'term_colors_print_scripts' ) );
101
+ }
102
+
103
+ function term_colors_print_styles() {
104
+ ?>
105
+
106
+ <style type="text/css">
107
+ .column-color { width: 50px; }
108
+ .column-color .color-block { display: inline-block; width: 28px; height: 28px; border: 1px solid #ddd; }
109
+ </style>
110
+ <?php
111
+ }
112
+
113
+ function term_colors_print_scripts() {
114
+ ?>
115
+
116
+ <script type="text/javascript">
117
+ jQuery( document ).ready( function( $ ) {
118
+ $( '.term_color' ).wpColorPicker();
119
+ } );
120
+ </script>
121
+ <?php
122
+ }
123
+
124
+ /*
125
+ 管理画面 _ カテゴリー一覧でカラムの追加
126
+ /*-------------------------------------------*/
127
+
128
+ function edit_term_columns( $columns ) {
129
+
130
+ $columns['color'] = __( 'Color', 'vk_term_color_textdomain' );
131
+
132
+ return $columns;
133
+ }
134
+
135
+
136
+ function manage_term_custom_column( $out, $column, $term_id ) {
137
+
138
+ if ( 'color' === $column ) {
139
+
140
+ $color = self::get_term_color( $term_id );
141
+
142
+ if ( ! $color ) {
143
+ $color = '#ffffff';
144
+ }
145
+
146
+ $out = sprintf( '<span class="color-block" style="background:%s;">&nbsp;</span>', esc_attr( $color ) );
147
+ }
148
+
149
+ return $out;
150
+ }
151
+
152
+ /*
153
+ termのカラーを取得
154
+ /*-------------------------------------------*/
155
+ public static function get_term_color( $term_id ) {
156
+ $term_color_default = '#999999';
157
+ $term_color_default = apply_filters( 'term_color_default_custom', $term_color_default );
158
+ if ( isset( $term_id ) ) {
159
+ $term_color = self::sanitize_hex( get_term_meta( $term_id, 'term_color', true ) );
160
+ $term_color = ( $term_color ) ? '#' . $term_color : $term_color_default;
161
+ } else {
162
+ $term_color = $term_color_default;
163
+ }
164
+ return $term_color;
165
+ }
166
+
167
+ /*
168
+ termのカラーを取得
169
+ /*-------------------------------------------*/
170
+ public static function get_single_term_with_color( $post = '', $args = array() ) {
171
+ if ( ! $post ) {
172
+ global $post;
173
+ }
174
+
175
+ $args_default = array(
176
+ 'class' => '',
177
+ 'link' => false,
178
+ );
179
+ $args = wp_parse_args( $args, $args_default );
180
+
181
+ $outer_class = '';
182
+ if ( ! empty( $args['class'] ) ) {
183
+ $outer_class = ' class="' . esc_attr( $args['class'] ) . '"';
184
+ }
185
+
186
+ $taxonomies = get_the_taxonomies();
187
+ $exclusion = array( 'post_tag', 'product_type' );
188
+ // * vk_exclude_term_list is used in lightning too.
189
+ $exclusion = apply_filters( 'vk_get_display_taxonomies_exclusion', $exclusion );
190
+ if ( is_array( $exclusion ) ) {
191
+ foreach ( $exclusion as $key => $value ) {
192
+ unset( $taxonomies[ $value ] );
193
+ }
194
+ }
195
+
196
+ $single_term_with_color = '';
197
+ if ( $taxonomies ) :
198
+ // get $taxonomy name
199
+ $taxonomy = key( $taxonomies );
200
+ $terms = get_the_terms( $post->ID, $taxonomy );
201
+ if ( ! $terms ) {
202
+ return;
203
+ }
204
+ $term_name = esc_html( $terms[0]->name );
205
+ $term_url = esc_url( get_term_link( $terms[0]->term_id, $taxonomy ) );
206
+ $term_color = self::get_term_color( $terms[0]->term_id );
207
+ $term_color = ( $term_color ) ? ' style="color:#fff;background-color:' . $term_color . '"' : '';
208
+
209
+ if ( $args['link'] ) {
210
+ $single_term_with_color .= '<a' . $outer_class . $term_color . ' href="' . esc_url( $term_url ) . '">';
211
+ } else {
212
+ $single_term_with_color .= '<span' . $outer_class . $term_color . '>';
213
+ }
214
+
215
+ $single_term_with_color .= $term_name;
216
+
217
+ if ( $args['link'] ) {
218
+ $single_term_with_color .= '</a>';
219
+ } else {
220
+ $single_term_with_color .= '</span>';
221
+ }
222
+
223
+ endif;
224
+ return $single_term_with_color;
225
+ }
226
+
227
+ /*
228
+ term color を有効化する taxonomy
229
+ /*-------------------------------------------*/
230
+ public function get_term_color_taxonomies() {
231
+ /*
232
+ 最初Global変数指定をしていたが、 Global変数では
233
+ 複数の term color が存在した場合に実行タイミングの都合上任意に指定が効かないため、
234
+ フックでの指定を行う
235
+ */
236
+ global $vk_term_color_taxonomies;
237
+ if ( $vk_term_color_taxonomies ) {
238
+ $taxonomies = $vk_term_color_taxonomies;
239
+ } else {
240
+ $taxonomies = array( 'category', 'post_tag' );
241
+ }
242
+ $taxonomies = apply_filters( 'term_color_taxonomies_custom', $taxonomies );
243
+ // 重複の値を削除
244
+ $taxonomies = array_unique( $taxonomies );
245
+ // 特に影響はないがキーを振り直す
246
+ $taxonomies = array_values( $taxonomies );
247
+ return $taxonomies;
248
+ }
249
+ /*
250
+ 実行
251
+ /*-------------------------------------------*/
252
+ public function __construct() {
253
+ add_action( 'init', array( $this, 'term_meta_color' ) );
254
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
255
+
256
+ /*
257
+ 管理画面 _ 各種処理発火
258
+ /*-------------------------------------------*/
259
+ // カラーピッカーを追加するタクソノミー
260
+
261
+ $taxonomies = self::get_term_color_taxonomies();
262
+
263
+ // 該当のタクソノミー分ループ処理する
264
+ foreach ( $taxonomies as $key => $value ) {
265
+ add_action( $value . '_add_form_fields', array( $this, 'taxonomy_add_new_meta_field_color' ), 10, 2 );
266
+ add_action( $value . '_edit_form_fields', array( $this, 'taxonomy_add_edit_meta_field_color' ), 10, 2 );
267
+ add_action( 'edited_' . $value, array( $this, 'save_term_meta_color' ), 10, 2 );
268
+ add_action( 'create_' . $value, array( $this, 'save_term_meta_color' ), 10, 2 );
269
+ add_filter( 'manage_edit-' . $value . '_columns', array( $this, 'edit_term_columns' ) );
270
+ add_filter( 'manage_' . $value . '_custom_column', array( $this, 'manage_term_custom_column' ), 10, 3 );
271
+ }
272
+ }
273
+ }
274
+
275
+ $Vk_term_color = new Vk_term_color();
276
+
277
+ }
inc/term-color/readme.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## 使い方
2
+
3
+ 1. term-color-config.php を term-color を使用するプラグインディレクトリに複製
4
+ 1. term-color-config.php の中身をプラグインの情報にあわせて書き換える
5
+ 1. プラグインが最初に読み込むPHPファイルなどから require_once( 'inc/term-color-config.php' ); などで読み込む
6
+ 1. termの色を表示したいテンプレートに以下のように記述
7
+
8
+ ~~~
9
+ $taxonomies = get_the_taxonomies();
10
+ if ($taxonomies):
11
+ // get $taxonomy name
12
+ $taxonomy = key( $taxonomies );
13
+ $terms = get_the_terms( get_the_ID(),$taxonomy );
14
+ $term_name = esc_html($terms[0]->name);
15
+ $term_color = Vk_term_color::get_term_color( $terms[0]->term_id );
16
+ $term_color = ( $term_color ) ? ' style="background-color:'.$term_color.'"': '';
17
+ $term_link = esc_url( get_term_link( $terms[0]->term_id, $taxonomy ) );
18
+ $term = '<a class="padCate"'.$term_color.' href="'.$term_link.'">'.$term_name.'</a>';
19
+ endif;
20
+ ~~~
inc/term-color/term-color-config.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**********************************************/
4
+ // Load modules
5
+ /**********************************************/
6
+
7
+ /*
8
+ 色選択機能をつける対象のタームの指定
9
+ */
10
+
11
+ // ★★★★★★ 関数のprefixは固有のものに変更する事 ★★★★★★
12
+ // add_filter( 'term_color_taxonomies_custom', 'fort_term_color_taxonomies_custom', 10.2 );
13
+ // function fort_term_color_taxonomies_custom( $taxonomies ) {
14
+ // $taxonomies[] = 'category';
15
+ // $taxonomies[] = 'post_tags';
16
+ // return $taxonomies;
17
+ // }
18
+ if ( ! class_exists( 'Vk_term_color' ) ) {
19
+
20
+ /*
21
+ 読み込みタイミングをafter_setup_themeにしておかないと
22
+ テーマから対象taxonomyの指定がある場合に効かない
23
+ ★★★★★★ 関数のprefixは固有のものに変更する事 ★★★★★★
24
+ */
25
+ add_action( 'after_setup_theme', 'veu_load_term_color' );
26
+ function veu_load_term_color() {
27
+ require_once 'package/class.term-color.php';
28
+ }
29
+ }
inc/vk-customize-helpers/package/vk-customize-helpers.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action( 'customize_register', 'vk_register_customize_helpers', 1 );
3
+ if ( ! function_exists( 'vk_register_customize_helpers' ) ){
4
+ function vk_register_customize_helpers( $wp_customize ) {
5
+ /* Add text control description
6
+ /*-------------------------------------------*/
7
+ if ( ! class_exists( 'Custom_Text_Control' ) ) {
8
+ class Custom_Text_Control extends WP_Customize_Control {
9
+ public $type = 'customtext';
10
+ public $description = ''; // we add this for the extra description
11
+ public $input_before = '';
12
+ public $input_after = '';
13
+ public function render_content() {
14
+ ?>
15
+ <label>
16
+ <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
17
+ <?php $style = ( $this->input_before || $this->input_after ) ? ' style="width:50%"' : ''; ?>
18
+ <div>
19
+ <?php echo wp_kses_post( $this->input_before ); ?>
20
+ <input type="text" value="<?php echo esc_attr( $this->value() ); ?>"<?php echo $style; ?> <?php $this->link(); ?> />
21
+ <?php echo wp_kses_post( $this->input_after ); ?>
22
+ </div>
23
+ <div><?php echo $this->description; ?></div>
24
+ </label>
25
+ <?php
26
+ } // public function render_content() {
27
+ } // class Custom_Text_Control extends WP_Customize_Control
28
+ }
29
+
30
+ if ( ! class_exists( 'Custom_Html_Control' ) ) {
31
+ class Custom_Html_Control extends WP_Customize_Control {
32
+ public $type = 'customtext';
33
+ public $custom_title_sub = ''; // we add this for the extra custom_html
34
+ public $custom_html = ''; // we add this for the extra custom_html
35
+ public function render_content() {
36
+ if ( $this->label ) {
37
+ echo '<h2 class="admin-custom-h2">' . wp_kses_post( $this->label ) . '</h2>';
38
+ }
39
+ if ( $this->custom_title_sub ) {
40
+ echo '<h3 class="admin-custom-h3">' . wp_kses_post( $this->custom_title_sub ) . '</h3>';
41
+ }
42
+ if ( $this->custom_html ) {
43
+ echo '<div>' . wp_kses_post( $this->custom_html ) . '</div>';
44
+ }
45
+ } // public function render_content() {
46
+ } // class Custom_Html_Control extends WP_Customize_Control {
47
+ }
48
+ }
49
+ }
inc/vk-customize-helpers/vk-customize-helpers-config.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ if ( ! class_exists( 'Custom_Text_Control' ) ) {
3
+ require_once plugin_dir_path( __FILE__ ) . 'package/vk-customize-helpers.php';
4
+ }
initialize.php CHANGED
@@ -12,8 +12,10 @@ require veu_get_directory() . '/veu-package-manager.php';
12
  // template-tags-veuでpackageの関数を使うので package-managerを先に読み込んでいる
13
  require_once veu_get_directory() . '/inc/template-tags/template-tags-config.php';
14
  require_once veu_get_directory() . '/inc/vk-css-optimize/vk-css-optimize-config.php';
 
15
  require_once veu_get_directory() . '/inc/common-block.php';
16
  require_once veu_get_directory() . '/admin/admin.php';
 
17
  require veu_get_directory() . '/inc/footer-copyright-change.php';
18
 
19
  veu_package_include(); // package_manager.php
12
  // template-tags-veuでpackageの関数を使うので package-managerを先に読み込んでいる
13
  require_once veu_get_directory() . '/inc/template-tags/template-tags-config.php';
14
  require_once veu_get_directory() . '/inc/vk-css-optimize/vk-css-optimize-config.php';
15
+ require_once veu_get_directory() . '/inc/vk-customize-helpers/vk-customize-helpers-config.php';
16
  require_once veu_get_directory() . '/inc/common-block.php';
17
  require_once veu_get_directory() . '/admin/admin.php';
18
+ require_once veu_get_directory() . '/inc/term-color/term-color-config.php';
19
  require veu_get_directory() . '/inc/footer-copyright-change.php';
20
 
21
  veu_package_include(); // package_manager.php
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: Google Analytics, New posts, Related Posts, sitemap, sns, twitter card, Facebook Page Plugin, OG tags,
5
  Requires at least: 5.0.0
6
  Tested up to: 5.5.1
7
- Stable tag: 9.42.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -81,6 +81,9 @@ e.g.
81
 
82
  == Changelog ==
83
 
 
 
 
84
  = 9.42.0.0 =
85
  [ Specification Change ][ CSS Optimize ] Change to common setting
86
 
4
  Tags: Google Analytics, New posts, Related Posts, sitemap, sns, twitter card, Facebook Page Plugin, OG tags,
5
  Requires at least: 5.0.0
6
  Tested up to: 5.5.1
7
+ Stable tag: 9.42.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
81
 
82
  == Changelog ==
83
 
84
+ = 9.42.1.0 =
85
+ [ Bug fix ] Fix Customize error ( ad vk customize helpers )
86
+
87
  = 9.42.0.0 =
88
  [ Specification Change ][ CSS Optimize ] Change to common setting
89
 
vkExUnit.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: VK All in One Expansion Unit
4
  * Plugin URI: https://ex-unit.nagoya
5
  * Description: This plug-in is an integrated plug-in with a variety of features that make it powerful your web site. Many features can be stopped individually. Example Facebook Page Plugin,Social Bookmarks,Print OG Tags,Print Twitter Card Tags,Print Google Analytics tag,New post widget,Insert Related Posts and more!
6
- * Version: 9.42.0.0
7
  * Author: Vektor,Inc.
8
  * Text Domain: vk-all-in-one-expansion-unit
9
  * Domain Path: /languages
3
  * Plugin Name: VK All in One Expansion Unit
4
  * Plugin URI: https://ex-unit.nagoya
5
  * Description: This plug-in is an integrated plug-in with a variety of features that make it powerful your web site. Many features can be stopped individually. Example Facebook Page Plugin,Social Bookmarks,Print OG Tags,Print Twitter Card Tags,Print Google Analytics tag,New post widget,Insert Related Posts and more!
6
+ * Version: 9.42.1.0
7
  * Author: Vektor,Inc.
8
  * Text Domain: vk-all-in-one-expansion-unit
9
  * Domain Path: /languages