connect = $connect;
$this->page_url = admin_url( 'admin.php?page=elementor-connect-account' );
$this->script_config = $script_config;
}
public function get_label(): string {
return esc_html__( 'Connect Account', 'elementor' );
}
public function get_page_title(): string {
return esc_html__( 'Connect Settings', 'elementor' );
}
public function get_capability(): string {
return 'manage_options';
}
public function get_parent_slug(): string {
return Settings::PAGE_ID;
}
public function is_visible(): bool {
return true;
}
public function render() {
$this->enqueue_scripts();
?>
get_page_title() ); ?>
connect->is_connected() ) {
$this->render_connect_box();
} else {
$this->render_license_box();
}
?>
connect->get_admin_url( 'authorize', [
'utm_source' => 'license-page-connect-free',
'utm_medium' => 'wp-dash',
'utm_campaign' => 'connect-and-activate-license',
'redirect_to' => $this->page_url,
] );
?>
connect->get_admin_url( 'disconnect', [
'redirect_to' => $this->page_url,
] );
$download_link = $this->connect->get_download_link();
?>
:
get_connected_account();
if ( $connected_user ) :
printf(
/* translators: %s: Connected user. */
esc_html__( 'You\'re connected as %s.', 'elementor' ),
'' . esc_html( $connected_user ) . ''
);
endif;
?>
render_promotion_box();
} else {
$this->render_install_or_activate_box();
}
}
private function get_connected_account() {
$user = $this->connect->get( 'user' );
$email = '';
if ( $user ) {
$email = $user->email;
}
return $email;
}
private function render_promotion_box() {
?>
get_cta_data();
$ctr_url = wp_nonce_url( admin_url( 'admin-post.php?action=elementor_do_pro_install' ), 'elementor_do_pro_install' );
$ctr_id = $this->is_pro_installed() ? 'elementor-connect-activate-pro' : 'elementor-connect-install-pro';
?>
esc_html__( 'Enjoy full access to powerful design tools, advanced widgets, and everything you need to create next-level websites.', 'elementor' ),
'button_text' => $this->is_pro_installed() ? esc_html__( 'Activate Elementor Pro', 'elementor' ) : esc_html__( 'Install & Activate', 'elementor' ),
];
}
private function is_pro_installed(): bool {
$file_path = $this->get_elementor_pro_file_path();
$installed_plugins = get_plugins();
return isset( $installed_plugins[ $file_path ] );
}
private function get_elementor_pro_file_path(): string {
return 'elementor-pro/elementor-pro.php';
}
private function enqueue_scripts() {
wp_enqueue_script( ...$this->script_config );
}
}