Skip to content

Commit 940a160

Browse files
Merge pull request #986 from Codeinwp/feat/banner-support
feat: add banner support
2 parents 0b741c4 + bd3d930 commit 940a160

File tree

6 files changed

+51
-10
lines changed

6 files changed

+51
-10
lines changed

css/settings.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,28 @@
113113
.post-type-feedzy_imports:not(.edit-post) .wrap div#side-sortables{
114114
display: none;
115115
}
116+
117+
.feedzy-banner:has(.tsdk-banner-cta) {
118+
margin: 0 auto;
119+
display: flex;
120+
justify-content: center;
121+
margin-bottom: 20px;
122+
}
123+
124+
.feedzy-banner .tsdk-banner-urgency-text {
125+
padding: 5px;
126+
}
127+
128+
.feedzy-banner-dashboard:has(.tsdk-banner-cta) {
129+
margin: 20px 0;
130+
131+
/* Remove the properties added by .notice */
132+
background: transparent;
133+
border: unset;
134+
box-shadow: unset;
135+
padding: unset;
136+
}
137+
116138
.feedzy-container{
117139
max-width: 1224px;
118140
margin: 0 auto;

img/black-friday-banner.png

-27.3 KB
Binary file not shown.

img/black-friday.jpg

89.9 KB
Loading

includes/admin/feedzy-rss-feeds-admin.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public function enqueue_styles_admin() {
130130

131131
if ( 'feedzy_imports' === $screen->post_type && 'edit' === $screen->base ) {
132132
$this->register_survey();
133+
$this->add_banner_anchor();
133134
}
134135

135136
if ( 'feedzy_categories' === $screen->post_type ) {
@@ -158,6 +159,7 @@ public function enqueue_styles_admin() {
158159
);
159160

160161
$this->register_survey();
162+
$this->add_banner_anchor();
161163
}
162164

163165
if ( 'feedzy_page_feedzy-settings' === $screen->base ) {
@@ -181,6 +183,17 @@ public function enqueue_styles_admin() {
181183
$this->register_survey();
182184
}
183185

186+
if (
187+
'feedzy_page_feedzy-settings' === $screen->base ||
188+
'feedzy_categories' === $screen->post_type ||
189+
( 'feedzy_imports' === $screen->post_type && 'edit' === $screen->base )
190+
) {
191+
$license_data = get_option( 'feedzy_rss_feeds_pro_license_data', array() );
192+
if ( self::plan_category( $license_data ) <= 1 ) {
193+
do_action( 'themeisle_sdk_load_banner', 'feedzy' );
194+
}
195+
}
196+
184197
$upsell_screens = array( 'feedzy-rss_page_feedzy-settings', 'feedzy-rss_page_feedzy-admin-menu-pro-upsell' );
185198
if ( 'feedzy_imports' === $screen->post_type && 'edit' !== $screen->base ) {
186199

@@ -1617,7 +1630,7 @@ public function api_license_status() {
16171630
* @param object $license_data The license data.
16181631
* @return int
16191632
*/
1620-
private static function plan_category( $license_data ) {
1633+
public static function plan_category( $license_data ) {
16211634

16221635
if ( ! isset( $license_data->plan ) || ! is_numeric( $license_data->plan ) ) {
16231636
return 0; // Free
@@ -1712,5 +1725,17 @@ public function register_survey() {
17121725
do_action( 'themeisle_sdk_dependency_enqueue_script', 'survey' );
17131726
wp_enqueue_script( $this->plugin_name . '_survey', FEEDZY_ABSURL . 'js/survey.js', array( $survey_handler ), $this->version, true );
17141727
wp_localize_script( $this->plugin_name . '_survey', 'feedzySurveyData', $this->get_survery_metadata() );
1728+
1729+
}
1730+
1731+
/**
1732+
* Add banner anchor for promotions.
1733+
*/
1734+
public function add_banner_anchor() {
1735+
add_action(
1736+
'admin_notices', function() {
1737+
echo '<div id="tsdk_banner" class="notice feedzy-banner-dashboard"></div>';
1738+
}, 999
1739+
);
17151740
}
17161741
}

includes/feedzy-rss-feeds.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,6 @@ function () {
295295
}
296296
);
297297
}
298-
299-
if ( ! feedzy_is_pro() ) {
300-
$offer = new Feedzy_Rss_Feeds_Limited_Offers();
301-
$offer->load_banner();
302-
}
303-
304298
}
305299

306300
/**

includes/layouts/settings.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
$help_btn_url = 'https://docs.themeisle.com/category/712-feedzy';
1010

11-
$offer = new Feedzy_Rss_Feeds_Limited_Offers();
12-
$offer_data = feedzy_is_pro() ? array() : $offer->get_localized_data();
13-
1411
if ( 'headers' === $active_tab ) {
1512
$help_btn_url = 'https://docs.themeisle.com/article/713-how-to-change-user-agent-in-feedzy';
1613
} elseif ( 'proxy' === $active_tab ) {
@@ -30,6 +27,9 @@
3027
<?php if ( $this->error ) { ?>
3128
<div class="fz-snackbar-notice error"><p><?php echo wp_kses_post( $this->error ); ?></p></div>
3229
<?php } ?>
30+
31+
<div id="tsdk_banner" class="feedzy-banner"></div>
32+
3333
<div class="feedzy-container">
3434
<?php if ( ! empty( $offer_data['active'] ) ) { ?>
3535
<div class="feedzy-sale">

0 commit comments

Comments
 (0)