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 '/':
|
case '/':
|
||||||
return ContentActions::executeHome();
|
return ContentActions::executeHome();
|
||||||
|
case '/get':
|
||||||
|
return ContentActions::executeGet();
|
||||||
case '/postcommit':
|
case '/postcommit':
|
||||||
return OpsActions::executePostCommit();
|
return OpsActions::executePostCommit();
|
||||||
case '/list-subscribe':
|
case '/list-subscribe':
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*/
|
*/
|
||||||
class Session
|
class Session
|
||||||
{
|
{
|
||||||
|
const KEY_MAILCHIMP_LIST_IDS = 'mailchimp_list_ids';
|
||||||
|
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
session_start();
|
session_start();
|
||||||
|
|
|
@ -11,6 +11,13 @@ class ContentActions extends Actions
|
||||||
{
|
{
|
||||||
return ['page/home', []];
|
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()
|
// protected static function validateDownloadAccess()
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -26,8 +26,11 @@ class MailActions extends Actions
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mcApi = new Mailchimp();
|
$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.'));
|
Session::set('list_success', __('Great success! Welcome to LBRY.'));
|
||||||
}
|
}
|
||||||
else
|
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)
|
public static function prepareJoinList(array $vars)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*
|
*
|
||||||
* @author jeremy
|
* @author jeremy
|
||||||
*/
|
*/
|
||||||
class OpsActions
|
class OpsActions extends Actions
|
||||||
{
|
{
|
||||||
public static function executePostCommit()
|
public static function executePostCommit()
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,5 +9,8 @@
|
||||||
<input type="hidden" name="listId" value="<?php echo $listId ?>"/>
|
<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="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 ?>">
|
<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>
|
</div>
|
||||||
</form>
|
</form>
|
|
@ -12,6 +12,7 @@
|
||||||
<?php echo View::render('mail/joinList', [
|
<?php echo View::render('mail/joinList', [
|
||||||
'submitLabel' => 'Go',
|
'submitLabel' => 'Go',
|
||||||
'listId' => Mailchimp::LIST_GENERAL_ID,
|
'listId' => Mailchimp::LIST_GENERAL_ID,
|
||||||
|
'mergeFields' => ['CLI' => 'No'],
|
||||||
'btnClass' => 'btn-alt'
|
'btnClass' => 'btn-alt'
|
||||||
]) ?>
|
]) ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,16 +24,30 @@
|
||||||
</div>
|
</div>
|
||||||
<h1><?php echo __('I am a Linux or OS X user comfortable from the command line.') ?></h1>
|
<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>
|
<p class="pflow">Earn early adopter rewards and interact directly with developers via our Alpha client.</p>
|
||||||
<div class="content-inset">
|
<?php if (!$isSubscribed): ?>
|
||||||
<ul class="no-style">
|
<div class="spacer1">
|
||||||
<li>
|
<?php echo View::render('mail/joinList', [
|
||||||
<a href="/linux" class="link-primary"><span class="icon-linux"></span> Linux</a>
|
'submitLabel' => 'Go',
|
||||||
</li>
|
'listId' => Mailchimp::LIST_GENERAL_ID,
|
||||||
<li>
|
'mergeFields' => ['CLI' => 'Yes'],
|
||||||
<a href="/osx" class="link-primary"><span class="icon-apple"></span> OS X</a>
|
'returnUrl' => '/get?email=1'
|
||||||
</li>
|
]) ?>
|
||||||
</ul>
|
</div>
|
||||||
</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>
|
||||||
|
<a href="/linux" class="link-primary"><span class="icon-linux"></span> Linux</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/osx" class="link-primary"><span class="icon-apple"></span> OS X</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<div class="bg-image-full" style="background-image: url(/img/cover-home2.jpg)"></div>
|
<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]) ?>
|
<?php echo View::render('nav/header', ['isDark' => true]) ?>
|
||||||
<main class="column-fluid">
|
<main class="column-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
|
|
|
@ -3,4 +3,4 @@ include $_SERVER['ROOT_DIR'] . '/autoload.php';
|
||||||
|
|
||||||
i18n::register();
|
i18n::register();
|
||||||
Session::init();
|
Session::init();
|
||||||
Controller::dispatch($_SERVER['REQUEST_URI']);
|
Controller::dispatch(strtok($_SERVER['REQUEST_URI'], '?'));
|
Loading…
Add table
Reference in a new issue