VK All in One Expansion Unit - Version 9.46.0.0

Version Description

[ Add function ][ Archive list widget ] can be select list style ( add "select" )

Download this release

Release Info

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

Code changes from version 9.45.0.0 to 9.46.0.0

Files changed (3) hide show
  1. inc/other-widget/widget-archives.php +124 -84
  2. readme.txt +4 -1
  3. vkExUnit.php +1 -1
inc/other-widget/widget-archives.php CHANGED
@@ -4,7 +4,10 @@
4
  Archive list widget
5
  /*-------------------------------------------*/
6
  class WP_Widget_VK_archive_list extends WP_Widget {
7
- function __construct() {
 
 
 
8
  parent::__construct(
9
  'WP_Widget_VK_archive_list',
10
  self::veu_widget_name(),
@@ -20,121 +23,158 @@ class WP_Widget_VK_archive_list extends WP_Widget {
20
  return __( 'Displays a list of archives. You can choose the post type and also to display archives by month or by year.', 'vk-all-in-one-expansion-unit' );
21
  }
22
 
23
- function widget( $args, $instance ) {
 
 
 
24
  $arg = array(
25
  'echo' => 1,
26
  );
27
 
 
 
 
 
28
  if ( isset( $instance['display_type'] ) && $instance['display_type'] == 'y' ) {
29
  $arg['type'] = 'yearly';
30
- $arg['post_type'] = ( isset( $instance['post_type'] ) ) ? $instance['post_type'] : 'post';
31
  if ( strtoupper( get_locale() ) == 'JA' ) {
32
  $arg['after'] = '年';
33
  }
34
  } else {
35
  $arg['type'] = 'monthly';
36
- $arg['post_type'] = ( isset( $instance['post_type'] ) ) ? $instance['post_type'] : 'post';
37
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  ?>
39
- <?php echo $args['before_widget']; ?>
40
- <div class="sideWidget widget_archive">
41
- <?php if ( ( isset( $instance['label'] ) ) && $instance['label'] ) { ?>
42
- <?php echo $args['before_title'] . $instance['label'] . $args['after_title']; ?>
43
- <?php } ?>
44
- <ul class="localNavi">
45
- <?php wp_get_archives( $arg ); ?>
46
- </ul>
47
- </div>
48
- <?php echo $args['after_widget']; ?>
49
- <?php
50
- }
 
 
 
 
51
 
 
 
 
 
 
52
 
53
- function form( $instance ) {
 
 
 
 
54
  $defaults = array(
55
- 'post_type' => 'post',
56
- 'display_type' => 'm',
57
- 'label' => __( 'Monthly archives', 'vk-all-in-one-expansion-unit' ),
58
- 'hide' => __( 'Monthly archives', 'vk-all-in-one-expansion-unit' ),
59
  );
60
-
61
  $instance = wp_parse_args( (array) $instance, $defaults );
62
- $pages = get_post_types(
 
 
63
  array(
64
  'public' => true,
 
65
  '_builtin' => false,
66
  ),
67
- 'names'
 
68
  );
69
- $pages[] = 'post';
70
- ?>
71
- <p>
72
-
73
- <label for="<?php echo $this->get_field_id( 'label' ); ?>"><?php _e( 'Title', 'vk-all-in-one-expansion-unit' ); ?>:</label>
74
- <input type="text" id="<?php echo $this->get_field_id( 'label' ); ?>-title" name="<?php echo $this->get_field_name( 'label' ); ?>" value="<?php echo esc_attr( $instance['label'] ); ?>" ><br/>
75
- <input type="hidden" name="<?php echo $this->get_field_name( 'hide' ); ?>" ><br/>
76
-
77
- <label for="<?php echo $this->get_field_id( 'post_type' ); ?>"><?php _e( 'Post type', 'vk-all-in-one-expansion-unit' ); ?>:</label>
78
- <select name="<?php echo $this->get_field_name( 'post_type' ); ?>" >
79
- <?php foreach ( $pages as $page ) { ?>
80
- <option value="<?php echo $page; ?>"
81
- <?php
82
- if ( $instance['post_type'] == $page ) {
83
- echo 'selected="selected"'; }
84
- ?>
85
- ><?php echo $page; ?></option>
86
- <?php } ?>
87
- </select>
88
- <br/>
89
- <label for="<?php echo $this->get_field_id( 'display_type' ); ?>">表示タイプ</label>
90
- <select name="<?php echo $this->get_field_name( 'display_type' ); ?>" >
91
- <option value="m"
92
- <?php
93
- if ( $instance['display_type'] != 'y' ) {
94
- echo 'selected="selected"'; }
95
- ?>
96
- >
97
- <?php _e( 'Monthly', 'vk-all-in-one-expansion-unit' ); ?></option>
98
- <option value="y"
99
- <?php
100
- if ( $instance['display_type'] == 'y' ) {
101
- echo 'selected="selected"'; }
102
- ?>
103
- >
104
- <?php _e( 'Yearly', 'vk-all-in-one-expansion-unit' ); ?></option>
105
- </select>
106
- </p>
107
- <script type="text/javascript">
108
- jQuery(document).ready(function($){
109
- var post_labels = new Array();
110
- <?php
111
- foreach ( $pages as $page ) {
112
- $page_labl = get_post_type_object( $page );
113
- if ( isset( $page_labl->labels->name ) ) {
114
- echo 'post_labels["' . $page . '"] = "' . $page_labl->labels->name . '";';
115
- }
116
  }
117
- echo 'post_labels["blog"] = "Blog";' . "\n";
118
- ?>
119
- var posttype = jQuery("[name=\"<?php echo $this->get_field_name( 'post_type' ); ?>\"]");
120
- var lablfeld = jQuery("[name=\"<?php echo $this->get_field_name( 'label' ); ?>\"]");
121
- posttype.change(function(){
122
- lablfeld.val(post_labels[posttype.val()]+'<?php _e( 'archive', 'vk-all-in-one-expansion-unit' ); ?>');
123
- });
124
- });
125
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  <?php
127
  }
128
 
129
 
130
  function update( $new_instance, $old_instance ) {
131
  $instance = $old_instance;
 
132
  $instance['post_type'] = $new_instance['post_type'];
133
  $instance['display_type'] = $new_instance['display_type'];
134
- if ( ! $new_instance['label'] ) {
135
- $new_instance['label'] = $new_instance['hide'];
136
- }
137
- $instance['label'] = $new_instance['label'];
138
  return $instance;
139
  }
140
  }
4
  Archive list widget
5
  /*-------------------------------------------*/
6
  class WP_Widget_VK_archive_list extends WP_Widget {
7
+ /**
8
+ * Constructor
9
+ */
10
+ public function __construct() {
11
  parent::__construct(
12
  'WP_Widget_VK_archive_list',
13
  self::veu_widget_name(),
23
  return __( 'Displays a list of archives. You can choose the post type and also to display archives by month or by year.', 'vk-all-in-one-expansion-unit' );
24
  }
25
 
26
+ /**
27
+ * ウィジェットの表示画面
28
+ */
29
+ public function widget( $args, $instance ) {
30
  $arg = array(
31
  'echo' => 1,
32
  );
33
 
34
+ // 投稿タイプ.
35
+ $arg['post_type'] = ( isset( $instance['post_type'] ) ) ? $instance['post_type'] : 'post';
36
+
37
+ // 表示タイプ
38
  if ( isset( $instance['display_type'] ) && $instance['display_type'] == 'y' ) {
39
  $arg['type'] = 'yearly';
 
40
  if ( strtoupper( get_locale() ) == 'JA' ) {
41
  $arg['after'] = '年';
42
  }
43
  } else {
44
  $arg['type'] = 'monthly';
 
45
  }
46
+
47
+ // 表示デザイン
48
+ if ( isset( $instance['display_design'] ) && 'select' === $instance['display_design'] ) {
49
+ $arg['format'] = 'option';
50
+ } else {
51
+ $arg['format'] = 'html';
52
+ }
53
+
54
+ $get_posts = get_posts(
55
+ array(
56
+ 'post_type' => $arg['post_type']
57
+ )
58
+ );
59
+ if ( ! empty( $get_posts ) ) {
60
  ?>
61
+ <?php echo $args['before_widget']; ?>
62
+ <div class="sideWidget widget_archive">
63
+ <?php
64
+ if ( ( isset( $instance['label'] ) ) && $instance['label'] ) {
65
+ echo $args['before_title'] . $instance['label'] . $args['after_title'];
66
+ }
67
+ ?>
68
+ <?php if ( 'option' === $arg['format'] ) : ?>
69
+ <select class="localNavi" name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'>
70
+ <?php wp_get_archives( $arg ); ?>
71
+ </select>
72
+ <?php else : ?>
73
+ <ul class="localNavi">
74
+ <?php wp_get_archives( $arg ); ?>
75
+ </ul>
76
+ <?php endif; ?>
77
 
78
+ </div>
79
+ <?php echo $args['after_widget']; ?>
80
+ <?php
81
+ }
82
+ }
83
 
84
+ /**
85
+ * ウィジェットの設定画面
86
+ */
87
+ public function form( $instance ) {
88
+ // インスタンスを初期化&調整.
89
  $defaults = array(
90
+ 'post_type' => 'post',
91
+ 'display_type' => 'm',
92
+ 'label' => __( 'Monthly archives', 'vk-all-in-one-expansion-unit' ),
93
+ 'display_design' => 'list',
94
  );
 
95
  $instance = wp_parse_args( (array) $instance, $defaults );
96
+
97
+ // 投稿タイプをオブジェクトで取得.
98
+ $the_post_types = get_post_types(
99
  array(
100
  'public' => true,
101
+ 'show_ui' => true,
102
  '_builtin' => false,
103
  ),
104
+ 'objects',
105
+ 'and'
106
  );
107
+
108
+ // 選択肢用配列の定義&「投稿」を挿入.
109
+ $select_post_types = array(
110
+ array(
111
+ 'label' => get_post_type_object( 'post' )->labels->singular_name,
112
+ 'value' => get_post_type_object( 'post' )->name,
113
+ ),
114
+ );
115
+ // 選択肢用配列に各カスタム投稿タイプを追加.
116
+ foreach ( $the_post_types as $the_post_type ) {
117
+ $get_posts = get_posts(
118
+ array(
119
+ 'post_type' => $the_post_type->name,
120
+ )
121
+ );
122
+ if ( ! empty( $get_posts ) ) {
123
+ $select_post_types[] = array(
124
+ 'label' => $the_post_type->labels->singular_name,
125
+ 'value' => $the_post_type->name,
126
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
+ }
129
+ ?>
130
+ <div>
131
+
132
+ <!-- タイトル -->
133
+ <div>
134
+ <label for="<?php echo $this->get_field_id( 'label' ); ?>"><?php _e( 'Title', 'vk-all-in-one-expansion-unit' ); ?>:</label>
135
+ <input type="text" id="<?php echo $this->get_field_id( 'label' ); ?>-title" name="<?php echo $this->get_field_name( 'label' ); ?>" value="<?php echo esc_attr( $instance['label'] ); ?>" >
136
+ </div>
137
+
138
+ <!-- 投稿タイプ -->
139
+ <div>
140
+ <label for="<?php echo $this->get_field_id( 'post_type' ); ?>"><?php _e( 'Post type', 'vk-all-in-one-expansion-unit' ); ?>:</label>
141
+ <select name="<?php echo $this->get_field_name( 'post_type' ); ?>" >
142
+ <?php foreach ( $select_post_types as $select_post_type ) : ?>
143
+ <option value="<?php echo $select_post_type['value']; ?>" <?php selected( $select_post_type['value'], $instance['post_type'] , true ); ?>>
144
+ <?php echo $select_post_type['label']; ?>
145
+ </option>
146
+ <?php endforeach; ?>
147
+ </select>
148
+ </div>
149
+
150
+ <!-- 表示タイプ -->
151
+ <div>
152
+ <label for="<?php echo $this->get_field_id( 'display_type' ); ?>">表示タイプ</label>
153
+ <select name="<?php echo $this->get_field_name( 'display_type' ); ?>" >
154
+ <option value="m" <?php selected( $instance['display_type'], 'm', true ); ?>><?php _e( 'Monthly', 'vk-all-in-one-expansion-unit' ); ?></option>
155
+ <option value="y" <?php selected( $instance['display_type'], 'y', true ); ?>><?php _e( 'Yearly', 'vk-all-in-one-expansion-unit' ); ?></option>
156
+ </select>
157
+ </div>
158
+
159
+ <!-- デザイン -->
160
+ <div>
161
+ <label for="<?php echo $this->get_field_id( 'display_design' ); ?>">デザイン</label>
162
+ <select name="<?php echo $this->get_field_name( 'display_design' ); ?>" >
163
+ <option value="list" <?php selected( $instance['display_design'],'list',true ); ?>><?php _e( 'Lists', 'vk-all-in-one-expansion-unit' ); ?></option>
164
+ <option value="select" <?php selected( $instance['display_design'],'select',true ); ?>><?php _e( 'Select', 'vk-all-in-one-expansion-unit' ); ?></option>
165
+ </select>
166
+ </div>
167
+ </div>
168
  <?php
169
  }
170
 
171
 
172
  function update( $new_instance, $old_instance ) {
173
  $instance = $old_instance;
174
+ $instance['label'] = $new_instance['label'];
175
  $instance['post_type'] = $new_instance['post_type'];
176
  $instance['display_type'] = $new_instance['display_type'];
177
+ $instance['display_design'] = $new_instance['display_design'];
 
 
 
178
  return $instance;
179
  }
180
  }
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.45.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.45.0.0 =
85
  [ Add function ] Add plugin short cut link to adminbar
86
  [ Design specification Change ][ Child Page List / Page list from ancestors ] When set to first object that delete margin top.
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.46.0.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.46.0.0 =
85
+ [ Add function ][ Archive list widget ] can be select list style ( add "select" )
86
+
87
  = 9.45.0.0 =
88
  [ Add function ] Add plugin short cut link to adminbar
89
  [ Design specification Change ][ Child Page List / Page list from ancestors ] When set to first object that delete margin top.
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.45.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.46.0.0
7
  * Author: Vektor,Inc.
8
  * Text Domain: vk-all-in-one-expansion-unit
9
  * Domain Path: /languages