| @@ -1,14 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Modules\ElementManager; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; | |
| 5 | 4 | use Elementor\Modules\Usage\Module as Usage_Module; |
| 6 | 5 | use Elementor\Api; |
| 7 | 6 | use Elementor\Plugin; |
| 8 | 7 | use Elementor\User; |
| 9 | 8 | use Elementor\Utils; |
| 10 | -use Elementor\Core\Utils\Promotions\Validate_Promotion; | |
| 11 | 9 | |
| 12 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | 11 | exit; // Exit if accessed directly. |
| 14 | 12 | } |
| @@ -14,14 +12,8 @@ | ||
| 14 | 12 | } |
| 15 | 13 | |
| 16 | 14 | class Ajax { |
| 17 | 15 | |
| 18 | - const ELEMENT_MANAGER_PROMOTION_URL = 'https://go.elementor.com/go-pro-element-manager/'; | |
| 19 | - | |
| 20 | - const FREE_TO_PRO_PERMISSIONS_PROMOTION_URL = 'https://go.elementor.com/go-pro-element-manager-permissions/'; | |
| 21 | - | |
| 22 | - const PRO_TO_ADVANCED_PERMISSIONS_PROMOTION_URL = 'https://go.elementor.com/go-pro-advanced-element-manager-permissions/'; | |
| 23 | - | |
| 24 | 16 | public function register_endpoints() { |
| 25 | 17 | add_action( 'wp_ajax_elementor_element_manager_get_admin_app_data', [ $this, 'ajax_get_admin_page_data' ] ); |
| 26 | 18 | add_action( 'wp_ajax_elementor_element_manager_save_disabled_elements', [ $this, 'ajax_save_disabled_elements' ] ); |
| 27 | 19 | add_action( 'wp_ajax_elementor_element_manager_get_widgets_usage', [ $this, 'ajax_get_widgets_usage' ] ); |
| @@ -63,35 +55,9 @@ | ||
| 63 | 55 | 'plugins' => $plugins, |
| 64 | 56 | 'notice_data' => [ |
| 65 | 57 | 'notice_id' => $notice_id, |
| 66 | 58 | 'is_viewed' => User::is_user_notice_viewed( $notice_id ), |
| 67 | - 'nonce' => wp_create_nonce( 'elementor_set_admin_notice_viewed' ), | |
| 68 | 59 | ], |
| 69 | - 'promotion_data' => [ | |
| 70 | - 'manager_permissions' => [ | |
| 71 | - 'pro' => $this->get_element_manager_promotion( | |
| 72 | - [ | |
| 73 | - 'text' => esc_html__( 'Upgrade Now', 'elementor' ), | |
| 74 | - 'url' => self::FREE_TO_PRO_PERMISSIONS_PROMOTION_URL, | |
| 75 | - ], | |
| 76 | - 'pro_permissions' | |
| 77 | - ), | |
| 78 | - 'advanced' => $this->get_element_manager_promotion( | |
| 79 | - [ | |
| 80 | - 'text' => esc_html__( 'Upgrade Now', 'elementor' ), | |
| 81 | - 'url' => self::PRO_TO_ADVANCED_PERMISSIONS_PROMOTION_URL, | |
| 82 | - ], | |
| 83 | - 'advanced_permissions' | |
| 84 | - ), | |
| 85 | - ], | |
| 86 | - 'element_manager' => $this->get_element_manager_promotion( | |
| 87 | - [ | |
| 88 | - 'text' => esc_html__( 'Upgrade Now', 'elementor' ), | |
| 89 | - 'url' => self::ELEMENT_MANAGER_PROMOTION_URL, | |
| 90 | - ], | |
| 91 | - 'element_manager' | |
| 92 | - ), | |
| 93 | - ], | |
| 94 | 60 | ]; |
| 95 | 61 | |
| 96 | 62 | if ( ! Utils::has_pro() ) { |
| 97 | 63 | $data['promotion_widgets'] = Api::get_promotion_widgets(); |
| @@ -101,13 +67,8 @@ | ||
| 101 | 67 | |
| 102 | 68 | wp_send_json_success( $data ); |
| 103 | 69 | } |
| 104 | 70 | |
| 105 | - private function get_element_manager_promotion( $promotion_data, $filter_id ): array { | |
| 106 | - | |
| 107 | - return Filtered_Promotions_Manager::get_filtered_promotion_data( $promotion_data, 'elementor/element_manager/admin_app_data/promotion_data/' . $filter_id, 'url' ); | |
| 108 | - } | |
| 109 | - | |
| 110 | 71 | private function verify_permission() { |
| 111 | 72 | if ( ! current_user_can( 'manage_options' ) ) { |
| 112 | 73 | wp_send_json_error( esc_html__( 'You do not have permission to edit these settings.', 'elementor' ) ); |
| 113 | 74 | } |
| @@ -122,9 +83,9 @@ | ||
| 122 | 83 | remove_all_filters( 'elementor/widgets/is_widget_enabled' ); |
| 123 | 84 | } |
| 124 | 85 | |
| 125 | 86 | private function get_plugin_name_from_widget_instance( $widget ) { |
| 126 | - if ( in_array( 'wordpress', $widget->get_categories() ) ) { // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText | |
| 87 | + if ( in_array( 'wordpress', $widget->get_categories() ) ) { | |
| 127 | 88 | return esc_html__( 'WordPress Widgets', 'elementor' ); |
| 128 | 89 | } |
| 129 | 90 | |
| 130 | 91 | $class_reflection = new \ReflectionClass( $widget ); |