Version Description
[ Update ] Update CTA Pattern [ Othe ] Add Pattern Lib notice
Download this release
Release Info
Developer | vektor-inc |
Plugin | VK Block Patterns |
Version | 1.23.0 |
Comparing to | |
See all releases |
Code changes from version 1.22.0 to 1.23.0
- admin/admin.php +110 -0
- build/admin/index.asset.php +1 -1
- build/admin/index.js +1 -1
- favorite-patterns/favorite-patterns.php +1 -0
- readme.txt +5 -1
- vk-block-patterns.php +7 -1
admin/admin.php
CHANGED
@@ -151,3 +151,113 @@ function vbp_admin_enqueue_scripts( $hook_suffix ) {
|
|
151 |
wp_localize_script( 'vk-patterns-admin-js', 'vkpOptions', $vbp_options );
|
152 |
}
|
153 |
add_action( 'admin_enqueue_scripts', 'vbp_admin_enqueue_scripts' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
wp_localize_script( 'vk-patterns-admin-js', 'vkpOptions', $vbp_options );
|
152 |
}
|
153 |
add_action( 'admin_enqueue_scripts', 'vbp_admin_enqueue_scripts' );
|
154 |
+
|
155 |
+
|
156 |
+
/**
|
157 |
+
* 警告文のリスト
|
158 |
+
*/
|
159 |
+
function vbp_vws_alert_list() {
|
160 |
+
|
161 |
+
// 変数を定義
|
162 |
+
$current_url = ( ( ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' ) ) ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
163 |
+
$url_next = false === strpos( $current_url, '?' ) ? '?' : '&';
|
164 |
+
$setting_link = admin_url() . 'options-general.php?page=vk_block_patterns_options';
|
165 |
+
|
166 |
+
// 無効なユーザーが設定された場合
|
167 |
+
$invalid_notice = '<div class="notice notice-warning"><p>';
|
168 |
+
$invalid_notice .= __( 'The registerd VWS account linkage is invalid. Please change VWS account linkage.', 'vk-block-patterns' );
|
169 |
+
$invalid_notice .= ' ';
|
170 |
+
$invalid_notice .= '<a href="' . $setting_link . '" class="button button-primary">' . __( 'Go to VK Block Patterns Setting', 'vk-block-patterns' ) . '</a>';
|
171 |
+
$invalid_notice .= ' ';
|
172 |
+
$invalid_notice .= '<a href="' . $current_url . $url_next . 'disable-invalid-notice" class="button button-secondary">' . __( 'Dismiss', 'vk-block-patterns' ) . '</a>';
|
173 |
+
$invalid_notice .= '</p></div>';
|
174 |
+
|
175 |
+
// 期限切れユーザーが設定された場合
|
176 |
+
$free_notice = '<div class="notice notice-warning"><p>';
|
177 |
+
$free_notice .= __( 'Your VWS account linkage is Outdated. Please Update VWS account license.', 'vk-block-patterns' );
|
178 |
+
$free_notice .= ' ';
|
179 |
+
$free_notice .= '<a href="' . $current_url . $url_next . 'disable-free-notice" class="button button-secondary">' . __( 'Dismiss', 'vk-block-patterns' ) . '</a>';
|
180 |
+
$free_notice .= '</p></div>';
|
181 |
+
|
182 |
+
// メールアドレスが入力されていない場合
|
183 |
+
$empty_notice = '<div class="notice notice-warning"><p>';
|
184 |
+
$empty_notice .= __( 'The VWS account linkage is not registerd. Please register VWS account linkage.', 'vk-block-patterns' );
|
185 |
+
$empty_notice .= ' ';
|
186 |
+
$empty_notice .= '<a href="' . $setting_link . '" class="button button-primary">' . __( 'Go to VK Block Patterns Setting', 'vk-block-patterns' ) . '</a>';
|
187 |
+
$empty_notice .= ' ';
|
188 |
+
$empty_notice .= '<a href="' . $current_url . $url_next . 'disable-empty-notice" class="button button-secondary">' . __( 'Dismiss', 'vk-block-patterns' ) . '</a>';
|
189 |
+
$empty_notice .= '</p></div>';
|
190 |
+
|
191 |
+
// 配列に整えて返す
|
192 |
+
$alert = array(
|
193 |
+
'invalid-user' => $invalid_notice,
|
194 |
+
'free-user' => $free_notice,
|
195 |
+
'empty-user' => $empty_notice,
|
196 |
+
);
|
197 |
+
|
198 |
+
return $alert;
|
199 |
+
}
|
200 |
+
|
201 |
+
|
202 |
+
|
203 |
+
/**
|
204 |
+
* 警告を追加
|
205 |
+
*
|
206 |
+
* @param Array $api API for TEST.
|
207 |
+
*/
|
208 |
+
function vbp_vws_alert( $api = array() ) {
|
209 |
+
$options = vbp_get_options();
|
210 |
+
$alerts = vbp_vws_alert_list();
|
211 |
+
$notice = '';
|
212 |
+
$lang = ( get_locale() === 'ja' || get_locale() === 'ja_JP' ) ? 'ja' : 'en';
|
213 |
+
|
214 |
+
if ( 'ja' === $lang ) {
|
215 |
+
if ( ! empty( $options['VWSMail'] ) ) {
|
216 |
+
$pattern_api_data = ! empty( $api ) ? $api : vbp_get_pattern_api_data();
|
217 |
+
if ( ! empty( $pattern_api_data ) && is_array( $pattern_api_data ) && ! empty( $pattern_api_data['role'] ) ) {
|
218 |
+
$role = $pattern_api_data['role'];
|
219 |
+
if ( 'invalid-user' === $role && false === $options['account-check']['disable-invalid-notice'] ) {
|
220 |
+
$notice = $alerts['invalid-user'];
|
221 |
+
} elseif ( 'free-user' === $role && false === $options['account-check']['disable-free-notice'] ) {
|
222 |
+
$notice = $alerts['free-user'];
|
223 |
+
}
|
224 |
+
}
|
225 |
+
} elseif ( false === $options['account-check']['disable-empty-notice'] ) {
|
226 |
+
$notice = $alerts['empty-user'];
|
227 |
+
}
|
228 |
+
}
|
229 |
+
return $notice;
|
230 |
+
}
|
231 |
+
|
232 |
+
function vbp_display_vws_alert() {
|
233 |
+
$notice = vbp_vws_alert();
|
234 |
+
echo $notice;
|
235 |
+
}
|
236 |
+
add_action( 'admin_notices', 'vbp_display_vws_alert' );
|
237 |
+
|
238 |
+
function vbp_admin_control() {
|
239 |
+
$options = vbp_get_options();
|
240 |
+
$current_date = date( 'Y-m-d H:i:s' );
|
241 |
+
|
242 |
+
if ( null !== $options['account-check']['date'] ) {
|
243 |
+
$checked_date = $options['account-check']['date'];
|
244 |
+
$diff_yaer = ( strtotime( $current_date ) - strtotime( $checked_date ) ) / ( 60 * 60 * 24 * 365 );
|
245 |
+
if ( 1 <= $diff_yaer ) {
|
246 |
+
$options['account-check']['disable-invalid-notice'] = false;
|
247 |
+
$options['account-check']['disable-free-notice'] = false;
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
if ( isset( $_GET['disable-invalid-notice'] ) ) {
|
252 |
+
$options['account-check']['disable-invalid-notice'] = true;
|
253 |
+
}
|
254 |
+
if ( isset( $_GET['disable-free-notice'] ) ) {
|
255 |
+
$options['account-check']['disable-free-notice'] = true;
|
256 |
+
}
|
257 |
+
if ( isset( $_GET['disable-empty-notice'] ) ) {
|
258 |
+
$options['account-check']['disable-empty-notice'] = true;
|
259 |
+
}
|
260 |
+
$options['account-check']['date'] = $current_date;
|
261 |
+
update_option( 'vk_block_patterns_options', $options );
|
262 |
+
}
|
263 |
+
add_action( 'admin_init', 'vbp_admin_control' );
|
build/admin/index.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-api', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('wp-api', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '54260d0846a24625f7b9');
|
build/admin/index.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){"use strict";var e,t={406:function(e,t,n){var r=window.wp.element,a=window.wp.i18n,l=window.wp.components,o=window.wp.api,i=n.n(o);(0,r.render)((0,r.createElement)((()=>{const e="1"===vkpOptions.showPatternsLink,t="1"===vkpOptions.disableCorePattern,n="1"===vkpOptions.disablePluginPattern,[o,s]=(0,r.useState)({role:vkpOptions.role,showPatternsLink:e,VWSMail:vkpOptions.VWSMail,disableCorePattern:t,disablePluginPattern:n}),c=e=>{s(e)},[u,p]=(0,r.useState)(!1),[k,v]=(0,r.useState)(""),b=(0,a.getLocaleData)()[""].lang,m=vkpOptions.adminUrl+"edit.php?post_type=vk-block-patterns";return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",null,(0,r.createElement)("section",null,(0,r.createElement)("h3",{id:"role-setting"},(0,a.__)("Role Setting","vk-block-patterns")),(0,r.createElement)("p",null,(0,a.__)("User permission to register patterns in VK Block Patterns","vk-block-patterns")," [ ",(0,r.createElement)("a",{href:m},"VK Block Patterns")," ]"),(0,r.createElement)(l.SelectControl,{value:o.role,onChange:e=>{c({...o,role:e})},options:[{label:(0,a.__)("Contributor or higher","vk-block-patterns"),value:"contributor"},{label:(0,a.__)("Author or higher","vk-block-patterns"),value:"author"},{label:(0,a.__)("Editor or higher","vk-block-patterns"),value:"editor"},{label:(0,a.__)("Administrator only","vk-block-patterns"),value:"administrator"}]})),(0,r.createElement)("section",null,(0,r.createElement)("h3",{id:"default-patterns-setting"},(0,a.__)("Default Pattern Setting","vk-block-patterns")),(0,r.createElement)(l.ToggleControl,{label:(0,a.__)("Disable WordPress Core Patterns","vk-block-patterns"),checked:o.disableCorePattern,onChange:e=>{c({...o,disableCorePattern:e})}}),(0,r.createElement)(l.ToggleControl,{label:(0,a.__)("Disable
|
1 |
+
!function(){"use strict";var e,t={406:function(e,t,n){var r=window.wp.element,a=window.wp.i18n,l=window.wp.components,o=window.wp.api,i=n.n(o);(0,r.render)((0,r.createElement)((()=>{const e="1"===vkpOptions.showPatternsLink,t="1"===vkpOptions.disableCorePattern,n="1"===vkpOptions.disablePluginPattern,[o,s]=(0,r.useState)({role:vkpOptions.role,showPatternsLink:e,VWSMail:vkpOptions.VWSMail,disableCorePattern:t,disablePluginPattern:n}),c=e=>{s(e)},[u,p]=(0,r.useState)(!1),[k,v]=(0,r.useState)(""),b=(0,a.getLocaleData)()[""].lang,m=vkpOptions.adminUrl+"edit.php?post_type=vk-block-patterns";return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",null,(0,r.createElement)("section",null,(0,r.createElement)("h3",{id:"role-setting"},(0,a.__)("Role Setting","vk-block-patterns")),(0,r.createElement)("p",null,(0,a.__)("User permission to register patterns in VK Block Patterns","vk-block-patterns")," [ ",(0,r.createElement)("a",{href:m},"VK Block Patterns")," ]"),(0,r.createElement)(l.SelectControl,{value:o.role,onChange:e=>{c({...o,role:e})},options:[{label:(0,a.__)("Contributor or higher","vk-block-patterns"),value:"contributor"},{label:(0,a.__)("Author or higher","vk-block-patterns"),value:"author"},{label:(0,a.__)("Editor or higher","vk-block-patterns"),value:"editor"},{label:(0,a.__)("Administrator only","vk-block-patterns"),value:"administrator"}]})),(0,r.createElement)("section",null,(0,r.createElement)("h3",{id:"default-patterns-setting"},(0,a.__)("Default Pattern Setting","vk-block-patterns")),(0,r.createElement)(l.ToggleControl,{label:(0,a.__)("Disable WordPress Core Patterns","vk-block-patterns"),checked:o.disableCorePattern,onChange:e=>{c({...o,disableCorePattern:e})}}),(0,r.createElement)(l.ToggleControl,{label:(0,a.__)("Disable default patterns of this plugin","vk-block-patterns"),checked:o.disablePluginPattern,onChange:e=>{c({...o,disablePluginPattern:e})}})),"ja_JP"===b&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("h3",{id:"pattern-library-setting"},(0,a.__)("VK Pattern Library Setting","vk-block-patterns")),(0,r.createElement)("section",null,(0,r.createElement)("h4",null,(0,a.__)("VWS account linkage","vk-block-patterns")),(0,r.createElement)("p",null,(0,r.createElement)("a",{href:"https://vws.vektor-inc.co.jp/product/lightning-g3-pro-pack?ref=vkbp-admin",target:"_blank"},"Lightning G3 Pro Pack")," のライセンスをお持ちのユーザーは、",(0,r.createElement)("a",{href:"https://vws.vektor-inc.co.jp/my-account",target:"_blank"},"アカウント"),"のメールアドレスを登録してください。",(0,r.createElement)("br",null),"VK Pattern Library でお気に入りに登録したパターンをエディター上で直接呼び出す事ができます。"),(0,r.createElement)(l.TextControl,{type:"email",className:"vws-mail-address",label:(0,a.__)("VWS Account email address","vk-block-patterns"),value:o.VWSMail,onChange:e=>{c({...o,VWSMail:e})}}),(0,r.createElement)("p",null,"[ ",(0,r.createElement)("a",{href:"https://patterns.vektor-inc.co.jp/about/about-favorite/",target:"_blank"},(0,a.__)("Click here for more information on Favorites","vk-block-patterns"))," ]")),(0,r.createElement)("section",null,(0,r.createElement)("h4",null,(0,a.__)("Editor Setting","vk-block-patterns")),(0,r.createElement)(l.ToggleControl,{label:(0,a.__)("Show VK Pattern Library link in editor toolbar","vk-block-patterns"),checked:o.showPatternsLink,onChange:e=>{c({...o,showPatternsLink:e})}}))),(0,r.createElement)(l.Button,{isPrimary:!0,onClick:()=>{p(!0),i().loadPromise.then((()=>{const e=new(i().models.Settings)({vk_block_patterns_options:o}).save();e.success((()=>{setTimeout((()=>{p(!1),v(!0)}),600)})),e.error((()=>{setTimeout((()=>{p(!1),v(!1)}),600)}))}))},isBusy:u},(0,a.__)("Save setting","vk-block-patterns")),u&&(0,r.createElement)(l.Spinner,null),!1===k&&(0,a.__)("Failed to save.","vk-block-patterns")))}),null),document.getElementById("vk_block_patterns_admin"))}},n={};function r(e){var a=n[e];if(void 0!==a)return a.exports;var l=n[e]={exports:{}};return t[e](l,l.exports,r),l.exports}r.m=t,e=[],r.O=function(t,n,a,l){if(!n){var o=1/0;for(u=0;u<e.length;u++){n=e[u][0],a=e[u][1],l=e[u][2];for(var i=!0,s=0;s<n.length;s++)(!1&l||o>=l)&&Object.keys(r.O).every((function(e){return r.O[e](n[s])}))?n.splice(s--,1):(i=!1,l<o&&(o=l));if(i){e.splice(u--,1);var c=a();void 0!==c&&(t=c)}}return t}l=l||0;for(var u=e.length;u>0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[n,a,l]},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={846:0,966:0};r.O.j=function(t){return 0===e[t]};var t=function(t,n){var a,l,o=n[0],i=n[1],s=n[2],c=0;if(o.some((function(t){return 0!==e[t]}))){for(a in i)r.o(i,a)&&(r.m[a]=i[a]);if(s)var u=s(r)}for(t&&t(n);c<o.length;c++)l=o[c],r.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return r.O(u)},n=self.webpackChunkvk_block_patterns=self.webpackChunkvk_block_patterns||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var a=r.O(void 0,[966],(function(){return r(406)}));a=r.O(a)}();
|
favorite-patterns/favorite-patterns.php
CHANGED
@@ -62,3 +62,4 @@ function vbp_register_favorite_patterns() {
|
|
62 |
}
|
63 |
}
|
64 |
add_action( 'init', 'vbp_register_favorite_patterns' );
|
|
62 |
}
|
63 |
}
|
64 |
add_action( 'init', 'vbp_register_favorite_patterns' );
|
65 |
+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: Guternberg, Block Pattern
|
5 |
Requires at least: 5.8
|
6 |
Tested up to: 6.0.1
|
7 |
-
Stable tag: 1.
|
8 |
Requires PHP: 7.2
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -16,6 +16,10 @@ When you activate this plugin that create new custom post type for custom block
|
|
16 |
|
17 |
== Changelog ==
|
18 |
|
|
|
|
|
|
|
|
|
19 |
= 1.22.0 =
|
20 |
[ Fix ] Setting screen
|
21 |
[ Update ] Update CTA Pattern
|
4 |
Tags: Guternberg, Block Pattern
|
5 |
Requires at least: 5.8
|
6 |
Tested up to: 6.0.1
|
7 |
+
Stable tag: 1.23.0
|
8 |
Requires PHP: 7.2
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
16 |
|
17 |
== Changelog ==
|
18 |
|
19 |
+
= 1.23.0 =
|
20 |
+
[ Update ] Update CTA Pattern
|
21 |
+
[ Othe ] Add Pattern Lib notice
|
22 |
+
|
23 |
= 1.22.0 =
|
24 |
[ Fix ] Setting screen
|
25 |
[ Update ] Update CTA Pattern
|
vk-block-patterns.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: VK Block Patterns
|
4 |
* Plugin URI: https://github.com/vektor-inc/vk-block-patterns
|
5 |
* Description: You can make and register your original custom block patterns.
|
6 |
-
* Version: 1.
|
7 |
* Requires at least: 5.8
|
8 |
* Author: Vektor,Inc.
|
9 |
* Author URI: https://vektor-inc.co.jp
|
@@ -69,6 +69,12 @@ function vbp_get_options() {
|
|
69 |
'VWSMail' => '',
|
70 |
'disableCorePattern' => false,
|
71 |
'disablePluginPattern' => false,
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
);
|
73 |
$options = get_option( 'vk_block_patterns_options' );
|
74 |
// showPatternsLinkは後から追加したので、option値に保存されてない時にデフォルトとマージする
|
3 |
* Plugin Name: VK Block Patterns
|
4 |
* Plugin URI: https://github.com/vektor-inc/vk-block-patterns
|
5 |
* Description: You can make and register your original custom block patterns.
|
6 |
+
* Version: 1.23.0
|
7 |
* Requires at least: 5.8
|
8 |
* Author: Vektor,Inc.
|
9 |
* Author URI: https://vektor-inc.co.jp
|
69 |
'VWSMail' => '',
|
70 |
'disableCorePattern' => false,
|
71 |
'disablePluginPattern' => false,
|
72 |
+
'account-check' => array(
|
73 |
+
'date' => null,
|
74 |
+
'disable-empty-notice' => false,
|
75 |
+
'disable-invalid-notice' => false,
|
76 |
+
'disable-free-notice' => false,
|
77 |
+
),
|
78 |
);
|
79 |
$options = get_option( 'vk_block_patterns_options' );
|
80 |
// showPatternsLinkは後から追加したので、option値に保存されてない時にデフォルトとマージする
|