wp-whatsapp
Last commit date
assets
2 years ago
blocks
2 years ago
includes
2 years ago
languages
2 years ago
views
2 years ago
index.php
2 years ago
readme.txt
2 years ago
whatsapp.php
2 years ago
wpml-config.xml
2 years ago
whatsapp.php
100 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @wordpress-plugin |
| 4 | * Plugin Name: WP Chat App |
| 5 | * Plugin URI: https://ninjateam.org/wordpress-whatsapp-chat |
| 6 | * Description: Integrate your WhatsApp experience directly into your website. This is one of the best way to connect and interact with your customer. |
| 7 | * Version: 3.4.4 |
| 8 | * Author: NinjaTeam |
| 9 | * Author URI: https://ninjateam.org |
| 10 | * Text Domain: ninjateam-whatsapp |
| 11 | * Domain Path: /languages |
| 12 | */ |
| 13 | namespace NTA_WhatsApp; |
| 14 | |
| 15 | defined('ABSPATH') || exit; |
| 16 | |
| 17 | if ( function_exists( 'NTA_WhatsApp\\init' ) ) { |
| 18 | require_once plugin_dir_path( __FILE__ ) . 'includes/Fallback.php'; |
| 19 | add_action( |
| 20 | 'admin_init', |
| 21 | function() { |
| 22 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 23 | } |
| 24 | ); |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | if ( ! defined( 'NTA_WHATSAPP_VERSION' ) ) { |
| 29 | define( 'NTA_WHATSAPP_VERSION', '3.4.4' ); |
| 30 | } |
| 31 | |
| 32 | if ( ! defined( 'NTA_WHATSAPP_PLUGIN_URL' ) ) { |
| 33 | define( 'NTA_WHATSAPP_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 34 | } |
| 35 | |
| 36 | if ( ! defined( 'NTA_WHATSAPP_PLUGIN_DIR' ) ) { |
| 37 | define( 'NTA_WHATSAPP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 38 | } |
| 39 | |
| 40 | if ( ! defined( 'NTA_WHATSAPP_BASE_NAME' ) ) { |
| 41 | define( 'NTA_WHATSAPP_BASE_NAME', plugin_basename( __FILE__ ) ); |
| 42 | } |
| 43 | |
| 44 | spl_autoload_register( |
| 45 | function ( $class ) { |
| 46 | $prefix = __NAMESPACE__; // project-specific namespace prefix |
| 47 | $base_dir = __DIR__ . '/includes'; // base directory for the namespace prefix |
| 48 | |
| 49 | $len = strlen( $prefix ); |
| 50 | if ( strncmp( $prefix, $class, $len ) !== 0 ) { // does the class use the namespace prefix? |
| 51 | return; // no, move to the next registered autoloader |
| 52 | } |
| 53 | |
| 54 | $relative_class_name = substr( $class, $len ); |
| 55 | |
| 56 | // replace the namespace prefix with the base directory, replace namespace |
| 57 | // separators with directory separators in the relative class name, append |
| 58 | // with .php |
| 59 | $file = $base_dir . str_replace( '\\', '/', $relative_class_name ) . '.php'; |
| 60 | |
| 61 | if ( file_exists( $file ) ) { |
| 62 | require $file; |
| 63 | } |
| 64 | } |
| 65 | ); |
| 66 | |
| 67 | if (file_exists(dirname(__FILE__) . '/includes/Review.php')) { |
| 68 | require_once dirname(__FILE__) . '/includes/Review.php'; |
| 69 | } |
| 70 | |
| 71 | if (file_exists(dirname(__FILE__) . '/includes/Cross.php')) { |
| 72 | require_once dirname(__FILE__) . '/includes/Cross.php'; |
| 73 | } |
| 74 | |
| 75 | if (file_exists(dirname(__FILE__) . '/includes/Recommended/Recommended.php')) { |
| 76 | require_once dirname(__FILE__) . '/includes/Recommended/Recommended.php'; |
| 77 | } |
| 78 | |
| 79 | if ( ! function_exists( 'NTA_WhatsApp\\init' ) ) { |
| 80 | function init() { |
| 81 | Plugin::activate(); |
| 82 | PostType::getInstance(); |
| 83 | I18n::loadPluginTextdomain(); |
| 84 | Shortcode::getInstance(); |
| 85 | Popup::getInstance(); |
| 86 | Settings::getInstance(); |
| 87 | Upgrade::getInstance(); |
| 88 | Support\WPML::getInstance(); |
| 89 | Support\Woocommerce::getInstance(); |
| 90 | if ( function_exists( 'register_block_type' ) ) { |
| 91 | require_once plugin_dir_path( __FILE__ ) . 'blocks/src/init.php'; |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | |
| 97 | add_action('plugins_loaded', 'NTA_WhatsApp\\init'); |
| 98 | |
| 99 | register_activation_hook(__FILE__, array('NTA_WhatsApp\\Plugin', 'activate')); |
| 100 | register_deactivation_hook(__FILE__, array('NTA_WhatsApp\\Plugin', 'deactivate')); |