-
Notifications
You must be signed in to change notification settings - Fork 35
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
Marketing Notices for Black Friday. #2225
Changes from 14 commits
834bc5c
e163c74
bb50481
2ea5987
798dbd8
6ffbb00
2955ac0
2790e31
3800071
b8c45b6
08efbc1
2740084
4201ac5
21c009d
11ea932
65a55c2
55d63fb
a4b1b4d
44fe9dd
0cc425c
d76111e
557415b
fdab5a4
b239fee
8235425
5ba54c4
37ab593
3cfd0ec
b676cb2
6a053ab
6c5b0b7
3ca07a3
db9d4ee
6612db7
86a55bd
2d84873
fae268d
85b2add
fdbda1a
216664c
951bf72
5bbc440
13c2d9d
afcde72
189ce37
6cc1963
5c9c8ce
ce54952
95d8431
4fb9615
e6182b4
c498e72
110cc02
7c6cf49
3edd0e2
027f5c0
95d8f9a
65c5f20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: deprecated | ||
|
||
Removed deprecated classes: `Tribe\Admin\Notice\Marketing`, `Tribe\Admin\Notice\Marketing\Black_Friday`, `Tribe\Admin\Notice\Marketing\End_Of_Year_Sale`, `Tribe\Admin\Notice\Marketing\Stellar_Sale`, `Tribe\Admin\Notice\Conditional_Content\`, `Tribe\Admin\Notice\Marketing\Black_Friday`, `Tribe\Admin\Notice\Marketing\End_Of_Year_Sale`, `Tribe\Admin\Notice\Marketing\Stellar_Sale` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "tribe-common", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
Camwyn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"repository": "[email protected]:the-events-calendar/tribe-common.git", | ||
"_resourcepath": "src/resources", | ||
"_domainPath": "lang", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
<?php | ||
bordoni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
namespace TEC\Common\Admin\Conditional_Content; | ||
|
||
use TEC\Common\Admin\Settings_Sidebar; | ||
use Tribe\Utils\Element_Attributes as Attributes; | ||
use TEC\Common\Admin\Entities\Link; | ||
use TEC\Common\Admin\Entities\Image; | ||
use TEC\Common\Admin\Settings_Section; | ||
use Tribe\Utils\Date_I18n; | ||
|
||
/** | ||
* Set up for Black Friday promo. | ||
* | ||
* @since TBD | ||
*/ | ||
class Black_Friday extends Datetime_Conditional_Abstract { | ||
/** | ||
* @inheritdoc | ||
*/ | ||
bordoni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
protected string $slug = 'black_friday'; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
bordoni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
protected string $start_date = 'fourth Thursday of November'; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
bordoni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
protected string $end_date = 'November 30th'; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function hook(): void { | ||
add_action( 'tec_settings_sidebar_start', [ $this, 'include_sidebar_section' ] ); | ||
add_action( 'tribe_settings_below_tabs', [ $this, 'include_tickets_settings_section' ] ); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function get_start_time(): ?Date_I18n { | ||
$date = parent::get_start_time(); | ||
if ( null === $date ) { | ||
return null; | ||
} | ||
|
||
$date = $date->modify( '-3 days' ); | ||
|
||
return $date; | ||
} | ||
|
||
protected function should_display(): bool { | ||
return true; | ||
} | ||
bordoni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* Gets the content for the Black Friday promo. | ||
* | ||
* @since TBD | ||
* | ||
* @return string | ||
*/ | ||
protected function get_wide_banner_html(): string { | ||
$template_args = [ | ||
'image_src' => tribe_resource_url( 'images/hero-section-wide.jpg', false, null, \Tribe__Main::instance() ), | ||
'link' => 'https://evnt.is/tec-bf-2024', | ||
]; | ||
|
||
return $this->get_template()->template( 'black-friday', $template_args, false ); | ||
} | ||
|
||
/** | ||
* Render the wide banner HTML. | ||
* | ||
* @since TBD | ||
* | ||
* @return void | ||
*/ | ||
public function render_wide_banner_html(): void { | ||
if ( ! $this->should_display() ) { | ||
return; | ||
} | ||
echo $this->get_wide_banner_html(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | ||
} | ||
|
||
/** | ||
* Gets the content for the Black Friday promo. | ||
* | ||
* @since TBD | ||
* | ||
* @return string | ||
*/ | ||
protected function get_narrow_banner_html(): string { | ||
$template_args = [ | ||
'image_src' => tribe_resource_url( 'images/hero-section-narrow.jpg', false, null, \Tribe__Main::instance() ), | ||
'link' => 'https://evnt.is/tec-bf-2024', | ||
'is_narrow' => true, | ||
]; | ||
|
||
return $this->get_template()->template( 'black-friday', $template_args, false ); | ||
} | ||
|
||
/** | ||
* Render the narrow banner HTML. | ||
* | ||
* @since TBD | ||
* | ||
* @return void | ||
*/ | ||
public function render_narrow_banner_html(): void { | ||
if ( ! $this->should_display() ) { | ||
return; | ||
} | ||
echo $this->get_narrow_banner_html(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | ||
} | ||
|
||
/** | ||
* Include the Black Friday promo in the tickets settings section. | ||
* | ||
* @since TBD | ||
* | ||
* @return void | ||
*/ | ||
public function include_tickets_settings_section(): void { | ||
if ( ! $this->should_display() ) { | ||
return; | ||
} | ||
|
||
$page = tribe_get_request_var( 'page' ); | ||
if ( $page !== 'tec-tickets-settings' ) { | ||
return; | ||
} | ||
|
||
$this->render_narrow_banner_html(); | ||
} | ||
|
||
/** | ||
* Replace the opening markup for the general settings info box. | ||
* | ||
* @since TBD | ||
* | ||
* @param Settings_Sidebar $sidebar Sidebar instance. | ||
* | ||
* @return void | ||
*/ | ||
public function include_sidebar_section( $sidebar ): void { | ||
// Check if the content should currently be displayed. | ||
if ( ! $this->should_display() ) { | ||
return; | ||
} | ||
|
||
$year = date_i18n( 'Y' ); | ||
|
||
$sidebar->prepend_section( | ||
( new Settings_Section() ) | ||
->add_elements( | ||
[ | ||
new Link( | ||
'https://evnt.is/tec-bf-2024', | ||
new Image( | ||
tribe_resource_url( 'images/hero-section-settings-sidebar.jpg', false, null, \Tribe__Main::instance() ), | ||
new Attributes( | ||
[ | ||
'alt' => sprintf( esc_attr_x( '%1$s Black Friday Sale for The Events Calendar plugins, add-ons and bundles.', 'Alt text for the Black Friday Ad', 'tribe-common' ), $year ), | ||
'role' => 'presentation', | ||
] | ||
) | ||
), | ||
null, | ||
new Attributes( | ||
[ | ||
'title' => sprintf( esc_attr_x( '%1$s Black Friday Sale for The Events Calendar plugins, add-ons and bundles.', 'Alt text for the Black Friday Ad', 'tribe-common' ), $year ), | ||
'target' => '_blank', | ||
'rel' => 'noopener nofollow', | ||
] | ||
) | ||
), | ||
] | ||
) | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,27 +6,31 @@ | |||||
* @package Tribe\Admin\Conditional_Content; | ||||||
*/ | ||||||
|
||||||
namespace Tribe\Admin\Conditional_Content; | ||||||
namespace TEC\Common\Admin\Conditional_Content; | ||||||
|
||||||
use TEC\Common\Contracts\Service_Provider as Provider_Contract; | ||||||
|
||||||
/** | ||||||
* Conditional Content Provider. | ||||||
* Conditional Content Controller. | ||||||
* | ||||||
* @since 4.14.7 | ||||||
* @since TBD | ||||||
*/ | ||||||
class Service_Provider extends Provider_Contract { | ||||||
Camwyn marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
class Controller extends Provider_Contract { | ||||||
|
||||||
|
||||||
/** | ||||||
* Registers the required objects and filters. | ||||||
* | ||||||
* @since 4.14.7 | ||||||
* @since TBD | ||||||
*/ | ||||||
public function register() { | ||||||
// This is specifically for the admin, bail if we're not in the admin. | ||||||
if ( ! is_admin() ) { | ||||||
return; | ||||||
} | ||||||
|
||||||
$this->container->singleton( Black_Friday::class, Black_Friday::class, [ 'hook' ] ); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [phpcs] reported by reviewdog 🐶 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
// EOY Sale disabled for 2022 | ||||||
// $this->container->singleton( End_Of_Year_Sale::class, End_Of_Year_Sale::class, [ 'hook' ] ); | ||||||
|
||||||
$this->hooks(); | ||||||
} | ||||||
|
||||||
|
@@ -35,18 +39,16 @@ public function register() { | |||||
* | ||||||
* @since 4.14.7 | ||||||
*/ | ||||||
protected function hooks() { | ||||||
protected function hooks(): void { | ||||||
add_action( 'tribe_plugins_loaded', [ $this, 'plugins_loaded' ] ); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Setup for things that require plugins loaded first. | ||||||
* | ||||||
* @since 4.14.7 | ||||||
* @since TBD | ||||||
*/ | ||||||
public function plugins_loaded() { | ||||||
$this->container->make( Black_Friday::class ); | ||||||
// EOY Sale disabled for 2022 | ||||||
// $this->container->make( End_Of_Year_Sale::class ); | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be another of these? This only covers the deprecations.