Skip to content
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

Add expired message filter #89

Merged
merged 9 commits into from
Dec 4, 2024

Conversation

kadencewp
Copy link
Contributor

Add missing filter for expired key

@kadencewp kadencewp requested a review from defunctl December 2, 2024 17:38
Copy link
Contributor

@defunctl defunctl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something with sprintf might be a lot easier to read/adjust in the future and ensure we're escaping everything.

Maybe something like this (untested)?

Edited:

$message_link = apply_filters(
	'stellarwp/uplink/' . Config::get_hook_prefix() . '/messages/expired_key_link',
	'https://evnt.is/195y'
);

$renew_label = apply_filters(
	'stellarwp/uplink/' . Config::get_hook_prefix() . '/messages/renew_label',
	__( 'Renew Your License Now', '%TEXTDOMAIN%' )
);

$opens_in_new_window = apply_filters(
	'stellarwp/uplink/' . Config::get_hook_prefix() . '/messages/screen_reader_text',
	__( ' (opens in a new window)', '%TEXTDOMAIN%' )
);

$notice_text = apply_filters(
	'stellarwp/uplink/' . Config::get_hook_prefix() . '/messages/expired_key_notice',
	__( 'Your license is expired', '%TEXTDOMAIN%' )
);

$message_content = sprintf(
	'%s <a href="%s" target="_blank" class="button button-primary">%s<span class="screen-reader-text">%s</span></a>',
	esc_html( $notice_text ),
	esc_url( $message_link ),
	esc_html( $renew_label ),
	esc_html( $opens_in_new_window )
);

return sprintf(
	'<div class="notice notice-warning"><p>%s</p></div>',
	$message_content
);

@kadencewp
Copy link
Contributor Author

@defunctl Well I feel like being able to filter the whole thing is nice because then if I want two buttons or I don't want a link at all I can do that. Only filtering parts feels really limiting. I updated the code let me know what you think of that

@defunctl defunctl self-requested a review December 3, 2024 00:31
src/Uplink/Messages/Expired_Key.php Outdated Show resolved Hide resolved
tests/wpunit/Admin/NoticeTest.php Show resolved Hide resolved
@defunctl defunctl self-requested a review December 4, 2024 16:26
Copy link
Contributor

@defunctl defunctl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@kadencewp kadencewp merged commit 301a5d4 into bugfix/multisite-token-logic Dec 4, 2024
13 checks passed
@kadencewp kadencewp deleted the bugfix/missing-filter branch December 4, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants