| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\Promotions\AdminMenuItems; |
| 4 |
|
| 5 |
use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page; |
| 6 |
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; |
| 7 |
use Elementor\Settings; |
| 8 |
use Elementor\Utils; |
| 9 |
|
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
exit; // Exit if accessed directly. |
| 12 |
} |
| 13 |
|
| 14 |
class Go_Pro_Promotion_Item implements Admin_Menu_Item_With_Page { |
| 15 |
const URL = 'https://go.elementor.com/pro-admin-menu/'; |
| 16 |
|
| 17 |
public function get_name() { |
| 18 |
return 'admin_menu_promo'; |
| 19 |
} |
| 20 |
|
| 21 |
public function is_visible() { |
| 22 |
return true; |
| 23 |
} |
| 24 |
|
| 25 |
public function get_parent_slug() { |
| 26 |
return Settings::PAGE_ID; |
| 27 |
} |
| 28 |
|
| 29 |
public function get_label() { |
| 30 |
$upgrade_text = esc_html__( 'Upgrade', 'elementor' ); |
| 31 |
|
| 32 |
if ( Utils::is_sale_time() ) { |
| 33 |
$upgrade_text = esc_html__( 'Upgrade Sale Now', 'elementor' ); |
| 34 |
} |
| 35 |
|
| 36 |
return apply_filters( 'elementor/admin_menu/custom_promotion', [ 'upgrade_text' => $upgrade_text ] )['upgrade_text'] ?? $upgrade_text; |
| 37 |
} |
| 38 |
|
| 39 |
public function get_page_title() { |
| 40 |
return ''; |
| 41 |
} |
| 42 |
|
| 43 |
public function get_capability() { |
| 44 |
return 'manage_options'; |
| 45 |
} |
| 46 |
|
| 47 |
public static function get_url() { |
| 48 |
$url = self::URL; |
| 49 |
$filtered_url = apply_filters( 'elementor/admin_menu/custom_promotion', [ 'upgrade_url' => $url ] )['upgrade_url'] ?? ''; |
| 50 |
$promotion_data = Filtered_Promotions_Manager::get_filtered_promotion_data( [ 'upgrade_url' => $filtered_url ], 'elementor/admin_menu/custom_promotion', 'upgrade_url' ); |
| 51 |
return $promotion_data ['upgrade_url']; |
| 52 |
} |
| 53 |
|
| 54 |
public function render() { |
| 55 |
// Redirects from the module on `admin_init`. |
| 56 |
die; |
| 57 |
} |
| 58 |
} |
| 59 |
|