VK All in One Expansion Unit - Version 9.69.0.0

Version Description

  • [ Other ] Cope with Lightning G3 Pro Unit 404 Page customize
  • [ Design tuning ] metabox css tuning in edit screen
Download this release

Release Info

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

Code changes from version 9.68.4.0 to 9.69.0.0

assets/_scss/vkExUnit_admin.scss CHANGED
@@ -48,6 +48,10 @@
48
  }
49
 
50
  .veu_metabox_section {
 
 
 
 
51
  label {
52
  font-weight: normal;
53
  }
@@ -84,7 +88,10 @@
84
  }
85
  &_body {
86
  display: none;
87
- padding: 1rem 1rem 2rem;
 
 
 
88
  .button {
89
  margin-right:0.5em;
90
  }
48
  }
49
 
50
  .veu_metabox_section {
51
+ p {
52
+ margin-top:0;
53
+ margin-bottom:10px;
54
+ }
55
  label {
56
  font-weight: normal;
57
  }
88
  }
89
  &_body {
90
  display: none;
91
+ padding: 1rem 1rem 1.5rem;
92
+ & > *:last-child{
93
+ margin-bottom:0;
94
+ }
95
  .button {
96
  margin-right:0.5em;
97
  }
assets/css/vkExUnit_admin.css CHANGED
@@ -1 +1 @@
1
- .wrap.debug_mode tr.dev_object{display:table-row}.veu_metabox_nav{position:relative;display:block;overflow:hidden}.veu_metabox_nav .veu_metabox_all_section_toggle{position:relative;right:0;top:0;opacity:1;float:none}.veu_metabox_footer{padding-top:5px}.veu_metabox_footer .logo_exUnit{text-align:right;border:none}.veu_metabox_footer .logo_exUnit img{width:100px}.veu_metabox_all_section_toggle.close .veu_metabox_all_section_toggle_btn_open{display:block}.veu_metabox_all_section_toggle.close .veu_metabox_all_section_toggle_btn_close{display:none}.veu_metabox_all_section_toggle.open .veu_metabox_all_section_toggle_btn_open{display:none}.veu_metabox_all_section_toggle.open .veu_metabox_all_section_toggle_btn_close{display:block}.veu_metabox_section label{font-weight:400}.veu_metabox_section input[type=checkbox]{margin-top:0;margin-right:4px}.veu_metabox_section input,.veu_metabox_section select,.veu_metabox_section textarea{margin-bottom:5px}.veu_metabox_section_title{position:relative;border:1px solid #e5e5e5;padding:7px 1rem;background-color:#f5f5f5;margin:0 0 2px;font-size:14px;cursor:pointer}.veu_metabox_section_title_status_btn{display:block;overflow:hidden;position:absolute;right:10px;top:5px}.veu_metabox_section_title_status_btn.close{display:block}.veu_metabox_section_title_status_btn.open{display:none}.veu_metabox_section_body{display:none;padding:1rem 1rem 2rem}.veu_metabox_section_body .button{margin-right:.5em}.veu_metabox_section.open .veu_metabox_section_title_status_btn.close{display:none}.veu_metabox_section.open .veu_metabox_section_title_status_btn.open{display:block}.veu_metabox_section.open .veu_metabox_section_body{display:block}.vkExUnit_cta_button_icon_inputset dl{display:flex}.vkExUnit_cta_button_icon_inputset dl dt{white-space:nowrap}.vkExUnit_cta_button_icon_inputset dl dd{width:50%;box-sizing:border-box}.body-open{border:1px solid red}.veu_sns_title input[type=text]{width:100%}.table-widget-enablation{width:100%}.table-widget-enablation tbody td,.table-widget-enablation tbody th{box-shadow:inset 0 -1px 0 rgba(0,0,0,.1)}.table-widget-enablation tbody .active td,.table-widget-enablation tbody .active th{background-color:#f7fcfe}
1
+ .wrap.debug_mode tr.dev_object{display:table-row}.veu_metabox_nav{position:relative;display:block;overflow:hidden}.veu_metabox_nav .veu_metabox_all_section_toggle{position:relative;right:0;top:0;opacity:1;float:none}.veu_metabox_footer{padding-top:5px}.veu_metabox_footer .logo_exUnit{text-align:right;border:none}.veu_metabox_footer .logo_exUnit img{width:100px}.veu_metabox_all_section_toggle.close .veu_metabox_all_section_toggle_btn_open{display:block}.veu_metabox_all_section_toggle.close .veu_metabox_all_section_toggle_btn_close{display:none}.veu_metabox_all_section_toggle.open .veu_metabox_all_section_toggle_btn_open{display:none}.veu_metabox_all_section_toggle.open .veu_metabox_all_section_toggle_btn_close{display:block}.veu_metabox_section p{margin-top:0;margin-bottom:10px}.veu_metabox_section label{font-weight:400}.veu_metabox_section input[type=checkbox]{margin-top:0;margin-right:4px}.veu_metabox_section input,.veu_metabox_section select,.veu_metabox_section textarea{margin-bottom:5px}.veu_metabox_section_title{position:relative;border:1px solid #e5e5e5;padding:7px 1rem;background-color:#f5f5f5;margin:0 0 2px;font-size:14px;cursor:pointer}.veu_metabox_section_title_status_btn{display:block;overflow:hidden;position:absolute;right:10px;top:5px}.veu_metabox_section_title_status_btn.close{display:block}.veu_metabox_section_title_status_btn.open{display:none}.veu_metabox_section_body{display:none;padding:1rem 1rem 1.5rem}.veu_metabox_section_body>:last-child{margin-bottom:0}.veu_metabox_section_body .button{margin-right:.5em}.veu_metabox_section.open .veu_metabox_section_title_status_btn.close{display:none}.veu_metabox_section.open .veu_metabox_section_title_status_btn.open{display:block}.veu_metabox_section.open .veu_metabox_section_body{display:block}.vkExUnit_cta_button_icon_inputset dl{display:flex}.vkExUnit_cta_button_icon_inputset dl dt{white-space:nowrap}.vkExUnit_cta_button_icon_inputset dl dd{width:50%;box-sizing:border-box}.body-open{border:1px solid red}.veu_sns_title input[type=text]{width:100%}.table-widget-enablation{width:100%}.table-widget-enablation tbody td,.table-widget-enablation tbody th{box-shadow:inset 0 -1px 0 rgba(0,0,0,.1)}.table-widget-enablation tbody .active td,.table-widget-enablation tbody .active th{background-color:#f7fcfe}
gulpfile.js CHANGED
@@ -68,6 +68,7 @@ gulp.task('block', function (done) {
68
  });
69
 
70
  gulp.task("text-domain", function(done) {
 
71
  // vk-admin
72
  gulp.src(["./admin/vk-admin/package/*"])
73
  .pipe(replace("vk_admin_textdomain","vk-all-in-one-expansion-unit"))
@@ -80,6 +81,10 @@ gulp.task("text-domain", function(done) {
80
  gulp.src(["./inc/term-color/package/*.php"])
81
  .pipe(replace("'vk_term_color_textdomain'","'vk-all-in-one-expansion-unit'"))
82
  .pipe(gulp.dest("./inc/term-color/package/"));
 
 
 
 
83
  gulp.src(["./inc/vk-css-optimize/package/*.php"])
84
  .pipe(replace("'css_optimize_textdomain'","'vk-all-in-one-expansion-unit'"))
85
  .pipe(gulp.dest("./inc/vk-css-optimize/package/"));
68
  });
69
 
70
  gulp.task("text-domain", function(done) {
71
+
72
  // vk-admin
73
  gulp.src(["./admin/vk-admin/package/*"])
74
  .pipe(replace("vk_admin_textdomain","vk-all-in-one-expansion-unit"))
81
  gulp.src(["./inc/term-color/package/*.php"])
82
  .pipe(replace("'vk_term_color_textdomain'","'vk-all-in-one-expansion-unit'"))
83
  .pipe(gulp.dest("./inc/term-color/package/"));
84
+ // Post Type Manager
85
+ gulp.src(["./inc/post-type-manager/package/*.php"])
86
+ .pipe(replace("'vk_post_type_manager_textdomain'","'vk-all-in-one-expansion-unit'"))
87
+ .pipe(gulp.dest("./inc/post-type-manager/package/"));
88
  gulp.src(["./inc/vk-css-optimize/package/*.php"])
89
  .pipe(replace("'css_optimize_textdomain'","'vk-all-in-one-expansion-unit'"))
90
  .pipe(gulp.dest("./inc/vk-css-optimize/package/"));
inc/post-type-manager/package/class.post-type-manager.php CHANGED
@@ -1,26 +1,29 @@
1
- <?php
2
-
3
  /*
4
  このファイルの元ファイルは
5
  https://github.com/vektor-inc/vektor-wp-libraries
6
  にあります。修正の際は上記リポジトリのデータを修正してください。
7
  */
8
 
9
- if ( ! class_exists( 'Vk_post_type_manager' ) ) {
10
 
11
- class Vk_post_type_manager {
 
 
 
12
 
13
- /*
14
- カスタム投稿タイプ制御用投稿タイプを追加
15
- /*-------------------------------------------*/
16
- function add_post_type_post_type_manage() {
17
- global $vk_post_type_manager_textdomain;
 
18
  register_post_type(
19
- 'post_type_manage', // カスタム投稿タイプのスラッグ
20
  array(
21
  'labels' => array(
22
- 'name' => __( 'Custom Post Type Setting', $vk_post_type_manager_textdomain ),
23
- 'singular_name' => __( 'Custom Post Type Setting', $vk_post_type_manager_textdomain ),
24
  ),
25
  'public' => false,
26
  'show_ui' => true,
@@ -28,16 +31,20 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
28
  'menu_position' => 100,
29
  'capability_type' => array( 'post_type_manage', 'post_type_manages' ),
30
  'map_meta_cap' => true,
 
31
  'menu_icon' => 'dashicons-admin-generic',
32
  'supports' => array( 'title' ),
33
  )
34
  );
35
  }
36
 
37
- /*
38
- post_type_manage の編集権限を追加
39
- /*-------------------------------------------*/
40
- function add_cap_post_type_manage() {
 
 
 
41
  $role = get_role( 'administrator' );
42
  $post_type_name = 'post_type_manage';
43
  $role->add_cap( 'add_' . $post_type_name );
@@ -55,19 +62,22 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
55
  $role->add_cap( 'publish_others_' . $post_type_name . 's' );
56
  }
57
 
58
- /*
59
- meta box を作成
60
- /*-------------------------------------------*/
61
- // add meta_box
62
- function add_meta_box() {
63
- global $vk_post_type_manager_textdomain;
64
- add_meta_box( 'meta_box_post_type_manage', __( 'Custom Post Type Setting', $vk_post_type_manager_textdomain ), array( $this, 'add_meta_box_action' ), 'post_type_manage', 'normal', 'high' );
65
  }
66
- function add_meta_box_action() {
67
- global $vk_post_type_manager_textdomain;
 
 
 
 
 
68
  global $post;
69
 
70
- // CSRF対策の設定(フォームにhiddenフィールドとして追加するためのnonceを「'noncename__post_type_manager」として設定)
71
  wp_nonce_field( wp_create_nonce( __FILE__ ), 'noncename__post_type_manager' );
72
 
73
  ?>
@@ -82,86 +92,82 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
82
  </style>
83
  <?php
84
 
85
- /*
86
- Post Type ID
87
- /*-------------------------------------------*/
88
- echo '<h4>' . __( 'Post Type ID(Required)', $vk_post_type_manager_textdomain ) . '</h4>';
89
- echo '<p>' . __( '20 characters or less in alphanumeric', $vk_post_type_manager_textdomain ) . '</p>';
90
  echo '<input class="form-control" type="text" id="veu_post_type_id" name="veu_post_type_id" value="' . esc_attr( mb_strimwidth( mb_convert_kana( mb_strtolower( $post->veu_post_type_id ), 'a' ), 0, 20, '', 'UTF-8' ) ) . '" size="30">';
91
  echo '<hr>';
92
 
93
  $post_type_items_array = array(
94
- 'title' => __( 'title', $vk_post_type_manager_textdomain ),
95
- 'editor' => __( 'editor', $vk_post_type_manager_textdomain ),
96
- 'author' => __( 'author', $vk_post_type_manager_textdomain ),
97
- 'thumbnail' => __( 'thumbnail', $vk_post_type_manager_textdomain ),
98
- 'excerpt' => __( 'excerpt', $vk_post_type_manager_textdomain ),
99
- 'comments' => __( 'comments', $vk_post_type_manager_textdomain ),
100
- 'revisions' => __( 'revisions', $vk_post_type_manager_textdomain ),
101
  );
102
 
103
- /*
104
- Supports(Required)
105
- /*-------------------------------------------*/
106
- echo '<h4>' . __( 'Supports(Required)', $vk_post_type_manager_textdomain ) . '</h4>';
107
  $post_type_items_value = get_post_meta( $post->ID, 'veu_post_type_items', true );
108
  echo '<ul>';
109
  foreach ( $post_type_items_array as $key => $label ) {
110
  $checked = ( isset( $post_type_items_value[ $key ] ) && $post_type_items_value[ $key ] ) ? ' checked' : '';
111
- echo '<li><label>' . '<input type="checkbox" id="veu_post_type_items[' . $key . ']" name="veu_post_type_items[' . $key . ']" value="true"' . $checked . '> ' . $label . '</label></li>';
112
  }
113
  echo '</ul>';
114
 
115
  echo '<hr>';
116
 
117
- /*
118
- Menu position
119
- /*-------------------------------------------*/
120
- echo '<h4>' . __( 'Menu position(optional)', $vk_post_type_manager_textdomain ) . '</h4>';
121
- echo '<p>' . __( 'Please enter a number.', $vk_post_type_manager_textdomain ) . '</p>';
122
  echo '<input class="form-control" type="text" id="veu_menu_position" name="veu_menu_position" value="' . esc_attr( $post->veu_menu_position ) . '" size="30">';
123
 
124
  echo '<hr>';
125
 
126
- /*
127
- Export to Rest api
128
- /*-------------------------------------------*/
129
- echo '<h4>' . __( 'Corresponds to the block editor ( optional )', $vk_post_type_manager_textdomain ) . '</h4>';
130
 
131
- // 現在保存されているカスタムフィールドの値を取得
132
  $export_to_api_value = get_post_meta( $post->ID, 'veu_post_type_export_to_api', true );
133
 
134
- // 保存されているデータが true だったら $checked = ' checked' にする。
135
  if ( $export_to_api_value ) {
136
  $checked = ' checked';
137
  } else {
138
  $checked = '';
139
  }
140
 
141
- echo '<label>' . '<input type="checkbox" id="veu_post_type_export_to_api" name="veu_post_type_export_to_api" value="true"' . $checked . '> ' . __( 'Corresponds to the block editor ( Export to REST API / optional )', $vk_post_type_manager_textdomain ). '</label>';
142
- echo '<p>' . __( 'If you want to use the block editor that, you have to use the REST API.', $vk_post_type_manager_textdomain ) . '</p>';
143
  echo '<hr>';
144
 
145
- /*
146
- Custom taxonomies
147
- /*-------------------------------------------*/
148
- echo '<h4>' . __( 'Custom taxonomies(optional)', $vk_post_type_manager_textdomain ) . '</h4>';
149
 
150
  echo '<p>';
151
- echo __( 'Custom taxonomy is like a category in post.', $vk_post_type_manager_textdomain ) . '<br />';
152
- echo __( 'However, it refers to the "category" itself, not to the “item” of the category.', $vk_post_type_manager_textdomain ) . '<br />';
153
- echo __( 'For example, if you create a post type "construction result", Custom taxonomy will be "construction type", "construction area", etc.', $vk_post_type_manager_textdomain );
154
  echo '</p>';
155
 
156
  echo '<table class="table table-border">';
157
 
158
- // カスタム分類の情報は カスタムフィールドの veu_taxonomy に連想配列で格納している
159
  $taxonomy = get_post_meta( $post->ID, 'veu_taxonomy', true );
160
 
161
- // if ( ! $taxonomy ){
162
- // $taxonomy = array(array());
163
- // }
164
-
165
  for ( $i = 1; $i <= 5; $i++ ) {
166
 
167
  $slug = ( isset( $taxonomy[ $i ]['slug'] ) ) ? $taxonomy[ $i ]['slug'] : '';
@@ -171,38 +177,38 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
171
 
172
  echo '<tr>';
173
 
174
- echo '<th rowspan="4">' . $i . '</th>';
175
 
176
- // slug
177
- echo '<td>' . __( 'Custon taxonomy name(slug)', $vk_post_type_manager_textdomain ) . '</td>';
178
- echo '<td><input type="text" id="veu_taxonomy[' . $i . '][slug]" name="veu_taxonomy[' . $i . '][slug]" value="' . esc_attr( $slug ) . '" size="20">';
179
  $locale = get_locale();
180
  if ( ! in_array( $locale, array( 'en_US', 'en_CA', 'en_NZ', 'en_AU', 'en_ZA', 'en_GB' ) ) ) {
181
- echo '<div>' . __( '* Please be sure to enter it with one-byte alphanumeric characters', $vk_post_type_manager_textdomain ) . '</div>';
182
  }
183
  echo '</td>';
184
 
185
- // 表示名
186
  echo '<tr>';
187
- echo '<td>' . __( 'Custon taxonomy label', $vk_post_type_manager_textdomain ) . '</td>';
188
- echo '<td><input type="text" id="veu_taxonomy[' . $i . '][label]" name="veu_taxonomy[' . $i . '][label]" value="' . esc_attr( $label ) . '" size="20"></td>';
189
  echo '</tr>';
190
 
191
- // tag
192
  echo '<tr>';
193
  $checked = ( isset( $taxonomy[ $i ]['tag'] ) && $taxonomy[ $i ]['tag'] ) ? ' checked' : '';
194
- echo '<td>' . __( 'Hierarchy', $vk_post_type_manager_textdomain ) . '</td>';
195
- echo '<td><label><input type="checkbox" id="veu_taxonomy[' . $i . '][tag]" name="veu_taxonomy[' . $i . '][tag]" value="true"' . $checked . '> ' . __( 'Make it a tag (do not hierarchize)', $vk_post_type_manager_textdomain ) . '</label></td>';
196
  echo '</tr>';
197
 
198
- // RERT API
199
  echo '<tr>';
200
 
201
- // チェックが元々入ってるかどうか
202
  $checked = ( isset( $taxonomy[ $i ]['rest_api'] ) && $taxonomy[ $i ]['rest_api'] ) ? ' checked' : '';
203
 
204
- echo '<td>' . __( 'Corresponds to the block editor', $vk_post_type_manager_textdomain ) . '</td>';
205
- echo '<td><label><input type="checkbox" id="veu_taxonomy[' . $i . '][rest_api]" name="veu_taxonomy[' . $i . '][rest_api]" value="true"' . $checked . '> ' . __( 'Corresponds to the block editor ( Export to REST API / optional )', $vk_post_type_manager_textdomain ) . '</label></td>';
206
  echo '</tr>';
207
 
208
  }
@@ -210,26 +216,27 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
210
 
211
  }
212
 
213
- /*
214
- 入力された値の保存
215
- /*-------------------------------------------*/
216
-
217
- function save_cf_value( $post_id, $post ) {
 
218
  global $post;
219
 
220
- // 設定したnonce を取得(CSRF対策)
221
- $noncename__post_type_manager = isset( $_POST['noncename__post_type_manager'] ) ? $_POST['noncename__post_type_manager'] : null;
222
 
223
- // nonce を確認し、値が書き換えられていれば、何もしない(CSRF対策)
224
  if ( ! wp_verify_nonce( $noncename__post_type_manager, wp_create_nonce( __FILE__ ) ) ) {
225
  return $post_id;
226
  }
227
 
228
- // 自動保存ルーチンかどうかチェック。そうだった場合は何もしない(記事の自動保存処理として呼び出された場合の対策)
229
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
230
  return $post_id; }
231
 
232
- // 保存しているカスタムフィールド
233
  $fields = array(
234
  'veu_post_type_id',
235
  'veu_post_type_items',
@@ -241,49 +248,47 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
241
  foreach ( $fields as $key => $field ) {
242
  $field_value = ( isset( $_POST[ $field ] ) ) ? $_POST[ $field ] : '';
243
 
244
- // データが空だったら入れる
245
  if ( get_post_meta( $post_id, $field ) == '' ) {
246
  add_post_meta( $post_id, $field, $field_value, true );
247
 
248
- // 今入ってる値と違ってたらアップデートする
249
- } elseif ( $field_value != get_post_meta( $post_id, $field, true ) ) {
250
  update_post_meta( $post_id, $field, $field_value );
251
 
252
- // 入力がなかったら消す
253
- } elseif ( $field_value == '' ) {
254
  delete_post_meta( $post_id, $field, get_post_meta( $post_id, $field, true ) );
255
  }
256
  }
257
 
258
- // 投稿タイプマネージャー保存時にパーマリンクを保存する
259
- if ( 'post_type_manage' === $post->post_type ){
260
- flush_rewrite_rules();
261
- }
262
-
263
  }
264
 
265
- function add_post_notice() {
 
 
 
 
 
266
  global $pagenow;
267
- global $vk_post_type_manager_textdomain;
268
- if ( $pagenow == 'post.php' && get_post_type() == 'post_type_manage' && $_GET['action'] == 'edit' ) {
269
  $html = '<div class="notice-warning notice is-dismissible">';
270
  $link = admin_url() . 'options-permalink.php';
271
- // $html .= '<p>'.sprintf( __('設定を更新したら<a href="%s">パーマリンク設定</a>を保存してください。', $vk_post_type_manager_textdomain ),$link ).'</p>';
272
- $html .= '<p>' . sprintf( __( 'Please save a <a href="%s">permanent link configuration</a> After updating the setting.', $vk_post_type_manager_textdomain ), $link ) . '</p>';
273
  $html .= ' <button type="button" class="notice-dismiss">';
274
  $html .= ' <span class="screen-reader-text">この通知を非表示にする</span>';
275
  $html .= ' </button>';
276
  $html .= '</div>';
277
 
278
- echo $html;
279
  }
280
  }
281
 
282
- /*
283
- 登録したカスタム投稿タイプを実際に作成
284
- /*-------------------------------------------*/
285
-
286
- function add_post_type() {
287
  $args = array(
288
  'posts_per_page' => -1,
289
  'post_type' => 'post_type_manage',
@@ -296,9 +301,9 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
296
  if ( $custom_post_types ) {
297
  foreach ( $custom_post_types as $key => $post ) {
298
 
299
- /*
300
- 投稿タイプ追加
301
- /*-------------------------------------------*/
302
  $labels = array(
303
  'name' => esc_html( $post->post_title ),
304
  'singular_name' => esc_html( $post->post_title ),
@@ -313,7 +318,7 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
313
  $supports[] = $key;
314
  }
315
 
316
- // カスタム投稿タイプのスラッグ
317
  $post_type_id = mb_strimwidth( mb_convert_kana( mb_strtolower( esc_html( get_post_meta( $post->ID, 'veu_post_type_id', true ) ) ), 'a' ), 0, 20, '', 'UTF-8' );
318
 
319
  if ( $post_type_id ) {
@@ -330,9 +335,9 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
330
  'supports' => $supports,
331
  );
332
 
333
- // REST API に出力するかどうかをカスタムフィールドから取得
334
  $rest_api = get_post_meta( $post->ID, 'veu_post_type_export_to_api', true );
335
- // REST APIに出力する場合
336
  if ( $rest_api ) {
337
  $rest_args = array(
338
  'show_in_rest' => true,
@@ -341,23 +346,23 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
341
  $args = array_merge( $args, $rest_args );
342
  }
343
 
344
- // カスタム投稿タイプを発行
345
  register_post_type( $post_type_id, $args );
346
 
347
- /*
348
- カスタム分類を追加
349
- /*-------------------------------------------*/
350
 
351
- // カスタムフィールドに連想配列で格納しておいたカスタム分類の情報を取得
352
  $veu_taxonomies = get_post_meta( $post->ID, 'veu_taxonomy', true );
353
 
354
  foreach ( $veu_taxonomies as $key => $taxonomy ) {
355
 
356
  if ( $taxonomy['slug'] && $taxonomy['label'] ) {
357
 
358
- // カスタム分類を階層化するかどうか
359
  $hierarchical_true = ( empty( $taxonomy['tag'] ) ) ? true : false;
360
- // REST API を使用するかどうか
361
  $rest_api_true = ( empty( $taxonomy['rest_api'] ) ) ? false : true;
362
 
363
  $args = array(
@@ -388,21 +393,20 @@ if ( ! class_exists( 'Vk_post_type_manager' ) ) {
388
 
389
  }
390
 
391
- /*
392
- 実行
393
- /*-------------------------------------------*/
394
  public function __construct() {
395
- add_action( 'init', array( $this, 'add_post_type_post_type_manage' ), 0 );
396
  add_action( 'admin_init', array( $this, 'add_cap_post_type_manage' ) );
397
- add_action( 'save_post', array( $this, 'save_cf_value' ), 10, 2 );
398
  add_action( 'admin_menu', array( $this, 'add_meta_box' ) );
399
- add_action( 'init', array( $this, 'add_post_type' ), 0 );
400
- // add_action( 'save_post', array( $this, 'add_post_notice' ) );
401
  add_action( 'admin_notices', array( $this, 'add_post_notice' ) );
402
  }
403
 
404
- } // class Vk_post_type_manager
405
 
406
- $Vk_post_type_manager = new Vk_post_type_manager();
407
 
408
  }
1
+ <?php // phpcs:ignore
 
2
  /*
3
  このファイルの元ファイルは
4
  https://github.com/vektor-inc/vektor-wp-libraries
5
  にあります。修正の際は上記リポジトリのデータを修正してください。
6
  */
7
 
8
+ if ( ! class_exists( 'VK_Post_Type_Manager' ) ) {
9
 
10
+ /**
11
+ * Post Type Manager
12
+ */
13
+ class VK_Post_Type_Manager {
14
 
15
+ /**
16
+ * カスタム投稿タイプ制御用投稿タイプを追加
17
+ *
18
+ * @return void
19
+ */
20
+ public static function add_post_type_post_type_manage() {
21
  register_post_type(
22
+ 'post_type_manage', // カスタム投稿タイプのスラッグ.
23
  array(
24
  'labels' => array(
25
+ 'name' => __( 'Custom Post Type Setting', 'vk-all-in-one-expansion-unit' ),
26
+ 'singular_name' => __( 'Custom Post Type Setting', 'vk-all-in-one-expansion-unit' ),
27
  ),
28
  'public' => false,
29
  'show_ui' => true,
31
  'menu_position' => 100,
32
  'capability_type' => array( 'post_type_manage', 'post_type_manages' ),
33
  'map_meta_cap' => true,
34
+ 'has_archive' => false,
35
  'menu_icon' => 'dashicons-admin-generic',
36
  'supports' => array( 'title' ),
37
  )
38
  );
39
  }
40
 
41
+ /**
42
+ * 編集権限を追加
43
+ * post_type_manage の編集権限を追加
44
+ *
45
+ * @return void
46
+ */
47
+ public static function add_cap_post_type_manage() {
48
  $role = get_role( 'administrator' );
49
  $post_type_name = 'post_type_manage';
50
  $role->add_cap( 'add_' . $post_type_name );
62
  $role->add_cap( 'publish_others_' . $post_type_name . 's' );
63
  }
64
 
65
+ /*******************************************
66
+ * カスタムフィールドの meta box を作成.
67
+ */
68
+ public static function add_meta_box() {
69
+ add_meta_box( 'meta_box_post_type_manage', __( 'Custom Post Type Setting', 'vk-all-in-one-expansion-unit' ), array( __CLASS__, 'add_meta_box_action' ), 'post_type_manage', 'normal', 'high' );
 
 
70
  }
71
+
72
+ /**
73
+ * Add meta box action
74
+ *
75
+ * @return void
76
+ */
77
+ public static function add_meta_box_action() {
78
  global $post;
79
 
80
+ // CSRF対策の設定(フォームにhiddenフィールドとして追加するためのnonceを「'noncename__post_type_manager」として設定).
81
  wp_nonce_field( wp_create_nonce( __FILE__ ), 'noncename__post_type_manager' );
82
 
83
  ?>
92
  </style>
93
  <?php
94
 
95
+ /*******************************************
96
+ * Post Type ID
97
+ */
98
+ echo '<h4>' . esc_html__( 'Post Type ID(Required)', 'vk-all-in-one-expansion-unit' ) . '</h4>';
99
+ echo '<p>' . esc_html__( '20 characters or less in alphanumeric', 'vk-all-in-one-expansion-unit' ) . '</p>';
100
  echo '<input class="form-control" type="text" id="veu_post_type_id" name="veu_post_type_id" value="' . esc_attr( mb_strimwidth( mb_convert_kana( mb_strtolower( $post->veu_post_type_id ), 'a' ), 0, 20, '', 'UTF-8' ) ) . '" size="30">';
101
  echo '<hr>';
102
 
103
  $post_type_items_array = array(
104
+ 'title' => __( 'title', 'vk-all-in-one-expansion-unit' ),
105
+ 'editor' => __( 'editor', 'vk-all-in-one-expansion-unit' ),
106
+ 'author' => __( 'author', 'vk-all-in-one-expansion-unit' ),
107
+ 'thumbnail' => __( 'thumbnail', 'vk-all-in-one-expansion-unit' ),
108
+ 'excerpt' => __( 'excerpt', 'vk-all-in-one-expansion-unit' ),
109
+ 'comments' => __( 'comments', 'vk-all-in-one-expansion-unit' ),
110
+ 'revisions' => __( 'revisions', 'vk-all-in-one-expansion-unit' ),
111
  );
112
 
113
+ /*******************************************
114
+ * Supports(Required)
115
+ */
116
+ echo '<h4>' . esc_html__( 'Supports(Required)', 'vk-all-in-one-expansion-unit' ) . '</h4>';
117
  $post_type_items_value = get_post_meta( $post->ID, 'veu_post_type_items', true );
118
  echo '<ul>';
119
  foreach ( $post_type_items_array as $key => $label ) {
120
  $checked = ( isset( $post_type_items_value[ $key ] ) && $post_type_items_value[ $key ] ) ? ' checked' : '';
121
+ echo '<li><label><input type="checkbox" id="veu_post_type_items[' . esc_attr( $key ) . ']" name="veu_post_type_items[' . esc_attr( $key ) . ']" value="true"' . esc_attr( $checked ) . '> ' . esc_html( $label ) . '</label></li>';
122
  }
123
  echo '</ul>';
124
 
125
  echo '<hr>';
126
 
127
+ /*******************************************
128
+ * Menu position
129
+ */
130
+ echo '<h4>' . esc_html__( 'Menu position(optional)', 'vk-all-in-one-expansion-unit' ) . '</h4>';
131
+ echo '<p>' . esc_html__( 'Please enter a number.', 'vk-all-in-one-expansion-unit' ) . '</p>';
132
  echo '<input class="form-control" type="text" id="veu_menu_position" name="veu_menu_position" value="' . esc_attr( $post->veu_menu_position ) . '" size="30">';
133
 
134
  echo '<hr>';
135
 
136
+ /*******************************************
137
+ * Export to Rest api
138
+ */
139
+ echo '<h4>' . esc_html__( 'Corresponds to the block editor ( optional )', 'vk-all-in-one-expansion-unit' ) . '</h4>';
140
 
141
+ // 現在保存されているカスタムフィールドの値を取得.
142
  $export_to_api_value = get_post_meta( $post->ID, 'veu_post_type_export_to_api', true );
143
 
144
+ // 保存されているデータが true だったら $checked = ' checked' にする。.
145
  if ( $export_to_api_value ) {
146
  $checked = ' checked';
147
  } else {
148
  $checked = '';
149
  }
150
 
151
+ echo '<label><input type="checkbox" id="veu_post_type_export_to_api" name="veu_post_type_export_to_api" value="true"' . esc_html( $checked ) . '> ' . esc_html__( 'Corresponds to the block editor ( Export to REST API / optional )', 'vk-all-in-one-expansion-unit' ) . '</label>';
152
+ echo '<p>' . esc_html__( 'If you want to use the block editor that, you have to use the REST API.', 'vk-all-in-one-expansion-unit' ) . '</p>';
153
  echo '<hr>';
154
 
155
+ /*******************************************
156
+ * Custom taxonomies
157
+ */
158
+ echo '<h4>' . esc_html__( 'Custom taxonomies(optional)', 'vk-all-in-one-expansion-unit' ) . '</h4>';
159
 
160
  echo '<p>';
161
+ echo esc_html__( 'Custom taxonomy is like a category in post.', 'vk-all-in-one-expansion-unit' ) . '<br />';
162
+ echo esc_html__( 'However, it refers to the "category" itself, not to the “item” of the category.', 'vk-all-in-one-expansion-unit' ) . '<br />';
163
+ echo esc_html__( 'For example, if you create a post type "construction result", Custom taxonomy will be "construction type", "construction area", etc.', 'vk-all-in-one-expansion-unit' );
164
  echo '</p>';
165
 
166
  echo '<table class="table table-border">';
167
 
168
+ // カスタム分類の情報は カスタムフィールドの veu_taxonomy に連想配列で格納している.
169
  $taxonomy = get_post_meta( $post->ID, 'veu_taxonomy', true );
170
 
 
 
 
 
171
  for ( $i = 1; $i <= 5; $i++ ) {
172
 
173
  $slug = ( isset( $taxonomy[ $i ]['slug'] ) ) ? $taxonomy[ $i ]['slug'] : '';
177
 
178
  echo '<tr>';
179
 
180
+ echo '<th rowspan="4">' . esc_attr( $i ) . '</th>';
181
 
182
+ // slug.
183
+ echo '<td>' . esc_html__( 'Custon taxonomy name(slug)', 'vk-all-in-one-expansion-unit' ) . '</td>';
184
+ echo '<td><input type="text" id="veu_taxonomy[' . esc_attr( $i ) . '][slug]" name="veu_taxonomy[' . esc_attr( $i ) . '][slug]" value="' . esc_attr( $slug ) . '" size="20">';
185
  $locale = get_locale();
186
  if ( ! in_array( $locale, array( 'en_US', 'en_CA', 'en_NZ', 'en_AU', 'en_ZA', 'en_GB' ) ) ) {
187
+ echo '<div>' . esc_html__( '* Please be sure to enter it with one-byte alphanumeric characters', 'vk-all-in-one-expansion-unit' ) . '</div>';
188
  }
189
  echo '</td>';
190
 
191
+ // 表示名.
192
  echo '<tr>';
193
+ echo '<td>' . esc_html__( 'Custon taxonomy label', 'vk-all-in-one-expansion-unit' ) . '</td>';
194
+ echo '<td><input type="text" id="veu_taxonomy[' . esc_attr( $i ) . '][label]" name="veu_taxonomy[' . esc_attr( $i ) . '][label]" value="' . esc_attr( $label ) . '" size="20"></td>';
195
  echo '</tr>';
196
 
197
+ // tag.
198
  echo '<tr>';
199
  $checked = ( isset( $taxonomy[ $i ]['tag'] ) && $taxonomy[ $i ]['tag'] ) ? ' checked' : '';
200
+ echo '<td>' . esc_html__( 'Hierarchy', 'vk-all-in-one-expansion-unit' ) . '</td>';
201
+ echo '<td><label><input type="checkbox" id="veu_taxonomy[' . esc_attr( $i ) . '][tag]" name="veu_taxonomy[' . esc_attr( $i ) . '][tag]" value="true"' . esc_attr( $checked ) . '> ' . esc_html__( 'Make it a tag (do not hierarchize)', 'vk-all-in-one-expansion-unit' ) . '</label></td>';
202
  echo '</tr>';
203
 
204
+ // RERT API.
205
  echo '<tr>';
206
 
207
+ // チェックが元々入ってるかどうか.
208
  $checked = ( isset( $taxonomy[ $i ]['rest_api'] ) && $taxonomy[ $i ]['rest_api'] ) ? ' checked' : '';
209
 
210
+ echo '<td>' . esc_html__( 'Corresponds to the block editor', 'vk-all-in-one-expansion-unit' ) . '</td>';
211
+ echo '<td><label><input type="checkbox" id="veu_taxonomy[' . esc_attr( $i ) . '][rest_api]" name="veu_taxonomy[' . esc_attr( $i ) . '][rest_api]" value="true"' . esc_attr( $checked ) . '> ' . esc_html__( 'Corresponds to the block editor ( Export to REST API / optional )', 'vk-all-in-one-expansion-unit' ) . '</label></td>';
212
  echo '</tr>';
213
 
214
  }
216
 
217
  }
218
 
219
+ /***
220
+ * 入力されたカスタムフィールドの値の保存
221
+ *
222
+ * @param string $post_id : post id.
223
+ */
224
+ public static function save_cf_value( $post_id ) {
225
  global $post;
226
 
227
+ // 設定したnonce を取得(CSRF対策).
228
+ $noncename__post_type_manager = isset( $_POST['noncename__post_type_manager'] ) ? wp_unslash( $_POST['noncename__post_type_manager'] ) : null;
229
 
230
+ // nonce を確認し、値が書き換えられていれば、何もしない(CSRF対策).
231
  if ( ! wp_verify_nonce( $noncename__post_type_manager, wp_create_nonce( __FILE__ ) ) ) {
232
  return $post_id;
233
  }
234
 
235
+ // 自動保存ルーチンかどうかチェック。そうだった場合は何もしない(記事の自動保存処理として呼び出された場合の対策).
236
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
237
  return $post_id; }
238
 
239
+ // 保存しているカスタムフィールド.
240
  $fields = array(
241
  'veu_post_type_id',
242
  'veu_post_type_items',
248
  foreach ( $fields as $key => $field ) {
249
  $field_value = ( isset( $_POST[ $field ] ) ) ? $_POST[ $field ] : '';
250
 
251
+ // データが空だったら入れる.
252
  if ( get_post_meta( $post_id, $field ) == '' ) {
253
  add_post_meta( $post_id, $field, $field_value, true );
254
 
255
+ // 今入ってる値と違ってたらアップデートする.
256
+ } elseif ( get_post_meta( $post_id, $field, true ) !== $field_value ) {
257
  update_post_meta( $post_id, $field, $field_value );
258
 
259
+ // 入力がなかったら消す.
260
+ } elseif ( '' === $field_value ) {
261
  delete_post_meta( $post_id, $field, get_post_meta( $post_id, $field, true ) );
262
  }
263
  }
264
 
 
 
 
 
 
265
  }
266
 
267
+ /**
268
+ * Add post notice
269
+ *
270
+ * @return void
271
+ */
272
+ public static function add_post_notice() {
273
  global $pagenow;
274
+ if ( 'post.php' === $pagenow && 'post_type_manage' === get_post_type() && 'edit' === $_GET['action'] ) {
 
275
  $html = '<div class="notice-warning notice is-dismissible">';
276
  $link = admin_url() . 'options-permalink.php';
277
+ /* translators: %s: permalink url */
278
+ $html .= '<p>' . sprintf( __( 'Please save a <a href="%s">permanent link configuration</a> After updating the setting.', 'vk-all-in-one-expansion-unit' ), $link ) . '</p>';
279
  $html .= ' <button type="button" class="notice-dismiss">';
280
  $html .= ' <span class="screen-reader-text">この通知を非表示にする</span>';
281
  $html .= ' </button>';
282
  $html .= '</div>';
283
 
284
+ echo wp_kses_post( $html );
285
  }
286
  }
287
 
288
+ /**
289
+ * 登録したカスタム投稿タイプを実際に作成
290
+ */
291
+ public static function add_post_type() {
 
292
  $args = array(
293
  'posts_per_page' => -1,
294
  'post_type' => 'post_type_manage',
301
  if ( $custom_post_types ) {
302
  foreach ( $custom_post_types as $key => $post ) {
303
 
304
+ /*******************************************
305
+ * 投稿タイプ追加.
306
+ */
307
  $labels = array(
308
  'name' => esc_html( $post->post_title ),
309
  'singular_name' => esc_html( $post->post_title ),
318
  $supports[] = $key;
319
  }
320
 
321
+ // カスタム投稿タイプのスラッグ.
322
  $post_type_id = mb_strimwidth( mb_convert_kana( mb_strtolower( esc_html( get_post_meta( $post->ID, 'veu_post_type_id', true ) ) ), 'a' ), 0, 20, '', 'UTF-8' );
323
 
324
  if ( $post_type_id ) {
335
  'supports' => $supports,
336
  );
337
 
338
+ // REST API に出力するかどうかをカスタムフィールドから取得.
339
  $rest_api = get_post_meta( $post->ID, 'veu_post_type_export_to_api', true );
340
+ // REST APIに出力する場合.
341
  if ( $rest_api ) {
342
  $rest_args = array(
343
  'show_in_rest' => true,
346
  $args = array_merge( $args, $rest_args );
347
  }
348
 
349
+ // カスタム投稿タイプを発行.
350
  register_post_type( $post_type_id, $args );
351
 
352
+ /*******************************************
353
+ * カスタム分類を追加
354
+ */
355
 
356
+ // カスタムフィールドに連想配列で格納しておいたカスタム分類の情報を取得.
357
  $veu_taxonomies = get_post_meta( $post->ID, 'veu_taxonomy', true );
358
 
359
  foreach ( $veu_taxonomies as $key => $taxonomy ) {
360
 
361
  if ( $taxonomy['slug'] && $taxonomy['label'] ) {
362
 
363
+ // カスタム分類を階層化するかどうか.
364
  $hierarchical_true = ( empty( $taxonomy['tag'] ) ) ? true : false;
365
+ // REST API を使用するかどうか.
366
  $rest_api_true = ( empty( $taxonomy['rest_api'] ) ) ? false : true;
367
 
368
  $args = array(
393
 
394
  }
395
 
396
+ /**
397
+ * Constructer
398
+ */
399
  public function __construct() {
400
+ add_action( 'init', array( $this, 'add_post_type_post_type_manage' ) );
401
  add_action( 'admin_init', array( $this, 'add_cap_post_type_manage' ) );
402
+ add_action( 'save_post', array( $this, 'save_cf_value' ) );
403
  add_action( 'admin_menu', array( $this, 'add_meta_box' ) );
404
+ add_action( 'after_setup_theme', array( $this, 'add_post_type' ), 0 );
 
405
  add_action( 'admin_notices', array( $this, 'add_post_notice' ) );
406
  }
407
 
408
+ } // class VK_Post_Type_Manager
409
 
410
+ $VK_Post_Type_Manager = new VK_Post_Type_Manager(); // phpcs:ignore
411
 
412
  }
inc/sitemap-page/sitemap-page.php CHANGED
@@ -68,13 +68,21 @@ function show_sitemap( $content ) {
68
  */
69
  function veu_show_sitemap( $content ) {
70
  global $is_pagewidget;
 
71
  if ( $is_pagewidget ) {
72
  return $content; }
 
 
 
 
 
73
  wp_reset_postdata(); // need under other section / ex:child page index
74
  global $post;
75
- $enable = get_post_meta( $post->ID, 'vkExUnit_sitemap', true );
76
- if ( $enable ) {
77
- return $content . "\n" . do_shortcode( '[vkExUnit_sitemap]' );
 
 
78
  }
79
  return $content;
80
  }
68
  */
69
  function veu_show_sitemap( $content ) {
70
  global $is_pagewidget;
71
+
72
  if ( $is_pagewidget ) {
73
  return $content; }
74
+
75
+ // 404ページの内容を G3 ProUnit で指定の記事本文に書き換えた場合に表示されないように
76
+ if ( is_404() ) {
77
+ return $content; }
78
+
79
  wp_reset_postdata(); // need under other section / ex:child page index
80
  global $post;
81
+ if ( $post ) {
82
+ $enable = get_post_meta( $post->ID, 'vkExUnit_sitemap', true );
83
+ if ( $enable ) {
84
+ return $content . "\n" . do_shortcode( '[vkExUnit_sitemap]' );
85
+ }
86
  }
87
  return $content;
88
  }
inc/sns/function-sns-btns.php CHANGED
@@ -21,7 +21,7 @@ function veu_add_sns_btns_loopend( $query ) {
21
  if ( ! $query->is_main_query() ) {
22
  return;
23
  }
24
- if ( is_front_page() || is_home() ) {
25
  return;
26
  }
27
  echo veu_add_sns_btns( '' );
@@ -38,7 +38,10 @@ function veu_is_sns_btns_display() {
38
  $ignore_posts = explode( ',', $options['snsBtn_ignorePosts'] );
39
  $post_type = vk_get_post_type();
40
  $post_type = $post_type['slug'];
41
-
 
 
 
42
  if ( empty( $options['enableSnsBtns'] ) ) {
43
  return false;
44
  }
21
  if ( ! $query->is_main_query() ) {
22
  return;
23
  }
24
+ if ( is_front_page() || is_home() || is_404() ) {
25
  return;
26
  }
27
  echo veu_add_sns_btns( '' );
38
  $ignore_posts = explode( ',', $options['snsBtn_ignorePosts'] );
39
  $post_type = vk_get_post_type();
40
  $post_type = $post_type['slug'];
41
+ // 404ページの内容を G3 ProUnit で指定の記事本文に書き換えた場合に表示されないように
42
+ if ( is_404() ){
43
+ return false;
44
+ }
45
  if ( empty( $options['enableSnsBtns'] ) ) {
46
  return false;
47
  }
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: vektor-inc,kurudrive,hinaloe,jim912,hideokamoto,nc30,SaoriMiyazaki
3
  Donate link:
4
  Tags: Google Analytics, New posts, Related Posts, sitemap, sns, twitter card, Facebook Page Plugin, OG tags,
5
  Requires at least: 5.3.0
6
- Tested up to: 5.8.1
7
- Requires PHP: 5.6
8
- Stable tag: 9.68.4.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -82,6 +82,10 @@ e.g.
82
 
83
  == Changelog ==
84
 
 
 
 
 
85
  = 9.68.4.0 =
86
  * [ Bug fix ][ smooth scroll ] fix scroll top position on admin bar
87
 
3
  Donate link:
4
  Tags: Google Analytics, New posts, Related Posts, sitemap, sns, twitter card, Facebook Page Plugin, OG tags,
5
  Requires at least: 5.3.0
6
+ Tested up to: 5.8.2
7
+ Requires PHP: 7.0
8
+ Stable tag: 9.69.0.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
82
 
83
  == Changelog ==
84
 
85
+ = 9.69.0.0 =
86
+ * [ Other ] Cope with Lightning G3 Pro Unit 404 Page customize
87
+ * [ Design tuning ] metabox css tuning in edit screen
88
+
89
  = 9.68.4.0 =
90
  * [ Bug fix ][ smooth scroll ] fix scroll top position on admin bar
91
 
vkExUnit.php CHANGED
@@ -3,8 +3,8 @@
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.68.4.0
7
- * Requires PHP: 5.6
8
  * Author: Vektor,Inc.
9
  * Text Domain: vk-all-in-one-expansion-unit
10
  * 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.69.0.0
7
+ * Requires PHP: 7.0
8
  * Author: Vektor,Inc.
9
  * Text Domain: vk-all-in-one-expansion-unit
10
  * Domain Path: /languages