Skip to content

Commit 29edca3

Browse files
fix: linter and phpstan
1 parent a1d7102 commit 29edca3

2 files changed

Lines changed: 101 additions & 93 deletions

File tree

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

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,36 +2032,37 @@ private function setup_wizard_subscribe_process() {
20322032
*
20332033
* @since 5.1.0
20342034
* @access public
2035+
* @return void
20352036
*/
20362037
public function feedzy_dashboard_subscribe() {
2037-
check_ajax_referer('feedzy_subscribe_nonce', '_wpnonce');
2038+
check_ajax_referer( 'feedzy_subscribe_nonce', '_wpnonce' );
20382039

2039-
$with_subscribe = !empty($_POST['with_subscribe']) ? (bool) $_POST['with_subscribe'] : false;
2040-
$email = !empty($_POST['email']) ? sanitize_email($_POST['email']) : '';
2041-
$integrate_with = !empty($_POST['integrate_with']) ? sanitize_text_field($_POST['integrate_with']) : '';
2040+
$with_subscribe = ! empty( $_POST['with_subscribe'] ) ? (bool) $_POST['with_subscribe'] : false;
2041+
$email = ! empty( $_POST['email'] ) ? sanitize_email( $_POST['email'] ) : '';
2042+
$integrate_with = ! empty( $_POST['integrate_with'] ) ? sanitize_text_field( $_POST['integrate_with'] ) : '';
20422043

2043-
if ($with_subscribe && is_email($email)) {
2044-
update_option('feedzy_rss_feeds_logger_flag', 'yes');
2044+
if ( $with_subscribe && is_email( $email ) ) {
2045+
update_option( 'feedzy_rss_feeds_logger_flag', 'yes' );
20452046

20462047
$request_res = wp_remote_post(
20472048
FEEDZY_SUBSCRIBE_API,
20482049
array(
2049-
'timeout' => 100,
2050+
'timeout' => 100, // phpcs:ignore WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout
20502051
'headers' => array(
20512052
'Content-Type' => 'application/json',
20522053
),
2053-
'body' => wp_json_encode(
2054+
'body' => wp_json_encode(
20542055
array(
2055-
'slug' => 'feedzy-rss-feeds',
2056-
'site' => home_url(),
2056+
'slug' => 'feedzy-rss-feeds',
2057+
'site' => home_url(),
20572058
'email' => $email,
2058-
'data' => array('integration' => $integrate_with),
2059+
'data' => array( 'integration' => $integrate_with ),
20592060
)
20602061
),
20612062
)
20622063
);
20632064

2064-
if (!is_wp_error($request_res)) {
2065+
if ( ! is_wp_error( $request_res ) ) {
20652066
$this->dismiss_subscribe_notice();
20662067
wp_send_json_success();
20672068
} else {
@@ -2073,6 +2074,13 @@ public function feedzy_dashboard_subscribe() {
20732074
}
20742075
}
20752076

2077+
/**
2078+
* Dismiss subscribe notice.
2079+
*
2080+
* @since 5.1.0
2081+
* @access public
2082+
* @return void
2083+
*/
20762084
public function dismiss_subscribe_notice() {
20772085
update_option( 'feedzy_rss_feeds_dismiss_subscribe_notice', 'yes' );
20782086
}
Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
<div id="fz-features" class="feedzy-wrap">
22

3-
<?php load_template(FEEDZY_ABSPATH . '/includes/layouts/header.php'); ?>
3+
<?php load_template( FEEDZY_ABSPATH . '/includes/layouts/header.php' ); ?>
44

55
<?php
66
// phpcs:ignore WordPress.Security.NonceVerification
7-
$active_tab = isset($_REQUEST['tab']) ? sanitize_text_field(wp_unslash($_REQUEST['tab'])) : 'help';
7+
$active_tab = isset( $_REQUEST['tab'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tab'] ) ) : 'help';
88
?>
99

1010
<?php
11-
$skip_subscribe = get_option( 'feedzy_rss_feeds_skip_subscribe' );
12-
$subscribed_notice = get_option('feedzy_rss_feeds_dismiss_subscribe_notice');
13-
if ( 'yes' === $skip_subscribe && 'no' === $subscribed_notice) :
14-
?>
11+
$skip_subscribe = get_option( 'feedzy_rss_feeds_skip_subscribe' );
12+
$subscribed_notice = get_option( 'feedzy_rss_feeds_dismiss_subscribe_notice' );
13+
if ( 'yes' === $skip_subscribe && 'no' === $subscribed_notice ) :
14+
?>
1515
<div class ="feedzy-container">
1616
<div class="feedzy-helper-notice" style="padding: 30px ;position: relative">
1717
<button
1818
type="button"
1919
class="feedzy-notice-dismiss"
2020
aria-label="<?php esc_attr_e( 'Dismiss this notice', 'feedzy-rss-feeds' ); ?>"
2121
>
22-
&times;
23-
</button>
22+
&times;
23+
</button>
2424

2525
<h2 class="feedzy-notice-title">
2626
<?php esc_html_e( 'Welcome to Feedzy!', 'feedzy-rss-feeds' ); ?>
@@ -31,7 +31,7 @@ class="feedzy-notice-dismiss"
3131
</p>
3232

3333
<form id="feedzy-subscribe-form" method="post" action="">
34-
<?php wp_nonce_field('feedzy_subscribe_nonce', 'feedzy_subscribe_nonce_field'); ?>
34+
<?php wp_nonce_field( 'feedzy_subscribe_nonce', 'feedzy_subscribe_nonce_field' ); ?>
3535

3636
<input
3737
type="email"
@@ -71,14 +71,14 @@ class="feedzy-subscribe"
7171
<div class="fz-tabs-menu">
7272
<ul>
7373
<li>
74-
<a href="<?php echo esc_url(admin_url('admin.php?page=feedzy-support&tab=help')); ?>"
75-
class="<?php echo 'help' === $active_tab ? 'active' : ''; ?>"><?php esc_html_e('Getting Started', 'feedzy-rss-feeds'); ?></a>
74+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=feedzy-support&tab=help' ) ); ?>"
75+
class="<?php echo 'help' === $active_tab ? 'active' : ''; ?>"><?php esc_html_e( 'Getting Started', 'feedzy-rss-feeds' ); ?></a>
7676
</li>
7777
<li>
78-
<a href="<?php echo esc_url(admin_url('admin.php?page=feedzy-support&tab=docs')); ?>"
79-
class="<?php echo 'docs' === $active_tab ? 'active' : ''; ?>"><?php esc_html_e('Documentation', 'feedzy-rss-feeds'); ?></a>
78+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=feedzy-support&tab=docs' ) ); ?>"
79+
class="<?php echo 'docs' === $active_tab ? 'active' : ''; ?>"><?php esc_html_e( 'Documentation', 'feedzy-rss-feeds' ); ?></a>
8080
</li>
81-
<?php if (!feedzy_is_pro()): ?>
81+
<?php if ( ! feedzy_is_pro() ) : ?>
8282
<li>
8383
<a href="<?php echo esc_url( admin_url( 'admin.php?page=feedzy-support&tab=feedzy-pro' ) ); ?>"
8484
class="<?php echo 'feedzy-pro' === $active_tab ? 'active' : ''; ?>"><?php esc_html_e( 'Free vs Pro', 'feedzy-rss-feeds' ); ?></a>
@@ -91,8 +91,8 @@ class="<?php echo 'license' === $active_tab ? 'active' : ''; ?>"><?php esc_html_
9191
</li>
9292
<?php endif; ?>
9393
<li>
94-
<a href="<?php echo esc_url(admin_url('admin.php?page=feedzy-support&tab=improve')); ?>"
95-
class="<?php echo 'improve' === $active_tab ? 'active' : ''; ?>"><?php esc_html_e('Help us improve!', 'feedzy-rss-feeds'); ?></a>
94+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=feedzy-support&tab=improve' ) ); ?>"
95+
class="<?php echo 'improve' === $active_tab ? 'active' : ''; ?>"><?php esc_html_e( 'Help us improve!', 'feedzy-rss-feeds' ); ?></a>
9696
</li>
9797
<li>
9898
<a href="<?php echo esc_url( admin_url( 'admin.php?page=feedzy-settings' ) ); ?>"
@@ -111,22 +111,22 @@ class="<?php echo 'integration' === $active_tab ? 'active' : ''; ?>">
111111
<?php $support_tab_heading = apply_filters( 'feedzy_support_tab_heading', '', $active_tab ); ?>
112112
<?php if ( ! empty( $support_tab_heading ) ) : ?>
113113
<li>
114-
<?php echo wp_kses_post($support_tab_heading); ?>
114+
<?php echo wp_kses_post( $support_tab_heading ); ?>
115115
</li>
116116
<?php endif; ?>
117117
</ul>
118118
</div>
119119

120120
<?php
121-
switch ($active_tab) {
121+
switch ( $active_tab ) {
122122
case 'help':
123-
load_template(FEEDZY_ABSPATH . '/includes/layouts/feedzy-tutorial.php');
123+
load_template( FEEDZY_ABSPATH . '/includes/layouts/feedzy-tutorial.php' );
124124
break;
125125
case 'docs':
126-
load_template(FEEDZY_ABSPATH . '/includes/layouts/feedzy-documentation.php');
126+
load_template( FEEDZY_ABSPATH . '/includes/layouts/feedzy-documentation.php' );
127127
break;
128128
case 'feedzy-pro':
129-
load_template(FEEDZY_ABSPATH . '/includes/layouts/feedzy-pro.php');
129+
load_template( FEEDZY_ABSPATH . '/includes/layouts/feedzy-pro.php' );
130130
break;
131131
case 'improve':
132132
load_template( FEEDZY_ABSPATH . '/includes/layouts/feedzy-improve.php' );
@@ -135,45 +135,45 @@ class="<?php echo 'integration' === $active_tab ? 'active' : ''; ?>">
135135
load_template( FEEDZY_ABSPATH . '/includes/layouts/feedzy-license.php' );
136136
break;
137137
default:
138-
$template = apply_filters('feedzy_support_tab_content', '', $active_tab);
139-
if (!empty($template)) {
140-
load_template($template);
138+
$template = apply_filters( 'feedzy_support_tab_content', '', $active_tab );
139+
if ( ! empty( $template ) ) {
140+
load_template( $template );
141141
}
142142
}
143143
?>
144144
</div>
145145
</div>
146-
<?php if (in_array($active_tab, array('help', 'docs'), true)): ?>
146+
<?php if ( in_array( $active_tab, array( 'help', 'docs' ), true ) ) : ?>
147147
<div class="feedzy-accordion-item need-help-box">
148148
<div class="feedzy-accordion-item__content">
149-
<h3 class="h3"><?php esc_html_e('Need help with Feedzy?', 'feedzy-rss-feeds'); ?></h3>
149+
<h3 class="h3"><?php esc_html_e( 'Need help with Feedzy?', 'feedzy-rss-feeds' ); ?></h3>
150150
<?php
151-
if (!defined('FEEDZY_PRO_VERSION')) {
152-
$upsell_link = tsdk_translate_link(tsdk_utmify(FEEDZY_UPSELL_LINK, 'dedicatedsupport'));
151+
if ( ! defined( 'FEEDZY_PRO_VERSION' ) ) {
152+
$upsell_link = tsdk_translate_link( tsdk_utmify( FEEDZY_UPSELL_LINK, 'dedicatedsupport' ) );
153153
?>
154154
<p>
155155
<?php
156156
echo wp_kses_post(
157157
wp_sprintf(
158158
// Translators: %1$s is the opening anchor tag for the upsell link, %2$s is the closing anchor tag.
159-
__('If you did not found an answer in our Knowledge Base, you can always ask for help from our community based forum or %1$s get dedicated support with our premium plans. %2$s', 'feedzy-rss-feeds'),
160-
'<a target="_blank" href="' . esc_url($upsell_link) . '">',
159+
__( 'If you did not found an answer in our Knowledge Base, you can always ask for help from our community based forum or %1$s get dedicated support with our premium plans. %2$s', 'feedzy-rss-feeds' ),
160+
'<a target="_blank" href="' . esc_url( $upsell_link ) . '">',
161161
'</a>'
162162
)
163163
);
164164
?>
165165
</p>
166166
<a href="https://wordpress.org/support/plugin/feedzy-rss-feeds/" class="btn btn-outline-primary"
167167
target="_blank">
168-
<?php esc_html_e('Community Forum', 'feedzy-rss-feeds'); ?>
168+
<?php esc_html_e( 'Community Forum', 'feedzy-rss-feeds' ); ?>
169169
</a>
170170
<?php
171171
} else {
172172
?>
173-
<p><?php echo wp_kses_post(wp_sprintf(__('If you didn\'t found an answer in our Knowledge Base, our dedicated support team standby to help you.', 'feedzy-rss-feeds'))); ?>
173+
<p><?php echo wp_kses_post( wp_sprintf( __( 'If you didn\'t found an answer in our Knowledge Base, our dedicated support team standby to help you.', 'feedzy-rss-feeds' ) ) ); ?>
174174
</p>
175175
<a href="https://store.themeisle.com/contact" class="btn btn-outline-primary"
176-
target="_blank"><?php esc_html_e('Contact Support', 'feedzy-rss-feeds'); ?></a>
176+
target="_blank"><?php esc_html_e( 'Contact Support', 'feedzy-rss-feeds' ); ?></a>
177177
<?php
178178
}
179179
?>
@@ -185,8 +185,8 @@ class="<?php echo 'integration' === $active_tab ? 'active' : ''; ?>">
185185

186186
<script>
187187
jQuery(document).ready(function($) {
188-
$('body').on('click', '.feedzy-notice-dismiss', function(e) {
189-
e.preventDefault();
188+
$('body').on('click', '.feedzy-notice-dismiss', function(e) {
189+
e.preventDefault();
190190
const $notice = $(this).closest('.feedzy-helper-notice');
191191
const $button = $(this);
192192
$button.prop('disabled', true);
@@ -211,57 +211,57 @@ class="<?php echo 'integration' === $active_tab ? 'active' : ''; ?>">
211211
$(this).remove();
212212
});
213213
});
214-
});
215-
216-
$('body').on('click', '.feedzy-subscribe', function(e) {
217-
e.preventDefault();
218-
219-
const $button = $(this);
220-
const withSubscribe = $(this).data('fz_subscribe');
214+
});
215+
216+
$('body').on('click', '.feedzy-subscribe', function(e) {
217+
e.preventDefault();
218+
219+
const $button = $(this);
220+
const withSubscribe = $(this).data('fz_subscribe');
221221

222-
/**
223-
* @type {HTMLFormElement}
224-
*/
225-
const subscriptionForm = document.getElementById('feedzy-subscribe-form');
222+
/**
223+
* @type {HTMLFormElement}
224+
*/
225+
const subscriptionForm = document.getElementById('feedzy-subscribe-form');
226226

227-
if (withSubscribe && subscriptionForm.checkValidity() === false) {
228-
subscriptionForm.reportValidity();
229-
return false;
230-
}
227+
if (withSubscribe && subscriptionForm.checkValidity() === false) {
228+
subscriptionForm.reportValidity();
229+
return false;
230+
}
231231

232-
const emailElement = $('#fz_subscribe_email');
233-
234-
emailElement.next('.fz-field-error').remove();
235-
236-
const postData = {
237-
action: 'feedzy_dashboard_subscribe',
238-
_wpnonce: $('#feedzy_subscribe_nonce_field').val(),
239-
integrate_with: 'shortcode'
240-
};
232+
const emailElement = $('#fz_subscribe_email');
233+
234+
emailElement.next('.fz-field-error').remove();
235+
236+
const postData = {
237+
action: 'feedzy_dashboard_subscribe',
238+
_wpnonce: $('#feedzy_subscribe_nonce_field').val(),
239+
integrate_with: 'shortcode'
240+
};
241241

242-
if (withSubscribe) {
243-
postData.with_subscribe = 1;
244-
postData.email = emailElement.val();
245-
}
242+
if (withSubscribe) {
243+
postData.with_subscribe = 1;
244+
postData.email = emailElement.val();
245+
}
246246

247-
$button.prop('disabled', true);
247+
$button.prop('disabled', true);
248248

249-
$.post(ajaxurl, postData, function(res) {
250-
if (res.success) {
251-
$('.feedzy-helper-notice').fadeOut(400, function() {
252-
$(this).remove();
253-
});
254-
255-
if (res.data && res.data.redirect_to) {
256-
window.location.href = res.data.redirect_to;
257-
}
258-
}
259-
260-
$button.prop('disabled', false);
261-
}).fail(function() {
262-
$button.prop('disabled', false);
263-
alert('An error occurred. Please try again.');
264-
});
265-
});
249+
$.post(ajaxurl, postData, function(res) {
250+
if (res.success) {
251+
$('.feedzy-helper-notice').fadeOut(400, function() {
252+
$(this).remove();
253+
});
254+
255+
if (res.data && res.data.redirect_to) {
256+
window.location.href = res.data.redirect_to;
257+
}
258+
}
259+
260+
$button.prop('disabled', false);
261+
}).fail(function() {
262+
$button.prop('disabled', false);
263+
alert('An error occurred. Please try again.');
264+
});
265+
});
266266
});
267267
</script>

0 commit comments

Comments
 (0)