VK All in One Expansion Unit - Version 9.81.0.0

Version Description

[ Add function ] Add function of article structure data

Download this release

Release Info

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

Code changes from version 9.80.1.0 to 9.81.0.0

inc/article-structure-data/class-vk-article-structure-data.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * VK_Article_Srtuctured_Data
4
+ *
5
+ * @package vektor-inc/vk-all-in-one-expanaion-unit
6
+ */
7
+
8
+ /**
9
+ * ユーザー設定に @typeとsameAsの項目を追加
10
+ */
11
+
12
+ class VK_Article_Srtuctured_Data {
13
+
14
+ public function __construct() {
15
+ add_action( 'show_user_profile', array( __CLASS__, 'add_user_meta_structure_data_ui' ) );
16
+ add_action( 'edit_user_profile', array( __CLASS__, 'add_user_meta_structure_data_ui' ) );
17
+ add_action( 'profile_update', array( __CLASS__, 'update_auhtor_structure_data' ), 10, 2 );
18
+ add_action( 'wp_head', array( __CLASS__, 'the_article_structure_data' ), 9999 );
19
+ }
20
+
21
+ /**
22
+ * Add Author Structure Date
23
+ *
24
+ * @param $bool
25
+ */
26
+ public static function add_user_meta_structure_data_ui() {
27
+ global $user_id;
28
+ $author_type = get_user_meta( $user_id, 'author_type', true ) ?: 'Organization';
29
+ $author_name = get_user_meta( $user_id, 'author_name', true );
30
+ $author_url = get_user_meta( $user_id, 'author_url', true );
31
+ $author_sameAs = get_user_meta( $user_id, 'author_sameAs', true );
32
+
33
+ ?>
34
+ <h2 style="margin-top:2em;">
35
+ <?php esc_html_e( 'Author information structured data', 'vk-all-in-one-expansion-unit' ); ?>
36
+ </h2>
37
+ <table class="form-table">
38
+ <tr>
39
+ <th><label for='author_type'>@type</label></th>
40
+ <td>
41
+ <select name='author_type' id='author_type'>
42
+ <option value='organization' <?php echo ( ( $author_type == 'organization' ) ) ? 'selected' : ''; ?> >Organization</option>
43
+ <option value='person' <?php echo ( ( $author_type == 'person' ) ) ? 'selected' : ''; ?> >Person</option>
44
+ </select>
45
+ <p class="discription">
46
+ <?php esc_html_e( 'Select Person if the author is an individual and Organization if the author is an organization.', 'vk-all-in-one-expansion-unit' ); ?>
47
+ </p>
48
+ </td>
49
+ </tr>
50
+ <tr>
51
+ <th><label for='author_name'>name</label></th>
52
+ <td>
53
+ <label><input id='author_name' type='text' name='author_name' value='<?php echo esc_attr( $author_name ); ?>'/></label>
54
+ <p class="discription">
55
+ <?php esc_html_e( 'If not entered, the display name on the blog will be used.', 'vk-all-in-one-expansion-unit' ); ?>
56
+ </p>
57
+ </td>
58
+ </tr>
59
+ <tr>
60
+ <th><label for='author_url'>url</label></th>
61
+ <td>
62
+ <label><input id='author_url' type='url' name='author_url' value='<?php echo esc_attr( $author_url ); ?>'/></label>
63
+ <p class="discription">
64
+ <?php esc_html_e( 'Enter the URL of this user\'s profile page.', 'vk-all-in-one-expansion-unit' ); ?><br />
65
+ <?php esc_html_e( 'If not entered', 'vk-all-in-one-expansion-unit' ); ?><br />
66
+ <?php esc_html_e( 'If @type is individual', 'vk-all-in-one-expansion-unit' ); ?> :
67
+ <?php esc_html_e( 'The URL of the contributor archive page on this site will be used.', 'vk-all-in-one-expansion-unit' ); ?><br />
68
+ <?php esc_html_e( 'If @type is organization', 'vk-all-in-one-expansion-unit' ); ?> :
69
+ <?php esc_html_e( 'The URL of the top page of this homepage is applied.', 'vk-all-in-one-expansion-unit' ); ?><br />
70
+ <?php esc_html_e( '* The URL of the site specified in the contact information of the user profile is not reflected in the url.', 'vk-all-in-one-expansion-unit' ); ?>
71
+ </p>
72
+ </td>
73
+ </tr>
74
+ <tr>
75
+ <th><label for='author_sameAs'>sameAs</label></th>
76
+ <td>
77
+ <label><input id='author_sameAs' type='url' name='author_sameAs' value='<?php echo esc_attr( $author_sameAs ); ?>'/></label>
78
+ <p class="discription"><?php esc_html_e( 'Specify the profile URL of SNS, Wikipedia, etc.', 'vk-all-in-one-expansion-unit' ); ?></p>
79
+ </td>
80
+ </tr>
81
+ </table>
82
+ <?php
83
+ }
84
+
85
+ /**
86
+ * Update Author Structure Date
87
+ */
88
+ public static function update_author_structure_data( $user_id, $old_user_data ) {
89
+ if ( isset( $_POST['author_type'] ) ) {
90
+ update_user_meta( $user_id, 'author_type', $_POST['author_type'], $old_user_data->author_type );
91
+ }
92
+ if ( isset( $_POST['author_name'] ) ) {
93
+ update_user_meta( $user_id, 'author_name', $_POST['author_name'], $old_user_data->author_name );
94
+ }
95
+ if ( isset( $_POST['author_url'] ) ) {
96
+ update_user_meta( $user_id, 'author_url', $_POST['author_url'], $old_user_data->author_url );
97
+ }
98
+ if ( isset( $_POST['author_sameAs'] ) ) {
99
+ update_user_meta( $user_id, 'author_sameAs', $_POST['author_sameAs'], $old_user_data->author_sameAs );
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Print Article Structure Data
105
+ *
106
+ * @return void
107
+ */
108
+ public static function the_article_structure_data() {
109
+ global $post;
110
+ $author_id = $post->post_author;
111
+ if ( is_single() ) {
112
+ $article_array = self::get_article_structure_array( $author_id );
113
+ if ( $article_array && is_array( $article_array ) ) {
114
+ echo '<!-- [ VK All in One Expansion Unit Article Structure Data ] -->';
115
+ echo '<script type="application/ld+json">' . json_encode( $article_array, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) . '</script>';
116
+ echo '<!-- [ / VK All in One Expansion Unit Article Structure Data ] -->';
117
+ }
118
+ }
119
+ }
120
+
121
+ /**
122
+ * 記事の構造化データの情報を配列で返す
123
+ *
124
+ * @return array $article_array
125
+ */
126
+ public static function get_article_structure_array( $author_id = '' ) {
127
+
128
+ if ( ! $author_id ) {
129
+ // 表示中のページの投稿オブジェクトからユーザーIDを取得
130
+ global $post;
131
+ $author_id = $post->post_author;
132
+ }
133
+
134
+ // $author_id = get_the_author_meta('ID');
135
+ if ( ! isset( $author_id ) ) {
136
+ return;
137
+ }
138
+
139
+ // $author_type = get_user_meta( $author_id, 'author_type', true );
140
+
141
+ if ( is_singular() ) {
142
+ if ( has_post_thumbnail() ) {
143
+ $image_url = get_the_post_thumbnail_url();
144
+ } else {
145
+ $image_url = '';
146
+ };
147
+ $post_title = get_the_title();
148
+ }
149
+
150
+ $article_array = array(
151
+ '@context' => 'https://schema.org/',
152
+ '@type' => 'Article',
153
+ 'headline' => $post_title,
154
+ 'image' => $image_url,
155
+ 'datePublished' => get_the_time( 'c' ),
156
+ 'dateModified' => get_the_modified_time( 'c' ),
157
+ 'author' => self::get_author_array( $author_id ),
158
+ // Google側で必須事項ではなく要件が不明確なのでコメントアウト。
159
+ // "publisher" => array(
160
+ // "@context" => "http://schema.org",
161
+ // "@type" => $author_type,
162
+ // "name" => get_bloginfo( 'name' ),
163
+ // "description" => get_bloginfo( 'description' ),
164
+ // "logo" => array(
165
+ // "@type" => "ImageObject",
166
+ // "url" => get_custom_logo(),
167
+ // ),
168
+ // ),
169
+ );
170
+
171
+ return $article_array;
172
+ }
173
+
174
+ /**
175
+ * ユーザー設定ページに登録されている情報を元に著者情報を配列で返す
176
+ *
177
+ * @param int $author_id
178
+ * @return array $author_array
179
+ */
180
+ public static function get_author_array( $author_id = '' ) {
181
+
182
+ if ( ! $author_id ) {
183
+ // 表示中のページの投稿オブジェクトからユーザーIDを取得
184
+ global $post;
185
+ $author_id = $post->post_author;
186
+ }
187
+
188
+ // $author_id = get_the_author_meta('ID');
189
+ if ( ! isset( $author_id ) ) {
190
+ return;
191
+ }
192
+
193
+ $author = get_userdata( $author_id );
194
+ $author_type = get_user_meta( $author_id, 'author_type', true );
195
+ $author_name = get_user_meta( $author_id, 'author_name', true ) ?: $author->display_name;
196
+ $author_url = get_user_meta( $author_id, 'author_url', true ) ?: home_url( '/' );
197
+ if ( 'person' === $author_type ) {
198
+ $author_url = get_user_meta( $author_id, 'author_url', true ) ?: get_author_posts_url( $author_id );
199
+ }
200
+ $author_sameAs = get_user_meta( $author_id, 'author_sameAs', true );
201
+
202
+ $author_array = array(
203
+ '@type' => $author_type,
204
+ 'name' => $author_name,
205
+ 'url' => $author_url,
206
+ 'sameAs' => $author_sameAs,
207
+ );
208
+
209
+ return $author_array;
210
+ }
211
+ }
212
+
213
+ new VK_Article_Srtuctured_Data();
readme.txt CHANGED
@@ -81,6 +81,9 @@ e.g.
81
 
82
  == Changelog ==
83
 
 
 
 
84
  = 9.80.1.0 =
85
  [ Bug fix ] Fixed broken layout of setting page
86
 
81
 
82
  == Changelog ==
83
 
84
+ = 9.81.0.0 =
85
+ [ Add function ] Add function of article structure data
86
+
87
  = 9.80.1.0 =
88
  [ Bug fix ] Fixed broken layout of setting page
89
 
vendor/autoload.php CHANGED
@@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
- return ComposerAutoloaderInitdc9a003a876f9daa524833c91c145d27::getLoader();
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
+ return ComposerAutoloaderInit573cb648aa150cf7de79c223e687e890::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitdc9a003a876f9daa524833c91c145d27
6
  {
7
  private static $loader;
8
 
@@ -24,12 +24,12 @@ class ComposerAutoloaderInitdc9a003a876f9daa524833c91c145d27
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
- spl_autoload_register(array('ComposerAutoloaderInitdc9a003a876f9daa524833c91c145d27', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29
- spl_autoload_unregister(array('ComposerAutoloaderInitdc9a003a876f9daa524833c91c145d27', 'loadClassLoader'));
30
 
31
  require __DIR__ . '/autoload_static.php';
32
- call_user_func(\Composer\Autoload\ComposerStaticInitdc9a003a876f9daa524833c91c145d27::getInitializer($loader));
33
 
34
  $loader->register(true);
35
 
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit573cb648aa150cf7de79c223e687e890
6
  {
7
  private static $loader;
8
 
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
+ spl_autoload_register(array('ComposerAutoloaderInit573cb648aa150cf7de79c223e687e890', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29
+ spl_autoload_unregister(array('ComposerAutoloaderInit573cb648aa150cf7de79c223e687e890', 'loadClassLoader'));
30
 
31
  require __DIR__ . '/autoload_static.php';
32
+ call_user_func(\Composer\Autoload\ComposerStaticInit573cb648aa150cf7de79c223e687e890::getInitializer($loader));
33
 
34
  $loader->register(true);
35
 
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitdc9a003a876f9daa524833c91c145d27
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'V' =>
@@ -46,9 +46,9 @@ class ComposerStaticInitdc9a003a876f9daa524833c91c145d27
46
  public static function getInitializer(ClassLoader $loader)
47
  {
48
  return \Closure::bind(function () use ($loader) {
49
- $loader->prefixLengthsPsr4 = ComposerStaticInitdc9a003a876f9daa524833c91c145d27::$prefixLengthsPsr4;
50
- $loader->prefixDirsPsr4 = ComposerStaticInitdc9a003a876f9daa524833c91c145d27::$prefixDirsPsr4;
51
- $loader->classMap = ComposerStaticInitdc9a003a876f9daa524833c91c145d27::$classMap;
52
 
53
  }, null, ClassLoader::class);
54
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit573cb648aa150cf7de79c223e687e890
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'V' =>
46
  public static function getInitializer(ClassLoader $loader)
47
  {
48
  return \Closure::bind(function () use ($loader) {
49
+ $loader->prefixLengthsPsr4 = ComposerStaticInit573cb648aa150cf7de79c223e687e890::$prefixLengthsPsr4;
50
+ $loader->prefixDirsPsr4 = ComposerStaticInit573cb648aa150cf7de79c223e687e890::$prefixDirsPsr4;
51
+ $loader->classMap = ComposerStaticInit573cb648aa150cf7de79c223e687e890::$classMap;
52
 
53
  }, null, ClassLoader::class);
54
  }
vendor/composer/installed.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php return array(
2
  'root' => array(
3
  'name' => 'vektor-inc/vk-all-in-one-expansion-unit',
4
- 'pretty_version' => '9.80.1.0',
5
- 'version' => '9.80.1.0',
6
- 'reference' => 'bd30c654671a462ac35351a5afa0fb7c0c53f5ec',
7
  'type' => 'project',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
@@ -20,9 +20,9 @@
20
  'dev_requirement' => false,
21
  ),
22
  'vektor-inc/vk-all-in-one-expansion-unit' => array(
23
- 'pretty_version' => '9.80.1.0',
24
- 'version' => '9.80.1.0',
25
- 'reference' => 'bd30c654671a462ac35351a5afa0fb7c0c53f5ec',
26
  'type' => 'project',
27
  'install_path' => __DIR__ . '/../../',
28
  'aliases' => array(),
1
  <?php return array(
2
  'root' => array(
3
  'name' => 'vektor-inc/vk-all-in-one-expansion-unit',
4
+ 'pretty_version' => '9.81.0.0',
5
+ 'version' => '9.81.0.0',
6
+ 'reference' => '096b09488ecc5875c62a30cf49fb1b20d8841423',
7
  'type' => 'project',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
20
  'dev_requirement' => false,
21
  ),
22
  'vektor-inc/vk-all-in-one-expansion-unit' => array(
23
+ 'pretty_version' => '9.81.0.0',
24
+ 'version' => '9.81.0.0',
25
+ 'reference' => '096b09488ecc5875c62a30cf49fb1b20d8841423',
26
  'type' => 'project',
27
  'install_path' => __DIR__ . '/../../',
28
  'aliases' => array(),
veu-packages.php CHANGED
@@ -2,9 +2,9 @@
2
  function veu_get_packages( $is_block_theme = null ) {
3
  $required_packages = array();
4
  if ( null === $is_block_theme ) {
5
- $is_block_theme = function_exists( 'wp_is_block_theme' ) && wp_is_block_theme();
6
  }
7
-
8
  /*
9
  Example :
10
  $required_packages[] = array(
@@ -527,6 +527,17 @@ function veu_get_packages( $is_block_theme = null ) {
527
  'include' => 'add-body-class.php',
528
  );
529
 
 
 
 
 
 
 
 
 
 
 
 
530
  /*
531
  Nav Menu Class Custom
532
  /*-------------------------------------------*/
2
  function veu_get_packages( $is_block_theme = null ) {
3
  $required_packages = array();
4
  if ( null === $is_block_theme ) {
5
+ $is_block_theme = function_exists( 'wp_is_block_theme' ) && wp_is_block_theme();
6
  }
7
+
8
  /*
9
  Example :
10
  $required_packages[] = array(
527
  'include' => 'add-body-class.php',
528
  );
529
 
530
+ /**
531
+ * Article Structure Data
532
+ */
533
+ $required_packages[] = array(
534
+ 'name' => 'article_structure_data',
535
+ 'title' => __( 'Article Structure Data', 'vk-all-in-one-expansion-unit' ),
536
+ 'description' => __( 'You can set Article Structure Data.', 'vk-all-in-one-expansion-unit' ),
537
+ 'default' => true,
538
+ 'include' => 'article-structure-data/class-vk-article-structure-data.php',
539
+ );
540
+
541
  /*
542
  Nav Menu Class Custom
543
  /*-------------------------------------------*/
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.80.1.0
7
  * Requires PHP: 7.2
8
  * Author: Vektor,Inc.
9
  * Text Domain: vk-all-in-one-expansion-unit
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.81.0.0
7
  * Requires PHP: 7.2
8
  * Author: Vektor,Inc.
9
  * Text Domain: vk-all-in-one-expansion-unit