PluginProbe
VK Blocks / 1.23.0
VK Blocks v1.23.0
1.126.4 1.126.3 1.126.1 1.126.2 1.126.0 1.125.0 1.124.0 1.123.0 1.122.0 1.121.0 1.120.0 1.119.2 1.119.1 1.119.0 1.118.7 1.82.0.0 1.82.0.1 1.83.0.0 1.83.0.1 1.84.0.0 1.84.0.1 1.85.0.2 1.85.0.3 1.85.1.0 1.85.1.1 All 287 releases
vk-blocks / vk-blocks.php

vk-blocks.php in VK Blocks 1.23.0, at vk-blocks.php

128 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: VK Blocks
4 * Plugin URI: https://github.com/vektor-inc/vk-blocks
5 * Description: This is a plugin that extends Gutenberg's blocks.
6 * Version: 1.23.0
7 * Stable tag: 1.23.0
8 * Requires at least: 5.8
9 * Author: Vektor,Inc.
10 * Author URI: https://vektor-inc.co.jp
11 * Text Domain: vk-blocks
12 *
13 * @package vk-blocks
14 */
15
16 // Do not load directly.
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
19 }
20
21 // Composer のファイルを読み込み ( composer install --no-dev ).
22 require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
23 // Set plugin dir path.
24 define( 'VK_BLOCKS_DIR_PATH', plugin_dir_path( __FILE__ ) );
25 // Set Plugin Dir URL.
26 define( 'VK_BLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) );
27
28 /*
29 無料版の VK Blocks の無効化が正常に動作しなかった場合に無料版の関数が�
30 �に定義され
31 重複 -> Fatal error になるため function_exists は フォールバックとして付与している
32 */
33 if ( ! function_exists( 'vk_blocks_get_version' ) ) {
34 /**
35 * Get Plugin Version
36 *
37 * @return string
38 */
39 function vk_blocks_get_version() {
40 $data = get_file_data( __FILE__, array( 'version' => 'Version' ) );
41 return $data['version'];
42 }
43 }
44 if ( ! function_exists( 'vk_blocks_deactivate_plugin' ) ) {
45 /**
46 * Plugin deactive function
47 *
48 * @param string $plugin_path Plugin path to disable.
49 * @return void
50 */
51 function vk_blocks_deactivate_plugin( $plugin_path ) {
52 include_once ABSPATH . 'wp-admin/includes/plugin.php';
53 if ( is_plugin_active( $plugin_path ) ) {
54 $active_plugins = get_option( 'active_plugins' );
55 // delete active plugin.
56 $active_plugins = array_diff( $active_plugins, array( $plugin_path ) );
57 // re index active plugin.
58 $active_plugins = array_values( $active_plugins );
59 update_option( 'active_plugins', $active_plugins );
60 }
61 }
62 }
63
64 /**
65 * Deactive VK Blocks ( Free )
66 *
67 * 関数名�
68 �れると無料版 VK Blocks の宣言と被ってエラーになるので一時的な回避処理で無名関数を利用している
69 */
70 add_action(
71 'admin_init',
72 function() {
73 $plugin_base_dir = dirname( __FILE__ );
74 include_once ABSPATH . 'wp-admin/includes/plugin.php';
75 if ( is_plugin_active( 'vk-blocks-pro/vk-blocks.php' ) ) {
76 // Deactive Plugin VK Blocks ( free ).
77 if ( function_exists( 'vk_blocks_deactivate_plugin' ) ) {
78 vk_blocks_deactivate_plugin( 'vk-blocks/vk-blocks.php' );
79 }
80 }
81 // Deactive ExUnit included VK Blocks.
82 $options = get_option( 'vkExUnit_common_options' );
83 if ( ! empty( $options['active_vk-blocks'] ) ) {
84 $options['active_vk-blocks'] = false;
85 update_option( 'vkExUnit_common_options', $options );
86 }
87 },
88 9999
89 );
90
91 if ( is_admin() && ! is_network_admin() ) {
92 $vk_blocks_options = get_option( 'vkExUnit_common_options' );
93 if ( ! empty( $vk_blocks_options['active_vk-blocks'] ) ) {
94 $vk_blocks_options['active_vk-blocks'] = false;
95 update_option( 'vkExUnit_common_options', $vk_blocks_options );
96
97 add_action(
98 'admin_notices',
99 function() {
100 echo '<div class="updated notice"><p>';
101 echo esc_html( __( 'Disabled Blocks module on VK All in One Expansion Unit. Because VK-Blocks Plugin running.', 'vk-blocks' ) );
102 echo '</p></div>';
103 }
104 );
105 }
106 }
107
108 /**
109 * Load VK Blocks
110 */
111 require_once plugin_dir_path( __FILE__ ) . 'inc/vk-blocks-config.php';
112
113 /**
114 * Load updater ( Pro version only )
115 */
116 $vk_blocks_plugin_base_dir = plugin_dir_path( __FILE__ );
117 if ( strpos( $vk_blocks_plugin_base_dir, 'vk-blocks-pro' ) !== false ) {
118
119 // Cope with : WP HTTP Error: cURL error 60: SSL certificate problem: certificate has expired.
120 add_filter( 'https_ssl_verify', '__return_false' );
121
122 $vk_blocks_update_checker = Puc_v4_Factory::buildUpdateChecker(
123 'https://vws.vektor-inc.co.jp/updates/?action=get_metadata&slug=vk-blocks-pro',
124 __FILE__,
125 'vk-blocks-pro'
126 );
127 }
128