=' ) ) { 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; } // Add Plugin actions add_action( 'elementor/widgets/widgets_registered', [ $this, 'init_widgets' ] ); add_action( 'elementor/controls/controls_registered', [ $this, 'init_controls' ] ); add_action( 'elementor/elements/categories_registered', [ $this, 'init_categories' ] ); } /** * 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.', 'elementor-test-extension' ), '' . esc_html__( '5 Anker Connect Elementor Extension', '5-anker-connect' ) . '', '' . esc_html__( 'Elementor', 'elementor-test-extension' ) . '' ); printf( '

%1$s

', $message ); } /** * Admin notice * * Warning when the site doesn't have a minimum required Elementor version. * * @since 1.0.0 * * @access public */ public function admin_notice_minimum_elementor_version() { if ( isset( $_GET['activate'] ) ) { unset( $_GET['activate'] ); } $message = sprintf( /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */ esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'elementor-test-extension' ), '' . esc_html__( 'Elementor Test Extension', 'elementor-test-extension' ) . '', '' . esc_html__( 'Elementor', 'elementor-test-extension' ) . '', self::MINIMUM_ELEMENTOR_VERSION ); printf( '

%1$s

', $message ); } /** * Admin notice * * Warning when the site doesn't have a minimum required PHP version. * * @since 1.0.0 * * @access public */ public function admin_notice_minimum_php_version() { if ( isset( $_GET['activate'] ) ) { unset( $_GET['activate'] ); } $message = sprintf( /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'elementor-test-extension' ), '' . esc_html__( 'Elementor Test Extension', 'elementor-test-extension' ) . '', '' . esc_html__( 'PHP', 'elementor-test-extension' ) . '', self::MINIMUM_PHP_VERSION ); printf( '

%1$s

', $message ); } /** * Init Widgets * * Include widgets files and register them * * @since 1.0.0 * * @access public */ public function init_widgets() { // Include Widget files $plugins = [ 'wls_boat' => '\Anker_Connect_Elementor_Wls_Boat_Widget', 'wls_boats' => '\Anker_Connect_Elementor_Wls_Boats_Widget', 'wls_boats_grid' => '\Anker_Connect_Elementor_Wls_BoatsGrid_Widget', 'wls_boats_slider' => '\Anker_Connect_Elementor_Wls_BoatsSlider_Widget', 'wls_search' => '\Anker_Connect_Elementor_Wls_Search_Widget', 'wls_search_day' => '\Anker_Connect_Elementor_Wls_SearchDay_Widget', 'wls_search_watercamper' => '\Anker_Connect_Elementor_Wls_SearchWaterCamper_Widget', 'wls_cruise_slider' => '\Anker_Connect_Elementor_Wls_CruiseSlider_Widget', 'wls_search_form' => '\Anker_Connect_Elementor_Wls_SearchForm_Widget', 'wls_newsletter' => '\Anker_Connect_Elementor_Wls_Newsletter_Widget', 'wls_contact_form' => '\Anker_Connect_Elementor_Wls_ContactForm_Widget', 'wls_boat_book_calendar' => '\Anker_Connect_Elementor_Wls_BoatBookCalendar_Widget', 'wls_marinas' => '\Anker_Connect_Elementor_Wls_Marinas_Widget', 'wls_marina' => '\Anker_Connect_Elementor_Wls_Marina_Widget', 'wls_map' => '\Anker_Connect_Elementor_Wls_Map_Widget', 'wls_notepad' => '\Anker_Connect_Elementor_Wls_Notepad_Widget', 'wls_planbar_login' => '\Anker_Connect_Elementor_Wls_PlanbarLogin_Widget', ]; foreach ( $plugins as $plugin => $pClass ) { require_once plugin_dir_path( dirname( __FILE__ ) ) . '../lib/elementor/' . $plugin . '.php'; \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new $pClass ); } } /** * Init Controls * * Include controls files and register them * * @since 1.0.0 * * @access public */ public function init_controls() { // Include Control files // require_once( __DIR__ . '/controls/test-control.php' ); // Register control // \Elementor\Plugin::$instance->controls_manager->register_control( 'control-type-', new \Test_Control() ); } /** * Init Categories * * Init Categories and register them * * @since 1.0.0 * * @access public */ public function init_categories( $elements_manager ) { $elements_manager->add_category( 'connect-wls', [ 'title' => __( 'Connect', '5-anker-connect' ), 'icon' => 'fa fa-plug', ] ); } } Anker_Connect_Elementor_Extension::instance();