Skip to content
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

Implement Black Friday 2019 banner #13736

Merged
merged 4 commits into from Oct 28, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Implement Black Friday 2019 banner

  • Loading branch information
jdevalk authored and igorschoester committed Oct 25, 2019
commit e88a0da86bd2b8d2ec8d875abbcda5eb2a61b131
@@ -1,11 +1,39 @@
<?php
class WPSEO_Admin_Banner {
class WPSEO_Admin_Banner implements WPSEO_WordPress_Integration {
/**
* Registers all hooks to WordPress.
*
* @return void
*/
public function register_hooks() {
add_action( 'admin_notices', array( $this, 'banner' ) );
}
/**
* WPSEO_Admin_Banner constructor.
* Render the admin banner.
*/
public function __construct() {
public function banner() {
if ( isset( $_GET['yst_dismiss_bf'] ) ) {
if ( $_GET['yst_dismiss_bf'] === '1' ) {
WPSEO_Options::set( 'bf_banner_2019_dismissed', true );
}
if ( $_GET['yst_dismiss_bf'] === '0' ) {
WPSEO_Options::set( 'bf_banner_2019_dismissed', false );
}
}
if ( WPSEO_Options::get( 'bf_banner_2019_dismissed' ) ) {
return;
}
$close_url = add_query_arg( array( 'yst_dismiss_bf' => 1 ) );
?>
<div class="yoast_bf_sale">
<a class="close" href="<?php echo $close_url; ?>" aria-label="Dismiss the Yoast Black Friday Banner">X</a>
<a class="target" href="https://yoa.st/bf-sale-2019"></a>
</div>
<?php
}
}
@@ -113,6 +113,7 @@ public function __construct() {
$integrations[] = new WPSEO_Schema_Person_Upgrade_Notification();
$integrations[] = new WPSEO_Tracking( 'https://tracking.yoast.com/stats', ( WEEK_IN_SECONDS * 2 ) );
$integrations[] = new WPSEO_Admin_Settings_Changed_Listener();
$integrations[] = new WPSEO_Admin_Banner();
$integrations = array_merge(
$integrations,
@@ -573,4 +573,35 @@ body.folded {
}
}


.yoast_bf_sale {
position: relative;
margin: 10px 0;
max-width: 1012px;
height: 100px;
background: url(../../images/yoasie_banner_bf.gif) no-repeat;
.close {
text-align: center;
position: absolute;
right: 5px;
top: 5px;
background: transparent;
color: #000;
border-radius: 50%;
width: 17px;
font-weight: bold;
text-decoration: none;
&:hover {
cursor: pointer;
color: #fff;
background: #000;
}
}
.target {
display: block;
width: 100%;
height: 100%;
&:hover {
cursor: url('../../images/crosshair.svg'), pointer;
}
}
}
@@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="24" height="24">
<circle cx="16" cy="16" r="11.35" fill="none" stroke="#e51a21" stroke-linecap="round" stroke-miterlimit="10"
stroke-width="2"/>
<line x1="16" y1="0.75" x2="16" y2="11.04" fill="none" stroke="#e51a21" stroke-linecap="round"
stroke-miterlimit="10" stroke-width="2"/>
<line x1="16" y1="20.87" x2="16" y2="31.16" fill="none" stroke="#e51a21" stroke-linecap="round"
stroke-miterlimit="10" stroke-width="2"/>
<line x1="0.79" y1="15.95" x2="11.09" y2="15.95" fill="none" stroke="#e51a21" stroke-linecap="round"
stroke-miterlimit="10" stroke-width="2"/>
<line x1="20.91" y1="15.95" x2="31.21" y2="15.95" fill="none" stroke="#e51a21" stroke-linecap="round"
stroke-miterlimit="10" stroke-width="2"/>
</svg>
@@ -29,6 +29,8 @@ class WPSEO_Option_Wpseo extends WPSEO_Option {
'ms_defaults_set' => false,
// Non-form field, should only be set via validation routine.
'version' => '', // Leave default as empty to ensure activation/upgrade works.
// Non-form field, should be set by dismissing banner.
'bf_banner_2019_dismissed' => false,
// Form fields.
'disableadvanced_meta' => true,
@@ -242,6 +244,7 @@ protected function validate_option( $dirty, $clean, $old ) {
* (and don't need to be either as long as the default is false).
*/
case 'ms_defaults_set':
case 'bf_banner_2019_dismissed':
if ( isset( $dirty[ $key ] ) ) {
$clean[ $key ] = WPSEO_Utils::validate_bool( $dirty[ $key ] );
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.