| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* @link https://notiqoo.com/ |
| 5 |
* @since 1.0.0 |
| 6 |
* @package Woom_Messaging |
| 7 |
* |
| 8 |
* @wordpress-plugin |
| 9 |
* Plugin Name: Notiqoo |
| 10 |
* Plugin URI: https://notiqoo.com/ |
| 11 |
* Description: Send WhatsApp notifications for Woocommerce orders using official WhatsApp Cloud APIs. |
| 12 |
* Version: 1.4.14 |
| 13 |
* Author: Notiqoo |
| 14 |
* Author URI: https://notiqoo.com/ |
| 15 |
* License: GPL-2.0+ |
| 16 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 17 |
* Text Domain: wc-messaging |
| 18 |
* Domain Path: /languages |
| 19 |
* Requires Plugins: woocommerce |
| 20 |
* WC Requires at least: 3.7 |
| 21 |
* WC Tested up to: 11.1 |
| 22 |
*/ |
| 23 |
|
| 24 |
// If this file is called directly, abort. |
| 25 |
if (!defined('WPINC')) { |
| 26 |
die; |
| 27 |
} |
| 28 |
|
| 29 |
if (function_exists('is_plugin_active') && is_plugin_active('notiqoo-pro/notiqoo-pro.php')) { |
| 30 |
wp_die(sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Please deactivate Notiqoo PRO and activate the free version.', 'wc-messaging'), esc_url(admin_url('/') . 'plugins.php'), esc_html__('Back to plugins', 'wc-messaging')), 'wc-messaging'); |
| 31 |
} |
| 32 |
if (function_exists('is_plugin_active') && is_plugin_active('notiqoo/notiqoo.php')) { |
| 33 |
wp_die(sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Please deactivate Notiqoo and activate the free version.', 'wc-messaging'), esc_url(admin_url('/') . 'plugins.php'), esc_html__('Back to plugins', 'wc-messaging')), 'wc-messaging'); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Currently plugin version. |
| 38 |
* Start at version 1.0.0 and use SemVer - https://semver.org |
| 39 |
* Rename this for your plugin and update it as you release new versions. |
| 40 |
*/ |
| 41 |
if (!defined('woom_plugin_name')) { |
| 42 |
define('woom_plugin_name', 'WC Messaging'); |
| 43 |
} |
| 44 |
if (!defined('woom_version')) { |
| 45 |
define('woom_version', '1.4.14'); |
| 46 |
} |
| 47 |
|
| 48 |
if (!defined('woom_basename')) { |
| 49 |
define('woom_basename', plugin_basename(__FILE__)); |
| 50 |
} |
| 51 |
|
| 52 |
if (!defined('woom_dir_url')) { |
| 53 |
define( 'woom_dir_url', plugin_dir_url( __FILE__ ) ); |
| 54 |
|
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* The code that runs during plugin activation. |
| 59 |
* This action is documented in includes/class-wc-messaging-activator.php |
| 60 |
*/ |
| 61 |
|
| 62 |
if (!function_exists('woom_activate')) { |
| 63 |
function woom_activate() |
| 64 |
{ |
| 65 |
require_once plugin_dir_path(__FILE__) . 'includes/class-wc-messaging-activator.php'; |
| 66 |
Woom_Messaging_Activator::activate(); |
| 67 |
} |
| 68 |
register_activation_hook(__FILE__, 'woom_activate'); |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* The code that runs during plugin deactivation. |
| 73 |
* This action is documented in includes/class-wc-messaging-deactivator.php |
| 74 |
*/ |
| 75 |
if (!function_exists('woom_deactivate')) { |
| 76 |
function woom_deactivate() |
| 77 |
{ |
| 78 |
require_once plugin_dir_path(__FILE__) . 'includes/class-wc-messaging-deactivator.php'; |
| 79 |
Woom_Messaging_Deactivator::deactivate(); |
| 80 |
} |
| 81 |
register_activation_hook(__FILE__, 'woom_deactivate'); |
| 82 |
} |
| 83 |
|
| 84 |
/** |
| 85 |
* The core plugin class that is used to define internationalization, |
| 86 |
* admin-specific hooks, and public-facing site hooks. |
| 87 |
*/ |
| 88 |
require plugin_dir_path(__FILE__) . 'includes/class-wc-messaging.php'; |
| 89 |
|
| 90 |
/** |
| 91 |
* Begins execution of the plugin. |
| 92 |
* |
| 93 |
* Since everything within the plugin is registered via hooks, |
| 94 |
* then kicking off the plugin from this point in the file does |
| 95 |
* not affect the page life cycle. |
| 96 |
* |
| 97 |
* @since 1.0.0 |
| 98 |
*/ |
| 99 |
|
| 100 |
if (!function_exists('woom_run')) { |
| 101 |
function woom_run() |
| 102 |
{ |
| 103 |
|
| 104 |
$plugin = new Woom_Messaging(); |
| 105 |
$plugin->run(); |
| 106 |
} |
| 107 |
|
| 108 |
if ( |
| 109 |
function_exists('woom_run') && |
| 110 |
in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) |
| 111 |
) { |
| 112 |
woom_run(); |
| 113 |
} |
| 114 |
} |
| 115 |
|
| 116 |
|
| 117 |
/** |
| 118 |
* Feedback survey when deactivate the plugin |
| 119 |
*/ |
| 120 |
require plugin_dir_path(__FILE__) . 'plugin-deactivation-survey/deactivate-feedback-form.php'; |
| 121 |
add_filter('sgits_deactivate_feedback_form_plugins', 'woom_deactivate_feedback'); |
| 122 |
function woom_deactivate_feedback($plugins = array()) |
| 123 |
{ |
| 124 |
$plugins[] = (object)array( |
| 125 |
'slug' => 'wc-messaging', |
| 126 |
'version' => woom_version |
| 127 |
); |
| 128 |
return $plugins; |
| 129 |
} |
| 130 |
|
| 131 |
/** |
| 132 |
* Custom function to declare compatibility with cart_checkout_blocks feature |
| 133 |
* @since 1.0.0 |
| 134 |
*/ |
| 135 |
if (!function_exists('woom_declare_cart_checkout_blocks_compatibility')) { |
| 136 |
|
| 137 |
function woom_declare_cart_checkout_blocks_compatibility() |
| 138 |
{ |
| 139 |
// Check if the required class exists |
| 140 |
if (class_exists('\Automattic\WooCommerce\Utilities\FeaturesUtil')) { |
| 141 |
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('cart_checkout_blocks', __FILE__, true); |
| 142 |
} |
| 143 |
} |
| 144 |
|
| 145 |
add_action('before_woocommerce_init', 'woom_declare_cart_checkout_blocks_compatibility'); |
| 146 |
} |
| 147 |
|
| 148 |
add_action('before_woocommerce_init', function () { |
| 149 |
if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) { |
| 150 |
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true); |
| 151 |
} |
| 152 |
}); |
| 153 |
|