8889841cPK [V updater.phpnu [ plugin_version = ELEMENTOR_PRO_VERSION; $this->plugin_name = ELEMENTOR_PRO_PLUGIN_BASE; $this->plugin_slug = basename( ELEMENTOR_PRO__FILE__, '.php' ); $this->response_transient_key = md5( sanitize_key( $this->plugin_name ) . 'response_transient' ); $this->setup_hooks(); $this->maybe_delete_transients(); } private function setup_hooks() { add_filter( 'pre_set_site_transient_update_plugins', [ $this, 'check_update' ], 50 ); add_action( 'delete_site_transient_update_plugins', [ $this, 'delete_transients' ] ); add_filter( 'plugins_api', [ $this, 'plugins_api_filter' ], 10, 3 ); remove_action( 'after_plugin_row_' . $this->plugin_name, 'wp_plugin_update_row' ); add_action( 'after_plugin_row_' . $this->plugin_name, [ $this, 'show_update_notification' ], 10, 2 ); add_action( 'update_option_WPLANG', function () { $this->clean_get_version_cache(); } ); add_action( 'upgrader_process_complete', function () { $this->clean_get_version_cache(); } ); } public function delete_transients() { $this->delete_transient( $this->response_transient_key ); } private function maybe_delete_transients() { global $pagenow; if ( 'update-core.php' === $pagenow && isset( $_GET['force-check'] ) ) { $this->delete_transients(); } } private function check_transient_data( $_transient_data ) { if ( ! is_object( $_transient_data ) ) { $_transient_data = new \stdClass(); } $version_info = API::get_version( false /* Use Cache */ ); if ( is_wp_error( $version_info ) ) { return $_transient_data; } // include an unmodified $wp_version include( ABSPATH . WPINC . '/version.php' ); if ( version_compare( $wp_version, $version_info['requires'], '<' ) ) { return $_transient_data; } if ( ! empty( $version_info['elementor_requires'] ) ) { if ( version_compare( ELEMENTOR_VERSION, $version_info['elementor_requires'], '<' ) ) { return $_transient_data; } } $plugin_info = (object) $version_info; unset( $plugin_info->sections ); $plugin_info->plugin = $this->plugin_name; if ( version_compare( $this->plugin_version, $version_info['new_version'], '<' ) ) { $_transient_data->response[ $this->plugin_name ] = $plugin_info; $_transient_data->checked[ $this->plugin_name ] = $version_info['new_version']; } else { $_transient_data->no_update[ $this->plugin_name ] = $plugin_info; $_transient_data->checked[ $this->plugin_name ] = $this->plugin_version; } $_transient_data->last_checked = current_time( 'timestamp' ); if ( ! isset( $_transient_data->translations ) ) { $_transient_data->translations = []; } $_transient_data->translations = array_filter( $_transient_data->translations, function( $translation ) { return ( $translation['slug'] !== $this->plugin_slug ); } ); if ( ! empty( $version_info['translations'] ) ) { foreach ( $version_info['translations'] as $translation ) { $_transient_data->translations[] = [ 'type' => 'plugin', 'slug' => $this->plugin_slug, 'language' => $translation['language'], 'version' => $version_info['new_version'], 'updated' => $translation['updated'], 'package' => $translation['package'], 'autoupdate' => true, ]; } } return $_transient_data; } public function check_update( $_transient_data ) { global $pagenow; if ( ! is_object( $_transient_data ) ) { $_transient_data = new \stdClass(); } if ( 'plugins.php' === $pagenow && is_multisite() ) { return $_transient_data; } return $this->check_transient_data( $_transient_data ); } public function plugins_api_filter( $_data, $_action = '', $_args = null ) { if ( 'plugin_information' !== $_action ) { return $_data; } if ( ! isset( $_args->slug ) || ( $_args->slug !== $this->plugin_slug ) ) { return $_data; } $cache_key = 'elementor_pro_api_request_' . substr( md5( serialize( $this->plugin_slug ) ), 0, 15 ); $api_request_transient = get_site_transient( $cache_key ); if ( empty( $api_request_transient ) ) { $api_response = API::get_version(); if ( is_wp_error( $api_response ) ) { return $_data; } $api_request_transient = new \stdClass(); $api_request_transient->name = 'Elementor Pro'; $api_request_transient->slug = $this->plugin_slug; $api_request_transient->author = 'Elementor.com'; $api_request_transient->homepage = 'https://elementor.com/'; $api_request_transient->requires = $api_response['requires']; $api_request_transient->tested = $api_response['tested']; $api_request_transient->version = $api_response['new_version']; $api_request_transient->last_updated = $api_response['last_updated']; $api_request_transient->download_link = $api_response['download_link']; $api_request_transient->banners = [ 'high' => 'https://ps.w.org/elementor/assets/banner-1544x500.png?rev=1494133', 'low' => 'https://ps.w.org/elementor/assets/banner-1544x500.png?rev=1494133', ]; $api_request_transient->autoupdate = true; $api_request_transient->sections = unserialize( $api_response['sections'] ); // Expires in 1 day set_site_transient( $cache_key, $api_request_transient, DAY_IN_SECONDS ); } $_data = $api_request_transient; return $_data; } public function show_update_notification( $file, $plugin ) { if ( is_network_admin() ) { return; } if ( ! current_user_can( 'update_plugins' ) ) { return; } if ( ! is_multisite() ) { return; } if ( $this->plugin_name !== $file ) { return; } // Remove our filter on the site transient remove_filter( 'pre_set_site_transient_update_plugins', [ $this, 'check_update' ] ); $update_cache = get_site_transient( 'update_plugins' ); $update_cache = $this->check_transient_data( $update_cache ); set_site_transient( 'update_plugins', $update_cache ); // Restore our filter add_filter( 'pre_set_site_transient_update_plugins', [ $this, 'check_update' ] ); } protected function get_transient( $cache_key ) { $cache_data = get_option( $cache_key ); if ( empty( $cache_data['timeout'] ) || current_time( 'timestamp' ) > $cache_data['timeout'] ) { // Cache is expired. return false; } return $cache_data['value']; } protected function set_transient( $cache_key, $value, $expiration = 0 ) { if ( empty( $expiration ) ) { $expiration = strtotime( '+12 hours', current_time( 'timestamp' ) ); } $data = [ 'timeout' => $expiration, 'value' => $value, ]; update_option( $cache_key, $data, 'no' ); } protected function delete_transient( $cache_key ) { delete_option( $cache_key ); } private function clean_get_version_cache() { // Since `API::get_version` holds the old language. $cache_key = API::TRANSIENT_KEY_PREFIX . ELEMENTOR_PRO_VERSION; delete_option( $cache_key ); } } PK [d d admin.phpnu [ updater` instead. */ public static $updater = null; public static function get_errors_details() { $license_page_link = self::get_url(); return [ API::STATUS_EXPIRED => [ 'title' => esc_html__( 'Your Elementor Pro license has expired.', 'elementor-pro' ), 'description' => esc_html__( 'Want to keep creating secure and high-performing websites? Renew your subscription to regain access to all of the Elementor Pro widgets, templates, updates & more', 'elementor-pro' ), 'button_text' => esc_html__( 'Renew Now', 'elementor-pro' ), 'button_url' => API::RENEW_URL, 'button_type' => 'cta', ], API::STATUS_CANCELLED => [ 'title' => esc_html__( 'Your License Is Inactive', 'elementor-pro' ), 'description' => sprintf( /* translators: 1: Bold text opening tag, 2: Bold text closing tag. */ esc_html__( '%1$sYour license key has been cancelled%2$s (most likely due to a refund request). Please consider acquiring a new license.', 'elementor-pro' ), '', '' ), 'button_text' => esc_html__( 'Activate License', 'elementor-pro' ), 'button_url' => $license_page_link, ], API::STATUS_SITE_INACTIVE => [ 'title' => esc_html__( 'License Mismatch', 'elementor-pro' ), 'description' => sprintf( /* translators: 1: Bold text opening tag, 2: Bold text closing tag. */ esc_html__( '%1$sYour license key doesn\'t match your current domain%2$s. This is most likely due to a change in the domain URL. Please deactivate the license and then reactivate it again.', 'elementor-pro' ), '', '' ), 'button_text' => esc_html__( 'Reactivate License', 'elementor-pro' ), 'button_url' => $license_page_link, ], ]; } public static function deactivate() { API::deactivate_license(); delete_option( self::LICENSE_KEY_OPTION_NAME ); delete_option( self::LICENSE_DATA_OPTION_NAME ); delete_option( self::LICENSE_DATA_FALLBACK_OPTION_NAME ); } private static function get_hidden_license_key() { $input_string = self::get_license_key(); $start = 5; $length = mb_strlen( $input_string ) - $start - 5; $mask_string = preg_replace( '/\S/', 'X', $input_string ); $mask_string = mb_substr( $mask_string, $start, $length ); $input_string = substr_replace( $input_string, $mask_string, $start, $length ); return $input_string; } /** * @deprecated 3.6.0 Use `Plugin::instance()->updater` instead. * * @return \ElementorPro\License\Updater */ public static function get_updater_instance() { static::$updater = Plugin::instance()->updater; return static::$updater; } public static function get_license_key() { return trim( get_option( self::LICENSE_KEY_OPTION_NAME ) ); } public static function set_license_key( $license_key ) { return update_option( self::LICENSE_KEY_OPTION_NAME, $license_key ); } public function action_activate_license() { check_admin_referer( 'elementor-pro-license' ); $license_key = Pro_Utils::_unstable_get_super_global_value( $_POST, 'elementor_pro_license_key' ); if ( ! $license_key ) { wp_die( esc_html__( 'Please enter your license key.', 'elementor-pro' ), esc_html__( 'Elementor Pro', 'elementor-pro' ), [ 'back_link' => true, ] ); } $data = API::activate_license( $license_key ); if ( is_wp_error( $data ) ) { wp_die( sprintf( '%s (%s) ', wp_kses_post( $data->get_error_message() ), wp_kses_post( $data->get_error_code() ) ), esc_html__( 'Elementor Pro', 'elementor-pro' ), [ 'back_link' => true, ] ); } if ( empty( $data['success'] ) ) { $error_msg = API::get_error_message( $data['error'] ); wp_die( wp_kses_post( $error_msg ), esc_html__( 'Elementor Pro', 'elementor-pro' ), [ 'back_link' => true, ] ); } self::set_license_key( $license_key ); API::set_license_data( $data ); $this->safe_redirect( Pro_Utils::_unstable_get_super_global_value( $_POST, '_wp_http_referer' ) ); } protected function safe_redirect( $url ) { wp_safe_redirect( $url ); die; } public function action_deactivate_license() { check_admin_referer( 'elementor-pro-license' ); $this->deactivate(); $this->safe_redirect( Pro_Utils::_unstable_get_super_global_value( $_POST, '_wp_http_referer' ) ); } public function register_page() { return; $menu_text = esc_html__( 'License', 'elementor-pro' ); add_submenu_page( Settings::PAGE_ID, $menu_text, $menu_text, 'manage_options', self::PAGE_ID, [ $this, 'display_page' ] ); if ( API::is_license_expired() ) { add_submenu_page( Settings::PAGE_ID, '', sprintf( ' %s ', esc_html__( 'Renew Now', 'elementor-pro' ) ), 'manage_options', 'elementor_pro_renew_license_menu_link' ); } } public static function get_url() { return admin_url( 'admin.php?page=' . self::PAGE_ID ); } public function display_page() { $license_key = self::get_license_key(); $is_manual_mode = ( isset( $_GET['mode'] ) && 'manually' === $_GET['mode'] ); if ( $is_manual_mode ) { $this->render_manually_activation_widget( $license_key ); return; } ?>
', '', '', '' ); ?>
', '' ); ?>
is_block_editor() ) { return true; } if ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) { return true; } return false; } public function admin_license_details() { if ( ! current_user_can( 'manage_options' ) ) { return; } if ( $this->is_block_editor_page() ) { return; } $renew_url = API::RENEW_URL; $license_key = self::get_license_key(); /** * @var Admin_Notices $admin_notices */ $admin_notices = Plugin::elementor()->admin->get_component( 'admin-notices' ); if ( empty( $license_key ) ) { $admin_notices->print_admin_notice( [ 'title' => esc_html__( 'Welcome to Elementor Pro!', 'elementor-pro' ), 'description' => $this->get_activate_message(), 'button' => [ 'text' => '' . esc_html__( 'Connect & Activate', 'elementor-pro' ), 'url' => $this->get_connect_url( [ 'utm_source' => 'wp-notification-banner', 'utm_medium' => 'wp-dash', 'utm_campaign' => 'connect-and-activate-license', ] ), ], ] ); return; } $license_data = API::get_license_data(); // When the license with pro trial, the messages here are not relevant, pro trial messages will be shown instead. if ( API::is_licence_pro_trial() ) { return; } $errors = self::get_errors_details(); if ( ! $license_data['success'] && isset( $license_data['error'], $errors[ $license_data['error'] ] ) ) { $error_data = $errors[ $license_data['error'] ]; $admin_notices->print_admin_notice( [ 'title' => $error_data['title'], 'description' => $error_data['description'], 'button' => [ 'text' => $error_data['button_text'], 'url' => $error_data['button_url'], 'type' => isset( $error_data['button_type'] ) ? $error_data['button_type'] : '', ], ] ); return; } if ( API::is_license_active() && API::is_license_about_to_expire() ) { $title = sprintf( /* translators: %s: Days to expire. */ esc_html__( 'Your License Will Expire in %s.', 'elementor-pro' ), human_time_diff( current_time( 'timestamp' ), strtotime( $license_data['expires'] ) ) ); if ( isset( $license_data['renewal_discount'] ) && 0 < $license_data['renewal_discount'] ) { $description = sprintf( /* translators: %s: Discount percent. */ esc_html__( 'Renew your license today, and get an exclusive, time-limited %s discount.', 'elementor-pro' ), $license_data['renewal_discount'] . '%' ); } else { $description = esc_html__( 'Renew your license today, to keep getting feature updates, premium support, Pro widgets & unlimited access to the template library.', 'elementor-pro' ); } $admin_notices->print_admin_notice( [ 'title' => $title, 'description' => $description, 'type' => 'warning', 'button' => [ 'text' => esc_html__( 'Renew now', 'elementor-pro' ), 'url' => $renew_url, 'type' => 'warning', ], ] ); } } public function filter_library_get_templates_args( $body_args ) { $license_key = self::get_license_key(); if ( ! empty( $license_key ) ) { $body_args['license'] = $license_key; $body_args['url'] = home_url(); } return $body_args; } public function handle_tracker_actions() { // Show tracker notice after 24 hours from Pro installed time. $is_need_to_show = ( $this->get_installed_time() < strtotime( '-24 hours' ) ); $is_dismiss_notice = ( '1' === get_option( 'elementor_tracker_notice' ) ); $is_dismiss_pro_notice = ( '1' === get_option( 'elementor_pro_tracker_notice' ) ); if ( $is_need_to_show && $is_dismiss_notice && ! $is_dismiss_pro_notice ) { delete_option( 'elementor_tracker_notice' ); } if ( ! isset( $_GET['elementor_tracker'] ) ) { return; } if ( 'opt_out' === $_GET['elementor_tracker'] ) { update_option( 'elementor_pro_tracker_notice', '1' ); } } public function get_installed_time() { $installed_time = get_option( '_elementor_pro_installed_time' ); if ( ! $installed_time ) { $installed_time = time(); update_option( '_elementor_pro_installed_time', $installed_time ); } return $installed_time; } public function plugin_action_links( $links ) { $license_key = self::get_license_key(); if ( empty( $license_key ) ) { $links['active_license'] = sprintf( '%s', self::get_connect_url([ 'utm_source' => 'wp-plugins', 'utm_medium' => 'wp-dash', 'utm_campaign' => 'connect-and-activate-license', ]), __( 'Connect & Activate', 'elementor-pro' ) ); } if ( API::is_license_expired() ) { $links['renew_license'] = sprintf( '%s', 'https://go.elementor.com/wp-plugins-renew/', __( 'Renew Now', 'elementor-pro' ) ); } return $links; } public function plugin_auto_update_setting_html( $html, $plugin_file ) { $license_data = API::get_license_data(); if ( ELEMENTOR_PRO_PLUGIN_BASE === $plugin_file && ! $license_data['success'] ) { return '' . esc_html__( '(unavailable)', 'elementor-pro' ) . ''; } return $html; } private function handle_dashboard_admin_widget() { add_action( 'elementor/admin/dashboard_overview_widget/after_version', function() { /* translators: %s: Elementor Pro version. */ $label = sprintf( esc_html__( 'Elementor Pro v%s', 'elementor-pro' ), ELEMENTOR_PRO_VERSION ); echo ''; Utils::print_unescaped_internal_string( $label ); echo ''; } ); add_filter( 'elementor/admin/dashboard_overview_widget/footer_actions', function( $additions_actions ) { unset( $additions_actions['go-pro'] ); if ( current_user_can( 'manage_options' ) && API::is_license_expired() ) { // Using 'go-pro' key to style the 'renew' button as the 'go-pro' button $additions_actions['go-pro'] = [ 'title' => esc_html__( 'Renew Now', 'elementor-pro' ), 'link' => 'https://go.elementor.com/overview-widget-renew/', ]; } return $additions_actions; }, 550 ); } public function add_finder_item( array $categories ) { $categories['settings']['items']['license'] = [ 'title' => esc_html__( 'License', 'elementor-pro' ), 'url' => self::get_url(), ]; return $categories; } private function render_manually_activation_widget( $license_key ) { ?>