"valid", "key" => "B5E0B5F8DD8689E6ACA49DD6E6E1A930") ); define( 'GENERATEBLOCKS_PRO_VERSION', '2.5.0' ); define( 'GENERATEBLOCKS_PRO_DIR', plugin_dir_path( __FILE__ ) ); define( 'GENERATEBLOCKS_PRO_DIR_URL', plugin_dir_url( __FILE__ ) ); add_action( 'plugins_loaded', 'generateblocks_pro_init' ); /** * Set up the plugin if GenerateBlocks exists. * * @since 1.0.0 */ function generateblocks_pro_init() { if ( ! defined( 'GENERATEBLOCKS_VERSION' ) ) { add_action( 'admin_notices', 'generateblocks_pro_failed_load' ); return; } $generateblocks_version_required = '1.3.0'; if ( ! version_compare( GENERATEBLOCKS_VERSION, $generateblocks_version_required, '>=' ) ) { add_action( 'admin_notices', 'generateblocks_pro_failed_required_version' ); return; } require GENERATEBLOCKS_PRO_DIR . 'init.php'; } add_action( 'after_setup_theme', 'generateblocks_pro_after_setup_theme' ); /** * Do things once the theme is set up. */ function generateblocks_pro_after_setup_theme() { load_plugin_textdomain( 'generateblocks-pro', false, 'generateblocks-pro/languages' ); } /** * Show an admin notice if GenerateBlocks isn't active. * * @since 1.0.0 */ function generateblocks_pro_failed_load() { $screen = get_current_screen(); if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) { return; } $plugin = 'generateblocks/plugin.php'; $installed_plugins = get_plugins(); $is_generateblocks_installed = isset( $installed_plugins[ $plugin ] ); if ( $is_generateblocks_installed ) { if ( ! current_user_can( 'activate_plugins' ) ) { return; } $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin ); $message = '
' . __( 'GenerateBlocks Pro is not working because you need to activate the GenerateBlocks plugin.', 'generateblocks-pro' ) . '
'; $message .= '' . sprintf( '%s', $activation_url, __( 'Activate GenerateBlocks Now', 'generateblocks-pro' ) ) . '
'; } else { if ( ! current_user_can( 'install_plugins' ) ) { return; } $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=generateblocks' ), 'install-plugin_generateblocks' ); $message = '' . __( 'GenerateBlocks Pro is not working because you need to install the GenerateBlocks plugin.', 'generateblocks-pro' ) . '
'; $message .= '' . sprintf( '%s', $install_url, __( 'Install GenerateBlocks Now', 'generateblocks-pro' ) ) . '
'; } echo '' . $message . '
' . __( 'GenerateBlocks Pro is not working because you are using an old version of GenerateBlocks.', 'generateblocks-pro' ) . '
'; $message .= '' . sprintf( '%s', $upgrade_link, __( 'Update GenerateBlocks Now', 'generateblocks-pro' ) ) . '
'; echo '' . $message . '