Changeset 3276978
- Timestamp:
- 04/18/2025 11:20:55 PM (10 months ago)
- Location:
- alpha-price-table-for-elementor/trunk
- Files:
-
- 7 edited
-
README.md (modified) (1 diff)
-
alpha-price-table-for-elementor.php (modified) (5 diffs)
-
includes/class-alpha-price-table-widget.php (modified) (2 diffs)
-
includes/class-alpha-price-table.php (modified) (2 diffs)
-
index.php (modified) (1 diff)
-
languages/alpha-price-table-for-elementor.pot (modified) (9 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
alpha-price-table-for-elementor/trunk/README.md
r3209593 r3276978 79 79 ## Upgrade Notice 80 80 81 ### Version 1. 0.881 ### Version 1.1 82 82 83 - Compatibility for the updated Elementor colors and typography schema.83 - Compatibility for WP 6.8 -
alpha-price-table-for-elementor/trunk/alpha-price-table-for-elementor.php
r3209593 r3276978 1 1 <?php 2 3 2 /** 4 3 * Plugin Name: Alpha Price Table For Elementor 5 4 * Plugin URI: https://ali-ali.org/ 6 5 * Description: Premium Price Table for WordPress. 7 * Version: 1. 0.86 * Version: 1.1 8 7 * Author: Ali Ali 9 8 * Author URI: https://github.com/Ali7Ali … … 11 10 * Domain Path: /languages 12 11 * License: GPLv3 12 * 13 * @package AlphaPriceTable 13 14 */ 14 15 … … 29 30 */ 30 31 31 if ( !defined('ABSPATH')) {32 exit; // Exit if accessed directly.32 if ( ! defined( 'ABSPATH' ) ) { 33 exit; // Exit if accessed directly. 33 34 } 34 35 35 define( 'ALPHAPRICETABLE_VERSION', '1.0.8');36 define( 'ALPHAPRICETABLE_PLUGIN_FILE', __FILE__);37 define( 'ALPHAPRICETABLE_PLUGIN_URL', plugin_dir_url(ALPHAPRICETABLE_PLUGIN_FILE));38 define( 'ALPHAPRICETABLE_PLUGIN_PATH', plugin_dir_path(ALPHAPRICETABLE_PLUGIN_FILE));39 define( 'ALPHAPRICETABLE_ASSETS_URL', trailingslashit(ALPHAPRICETABLE_PLUGIN_URL . 'assets'));40 define( 'ALPHAPRICETABLE_INCLUDES_PATH', trailingslashit(ALPHAPRICETABLE_PLUGIN_PATH . 'includes'));41 define( 'ALPHAPRICETABLE_LANGUAGES_PATH', trailingslashit(ALPHAPRICETABLE_PLUGIN_PATH . 'languages'));42 define( 'ALPHAPRICETABLE_PLUGIN_BASENAME', plugin_basename(ALPHAPRICETABLE_PLUGIN_FILE));36 define( 'ALPHAPRICETABLE_VERSION', '1.1' ); 37 define( 'ALPHAPRICETABLE_PLUGIN_FILE', __FILE__ ); 38 define( 'ALPHAPRICETABLE_PLUGIN_URL', plugin_dir_url( ALPHAPRICETABLE_PLUGIN_FILE ) ); 39 define( 'ALPHAPRICETABLE_PLUGIN_PATH', plugin_dir_path( ALPHAPRICETABLE_PLUGIN_FILE ) ); 40 define( 'ALPHAPRICETABLE_ASSETS_URL', trailingslashit( ALPHAPRICETABLE_PLUGIN_URL . 'assets' ) ); 41 define( 'ALPHAPRICETABLE_INCLUDES_PATH', trailingslashit( ALPHAPRICETABLE_PLUGIN_PATH . 'includes' ) ); 42 define( 'ALPHAPRICETABLE_LANGUAGES_PATH', trailingslashit( ALPHAPRICETABLE_PLUGIN_PATH . 'languages' ) ); 43 define( 'ALPHAPRICETABLE_PLUGIN_BASENAME', plugin_basename( ALPHAPRICETABLE_PLUGIN_FILE ) ); 43 44 44 45 /** … … 49 50 * @since 1.0.6 50 51 */ 51 function alpha_price_table_addon_init() 52 { 53 // Check if Elementor is installed and activated. 54 if (! did_action('elementor/loaded')) { 55 add_action('admin_notices', 'alpha_price_table_missing_elementor_notice'); 56 return; 57 } 52 function alpha_price_table_addon_init() { 53 // Check if Elementor is installed and activated. 54 if ( ! did_action( 'elementor/loaded' ) ) { 55 add_action( 'admin_notices', 'alpha_price_table_missing_elementor_notice' ); 56 return; 57 } 58 58 59 // Load plugin text domain for translations.60 load_plugin_textdomain('alpha-price-table-for-elementor', false, ALPHAPRICETABLE_PLUGIN_BASENAME . '/languages');59 // Load plugin text domain for translations. 60 load_plugin_textdomain( 'alpha-price-table-for-elementor', false, ALPHAPRICETABLE_PLUGIN_BASENAME . '/languages' ); 61 61 62 // Include the main plugin class.63 include_once ALPHAPRICETABLE_INCLUDES_PATH . 'class-alpha-price-table.php';62 // Include the main plugin class. 63 include_once ALPHAPRICETABLE_INCLUDES_PATH . 'class-alpha-price-table.php'; 64 64 65 // Initialize the plugin.66 \Elementor_Alpha_Price_Table_Addon\Alpha_Price_Table_For_Elementor::instance();65 // Initialize the plugin. 66 \Elementor_Alpha_Price_Table_Addon\Alpha_Price_Table_For_Elementor::instance(); 67 67 } 68 add_action( 'plugins_loaded', 'alpha_price_table_addon_init');68 add_action( 'plugins_loaded', 'alpha_price_table_addon_init' ); 69 69 70 70 … … 75 75 * @since 1.0.6 76 76 */ 77 function alpha_price_table_missing_elementor_notice() 78 { 79 if (!current_user_can('activate_plugins')) { 80 return; 81 } 77 function alpha_price_table_missing_elementor_notice() { 78 if ( ! current_user_can( 'activate_plugins' ) ) { 79 return; 80 } 82 81 83 $plugin= 'elementor/elementor.php';84 $is_elementor_installed = file_exists(WP_PLUGIN_DIR . '/' . $plugin);82 $plugin = 'elementor/elementor.php'; 83 $is_elementor_installed = file_exists( WP_PLUGIN_DIR . '/' . $plugin ); 85 84 86 if ($is_elementor_installed) {87 $action_url= wp_nonce_url(88 self_admin_url('plugins.php?action=activate&plugin=' . $plugin),89 'activate-plugin_' . $plugin90 );91 $action_text = __('Activate Elementor Now', 'alpha-price-table-for-elementor');92 /* translators: %1$s: Plugin name, %2$s: Action link */93 $message_template = __('%1$s requires Elementor to be activated. %2$s', 'alpha-price-table-for-elementor');94 } else {95 $action_url= wp_nonce_url(96 self_admin_url('update.php?action=install-plugin&plugin=elementor'),97 'install-plugin_elementor'98 );99 $action_text = __('Install Elementor Now', 'alpha-price-table-for-elementor');100 /* translators: %1$s: Plugin name, %2$s: Action link */101 $message_template = __('%1$s requires Elementor to be installed and activated. %2$s', 'alpha-price-table-for-elementor');102 }85 if ( $is_elementor_installed ) { 86 $action_url = wp_nonce_url( 87 self_admin_url( 'plugins.php?action=activate&plugin=' . $plugin ), 88 'activate-plugin_' . $plugin 89 ); 90 $action_text = __( 'Activate Elementor Now', 'alpha-price-table-for-elementor' ); 91 /* translators: %1$s: Plugin name, %2$s: Action link */ 92 $message_template = __( '%1$s requires Elementor to be activated. %2$s', 'alpha-price-table-for-elementor' ); 93 } else { 94 $action_url = wp_nonce_url( 95 self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 96 'install-plugin_elementor' 97 ); 98 $action_text = __( 'Install Elementor Now', 'alpha-price-table-for-elementor' ); 99 /* translators: %1$s: Plugin name, %2$s: Action link */ 100 $message_template = __( '%1$s requires Elementor to be installed and activated. %2$s', 'alpha-price-table-for-elementor' ); 101 } 103 102 104 // Safely construct the plugin name and action link.105 $plugin_name = '<strong>' . esc_html__('Alpha Price Table For Elementor', 'alpha-price-table-for-elementor') . '</strong>';106 $action_link = '<a href="' . esc_url($action_url) . '" class="button-primary">' . esc_html($action_text) . '</a>';103 // Safely construct the plugin name and action link. 104 $plugin_name = '<strong>' . esc_html__( 'Alpha Price Table For Elementor', 'alpha-price-table-for-elementor' ) . '</strong>'; 105 $action_link = '<a href="' . esc_url( $action_url ) . '" class="button-primary">' . esc_html( $action_text ) . '</a>'; 107 106 108 // Combine message template with placeholders.109 $message = sprintf(110 $message_template,111 $plugin_name,112 $action_link113 );107 // Combine message template with placeholders. 108 $message = sprintf( 109 $message_template, 110 $plugin_name, 111 $action_link 112 ); 114 113 115 // Output the notice with the allowed HTML tags.116 $allowed_html = [ 117 'strong' => [],118 'a' => [ 119 'href' => [],120 'class' => [],121 ],122 'div' => [ 123 'class' => [],124 ],125 'p' => [],126 ];114 // Output the notice with the allowed HTML tags. 115 $allowed_html = array( 116 'strong' => array(), 117 'a' => array( 118 'href' => array(), 119 'class' => array(), 120 ), 121 'div' => array( 122 'class' => array(), 123 ), 124 'p' => array(), 125 ); 127 126 128 printf(129 '<div class="notice notice-warning is-dismissible">%s</div>',130 wp_kses('<p>' . $message . '</p>', $allowed_html)131 );127 printf( 128 '<div class="notice notice-warning is-dismissible">%s</div>', 129 wp_kses( '<p>' . $message . '</p>', $allowed_html ) 130 ); 132 131 } 133 -
alpha-price-table-for-elementor/trunk/includes/class-alpha-price-table-widget.php
r3209593 r3276978 1 1 <?php 2 /** 3 * Alpha Price Table Widget. 4 * 5 * @package AlphaPriceTable 6 * */ 2 7 3 8 namespace Elementor_Alpha_Price_Table_Addon; 4 9 5 if ( !defined('ABSPATH')) {6 exit; // Prevent direct access.10 if ( ! defined( 'ABSPATH' ) ) { 11 exit; // Prevent direct access. 7 12 } 8 13 … … 23 28 * Defines the Alpha Price Table widget for Elementor. 24 29 */ 25 class Alpha_Price_Table_Widget extends Widget_Base 26 { 27 /** 28 * Retrieve widget name. 29 * 30 * @return string 31 */ 32 public function get_name() 33 { 34 return 'alpha-price-table'; 35 } 36 37 /** 38 * Retrieve widget title. 39 * 40 * @return string 41 */ 42 public function get_title() 43 { 44 return esc_html__('Alpha Price Table', 'alpha-price-table-for-elementor'); 45 } 46 47 /** 48 * Retrieve widget icon. 49 * 50 * @return string 51 */ 52 public function get_icon() 53 { 54 return 'eicon-price-table'; 55 } 56 57 /** 58 * Retrieve widget keywords. 59 * 60 * @return array 61 */ 62 public function get_keywords() 63 { 64 return ['pricing', 'table', 'plan', 'button']; 65 } 66 67 /** 68 * Register widget controls. 69 * 70 * @return void 71 */ 72 protected function register_controls() 73 { 74 // Header Section 75 $this->start_controls_section( 76 'section_header', 77 [ 78 'label' => esc_html__('Header', 'alpha-price-table-for-elementor'), 79 ] 80 ); 81 82 $this->add_control( 83 'check_demo', 84 [ 85 'type' => Controls_Manager::RAW_HTML, 86 'raw' => sprintf( 87 /* translators: 1: Demo link open tag, 2: Link close tag. */ 88 esc_html__('Check this widget demo %1$shere%2$s.', 'alpha-price-table-for-elementor'), 89 '<a href="https://ali-ali.org/project/alpha-price-table-for-elementor/" target="_blank">', 90 '</a>' 91 ), 92 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 93 ] 94 ); 95 96 $this->add_control( 97 'heading', 98 [ 99 'label' => esc_html__('Title', 'alpha-price-table-for-elementor'), 100 'type' => Controls_Manager::TEXT, 101 'default' => esc_html__('Enter your title', 'alpha-price-table-for-elementor'), 102 ] 103 ); 104 105 $this->add_control( 106 'heading_alignment', 107 [ 108 'label' => esc_html__('Alignment', 'alpha-price-table-for-elementor'), 109 'type' => Controls_Manager::CHOOSE, 110 'label_block' => false, 111 'options' => [ 112 'left' => [ 113 'title' => esc_html__('Left', 'alpha-price-table-for-elementor'), 114 'icon' => 'eicon-text-align-left', 115 ], 116 'center' => [ 117 'title' => esc_html__('Center', 'alpha-price-table-for-elementor'), 118 'icon' => 'eicon-text-align-center', 119 ], 120 'right' => [ 121 'title' => esc_html__('Right', 'alpha-price-table-for-elementor'), 122 'icon' => 'eicon-text-align-right', 123 ], 124 ], 125 'selectors' => [ 126 '{{WRAPPER}} .elementor-price-table__header' => 'text-align: {{VALUE}}', 127 ], 128 ] 129 ); 130 131 $this->add_control( 132 'sub_heading', 133 [ 134 'label' => esc_html__('Description', 'alpha-price-table-for-elementor'), 135 'type' => Controls_Manager::TEXT, 136 'default' => esc_html__('Enter your description', 'alpha-price-table-for-elementor'), 137 ] 138 ); 139 140 $this->add_control( 141 'heading_tag', 142 [ 143 'label' => esc_html__('Heading Tag', 'alpha-price-table-for-elementor'), 144 'type' => Controls_Manager::SELECT, 145 'options' => [ 146 'h2' => 'H2', 147 'h3' => 'H3', 148 'h4' => 'H4', 149 'h5' => 'H5', 150 'h6' => 'H6', 151 ], 152 'default' => 'h3', 153 ] 154 ); 155 156 $this->end_controls_section(); 157 158 // Features Section 159 $this->start_controls_section( 160 'section_features', 161 [ 162 'label' => esc_html__('Features', 'alpha-price-table-for-elementor'), 163 ] 164 ); 165 166 $repeater = new Repeater(); 167 168 $repeater->add_control( 169 'item_text', 170 [ 171 'label' => esc_html__('Text', 'alpha-price-table-for-elementor'), 172 'type' => Controls_Manager::TEXT, 173 'default' => esc_html__('List Item', 'alpha-price-table-for-elementor'), 174 ] 175 ); 176 177 $default_icon = [ 178 'value' => 'far fa-check-circle', 179 'library' => 'fa-regular', 180 ]; 181 182 $repeater->add_control( 183 'selected_item_icon', 184 [ 185 'label' => esc_html__('Icon', 'alpha-price-table-for-elementor'), 186 'type' => Controls_Manager::ICONS, 187 'fa4compatibility' => 'item_icon', 188 'default' => $default_icon, 189 ] 190 ); 191 192 $repeater->add_control( 193 'item_icon_color', 194 [ 195 'label' => esc_html__('Icon Color', 'alpha-price-table-for-elementor'), 196 'type' => Controls_Manager::COLOR, 197 'selectors' => [ 198 '{{WRAPPER}} {{CURRENT_ITEM}} i' => 'color: {{VALUE}}', 199 '{{WRAPPER}} {{CURRENT_ITEM}} svg' => 'fill: {{VALUE}}', 200 ], 201 'default' => '#4BD700', 202 ] 203 ); 204 205 $repeater->add_control( 206 'item_icon_position', 207 [ 208 'label' => esc_html__('Icon Position', 'alpha-price-table-for-elementor'), 209 'type' => Controls_Manager::SELECT, 210 'default' => 'before', 211 'options' => [ 212 'before' => esc_html__('Before', 'alpha-price-table-for-elementor'), 213 'after' => esc_html__('After', 'alpha-price-table-for-elementor'), 214 ], 215 'condition' => [ 216 'selected_item_icon[value]!' => '', 217 ], 218 ] 219 ); 220 221 $this->add_control( 222 'features_list', 223 [ 224 'type' => Controls_Manager::REPEATER, 225 'fields' => $repeater->get_controls(), 226 'default' => [ 227 [ 228 'item_text' => esc_html__('List Item #1', 'alpha-price-table-for-elementor'), 229 'selected_item_icon' => $default_icon, 230 'item_icon_position' => 'before', 231 ], 232 [ 233 'item_text' => esc_html__('List Item #2', 'alpha-price-table-for-elementor'), 234 'selected_item_icon' => $default_icon, 235 'item_icon_position' => 'before', 236 ], 237 [ 238 'item_text' => esc_html__('List Item #3', 'alpha-price-table-for-elementor'), 239 'selected_item_icon' => $default_icon, 240 'item_icon_position' => 'before', 241 ], 242 ], 243 'title_field' => '{{{ item_text }}}', 244 ] 245 ); 246 247 $this->end_controls_section(); 248 249 // Footer Section 250 $this->start_controls_section( 251 'section_footer', 252 [ 253 'label' => esc_html__('Footer', 'alpha-price-table-for-elementor'), 254 ] 255 ); 256 257 $this->add_control( 258 'button_text', 259 [ 260 'label' => esc_html__('Button Text', 'alpha-price-table-for-elementor'), 261 'type' => Controls_Manager::TEXT, 262 'default' => esc_html__('Click Here', 'alpha-price-table-for-elementor'), 263 ] 264 ); 265 266 $this->add_control( 267 'link', 268 [ 269 'label' => esc_html__('Link', 'alpha-price-table-for-elementor'), 270 'type' => Controls_Manager::URL, 271 'placeholder' => esc_html__('https://your-link.com', 'alpha-price-table-for-elementor'), 272 'default' => [ 273 'url' => '#', 274 ], 275 'dynamic' => [ 276 'active' => true, 277 ], 278 ] 279 ); 280 281 $this->end_controls_section(); 282 283 $this->start_controls_section( 284 'section_header_style', 285 [ 286 'label' => esc_html__('Header', 'alpha-price-table-for-elementor'), 287 'tab' => Controls_Manager::TAB_STYLE, 288 'show_label' => false, 289 ] 290 ); 291 292 $this->add_control( 293 'header_bg_color', 294 [ 295 'label' => esc_html__('Background Color', 'alpha-price-table-for-elementor'), 296 'type' => Controls_Manager::COLOR, 297 'global' => [ 298 'default' => Global_Colors::COLOR_SECONDARY, 299 ], 300 'selectors' => [ 301 '{{WRAPPER}} .elementor-price-table__header' => 'background-color: {{VALUE}}', 302 ], 303 'default' => '#121212', 304 ] 305 ); 306 307 $this->add_responsive_control( 308 'header_padding', 309 [ 310 'label' => esc_html__('Padding', 'alpha-price-table-for-elementor'), 311 'type' => Controls_Manager::DIMENSIONS, 312 'size_units' => ['px', '%', 'em'], 313 'selectors' => [ 314 '{{WRAPPER}} .elementor-price-table__header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 315 ], 316 ] 317 ); 318 319 $this->add_control( 320 'heading_heading_style', 321 [ 322 'label' => esc_html__('Title', 'alpha-price-table-for-elementor'), 323 'type' => Controls_Manager::HEADING, 324 'separator' => 'before', 325 ] 326 ); 327 328 $this->add_control( 329 'heading_color', 330 [ 331 'label' => esc_html__('Color', 'alpha-price-table-for-elementor'), 332 'type' => Controls_Manager::COLOR, 333 'selectors' => [ 334 '{{WRAPPER}} .elementor-price-table__heading' => 'color: {{VALUE}}', 335 ], 336 ] 337 ); 338 339 $this->add_group_control( 340 Group_Control_Typography::get_type(), 341 [ 342 'name' => 'heading_typography', 343 'selector' => '{{WRAPPER}} .elementor-price-table__heading', 344 'global' => [ 345 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, 346 ], 347 ] 348 ); 349 350 $this->add_control( 351 'heading_sub_heading_style', 352 [ 353 'label' => esc_html__('Sub Title', 'alpha-price-table-for-elementor'), 354 'type' => Controls_Manager::HEADING, 355 'separator' => 'before', 356 ] 357 ); 358 359 $this->add_control( 360 'sub_heading_color', 361 [ 362 'label' => esc_html__('Color', 'alpha-price-table-for-elementor'), 363 'type' => Controls_Manager::COLOR, 364 'selectors' => [ 365 '{{WRAPPER}} .elementor-price-table__subheading' => 'color: {{VALUE}}', 366 ], 367 ] 368 ); 369 370 $this->add_group_control( 371 Group_Control_Typography::get_type(), 372 [ 373 'name' => 'sub_heading_typography', 374 'selector' => '{{WRAPPER}} .elementor-price-table__subheading', 375 'global' => [ 376 'default' => Global_Typography::TYPOGRAPHY_SECONDARY, 377 ], 378 ] 379 ); 380 381 $this->end_controls_section(); 382 383 $this->start_controls_section( 384 'section_features_list_style', 385 [ 386 'label' => esc_html__('Features', 'alpha-price-table-for-elementor'), 387 'tab' => Controls_Manager::TAB_STYLE, 388 'show_label' => false, 389 ] 390 ); 391 392 $this->add_control( 393 'features_list_bg_color', 394 [ 395 'label' => esc_html__('Background Color', 'alpha-price-table-for-elementor'), 396 'type' => Controls_Manager::COLOR, 397 'separator' => 'before', 398 'selectors' => [ 399 '{{WRAPPER}} .elementor-price-table__features-list' => 'background-color: {{VALUE}}', 400 ], 401 ] 402 ); 403 404 $this->add_responsive_control( 405 'features_list_padding', 406 [ 407 'label' => esc_html__('Padding', 'alpha-price-table-for-elementor'), 408 'type' => Controls_Manager::DIMENSIONS, 409 'size_units' => ['px', '%', 'em'], 410 'selectors' => [ 411 '{{WRAPPER}} .elementor-price-table__features-list' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 412 ], 413 'default' => [ 414 'top' => 25, 415 'right' => 0, 416 'bottom' => 0, 417 'left' => 0, 418 'unit' => 'px', 419 'isLinked' => false, 420 ], 421 'placeholder' => [ 422 'top' => 25, 423 'right' => 0, 424 'bottom' => 0, 425 'left' => 0, 426 ], 427 ] 428 ); 429 430 $this->add_control( 431 'features_list_color', 432 [ 433 'label' => esc_html__('Color', 'alpha-price-table-for-elementor'), 434 'type' => Controls_Manager::COLOR, 435 'global' => [ 436 'default' => Global_Colors::COLOR_TEXT, 437 ], 438 'separator' => 'before', 439 'selectors' => [ 440 '{{WRAPPER}} .elementor-price-table__features-list' => 'color: {{VALUE}}', 441 ], 442 ] 443 ); 444 445 $this->add_group_control( 446 Group_Control_Typography::get_type(), 447 [ 448 'name' => 'features_list_typography', 449 'selector' => '{{WRAPPER}} .elementor-price-table__features-list li', 450 'global' => [ 451 'default' => Global_Typography::TYPOGRAPHY_TEXT, 452 ], 453 ] 454 ); 455 456 $this->add_responsive_control( 457 'item_width', 458 [ 459 'label' => esc_html__('Width', 'alpha-price-table-for-elementor'), 460 'type' => Controls_Manager::SLIDER, 461 'range' => [ 462 '%' => [ 463 'min' => 25, 464 'max' => 100, 465 ], 466 ], 467 'selectors' => [ 468 '{{WRAPPER}} .elementor-price-table__feature-inner' => 'margin-left: calc((100% - {{SIZE}}%)/2); margin-right: calc((100% - {{SIZE}}%)/2)', 469 ], 470 ] 471 ); 472 473 $this->end_controls_section(); 474 475 $this->start_controls_section( 476 'section_footer_style', 477 [ 478 'label' => esc_html__('Footer', 'alpha-price-table-for-elementor'), 479 'tab' => Controls_Manager::TAB_STYLE, 480 'show_label' => false, 481 ] 482 ); 483 484 $this->add_control( 485 'footer_bg_color', 486 [ 487 'label' => esc_html__('Background Color', 'alpha-price-table-for-elementor'), 488 'type' => Controls_Manager::COLOR, 489 'selectors' => [ 490 '{{WRAPPER}} .elementor-price-table__footer' => 'background-color: {{VALUE}}', 491 ], 492 ] 493 ); 494 495 $this->add_responsive_control( 496 'footer_padding', 497 [ 498 'label' => esc_html__('Padding', 'alpha-price-table-for-elementor'), 499 'type' => Controls_Manager::DIMENSIONS, 500 'size_units' => ['px', '%', 'em'], 501 'selectors' => [ 502 '{{WRAPPER}} .elementor-price-table__footer' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 503 ], 504 ] 505 ); 506 507 $this->add_control( 508 'heading_footer_button', 509 [ 510 'label' => esc_html__('Button', 'alpha-price-table-for-elementor'), 511 'type' => Controls_Manager::HEADING, 512 'separator' => 'before', 513 'condition' => [ 514 'button_text!' => '', 515 ], 516 ] 517 ); 518 519 $this->add_responsive_control( 520 'button_size', 521 [ 522 'label' => esc_html__('Size', 'alpha-price-table-for-elementor'), 523 'type' => Controls_Manager::SELECT, 524 'default' => 'md', 525 'options' => [ 526 'xs' => esc_html__('Extra Small', 'alpha-price-table-for-elementor'), 527 'sm' => esc_html__('Small', 'alpha-price-table-for-elementor'), 528 'md' => esc_html__('Medium', 'alpha-price-table-for-elementor'), 529 'lg' => esc_html__('Large', 'alpha-price-table-for-elementor'), 530 'xl' => esc_html__('Extra Large', 'alpha-price-table-for-elementor'), 531 ], 532 'condition' => [ 533 'button_text!' => '', 534 ], 535 ] 536 ); 537 538 $this->start_controls_tabs('tabs_button_style'); 539 540 $this->start_controls_tab( 541 'tab_button_normal', 542 [ 543 'label' => esc_html__('Normal', 'alpha-price-table-for-elementor'), 544 'condition' => [ 545 'button_text!' => '', 546 ], 547 ] 548 ); 549 550 $this->add_control( 551 'button_text_color', 552 [ 553 'label' => esc_html__('Text Color', 'alpha-price-table-for-elementor'), 554 'type' => Controls_Manager::COLOR, 555 'default' => '', 556 'selectors' => [ 557 '{{WRAPPER}} .elementor-price-table__button' => 'color: {{VALUE}};', 558 ], 559 'condition' => [ 560 'button_text!' => '', 561 ], 562 ] 563 ); 564 565 $this->add_group_control( 566 Group_Control_Typography::get_type(), 567 [ 568 'name' => 'button_typography', 569 'global' => [ 570 'default' => Global_Typography::TYPOGRAPHY_ACCENT, 571 ], 572 'selector' => '{{WRAPPER}} .elementor-price-table__button', 573 'condition' => [ 574 'button_text!' => '', 575 ], 576 ] 577 ); 578 579 $this->add_control( 580 'button_background_color', 581 [ 582 'label' => esc_html__('Background Color', 'alpha-price-table-for-elementor'), 583 'type' => Controls_Manager::COLOR, 584 'global' => [ 585 'default' => Global_Colors::COLOR_ACCENT, 586 ], 587 'selectors' => [ 588 '{{WRAPPER}} .elementor-price-table__button' => 'background-color: {{VALUE}};', 589 ], 590 'condition' => [ 591 'button_text!' => '', 592 ], 593 'default' => '#121212', 594 ] 595 ); 596 597 $this->add_group_control( 598 Group_Control_Border::get_type(), 599 [ 600 'name' => 'button_border', 601 'selector' => '{{WRAPPER}} .elementor-price-table__button', 602 'condition' => [ 603 'button_text!' => '', 604 ], 605 'separator' => 'before', 606 ] 607 ); 608 609 $this->add_responsive_control( 610 'button_border_radius', 611 [ 612 'label' => esc_html__('Border Radius', 'alpha-price-table-for-elementor'), 613 'type' => Controls_Manager::DIMENSIONS, 614 'size_units' => ['px', '%'], 615 'selectors' => [ 616 '{{WRAPPER}} .elementor-price-table__button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 617 ], 618 'condition' => [ 619 'button_text!' => '', 620 ], 621 ] 622 ); 623 624 $this->add_responsive_control( 625 'button_text_padding', 626 [ 627 'label' => esc_html__('Text Padding', 'alpha-price-table-for-elementor'), 628 'type' => Controls_Manager::DIMENSIONS, 629 'size_units' => ['px', 'em', '%'], 630 'selectors' => [ 631 '{{WRAPPER}} .elementor-price-table__button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 632 ], 633 'condition' => [ 634 'button_text!' => '', 635 ], 636 ] 637 ); 638 639 $this->end_controls_tab(); 640 641 $this->start_controls_tab( 642 'tab_button_hover', 643 [ 644 'label' => esc_html__('Hover', 'alpha-price-table-for-elementor'), 645 'condition' => [ 646 'button_text!' => '', 647 ], 648 ] 649 ); 650 651 $this->add_control( 652 'button_hover_color', 653 [ 654 'label' => esc_html__('Text Color', 'alpha-price-table-for-elementor'), 655 'type' => Controls_Manager::COLOR, 656 'selectors' => [ 657 '{{WRAPPER}} .elementor-price-table__button:hover' => 'color: {{VALUE}};', 658 ], 659 'condition' => [ 660 'button_text!' => '', 661 ], 662 ] 663 ); 664 665 $this->add_control( 666 'button_background_hover_color', 667 [ 668 'label' => esc_html__('Background Color', 'alpha-price-table-for-elementor'), 669 'type' => Controls_Manager::COLOR, 670 'selectors' => [ 671 '{{WRAPPER}} .elementor-price-table__button:hover' => 'background-color: {{VALUE}};', 672 ], 673 'condition' => [ 674 'button_text!' => '', 675 ], 676 ] 677 ); 678 679 $this->add_control( 680 'button_hover_border_color', 681 [ 682 'label' => esc_html__('Border Color', 'alpha-price-table-for-elementor'), 683 'type' => Controls_Manager::COLOR, 684 'selectors' => [ 685 '{{WRAPPER}} .elementor-price-table__button:hover' => 'border-color: {{VALUE}};', 686 ], 687 'condition' => [ 688 'button_text!' => '', 689 ], 690 ] 691 ); 692 693 $this->add_control( 694 'button_hover_animation', 695 [ 696 'label' => esc_html__('Animation', 'alpha-price-table-for-elementor'), 697 'type' => Controls_Manager::HOVER_ANIMATION, 698 'condition' => [ 699 'button_text!' => '', 700 ], 701 ] 702 ); 703 704 $this->end_controls_tab(); 705 706 $this->end_controls_tabs(); 707 708 $this->end_controls_section(); 709 710 $this->start_controls_section( 711 'alpha_pricetable', 712 [ 713 'label' => esc_html__('Table', 'alpha-price-table-for-elementor'), 714 'tab' => Controls_Manager::TAB_STYLE, 715 'show_label' => false, 716 ] 717 ); 718 719 $this->add_group_control( 720 Group_Control_Border::get_type(), 721 [ 722 'name' => 'product_border', 723 'selector' => '{{WRAPPER}} .elementor-price-table', 724 'separator' => 'before', 725 ] 726 ); 727 728 $this->add_responsive_control( 729 'pricetable_border_radius', 730 [ 731 'label' => esc_html__('Border Radius', 'alpha-price-table-for-elementor'), 732 'type' => Controls_Manager::DIMENSIONS, 733 'size_units' => ['px', '%'], 734 'default' => [ 735 'top' => 0, 736 'right' => 0, 737 'bottom' => 0, 738 'left' => 0, 739 'unit' => 'px', 740 'isLinked' => 'true', 741 ], 742 'selectors' => [ 743 '{{WRAPPER}} .elementor-price-table' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 744 ], 745 ] 746 ); 747 748 $this->add_control( 749 'alpha_pricetable_overflow', 750 [ 751 'label' => esc_html__('Overflow', 'alpha-price-table-for-elementor'), 752 'type' => Controls_Manager::SELECT, 753 'default' => 'Hidden', 754 'options' => [ 755 'hidden' => esc_html__('Hidden', 'alpha-price-table-for-elementor'), 756 'visible' => esc_html__('Visible', 'alpha-price-table-for-elementor'), 757 ], 758 'selectors' => [ 759 '{{WRAPPER}}' => 'overflow: {{VALUE}}', 760 ], 761 ] 762 ); 763 764 $this->end_controls_section(); 765 } 766 767 /** 768 * Render the widget output on the frontend. 769 * 770 * @return void 771 */ 772 protected function render() 773 { 774 $settings = $this->get_settings_for_display(); 775 776 // Escape button size 777 $button_size = isset($settings['button_size']) ? esc_attr($settings['button_size']) : 'md'; 778 779 $this->add_render_attribute( 780 'button_text', 'class', [ 781 'elementor-price-table__button', 782 'elementor-button', 783 'cta-bt', 784 'elementor-size-' . $button_size, 785 ] 786 ); 787 788 if (! empty($settings['link']['url'])) { 789 $this->add_link_attributes('button_text', $settings['link']); 790 } 791 792 if (! empty($settings['button_hover_animation'])) { 793 $this->add_render_attribute('button_text', 'class', 'elementor-animation-' . esc_attr($settings['button_hover_animation'])); 794 } 795 796 $this->add_render_attribute('heading', 'class', 'elementor-price-table__heading'); 797 $this->add_render_attribute('sub_heading', 'class', 'elementor-price-table__subheading'); 798 $this->add_render_attribute('footer_additional_info', 'class', 'elementor-price-table__additional_info'); 799 800 $this->add_inline_editing_attributes('heading', 'none'); 801 $this->add_inline_editing_attributes('sub_heading', 'none'); 802 $this->add_inline_editing_attributes('footer_additional_info'); 803 $this->add_inline_editing_attributes('button_text'); 804 805 $migration_allowed = Icons_Manager::is_migration_allowed(); 806 ?> 807 808 <div class="elementor-price-table"> 809 <?php if ($settings['heading'] || $settings['sub_heading']) : ?> 810 <div class="elementor-price-table__header"> 811 <?php if (! empty($settings['heading'])) : ?> 812 <<?php echo esc_attr($settings['heading_tag']); ?> <?php echo wp_kses_post($this->get_render_attribute_string('heading')); ?>> 813 <?php echo wp_kses_post($settings['heading']); ?> 814 </<?php echo esc_attr($settings['heading_tag']); ?>> 815 <?php endif; ?> 816 817 <?php if (! empty($settings['sub_heading'])) : ?> 818 <span <?php echo wp_kses_post($this->get_render_attribute_string('sub_heading')); ?>> 819 <?php echo wp_kses_post($settings['sub_heading']); ?> 820 </span> 821 <?php endif; ?> 822 </div> 823 <?php endif; ?> 824 825 <?php if (! empty($settings['features_list'])) : ?> 826 <ul class="elementor-price-table__features-list"> 827 <?php 828 foreach ($settings['features_list'] as $index => $item) : 829 $repeater_setting_key = $this->get_repeater_setting_key('item_text', 'features_list', $index); 830 $this->add_inline_editing_attributes($repeater_setting_key); 831 832 $migrated = isset($item['__fa4_migrated']['selected_item_icon']); 833 // Add old default 834 if (! isset($item['item_icon']) && ! $migration_allowed) { 835 $item['item_icon'] = 'fa fa-check-circle'; 836 } 837 $is_new = ! isset($item['item_icon']) && $migration_allowed; 838 839 // Sanitize the item ID for class attribute 840 $item_id = isset($item['_id']) ? sanitize_html_class($item['_id']) : ''; 841 ?> 842 <li class="elementor-repeater-item-<?php echo esc_attr($item_id); ?>"> 843 <div class="elementor-price-table__feature-inner"> 844 <?php 845 $item_icon_position = $item['item_icon_position']; 846 $location_setting = ! empty($item_icon_position) ? $item_icon_position : 'before'; 847 if ((! empty($item['item_icon']) || ! empty($item['selected_item_icon'])) && $location_setting == 'before') : 848 if ($is_new || $migrated) : 849 Icons_Manager::render_icon($item['selected_item_icon'], ['aria-hidden' => 'true']); 850 else : ?> 851 <i class="<?php echo esc_attr($item['item_icon']); ?>" aria-hidden="true"></i> 852 <?php 853 endif; 854 endif; 855 if (! empty($item['item_text'])) : ?> 856 <span <?php echo wp_kses_post($this->get_render_attribute_string($repeater_setting_key)); ?>> 857 <?php echo esc_html($item['item_text']); ?> 858 </span> 859 <?php 860 else : 861 echo ' '; 862 endif; 863 if ((! empty($item['item_icon']) || ! empty($item['selected_item_icon'])) && $location_setting == 'after') : 864 if ($is_new || $migrated) : 865 Icons_Manager::render_icon($item['selected_item_icon'], ['aria-hidden' => 'true']); 866 else : ?> 867 <i class="<?php echo esc_attr($item['item_icon']); ?>" aria-hidden="true"></i> 868 <?php 869 endif; 870 endif; 871 ?> 872 </div> 873 </li> 874 <?php endforeach; ?> 875 </ul> 876 <?php endif; ?> 877 878 <?php if (! empty($settings['button_text']) || ! empty($settings['footer_additional_info'])) : ?> 879 <div class="elementor-price-table__footer"> 880 <?php if (! empty($settings['button_text'])) : ?> 881 <a <?php echo wp_kses_post($this->get_render_attribute_string('button_text')); ?>> 882 <?php echo esc_html($settings['button_text']); ?> 883 </a> 884 <?php endif; ?> 885 886 <?php if (! empty($settings['footer_additional_info'])) : ?> 887 <div <?php echo wp_kses_post($this->get_render_attribute_string('footer_additional_info')); ?>> 888 <?php echo wp_kses_post($settings['footer_additional_info']); ?> 889 </div> 890 <?php endif; ?> 891 </div> 892 <?php endif; ?> 893 </div> 894 895 <?php 896 } 30 class Alpha_Price_Table_Widget extends Widget_Base { 31 32 /** 33 * Retrieve widget name. 34 * 35 * @return string 36 */ 37 public function get_name() { 38 return 'alpha-price-table'; 39 } 40 41 /** 42 * Retrieve widget title. 43 * 44 * @return string 45 */ 46 public function get_title() { 47 return esc_html__( 'Alpha Price Table', 'alpha-price-table-for-elementor' ); 48 } 49 50 /** 51 * Retrieve widget icon. 52 * 53 * @return string 54 */ 55 public function get_icon() { 56 return 'eicon-price-table'; 57 } 58 59 /** 60 * Retrieve widget keywords. 61 * 62 * @return array 63 */ 64 public function get_keywords() { 65 return array( 'pricing', 'table', 'plan', 'button' ); 66 } 67 68 /** 69 * Register widget controls. 70 * 71 * @return void 72 */ 73 protected function register_controls() { 74 // Header Section. 75 $this->start_controls_section( 76 'section_header', 77 array( 78 'label' => esc_html__( 'Header', 'alpha-price-table-for-elementor' ), 79 ) 80 ); 81 82 $this->add_control( 83 'check_demo', 84 array( 85 'type' => Controls_Manager::RAW_HTML, 86 'raw' => sprintf( 87 /* translators: 1: Demo link open tag, 2: Link close tag. */ 88 esc_html__( 'Check this widget demo %1$shere%2$s.', 'alpha-price-table-for-elementor' ), 89 '<a href="https://ali-ali.org/project/alpha-price-table-for-elementor/" target="_blank">', 90 '</a>' 91 ), 92 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 93 ) 94 ); 95 96 $this->add_control( 97 'heading', 98 array( 99 'label' => esc_html__( 'Title', 'alpha-price-table-for-elementor' ), 100 'type' => Controls_Manager::TEXT, 101 'default' => esc_html__( 'Enter your title', 'alpha-price-table-for-elementor' ), 102 ) 103 ); 104 105 $this->add_control( 106 'heading_alignment', 107 array( 108 'label' => esc_html__( 'Alignment', 'alpha-price-table-for-elementor' ), 109 'type' => Controls_Manager::CHOOSE, 110 'label_block' => false, 111 'options' => array( 112 'left' => array( 113 'title' => esc_html__( 'Left', 'alpha-price-table-for-elementor' ), 114 'icon' => 'eicon-text-align-left', 115 ), 116 'center' => array( 117 'title' => esc_html__( 'Center', 'alpha-price-table-for-elementor' ), 118 'icon' => 'eicon-text-align-center', 119 ), 120 'right' => array( 121 'title' => esc_html__( 'Right', 'alpha-price-table-for-elementor' ), 122 'icon' => 'eicon-text-align-right', 123 ), 124 ), 125 'selectors' => array( 126 '{{WRAPPER}} .elementor-price-table__header' => 'text-align: {{VALUE}}', 127 ), 128 ) 129 ); 130 131 $this->add_control( 132 'sub_heading', 133 array( 134 'label' => esc_html__( 'Description', 'alpha-price-table-for-elementor' ), 135 'type' => Controls_Manager::TEXT, 136 'default' => esc_html__( 'Enter your description', 'alpha-price-table-for-elementor' ), 137 ) 138 ); 139 140 $this->add_control( 141 'heading_tag', 142 array( 143 'label' => esc_html__( 'Heading Tag', 'alpha-price-table-for-elementor' ), 144 'type' => Controls_Manager::SELECT, 145 'options' => array( 146 'h2' => 'H2', 147 'h3' => 'H3', 148 'h4' => 'H4', 149 'h5' => 'H5', 150 'h6' => 'H6', 151 ), 152 'default' => 'h3', 153 ) 154 ); 155 156 $this->end_controls_section(); 157 158 // Features Section. 159 $this->start_controls_section( 160 'section_features', 161 array( 162 'label' => esc_html__( 'Features', 'alpha-price-table-for-elementor' ), 163 ) 164 ); 165 166 $repeater = new Repeater(); 167 168 $repeater->add_control( 169 'item_text', 170 array( 171 'label' => esc_html__( 'Text', 'alpha-price-table-for-elementor' ), 172 'type' => Controls_Manager::TEXT, 173 'default' => esc_html__( 'List Item', 'alpha-price-table-for-elementor' ), 174 ) 175 ); 176 177 $default_icon = array( 178 'value' => 'far fa-check-circle', 179 'library' => 'fa-regular', 180 ); 181 182 $repeater->add_control( 183 'selected_item_icon', 184 array( 185 'label' => esc_html__( 'Icon', 'alpha-price-table-for-elementor' ), 186 'type' => Controls_Manager::ICONS, 187 'fa4compatibility' => 'item_icon', 188 'default' => $default_icon, 189 ) 190 ); 191 192 $repeater->add_control( 193 'item_icon_color', 194 array( 195 'label' => esc_html__( 'Icon Color', 'alpha-price-table-for-elementor' ), 196 'type' => Controls_Manager::COLOR, 197 'selectors' => array( 198 '{{WRAPPER}} {{CURRENT_ITEM}} i' => 'color: {{VALUE}}', 199 '{{WRAPPER}} {{CURRENT_ITEM}} svg' => 'fill: {{VALUE}}', 200 ), 201 'default' => '#4BD700', 202 ) 203 ); 204 205 $repeater->add_control( 206 'item_icon_position', 207 array( 208 'label' => esc_html__( 'Icon Position', 'alpha-price-table-for-elementor' ), 209 'type' => Controls_Manager::SELECT, 210 'default' => 'before', 211 'options' => array( 212 'before' => esc_html__( 'Before', 'alpha-price-table-for-elementor' ), 213 'after' => esc_html__( 'After', 'alpha-price-table-for-elementor' ), 214 ), 215 'condition' => array( 216 'selected_item_icon[value]!' => '', 217 ), 218 ) 219 ); 220 221 $this->add_control( 222 'features_list', 223 array( 224 'type' => Controls_Manager::REPEATER, 225 'fields' => $repeater->get_controls(), 226 'default' => array( 227 array( 228 'item_text' => esc_html__( 'List Item #1', 'alpha-price-table-for-elementor' ), 229 'selected_item_icon' => $default_icon, 230 'item_icon_position' => 'before', 231 ), 232 array( 233 'item_text' => esc_html__( 'List Item #2', 'alpha-price-table-for-elementor' ), 234 'selected_item_icon' => $default_icon, 235 'item_icon_position' => 'before', 236 ), 237 array( 238 'item_text' => esc_html__( 'List Item #3', 'alpha-price-table-for-elementor' ), 239 'selected_item_icon' => $default_icon, 240 'item_icon_position' => 'before', 241 ), 242 ), 243 'title_field' => '{{{ item_text }}}', 244 ) 245 ); 246 247 $this->end_controls_section(); 248 249 // Footer Section. 250 $this->start_controls_section( 251 'section_footer', 252 array( 253 'label' => esc_html__( 'Footer', 'alpha-price-table-for-elementor' ), 254 ) 255 ); 256 257 $this->add_control( 258 'button_text', 259 array( 260 'label' => esc_html__( 'Button Text', 'alpha-price-table-for-elementor' ), 261 'type' => Controls_Manager::TEXT, 262 'default' => esc_html__( 'Click Here', 'alpha-price-table-for-elementor' ), 263 ) 264 ); 265 266 $this->add_control( 267 'link', 268 array( 269 'label' => esc_html__( 'Link', 'alpha-price-table-for-elementor' ), 270 'type' => Controls_Manager::URL, 271 'placeholder' => esc_html__( 'https://your-link.com', 'alpha-price-table-for-elementor' ), 272 'default' => array( 273 'url' => '#', 274 ), 275 'dynamic' => array( 276 'active' => true, 277 ), 278 ) 279 ); 280 281 $this->end_controls_section(); 282 283 $this->start_controls_section( 284 'section_header_style', 285 array( 286 'label' => esc_html__( 'Header', 'alpha-price-table-for-elementor' ), 287 'tab' => Controls_Manager::TAB_STYLE, 288 'show_label' => false, 289 ) 290 ); 291 292 $this->add_control( 293 'header_bg_color', 294 array( 295 'label' => esc_html__( 'Background Color', 'alpha-price-table-for-elementor' ), 296 'type' => Controls_Manager::COLOR, 297 'global' => array( 298 'default' => Global_Colors::COLOR_SECONDARY, 299 ), 300 'selectors' => array( 301 '{{WRAPPER}} .elementor-price-table__header' => 'background-color: {{VALUE}}', 302 ), 303 'default' => '#121212', 304 ) 305 ); 306 307 $this->add_responsive_control( 308 'header_padding', 309 array( 310 'label' => esc_html__( 'Padding', 'alpha-price-table-for-elementor' ), 311 'type' => Controls_Manager::DIMENSIONS, 312 'size_units' => array( 'px', '%', 'em' ), 313 'selectors' => array( 314 '{{WRAPPER}} .elementor-price-table__header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 315 ), 316 ) 317 ); 318 319 $this->add_control( 320 'heading_heading_style', 321 array( 322 'label' => esc_html__( 'Title', 'alpha-price-table-for-elementor' ), 323 'type' => Controls_Manager::HEADING, 324 'separator' => 'before', 325 ) 326 ); 327 328 $this->add_control( 329 'heading_color', 330 array( 331 'label' => esc_html__( 'Color', 'alpha-price-table-for-elementor' ), 332 'type' => Controls_Manager::COLOR, 333 'selectors' => array( 334 '{{WRAPPER}} .elementor-price-table__heading' => 'color: {{VALUE}}', 335 ), 336 ) 337 ); 338 339 $this->add_group_control( 340 Group_Control_Typography::get_type(), 341 array( 342 'name' => 'heading_typography', 343 'selector' => '{{WRAPPER}} .elementor-price-table__heading', 344 'global' => array( 345 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, 346 ), 347 ) 348 ); 349 350 $this->add_control( 351 'heading_sub_heading_style', 352 array( 353 'label' => esc_html__( 'Sub Title', 'alpha-price-table-for-elementor' ), 354 'type' => Controls_Manager::HEADING, 355 'separator' => 'before', 356 ) 357 ); 358 359 $this->add_control( 360 'sub_heading_color', 361 array( 362 'label' => esc_html__( 'Color', 'alpha-price-table-for-elementor' ), 363 'type' => Controls_Manager::COLOR, 364 'selectors' => array( 365 '{{WRAPPER}} .elementor-price-table__subheading' => 'color: {{VALUE}}', 366 ), 367 ) 368 ); 369 370 $this->add_group_control( 371 Group_Control_Typography::get_type(), 372 array( 373 'name' => 'sub_heading_typography', 374 'selector' => '{{WRAPPER}} .elementor-price-table__subheading', 375 'global' => array( 376 'default' => Global_Typography::TYPOGRAPHY_SECONDARY, 377 ), 378 ) 379 ); 380 381 $this->end_controls_section(); 382 383 $this->start_controls_section( 384 'section_features_list_style', 385 array( 386 'label' => esc_html__( 'Features', 'alpha-price-table-for-elementor' ), 387 'tab' => Controls_Manager::TAB_STYLE, 388 'show_label' => false, 389 ) 390 ); 391 392 $this->add_control( 393 'features_list_bg_color', 394 array( 395 'label' => esc_html__( 'Background Color', 'alpha-price-table-for-elementor' ), 396 'type' => Controls_Manager::COLOR, 397 'separator' => 'before', 398 'selectors' => array( 399 '{{WRAPPER}} .elementor-price-table__features-list' => 'background-color: {{VALUE}}', 400 ), 401 ) 402 ); 403 404 $this->add_responsive_control( 405 'features_list_padding', 406 array( 407 'label' => esc_html__( 'Padding', 'alpha-price-table-for-elementor' ), 408 'type' => Controls_Manager::DIMENSIONS, 409 'size_units' => array( 'px', '%', 'em' ), 410 'selectors' => array( 411 '{{WRAPPER}} .elementor-price-table__features-list' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 412 ), 413 'default' => array( 414 'top' => 25, 415 'right' => 0, 416 'bottom' => 0, 417 'left' => 0, 418 'unit' => 'px', 419 'isLinked' => false, 420 ), 421 'placeholder' => array( 422 'top' => 25, 423 'right' => 0, 424 'bottom' => 0, 425 'left' => 0, 426 ), 427 ) 428 ); 429 430 $this->add_control( 431 'features_list_color', 432 array( 433 'label' => esc_html__( 'Color', 'alpha-price-table-for-elementor' ), 434 'type' => Controls_Manager::COLOR, 435 'global' => array( 436 'default' => Global_Colors::COLOR_TEXT, 437 ), 438 'separator' => 'before', 439 'selectors' => array( 440 '{{WRAPPER}} .elementor-price-table__features-list' => 'color: {{VALUE}}', 441 ), 442 ) 443 ); 444 445 $this->add_group_control( 446 Group_Control_Typography::get_type(), 447 array( 448 'name' => 'features_list_typography', 449 'selector' => '{{WRAPPER}} .elementor-price-table__features-list li', 450 'global' => array( 451 'default' => Global_Typography::TYPOGRAPHY_TEXT, 452 ), 453 ) 454 ); 455 456 $this->add_responsive_control( 457 'item_width', 458 array( 459 'label' => esc_html__( 'Width', 'alpha-price-table-for-elementor' ), 460 'type' => Controls_Manager::SLIDER, 461 'range' => array( 462 '%' => array( 463 'min' => 25, 464 'max' => 100, 465 ), 466 ), 467 'selectors' => array( 468 '{{WRAPPER}} .elementor-price-table__feature-inner' => 'margin-left: calc((100% - {{SIZE}}%)/2); margin-right: calc((100% - {{SIZE}}%)/2)', 469 ), 470 ) 471 ); 472 473 $this->end_controls_section(); 474 475 $this->start_controls_section( 476 'section_footer_style', 477 array( 478 'label' => esc_html__( 'Footer', 'alpha-price-table-for-elementor' ), 479 'tab' => Controls_Manager::TAB_STYLE, 480 'show_label' => false, 481 ) 482 ); 483 484 $this->add_control( 485 'footer_bg_color', 486 array( 487 'label' => esc_html__( 'Background Color', 'alpha-price-table-for-elementor' ), 488 'type' => Controls_Manager::COLOR, 489 'selectors' => array( 490 '{{WRAPPER}} .elementor-price-table__footer' => 'background-color: {{VALUE}}', 491 ), 492 ) 493 ); 494 495 $this->add_responsive_control( 496 'footer_padding', 497 array( 498 'label' => esc_html__( 'Padding', 'alpha-price-table-for-elementor' ), 499 'type' => Controls_Manager::DIMENSIONS, 500 'size_units' => array( 'px', '%', 'em' ), 501 'selectors' => array( 502 '{{WRAPPER}} .elementor-price-table__footer' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 503 ), 504 ) 505 ); 506 507 $this->add_control( 508 'heading_footer_button', 509 array( 510 'label' => esc_html__( 'Button', 'alpha-price-table-for-elementor' ), 511 'type' => Controls_Manager::HEADING, 512 'separator' => 'before', 513 'condition' => array( 514 'button_text!' => '', 515 ), 516 ) 517 ); 518 519 $this->add_responsive_control( 520 'button_size', 521 array( 522 'label' => esc_html__( 'Size', 'alpha-price-table-for-elementor' ), 523 'type' => Controls_Manager::SELECT, 524 'default' => 'md', 525 'options' => array( 526 'xs' => esc_html__( 'Extra Small', 'alpha-price-table-for-elementor' ), 527 'sm' => esc_html__( 'Small', 'alpha-price-table-for-elementor' ), 528 'md' => esc_html__( 'Medium', 'alpha-price-table-for-elementor' ), 529 'lg' => esc_html__( 'Large', 'alpha-price-table-for-elementor' ), 530 'xl' => esc_html__( 'Extra Large', 'alpha-price-table-for-elementor' ), 531 ), 532 'condition' => array( 533 'button_text!' => '', 534 ), 535 ) 536 ); 537 538 $this->start_controls_tabs( 'tabs_button_style' ); 539 540 $this->start_controls_tab( 541 'tab_button_normal', 542 array( 543 'label' => esc_html__( 'Normal', 'alpha-price-table-for-elementor' ), 544 'condition' => array( 545 'button_text!' => '', 546 ), 547 ) 548 ); 549 550 $this->add_control( 551 'button_text_color', 552 array( 553 'label' => esc_html__( 'Text Color', 'alpha-price-table-for-elementor' ), 554 'type' => Controls_Manager::COLOR, 555 'default' => '', 556 'selectors' => array( 557 '{{WRAPPER}} .elementor-price-table__button' => 'color: {{VALUE}};', 558 ), 559 'condition' => array( 560 'button_text!' => '', 561 ), 562 ) 563 ); 564 565 $this->add_group_control( 566 Group_Control_Typography::get_type(), 567 array( 568 'name' => 'button_typography', 569 'global' => array( 570 'default' => Global_Typography::TYPOGRAPHY_ACCENT, 571 ), 572 'selector' => '{{WRAPPER}} .elementor-price-table__button', 573 'condition' => array( 574 'button_text!' => '', 575 ), 576 ) 577 ); 578 579 $this->add_control( 580 'button_background_color', 581 array( 582 'label' => esc_html__( 'Background Color', 'alpha-price-table-for-elementor' ), 583 'type' => Controls_Manager::COLOR, 584 'global' => array( 585 'default' => Global_Colors::COLOR_ACCENT, 586 ), 587 'selectors' => array( 588 '{{WRAPPER}} .elementor-price-table__button' => 'background-color: {{VALUE}};', 589 ), 590 'condition' => array( 591 'button_text!' => '', 592 ), 593 'default' => '#121212', 594 ) 595 ); 596 597 $this->add_group_control( 598 Group_Control_Border::get_type(), 599 array( 600 'name' => 'button_border', 601 'selector' => '{{WRAPPER}} .elementor-price-table__button', 602 'condition' => array( 603 'button_text!' => '', 604 ), 605 'separator' => 'before', 606 ) 607 ); 608 609 $this->add_responsive_control( 610 'button_border_radius', 611 array( 612 'label' => esc_html__( 'Border Radius', 'alpha-price-table-for-elementor' ), 613 'type' => Controls_Manager::DIMENSIONS, 614 'size_units' => array( 'px', '%' ), 615 'selectors' => array( 616 '{{WRAPPER}} .elementor-price-table__button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 617 ), 618 'condition' => array( 619 'button_text!' => '', 620 ), 621 ) 622 ); 623 624 $this->add_responsive_control( 625 'button_text_padding', 626 array( 627 'label' => esc_html__( 'Text Padding', 'alpha-price-table-for-elementor' ), 628 'type' => Controls_Manager::DIMENSIONS, 629 'size_units' => array( 'px', 'em', '%' ), 630 'selectors' => array( 631 '{{WRAPPER}} .elementor-price-table__button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 632 ), 633 'condition' => array( 634 'button_text!' => '', 635 ), 636 ) 637 ); 638 639 $this->end_controls_tab(); 640 641 $this->start_controls_tab( 642 'tab_button_hover', 643 array( 644 'label' => esc_html__( 'Hover', 'alpha-price-table-for-elementor' ), 645 'condition' => array( 646 'button_text!' => '', 647 ), 648 ) 649 ); 650 651 $this->add_control( 652 'button_hover_color', 653 array( 654 'label' => esc_html__( 'Text Color', 'alpha-price-table-for-elementor' ), 655 'type' => Controls_Manager::COLOR, 656 'selectors' => array( 657 '{{WRAPPER}} .elementor-price-table__button:hover' => 'color: {{VALUE}};', 658 ), 659 'condition' => array( 660 'button_text!' => '', 661 ), 662 ) 663 ); 664 665 $this->add_control( 666 'button_background_hover_color', 667 array( 668 'label' => esc_html__( 'Background Color', 'alpha-price-table-for-elementor' ), 669 'type' => Controls_Manager::COLOR, 670 'selectors' => array( 671 '{{WRAPPER}} .elementor-price-table__button:hover' => 'background-color: {{VALUE}};', 672 ), 673 'condition' => array( 674 'button_text!' => '', 675 ), 676 ) 677 ); 678 679 $this->add_control( 680 'button_hover_border_color', 681 array( 682 'label' => esc_html__( 'Border Color', 'alpha-price-table-for-elementor' ), 683 'type' => Controls_Manager::COLOR, 684 'selectors' => array( 685 '{{WRAPPER}} .elementor-price-table__button:hover' => 'border-color: {{VALUE}};', 686 ), 687 'condition' => array( 688 'button_text!' => '', 689 ), 690 ) 691 ); 692 693 $this->add_control( 694 'button_hover_animation', 695 array( 696 'label' => esc_html__( 'Animation', 'alpha-price-table-for-elementor' ), 697 'type' => Controls_Manager::HOVER_ANIMATION, 698 'condition' => array( 699 'button_text!' => '', 700 ), 701 ) 702 ); 703 704 $this->end_controls_tab(); 705 706 $this->end_controls_tabs(); 707 708 $this->end_controls_section(); 709 710 $this->start_controls_section( 711 'alpha_pricetable', 712 array( 713 'label' => esc_html__( 'Table', 'alpha-price-table-for-elementor' ), 714 'tab' => Controls_Manager::TAB_STYLE, 715 'show_label' => false, 716 ) 717 ); 718 719 $this->add_group_control( 720 Group_Control_Border::get_type(), 721 array( 722 'name' => 'product_border', 723 'selector' => '{{WRAPPER}} .elementor-price-table', 724 'separator' => 'before', 725 ) 726 ); 727 728 $this->add_responsive_control( 729 'pricetable_border_radius', 730 array( 731 'label' => esc_html__( 'Border Radius', 'alpha-price-table-for-elementor' ), 732 'type' => Controls_Manager::DIMENSIONS, 733 'size_units' => array( 'px', '%' ), 734 'default' => array( 735 'top' => 0, 736 'right' => 0, 737 'bottom' => 0, 738 'left' => 0, 739 'unit' => 'px', 740 'isLinked' => 'true', 741 ), 742 'selectors' => array( 743 '{{WRAPPER}} .elementor-price-table' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', 744 ), 745 ) 746 ); 747 748 $this->add_control( 749 'alpha_pricetable_overflow', 750 array( 751 'label' => esc_html__( 'Overflow', 'alpha-price-table-for-elementor' ), 752 'type' => Controls_Manager::SELECT, 753 'default' => 'Hidden', 754 'options' => array( 755 'hidden' => esc_html__( 'Hidden', 'alpha-price-table-for-elementor' ), 756 'visible' => esc_html__( 'Visible', 'alpha-price-table-for-elementor' ), 757 ), 758 'selectors' => array( 759 '{{WRAPPER}}' => 'overflow: {{VALUE}}', 760 ), 761 ) 762 ); 763 764 $this->end_controls_section(); 765 } 766 767 /** 768 * Render the widget output on the frontend. 769 * 770 * @return void 771 */ 772 protected function render() { 773 $settings = $this->get_settings_for_display(); 774 775 // Escape button size. 776 $button_size = isset( $settings['button_size'] ) ? esc_attr( $settings['button_size'] ) : 'md'; 777 778 $this->add_render_attribute( 779 'button_text', 780 'class', 781 array( 782 'elementor-price-table__button', 783 'elementor-button', 784 'cta-bt', 785 'elementor-size-' . $button_size, 786 ) 787 ); 788 789 if ( ! empty( $settings['link']['url'] ) ) { 790 $this->add_link_attributes( 'button_text', $settings['link'] ); 791 } 792 793 if ( ! empty( $settings['button_hover_animation'] ) ) { 794 $this->add_render_attribute( 'button_text', 'class', 'elementor-animation-' . esc_attr( $settings['button_hover_animation'] ) ); 795 } 796 797 $this->add_render_attribute( 'heading', 'class', 'elementor-price-table__heading' ); 798 $this->add_render_attribute( 'sub_heading', 'class', 'elementor-price-table__subheading' ); 799 $this->add_render_attribute( 'footer_additional_info', 'class', 'elementor-price-table__additional_info' ); 800 801 $this->add_inline_editing_attributes( 'heading', 'none' ); 802 $this->add_inline_editing_attributes( 'sub_heading', 'none' ); 803 $this->add_inline_editing_attributes( 'footer_additional_info' ); 804 $this->add_inline_editing_attributes( 'button_text' ); 805 806 $migration_allowed = Icons_Manager::is_migration_allowed(); 807 ?> 808 809 <div class="elementor-price-table"> 810 <?php if ( $settings['heading'] || $settings['sub_heading'] ) : ?> 811 <div class="elementor-price-table__header"> 812 <?php if ( ! empty( $settings['heading'] ) ) : ?> 813 <<?php echo esc_attr( $settings['heading_tag'] ); ?> <?php echo wp_kses_post( $this->get_render_attribute_string( 'heading' ) ); ?>> 814 <?php echo wp_kses_post( $settings['heading'] ); ?> 815 </<?php echo esc_attr( $settings['heading_tag'] ); ?>> 816 <?php endif; ?> 817 818 <?php if ( ! empty( $settings['sub_heading'] ) ) : ?> 819 <span <?php echo wp_kses_post( $this->get_render_attribute_string( 'sub_heading' ) ); ?>> 820 <?php echo wp_kses_post( $settings['sub_heading'] ); ?> 821 </span> 822 <?php endif; ?> 823 </div> 824 <?php endif; ?> 825 826 <?php if ( ! empty( $settings['features_list'] ) ) : ?> 827 <ul class="elementor-price-table__features-list"> 828 <?php 829 foreach ( $settings['features_list'] as $index => $item ) : 830 $repeater_setting_key = $this->get_repeater_setting_key( 'item_text', 'features_list', $index ); 831 $this->add_inline_editing_attributes( $repeater_setting_key ); 832 833 $migrated = isset( $item['__fa4_migrated']['selected_item_icon'] ); 834 // Add old default. 835 if ( ! isset( $item['item_icon'] ) && ! $migration_allowed ) { 836 $item['item_icon'] = 'fa fa-check-circle'; 837 } 838 $is_new = ! isset( $item['item_icon'] ) && $migration_allowed; 839 840 // Sanitize the item ID for class attribute. 841 $item_id = isset( $item['_id'] ) ? sanitize_html_class( $item['_id'] ) : ''; 842 ?> 843 <li class="elementor-repeater-item-<?php echo esc_attr( $item_id ); ?>"> 844 <div class="elementor-price-table__feature-inner"> 845 <?php 846 $item_icon_position = $item['item_icon_position']; 847 $location_setting = ! empty( $item_icon_position ) ? $item_icon_position : 'before'; 848 if ( ( ! empty( $item['item_icon'] ) || ! empty( $item['selected_item_icon'] ) ) && 'before' === $location_setting ) : 849 if ( $is_new || $migrated ) : 850 Icons_Manager::render_icon( $item['selected_item_icon'], array( 'aria-hidden' => 'true' ) ); 851 else : 852 ?> 853 <i class="<?php echo esc_attr( $item['item_icon'] ); ?>" aria-hidden="true"></i> 854 <?php 855 endif; 856 endif; 857 if ( ! empty( $item['item_text'] ) ) : 858 ?> 859 <span <?php echo wp_kses_post( $this->get_render_attribute_string( $repeater_setting_key ) ); ?>> 860 <?php echo esc_html( $item['item_text'] ); ?> 861 </span> 862 <?php 863 else : 864 echo ' '; 865 endif; 866 if ( ( ! empty( $item['item_icon'] ) || ! empty( $item['selected_item_icon'] ) ) && 'after' === $location_setting ) : 867 if ( $is_new || $migrated ) : 868 Icons_Manager::render_icon( $item['selected_item_icon'], array( 'aria-hidden' => 'true' ) ); 869 else : 870 ?> 871 <i class="<?php echo esc_attr( $item['item_icon'] ); ?>" aria-hidden="true"></i> 872 <?php 873 endif; 874 endif; 875 ?> 876 </div> 877 </li> 878 <?php endforeach; ?> 879 </ul> 880 <?php endif; ?> 881 882 <?php if ( ! empty( $settings['button_text'] ) || ! empty( $settings['footer_additional_info'] ) ) : ?> 883 <div class="elementor-price-table__footer"> 884 <?php if ( ! empty( $settings['button_text'] ) ) : ?> 885 <a <?php echo wp_kses_post( $this->get_render_attribute_string( 'button_text' ) ); ?>> 886 <?php echo esc_html( $settings['button_text'] ); ?> 887 </a> 888 <?php endif; ?> 889 890 <?php if ( ! empty( $settings['footer_additional_info'] ) ) : ?> 891 <div <?php echo wp_kses_post( $this->get_render_attribute_string( 'footer_additional_info' ) ); ?>> 892 <?php echo wp_kses_post( $settings['footer_additional_info'] ); ?> 893 </div> 894 <?php endif; ?> 895 </div> 896 <?php endif; ?> 897 </div> 898 899 <?php 900 } 897 901 } -
alpha-price-table-for-elementor/trunk/includes/class-alpha-price-table.php
r3209593 r3276978 1 1 <?php 2 /** 3 * Alpha Price Table. 4 * 5 * @package AlphaPriceTable 6 * */ 2 7 3 8 namespace Elementor_Alpha_Price_Table_Addon; 4 9 5 if ( ! defined('ABSPATH')) {6 exit; // Exit if accessed directly.10 if ( ! defined( 'ABSPATH' ) ) { 11 exit; // Exit if accessed directly. 7 12 } 8 13 … … 14 19 * @since 1.0.0 15 20 */ 16 final class Alpha_Price_Table_For_Elementor 17 { 18 19 /** 20 * Minimum Elementor Version 21 * 22 * @since 1.0.0 23 * @var string Minimum Elementor version required to run the addon. 24 */ 25 const MINIMUM_ELEMENTOR_VERSION = '3.21.0'; 26 27 /** 28 * Minimum PHP Version 29 * 30 * @since 1.0.0 31 * @var string Minimum PHP version required to run the addon. 32 */ 33 const MINIMUM_PHP_VERSION = '7.4'; 34 35 /** 36 * Instance 37 * 38 * @since 1.0.0 39 * @access private 40 * @static 41 * @var Alpha_Price_Table_For_Elementor|null The single instance of the class. 42 */ 43 private static ?Alpha_Price_Table_For_Elementor $_instance = null; 44 45 /** 46 * Ensures only one instance of the class is loaded or can be loaded. 47 * 48 * @since 1.0.0 49 * @access public 50 * @static 51 * @return Alpha_Price_Table_For_Elementor An instance of the class. 52 */ 53 public static function instance(): Alpha_Price_Table_For_Elementor 54 { 55 if (is_null(self::$_instance)) { 56 self::$_instance = new self(); 57 } 58 return self::$_instance; 59 } 60 61 /** 62 * Constructor 63 * 64 * Perform compatibility checks and initialize functionality if all checks pass. 65 * 66 * @since 1.0.0 67 * @access private 68 */ 69 private function __construct() 70 { 71 if ($this->is_compatible()) { 72 add_action('elementor/init', [$this, 'init']); 73 } 74 } 75 76 /** 77 * Compatibility Checks 78 * 79 * Verifies the site meets the addon's requirements. 80 * 81 * @since 1.0.0 82 * @access private 83 * @return bool True if compatible, false otherwise. 84 */ 85 private function is_compatible(): bool 86 { 87 // Check for required Elementor version. 88 if (!defined('ELEMENTOR_VERSION') || !version_compare(ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=')) { 89 add_action('admin_notices', [$this, 'admin_notice_minimum_elementor_version']); 90 return false; 91 } 92 93 // Check for required PHP version. 94 if (version_compare(PHP_VERSION, self::MINIMUM_PHP_VERSION, '<')) { 95 add_action('admin_notices', [$this, 'admin_notice_minimum_php_version']); 96 return false; 97 } 98 99 return true; 100 } 101 102 /** 103 * Initialize the plugin. 104 * 105 * Loads translations, enqueues styles, and registers widgets. 106 * 107 * @since 1.0.0 108 * @access public 109 */ 110 public function init(): void 111 { 112 add_action('elementor/frontend/after_enqueue_styles', [$this, 'frontend_styles']); 113 add_action('elementor/widgets/register', [$this, 'register_widgets']); 114 } 115 116 /** 117 * Displays an admin notice if the Elementor version is below the required minimum. 118 * 119 * @since 1.0.0 120 * @access public 121 */ 122 public function admin_notice_minimum_elementor_version(): void 123 { 124 if (!current_user_can('update_plugins')) { 125 return; 126 } 127 128 $upgrade_url = wp_nonce_url(self_admin_url('update-core.php'), 'upgrade-core'); 129 130 $message = sprintf( 131 /* translators: 1: Plugin name, 2: Required Elementor version */ 132 __('%1$s requires Elementor version %2$s or greater.', 'alpha-price-table-for-elementor'), 133 '<strong>' . __('Alpha Price Table for Elementor', 'alpha-price-table-for-elementor') . '</strong>', 134 self::MINIMUM_ELEMENTOR_VERSION 135 ); 136 137 $button = sprintf( 138 '<a href="%s" class="button-primary">%s</a>', 139 esc_url($upgrade_url), 140 esc_html__('Update Elementor', 'alpha-price-table-for-elementor') 141 ); 142 143 $allowed_html = [ 144 'strong' => [], 145 'p' => [], 146 'a' => [ 147 'href' => [], 148 'class' => [], 149 ], 150 'div' => [ 151 'class' => [], 152 ], 153 ]; 154 155 printf( 156 '<div class="notice notice-warning is-dismissible">%s</div>', 157 wp_kses('<p>' . $message . '</p><p>' . $button . '</p>', $allowed_html) 158 ); 159 } 160 161 162 /** 163 * Displays an admin notice if the PHP version is below the required minimum. 164 * 165 * @since 1.0.0 166 * @access public 167 */ 168 public function admin_notice_minimum_php_version(): void 169 { 170 if (!current_user_can('update_core')) { 171 return; 172 } 173 174 $message = sprintf( 175 /* translators: 1: Plugin name, 2: Required PHP version */ 176 __('%1$s requires PHP version %2$s or greater.', 'alpha-price-table-for-elementor'), 177 '<strong>' . __('Alpha Price Table for Elementor', 'alpha-price-table-for-elementor') . '</strong>', 178 self::MINIMUM_PHP_VERSION 179 ); 180 181 $allowed_html = [ 182 'strong' => [], 183 'p' => [], 184 'div' => [ 185 'class' => [], 186 ], 187 ]; 188 189 printf( 190 '<div class="notice notice-warning is-dismissible">%s</div>', 191 wp_kses('<p>' . $message . '</p>', $allowed_html) 192 ); 193 } 194 195 196 /** 197 * Enqueues the necessary CSS files for the widget. 198 * 199 * @since 1.0.0 200 * @access public 201 */ 202 public function frontend_styles(): void 203 { 204 wp_enqueue_style( 205 'alpha-pricetable-widget', 206 ALPHAPRICETABLE_ASSETS_URL . 'css/alpha-pricetable-widget.css', 207 [], 208 ALPHAPRICETABLE_VERSION 209 ); 210 } 211 212 /** 213 * Registers the widget with Elementor. 214 * 215 * @since 1.0.0 216 * @access public 217 * @param \Elementor\Widgets_Manager $widgets_manager Elementor widgets manager. 218 */ 219 public function register_widgets(\Elementor\Widgets_Manager $widgets_manager): void 220 { 221 include_once ALPHAPRICETABLE_INCLUDES_PATH . 'class-alpha-price-table-widget.php'; 222 $widgets_manager->register(new Alpha_Price_Table_Widget()); 223 } 21 final class Alpha_Price_Table_For_Elementor { 22 23 24 /** 25 * Minimum Elementor Version 26 * 27 * @since 1.0.0 28 * @var string Minimum Elementor version required to run the addon. 29 */ 30 const MINIMUM_ELEMENTOR_VERSION = '3.21.0'; 31 32 /** 33 * Minimum PHP Version 34 * 35 * @since 1.0.0 36 * @var string Minimum PHP version required to run the addon. 37 */ 38 const MINIMUM_PHP_VERSION = '7.4'; 39 40 /** 41 * Instance 42 * 43 * @since 1.0.0 44 * @access private 45 * @static 46 * @var Alpha_Price_Table_For_Elementor|null The single instance of the class. 47 */ 48 private static ?Alpha_Price_Table_For_Elementor $_instance = null; 49 50 /** 51 * Ensures only one instance of the class is loaded or can be loaded. 52 * 53 * @since 1.0.0 54 * @access public 55 * @static 56 * @return Alpha_Price_Table_For_Elementor An instance of the class. 57 */ 58 public static function instance(): Alpha_Price_Table_For_Elementor { 59 if ( is_null( self::$_instance ) ) { 60 self::$_instance = new self(); 61 } 62 return self::$_instance; 63 } 64 65 /** 66 * Constructor 67 * 68 * Perform compatibility checks and initialize functionality if all checks pass. 69 * 70 * @since 1.0.0 71 * @access private 72 */ 73 private function __construct() { 74 if ( $this->is_compatible() ) { 75 add_action( 'elementor/init', array( $this, 'init' ) ); 76 } 77 } 78 79 /** 80 * Compatibility Checks 81 * 82 * Verifies the site meets the addon's requirements. 83 * 84 * @since 1.0.0 85 * @access private 86 * @return bool True if compatible, false otherwise. 87 */ 88 private function is_compatible(): bool { 89 // Check for required Elementor version. 90 if ( ! defined( 'ELEMENTOR_VERSION' ) || ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) { 91 add_action( 'admin_notices', array( $this, 'admin_notice_minimum_elementor_version' ) ); 92 return false; 93 } 94 95 // Check for required PHP version. 96 if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) { 97 add_action( 'admin_notices', array( $this, 'admin_notice_minimum_php_version' ) ); 98 return false; 99 } 100 101 return true; 102 } 103 104 /** 105 * Initialize the plugin. 106 * 107 * Loads translations, enqueues styles, and registers widgets. 108 * 109 * @since 1.0.0 110 * @access public 111 */ 112 public function init(): void { 113 add_action( 'elementor/frontend/after_enqueue_styles', array( $this, 'frontend_styles' ) ); 114 add_action( 'elementor/widgets/register', array( $this, 'register_widgets' ) ); 115 } 116 117 /** 118 * Displays an admin notice if the Elementor version is below the required minimum. 119 * 120 * @since 1.0.0 121 * @access public 122 */ 123 public function admin_notice_minimum_elementor_version(): void { 124 if ( ! current_user_can( 'update_plugins' ) ) { 125 return; 126 } 127 128 $upgrade_url = wp_nonce_url( self_admin_url( 'update-core.php' ), 'upgrade-core' ); 129 130 $message = sprintf( 131 /* translators: 1: Plugin name, 2: Required Elementor version */ 132 __( '%1$s requires Elementor version %2$s or greater.', 'alpha-price-table-for-elementor' ), 133 '<strong>' . __( 'Alpha Price Table for Elementor', 'alpha-price-table-for-elementor' ) . '</strong>', 134 self::MINIMUM_ELEMENTOR_VERSION 135 ); 136 137 $button = sprintf( 138 '<a href="%s" class="button-primary">%s</a>', 139 esc_url( $upgrade_url ), 140 esc_html__( 'Update Elementor', 'alpha-price-table-for-elementor' ) 141 ); 142 143 $allowed_html = array( 144 'strong' => array(), 145 'p' => array(), 146 'a' => array( 147 'href' => array(), 148 'class' => array(), 149 ), 150 'div' => array( 151 'class' => array(), 152 ), 153 ); 154 155 printf( 156 '<div class="notice notice-warning is-dismissible">%s</div>', 157 wp_kses( '<p>' . $message . '</p><p>' . $button . '</p>', $allowed_html ) 158 ); 159 } 160 161 162 /** 163 * Displays an admin notice if the PHP version is below the required minimum. 164 * 165 * @since 1.0.0 166 * @access public 167 */ 168 public function admin_notice_minimum_php_version(): void { 169 if ( ! current_user_can( 'update_core' ) ) { 170 return; 171 } 172 173 $message = sprintf( 174 /* translators: 1: Plugin name, 2: Required PHP version */ 175 __( '%1$s requires PHP version %2$s or greater.', 'alpha-price-table-for-elementor' ), 176 '<strong>' . __( 'Alpha Price Table for Elementor', 'alpha-price-table-for-elementor' ) . '</strong>', 177 self::MINIMUM_PHP_VERSION 178 ); 179 180 $allowed_html = array( 181 'strong' => array(), 182 'p' => array(), 183 'div' => array( 184 'class' => array(), 185 ), 186 ); 187 188 printf( 189 '<div class="notice notice-warning is-dismissible">%s</div>', 190 wp_kses( '<p>' . $message . '</p>', $allowed_html ) 191 ); 192 } 193 194 195 /** 196 * Enqueues the necessary CSS files for the widget. 197 * 198 * @since 1.0.0 199 * @access public 200 */ 201 public function frontend_styles(): void { 202 wp_enqueue_style( 203 'alpha-pricetable-widget', 204 ALPHAPRICETABLE_ASSETS_URL . 'css/alpha-pricetable-widget.css', 205 array(), 206 ALPHAPRICETABLE_VERSION 207 ); 208 } 209 210 /** 211 * Registers the widget with Elementor. 212 * 213 * @since 1.0.0 214 * @access public 215 * @param \Elementor\Widgets_Manager $widgets_manager Elementor widgets manager. 216 */ 217 public function register_widgets( \Elementor\Widgets_Manager $widgets_manager ): void { 218 include_once ALPHAPRICETABLE_INCLUDES_PATH . 'class-alpha-price-table-widget.php'; 219 $widgets_manager->register( new Alpha_Price_Table_Widget() ); 220 } 224 221 } -
alpha-price-table-for-elementor/trunk/index.php
r3209593 r3276978 1 1 <?php 2 2 // Prevent direct access to this file. 3 if ( !defined('ABSPATH')) {4 exit; // Exit if accessed directly.3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; // Exit if accessed directly. 5 5 } 6 6 -
alpha-price-table-for-elementor/trunk/languages/alpha-price-table-for-elementor.pot
r3190429 r3276978 1 # Copyright (C) 202 4Ali Ali1 # Copyright (C) 2025 Ali Ali 2 2 # This file is distributed under the GPLv3. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Alpha Price Table For Elementor 1. 0.7\n"5 "Project-Id-Version: Alpha Price Table For Elementor 1.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/alpha-price-table-for-elementor\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 202 4-11-15T18:52:14+00:00\n"12 "POT-Creation-Date: 2025-04-17T10:50:32+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.11.0\n" … … 17 17 #. Plugin Name of the plugin 18 18 #: alpha-price-table-for-elementor.php 19 #: alpha-price-table-for-elementor.php:10 219 #: alpha-price-table-for-elementor.php:104 20 20 msgid "Alpha Price Table For Elementor" 21 21 msgstr "" … … 41 41 msgstr "" 42 42 43 #: alpha-price-table-for-elementor.php: 8843 #: alpha-price-table-for-elementor.php:90 44 44 msgid "Activate Elementor Now" 45 45 msgstr "" 46 46 47 47 #. translators: %1$s: Plugin name, %2$s: Action link 48 #: alpha-price-table-for-elementor.php:9 048 #: alpha-price-table-for-elementor.php:92 49 49 msgid "%1$s requires Elementor to be activated. %2$s" 50 50 msgstr "" 51 51 52 #: alpha-price-table-for-elementor.php:9 652 #: alpha-price-table-for-elementor.php:98 53 53 msgid "Install Elementor Now" 54 54 msgstr "" 55 55 56 56 #. translators: %1$s: Plugin name, %2$s: Action link 57 #: alpha-price-table-for-elementor.php: 9857 #: alpha-price-table-for-elementor.php:100 58 58 msgid "%1$s requires Elementor to be installed and activated. %2$s" 59 59 msgstr "" 60 60 61 #: includes/class-alpha-price-table-widget.php:4 461 #: includes/class-alpha-price-table-widget.php:47 62 62 msgid "Alpha Price Table" 63 63 msgstr "" … … 74 74 75 75 #: includes/class-alpha-price-table-widget.php:99 76 #: includes/class-alpha-price-table-widget.php:32 376 #: includes/class-alpha-price-table-widget.php:322 77 77 msgid "Title" 78 78 msgstr "" … … 111 111 112 112 #: includes/class-alpha-price-table-widget.php:162 113 #: includes/class-alpha-price-table-widget.php:38 3113 #: includes/class-alpha-price-table-widget.php:386 114 114 msgid "Features" 115 115 msgstr "" … … 156 156 157 157 #: includes/class-alpha-price-table-widget.php:253 158 #: includes/class-alpha-price-table-widget.php:47 4158 #: includes/class-alpha-price-table-widget.php:478 159 159 msgid "Footer" 160 160 msgstr "" … … 177 177 178 178 #: includes/class-alpha-price-table-widget.php:295 179 #: includes/class-alpha-price-table-widget.php:39 2180 #: includes/class-alpha-price-table-widget.php:48 3181 #: includes/class-alpha-price-table-widget.php:5 76182 #: includes/class-alpha-price-table-widget.php:66 3179 #: includes/class-alpha-price-table-widget.php:395 180 #: includes/class-alpha-price-table-widget.php:487 181 #: includes/class-alpha-price-table-widget.php:582 182 #: includes/class-alpha-price-table-widget.php:668 183 183 msgid "Background Color" 184 184 msgstr "" 185 185 186 #: includes/class-alpha-price-table-widget.php:31 1187 #: includes/class-alpha-price-table-widget.php:40 4188 #: includes/class-alpha-price-table-widget.php:49 4186 #: includes/class-alpha-price-table-widget.php:310 187 #: includes/class-alpha-price-table-widget.php:407 188 #: includes/class-alpha-price-table-widget.php:498 189 189 msgid "Padding" 190 190 msgstr "" 191 191 192 #: includes/class-alpha-price-table-widget.php:33 2193 #: includes/class-alpha-price-table-widget.php:36 1194 #: includes/class-alpha-price-table-widget.php:43 0192 #: includes/class-alpha-price-table-widget.php:331 193 #: includes/class-alpha-price-table-widget.php:362 194 #: includes/class-alpha-price-table-widget.php:433 195 195 msgid "Color" 196 196 msgstr "" 197 197 198 #: includes/class-alpha-price-table-widget.php:35 2198 #: includes/class-alpha-price-table-widget.php:353 199 199 msgid "Sub Title" 200 200 msgstr "" 201 201 202 #: includes/class-alpha-price-table-widget.php:45 5202 #: includes/class-alpha-price-table-widget.php:459 203 203 msgid "Width" 204 204 msgstr "" 205 205 206 #: includes/class-alpha-price-table-widget.php:5 06206 #: includes/class-alpha-price-table-widget.php:510 207 207 msgid "Button" 208 208 msgstr "" 209 209 210 #: includes/class-alpha-price-table-widget.php:5 18210 #: includes/class-alpha-price-table-widget.php:522 211 211 msgid "Size" 212 212 msgstr "" 213 213 214 #: includes/class-alpha-price-table-widget.php:52 2214 #: includes/class-alpha-price-table-widget.php:526 215 215 msgid "Extra Small" 216 216 msgstr "" 217 217 218 #: includes/class-alpha-price-table-widget.php:52 3218 #: includes/class-alpha-price-table-widget.php:527 219 219 msgid "Small" 220 220 msgstr "" 221 221 222 #: includes/class-alpha-price-table-widget.php:52 4222 #: includes/class-alpha-price-table-widget.php:528 223 223 msgid "Medium" 224 224 msgstr "" 225 225 226 #: includes/class-alpha-price-table-widget.php:52 5226 #: includes/class-alpha-price-table-widget.php:529 227 227 msgid "Large" 228 228 msgstr "" 229 229 230 #: includes/class-alpha-price-table-widget.php:5 26230 #: includes/class-alpha-price-table-widget.php:530 231 231 msgid "Extra Large" 232 232 msgstr "" 233 233 234 #: includes/class-alpha-price-table-widget.php:5 39234 #: includes/class-alpha-price-table-widget.php:543 235 235 msgid "Normal" 236 236 msgstr "" 237 237 238 #: includes/class-alpha-price-table-widget.php:5 49239 #: includes/class-alpha-price-table-widget.php:6 49238 #: includes/class-alpha-price-table-widget.php:553 239 #: includes/class-alpha-price-table-widget.php:654 240 240 msgid "Text Color" 241 241 msgstr "" 242 242 243 #: includes/class-alpha-price-table-widget.php:6 07244 #: includes/class-alpha-price-table-widget.php:7 26243 #: includes/class-alpha-price-table-widget.php:612 244 #: includes/class-alpha-price-table-widget.php:731 245 245 msgid "Border Radius" 246 246 msgstr "" 247 247 248 #: includes/class-alpha-price-table-widget.php:62 2248 #: includes/class-alpha-price-table-widget.php:627 249 249 msgid "Text Padding" 250 250 msgstr "" 251 251 252 #: includes/class-alpha-price-table-widget.php:6 39252 #: includes/class-alpha-price-table-widget.php:644 253 253 msgid "Hover" 254 254 msgstr "" 255 255 256 #: includes/class-alpha-price-table-widget.php:6 77256 #: includes/class-alpha-price-table-widget.php:682 257 257 msgid "Border Color" 258 258 msgstr "" 259 259 260 #: includes/class-alpha-price-table-widget.php:69 1260 #: includes/class-alpha-price-table-widget.php:696 261 261 msgid "Animation" 262 262 msgstr "" 263 263 264 #: includes/class-alpha-price-table-widget.php:7 08264 #: includes/class-alpha-price-table-widget.php:713 265 265 msgid "Table" 266 266 msgstr "" 267 267 268 #: includes/class-alpha-price-table-widget.php:7 46268 #: includes/class-alpha-price-table-widget.php:751 269 269 msgid "Overflow" 270 270 msgstr "" 271 271 272 #: includes/class-alpha-price-table-widget.php:75 0272 #: includes/class-alpha-price-table-widget.php:755 273 273 msgid "Hidden" 274 274 msgstr "" 275 275 276 #: includes/class-alpha-price-table-widget.php:75 1276 #: includes/class-alpha-price-table-widget.php:756 277 277 msgid "Visible" 278 278 msgstr "" … … 284 284 285 285 #: includes/class-alpha-price-table.php:133 286 #: includes/class-alpha-price-table.php:1 53286 #: includes/class-alpha-price-table.php:176 287 287 msgid "Alpha Price Table for Elementor" 288 288 msgstr "" 289 289 290 #: includes/class-alpha-price-table.php:1 35290 #: includes/class-alpha-price-table.php:140 291 291 msgid "Update Elementor" 292 292 msgstr "" 293 293 294 294 #. translators: 1: Plugin name, 2: Required PHP version 295 #: includes/class-alpha-price-table.php:1 52295 #: includes/class-alpha-price-table.php:175 296 296 msgid "%1$s requires PHP version %2$s or greater." 297 297 msgstr "" -
alpha-price-table-for-elementor/trunk/readme.txt
r3209593 r3276978 4 4 Tags: price-table, price, elementor, comparison, table 5 5 Requires at least: 6.0 6 Tested up to: 6. 76 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1. 0.88 Stable tag: 1.1 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 54 54 == Upgrade Notice == 55 55 56 = 1. 0.8=57 - Compatibility for the updated Elementor colors and typography schema.56 = 1.1 = 57 - Compatibility for WP 6.8
Note: See TracChangeset
for help on using the changeset viewer.