| 1 |
<?php |
| 2 |
/** |
| 3 |
* Hyve Lite. |
| 4 |
* |
| 5 |
* @package Codeinwp/hyve-lite |
| 6 |
* |
| 7 |
* Plugin Name: Hyve Lite |
| 8 |
* Plugin URI: https://themeisle.com/plugins/hyve/ |
| 9 |
* Description: Hyve is an AI-powered chatbot that transforms your WordPress content into engaging conversations. |
| 10 |
* Version: 2.0.2 |
| 11 |
* Author: ThemeIsle |
| 12 |
* Author URI: https://themeisle.com |
| 13 |
* License: GPL-3.0+ |
| 14 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt |
| 15 |
* Text Domain: hyve-lite |
| 16 |
* Domain Path: /languages |
| 17 |
* WordPress Available: yes |
| 18 |
* Requires License: no |
| 19 |
* Pro Slug: hyve |
| 20 |
*/ |
| 21 |
|
| 22 |
// If this file is called directly, abort. |
| 23 |
if ( ! defined( 'WPINC' ) ) { |
| 24 |
die; |
| 25 |
} |
| 26 |
|
| 27 |
if ( version_compare( PHP_VERSION, '7.4', '<' ) ) { |
| 28 |
add_action( |
| 29 |
'admin_notices', |
| 30 |
function () { |
| 31 |
?> |
| 32 |
<div class="notice notice-error"> |
| 33 |
<p><?php esc_html_e( 'Hyve Lite requires PHP 7.4 or higher. Please upgrade your PHP version.', 'hyve-lite' ); ?></p> |
| 34 |
</div> |
| 35 |
<?php |
| 36 |
} |
| 37 |
); |
| 38 |
|
| 39 |
return; |
| 40 |
} |
| 41 |
|
| 42 |
define( 'HYVE_LITE_BASEFILE', __FILE__ ); |
| 43 |
define( 'HYVE_LITE_URL', plugins_url( '/', __FILE__ ) ); |
| 44 |
define( 'HYVE_LITE_PATH', __DIR__ ); |
| 45 |
define( 'HYVE_LITE_VERSION', '2.0.2' ); |
| 46 |
define( 'HYVE_PRODUCT_SLUG', basename( HYVE_LITE_PATH ) ); |
| 47 |
|
| 48 |
$vendor_file = HYVE_LITE_PATH . '/vendor/autoload.php'; |
| 49 |
|
| 50 |
if ( is_readable( $vendor_file ) ) { |
| 51 |
require_once $vendor_file; |
| 52 |
} |
| 53 |
|
| 54 |
add_filter( |
| 55 |
'themeisle_sdk_products', |
| 56 |
function ( $products ) { |
| 57 |
$products[] = HYVE_LITE_BASEFILE; |
| 58 |
|
| 59 |
return $products; |
| 60 |
} |
| 61 |
); |
| 62 |
|
| 63 |
add_filter( |
| 64 |
HYVE_PRODUCT_SLUG . '_sdk_migrations_path', |
| 65 |
function () { |
| 66 |
return HYVE_LITE_PATH . '/migrations'; |
| 67 |
} |
| 68 |
); |
| 69 |
|
| 70 |
register_activation_hook( |
| 71 |
__FILE__, |
| 72 |
function () { |
| 73 |
set_transient( 'hyve_lite_activation_redirect', 1, 30 ); |
| 74 |
} |
| 75 |
); |
| 76 |
|
| 77 |
add_action( |
| 78 |
'admin_init', |
| 79 |
function () { |
| 80 |
if ( ! get_transient( 'hyve_lite_activation_redirect' ) ) { |
| 81 |
return; |
| 82 |
} |
| 83 |
|
| 84 |
delete_transient( 'hyve_lite_activation_redirect' ); |
| 85 |
|
| 86 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only detecting a bulk activation to skip the redirect; no state change. |
| 87 |
if ( isset( $_GET['activate-multi'] ) || is_network_admin() || ! current_user_can( 'manage_options' ) ) { |
| 88 |
return; |
| 89 |
} |
| 90 |
|
| 91 |
wp_safe_redirect( admin_url( 'admin.php?page=hyve' ) ); |
| 92 |
exit; |
| 93 |
} |
| 94 |
); |
| 95 |
|
| 96 |
add_action( |
| 97 |
'plugins_loaded', |
| 98 |
function () { |
| 99 |
new \ThemeIsle\HyveLite\Main(); |
| 100 |
} |
| 101 |
); |
| 102 |
|