Skip to content

Commit 75d9716

Browse files
committed
Update promotions
1 parent 3a756d7 commit 75d9716

File tree

1 file changed

+37
-20
lines changed

1 file changed

+37
-20
lines changed

src/php/promotions/elementor-pro.php

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,20 @@ public function promotion_in_custom_code_screen() {
2727
if ( ! $this->is_custom_code_screen() ) {
2828
return;
2929
}
30-
3130
?>
32-
<div class="notice notice-info is-dismissibleX">
31+
<div class="notice notice-info is-dismissible">
3332
<p>
34-
<strong><?php esc_html_e( '💡 Looking for a better way to manage custom code?', 'code-snippets' ); ?></strong>
33+
<strong><?php esc_html_e( 'Looking for a better way to manage your custom code?', 'code-snippets' ); ?></strong>
3534
</p>
3635
<p>
37-
<?php
38-
printf(
39-
/* translators: %s: Code Snippets plugin name */
40-
esc_html__( '%s provides a powerful and user-friendly alternative to Elementor Custom Code, with cloud sync, advanced features, and an intuitive interface.', 'code-snippets' ),
41-
'<strong>Code Snippets Pro</strong>'
42-
);
43-
?>
36+
<?php esc_html_e( 'Code Snippets Pro provides a powerful and user-friendly alternative to Elementor Custom Code, with cloud sync, advanced features, and an intuitive interface.', 'code-snippets' ); ?>
4437
</p>
4538
<p>
46-
<a href="<?php echo esc_url( 'https://codesnippets.pro/pricing/?utm_source=elementor&utm_medium=banner&utm_campaign=custom-code' ); ?>" class="button button-primary" target="_blank">
47-
<?php esc_html_e( 'Learn More', 'code-snippets' ); ?>
39+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=snippets' ) ); ?>" class="button button-primary">
40+
<?php esc_html_e( 'Manage your snippets', 'code-snippets' ); ?>
4841
</a>
49-
<a href="<?php echo esc_url( admin_url( 'admin.php?page=snippets' ) ); ?>" class="button button-secondary">
50-
<?php esc_html_e( 'Try Code Snippets', 'code-snippets' ); ?>
42+
<a href="https://codesnippets.pro/pricing/?utm_source=elementor&utm_medium=banner&utm_campaign=custom-code" class="button button-secondary" target="_blank">
43+
<?php esc_html_e( 'Learn More', 'code-snippets' ); ?>
5144
</a>
5245
</p>
5346
</div>
@@ -101,13 +94,37 @@ public function add_promotion_to_custom_css_section( $element ) {
10194
'type' => \Elementor\Controls_Manager::NOTICE,
10295
'notice_type' => 'info',
10396
'dismissible' => true,
104-
'heading' => esc_html__( 'Manage your custom code', 'code-snippets' ),
105-
'content' => sprintf(
106-
/* translators: %s: Code Snippets plugin name */
107-
esc_html__( '%s provides a powerful and user-friendly alternative to Elementor Custom Code, with cloud sync, advanced features, and an intuitive interface.', 'code-snippets' ),
108-
'<strong>Code Snippets Pro</strong>'
109-
),
97+
'heading' => esc_html__( 'Manage your custom styles', 'code-snippets' ),
98+
'content' => $this->get_promotion_content(),
11099
]
111100
);
112101
}
102+
103+
/**
104+
* Get the promotion content with appropriate link.
105+
*
106+
* @return string
107+
*/
108+
private function get_promotion_content(): string {
109+
$message = esc_html__( 'Code Snippets Pro provides a powerful and user-friendly alternative to Elementor Custom Code, with cloud sync, conditional logic, and advanced features.', 'code-snippets' );
110+
111+
if ( $this->is_pro() ) {
112+
$link_text = esc_html__( 'Manage CSS snippets', 'code-snippets' );
113+
$url = admin_url( 'admin.php?page=snippets&type=css' );
114+
} else {
115+
$link_text = esc_html__( 'Learn More', 'code-snippets' );
116+
$url = 'https://codesnippets.pro/pricing/?utm_source=elementor&utm_medium=banner&utm_campaign=elementor-addon-custom-code';
117+
}
118+
119+
return sprintf( '%s <br><br><a href="%s" target="_blank" class="e-btn e-info" style="color:#fff;">%s</a>', $message, $url, $link_text );
120+
}
121+
122+
/**
123+
* Check if pro version is installed and active.
124+
*
125+
* @return bool
126+
*/
127+
private function is_pro(): bool {
128+
return defined( 'CODE_SNIPPETS_PRO' ) && CODE_SNIPPETS_PRO;
129+
}
113130
}

0 commit comments

Comments
 (0)