Skip to content

Commit

Permalink
Refactor: remove StellarBanner (#7472)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaHungDinh authored Aug 20, 2024
1 parent 3b0229b commit e0251ee
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 207 deletions.
53 changes: 0 additions & 53 deletions src/Promotions/InPluginUpsells/SaleBanners.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,59 +242,6 @@ public static function getDataByPricingPlan(array $data): string
return $data['default'];
}

/**
* @since 3.13.0
*
* This method cycles through the visible banners, selecting the next banner in the list
* on each call. If no banners are visible, or if the session index is not set, it returns
* all visible banners.
*/
public function alternateVisibleBanners(): array
{
$visibleBanners = $this->getVisibleBanners();
$bannerCount = count($visibleBanners);

if ($bannerCount > 0) {
$currentIndex = $_SESSION['banner_index'] ?? 0;

$selectedBanner = $visibleBanners[$currentIndex];

$currentIndex = ($currentIndex + 1) % $bannerCount;

$_SESSION['banner_index'] = $currentIndex;

if( !$selectedBanner){
$this->destroySession();
return $visibleBanners;
}

return [$selectedBanner];
}

return $visibleBanners;
}

/**
* @since 3.13.0
*/
public function startSession(): void
{
if (!session_id()) {
session_start();
}
}

/**
* @since 3.13.0
*/
public function destroySession(): void
{
if (session_id()) {
session_destroy();
}
}


/**
* @since 3.13.0
*/
Expand Down
143 changes: 0 additions & 143 deletions src/Promotions/InPluginUpsells/StellarSaleBanners.php

This file was deleted.

11 changes: 0 additions & 11 deletions src/Promotions/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ private function bootPluginUpsells()
Hooks::addAction('admin_enqueue_scripts', AddonsAdminPage::class, 'loadScripts');
}

if (SaleBanners::isShowing()) {
Hooks::addAction('admin_notices', SaleBanners::class, 'render');
Hooks::addAction('admin_enqueue_scripts', SaleBanners::class, 'loadScripts');
}

if (StellarSaleBanners::isShowing()) {
Hooks::addAction('admin_init', SaleBanners::class, 'startSession');
Hooks::addAction('admin_notices', StellarSaleBanners::class, 'render');
Hooks::addAction('admin_enqueue_scripts', StellarSaleBanners::class, 'loadScripts');
}

if (ReportsWidgetBanner::isShowing()) {
Hooks::addAction('admin_enqueue_scripts', ReportsWidgetBanner::class, 'loadScripts');
}
Expand Down

0 comments on commit e0251ee

Please sign in to comment.