plugin = $plugin; $this->hooks(); } /** * Initiate our hooks. * * @since 3.0.3 */ public function hooks() { add_action( 'init', [ $this, 'init' ] ); } /** * Initialize the plugin * * Load the plugin only after Elementor (and other plugins) are loaded. * Checks for basic plugin requirements, if one check fail don't continue, * if all check have passed load the files required to run the plugin. * * Fired by `plugins_loaded` action hook. * * @since 1.0.0 * * @access public */ public function init() { // Check if Elementor installed and activated if ( ! did_action( 'elementor/loaded' ) ) { // add_action( 'admin_notices', [ $this, 'admin_notice_missing_main_plugin' ] ); return; } // Check for required Elementor version // if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) { // add_action( 'admin_notices', [ $this, 'admin_notice_minimum_elementor_version' ] ); // return; // } // // Check for required PHP version // if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) { // add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] ); // return; // } // Register widget styles add_action( 'elementor/frontend/after_enqueue_styles', [ $this, 'widget_styles' ] ); // Register widget scripts add_action( 'elementor/frontend/after_register_scripts', [ $this, 'widget_scripts' ] ); // the conditional logic below helps us stay backwards compatible with Elementor < 3.5.0 if(version_compare(ELEMENTOR_VERSION, "3.5.0", '<')){ /** * Deprecated actions * no harm in keeping those for a while for backwards compatibility */ add_action( 'elementor/widgets/widgets_registered', [ $this, 'init_widgets' ] ); add_action( 'elementor/controls/controls_registered', [ $this, 'init_controls' ] ); } else { /** * Up to date actions to register the widgets */ add_action( 'elementor/widgets/register', array( $this, 'init_widgets' ) ); add_action( 'elementor/controls/register', array( $this, 'init_controls' ) ); } } /** * Widget styles * * @since 1.0.0 * * @access public */ public function widget_styles() { wp_register_style( 'ssa-elementor', plugins_url( 'widgets/css/ssa-elementor.css', __FILE__ ) ); } /** * Widget scripts * * @since 1.0.0 * * @access public */ public function widget_scripts() { wp_register_script( 'ssa-elementor', plugins_url( 'widgets/js/ssa-elementor.js', __FILE__ ) ); } /** * Admin notice * * Warning when the site doesn't have Elementor installed or activated. * * @since 1.0.0 * * @access public */ public function admin_notice_missing_main_plugin() { if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); $message = sprintf( /* translators: 1: Plugin name 2: Elementor */ esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'simply-schedule-appointments' ), '' . esc_html__( 'SSA Elementor Integration', 'simply-schedule-appointments' ) . '', '' . esc_html__( 'Elementor', 'simply-schedule-appointments' ) . '' ); printf( '
%1$s
%1$s
%1$s