| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\Promotions\AdminMenuItems; |
| 4 |
|
| 5 |
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; |
| 6 |
use Elementor\Modules\Promotions\AdminMenuItems\Interfaces\Promotion_Menu_Item; |
| 7 |
use Elementor\Settings; |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
|
| 13 |
abstract class Base_Promotion_Item implements Promotion_Menu_Item { |
| 14 |
|
| 15 |
public function get_name() { |
| 16 |
return 'base_promotion'; |
| 17 |
} |
| 18 |
|
| 19 |
public function is_visible() { |
| 20 |
return true; |
| 21 |
} |
| 22 |
|
| 23 |
public function get_parent_slug() { |
| 24 |
return Settings::PAGE_ID; |
| 25 |
} |
| 26 |
|
| 27 |
public function get_capability() { |
| 28 |
return 'manage_options'; |
| 29 |
} |
| 30 |
|
| 31 |
public function get_cta_text() { |
| 32 |
return esc_html__( 'Upgrade Now', 'elementor' ); |
| 33 |
} |
| 34 |
|
| 35 |
public function get_image_url() { |
| 36 |
return ELEMENTOR_ASSETS_URL . 'images/go-pro-wp-dashboard.svg'; |
| 37 |
} |
| 38 |
|
| 39 |
public function get_promotion_description() { |
| 40 |
return ''; |
| 41 |
} |
| 42 |
|
| 43 |
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 |
?> |
| 57 |
<div class="wrap"> |
| 58 |
<div class="elementor-blank_state"> |
| 59 |
<img src="<?php echo esc_url( $config['image'] ?? $this->get_image_url() ); ?>" loading="lazy" /> |
| 60 |
|
| 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() ); ?> |
| 67 |
</a> |
| 68 |
</div> |
| 69 |
</div> |
| 70 |
<?php |
| 71 |
} |
| 72 |
} |
| 73 |
|