admin-pages
4 years ago
api
4 years ago
blog
4 years ago
filters
4 years ago
full-site-editing
4 years ago
importer
4 years ago
integrations
4 years ago
menu
4 years ago
polyfills
4 years ago
preview
4 years ago
shapes
4 years ago
shortcodes
4 years ago
src
4 years ago
add-edit-in-kubio.php
4 years ago
editor-assets.php
4 years ago
env.php
4 years ago
filters.php
4 years ago
frontend.php
4 years ago
global-data.php
4 years ago
init.php
4 years ago
kubio-block-library.php
4 years ago
kubio-editor.php
4 years ago
load.php
4 years ago
init.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | function kubio_plugin_activated() { |
| 4 | $experimental_options = get_option( 'gutenberg-experiments', array() ); |
| 5 | if ( ! is_array( $experimental_options ) ) { |
| 6 | $experimental_options = array( $experimental_options ); |
| 7 | } |
| 8 | $experimental_options['gutenberg-navigation'] = 1; |
| 9 | $experimental_options['gutenberg-widget-experiments'] = 1; |
| 10 | |
| 11 | update_option( 'gutenberg-experiments', $experimental_options ); |
| 12 | do_action( 'kubio/plugin_activated' ); |
| 13 | } |
| 14 | |
| 15 | function kubio_plugin_deactivated() { |
| 16 | |
| 17 | $active_plugins = get_option( 'active_plugins' ); |
| 18 | $pro_builder_is_active = in_array( 'kubio-pro/plugin.php', $active_plugins ); |
| 19 | |
| 20 | if ( ! kubio_is_pro() && $pro_builder_is_active ) { |
| 21 | return; |
| 22 | } |
| 23 | |
| 24 | do_action( 'kubio/plugin_deactivated' ); |
| 25 | } |
| 26 | |
| 27 | function kubio_enable_block_support() { |
| 28 | add_theme_support( 'block-templates' ); |
| 29 | |
| 30 | if(!current_theme_supports( 'align-wide' )) { |
| 31 | add_theme_support( 'align-wide' ); |
| 32 | } |
| 33 | |
| 34 | } |
| 35 | |
| 36 | function kubio_plugin_init() { |
| 37 | require_once plugin_dir_path( __FILE__ ) . '/load.php'; |
| 38 | add_filter( 'kubio_is_enabled', '__return_true' ); |
| 39 | |
| 40 | register_activation_hook( KUBIO_ENTRY_FILE, 'kubio_plugin_activated' ); |
| 41 | register_deactivation_hook( KUBIO_ENTRY_FILE, 'kubio_plugin_deactivated' ); |
| 42 | add_action( 'after_setup_theme', 'kubio_enable_block_support', 500 ); |
| 43 | } |
| 44 | |
| 45 | kubio_plugin_init(); |
| 46 |