mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
switch to mailgun for mailing list join
This commit is contained in:
parent
ecce83e9a7
commit
0f5692290d
22 changed files with 614 additions and 2707 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -7,5 +7,6 @@
|
|||
/log
|
||||
/web/zohoverify
|
||||
nbproject
|
||||
|
||||
composer
|
||||
.ht*
|
||||
vendor/
|
||||
|
|
7
composer.json
Normal file
7
composer.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "lbry/lbry.io",
|
||||
"require": {
|
||||
"php": ">=7.0",
|
||||
"ext-curl": "*"
|
||||
}
|
||||
}
|
21
composer.lock
generated
Normal file
21
composer.lock
generated
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "37d65c68b462975921781df87dbfb52a",
|
||||
"content-hash": "a9b88596dfa02452b6d63461accdf07f",
|
||||
"packages": [],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=7.0",
|
||||
"ext-curl": "*"
|
||||
},
|
||||
"platform-dev": []
|
||||
}
|
|
@ -90,17 +90,20 @@ class Controller
|
|||
|
||||
$router->post('/postcommit', 'OpsActions::executePostCommit');
|
||||
$router->post('/log-upload', 'OpsActions::executeLogUpload');
|
||||
$router->post(['/list-subscribe', 'list-subscribe'], 'MailActions::executeListSubscribe');
|
||||
|
||||
$router->any('/list/subscribe', 'MailActions::executeSubscribe');
|
||||
$router->get('/list/confirm/{hash}', 'MailActions::executeConfirm');
|
||||
|
||||
$permanentRedirects = [
|
||||
'/lbry-osx-latest.dmg' => '/get',
|
||||
'/lbry-linux-latest.deb' => '/get',
|
||||
'/dl/lbry_setup.sh' => '/get',
|
||||
'/art' => '/what',
|
||||
'/why' => '/learn',
|
||||
'/feedback' => '/learn',
|
||||
'/faq/when-referral-payouts' => '/faq/referrals',
|
||||
'/lbry-osx-latest.dmg' => '/get',
|
||||
'/lbry-linux-latest.deb' => '/get',
|
||||
'/dl/lbry_setup.sh' => '/get',
|
||||
'/art' => '/what',
|
||||
'/why' => '/learn',
|
||||
'/feedback' => '/learn',
|
||||
'/faq/when-referral-payouts' => '/faq/referrals',
|
||||
'/news/meet-the-lbry-founders' => '/team',
|
||||
'/join-list' => '/list/subscribe',
|
||||
];
|
||||
|
||||
$tempRedirects = [
|
||||
|
@ -170,7 +173,7 @@ class Controller
|
|||
|
||||
public static function shutdown()
|
||||
{
|
||||
while($fn = array_shift(static::$queuedFunctions))
|
||||
while ($fn = array_shift(static::$queuedFunctions))
|
||||
{
|
||||
call_user_func($fn);
|
||||
}
|
||||
|
|
|
@ -6,10 +6,7 @@ class Session
|
|||
KEY_DOWNLOAD_ALLOWED = 'beta_download_allowed2',
|
||||
KEY_PREFINERY_USER_ID = 'prefinery_user_id',
|
||||
KEY_PREFINER_USED_CUSTOM_CODE = 'prefinery_used_custom_code',
|
||||
KEY_LIST_SUB_ERROR = 'list_error',
|
||||
KEY_LIST_SUB_SIGNATURE = 'list_sub_sig',
|
||||
KEY_LIST_SUB_SUCCESS = 'list_success',
|
||||
KEY_LIST_SUB_FB_EVENT = 'list_sub_fb_event';
|
||||
KEY_LIST_SUB_ERROR = 'list_error';
|
||||
|
||||
public static function init()
|
||||
{
|
||||
|
|
|
@ -86,13 +86,7 @@ class DownloadActions extends Actions
|
|||
{
|
||||
$referrerId = Request::getParam('referrer_id');
|
||||
$failure = false;
|
||||
try
|
||||
{
|
||||
MailActions::subscribeToMailchimp($email, Mailchimp::LIST_GENERAL_ID);
|
||||
}
|
||||
catch (MailchimpSubscribeException $e)
|
||||
{
|
||||
}
|
||||
Mailgun::sendSubscriptionConfirmation($email);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -2,77 +2,57 @@
|
|||
|
||||
class MailActions extends Actions
|
||||
{
|
||||
public static function executeListSubscribe()
|
||||
public static function executeSubscribe()
|
||||
{
|
||||
$nextUrl = Request::getPostParam('returnUrl', '/join-list');
|
||||
|
||||
if (!Request::isPost())
|
||||
{
|
||||
return Controller::redirect($nextUrl);
|
||||
return ['mail/subscribe'];
|
||||
}
|
||||
|
||||
Session::set(Session::KEY_LIST_SUB_SIGNATURE, Request::getPostParam('listSig', true));
|
||||
|
||||
$nextUrl = Request::getPostParam('returnUrl', '/');
|
||||
$email = Request::getPostParam('email');
|
||||
if (!$email|| !filter_var($email, FILTER_VALIDATE_EMAIL))
|
||||
if (!$email || !filter_var($email, FILTER_VALIDATE_EMAIL))
|
||||
{
|
||||
Session::set(Session::KEY_LIST_SUB_ERROR, $email ? __('Please provide a valid email address.') : __('Please provide an email address.'));
|
||||
}
|
||||
elseif (!Request::getPostParam('listId'))
|
||||
{
|
||||
Session::set(Session::KEY_LIST_SUB_ERROR, __('List not provided.'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$mcListId = htmlspecialchars(Request::getPostParam('listId'));
|
||||
$mergeFields = Request::getPostParam('mergeFields') ? (unserialize(Request::getPostParam('mergeFields')) ?: []) : [];
|
||||
try
|
||||
{
|
||||
static::subscribeToMailchimp($email, $mcListId, $mergeFields);
|
||||
Session::set(Session::KEY_LIST_SUB_SUCCESS, true);
|
||||
Session::set(Session::KEY_LIST_SUB_FB_EVENT, Request::getPostParam('fbEvent') ?? null);
|
||||
}
|
||||
catch (MailchimpSubscribeException $e)
|
||||
{
|
||||
Session::set(Session::KEY_LIST_SUB_SUCCESS, false);
|
||||
Session::set(Session::KEY_LIST_SUB_ERROR, $e->getMessage());
|
||||
}
|
||||
Session::set(Session::KEY_LIST_SUB_ERROR,
|
||||
$email ? __('Please provide a valid email address.') : __('Please provide an email address.'));
|
||||
|
||||
return Controller::redirect(Request::getRelativeUri());
|
||||
}
|
||||
|
||||
return Controller::redirect($nextUrl);
|
||||
$sent = Mailgun::sendSubscriptionConfirmation($email);
|
||||
if (!$sent)
|
||||
{
|
||||
return ['mail/subscribe', ['error' => __('email.subscribe_send_failed')]];
|
||||
}
|
||||
|
||||
return ['mail/subscribe', ['subscribeSuccess' => true, 'nextUrl' => $nextUrl]];
|
||||
}
|
||||
|
||||
public static function subscribeToMailchimp($email, $listId, array $mergeFields = [])
|
||||
public static function executeConfirm(string $hash)
|
||||
{
|
||||
$mcApi = new Mailchimp();
|
||||
$success = $mcApi->listSubscribe($listId, $email, $mergeFields, 'html', false);
|
||||
if (!$success)
|
||||
$email = Mailgun::checkConfirmHashAndGetEmail($hash);
|
||||
if ($email === null)
|
||||
{
|
||||
throw new MailchimpSubscribeException($mcApi->errorMessage ?: __('Something went wrong adding you to the list.'));
|
||||
return ['mail/subscribe', ['error' => __('email.invalid_confirm_hash')]];
|
||||
}
|
||||
return true;
|
||||
|
||||
$outcome = Mailgun::addToMailingList(Mailgun::LIST_GENERAL, $email);
|
||||
if ($outcome !== true)
|
||||
{
|
||||
return ['mail/subscribe', ['error' => $outcome]];
|
||||
}
|
||||
|
||||
return ['mail/subscribe', ['confirmSuccess' => true, 'learnFooter' => true]];
|
||||
}
|
||||
|
||||
public static function prepareJoinListPartial(array $vars)
|
||||
|
||||
|
||||
public static function prepareSubscribeFormPartial(array $vars)
|
||||
{
|
||||
$vars['listSig'] = md5(serialize($vars));
|
||||
$vars += ['btnClass' => 'btn-primary', 'returnUrl' => Request::getRelativeUri()];
|
||||
|
||||
if (Session::get(Session::KEY_LIST_SUB_SIGNATURE) == $vars['listSig'])
|
||||
{
|
||||
$vars['error'] = Session::get(Session::KEY_LIST_SUB_ERROR);
|
||||
Session::unsetKey(Session::KEY_LIST_SUB_ERROR);
|
||||
|
||||
$vars['success'] = Session::get(Session::KEY_LIST_SUB_SUCCESS) ? __('Great success! Welcome to LBRY.') : false;
|
||||
$vars['fbEvent'] = Session::get(Session::KEY_LIST_SUB_FB_EVENT) ?: 'Lead';
|
||||
Session::unsetKey(Session::KEY_LIST_SUB_SUCCESS);
|
||||
Session::unsetKey(Session::KEY_LIST_SUB_FB_EVENT);
|
||||
Session::unsetKey(Session::KEY_LIST_SUB_SIGNATURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$vars['success'] = false;
|
||||
}
|
||||
$vars['error'] = Session::get(Session::KEY_LIST_SUB_ERROR);
|
||||
Session::unsetKey(Session::KEY_LIST_SUB_ERROR);
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
|
|
@ -55,12 +55,22 @@ download:
|
|||
email:
|
||||
address: Email
|
||||
code: Invite Code
|
||||
disclaimer: You will receive 1-2 messages a month, only from LBRY, Inc. and only about LBRY. You can easily unsubscribe at any time.
|
||||
confirm_email_body: Please confirm your subscription to LBRY updates by clicking the link below.
|
||||
confirm_email_button: Confirm Subscription
|
||||
confirm_email_subject: Confirm Your Subscription to LBRY
|
||||
confirm_success: Great success! Welcome to LBRY.
|
||||
disclaimer: You will receive 1-2 messages a month, only from LBRY Inc. and only about LBRY. You can easily unsubscribe at any time.
|
||||
go: Go
|
||||
invalid_confirm_hash: This link is expired or invalid. Please enter your email address again.
|
||||
nocode: None, but I want in as soon as possible!
|
||||
placeholder: someone@somewhere.com
|
||||
return: Return to LBRY
|
||||
subs: Subscribe
|
||||
subscribe: Subscribe to our email list
|
||||
subscribe_needs_confirm: We sent you an email with a confirmation link. Click the link to complete your subscription.
|
||||
subscribe_send_failed: Something went wrong. Please enter your email address again.
|
||||
unsubs: unsubscribe
|
||||
unsubscribe: Don't want to stay on the bleeding edge of a content distribution revolution?
|
||||
updates: Get Updates
|
||||
yescode: "Yes"
|
||||
global:
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
|
||||
class MailchimpSubscribeException extends Exception {}
|
||||
|
||||
class Mailchimp extends MCAPI
|
||||
{
|
||||
const LIST_GENERAL_ID = '7b74c90030';
|
||||
|
||||
protected static $instance = null;
|
||||
|
||||
public function __construct($key = null)
|
||||
{
|
||||
if ($key === null)
|
||||
{
|
||||
$key = Config::get('mailchimp_key');
|
||||
}
|
||||
return parent::__construct($key);
|
||||
}
|
||||
//
|
||||
// public function listBatchSubscribeUsers($listId, $persons, Site $site)
|
||||
// {
|
||||
// $batch = [];
|
||||
// foreach($persons as $person)
|
||||
// {
|
||||
// $row = $site->isAdmin() ? $this->getMailchimpRowDataAdminSite($person) : $this->getMailchimpRowData($person, $site);
|
||||
// if ($row)
|
||||
// {
|
||||
// $batch[] = $row;
|
||||
// }
|
||||
// }
|
||||
// return $this->listBatchSubscribe($listId, $batch, false, true, false);
|
||||
// }
|
||||
//
|
||||
// protected function getMailchimpRowData($person, $site)
|
||||
// {
|
||||
// return [
|
||||
// 'EMAIL' => $person['email_address'],
|
||||
// 'FNAME' => $person['first_name'],
|
||||
// 'LNAME' => $person['last_name'],
|
||||
// 'GENDER' => $person['gender'],
|
||||
// 'USER_ID' => $person['id'],
|
||||
// 'USER_CULTURE' => $person['culture']
|
||||
// ];
|
||||
// }
|
||||
//
|
||||
// protected function getMailchimpRowDataAdminSite($person)
|
||||
// {
|
||||
// if (!preg_match('/@(' . implode('|', SiteDomainTable::getAllServiceDomainNames()) . ')$/', $person['email_address'])) //don't add @network addresses
|
||||
// {
|
||||
// $site = SiteTable::guessMostUsedSiteForPersonId($person['id']);
|
||||
// if (!$site)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// $organization = null;
|
||||
// if ($site->isMultiOrganization())
|
||||
// {
|
||||
// $organization = OrganizationTable::guessForNetworkSiteIdAndPersonId($site, $person['id']);
|
||||
// }
|
||||
// if (!$organization)
|
||||
// {
|
||||
// $organization = $site->Organization;
|
||||
// }
|
||||
// return $this->getMailchimpRowData($person, $site) + [
|
||||
// 'ORG_FULL' => $organization->full_name,
|
||||
// 'ABBR' => $organization->abbr,
|
||||
// 'SITE_NAME' => $site->name,
|
||||
// 'IS_ADMIN' => isset($site['is_admin']) && $site['is_admin'] ? 'Yes' : 'No',
|
||||
// 'URL' => $site->getPrimaryDomain()->getName(),
|
||||
// 'STATUS' => $site->is_public ? 'Public' : 'Private',
|
||||
// 'SERVICE' => $site->Service->name,
|
||||
// 'CULTURE' => $organization->culture,
|
||||
// 'USES_PAYMENTS' => PaymentServiceTable::count(['organization_id' => $organization['id'], 'is_enabled' => 1, 'type' => PaymentService::TYPE_TOPSCORE]) ? 'Yes' : 'No'
|
||||
// ];
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
90
lib/thirdparty/Mailgun.class.php
vendored
Normal file
90
lib/thirdparty/Mailgun.class.php
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
class Mailgun
|
||||
{
|
||||
const BASE_URL = 'https://api.mailgun.net/v3';
|
||||
|
||||
const LIST_GENERAL = 'lbryians@lbry.io';
|
||||
|
||||
public static function sendSubscriptionConfirmation($email)
|
||||
{
|
||||
$confirmHash = static::getConfirmHash($email);
|
||||
list($status, $headers, $body) = static::post('/lbry.io/messages', [
|
||||
'from' => 'LBRY <mail@lbry.io>',
|
||||
'to' => $email,
|
||||
'subject' => __('email.confirm_email_subject'),
|
||||
'html' => static::inlineCss(View::render('email_templates/_confirmHash', [
|
||||
'confirmHash' => $confirmHash
|
||||
])),
|
||||
'o:tracking-clicks' => 'no',
|
||||
'o:tracking-opens' => 'no'
|
||||
]);
|
||||
|
||||
return $status == 200;
|
||||
}
|
||||
|
||||
public static function addToMailingList($listAddress, $email)
|
||||
{
|
||||
list($status, $headers, $body) = static::post('/lists/' . $listAddress . '/members', [
|
||||
'address' => $email,
|
||||
// 'subscribed' => 'yes',
|
||||
// 'upsert' => 'no', //https://documentation.mailgun.com/api-mailinglists.html#mailing-lists
|
||||
]);
|
||||
|
||||
if ($status != 200)
|
||||
{
|
||||
return json_decode($body, true)['message'];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static function getConfirmHash($email, $timestamp = null, $nonce = null)
|
||||
{
|
||||
$timestamp = $timestamp !== null ? $timestamp : time();
|
||||
$nonce = $nonce !== null ? $nonce : bin2hex(random_bytes(8));
|
||||
$secret = Config::get('mailing_list_hmac_secret', 'testing');
|
||||
|
||||
return Encoding::base64EncodeUrlsafe(join('|', [
|
||||
$email, $timestamp, $nonce, hash_hmac('sha256', $email . $timestamp . $nonce, $secret)
|
||||
]));
|
||||
}
|
||||
|
||||
public static function checkConfirmHashAndGetEmail($hash)
|
||||
{
|
||||
$parts = explode('|', Encoding::base64DecodeUrlsafe($hash));
|
||||
if (count($parts) !== 4)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
list($email, $timestamp, $nonce, $signature) = $parts;
|
||||
|
||||
if (!hash_equals(static::getConfirmHash($email, $timestamp, $nonce), $hash))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!is_numeric($timestamp) || time() - $timestamp > 60 * 60 * 24 * 3)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return $email;
|
||||
}
|
||||
|
||||
protected static function post($endpoint, $data)
|
||||
{
|
||||
return Curl::doCurl(Curl::POST, self::BASE_URL . $endpoint, $data, [
|
||||
'headers' => [
|
||||
'Authorization: Basic ' . base64_encode('api:' . Config::get('mailgun_api_key'))
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
protected static function inlineCss($html, $css = '')
|
||||
{
|
||||
$e = new \Pelago\Emogrifier($html, $css);
|
||||
return trim($e->emogrify());
|
||||
}
|
||||
}
|
14
lib/tools/Encoding.class.php
Normal file
14
lib/tools/Encoding.class.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
class Encoding
|
||||
{
|
||||
public static function base64EncodeUrlsafe($data)
|
||||
{
|
||||
return rtrim(strtr(base64_encode($data), '+/', '-_'), '='); // equals sign is just for padding, can be safely removed
|
||||
}
|
||||
|
||||
public static function base64DecodeUrlsafe($data)
|
||||
{
|
||||
return base64_decode(strtr($data, '-_', '+/')); // dont worry about replacing equals sign
|
||||
}
|
||||
}
|
355
view/template/email_templates/_base.php
Normal file
355
view/template/email_templates/_base.php
Normal file
|
@ -0,0 +1,355 @@
|
|||
<?php ob_start() ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title><?php echo $title ?? '' ?></title>
|
||||
<style type="text/css">
|
||||
/* -------------------------------------
|
||||
GLOBAL
|
||||
A very basic CSS reset
|
||||
------------------------------------- */
|
||||
* {
|
||||
margin: 0;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
box-sizing: border-box;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-text-size-adjust: none;
|
||||
width: 100% !important;
|
||||
height: 100%;
|
||||
line-height: 1.6em;
|
||||
/* 1.6em * 14px = 22.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 22px;*/
|
||||
}
|
||||
|
||||
/* Let's make sure all tables have defaults */
|
||||
table td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
BODY & CONTAINER
|
||||
------------------------------------- */
|
||||
body {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.body-wrap {
|
||||
background-color: #f6f6f6;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: block !important;
|
||||
max-width: 600px !important;
|
||||
margin: 0 auto !important;
|
||||
/* makes it centered */
|
||||
clear: both !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
HEADER, FOOTER, MAIN
|
||||
------------------------------------- */
|
||||
.main {
|
||||
background-color: #fff;
|
||||
border: 1px solid #e9e9e9;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.content-block {
|
||||
padding: 0 0 20px;
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
/*width: 100%;*/
|
||||
clear: both;
|
||||
color: #999;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.footer p, .footer a, .footer td {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
TYPOGRAPHY
|
||||
------------------------------------- */
|
||||
h1, h2, h3 {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
color: #000;
|
||||
margin: 40px 0 0;
|
||||
line-height: 1.2em;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 32px;
|
||||
font-weight: 500;
|
||||
/* 1.2em * 32px = 38.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 38px;*/
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
/* 1.2em * 24px = 28.8px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 29px;*/
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 18px;
|
||||
/* 1.2em * 18px = 21.6px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 22px;*/
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
p, ul, ol {
|
||||
margin-bottom: 10px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
p li, ul li, ol li {
|
||||
margin-left: 5px;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
LINKS & BUTTONS
|
||||
------------------------------------- */
|
||||
a {
|
||||
color: #348eda;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
text-decoration: none;
|
||||
color: #FFF;
|
||||
background-color: #348eda;
|
||||
border: solid #348eda;
|
||||
border-width: 10px 20px;
|
||||
line-height: 2em;
|
||||
/* 2em * 14px = 28px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */
|
||||
/*line-height: 28px;*/
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
border-radius: 5px;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
OTHER STYLES THAT MIGHT BE USEFUL
|
||||
------------------------------------- */
|
||||
.last {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.first {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.aligncenter {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.alignright {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.alignleft {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
ALERTS
|
||||
Change the class depending on warning email, good email or bad email
|
||||
------------------------------------- */
|
||||
.alert {
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
border-radius: 3px 3px 0 0;
|
||||
}
|
||||
|
||||
.alert a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.alert.alert-warning {
|
||||
background-color: #FF9F00;
|
||||
}
|
||||
|
||||
.alert.alert-bad {
|
||||
background-color: #D0021B;
|
||||
}
|
||||
|
||||
.alert.alert-good {
|
||||
background-color: #68B90F;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
INVOICE
|
||||
Styles for the billing table
|
||||
------------------------------------- */
|
||||
.invoice {
|
||||
margin: 40px auto;
|
||||
text-align: left;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.invoice td {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
.invoice .invoice-items {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.invoice .invoice-items td {
|
||||
border-top: #eee 1px solid;
|
||||
}
|
||||
|
||||
.invoice .invoice-items .total td {
|
||||
border-top: 2px solid #333;
|
||||
border-bottom: 2px solid #333;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* -------------------------------------
|
||||
RESPONSIVE AND MOBILE FRIENDLY STYLES
|
||||
------------------------------------- */
|
||||
@media only screen and (max-width: 640px) {
|
||||
body {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4 {
|
||||
font-weight: 800 !important;
|
||||
margin: 20px 0 5px !important;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 22px !important;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.content-wrap {
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.invoice {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="body-wrap">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="container">
|
||||
<div class="content">
|
||||
<table class="main" width="100%" cellpadding="0" cellspacing="0">
|
||||
<?php if ($warning ?? false): ?>
|
||||
<tr>
|
||||
<td class="alert alert-warning"><?php echo $warning ?></td>
|
||||
</tr>
|
||||
<?php elseif ($info ?? false): ?>
|
||||
<tr>
|
||||
<td class="alert alert-info"><?php echo $info ?></td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
<tr>
|
||||
<td class="content-wrap">
|
||||
|
||||
<?php echo $body ?>
|
||||
|
||||
<div style="margin: 20px 0 0 0;">
|
||||
<?php echo $footer ?? '— LBRY' ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="footer">
|
||||
<table width="100%">
|
||||
<?php if ($unsubscribe ?? false): ?>
|
||||
<tr>
|
||||
<td class="aligncenter content-block">
|
||||
{{email.unsubscribe}} <a
|
||||
href="%mailing_list_unsubscribe_url%">{{email.unsubs}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
<tr>
|
||||
<td class="aligncenter content-block">
|
||||
<a href="https://lbry.io">LBRY Inc</a>
|
||||
• 521 Pine Street, Manchester, New Hampshire 03104
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
<?php $emailHtml = ob_get_clean() ?>
|
||||
<?php
|
||||
$e = new \Pelago\Emogrifier($emailHtml, '');
|
||||
echo trim($e->emogrify());
|
16
view/template/email_templates/_confirmHash.php
Normal file
16
view/template/email_templates/_confirmHash.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php $url = 'https://' . Request::getHost() . '/list/confirm/' . $confirmHash ?>
|
||||
<?php ob_start() ?>
|
||||
<meta itemprop="name" content="Confirm Subscription"/>
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="content-block">
|
||||
{{email.confirm_email_body}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-block" itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
|
||||
<a href="<?php echo $url ?>" class="btn-primary" itemprop="url">{{email.confirm_email_button}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo View::render('email_templates/_base', ['body' => ob_get_clean()]);
|
|
@ -1,35 +0,0 @@
|
|||
<?php $error = $error ?? null ?>
|
||||
<form action="/list-subscribe" method="post" novalidate>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
||||
<?php elseif ($success): ?>
|
||||
<?php js_start() ?>
|
||||
ga('send', 'event', 'Sign Up', 'Join List', '<?php echo $listId ?>');
|
||||
twttr.conversion.trackPid('nty1x');
|
||||
fbq('track', '<?php echo $fbEvent ?>');
|
||||
<?php js_end() ?>
|
||||
<div class="notice notice-success spacer1"><?php echo $success ?></div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($error || !$success): ?>
|
||||
<div class="mail-submit">
|
||||
<input type="hidden" name="returnUrl" value="<?php echo $returnUrl ?>"/>
|
||||
<input type="hidden" name="listId" value="<?php echo $listId ?>"/>
|
||||
<input type="hidden" name="listSig" value="<?php echo $listSig ?>"/>
|
||||
<input type="email" value="" name="email" class="required email standard" placeholder= "<?php echo __('email.placeholder') ?>">
|
||||
<input type="submit" value="<?php echo $submitLabel ?? __('email.subs') ?>" name="subscribe" class="<?php echo $btnClass ?>">
|
||||
<?php if (isset($fbEvent)): ?>
|
||||
<input type="hidden" name="fbEvent" value="<?php echo $fbEvent ?>" />
|
||||
<?php endif ?>
|
||||
<?php if (isset($mergeFields)): ?>
|
||||
<input type="hidden" name="mergeFields" value="<?php echo htmlentities(serialize($mergeFields)) ?>" />
|
||||
<?php endif ?>
|
||||
<?php if (isset($meta) && $meta): ?>
|
||||
<div class="meta">
|
||||
{{email.disclaimer}}
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</form>
|
14
view/template/mail/_subscribeForm.php
Normal file
14
view/template/mail/_subscribeForm.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php $error = $error ?? null ?>
|
||||
<form action="/list/subscribe" method="POST" novalidate>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="mail-submit">
|
||||
<input type="hidden" name="returnUrl" value="<?php echo $returnUrl ?>"/>
|
||||
<input type="email" value="" name="email" class="required email standard" placeholder="{{email.placeholder}}">
|
||||
<input type="submit" value="<?php echo $submitLabel ?? __('email.subs') ?>" name="subscribe" class="<?php echo $btnClass ?>">
|
||||
<div class="meta">{{email.disclaimer}}</div>
|
||||
</div>
|
||||
</form>
|
36
view/template/mail/subscribe.php
Normal file
36
view/template/mail/subscribe.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php Response::setMetaTitle(__('title.join')) ?>
|
||||
<?php Response::setMetaDescription(__('description.join')) ?>
|
||||
<?php echo View::render('nav/_header', ['isDark' => false]) ?>
|
||||
<main>
|
||||
<div class="content">
|
||||
<div class="row-fluid">
|
||||
<div class="span9">
|
||||
<h1>{{page.join}}</h1>
|
||||
<?php if ($confirmSuccess ?? false): ?>
|
||||
<?php if (IS_PRODUCTION): ?>
|
||||
<?php js_start() ?>
|
||||
ga('send', 'event', 'Sign Up', 'Join List', 'lbryians');
|
||||
twttr.conversion.trackPid('nty1x');
|
||||
fbq('track', 'Lead');
|
||||
<?php js_end() ?>
|
||||
<?php endif ?>
|
||||
<div class="notice notice-success spacer1">{{email.confirm_success}}</div>
|
||||
<?php elseif ($subscribeSuccess ?? false): ?>
|
||||
<div class="notice notice-success spacer1">{{email.subscribe_needs_confirm}}</div>
|
||||
<a class="link-primary" href="<?php echo $nextUrl ?? '/' ?>">{{email.return}}</a>
|
||||
<?php else: ?>
|
||||
<p>{{page.updates}}</p>
|
||||
<?php if ($error ?? false): ?>
|
||||
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
||||
<?php endif ?>
|
||||
<?php echo View::render('mail/_subscribeForm', ['returnUrl' => $nextUrl ?? '/']) ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<div class="span3">
|
||||
<h3>{{social.also}}</h3>
|
||||
<?php echo View::render('social/_list') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<?php echo View::render('nav/_footer', ['showLearnFooter' => $learnFooter ?? false]) ?>
|
|
@ -14,7 +14,7 @@
|
|||
</tr>
|
||||
</table>
|
||||
<ul>
|
||||
<li><a href="/join-list" class="link-primary"><?php echo __('email.subscribe') ?></a>.</li>
|
||||
<li><a href="/list/subscribe" class="link-primary"><?php echo __('email.subscribe') ?></a>.</li>
|
||||
<li>Join us on <a href="https://twitter.com/lbryio" class="link-primary"><span class="btn-label">Twitter</span><span class="icon icon-twitter"></span></a>,
|
||||
<a href="https://facebook.com/lbryio" class="link-primary"><span class="btn-label">Facebook</span><span class="icon icon-facebook"></span></a>,
|
||||
or <a href="https://reddit.com/r/lbry" class="link-primary"><span class="btn-label">Reddit</span><span class="icon icon-reddit"></span></a>.</li>
|
||||
|
|
|
@ -27,14 +27,7 @@
|
|||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<h3><?php echo __('email.updates') ?></h3>
|
||||
<?php echo View::render('mail/_joinList', [
|
||||
'submitLabel' => __('email.go'),
|
||||
'listId' => Mailchimp::LIST_GENERAL_ID,
|
||||
'mergeFields' => ['CLI' => 'No'],
|
||||
'meta' => true,
|
||||
'returnUrl' => '/',
|
||||
'btnClass' => 'btn-alt'
|
||||
]) ?>
|
||||
<?php echo View::render('mail/_subscribeForm', ['submitLabel' => __('email.go'), 'btnClass' => 'btn-alt']) ?>
|
||||
</div>
|
||||
<div class="span4 text-center">
|
||||
<div class="fb-page" data-href="https://www.facebook.com/lbryio" data-height="300" data-small-header="false" data-width="300"
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<?php Response::setMetaTitle(__('title.join')) ?>
|
||||
<?php Response::setMetaDescription(__('description.join')) ?>
|
||||
<?php echo View::render('nav/_header', ['isDark' => false ]) ?>
|
||||
<main>
|
||||
<div class="content">
|
||||
<div class="row-fluid">
|
||||
<div class="span9">
|
||||
<h1><?php echo __('page.join') ?></h1>
|
||||
<p>
|
||||
<?php echo __('page.updates') ?>
|
||||
</p>
|
||||
<?php echo View::render('mail/_joinList', [
|
||||
'submitLabel' => 'Subscribe',
|
||||
'returnUrl' => '/join-list',
|
||||
'meta' => true,
|
||||
'listId' => Mailchimp::LIST_GENERAL_ID
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="span3">
|
||||
<h3><?php echo __('social.also') ?></h3>
|
||||
<?php echo View::render('social/_list') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<?php echo View::render('nav/_footer') ?>
|
Loading…
Add table
Reference in a new issue