← All changes
|
modules/promotions/admin-menu-items/base-promotion-item.php
+12
-32
4.3.1
→
3.17.2
View file →
| @@ -1,31 +1,27 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\Promotions\AdminMenuItems; |
| 4 | 4 | |
| 5 | -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; | |
| 6 | 5 | use Elementor\Modules\Promotions\AdminMenuItems\Interfaces\Promotion_Menu_Item; |
| 7 | 6 | use Elementor\Settings; |
| 7 | +use Elementor\Utils; | |
| 8 | 8 | |
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | - exit; // Exit if accessed directly. | |
| 10 | + exit; // Exit if accessed directly | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | abstract class Base_Promotion_Item implements Promotion_Menu_Item { |
| 14 | 14 | |
| 15 | - public function get_name(): string { | |
| 16 | - return 'base_promotion'; | |
| 17 | - } | |
| 18 | - | |
| 19 | - public function is_visible(): bool { | |
| 15 | + public function is_visible() { | |
| 20 | 16 | return true; |
| 21 | 17 | } |
| 22 | 18 | |
| 23 | - public function get_parent_slug(): string { | |
| 19 | + public function get_parent_slug() { | |
| 24 | 20 | return Settings::PAGE_ID; |
| 25 | 21 | } |
| 26 | 22 | |
| 27 | - public function get_capability(): string { | |
| 23 | + public function get_capability() { | |
| 28 | 24 | return 'manage_options'; |
| 29 | 25 | } |
| 30 | 26 | |
| 31 | 27 | public function get_cta_text() { |
| @@ -35,36 +31,20 @@ | ||
| 35 | 31 | public function get_image_url() { |
| 36 | 32 | return ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg'; |
| 37 | 33 | } |
| 38 | 34 | |
| 39 | - public function get_promotion_description() { | |
| 40 | - return ''; | |
| 41 | - } | |
| 42 | - | |
| 43 | 35 | public function render() { |
| 44 | - $config = [ | |
| 45 | - 'title' => $this->get_promotion_title(), | |
| 46 | - 'description' => $this->get_promotion_description(), | |
| 47 | - 'image' => $this->get_image_url(), | |
| 48 | - 'upgrade_text' => $this->get_cta_text(), | |
| 49 | - 'upgrade_url' => $this->get_cta_url(), | |
| 50 | - ]; | |
| 51 | - | |
| 52 | - $config = Filtered_Promotions_Manager::get_filtered_promotion_data( $config, 'elementor/' . $this->get_name() . '/custom_promotion', 'upgrade_url' ); | |
| 53 | - | |
| 54 | - $description = $config['description'] ?? $this->get_promotion_description() ?? ''; | |
| 55 | - | |
| 56 | 36 | ?> |
| 57 | 37 | <div class="wrap"> |
| 58 | 38 | <div class="elementor-blank_state"> |
| 59 | - <img src="<?php echo esc_url( $config['image'] ?? $this->get_image_url() ); ?>" loading="lazy" /> | |
| 39 | + <img src="<?php echo esc_url( $this->get_image_url() ); ?>" loading="lazy" /> | |
| 60 | 40 | |
| 61 | - <h3><?php echo esc_html( $config['title'] ?? $this->get_promotion_title() ); ?></h3> | |
| 62 | - <?php if ( $description ) : ?> | |
| 63 | - <p><?php echo esc_html( $description ); ?></p> | |
| 64 | - <?php endif; ?> | |
| 65 | - <a class="elementor-button go-pro" href="<?php echo esc_url( $config['upgrade_url'] ?? $this->get_cta_url() ); ?>"> | |
| 66 | - <?php echo esc_html( $config['upgrade_text'] ?? $this->get_cta_text() ); ?> | |
| 41 | + <h3><?php Utils::print_unescaped_internal_string( $this->get_promotion_title() ); ?></h3> | |
| 42 | + | |
| 43 | + <p><?php $this->render_promotion_description(); ?></p> | |
| 44 | + | |
| 45 | + <a class="elementor-button go-pro" href="<?php echo esc_url( $this->get_cta_url() ); ?>"> | |
| 46 | + <?php Utils::print_unescaped_internal_string( $this->get_cta_text() ); ?> | |
| 67 | 47 | </a> |
| 68 | 48 | </div> |
| 69 | 49 | </div> |
| 70 | 50 | <?php |