Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions inc/options/cdn-fsd-marketing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php
/**
* File: cdn-fsd-marketing.php
*
* @since X.X.X
*
* @package W3TC
*/

namespace W3TC;

defined( 'W3TC' ) || die;

Util_Ui::postbox_header(
esc_html__( 'Upgrade Opportunities', 'w3-total-cache' ),
'',
'full-site-delivery-upsell'
);
?>
<div class="w3tc-fsd-marketing">
<?php
if ( ! $is_w3tc_pro ) {
?>
<div class="w3tc-gopro-manual-wrap">
<?php Util_Ui::pro_wrap_maybe_start(); ?>
<p>
<?php
esc_html_e(
'Full-Site Delivery (FSD) is a W3 Total Cache Pro feature that serves every page and asset through a CDN provider for the fastest experience available.',
'w3-total-cache'
);
?>
</p>
<p>
<?php
esc_html_e(
'Upgrade today to unlock premium support and edge caching for HTML, media, CSS, and JavaScript via CDN.',
'w3-total-cache'
);
?>
</p>
<?php Util_Ui::pro_wrap_maybe_end( 'cdn_fsd', true ); ?>
</div>
<?php
}

if ( ! $is_totalcdn_authorized ) {
?>
<div id="w3tc-tcdn-ad-fsd">
<img class="w3tc-tcdn-icon" src="<?php echo esc_url( plugins_url( '/pub/img/w3total-cdn-teal.svg', W3TC_FILE ) ); ?>" alt="<?php echo esc_attr( W3TC_CDN_NAME ); ?> icon">
<p>
<?php
printf(
// translators: %s: CDN brand name.
esc_html__(
'Deliver your entire site through %s with Full-Site Delivery.',
'w3-total-cache'
),
esc_html( W3TC_CDN_NAME )
);
?>
</p>
<input type="button" class="button-buy-tcdn" data-renew-key="<?php echo esc_attr( $license_key ); ?>" data-src="cdn_page_fsd_totalcdn" value="<?php esc_attr_e( 'Get Total CDN', 'w3-total-cache' ); ?>">
</div>
<?php
} elseif ( $is_w3tc_pro && $is_totalcdn_static ) {
?>
<div class="notice notice-info inline w3tc-fsd-notice">
<p>
<?php
printf(
// translators: 1 CDN brand name, 2 opening a tag to CDN section on general settings page, 3 closing a tag.
esc_html__(
'You\'re already using %1$s for static asset delivery. To enable full-site delivery - which caches HTML, media, and scripts on the same global edge for even faster performance - %2$sGo to your General Settings page%3$s and enable Full-Site Delivery (FSD).',
'w3-total-cache'
),
esc_html( W3TC_CDN_NAME ),
'<a target="_blank" href="' . esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#cdn' ) ) . '">',
'</a>'
);
?>
</p>
</div>
<?php
} elseif ( $is_w3tc_pro && ! $is_totalcdn_fsd ) {
?>
<div class="notice notice-info inline w3tc-fsd-notice">
<p>
<?php
printf(
// translators: 1 CDN brand name, 2 opening a tag to CDN section on general settings page, 3 closing a tag.
esc_html__(
'You\'re %1$s account is ready for Full-Site Delivery. To enable full-site delivery - which caches HTML, media, and scripts on the same global edge for even faster performance - %2$sGo to your General Settings page%3$s and enable Full-Site Delivery (FSD).',
'w3-total-cache'
),
esc_html( W3TC_CDN_NAME ),
'<a target="_blank" href="' . esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#cdn' ) ) . '">',
'</a>'
);
?>
</p>
</div>
<?php
}
?>
</div>
<?php Util_Ui::postbox_footer(); ?>
17 changes: 17 additions & 0 deletions inc/options/cdn.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,23 @@
<?php Util_Ui::postbox_footer(); ?>
<?php endif; ?>

<?php
$is_cdnfsd_active = ( $cdnfsd_enabled && $is_cdnfsd_authorized );
$is_w3tc_pro = Util_Environment::is_w3tc_pro( $config );
$is_totalcdn_authorized = Cdn_TotalCdn_Util::is_totalcdn_authorized();
$is_totalcdn_static = $cdn_enabled && 'totalcdn' === $cdn_engine && $is_totalcdn_authorized;
$is_totalcdn_fsd = $cdnfsd_enabled && 'totalcdn' === $cdnfsd_engine && $is_totalcdn_authorized;
$license_key = $config->get_string( 'plugin.license_key' );

if (
! $is_w3tc_pro
|| ! $is_totalcdn_authorized
|| ( $is_w3tc_pro && $is_totalcdn_authorized && ! $is_totalcdn_fsd )
) {
include W3TC_INC_DIR . '/options/cdn-fsd-marketing.php';
}
?>

<?php do_action( 'w3tc_settings_box_cdnfsd' ); ?>

<?php
Expand Down
28 changes: 19 additions & 9 deletions pub/css/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,8 @@ td .w3tc-control-after span {
}

#w3tc-tcdn-ad-general,
#w3tc-tcdn-ad-cdn {
#w3tc-tcdn-ad-cdn,
#w3tc-tcdn-ad-fsd {
background: linear-gradient(270deg, rgba(0,0,0,0.16) 0%, rgba(132, 132, 132, 0.00) 100%), url(../img/upsell-darker.png);
background-size: cover;
background-position-y: 27%;
Expand All @@ -1408,7 +1409,8 @@ td .w3tc-control-after span {
line-height: normal;
}

#w3tc-tcdn-ad-general p {
#w3tc-tcdn-ad-general p,
#w3tc-tcdn-ad-fsd p {
color: #FFF;
text-shadow: 2px 2px 4px #000;
font-family: Roboto;
Expand All @@ -1418,7 +1420,8 @@ td .w3tc-control-after span {
line-height: normal;
}

#w3tc-tcdn-ad-general .w3tc-tcdn-icon {
#w3tc-tcdn-ad-general .w3tc-tcdn-icon,
#w3tc-tcdn-ad-fsd .w3tc-tcdn-icon {
width: 93.27px;
height: 49.148px;
flex-shrink: 0;
Expand All @@ -1431,7 +1434,8 @@ td .w3tc-control-after span {
}

#w3tc-tcdn-ad-general input,
#w3tc-tcdn-ad-cdn input {
#w3tc-tcdn-ad-cdn input,
#w3tc-tcdn-ad-fsd input {
display: flex;
height: 44px;
padding: 4.082px 17.008px;
Expand All @@ -1457,12 +1461,14 @@ td .w3tc-control-after span {
font-size: 22.314px;
}
#w3tc-tcdn-ad-general input:hover,
#w3tc-tcdn-ad-cdn input:hover {
#w3tc-tcdn-ad-cdn input:hover,
#w3tc-tcdn-ad-fsd input:hover {
box-shadow: 0 0 8.958px 4px rgba(255, 255, 255, 0.75);
}

#w3tc-tcdn-ad-general input:focus,
#w3tc-tcdn-ad-cdn input:focus {
#w3tc-tcdn-ad-cdn input:focus,
#w3tc-tcdn-ad-fsd input:focus {
box-shadow: 0 0 8.958px 4px rgba(255, 255, 255, 0.61);
}

Expand Down Expand Up @@ -1811,20 +1817,24 @@ td .w3tc-control-after span {
}

#w3tc-tcdn-ad-cdn,
#w3tc-tcdn-ad-general {
#w3tc-tcdn-ad-general,
#w3tc-tcdn-ad-fsd {
flex-direction: column;
}

#w3tc-tcdn-ad-cdn strong,
#w3tc-tcdn-ad-cdn .w3tc-tcdn-promotion-button,
#w3tc-tcdn-ad-cdn .w3tc-tcdn-logo,
#w3tc-tcdn-ad-general strong,
#w3tc-tcdn-ad-general .w3tc-tcdn-promotion-button {
#w3tc-tcdn-ad-general .w3tc-tcdn-promotion-button,
#w3tc-tcdn-ad-fsd strong,
#w3tc-tcdn-ad-fsd .w3tc-tcdn-promotion-button {
margin: 10px 0;
}

#w3tc-tcdn-ad-cdn .w3tc-tcdn-promotion-button,
#w3tc-tcdn-ad-general .w3tc-tcdn-promotion-button {
#w3tc-tcdn-ad-general .w3tc-tcdn-promotion-button,
#w3tc-tcdn-ad-fsd .w3tc-tcdn-promotion-button {
margin-top: 10px;
}
}
Expand Down