-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unnecessary has_filter()
calls
#414
Remove unnecessary has_filter()
calls
#414
Conversation
$simplified_summary_heading = 'Simplified Summary'; | ||
|
||
// filter title. | ||
if ( has_filter( 'edac_filter_simplified_summary_heading' ) ) { | ||
$simplified_summary_heading = apply_filters( 'edac_filter_simplified_summary_heading', $simplified_summary_heading ); | ||
} | ||
$simplified_summary_heading = apply_filters( | ||
'edac_filter_simplified_summary_heading', | ||
esc_html__( 'Simplified Summary', 'accessibility-checker' ) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also made the text translatable
$notice = 'Whoops! It looks like your website is currently password protected. The free version of Accessibility Checker can only scan live websites. To scan this website for accessibility problems either remove the password protection or <a href="https://equalizedigital.com/accessibility-checker/pricing/" target="_blank" aria-label="upgrade to accessibility checker pro, opens in a new window">upgrade to pro</a>. Scan results may be stored from a previous scan.'; | ||
|
||
if ( has_filter( 'edac_filter_password_protected_notice_text' ) ) { | ||
$notice = apply_filters( 'edac_filter_password_protected_notice_text', $notice ); | ||
} | ||
|
||
return $notice; | ||
return apply_filters( | ||
'edac_filter_password_protected_notice_text', | ||
sprintf( | ||
// translators: %s is the link to upgrade to pro, with "upgrade to pro" as the anchor text. | ||
esc_html__( 'Whoops! It looks like your website is currently password protected. The free version of Accessibility Checker can only scan live websites. To scan this website for accessibility problems either remove the password protection or %s. Scan results may be stored from a previous scan.', 'accessibility-checker' ), | ||
sprintf( | ||
'<a href="https://equalizedigital.com/accessibility-checker/pricing/" target="_blank" aria-label="%1$s">%2$s</a>', | ||
esc_attr__( 'Upgrade to accessibility checker pro. Opens in a new window.', 'accessibility-checker' ), | ||
esc_html__( 'upgrade to pro', 'accessibility-checker' ) | ||
) | ||
) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also made sure the text for this notice is translatable and properly escaped.
if ( has_filter( 'replace_editor', 'gutenberg_init' ) ) { | ||
// Gutenberg is installed and activated. | ||
$gutenberg = true; | ||
} | ||
$gutenberg = has_filter( 'replace_editor', 'gutenberg_init' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we'd check if Gutenberg is active using a check like the one below:
$gutenberg = defined( 'IS_GUTENBERG_PLUGIN' );
That's something we can do in a followup PR when we rething a bit how we check for plugins 👍
There's no need to check if
has_filter
before applying filters.This PR removes the cases where
has_filter()
was not required.