Skip to content

Commit

Permalink
Add expring screen
Browse files Browse the repository at this point in the history
  • Loading branch information
fditrapani committed Sep 4, 2020
1 parent b335994 commit bcbafe6
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 3 deletions.
1 change: 1 addition & 0 deletions colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'white' => "#FFFFFF",
'background' => "#F3F6F8",
'text' => '#353535',
'success' => '#007E65',
'error' => '#FF001F',
'link' => '#1282D6',
'border' => '#DCDCDE'
Expand Down
24 changes: 22 additions & 2 deletions components.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function renderVerticalSpacer( $size = "20px" ) {
<!-- VerticalSpacer start -->
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="padding: 0" height="$size">&nbsp;</td>
<td style="padding: 0;" height="$size">&nbsp;</td>
</tr>
</table>
<!-- VerticalSpacer end -->
Expand Down Expand Up @@ -164,7 +164,6 @@ function renderUnorderedList( $list, $icon ) {
}

function renderItem( $itemTitle, $itemStatus, $itenStatusMessage, $itemDescription) {
$color = include("colors.php");
$title = renderBoldText( $itemTitle );
$status = renderBoldText( $itenStatusMessage, $itemStatus );
$description = renderRegularText( $itemDescription );
Expand Down Expand Up @@ -192,6 +191,27 @@ function renderItem( $itemTitle, $itemStatus, $itenStatusMessage, $itemDescripti
return $item;
}

function renderItemVariant( $itemTitle, $itemDescription, $itemStatus, $statusColor ) {
$title = renderBoldText( $itemTitle );
$verticalSpacer = renderVerticalSpacer("0px");
$horizontalRule = renderHorizontalRule();
$description = renderRegularText( $itemDescription );
$status = renderBoldText( $itemStatus, $statusColor );
$manageSubscriptionButton = renderTextButton("Manage Subscription");

$itemVariant = <<<EOD
$horizontalRule
<p style="margin-top: 20px;">
$title <br/>
$description
</p>
<span style="margin-right:16px;">$status</span> $manageSubscriptionButton
EOD;

return $itemVariant;
}

function renderPrimaryButton( $buttonCta ) {
$color = include("colors.php");

Expand Down
102 changes: 102 additions & 0 deletions expiring.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<html xmlns:v="urn:schemas-microsoft-com:vml">
<?php include("components.php") ?>
<?php include("styles.php") ?>
<?php include("colors.php"); ?>

<head>
<title>WordPress.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-us">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="format-detection" content="date=no">
<meta name="format-detection" content="telephone=no">
<meta name="format-detection" content="address=no">


</head>
<body bgcolor="<?php echo $color['background']; ?>" style="direction: ltr; background-color: <?php echo $color['background']; ?>; margin: 0; padding: 0;">
<style type="text/css">
<?php echo renderStyles() ?>
</style>

<?php
$product = renderItem(
"WordPress.com Personal",
$color["error"],
"Expires Aug 22, 2020",
"Plan for Filippo Di Trapani (<a href='#' class='text-link' style='color:" . $color["text"] . "'>" . renderRegularText("filippodt.wordpress.com") . "</a>)",
);
$button_cta = renderRegularText("Add another month for $3", $color["white"], "14px");
$button = renderPrimaryButton( $button_cta );
$manageSubscriptionButton = renderTextButton( "Manage subscription" );
$verticalSpacer = renderVerticalSpacer( "40px" );
$halfVerticalSpacer = renderVerticalSpacer( "20px" );
$featureTitle = renderSecondaryTitle( "Don’t loose out" );
$featureParagraph = "<p style='margin-top: 0'>" . renderRegularText("Please note that if you choose not to renew, these features will be removed from your site.") . "</p>";
$featureList = renderUnorderedList( array(
1 => renderRegularText("Ability to set filippodt.com as your primary address."),
2 => renderRegularText("Remove WordPress.com ads from your site."),
3 => renderRegularText("Access to live chat when you need immediate support."),
4 => renderRegularText("Increased storage space for your photos, audio files, or videos."),
), "warning");

$billingHistoryTitle = renderSecondaryTitle( "Billing history" );

$billingHistoryAccount =
renderBoldText( "Account" ) . "<br>" .
renderRegularText( "fditrapani" ) . "<br>" .
"<a href='#' class='text-link' style='color:" . $color["text"] . "; text-decoration: none'>" . renderRegularText("[email protected]") . "</a>" . "<br>" .
" <a href='#' class='text-link' style='color:" . $color["text"] . "'>" . renderRegularText( "Manage account" ) . "</a>";

$billingHistoryReceipt = renderBoldText("Receipt") . "<br>" .
renderRegularText( "#19681643" ). "<br>" .
" <a href='#' class='text-link' style='color:" . $color["text"] . "'>" . renderRegularText( "View receipt" ) . "</a>";


$billingContent = renderTwoColumn( $billingHistoryAccount, $billingHistoryReceipt);

$recentPurchaseTitle = renderSecondaryTitle("Recently renewed");
$horizontalRule = renderHorizontalRule();
$recentPurchaseDetails = renderItemVariant(
"filippodt.com",
".com domain registration",
"Renewed for $20 on July 22, 2020",
$color['success'] );

$supportContent = renderSupport();

$content = <<<EOD
$product
<table cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 16px;">
$button
</td>
<td>
$manageSubscriptionButton
</td>
</tr>
</table>
$verticalSpacer
$featureTitle
$featureParagraph
$featureList
$verticalSpacer
$billingHistoryTitle
$billingContent
$halfVerticalSpacer
$recentPurchaseTitle
$recentPurchaseDetails
$halfVerticalSpacer
$supportContent
$halfVerticalSpacer
EOD;

echo renderEmailTemplate( "Your plan is about to expire", $content );
?>
</body>
</html>
3 changes: 2 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

<?php
$listOfPages = renderUnorderedList( array(
2 => '<a href="expired.php" class="text-link">' . renderRegularText("Expired") . '</a>'
1 => '<a href="expired.php" class="text-link">' . renderRegularText("Expired") . '</a>',
2 => '<a href="expiring.php" class="text-link">' . renderRegularText("Expiring") . '</a>'
), "checkmark");

echo renderEmailTemplate( "Email templates", $listOfPages );
Expand Down

0 comments on commit bcbafe6

Please sign in to comment.