| 1 |
<?php |
| 2 |
/** |
| 3 |
* Campaign registry. |
| 4 |
* |
| 5 |
* @package ULTP\Notice |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace ULTP\Includes\Notice; |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) || exit; |
| 11 |
|
| 12 |
/** |
| 13 |
* Every dated campaign notice PostX can show. This is the only file to edit for a new sale. |
| 14 |
* |
| 15 |
* To add a campaign, copy an entry from the matching list and change it: |
| 16 |
* - Use a new `key` every time. Reusing an old key brings back a dismissal the user made last time. |
| 17 |
* - Write dates as 'YYYY-MM-DD HH:MM Asia/Dhaka'. Start at 00:00, end at 23:59. |
| 18 |
* - Only list the settings that differ from the defaults in the notice class |
| 19 |
* (Banner_Notice, Content_Notice, Image_Notice). |
| 20 |
* |
| 21 |
* Past campaigns stay here as examples. They have ended, so they never display. |
| 22 |
* |
| 23 |
* When two campaigns are live at once they all show, in this order: banners, content notices, image banners. |
| 24 |
*/ |
| 25 |
final class Campaigns { |
| 26 |
|
| 27 |
/** |
| 28 |
* All campaigns, in display order. |
| 29 |
* |
| 30 |
* @return Abstract_Campaign_Notice[] |
| 31 |
*/ |
| 32 |
public static function all() { |
| 33 |
return array_merge( self::banners(), self::content_notices(), self::image_banners() ); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Hello bar ids the dashboard may dismiss. Every `id` in reactjs/src/dashboard/hellobar/index.js |
| 38 |
* must be listed here, or its bar can't be hidden: add the id here when you add a hello bar there. |
| 39 |
* |
| 40 |
* @return string[] |
| 41 |
*/ |
| 42 |
public static function hellobar_keys() { |
| 43 |
return array( |
| 44 |
'ultp_helloBar_summer_sale_2026_v1', |
| 45 |
'ultp_helloBar_summer_sale_2026_v1_2', |
| 46 |
'ultp_helloBar_base_price_2026', |
| 47 |
'ultp_helloBar_birthday_sale_2026_v1', |
| 48 |
); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Sales for the "Upgrade to Pro" link on the Plugins page. The first live one replaces the link's |
| 53 |
* text and UTM key; outside them it reads "Upgrade to Pro". Dates as for campaigns. |
| 54 |
* |
| 55 |
* @return array[] |
| 56 |
*/ |
| 57 |
public static function plugin_link_offers() { |
| 58 |
return array( |
| 59 |
array( |
| 60 |
'start' => '2026-07-06 00:00 Asia/Dhaka', |
| 61 |
'end' => '2026-08-01 23:59 Asia/Dhaka', |
| 62 |
'text' => __( 'Summer Sale - Up to 50% OFF', 'ultimate-post' ), |
| 63 |
'utm_key' => 'summer_sale_meta', |
| 64 |
), |
| 65 |
array( |
| 66 |
'start' => '2026-10-04 00:00 Asia/Dhaka', |
| 67 |
'end' => '2026-10-15 23:59 Asia/Dhaka', |
| 68 |
'text' => __( 'Enjoy 60% off', 'ultimate-post' ), |
| 69 |
'utm_key' => 'birthday', |
| 70 |
), |
| 71 |
); |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* Sales for the "Upgrade to Pro" item in the PostX menu. The first live one replaces the item's |
| 76 |
* text; outside them it reads "Upgrade to Pro". Dates as for campaigns. |
| 77 |
* |
| 78 |
* @return array[] |
| 79 |
*/ |
| 80 |
public static function menu_offers() { |
| 81 |
return array( |
| 82 |
array( |
| 83 |
'start' => '2026-01-01 00:00 Asia/Dhaka', |
| 84 |
'end' => '2026-02-15 23:59 Asia/Dhaka', |
| 85 |
'text' => __( 'New Year Offer!', 'ultimate-post' ), |
| 86 |
), |
| 87 |
); |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* Countdown banners. Images come from assets/img/dashboard_banner/{image_dir}/. |
| 92 |
* |
| 93 |
* @return Banner_Notice[] |
| 94 |
*/ |
| 95 |
private static function banners() { |
| 96 |
return array( |
| 97 |
new Banner_Notice( |
| 98 |
array( |
| 99 |
'key' => 'ultp_banner_flash_sale_2026_1', |
| 100 |
'start' => '2026-05-18 00:00 Asia/Dhaka', |
| 101 |
'end' => '2026-05-21 23:59 Asia/Dhaka', |
| 102 |
'image_dir' => 'flash_sale', |
| 103 |
'text' => 'Deal ending soon', |
| 104 |
'utm_key' => 'flash_sale_content', |
| 105 |
) |
| 106 |
), |
| 107 |
new Banner_Notice( |
| 108 |
array( |
| 109 |
'key' => 'ultp_banner_surprise_sale_2026_1', |
| 110 |
'start' => '2026-05-29 00:00 Asia/Dhaka', |
| 111 |
'end' => '2026-06-01 23:59 Asia/Dhaka', |
| 112 |
'image_dir' => 'surprise_sale', |
| 113 |
'text' => 'Limited Time Offer', |
| 114 |
'utm_key' => 'surprise_sale_content', |
| 115 |
) |
| 116 |
), |
| 117 |
new Banner_Notice( |
| 118 |
array( |
| 119 |
'key' => 'ultp_banner_massive_sale_2026_1', |
| 120 |
'start' => '2026-06-17 00:00 Asia/Dhaka', |
| 121 |
'end' => '2026-06-20 23:59 Asia/Dhaka', |
| 122 |
'image_dir' => 'massive_sale', |
| 123 |
'text' => 'Deal ending soon', |
| 124 |
'utm_key' => 'massive_sale_content', |
| 125 |
) |
| 126 |
), |
| 127 |
new Banner_Notice( |
| 128 |
array( |
| 129 |
'key' => 'ultp_banner_final_hours_sale_2026_1', |
| 130 |
'start' => '2026-06-28 00:00 Asia/Dhaka', |
| 131 |
'end' => '2026-06-30 23:59 Asia/Dhaka', |
| 132 |
'image_dir' => 'final_hours_sale', |
| 133 |
'text' => 'Hurry Before It Ends!', |
| 134 |
'utm_key' => 'final_hours_content', |
| 135 |
) |
| 136 |
), |
| 137 |
); |
| 138 |
} |
| 139 |
|
| 140 |
/** |
| 141 |
* Text and button notices. |
| 142 |
* |
| 143 |
* @return Content_Notice[] |
| 144 |
*/ |
| 145 |
private static function content_notices() { |
| 146 |
return array( |
| 147 |
new Content_Notice( |
| 148 |
array( |
| 149 |
'key' => 'ultp_dashboard_content_notice_summer_sale_2026_vv1', |
| 150 |
'start' => '2026-07-06 00:00 Asia/Dhaka', |
| 151 |
'end' => '2026-07-12 23:59 Asia/Dhaka', |
| 152 |
'utm_key' => 'summer_db', |
| 153 |
'content_heading' => __( 'Summer Sale:', 'ultimate-post' ), |
| 154 |
/* translators: %s: discount percentage */ |
| 155 |
'content_subheading' => __( 'Enjoy up to %s on PostX Pro.', 'ultimate-post' ), |
| 156 |
'discount_content' => ' 50% OFF', |
| 157 |
'icon' => ULTP_URL . 'assets/img/dashboard_banner/brand_logo.svg', |
| 158 |
'is_discount_logo' => true, |
| 159 |
) |
| 160 |
), |
| 161 |
new Content_Notice( |
| 162 |
array( |
| 163 |
'key' => 'ultp_dashboard_content_notice_birthday_sale_2026_v1', |
| 164 |
'start' => '2026-10-04 00:00 Asia/Dhaka', |
| 165 |
'end' => '2026-10-16 23:59 Asia/Dhaka', |
| 166 |
'utm_key' => 'birthday', |
| 167 |
'content_heading' => __( '7th Anniversary Offer:', 'ultimate-post' ), |
| 168 |
/* translators: %s: discount percentage */ |
| 169 |
'content_subheading' => __( 'Enjoy up to %s on PostX Pro.', 'ultimate-post' ), |
| 170 |
'discount_content' => ' 60% OFF', |
| 171 |
'icon' => ULTP_URL . 'assets/img/dashboard_banner/60-percent.png', |
| 172 |
'is_discount_logo' => true, |
| 173 |
) |
| 174 |
), |
| 175 |
); |
| 176 |
} |
| 177 |
|
| 178 |
/** |
| 179 |
* Full-image banners. |
| 180 |
* |
| 181 |
* @return Image_Notice[] |
| 182 |
*/ |
| 183 |
private static function image_banners() { |
| 184 |
return array( |
| 185 |
new Image_Notice( |
| 186 |
array( |
| 187 |
'key' => 'ultp_summer_sale_2612', |
| 188 |
'start' => '2026-07-20 00:00 Asia/Dhaka', |
| 189 |
'end' => '2026-08-01 23:59 Asia/Dhaka', |
| 190 |
'banner_src' => ULTP_URL . 'assets/img/dashboard_banner/dashboard_banner_summer_sale.png', |
| 191 |
'utm_key' => 'sub_menu_offer', |
| 192 |
) |
| 193 |
), |
| 194 |
new Image_Notice( |
| 195 |
array( |
| 196 |
'key' => 'ultp_summer_sale_2613', |
| 197 |
'start' => '2026-08-09 00:00 Asia/Dhaka', |
| 198 |
'end' => '2026-08-16 23:59 Asia/Dhaka', |
| 199 |
'banner_src' => ULTP_URL . 'assets/img/dashboard_banner/dashboard_banner_summer_sale.png', |
| 200 |
'utm_key' => 'sub_menu_offer', |
| 201 |
) |
| 202 |
), |
| 203 |
new Image_Notice( |
| 204 |
array( |
| 205 |
'key' => 'ultp_preco_sale_campaign_262_12', |
| 206 |
'start' => '2026-08-23 00:00 Asia/Dhaka', |
| 207 |
'end' => '2026-08-29 23:59 Asia/Dhaka', |
| 208 |
'banner_src' => ULTP_URL . 'assets/img/dashboard_banner/preco_banner_insider_deal.png', |
| 209 |
'url' => 'https://www.wpxpo.com/product/postx/?utm_source=db-postx-notice&utm_medium=insider-deal&utm_campaign=postx-dashboard/#pricing', |
| 210 |
'close_color' => '#ffffff', |
| 211 |
) |
| 212 |
), |
| 213 |
new Image_Notice( |
| 214 |
array( |
| 215 |
'key' => 'ultp_preco_sale_campaign_262_22', |
| 216 |
'start' => '2026-08-30 00:00 Asia/Dhaka', |
| 217 |
'end' => '2026-09-19 23:59 Asia/Dhaka', |
| 218 |
'banner_src' => ULTP_URL . 'assets/img/dashboard_banner/preco_banner_early_bird.png', |
| 219 |
'url' => 'https://www.wpxpo.com/product/postx/?utm_source=db-postx-notice&utm_medium=early-bird&utm_campaign=postx-dashboard/#pricing', |
| 220 |
'close_color' => '#ffffff', |
| 221 |
) |
| 222 |
), |
| 223 |
); |
| 224 |
} |
| 225 |
} |
| 226 |
|