VK All in One Expansion Unit - Version 9.22.0.0

Version Description

  • [ Add function ] Default eyecatch image
Download this release

Release Info

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

Code changes from version 9.21.0.0 to 9.22.0.0

inc/default-thumbnail/customize.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Add Customize Panel
4
+ /*-------------------------------------------*/
5
+ add_filter( 'veu_customize_panel_activation', 'veu_customize_panel_activation_default_thumbnail' );
6
+ function veu_customize_panel_activation_default_thumbnail() {
7
+ return true;
8
+ }
9
+
10
+ if ( apply_filters( 'veu_customize_panel_activation', false ) ) {
11
+ add_action( 'customize_register', 'veu_customize_register_default_thumbnail', 20 );
12
+ }
13
+
14
+ function veu_customize_register_default_thumbnail( $wp_customize ) {
15
+ /*
16
+ Defualt Thumbnail Settings
17
+ /*-------------------------------------------*/
18
+ // 1. テーマカスタマイザー上に新しいセクションを追加
19
+ $wp_customize->add_section(
20
+ 'veu_default_thumbnail_setting',
21
+ array(
22
+ 'title' => __( 'Defualt Thumbnail Settings', 'vk-all-in-one-expansion-unit' ),
23
+ 'panel' => 'veu_setting',
24
+ )
25
+ );
26
+
27
+ // defualt list image.
28
+ $wp_customize->add_setting(
29
+ 'veu_defualt_thumbnail[default_thumbnail_image]',
30
+ array(
31
+ 'default' => '',
32
+ 'type' => 'option',
33
+ 'capability' => 'edit_theme_options',
34
+ 'sanitize_callback' => 'vk_sanitize_number',
35
+ )
36
+ );
37
+
38
+ $wp_customize->add_control(
39
+ new WP_Customize_Media_Control(
40
+ $wp_customize,
41
+ 'veu_defualt_thumbnail[default_thumbnail_image]',
42
+ array(
43
+ 'label' => __( 'Default List Image', 'lightning' ),
44
+ 'section' => 'veu_default_thumbnail_setting',
45
+ 'settings' => 'veu_defualt_thumbnail[default_thumbnail_image]',
46
+ 'description' => '',
47
+ 'mime_type' => 'image',
48
+ 'priority' => 700,
49
+ )
50
+ )
51
+ );
52
+ }
inc/default-thumbnail/default-thumbnail-admin.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Default Thumbnail
4
+ /*-------------------------------------------*/
5
+ $options = get_option( 'veu_defualt_thumbnail' );
6
+ ?>
7
+ <h3><?php echo __( 'Default Thumbnail', 'vk-all-in-one-expansion-unit' ); ?></h3>
8
+ <div id="defaultThumbnailSetting" class="sectionBox">
9
+
10
+ <table class="form-table">
11
+ <tr>
12
+ <th><?php _e( 'Default Thumbnail Image', 'vk-all-in-one-expansion-unit' ); ?></th>
13
+ <td>
14
+ <?php
15
+ // 現在保存されている画像idを取得して表示
16
+ $image = null;
17
+ if ( is_numeric( $options['default_thumbnail_image'] ) ) {
18
+ $image = wp_get_attachment_image_src( $options['default_thumbnail_image'], 'large' );
19
+ }
20
+ ?>
21
+ <div class="_display" style="height:auto">
22
+ <?php if ( $image ) : ?>
23
+ <img src="<?php echo $image[0]; ?>" style="width:200px;height:auto;" />
24
+ <?php endif; ?>
25
+ </div>
26
+
27
+ <button class="button button-default button-block" style="display:block;width:200px;text-align: center; margin:4px 0;" onclick="javascript:veu_default_image_additional(this);return false;">
28
+ <?php _e( 'Set image', 'vk-all-in-one-expansion-unit' ); ?>
29
+ </button>
30
+
31
+ <input type="hidden" class="__id" name="veu_defualt_thumbnail[default_thumbnail_image]" value="<?php echo esc_attr( $options['default_thumbnail_image'] ); ?>" />
32
+
33
+ <script type="text/javascript">
34
+ if(veu_default_image_additional == undefined){
35
+ var veu_default_image_additional = function(e){
36
+ var d=jQuery(e).parent().children("._display");
37
+ var w=jQuery(e).parent().children('.__id')[0];
38
+ var u=wp.media({library:{type:'image'},multiple:false}).on('select', function(e){
39
+ u.state().get('selection').each(function(f){
40
+ // もともと表示されてた img タグを削除
41
+ d.children().remove();
42
+ // 新しく画像タグを挿入
43
+ d.append(jQuery('<img style="width:200px;mheight:auto">').attr('src',f.toJSON().url));
44
+ jQuery(w).val(f.toJSON().id).change(); });
45
+ });
46
+ u.open();
47
+ };
48
+ }
49
+ </script>
50
+ </td>
51
+ </tr>
52
+ </table>
53
+
54
+ <?php submit_button(); ?>
55
+ </div>
inc/default-thumbnail/default-thumbnail.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once dirname( __FILE__ ) . '/customize.php';
4
+
5
+ /**
6
+ * Defualt Thumbnail Change.
7
+ *
8
+ * @param string $html output of html.
9
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
10
+ * @param string|array $size Optional. Image size to use. Accepts any valid image size, or
11
+ * an array of width and height values in pixels (in that order).
12
+ * Default 'post-thumbnail'.
13
+ * @param string|array $attr Optional. Query string or array of attributes. Default empty.
14
+ */
15
+ function veu_post_thumbnail_html( $html, $post = null, $post_thumbnail_id = null, $size = 'post-thumbnail', $attr = '' ) {
16
+ $post = get_post( $post );
17
+ if ( ! $post ) {
18
+ return '';
19
+ }
20
+ $post_thumbnail_id = get_post_thumbnail_id( $post );
21
+
22
+ $size = apply_filters( 'post_thumbnail_size', $size, $post->ID );
23
+
24
+ $image_option = get_option( 'veu_defualt_thumbnail' );
25
+ $image_default_id = ! empty( $image_option['default_thumbnail_image'] ) ? $image_option['default_thumbnail_image'] : '';
26
+
27
+ if ( ! $post_thumbnail_id ) {
28
+ if ( $image_default_id ) {
29
+ do_action( 'begin_fetch_post_thumbnail_html', $post->ID, $image_default_id, $size );
30
+ if ( in_the_loop() ) {
31
+ update_post_thumbnail_cache();
32
+ }
33
+ $html = wp_get_attachment_image( $image_default_id, $size, false, $attr );
34
+ do_action( 'end_fetch_post_thumbnail_html', $post->ID, $image_default_id, $size );
35
+ } else {
36
+ $html = '';
37
+ }
38
+ }
39
+ return $html;
40
+ }
41
+ add_filter( 'post_thumbnail_html', 'veu_post_thumbnail_html', 10, 5 );
42
+
43
+ /**
44
+ * Change Has Post Thumbnail.
45
+ *
46
+ * @param bool $has_thumbnail Post has thumbnail or not.
47
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
48
+ */
49
+ function veu_has_post_thumbnail( $has_thumbnail, $post = null ) {
50
+ $thumbnail_id = get_post_thumbnail_id( $post );
51
+
52
+ $image_option = get_option( 'veu_defualt_thumbnail' );
53
+ $image_default_id = ! empty( $image_option['default_thumbnail_image'] ) ? $image_option['default_thumbnail_image'] : '';
54
+
55
+ if ( $thumbnail_id ) {
56
+ $has_thumbnail = true;
57
+ } elseif ( $image_default_id ) {
58
+ $has_thumbnail = true;
59
+ } else {
60
+ $has_thumbnail = false;
61
+ }
62
+ return $has_thumbnail;
63
+ }
64
+ add_filter( 'has_post_thumbnail', 'veu_has_post_thumbnail' );
65
+
66
+ function veu_change_vk_components_image_default_url( $options ) {
67
+ if ( veu_package_is_enable( 'default_thumbnail' ) ) {
68
+ $image_option = get_option( 'veu_defualt_thumbnail' );
69
+ $image_default_id = ! empty( $image_option['default_thumbnail_image'] ) ? $image_option['default_thumbnail_image'] : '';
70
+ if ( $image_default_id ) {
71
+ $image = wp_get_attachment_image_src( $image_default_id, 'large', false );
72
+ $options['image_default_url'] = $image[0];
73
+ }
74
+ }
75
+ return $options;
76
+ }
77
+ add_filter( 'vk_post_options', 'veu_change_vk_components_image_default_url' );
78
+
79
+ function veu_default_thumbnail_options_init() {
80
+ vkExUnit_register_setting(
81
+ __( 'Default Thumbnail', 'vk-all-in-one-expansion-unit' ), // tab label.
82
+ 'veu_defualt_thumbnail', // name attr
83
+ 'veu_default_thumbnail_options_validate', // sanitaise function name
84
+ 'veu_add_default_thumbnail_options_page' // setting_page function name
85
+ );
86
+ }
87
+ add_action( 'veu_package_init', 'veu_default_thumbnail_options_init' );
88
+
89
+ function veu_default_thumbnail_options_validate( $input ) {
90
+ $output['default_thumbnail_image'] = vk_sanitize_number( $input['default_thumbnail_image'] );
91
+ return $output;
92
+ }
93
+
94
+ /*
95
+ Add setting page
96
+ /*-------------------------------------------*/
97
+
98
+ function veu_add_default_thumbnail_options_page() {
99
+ require dirname( __FILE__ ) . '/default-thumbnail-admin.php';
100
+
101
+ }
inc/sns/function_follow.php CHANGED
@@ -34,13 +34,23 @@ function veu_add_follow( $content ) {
34
  /*----------------------------------------------*/
35
 
36
  $image_id = get_post_thumbnail_id();
37
- $image_url = wp_get_attachment_image_src( $image_id, true );
38
-
39
- $follow_html .= '<div class="veu_followSet">';
 
40
 
41
  // 画像
42
  if ( has_post_thumbnail() ) {
43
- $follow_html .= '<div class="followSet_img" style="background-image: url(\'' . $image_url[0] . '\')"></div>';
 
 
 
 
 
 
 
 
 
44
  }
45
 
46
  $follow_html .= '
34
  /*----------------------------------------------*/
35
 
36
  $image_id = get_post_thumbnail_id();
37
+ $image_url = wp_get_attachment_image_src( $image_id, true );
38
+ $follow_html .= '<div class="veu_followSet">';
39
+
40
+
41
 
42
  // 画像
43
  if ( has_post_thumbnail() ) {
44
+ if ( ! $image_url ) {
45
+ if ( veu_package_is_enable( 'default_thumbnail' ) ) {
46
+ $image_option = get_option( 'veu_defualt_thumbnail' );
47
+ $image_default_id = ! empty( $image_option['default_thumbnail_image'] ) ? $image_option['default_thumbnail_image'] : '';
48
+ if ( $image_default_id ) {
49
+ $image_url = wp_get_attachment_image_src( $image_default_id, true );
50
+ }
51
+ }
52
+ }
53
+ $follow_html .= '<div class="followSet_img" style="background-image: url(\'' . $image_url[0] . '\')"></div>';
54
  }
55
 
56
  $follow_html .= '
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Plugin Name ===
2
- Contributors: vektor-inc,kurudrive,nc30,SaoriMiyazaki,catherine8007,naoki0h
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.0.0
6
  Tested up to: 5.4.0
7
- Stable tag: 9.21.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -101,6 +101,9 @@ e.g.
101
 
102
  * [ Group block style ] Add alert style
103
 
 
 
 
104
  = 9.21.0.0 =
105
  * [ Specification change ] Font Awesome 5.11 -> 5.13
106
  * [ bug fix ][ Page list from ancestor ] do not display bug fix
1
  === Plugin Name ===
2
+ Contributors: vektor-inc,kurudrive,nc30,SaoriMiyazaki,catherine8007,naoki0h,rickaddison7634
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.0.0
6
  Tested up to: 5.4.0
7
+ Stable tag: 9.22.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
101
 
102
  * [ Group block style ] Add alert style
103
 
104
+ = 9.22.0.0 =
105
+ * [ Add function ] Default eyecatch image
106
+
107
  = 9.21.0.0 =
108
  * [ Specification change ] Font Awesome 5.11 -> 5.13
109
  * [ bug fix ][ Page list from ancestor ] do not display bug fix
veu-packages.php CHANGED
@@ -180,6 +180,24 @@ function veu_get_packages() {
180
  ),
181
  'default' => true,
182
  'include' => 'other-widget/other-widget.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  );
184
 
185
  /*
180
  ),
181
  'default' => true,
182
  'include' => 'other-widget/other-widget.php',
183
+ );
184
+
185
+ /**
186
+ * Defualt Thumbnail
187
+ */
188
+ $required_packages[] = array(
189
+ 'name' => 'default_thumbnail',
190
+ 'title' => __( 'Default Thumbnail', 'vk-all-in-one-expansion-unit' ),
191
+ 'description' => __( 'You can set Default Thumbnail.', 'vk-all-in-one-expansion-unit' ),
192
+ 'attr' => array(
193
+ array(
194
+ 'name' => __( 'Setting', 'vk-all-in-one-expansion-unit' ),
195
+ 'url' => admin_url() . 'admin.php?page=vkExUnit_main_setting#vkExUnit_default_thumbnail',
196
+ 'enable_only' => 1,
197
+ ),
198
+ ),
199
+ 'default' => true,
200
+ 'include' => 'default-thumbnail/default-thumbnail.php',
201
  );
202
 
203
  /*
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.21.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.22.0.0
7
  * Author: Vektor,Inc.
8
  * Text Domain: vk-all-in-one-expansion-unit
9
  * Domain Path: /languages