PluginProbe
VK Blocks / 1.20.7
VK Blocks v1.20.7
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
126 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.20.7
7 * Stable tag: 1.20.7
8 * Requires at least: 5.7
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 /* function_exists は VK Blocks 無料版の無効化が正常に動作しなかった場合のフォールバック */
29 if ( ! function_exists( 'vk_blocks_get_version' ) ) {
30 /**
31 * Get Plugin Version
32 *
33 * @return string
34 */
35 function vk_blocks_get_version() {
36 $data = get_file_data( __FILE__, array( 'version' => 'Version' ) );
37 return $data['version'];
38 }
39 }
40
41 /* function_exists は VK Blocks 無料版の無効化が正常に動作しなかった場合のフォールバック */
42 if ( ! function_exists( 'vk_blocks_deactivate_plugin' ) ) {
43 /**
44 * Plugin deactive function
45 *
46 * @param string $plugin_path Plugin path to disable.
47 * @return void
48 */
49 function vk_blocks_deactivate_plugin( $plugin_path ) {
50 include_once ABSPATH . 'wp-admin/includes/plugin.php';
51 if ( is_plugin_active( $plugin_path ) ) {
52 $active_plugins = get_option( 'active_plugins' );
53 // delete active plugin.
54 $active_plugins = array_diff( $active_plugins, array( $plugin_path ) );
55 // re index active plugin.
56 $active_plugins = array_values( $active_plugins );
57 update_option( 'active_plugins', $active_plugins );
58 }
59 }
60 }
61
62 /**
63 * Deactive VK Blocks ( Free )
64 *
65 * 関数名�
66 �れると無料版 VK Blocks の宣言と被ってエラーになるので一時的な回避処理で無名関数を利用している
67 */
68 add_action(
69 'admin_init',
70 function() {
71 $plugin_base_dir = dirname( __FILE__ );
72 include_once ABSPATH . 'wp-admin/includes/plugin.php';
73 if ( is_plugin_active( 'vk-blocks-pro/vk-blocks.php' ) ) {
74 // Deactive Plugin VK Blocks ( free ).
75 if ( function_exists( 'vk_blocks_deactivate_plugin' ) ) {
76 vk_blocks_deactivate_plugin( 'vk-blocks/vk-blocks.php' );
77 }
78 }
79 // Deactive ExUnit included VK Blocks.
80 $options = get_option( 'vkExUnit_common_options' );
81 if ( ! empty( $options['active_vk-blocks'] ) ) {
82 $options['active_vk-blocks'] = false;
83 update_option( 'vkExUnit_common_options', $options );
84 }
85 },
86 9999
87 );
88
89 if ( is_admin() && ! is_network_admin() ) {
90 $vk_blocks_options = get_option( 'vkExUnit_common_options' );
91 if ( ! empty( $vk_blocks_options['active_vk-blocks'] ) ) {
92 $vk_blocks_options['active_vk-blocks'] = false;
93 update_option( 'vkExUnit_common_options', $vk_blocks_options );
94
95 add_action(
96 'admin_notices',
97 function() {
98 echo '<div class="updated notice"><p>';
99 echo esc_html( __( 'Disabled Blocks module on VK All in One Expansion Unit. Because VK-Blocks Plugin running.', 'vk-blocks' ) );
100 echo '</p></div>';
101 }
102 );
103 }
104 }
105
106 /**
107 * Load VK Blocks
108 */
109 require_once plugin_dir_path( __FILE__ ) . 'inc/vk-blocks-config.php';
110
111 /**
112 * Load updater ( Pro version only )
113 */
114 $vk_blocks_plugin_base_dir = plugin_dir_path( __FILE__ );
115 if ( strpos( $vk_blocks_plugin_base_dir, 'vk-blocks-pro' ) !== false ) {
116
117 // Cope with : WP HTTP Error: cURL error 60: SSL certificate problem: certificate has expired.
118 add_filter( 'https_ssl_verify', '__return_false' );
119
120 $vk_blocks_update_checker = Puc_v4_Factory::buildUpdateChecker(
121 'https://vws.vektor-inc.co.jp/updates/?action=get_metadata&slug=vk-blocks-pro',
122 __FILE__,
123 'vk-blocks-pro'
124 );
125 }
126