← All changes
|
modules/promotions/admin-menu-items/base-promotion-item.php
+11
-7
4.3.2
→
3.20.0-dev3
View file →
| @@ -1,31 +1,31 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\Promotions\AdminMenuItems; |
| 4 | 4 | |
| 5 | -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; | |
| 5 | +use Elementor\Core\Utils\Promotions\Validate_Promotion; | |
| 6 | 6 | use Elementor\Modules\Promotions\AdminMenuItems\Interfaces\Promotion_Menu_Item; |
| 7 | 7 | use Elementor\Settings; |
| 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 { | |
| 15 | + public function get_name() { | |
| 16 | 16 | return 'base_promotion'; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function is_visible(): bool { | |
| 19 | + public function is_visible() { | |
| 20 | 20 | return true; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function get_parent_slug(): string { | |
| 23 | + public function get_parent_slug() { | |
| 24 | 24 | return Settings::PAGE_ID; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function get_capability(): string { | |
| 27 | + public function get_capability() { | |
| 28 | 28 | return 'manage_options'; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function get_cta_text() { |
| @@ -48,9 +48,13 @@ | ||
| 48 | 48 | 'upgrade_text' => $this->get_cta_text(), |
| 49 | 49 | 'upgrade_url' => $this->get_cta_url(), |
| 50 | 50 | ]; |
| 51 | 51 | |
| 52 | - $config = Filtered_Promotions_Manager::get_filtered_promotion_data( $config, 'elementor/' . $this->get_name() . '/custom_promotion', 'upgrade_url' ); | |
| 52 | + $config = apply_filters( 'elementor/' . $this->get_name() . '/custom_promotion', $config ); | |
| 53 | + | |
| 54 | + if ( isset( $config['upgrade_url'] ) && false === Validate_Promotion::domain_is_on_elementor_dot_com( $config['upgrade_url'] ) ) { | |
| 55 | + $config['upgrade_url'] = esc_url( $this->get_cta_url() ); | |
| 56 | + } | |
| 53 | 57 | |
| 54 | 58 | $description = $config['description'] ?? $this->get_promotion_description() ?? ''; |
| 55 | 59 | |
| 56 | 60 | ?> |