PluginProbe
VK Blocks / 1.17.0
VK Blocks v1.17.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.17.0, at vk-blocks.php

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