-
Notifications
You must be signed in to change notification settings - Fork 8
New. Banners. New banner design #834
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
Merged
+1,305
−338
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d2af814
New. Banners. New banner design
AntonV1211 34e1cc4
Merge dev
AntonV1211 53b6b6d
fix debug
AntonV1211 08d570d
Fix review
AntonV1211 bb7392d
fix psalm
AntonV1211 84e4d54
Fixs layout, texts
AntonV1211 9f6c730
fixs phpcs error
AntonV1211 8308fcf
Fix. Wizarg. Edit style
AntonV1211 2422098
merge dev
AntonV1211 b1f7664
Merge dev
AntonV1211 3508f8b
Mod. Banners. Edit layout full page banner
AntonV1211 efb3507
Mod. Banners. Bringing banners to a unified look with spbct
AntonV1211 b5368ae
Merge dev
AntonV1211 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
lib/Cleantalk/ApbctWP/AdminBannersModule/AdminBannerAbstract.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| <?php | ||
|
|
||
| namespace Cleantalk\ApbctWP\AdminBannersModule; | ||
|
|
||
| abstract class AdminBannerAbstract | ||
| { | ||
| /** | ||
| * @var string | ||
| */ | ||
| protected $prefix = 'cleantalk_'; | ||
|
|
||
| /** | ||
| * Hiding time in days | ||
| */ | ||
| const HIDING_TIME = 14; | ||
|
|
||
| /** | ||
| * @var string | ||
| */ | ||
| protected $banner_id; | ||
|
|
||
| /** | ||
| * Show the banner if conditions are met | ||
| * | ||
| * @return void | ||
| */ | ||
| public function show() | ||
| { | ||
| if ($this->needToShow()) { | ||
| $this->display(); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Check if banner needs to be shown | ||
| * | ||
| * @return bool | ||
| */ | ||
| abstract protected function needToShow(); | ||
|
|
||
| /** | ||
| * Output the banner HTML | ||
| * | ||
| * @return void | ||
| */ | ||
| abstract protected function display(); | ||
|
|
||
| /** | ||
| * Check if the banner was dismissed by the user | ||
| * | ||
| * @return bool | ||
| */ | ||
| protected function isDismissed() | ||
| { | ||
| $uid = get_current_user_id(); | ||
| $dismissed_date = get_option($this->banner_id . '_' . $uid . '_dismissed'); | ||
|
|
||
| if ($dismissed_date !== false && \Cleantalk\Common\Helper::dateValidate($dismissed_date)) { | ||
| $current_date = date_create(); | ||
| $notice_date = date_create($dismissed_date); | ||
|
|
||
| $diff = date_diff($current_date, $notice_date); | ||
|
|
||
| if ($diff->days <= static::HIDING_TIME) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.