PluginProbe
PublishPress Blocks – Block Controls, Block Visibility, Block Permissions / trunk
PublishPress Blocks – Block Controls, Block Visibility, Block Permissions vtrunk
3.7.6 3.7.5 3.7.4 3.7.3 3.7.2 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.4.1 3.1.4.2 3.1.4.3 3.1.5 3.1.6 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 All 161 releases
advanced-gutenberg / install.php

install.php in PublishPress Blocks – Block Controls, Block Visibility, Block Permissions trunk, at install.php

93 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined('ABSPATH') || die;
4
5 if (! defined('GUTENBERG_VERSION_REQUIRED')) {
6 define('GUTENBERG_VERSION_REQUIRED', '5.7.0');
7 }
8
9 // Check if Gutenberg is activated
10 if (! function_exists('register_block_type')) {
11 $gutenbergInstallUrl = wp_nonce_url(
12 add_query_arg(
13 array(
14 'action' => 'install-plugin',
15 'plugin' => 'gutenberg'
16 ),
17 admin_url('update.php')
18 ),
19 'install-plugin_gutenberg'
20 );
21
22 wp_die(
23 esc_html__('Gutenberg is not detected! Activate it or', 'advanced-gutenberg')
24 . ': <a href="' . esc_attr($gutenbergInstallUrl) . '">' . esc_html__(
25 'Install Gutenberg Now!',
26 'advanced-gutenberg'
27 ) . '</a>'
28 );
29 exit;
30 }
31
32 if (defined('GUTENBERG_VERSION')) {
33 if (version_compare(GUTENBERG_VERSION, GUTENBERG_VERSION_REQUIRED, 'lt')) {
34 wp_die(
35 esc_html__('We require at least Gutenberg version ', 'advanced-gutenberg')
36 . esc_html(GUTENBERG_VERSION_REQUIRED) . '. ' .
37 esc_html__('Please update Gutenberg then comeback later!', 'advanced-gutenberg')
38 );
39 exit;
40 }
41 }
42
43 // Add default settings for first time install
44 $saved_settings = get_option('advgb_settings');
45
46 if ($saved_settings === false) {
47 update_option('advgb_settings', array(
48 'gallery_lightbox' => 0, // Legacy feature: off by default on new sites
49 'gallery_lightbox_caption' => '1',
50 'blocks_icon_color' => '#655997',
51 'disable_wpautop' => 0,
52 'enable_columns_visual_guide' => 1,
53 'enable_block_access' => 1,
54 'enable_custom_styles' => 1,
55 'enable_advgb_blocks' => 1,
56 'enable_pp_branding' => 1,
57 'enable_core_blocks_features' => 1,
58 'block_controls' => 1,
59 'block_extend' => 0,
60 'reusable_blocks' => 1
61 ));
62 }
63
64 // Legacy blocks: OFF by default on new sites. Existing sites are handled by
65 // the versioned upgrade routine in init.php, which defaults them ON.
66 if ($saved_settings === false && get_option('advgb_legacy_blocks') === false) {
67 update_option('advgb_legacy_blocks', array(
68 'container' => 0,
69 'contact-form' => 0,
70 'image' => 0,
71 'images-slider' => 0,
72 'login-form' => 0,
73 'map' => 0,
74 'newsletter' => 0,
75 'search-bar' => 0,
76 'social-links' => 0,
77 'summary' => 0,
78 'testimonial' => 0,
79 'video' => 0,
80 'woo-products' => 0,
81 ), false);
82 update_option('advgb_legacy_settings_migrated', 1, false);
83 }
84
85 update_option('advgb_maybe_new_blocks', intval(true), false);
86
87 /* Delete deprecated options
88 * @todo - Remove in 4.0 */
89 delete_option('advgb_jureview_installation_time');
90 delete_option('advgb_jufeedback_version');
91 delete_option('ppb_reviews_installed_on'); // Added in 2.10.4 and disabled in 2.10.5
92 delete_option('advgb_reviews_installed_on'); // Added in 2.11.0 and disabled in 2.11.1
93