PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / Promotions / ReportsWidgetBanner / ReportsWidgetBanner.php

ReportsWidgetBanner.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Promotions/ReportsWidgetBanner/ReportsWidgetBanner.php

65 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Promotions\ReportsWidgetBanner;
4
5 use Give\Promotions\InPluginUpsells\SaleBanners;
6
7 /**
8 * @since 3.13.0
9 */
10 class ReportsWidgetBanner extends SaleBanners
11 {
12
13 /**
14 @since 3.13.0
15 */
16 public function getBanners(): array
17 {
18 return [
19 [
20 'id' => 'bfgt2024-reports-widget',
21 'header' => __('Make it yours. Save 40% on all GiveWP products.', 'give'),
22 'actionText' => __('Shop Now', 'give'),
23 'actionUrl' => 'https://go.givewp.com/40sale24',
24 'startDate' => '2024-07-23 00:00',
25 'endDate' => '2024-07-30 23:59',
26 ],
27 ];
28 }
29
30 /**
31 * @since 3.13.0
32 */
33 public function loadScripts(): void
34 {
35 wp_enqueue_script(
36 'give-in-plugin-upsells-sale-banners',
37 GIVE_PLUGIN_URL . 'build/assets/dist/js/admin-upsell-sale-banner.js',
38 [],
39 GIVE_VERSION,
40 true
41 );
42
43 wp_localize_script(
44 'give-in-plugin-upsells-sale-banners',
45 'giveReportsWidget',
46 [
47 'apiRoot' => esc_url_raw(rest_url('give-api/v2/sale-banner')),
48 'apiNonce' => wp_create_nonce('wp_rest'),
49 'banner' => $this->getVisibleBanners()[0],
50 ]
51 );
52 }
53
54 /**
55 * @since 3.13.0
56 */
57 public static function isShowing(): bool
58 {
59 $hasBanners = !empty((new ReportsWidgetBanner())->getVisibleBanners());
60 $isDashboardWidgetPage = admin_url() . 'index.php' === get_site_url() . $_SERVER['REQUEST_URI'];
61
62 return $hasBanners && $isDashboardWidgetPage;
63 }
64 }
65