/home/altere25/usaigc.com/wp-content/plugins/elementor-pro/license
Edit: /home/altere25/usaigc.com/wp-content/plugins/elementor-pro/license/admin.php (26105B)
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() {
$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'
);
}
if ( ! API::is_license_expired() && API::is_need_to_show_upgrade_promotion() ) {
add_submenu_page(
Settings::PAGE_ID,
'',
esc_html__( 'Unlock More Features', 'elementor-pro' ),
'manage_options',
'elementor_pro_upgrade_license_menu_link',
function () {
wp_redirect( current_user_can( 'manage_options' )
? 'https://go.elementor.com/go-pro-advanced-elementor-menu/'
: '/wp-admin'
);
die;
}
);
}
}
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;
}
?>
esc_html__( 'Expired', 'elementor-pro' ),
API::STATUS_SITE_INACTIVE => esc_html__( 'Mismatch', 'elementor-pro' ),
API::STATUS_CANCELLED => esc_html__( 'Cancelled', 'elementor-pro' ),
API::STATUS_HTTP_ERROR => esc_html__( 'HTTP Error', 'elementor-pro' ),
API::STATUS_MISSING => esc_html__( 'Missing', 'elementor-pro' ),
API::STATUS_REQUEST_LOCKED => esc_html__( 'Request Locked', 'elementor-pro' ),
];
echo esc_html__( 'Status', 'elementor-pro' ); ?>:
redirect_to_document( $redirect_to_document );
endif;
?>
',
'',
'',
''
); ?>
',
''
); ?>
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 ( ! $this->is_opt_out_request() || ! $this->is_valid_opt_out_nonce() ) {
return;
}
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' ) ) {
// Using 'go-pro' key to style the 'renew' button as the 'go-pro' button
if ( API::is_license_expired() ) {
$additions_actions['go-pro'] = [
'title' => esc_html__( 'Renew Now', 'elementor-pro' ),
'link' => 'https://go.elementor.com/overview-widget-renew/',
];
} elseif ( API::is_need_to_show_upgrade_promotion() ) {
$additions_actions['go-pro'] = [
'title' => esc_html__( 'Upgrade', 'elementor-pro' ),
'link' => 'https://go.elementor.com/go-pro-advanced-wordpress-elementor-overview/',
];
}
}
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 ) {
?>
30,
'body' => [
'api_version' => ELEMENTOR_PRO_VERSION,
'site_lang' => get_bloginfo( 'language' ),
],
] );
}
private function is_connected() {
return $this->get_app()->is_connected();
}
public function get_connect_url( $params = [] ) {
$action = $this->is_connected() ? 'activate_pro' : 'authorize';
return $this->get_app()->get_admin_url( $action, $params );
}
private function get_switch_license_url( $params = [] ) {
return $this->get_app()->get_admin_url( 'switch_license', $params );
}
private function get_connected_account() {
$user = $this->get_app()->get( 'user' );
$email = '';
if ( $user ) {
$email = $user->email;
}
return $email;
}
private function get_deactivate_url() {
return $this->get_app()->get_admin_url( 'deactivate' );
}
private function get_activate_message() {
return esc_html__( 'Please activate your license to get feature updates, premium support and unlimited access to the template library.', 'elementor-pro' );
}
/**
* @return Activate
*/
private function get_app() {
return Plugin::elementor()->common->get_component( 'connect' )->get_app( 'activate' );
}
private function redirect_to_document( $document_id ) {
$document = Plugin::elementor()->documents->get( (int) $document_id );
if ( $document ) {
// Triggers after the headers were sent, so a regular redirect won't work.
?>
handle_dashboard_admin_widget();
}
private function is_opt_out_request(): bool {
return 'opt_out' === Utils::get_super_global_value( $_GET, 'elementor_tracker' );
}
private function is_valid_opt_out_nonce() {
$nonce = Utils::get_super_global_value( $_REQUEST, '_wpnonce' );
return wp_verify_nonce( $nonce, 'opt_out' );
}
}