. */ declare(strict_types=1); if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } require_once ABSPATH . '/wp-admin/includes/plugin.php'; /** * Main C4WP Class. */ class C4WP { /** * Class instance. * * @var C4WP instance. * * @since 7.0.0 */ private static $instance; /** * Class constructor. * * @since 7.0.0 */ private function __construct() { $this->constants(); $this->includes(); $this->actions(); } /** * Class initiator. * * @return $instance - C4WP instance. * * @since 7.0.0 */ public static function init() { if ( ! self::$instance instanceof self ) { self::$instance = new self(); } return self::$instance; } /** * Setup plugin constants. * * @return void * * @since 7.0.0 */ private function constants() { if ( ! defined( 'C4WP_VERSION' ) ) { define( 'C4WP_VERSION', '7.6.0' ); } if ( ! defined( 'C4WP_PLUGIN_DIR' ) ) { define( 'C4WP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); } if ( ! defined( 'C4WP_PLUGIN_URL' ) ) { define( 'C4WP_PLUGIN_URL', plugins_url( '/', __FILE__ ) ); } if ( ! defined( 'C4WP_PLUGIN_FILE' ) ) { define( 'C4WP_PLUGIN_FILE', __FILE__ ); } if ( ! defined( 'C4WP_TABLE_PREFIX' ) ) { define( 'C4WP_TABLE_PREFIX', 'c4wp_' ); } if ( ! defined( 'C4WP_PREFIX' ) ) { define( 'C4WP_PREFIX', 'c4wp_' ); } if ( ! defined( 'C4WP_BASE_NAME' ) ) { define( 'C4WP_BASE_NAME', plugin_basename( __FILE__ ) ); } register_uninstall_hook( C4WP_PLUGIN_FILE, 'c4wp_uninstall' ); } /** * Include functions and pro extensions. * * @return void * * @since 7.0.0 */ private function includes() { if ( file_exists( C4WP_PLUGIN_DIR . 'vendor/autoload.php' ) ) { require_once C4WP_PLUGIN_DIR . 'vendor/autoload.php'; } add_action( 'wp_loaded', array( 'C4WP_Settings', 'actions_filters' ) ); add_action( 'init', array( 'C4WP\\C4WP_Captcha_Class', 'actions_filters' ), -9 ); add_action( 'init', array( 'C4WP\\PluginUpdatedNotice', 'init' ) ); add_action( 'init', array( 'C4WP\\Methods\\C4WP_Method_Loader', 'init' ), 0 ); // Hide all unrelated to the plugin notices on the plugin admin pages. add_action( 'admin_print_scripts', array( 'C4WP\C4WP_Functions', 'hide_unrelated_notices' ) ); } /** * Add plugin actions. * * @return void * * @since 7.0.0 */ private function actions() { add_action( 'init', array( 'C4WP\\C4WP_Functions', 'c4wp_translation' ) ); add_action( 'init', array( 'C4WP\\C4WP_Functions', 'actions' ) ); add_action( 'init', array( 'C4WP\\C4WP_Functions', 'c4wp_plugin_update' ), -15 ); add_action( 'login_enqueue_scripts', array( 'C4WP\\C4WP_Functions', 'c4wp_login_enqueue_scripts' ) ); add_filter( 'plugin_action_links_' . C4WP_BASE_NAME, array( 'C4WP\\C4WP_Functions', 'add_plugin_shortcuts' ), 999, 1 ); } } // END Class. add_action( 'plugins_loaded', array( 'C4WP', 'init' ) ); require_once 'includes/include-functions.php'; /* @free:start */ register_activation_hook( __FILE__, 'c4wp_redirect_after_activation' ); register_activation_hook( __FILE__, 'c4wp_free_on_plugin_activation' ); /* @free:end */