Changeset 3186462
- Timestamp:
- 11/12/2024 11:44:46 AM (16 months ago)
- Location:
- nex-button
- Files:
-
- 2 added
- 3 edited
-
assets/blueprints (added)
-
assets/blueprints/blueprint.json (added)
-
assets/icon-256x256.gif (modified) (previous)
-
tags/1.0.0/nex-button.php (modified) (2 diffs)
-
trunk/nex-button.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nex-button/tags/1.0.0/nex-button.php
r3186023 r3186462 4 4 * Description: Add stylish, customizable buttons to Elementor with various hover effects and animations. 5 5 * Version: 1.0.0 6 * Author: wpcoder75 6 * Author: wpcoder75 7 7 * Author URI: https://github.com/asikwp75 8 8 * Text Domain: nex-button … … 17 17 } 18 18 19 // Hook into Elementor's categories registration 20 add_action( 'elementor/elements/categories_registered', 'nexbutton_add_elementor_category' ); 19 class NexButtonPlugin { 20 const VERSION = '1.0.0'; 21 const MINIMUM_ELEMENTOR_VERSION = '3.13.2'; 22 const MINIMUM_PHP_VERSION = '7.4'; 21 23 22 function nexbutton_add_elementor_category( $elements_manager ) { 23 $elements_manager->add_category( 24 'nexbutton-category', // Custom category ID with a unique name 25 [ 26 'title' => esc_html__( 'NexButton', 'nex-button' ), // Title of the category 27 'icon' => 'eicon-cog', // Optional icon (Font Awesome) 28 ], 29 1 // Position in the list (1 is at the top) 30 ); 24 private static $_instance = null; 25 26 public static function instance() { 27 if ( is_null( self::$_instance ) ) { 28 self::$_instance = new self(); 29 } 30 return self::$_instance; 31 } 32 33 public function __construct() { 34 add_action( 'plugins_loaded', array( $this, 'init' ) ); 35 } 36 37 public function admin_notice_minimum_php_version() { 38 if ( isset( $_GET['activate'] ) ) { 39 unset( $_GET['activate'] ); 40 } 41 42 $message = sprintf( 43 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'nex-button' ), 44 '<strong>' . esc_html__( 'NexButton', 'nex-button' ) . '</strong>', 45 '<strong>' . esc_html__( 'PHP', 'nex-button' ) . '</strong>', 46 self::MINIMUM_PHP_VERSION 47 ); 48 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); 49 } 50 51 public function admin_notice_minimum_elementor_version() { 52 if ( isset( $_GET['activate'] ) ) { 53 unset( $_GET['activate'] ); 54 } 55 56 $message = sprintf( 57 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'nex-button' ), 58 '<strong>' . esc_html__( 'NexButton', 'nex-button' ) . '</strong>', 59 '<strong>' . esc_html__( 'Elementor', 'nex-button' ) . '</strong>', 60 self::MINIMUM_ELEMENTOR_VERSION 61 ); 62 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); 63 } 64 65 public function admin_notice_missing_main_plugin() { 66 if ( isset( $_GET['activate'] ) ) { 67 unset( $_GET['activate'] ); 68 } 69 70 $message = sprintf( 71 esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'nex-button' ), 72 '<strong>' . esc_html__( 'NexButton', 'nex-button' ) . '</strong>', 73 '<strong>' . esc_html__( 'Elementor', 'nex-button' ) . '</strong>' 74 ); 75 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); 76 } 77 78 public function init() { 79 load_plugin_textdomain( 'nex-button', false, plugin_dir_path( __FILE__ ) . '/languages' ); 80 81 if ( ! did_action( 'elementor/loaded' ) ) { 82 add_action( 'admin_notices', array( $this, 'admin_notice_missing_main_plugin' ) ); 83 return; 84 } 85 86 if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) { 87 add_action( 'admin_notices', array( $this, 'admin_notice_minimum_elementor_version' ) ); 88 return; 89 } 90 91 if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) { 92 add_action( 'admin_notices', array( $this, 'admin_notice_minimum_php_version' ) ); 93 return; 94 } 95 96 add_action( 'elementor/elements/categories_registered', array( $this, 'add_elementor_category' ) ); 97 add_action( 'elementor/widgets/register', array( $this, 'register_widgets' ) ); 98 add_action( 'elementor/frontend/after_enqueue_styles', array( $this, 'enqueue_styles' ) ); 99 } 100 101 public function add_elementor_category( $elements_manager ) { 102 $elements_manager->add_category( 103 'nexbutton-category', 104 [ 105 'title' => esc_html__( 'NexButton', 'nex-button' ), 106 'icon' => 'eicon-cog', 107 ], 108 1 109 ); 110 } 111 112 public function register_widgets( $widgets_manager ) { 113 require_once plugin_dir_path( __FILE__ ) . 'widgets/advanced-button/advanced-button.php'; 114 $widgets_manager->register( new \NexButton\Widgets\NexButton_Widget() ); 115 } 116 117 public function enqueue_styles() { 118 wp_enqueue_style( 'nexbutton-styles', plugins_url( 'css/advanced-button.css', __FILE__ ), array(), '1.0.0', false ); 119 } 31 120 } 32 121 33 // Register Elementor widgets 34 add_action( 'elementor/widgets/register', 'nexbutton_register_widgets' ); 35 36 function nexbutton_register_widgets( $widgets_manager ) { 37 require_once plugin_dir_path( __FILE__ ) . 'widgets/advanced-button/advanced-button.php'; 38 $widgets_manager->register( new \NexButton\Widgets\NexButton_Widget() ); 39 } 40 41 // Enqueue plugin styles 42 add_action( 'elementor/frontend/after_enqueue_styles', 'nexbutton_enqueue_styles' ); 43 44 function nexbutton_enqueue_styles() { 45 wp_enqueue_style( 'nexbutton-styles', plugins_url( 'css/advanced-button.css', __FILE__ ), array(), '1.0.0', false ); 46 } 122 NexButtonPlugin::instance(); -
nex-button/trunk/nex-button.php
r3185804 r3186462 4 4 * Description: Add stylish, customizable buttons to Elementor with various hover effects and animations. 5 5 * Version: 1.0.0 6 * Author: wpcoder75 6 * Author: wpcoder75 7 7 * Author URI: https://github.com/asikwp75 8 8 * Text Domain: nex-button … … 17 17 } 18 18 19 // Hook into Elementor's categories registration 20 add_action( 'elementor/elements/categories_registered', 'nexbutton_add_elementor_category' ); 19 class NexButtonPlugin { 20 const VERSION = '1.0.0'; 21 const MINIMUM_ELEMENTOR_VERSION = '3.13.2'; 22 const MINIMUM_PHP_VERSION = '7.4'; 21 23 22 function nexbutton_add_elementor_category( $elements_manager ) { 23 $elements_manager->add_category( 24 'nexbutton-category', // Custom category ID with a unique name 25 [ 26 'title' => esc_html__( 'NexButton', 'nex-button' ), // Title of the category 27 'icon' => 'eicon-cog', // Optional icon (Font Awesome) 28 ], 29 1 // Position in the list (1 is at the top) 30 ); 24 private static $_instance = null; 25 26 public static function instance() { 27 if ( is_null( self::$_instance ) ) { 28 self::$_instance = new self(); 29 } 30 return self::$_instance; 31 } 32 33 public function __construct() { 34 add_action( 'plugins_loaded', array( $this, 'init' ) ); 35 } 36 37 public function admin_notice_minimum_php_version() { 38 if ( isset( $_GET['activate'] ) ) { 39 unset( $_GET['activate'] ); 40 } 41 42 $message = sprintf( 43 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'nex-button' ), 44 '<strong>' . esc_html__( 'NexButton', 'nex-button' ) . '</strong>', 45 '<strong>' . esc_html__( 'PHP', 'nex-button' ) . '</strong>', 46 self::MINIMUM_PHP_VERSION 47 ); 48 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); 49 } 50 51 public function admin_notice_minimum_elementor_version() { 52 if ( isset( $_GET['activate'] ) ) { 53 unset( $_GET['activate'] ); 54 } 55 56 $message = sprintf( 57 esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'nex-button' ), 58 '<strong>' . esc_html__( 'NexButton', 'nex-button' ) . '</strong>', 59 '<strong>' . esc_html__( 'Elementor', 'nex-button' ) . '</strong>', 60 self::MINIMUM_ELEMENTOR_VERSION 61 ); 62 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); 63 } 64 65 public function admin_notice_missing_main_plugin() { 66 if ( isset( $_GET['activate'] ) ) { 67 unset( $_GET['activate'] ); 68 } 69 70 $message = sprintf( 71 esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'nex-button' ), 72 '<strong>' . esc_html__( 'NexButton', 'nex-button' ) . '</strong>', 73 '<strong>' . esc_html__( 'Elementor', 'nex-button' ) . '</strong>' 74 ); 75 printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); 76 } 77 78 public function init() { 79 load_plugin_textdomain( 'nex-button', false, plugin_dir_path( __FILE__ ) . '/languages' ); 80 81 if ( ! did_action( 'elementor/loaded' ) ) { 82 add_action( 'admin_notices', array( $this, 'admin_notice_missing_main_plugin' ) ); 83 return; 84 } 85 86 if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) { 87 add_action( 'admin_notices', array( $this, 'admin_notice_minimum_elementor_version' ) ); 88 return; 89 } 90 91 if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) { 92 add_action( 'admin_notices', array( $this, 'admin_notice_minimum_php_version' ) ); 93 return; 94 } 95 96 add_action( 'elementor/elements/categories_registered', array( $this, 'add_elementor_category' ) ); 97 add_action( 'elementor/widgets/register', array( $this, 'register_widgets' ) ); 98 add_action( 'elementor/frontend/after_enqueue_styles', array( $this, 'enqueue_styles' ) ); 99 } 100 101 public function add_elementor_category( $elements_manager ) { 102 $elements_manager->add_category( 103 'nexbutton-category', 104 [ 105 'title' => esc_html__( 'NexButton', 'nex-button' ), 106 'icon' => 'eicon-cog', 107 ], 108 1 109 ); 110 } 111 112 public function register_widgets( $widgets_manager ) { 113 require_once plugin_dir_path( __FILE__ ) . 'widgets/advanced-button/advanced-button.php'; 114 $widgets_manager->register( new \NexButton\Widgets\NexButton_Widget() ); 115 } 116 117 public function enqueue_styles() { 118 wp_enqueue_style( 'nexbutton-styles', plugins_url( 'css/advanced-button.css', __FILE__ ), array(), '1.0.0', false ); 119 } 31 120 } 32 121 33 // Register Elementor widgets 34 add_action( 'elementor/widgets/register', 'nexbutton_register_widgets' ); 35 36 function nexbutton_register_widgets( $widgets_manager ) { 37 require_once plugin_dir_path( __FILE__ ) . 'widgets/advanced-button/advanced-button.php'; 38 $widgets_manager->register( new \NexButton\Widgets\NexButton_Widget() ); 39 } 40 41 // Enqueue plugin styles 42 add_action( 'elementor/frontend/after_enqueue_styles', 'nexbutton_enqueue_styles' ); 43 44 function nexbutton_enqueue_styles() { 45 wp_enqueue_style( 'nexbutton-styles', plugins_url( 'css/advanced-button.css', __FILE__ ), array(), '1.0.0', false ); 46 } 122 NexButtonPlugin::instance();
Note: See TracChangeset
for help on using the changeset viewer.