kubio
Last commit date
build
4 years ago
defaults
4 years ago
languages
4 years ago
lib
4 years ago
static
4 years ago
vendor
4 years ago
LICENSE.txt
4 years ago
plugin.php
4 years ago
readme.txt
4 years ago
plugin.php
100 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Kubio |
| 4 | * Plugin URI: https://kubiobuilder.com |
| 5 | * Description: Kubio is an innovative block-based WordPress website builder that enriches the block editor with new blocks and gives its users endless styling options. |
| 6 | * Author: ExtendThemes |
| 7 | * Author URI: https://extendthemes.com |
| 8 | * Version: 1.0.1 |
| 9 | * License: GPL3+ |
| 10 | * License URI: https://www.gnu.org/licenses/gpl-2.0.txt |
| 11 | * Text Domain: kubio |
| 12 | * Domain Path: /languages |
| 13 | * Requires PHP: 7.1.3 |
| 14 | * Requires at least: 5.8.1 |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | // Exit if accessed directly. |
| 19 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | exit; |
| 21 | } |
| 22 | |
| 23 | |
| 24 | define( 'KUBIO_ENTRY_FILE', __FILE__ ); |
| 25 | define( 'KUBIO_ROOT_DIR', plugin_dir_path( __FILE__ ) ); |
| 26 | define( 'KUBIO_BUILD_DIR', plugin_dir_path( __FILE__ ) . '/build' ); |
| 27 | define( 'KUBIO_VERSION', '1.0.1' ); |
| 28 | define( 'KUBIO_BUILD_NUMBER', '19' ); |
| 29 | define( 'KUBIO_LOGO_URL', plugins_url( '/static/kubio-logo.svg', __FILE__ ) ); |
| 30 | define( 'KUBIO_LOGO_PATH', plugin_dir_path( __FILE__ ) . '/static/kubio-logo.svg' ); |
| 31 | define( 'KUBIO_LOGO_SVG', file_get_contents( KUBIO_LOGO_PATH ) ); |
| 32 | |
| 33 | function kubio_dir_path() { |
| 34 | return plugin_dir_path( __FILE__ ); |
| 35 | } |
| 36 | |
| 37 | function kubio_url( $path ) { |
| 38 | return plugins_url( $path, __FILE__ ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @var \Composer\Autoload\ClassLoader $kubio_autoloader ; |
| 43 | */ |
| 44 | global $kubio_autoloader; |
| 45 | $kubio_autoloader = require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
| 46 | |
| 47 | function kubio_does_not_support_current_theme() { |
| 48 | $theme = wp_get_theme( get_template() ); |
| 49 | ?> |
| 50 | <div class="notice notice-warning"> |
| 51 | <p> |
| 52 | <?php |
| 53 | printf( |
| 54 | // translators: %1$s - kubio page builder , %2$s - theme name |
| 55 | __( '%1$s does not currently support the %2$s theme', 'kubio' ), |
| 56 | '<strong>Kubio Page Builder</strong>', |
| 57 | sprintf( |
| 58 | '<strong>%s</strong>', |
| 59 | $theme->get( 'Name' ) |
| 60 | ) |
| 61 | ); |
| 62 | ?> |
| 63 | </p> |
| 64 | </div> |
| 65 | <?php |
| 66 | } |
| 67 | |
| 68 | function kubio_plugin_activated() { |
| 69 | $experimental_options = get_option( 'gutenberg-experiments', array() ); |
| 70 | if ( ! is_array( $experimental_options ) ) { |
| 71 | $experimental_options = array( $experimental_options ); |
| 72 | } |
| 73 | $experimental_options['gutenberg-navigation'] = 1; |
| 74 | $experimental_options['gutenberg-widget-experiments'] = 1; |
| 75 | |
| 76 | update_option( 'gutenberg-experiments', $experimental_options ); |
| 77 | do_action( 'kubio/plugin_activated' ); |
| 78 | } |
| 79 | |
| 80 | function kubio_plugin_init() { |
| 81 | $template = get_template(); |
| 82 | $supported_templates = array( 'kubio', 'elevate', 'elevate-wp' ); |
| 83 | |
| 84 | if ( ! in_array( $template, $supported_templates ) ) { |
| 85 | if ( is_admin() ) { |
| 86 | add_action( 'admin_notices', 'kubio_does_not_support_current_theme' ); |
| 87 | } |
| 88 | return; |
| 89 | } |
| 90 | |
| 91 | require_once plugin_dir_path( __FILE__ ) . 'lib/load.php'; |
| 92 | |
| 93 | add_theme_support( 'block-templates' ); |
| 94 | add_filter( 'kubio_is_enabled', '__return_true' ); |
| 95 | |
| 96 | register_activation_hook( __FILE__, 'kubio_plugin_activated' ); |
| 97 | } |
| 98 | |
| 99 | kubio_plugin_init(); |
| 100 |