Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/spbc-admin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/spbc-admin.min.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions js/src/spbc-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,13 @@ function spbcHandleBannersDismissing() {
jQuery('#spbct-notice-dismiss-success').fadeOut();
}, 5000);
}

// hide exclamation mark from admin bar, if other banner should be visible,
// this will be reloaded with the page
jQuery('#wp-admin-bar-cleantalk_admin_bar__parent_node')
.children('.ab-item')
.children('.spbc-icon-attention-alt')
.hide();
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function show()
}
}

abstract protected function needToShow();
abstract public function needToShow();

abstract protected function display();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(AdminBannersHandler $banners_handler)
*
* @return bool
*/
protected function needToShow()
public function needToShow()
{
if (
! $this->banners_handler->spbc->data['wl_mode_enabled'] &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(AdminBannersHandler $banners_handler)
*
* @return bool
*/
protected function needToShow()
public function needToShow()
{

if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(AdminBannersHandler $banners_handler)
*
* @return bool
*/
protected function needToShow()
public function needToShow()
{
if (
$this->banners_handler->spbc->notice_review &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct(AdminBannersHandler $banners_handler)
*
* @return bool
*/
protected function needToShow()
public function needToShow()
{
if (
$this->banners_handler->spbc->notice_show &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(AdminBannersHandler $banners_handler)
*
* @return bool
*/
protected function needToShow()
public function needToShow()
{
if (
! $this->banners_handler->spbc->key_is_ok &&
Expand Down
26 changes: 24 additions & 2 deletions lib/CleantalkSP/SpbctWP/AdminBannersModule/AdminBannersHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace CleantalkSP\SpbctWP\AdminBannersModule;

use CleantalkSP\SpbctWP\AdminBannersModule\AdminBanners\AdminBannerAbstract;
use CleantalkSP\SpbctWP\AdminBannersModule\AdminBanners\AdminBannerRenew;
use CleantalkSP\SpbctWP\AdminBannersModule\AdminBanners\AdminBannerReview;
use CleantalkSP\SpbctWP\AdminBannersModule\AdminBanners\AdminBannerTrial;
Expand Down Expand Up @@ -132,8 +133,29 @@ public function dismissBanner()

public function addAttentionMark($after)
{
if ( $this->spbc->notice_show ) {
return $after . '<i class="spbc-icon-attention-alt"></i>';
if ( $this->spbc->notice_show && !$this->isOnSpbcSettingsPage()) {
$add_mark = false;
foreach ($this->banners_register as $banner_class) {
if (!class_exists($banner_class)) {
continue;
}

// ignore review banner
if ( strpos($banner_class, 'AdminBannerReview') !== false ) {
continue;
}
/**
* @var AdminBannerAbstract $banner
*/
$banner = new $banner_class($this);
if ($banner instanceof AdminBannerAbstract && $banner->needToShow()) {
$add_mark = true;
break;
}
}
if ($add_mark) {
return $after . '<i class="spbc-icon-attention-alt"></i>';
}
}

return $after;
Expand Down
Loading
Loading