. */ use \Elementor\Plugin as Plugin; if ( ! defined( 'ABSPATH' ) ) { wp_die(esc_html__("Direct Access Not Allow",'plugsprice')); } final class Elementorplugsprice { const VERSION = "2.0.0"; const MINIMUM_ELEMENTOR_VERSION = "3.5.0"; const MINIMUM_PHP_VERSION = "7.4"; private static $_instance = null; //instance public static function instance() { if ( is_null( self::$_instance ) ) { self::$_instance = new self(); } return self::$_instance; } public function __construct() { add_action( 'plugins_loaded', [ $this, 'init' ] ); } public function init() { load_plugin_textdomain( 'plugsprice' ); // 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; } add_action( 'elementor/widgets/register', [ $this, 'init_widgets' ] ); add_action( 'elementor/elements/categories_registered', [ $this, 'register_new_cat' ] ); add_action( 'elementor/frontend/after_enqueue_styles', [ $this, 'widget_styles' ] ); add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'pricing_editor_assets' ] ); } function pricing_editor_assets(){ wp_enqueue_script("pricing-editor-js", plugins_url("/assets/js/scripts.js",__FILE__),array("jquery"),time(),true); } public function widget_styles(){ wp_enqueue_style('fontawesome', plugins_url('/assets/css/fontawesome.min.css',__FILE__ ), array(), '5.13.0'); wp_enqueue_style('priceplugs', plugins_url('/assets/css/style.css',__FILE__ ), array(), self::VERSION); } function register_new_cat($manager){ $manager->add_category('pricingtable',[ 'title'=>esc_html('Themeplugs','plugsprice'), 'icon' => 'fa fa-plug', ]); } public function init_widgets( $widgets_manager ){ // Include Widget files // price style1 require_once( __DIR__ . '/widgets/price-style1.php' ); $widgets_manager->register( new \PlugsPriceOne() ); // price style2 require_once( __DIR__ . '/widgets/price-style2.php' ); $widgets_manager->register( new \PlugsPriceTwo() ); } 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.', 'plugsprice' ), '' . esc_html__( 'PlugsPrice', 'plugsprice' ) . '', '' . esc_html__( 'PHP', 'plugsprice' ) . '', self::MINIMUM_PHP_VERSION ); printf( '
%1$s
%1$s
%1$s