mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
collect email on way in for get page, track user email as CLI user yes/no, fix deploy process (I think), and revise homepage meta
This commit is contained in:
parent
f432be9e73
commit
c36fb4b2af
9 changed files with 48 additions and 14 deletions
|
@ -39,6 +39,8 @@ class Controller
|
|||
{
|
||||
case '/':
|
||||
return ContentActions::executeHome();
|
||||
case '/get':
|
||||
return ContentActions::executeGet();
|
||||
case '/postcommit':
|
||||
return OpsActions::executePostCommit();
|
||||
case '/list-subscribe':
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
*/
|
||||
class Session
|
||||
{
|
||||
const KEY_MAILCHIMP_LIST_IDS = 'mailchimp_list_ids';
|
||||
|
||||
public static function init()
|
||||
{
|
||||
session_start();
|
||||
|
|
|
@ -11,6 +11,13 @@ class ContentActions extends Actions
|
|||
{
|
||||
return ['page/home', []];
|
||||
}
|
||||
|
||||
public static function executeGet()
|
||||
{
|
||||
return ['page/get', [
|
||||
'isSubscribed' => $_GET['email'] || in_array(Mailchimp::LIST_GENERAL_ID, Session::get(Session::KEY_MAILCHIMP_LIST_IDS, []))
|
||||
]];
|
||||
}
|
||||
//
|
||||
// protected static function validateDownloadAccess()
|
||||
// {
|
||||
|
|
|
@ -26,8 +26,11 @@ class MailActions extends Actions
|
|||
else
|
||||
{
|
||||
$mcApi = new Mailchimp();
|
||||
if ($mcApi->listSubscribe($_POST['listId'], $email, [], 'html', false))
|
||||
$mcListId = $_POST['listId'];
|
||||
$mergeFields = isset($_POST['mergeFields']) ? unserialize($_POST['mergeFields']) : [];
|
||||
if ($mcApi->listSubscribe($mcListId, $email, $mergeFields, 'html', false))
|
||||
{
|
||||
Session::set(Session::KEY_MAILCHIMP_LIST_IDS, array_merge(Session::get(Session::KEY_MAILCHIMP_LIST_IDS, []), [$mcListId]));
|
||||
Session::set('list_success', __('Great success! Welcome to LBRY.'));
|
||||
}
|
||||
else
|
||||
|
@ -36,7 +39,7 @@ class MailActions extends Actions
|
|||
}
|
||||
}
|
||||
|
||||
Controller::redirect($_POST['return_url'] ?: '/get');
|
||||
Controller::redirect(isset($_POST['return_url']) && $_POST['return_url'] ? $_POST['return_url'] : '/get');
|
||||
}
|
||||
|
||||
public static function prepareJoinList(array $vars)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* @author jeremy
|
||||
*/
|
||||
class OpsActions
|
||||
class OpsActions extends Actions
|
||||
{
|
||||
public static function executePostCommit()
|
||||
{
|
||||
|
|
|
@ -9,5 +9,8 @@
|
|||
<input type="hidden" name="listId" value="<?php echo $listId ?>"/>
|
||||
<input type="email" value="" name="email" class="required email standard" placeholder="someone@somewhere.com">
|
||||
<input type="submit" value="<?php echo isset($submitLabel) ? $submitLabel : 'Subscribe' ?>" name="subscribe" id="mc-embedded-subscribe" class="<?php echo $btnClass ?>">
|
||||
<?php if (isset($mergeFields)): ?>
|
||||
<input type="hidden" name="mergeFields" value="<?php echo htmlentities(serialize($mergeFields)) ?>" />
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</form>
|
|
@ -12,6 +12,7 @@
|
|||
<?php echo View::render('mail/joinList', [
|
||||
'submitLabel' => 'Go',
|
||||
'listId' => Mailchimp::LIST_GENERAL_ID,
|
||||
'mergeFields' => ['CLI' => 'No'],
|
||||
'btnClass' => 'btn-alt'
|
||||
]) ?>
|
||||
</div>
|
||||
|
@ -23,6 +24,19 @@
|
|||
</div>
|
||||
<h1><?php echo __('I am a Linux or OS X user comfortable from the command line.') ?></h1>
|
||||
<p class="pflow">Earn early adopter rewards and interact directly with developers via our Alpha client.</p>
|
||||
<?php if (!$isSubscribed): ?>
|
||||
<div class="spacer1">
|
||||
<?php echo View::render('mail/joinList', [
|
||||
'submitLabel' => 'Go',
|
||||
'listId' => Mailchimp::LIST_GENERAL_ID,
|
||||
'mergeFields' => ['CLI' => 'Yes'],
|
||||
'returnUrl' => '/get?email=1'
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="meta">
|
||||
Already sign up or really hate sharing your email? <a href="/get?email=1" class="link-primary">Click here.</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="content-inset">
|
||||
<ul class="no-style">
|
||||
<li>
|
||||
|
@ -33,6 +47,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<div class="bg-image-full" style="background-image: url(/img/cover-home2.jpg)"></div>
|
||||
<?php Response::setMetaTitle(__('LBRY - Watch, Share, Earn')) ?>
|
||||
<?php Response::setMetaDescription(__('Learn about LBRY, a peer-to-peer, decentralized content marketplace.')) ?>
|
||||
<?php echo View::render('nav/header', ['isDark' => true]) ?>
|
||||
<main class="column-fluid">
|
||||
<div class="span12">
|
||||
|
|
|
@ -3,4 +3,4 @@ include $_SERVER['ROOT_DIR'] . '/autoload.php';
|
|||
|
||||
i18n::register();
|
||||
Session::init();
|
||||
Controller::dispatch($_SERVER['REQUEST_URI']);
|
||||
Controller::dispatch(strtok($_SERVER['REQUEST_URI'], '?'));
|
Loading…
Add table
Reference in a new issue