add sass compiler, fix update script, fix ROOT_DIR, create Config class

This commit is contained in:
Alex Grintsvayg 2016-03-07 14:21:17 -05:00
parent beeeabb29a
commit f69e08ed6e
49 changed files with 10667 additions and 739 deletions

11
.gitattributes vendored Normal file
View file

@ -0,0 +1,11 @@
# Auto detect text files and perform LF normalization
* text=auto
*.php text diff=php
*.html text
*.css text
*.scss text
*.js text
*.sql text
*.svg -text

2
.gitignore vendored
View file

@ -1,5 +1,5 @@
.sass-cache .sass-cache
/web/css /web/css/*
/log /log
/data/secret /data/secret
/web/zohoverify /web/zohoverify

View file

@ -9,7 +9,7 @@ class Autoloader
{ {
return true; return true;
} }
$class = strtolower($class); $class = strtolower($class);
$path = isset(static::$classes[$class]) ? static::$classes[$class] : false; $path = isset(static::$classes[$class]) ? static::$classes[$class] : false;
@ -37,7 +37,7 @@ class Autoloader
static::$classes = []; static::$classes = [];
$dir = new RecursiveDirectoryIterator($_SERVER['ROOT_DIR'], RecursiveDirectoryIterator::SKIP_DOTS); $dir = new RecursiveDirectoryIterator(ROOT_DIR, RecursiveDirectoryIterator::SKIP_DOTS);
$ite = new RecursiveIteratorIterator($dir); $ite = new RecursiveIteratorIterator($dir);
$pathIterator = new RegexIterator($ite, '/.*\.class\.php/', RegexIterator::GET_MATCH); $pathIterator = new RegexIterator($ite, '/.*\.class\.php/', RegexIterator::GET_MATCH);
foreach($pathIterator as $paths) foreach($pathIterator as $paths)
@ -58,10 +58,20 @@ class Autoloader
{ {
$mapping = []; $mapping = [];
$classes = []; $classes = [];
preg_match_all('~^\s*(?:namespace)\s+([^;]+)~mi', file_get_contents($path), $namespaces);
preg_match_all('~^\s*(?:abstract\s+|final\s+)?(?:class|interface)\s+(\w+)~mi', file_get_contents($path), $classes); preg_match_all('~^\s*(?:abstract\s+|final\s+)?(?:class|interface)\s+(\w+)~mi', file_get_contents($path), $classes);
if (isset($namespaces[1]) && count($namespaces[1]) > 2)
{
throw new RuntimeException('Autoloader cannot handle 2 namespaces in the same file');
}
$prefix = isset($namespaces[1]) && count($namespaces[1]) ? reset($namespaces[1]) . '\\' : '';
foreach ($classes[1] as $class) foreach ($classes[1] as $class)
{ {
$mapping[strtolower($class)] = $path; $mapping[strtolower($prefix . $class)] = $path;
} }
return $mapping; return $mapping;
} }

5
bootstrap.php Normal file
View file

@ -0,0 +1,5 @@
<?php
define('ROOT_DIR', __DIR__);
include ROOT_DIR . '/autoload.php';

View file

@ -36,7 +36,7 @@ class ContentActions extends Actions
// //
// if ($_SERVER['REQUEST_METHOD'] === 'POST') // if ($_SERVER['REQUEST_METHOD'] === 'POST')
// { // {
// $accessCodes = include $_SERVER['ROOT_DIR'] . '/data/secret/access_list.php'; // $accessCodes = include ROOT_DIR . '/data/secret/access_list.php';
// $today = date('Y-m-d H:i:s'); // $today = date('Y-m-d H:i:s');
// foreach($accessCodes as $code => $date) // foreach($accessCodes as $code => $date)
// { // {
@ -61,4 +61,4 @@ class ContentActions extends Actions
// //
// return false; // return false;
// } // }
} }

View file

@ -11,7 +11,7 @@ class OpsActions extends Actions
{ {
$payload = json_decode($_REQUEST['payload'], true); $payload = json_decode($_REQUEST['payload'], true);
$rawPost = file_get_contents('php://input'); $rawPost = file_get_contents('php://input');
$secret = trim(file_get_contents($_SERVER['ROOT_DIR'] . '/data/secret/github-secret')); $secret = Config::get('github_key');
Actions::returnErrorIf(!isset($_SERVER['HTTP_X_HUB_SIGNATURE']), "HTTP header 'X-Hub-Signature' is missing."); Actions::returnErrorIf(!isset($_SERVER['HTTP_X_HUB_SIGNATURE']), "HTTP header 'X-Hub-Signature' is missing.");
@ -21,11 +21,11 @@ class OpsActions extends Actions
if ($payload['ref'] === 'refs/heads/master') if ($payload['ref'] === 'refs/heads/master')
{ {
$ret = shell_exec('sudo -u lbry ' . $_SERVER['ROOT_DIR'] . '/update.sh 2>&1'); $ret = shell_exec('sudo -u lbry ' . ROOT_DIR . '/update.php 2>&1');
echo "Successful post commit (aka the script executed, so maybe it is successful):\n"; echo "Successful post commit (aka the script executed, so maybe it is successful):\n";
echo $ret; echo $ret;
} }
return [null, []]; return [null, []];
} }
} }

23
css
View file

@ -1,23 +0,0 @@
/*
Errno::ENOENT: No such file or directory - scss
Backtrace:
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/plugin/compiler.rb:482:in `read'
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/plugin/compiler.rb:482:in `update_stylesheet'
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets'
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/plugin/compiler.rb:209:in `each'
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/plugin/compiler.rb:209:in `update_stylesheets'
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/plugin/compiler.rb:293:in `watch'
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/plugin.rb:108:in `method_missing'
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/exec/sass_scss.rb:381:in `watch_or_update'
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/exec/sass_scss.rb:51:in `process_result'
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/exec/base.rb:52:in `parse'
/var/lib/gems/1.9.1/gems/sass-3.4.11/lib/sass/exec/base.rb:19:in `parse!'
/var/lib/gems/1.9.1/gems/sass-3.4.11/bin/sass:13:in `<top (required)>'
/usr/local/bin/sass:23:in `load'
/usr/local/bin/sass:23:in `<main>'
*/
body:before {
white-space: pre;
font-family: monospace;
content: "Errno::ENOENT: No such file or directory - scss"; }

0
data/.gitkeep Normal file
View file

28
lib/Config.class.php Normal file
View file

@ -0,0 +1,28 @@
<?php
class Config
{
protected static $loaded = false;
protected static $data = [];
public static function get($name, $default = null)
{
static::load();
return array_key_exists($name, static::$data) ? static::$data[$name] : $default;
}
protected static function load()
{
if (!static::$loaded)
{
$dataFile = ROOT_DIR.'/data/config.php';
if (!is_readable($dataFile))
{
throw new RuntimeException('config file is missing or not readable');
}
static::$data = require $dataFile;
static::$loaded = true;
}
}
}

View file

@ -3,14 +3,14 @@
class Mailchimp extends MCAPI class Mailchimp extends MCAPI
{ {
const LIST_GENERAL_ID = '7b74c90030'; const LIST_GENERAL_ID = '7b74c90030';
protected static $instance = null; protected static $instance = null;
public function __construct($key = null) public function __construct($key = null)
{ {
if ($key === null) if ($key === null)
{ {
$key = trim(file_get_contents($_SERVER['ROOT_DIR'] . '/data/secret/mailchimp-api-key')); $key = Config::get('mailchimp_key');
} }
return parent::__construct($key); return parent::__construct($key);
} }

153
lib/shellExec.class.php Normal file
View file

@ -0,0 +1,153 @@
<?php
/**
* Shell
*
* Execute shell commands properly.
* - forks a separate process to run the command
* - collects all output (including the exit code and stderr) and returns it neatly
* - optionally prints the output/error to stdout/stderr, so you can see it in (almost) real time
*
* @author Alex Grintsvayg
* @link https://gist.github.com/lyoshenka/4a861672cf36ece4d09c
*
*/
class Shell
{
/**
* Execute a command. Returns the command's exit code, output, and error output.
*
* @param string $cmd The command to execute
* @param array $options Available options:
* - echo (bool) - If true, print the command's output/error to stdout/stderr of this process
* - echo_errors (bool) - If you want to control printing to stderr separately, use this. If not provided, will
* default to the value of 'echo'
* - live_callback (callable) - Will be called as soon as data is read. Use this for custom handling
* of live output. Callable signature: fn(string $text, bool $isError)
*
* @return array [exit code, output, errorOutput]
*/
public static function exec($cmd, array $options = [])
{
$options = array_merge([
'echo' => false,
'echo_errors' => null,
'live_callback' => null,
], $options);
if ($options['echo_errors'] === null)
{
$options['echo_errors'] = $options['echo'];
}
if ($options['live_callback'] && !is_callable($options['live_callback']))
{
throw new InvalidArgumentException('live_callback option must be a valid callback');
}
$descriptorSpec = [
1 => ['pipe', 'w'], // stdout
2 => ['pipe', 'w'], // stderr
];
$process = proc_open($cmd, $descriptorSpec, $pipes);
if (!is_resource($process))
{
throw new RuntimeException('proc_open failed');
}
stream_set_blocking($pipes[1], false);
stream_set_blocking($pipes[2], false);
$output = '';
$err = '';
while (!feof($pipes[1]) || !feof($pipes[2]))
{
foreach ($pipes as $key => $pipe)
{
$data = fread($pipe, 1024);
if (!$data)
{
continue;
}
if (1 == $key)
{
$output .= $data;
if ($options['echo'])
{
fprintf(STDOUT, "%s", $data);
}
if ($options['live_callback'])
{
call_user_func($options['live_callback'], $data, false);
}
}
else
{
$err .= $data;
if ($options['echo_errors'])
{
fprintf(STDERR, "%s", $data);
}
if ($options['live_callback'])
{
call_user_func($options['live_callback'], $data, true);
}
}
}
usleep(100000);
}
fclose($pipes[1]);
fclose($pipes[2]);
$exitCode = proc_close($process);
return [$exitCode, $output, $err];
}
/**
* Convenience method to build a command to execute. Will escape everything as necessary.
*
* @param string $executable The path to the executable
* @param array $arguments An array of arguments
* @param array $options An associative array of flags in the form flagName => flagValue.
* Short and long flags are supported.
* If flagValue === true, the flag have no value.
* If flagValue === false, the flag will be skipped.
*
* @return string An executable command
*/
public static function buildCmd($executable, array $arguments = [], array $options = [])
{
$shellArgs = [];
foreach ($options as $key => $value)
{
if ($value === false)
{
continue;
}
if (strlen($key) === 1)
{
$shellArgs[] = '-'.$key;
if ($value !== true)
{
$shellArgs[] = $value;
}
}
else
{
$shellArgs[] = '--' . $key . ($value !== true ? '=' . $value : '');
}
}
$shellArgs = array_merge($shellArgs, array_values($arguments));
return $executable . ' ' . join(' ', array_map('escapeshellarg', $shellArgs));
}
}

47
lib/vendor/scss/Base/Range.class.php vendored Normal file
View file

@ -0,0 +1,47 @@
<?php
/**
* SCSSPHP
*
* @copyright 2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Base;
/**
* Range
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class Range
{
public $first;
public $last;
/**
* Initialize range
*
* @param integer|float $first
* @param integer|float $last
*/
public function __construct($first, $last)
{
$this->first = $first;
$this->last = $last;
}
/**
* Test for inclusion in range
*
* @param integer|float $value
*
* @return boolean
*/
public function includes($value)
{
return $value >= $this->first && $value <= $this->last;
}
}

60
lib/vendor/scss/Block.class.php vendored Normal file
View file

@ -0,0 +1,60 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp;
/**
* Block
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class Block
{
/**
* @var string
*/
public $type;
/**
* @var \Leafo\ScssPhp\Block
*/
public $parent;
/**
* @var integer
*/
public $sourceIndex;
/**
* @var integer
*/
public $sourceLine;
/**
* @var integer
*/
public $sourceColumn;
/**
* @var array
*/
public $selectors;
/**
* @var array
*/
public $comments;
/**
* @var array
*/
public $children;
}

179
lib/vendor/scss/Colors.class.php vendored Normal file
View file

@ -0,0 +1,179 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp;
/**
* CSS Colors
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
class Colors
{
/**
* CSS Colors
*
* @see http://www.w3.org/TR/css3-color
*
* @var array
*/
public static $cssColors = [
'aliceblue' => '240,248,255',
'antiquewhite' => '250,235,215',
'aqua' => '0,255,255',
'aquamarine' => '127,255,212',
'azure' => '240,255,255',
'beige' => '245,245,220',
'bisque' => '255,228,196',
'black' => '0,0,0',
'blanchedalmond' => '255,235,205',
'blue' => '0,0,255',
'blueviolet' => '138,43,226',
'brown' => '165,42,42',
'burlywood' => '222,184,135',
'cadetblue' => '95,158,160',
'chartreuse' => '127,255,0',
'chocolate' => '210,105,30',
'coral' => '255,127,80',
'cornflowerblue' => '100,149,237',
'cornsilk' => '255,248,220',
'crimson' => '220,20,60',
'cyan' => '0,255,255',
'darkblue' => '0,0,139',
'darkcyan' => '0,139,139',
'darkgoldenrod' => '184,134,11',
'darkgray' => '169,169,169',
'darkgreen' => '0,100,0',
'darkgrey' => '169,169,169',
'darkkhaki' => '189,183,107',
'darkmagenta' => '139,0,139',
'darkolivegreen' => '85,107,47',
'darkorange' => '255,140,0',
'darkorchid' => '153,50,204',
'darkred' => '139,0,0',
'darksalmon' => '233,150,122',
'darkseagreen' => '143,188,143',
'darkslateblue' => '72,61,139',
'darkslategray' => '47,79,79',
'darkslategrey' => '47,79,79',
'darkturquoise' => '0,206,209',
'darkviolet' => '148,0,211',
'deeppink' => '255,20,147',
'deepskyblue' => '0,191,255',
'dimgray' => '105,105,105',
'dimgrey' => '105,105,105',
'dodgerblue' => '30,144,255',
'firebrick' => '178,34,34',
'floralwhite' => '255,250,240',
'forestgreen' => '34,139,34',
'fuchsia' => '255,0,255',
'gainsboro' => '220,220,220',
'ghostwhite' => '248,248,255',
'gold' => '255,215,0',
'goldenrod' => '218,165,32',
'gray' => '128,128,128',
'green' => '0,128,0',
'greenyellow' => '173,255,47',
'grey' => '128,128,128',
'honeydew' => '240,255,240',
'hotpink' => '255,105,180',
'indianred' => '205,92,92',
'indigo' => '75,0,130',
'ivory' => '255,255,240',
'khaki' => '240,230,140',
'lavender' => '230,230,250',
'lavenderblush' => '255,240,245',
'lawngreen' => '124,252,0',
'lemonchiffon' => '255,250,205',
'lightblue' => '173,216,230',
'lightcoral' => '240,128,128',
'lightcyan' => '224,255,255',
'lightgoldenrodyellow' => '250,250,210',
'lightgray' => '211,211,211',
'lightgreen' => '144,238,144',
'lightgrey' => '211,211,211',
'lightpink' => '255,182,193',
'lightsalmon' => '255,160,122',
'lightseagreen' => '32,178,170',
'lightskyblue' => '135,206,250',
'lightslategray' => '119,136,153',
'lightslategrey' => '119,136,153',
'lightsteelblue' => '176,196,222',
'lightyellow' => '255,255,224',
'lime' => '0,255,0',
'limegreen' => '50,205,50',
'linen' => '250,240,230',
'magenta' => '255,0,255',
'maroon' => '128,0,0',
'mediumaquamarine' => '102,205,170',
'mediumblue' => '0,0,205',
'mediumorchid' => '186,85,211',
'mediumpurple' => '147,112,219',
'mediumseagreen' => '60,179,113',
'mediumslateblue' => '123,104,238',
'mediumspringgreen' => '0,250,154',
'mediumturquoise' => '72,209,204',
'mediumvioletred' => '199,21,133',
'midnightblue' => '25,25,112',
'mintcream' => '245,255,250',
'mistyrose' => '255,228,225',
'moccasin' => '255,228,181',
'navajowhite' => '255,222,173',
'navy' => '0,0,128',
'oldlace' => '253,245,230',
'olive' => '128,128,0',
'olivedrab' => '107,142,35',
'orange' => '255,165,0',
'orangered' => '255,69,0',
'orchid' => '218,112,214',
'palegoldenrod' => '238,232,170',
'palegreen' => '152,251,152',
'paleturquoise' => '175,238,238',
'palevioletred' => '219,112,147',
'papayawhip' => '255,239,213',
'peachpuff' => '255,218,185',
'peru' => '205,133,63',
'pink' => '255,192,203',
'plum' => '221,160,221',
'powderblue' => '176,224,230',
'purple' => '128,0,128',
'rebeccapurple' => '102,51,153',
'red' => '255,0,0',
'rosybrown' => '188,143,143',
'royalblue' => '65,105,225',
'saddlebrown' => '139,69,19',
'salmon' => '250,128,114',
'sandybrown' => '244,164,96',
'seagreen' => '46,139,87',
'seashell' => '255,245,238',
'sienna' => '160,82,45',
'silver' => '192,192,192',
'skyblue' => '135,206,235',
'slateblue' => '106,90,205',
'slategray' => '112,128,144',
'slategrey' => '112,128,144',
'snow' => '255,250,250',
'springgreen' => '0,255,127',
'steelblue' => '70,130,180',
'tan' => '210,180,140',
'teal' => '0,128,128',
'thistle' => '216,191,216',
'tomato' => '255,99,71',
'transparent' => '0,0,0,0',
'turquoise' => '64,224,208',
'violet' => '238,130,238',
'wheat' => '245,222,179',
'white' => '255,255,255',
'whitesmoke' => '245,245,245',
'yellow' => '255,255,0',
'yellowgreen' => '154,205,50',
];
}

5059
lib/vendor/scss/Compiler.class.php vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,40 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Compiler;
/**
* Compiler environment
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class Environment
{
/**
* @var \Leafo\ScssPhp\Block
*/
public $block;
/**
* @var \Leafo\ScssPhp\Compiler\Environment
*/
public $parent;
/**
* @var array
*/
public $store;
/**
* @var integer
*/
public $depth;
}

View file

@ -0,0 +1,21 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Exception;
/**
* Compiler exception
*
* @author Oleksandr Savchenko <traveltino@gmail.com>
*/
class CompilerException extends \Exception
{
}

View file

@ -0,0 +1,21 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Exception;
/**
* Parser Exception
*
* @author Oleksandr Savchenko <traveltino@gmail.com>
*/
class ParserException extends \Exception
{
}

View file

@ -0,0 +1,21 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Exception;
/**
* Server Exception
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class ServerException extends \Exception
{
}

216
lib/vendor/scss/Formatter.class.php vendored Normal file
View file

@ -0,0 +1,216 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* Base formatter
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
abstract class Formatter
{
/**
* @var integer
*/
public $indentLevel;
/**
* @var string
*/
public $indentChar;
/**
* @var string
*/
public $break;
/**
* @var string
*/
public $open;
/**
* @var string
*/
public $close;
/**
* @var string
*/
public $tagSeparator;
/**
* @var string
*/
public $assignSeparator;
/**
* @var boolea
*/
public $keepSemicolons;
/**
* Initialize formatter
*
* @api
*/
abstract public function __construct();
/**
* Return indentation (whitespace)
*
* @return string
*/
protected function indentStr()
{
return '';
}
/**
* Return property assignment
*
* @api
*
* @param string $name
* @param mixed $value
*
* @return string
*/
public function property($name, $value)
{
return rtrim($name) . $this->assignSeparator . $value . ';';
}
/**
* Strip semi-colon appended by property(); it's a separator, not a terminator
*
* @api
*
* @param array $lines
*/
public function stripSemicolon(&$lines)
{
if ($this->keepSemicolons) {
return;
}
if (($count = count($lines))
&& substr($lines[$count - 1], -1) === ';'
) {
$lines[$count - 1] = substr($lines[$count - 1], 0, -1);
}
}
/**
* Output lines inside a block
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockLines(OutputBlock $block)
{
$inner = $this->indentStr();
$glue = $this->break . $inner;
echo $inner . implode($glue, $block->lines);
if (! empty($block->children)) {
echo $this->break;
}
}
/**
* Output block selectors
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockSelectors(OutputBlock $block)
{
$inner = $this->indentStr();
echo $inner
. implode($this->tagSeparator, $block->selectors)
. $this->open . $this->break;
}
/**
* Output block children
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockChildren(OutputBlock $block)
{
foreach ($block->children as $child) {
$this->block($child);
}
}
/**
* Output non-empty block
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block
*/
protected function block(OutputBlock $block)
{
if (empty($block->lines) && empty($block->children)) {
return;
}
$pre = $this->indentStr();
if (! empty($block->selectors)) {
$this->blockSelectors($block);
$this->indentLevel++;
}
if (! empty($block->lines)) {
$this->blockLines($block);
}
if (! empty($block->children)) {
$this->blockChildren($block);
}
if (! empty($block->selectors)) {
$this->indentLevel--;
if (empty($block->children)) {
echo $this->break;
}
echo $pre . $this->close . $this->break;
}
}
/**
* Entry point to formatting a block
*
* @api
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block An abstract syntax tree
*
* @return string
*/
public function format(OutputBlock $block)
{
ob_start();
$this->block($block);
$out = ob_get_clean();
return $out;
}
}

View file

@ -0,0 +1,45 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
/**
* Compact formatter
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
class Compact extends Formatter
{
/**
* {@inheritdoc}
*/
public function __construct()
{
$this->indentLevel = 0;
$this->indentChar = '';
$this->break = '';
$this->open = ' {';
$this->close = "}\n\n";
$this->tagSeparator = ',';
$this->assignSeparator = ':';
$this->keepSemicolons = true;
}
/**
* {@inheritdoc}
*/
public function indentStr()
{
return ' ';
}
}

View file

@ -0,0 +1,62 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* Compressed formatter
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
class Compressed extends Formatter
{
/**
* {@inheritdoc}
*/
public function __construct()
{
$this->indentLevel = 0;
$this->indentChar = ' ';
$this->break = '';
$this->open = '{';
$this->close = '}';
$this->tagSeparator = ',';
$this->assignSeparator = ':';
$this->keepSemicolons = false;
}
/**
* {@inheritdoc}
*/
public function blockLines(OutputBlock $block)
{
$inner = $this->indentStr();
$glue = $this->break . $inner;
foreach ($block->lines as $index => $line) {
if (substr($line, 0, 2) === '/*' && substr($line, 2, 1) !== '!') {
unset($block->lines[$index]);
} elseif (substr($line, 0, 3) === '/*!') {
$block->lines[$index] = '/*' . substr($line, 3);
}
}
echo $inner . implode($glue, $block->lines);
if (! empty($block->children)) {
echo $this->break;
}
}
}

View file

@ -0,0 +1,60 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* Crunched formatter
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class Crunched extends Formatter
{
/**
* {@inheritdoc}
*/
public function __construct()
{
$this->indentLevel = 0;
$this->indentChar = ' ';
$this->break = '';
$this->open = '{';
$this->close = '}';
$this->tagSeparator = ',';
$this->assignSeparator = ':';
$this->keepSemicolons = false;
}
/**
* {@inheritdoc}
*/
public function blockLines(OutputBlock $block)
{
$inner = $this->indentStr();
$glue = $this->break . $inner;
foreach ($block->lines as $index => $line) {
if (substr($line, 0, 2) === '/*') {
unset($block->lines[$index]);
}
}
echo $inner . implode($glue, $block->lines);
if (! empty($block->children)) {
echo $this->break;
}
}
}

View file

@ -0,0 +1,119 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* Debug formatter
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class Debug extends Formatter
{
/**
* {@inheritdoc}
*/
public function __construct()
{
$this->indentLevel = 0;
$this->indentChar = '';
$this->break = "\n";
$this->open = ' {';
$this->close = ' }';
$this->tagSeparator = ', ';
$this->assignSeparator = ': ';
$this->keepSemicolons = true;
}
/**
* {@inheritdoc}
*/
protected function indentStr()
{
return str_repeat(' ', $this->indentLevel);
}
/**
* {@inheritdoc}
*/
protected function blockLines(OutputBlock $block)
{
$indent = $this->indentStr();
if (empty($block->lines)) {
echo "{$indent}block->lines: []\n";
return;
}
foreach ($block->lines as $index => $line) {
echo "{$indent}block->lines[{$index}]: $line\n";
}
}
/**
* {@inheritdoc}
*/
protected function blockSelectors(OutputBlock $block)
{
$indent = $this->indentStr();
if (empty($block->selectors)) {
echo "{$indent}block->selectors: []\n";
return;
}
foreach ($block->selectors as $index => $selector) {
echo "{$indent}block->selectors[{$index}]: $selector\n";
}
}
/**
* {@inheritdoc}
*/
protected function blockChildren(OutputBlock $block)
{
$indent = $this->indentStr();
if (empty($block->children)) {
echo "{$indent}block->children: []\n";
return;
}
$this->indentLevel++;
foreach ($block->children as $i => $child) {
$this->block($child);
}
$this->indentLevel--;
}
/**
* {@inheritdoc}
*/
protected function block(OutputBlock $block)
{
$indent = $this->indentStr();
echo "{$indent}block->type: {$block->type}\n" .
"{$indent}block->depth: {$block->depth}\n";
$this->blockSelectors($block);
$this->blockLines($block);
$this->blockChildren($block);
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* Expanded formatter
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
class Expanded extends Formatter
{
/**
* {@inheritdoc}
*/
public function __construct()
{
$this->indentLevel = 0;
$this->indentChar = ' ';
$this->break = "\n";
$this->open = ' {';
$this->close = '}';
$this->tagSeparator = ', ';
$this->assignSeparator = ': ';
$this->keepSemicolons = true;
}
/**
* {@inheritdoc}
*/
protected function indentStr()
{
return str_repeat($this->indentChar, $this->indentLevel);
}
/**
* {@inheritdoc}
*/
protected function blockLines(OutputBlock $block)
{
$inner = $this->indentStr();
$glue = $this->break . $inner;
foreach ($block->lines as $index => $line) {
if (substr($line, 0, 2) === '/*') {
$block->lines[$index] = preg_replace('/(\r|\n)+/', $glue, $line);
}
}
echo $inner . implode($glue, $block->lines);
if (empty($block->selectors) || ! empty($block->children)) {
echo $this->break;
}
}
}

View file

@ -0,0 +1,198 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter;
use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* Nested formatter
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
class Nested extends Formatter
{
/**
* @var integer
*/
private $depth;
/**
* {@inheritdoc}
*/
public function __construct()
{
$this->indentLevel = 0;
$this->indentChar = ' ';
$this->break = "\n";
$this->open = ' {';
$this->close = ' }';
$this->tagSeparator = ', ';
$this->assignSeparator = ': ';
$this->keepSemicolons = true;
}
/**
* {@inheritdoc}
*/
protected function indentStr()
{
$n = $this->depth - 1;
return str_repeat($this->indentChar, max($this->indentLevel + $n, 0));
}
/**
* {@inheritdoc}
*/
protected function blockLines(OutputBlock $block)
{
$inner = $this->indentStr();
$glue = $this->break . $inner;
foreach ($block->lines as $index => $line) {
if (substr($line, 0, 2) === '/*') {
$block->lines[$index] = preg_replace('/(\r|\n)+/', $glue, $line);
}
}
echo $inner . implode($glue, $block->lines);
if (! empty($block->children)) {
echo $this->break;
}
}
/**
* {@inheritdoc}
*/
protected function blockSelectors(OutputBlock $block)
{
$inner = $this->indentStr();
echo $inner
. implode($this->tagSeparator, $block->selectors)
. $this->open . $this->break;
}
/**
* {@inheritdoc}
*/
protected function blockChildren(OutputBlock $block)
{
foreach ($block->children as $i => $child) {
$this->block($child);
if ($i < count($block->children) - 1) {
echo $this->break;
if (isset($block->children[$i + 1])) {
$next = $block->children[$i + 1];
if ($next->depth === max($block->depth, 1) && $child->depth >= $next->depth) {
echo $this->break;
}
}
}
}
}
/**
* {@inheritdoc}
*/
protected function block(OutputBlock $block)
{
if ($block->type === 'root') {
$this->adjustAllChildren($block);
}
if (empty($block->lines) && empty($block->children)) {
return;
}
$this->depth = $block->depth;
if (! empty($block->selectors)) {
$this->blockSelectors($block);
$this->indentLevel++;
}
if (! empty($block->lines)) {
$this->blockLines($block);
}
if (! empty($block->children)) {
$this->blockChildren($block);
}
if (! empty($block->selectors)) {
$this->indentLevel--;
echo $this->close;
}
if ($block->type === 'root') {
echo $this->break;
}
}
/**
* Adjust the depths of all children, depth first
*
* @param \Leafo\ScssPhp\Formatter\OutputBlock $block
*/
private function adjustAllChildren(OutputBlock $block)
{
// flatten empty nested blocks
$children = [];
foreach ($block->children as $i => $child) {
if (empty($child->lines) && empty($child->children)) {
if (isset($block->children[$i + 1])) {
$block->children[$i + 1]->depth = $child->depth;
}
continue;
}
$children[] = $child;
}
$count = count($children);
for ($i = 0; $i < $count; $i++) {
$depth = $children[$i]->depth;
$j = $i + 1;
if (isset($children[$j]) && $depth < $children[$j]->depth) {
$childDepth = $children[$j]->depth;
for (; $j < $count; $j++) {
if ($depth < $children[$j]->depth && $childDepth >= $children[$j]->depth) {
$children[$j]->depth = $depth + 1;
}
}
}
}
$block->children = $children;
// make relative to parent
foreach ($block->children as $child) {
$this->adjustAllChildren($child);
$child->depth = $child->depth - $block->depth;
}
}
}

View file

@ -0,0 +1,50 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Formatter;
/**
* Output block
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class OutputBlock
{
/**
* @var string
*/
public $type;
/**
* @var integer
*/
public $depth;
/**
* @var array
*/
public $selectors;
/**
* @var array
*/
public $lines;
/**
* @var array
*/
public $children;
/**
* @var \Leafo\ScssPhp\Formatter\OutputBlock
*/
public $parent;
}

40
lib/vendor/scss/Node.class.php vendored Normal file
View file

@ -0,0 +1,40 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp;
/**
* Base node
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
abstract class Node
{
/**
* @var string
*/
public $type;
/**
* @var integer
*/
public $sourceIndex;
/**
* @var integer
*/
public $sourceLine;
/**
* @var integer
*/
public $sourceColumn;
}

329
lib/vendor/scss/Node/Number.class.php vendored Normal file
View file

@ -0,0 +1,329 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp\Node;
use Leafo\ScssPhp\Compiler;
use Leafo\ScssPhp\Node;
use Leafo\ScssPhp\Type;
/**
* Dimension + optional units
*
* {@internal
* This is a work-in-progress.
*
* The \ArrayAccess interface is temporary until the migration is complete.
* }}
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class Number extends Node implements \ArrayAccess
{
/**
* @var integer
*/
static public $precision = 5;
/**
* @see http://www.w3.org/TR/2012/WD-css3-values-20120308/
*
* @var array
*/
static protected $unitTable = [
'in' => [
'in' => 1,
'pc' => 6,
'pt' => 72,
'px' => 96,
'cm' => 2.54,
'mm' => 25.4,
'q' => 101.6,
],
'turn' => [
'deg' => 360,
'grad' => 400,
'rad' => 6.28318530717958647692528676, // 2 * M_PI
'turn' => 1,
],
's' => [
's' => 1,
'ms' => 1000,
],
'Hz' => [
'Hz' => 1,
'kHz' => 0.001,
],
'dpi' => [
'dpi' => 1,
'dpcm' => 2.54,
'dppx' => 96,
],
];
/**
* @var integer|float
*/
public $dimension;
/**
* @var array
*/
public $units;
/**
* Initialize number
*
* @param mixed $dimension
* @param mixed $initialUnit
*/
public function __construct($dimension, $initialUnit)
{
$this->type = Type::T_NUMBER;
$this->dimension = $dimension;
$this->units = is_array($initialUnit)
? $initialUnit
: ($initialUnit ? [$initialUnit => 1]
: []);
}
/**
* Coerce number to target units
*
* @param array $units
*
* @return \Leafo\ScssPhp\Node\Number
*/
public function coerce($units)
{
if ($this->unitless()) {
return new Number($this->dimension, $units);
}
$dimension = $this->dimension;
foreach (self::$unitTable['in'] as $unit => $conv) {
$from = isset($this->units[$unit]) ? $this->units[$unit] : 0;
$to = isset($units[$unit]) ? $units[$unit] : 0;
$factor = pow($conv, $from - $to);
$dimension /= $factor;
}
return new Number($dimension, $units);
}
/**
* Normalize number
*
* @return \Leafo\ScssPhp\Node\Number
*/
public function normalize()
{
$dimension = $this->dimension;
$units = [];
$this->normalizeUnits($dimension, $units, 'in');
return new Number($dimension, $units);
}
/**
* {@inheritdoc}
*/
public function offsetExists($offset)
{
if ($offset === -3) {
return $this->sourceColumn !== null;
}
if ($offset === -2) {
return $this->sourceLine !== null;
}
if ($offset === -1
|| $offset === 0
|| $offset === 1
|| $offset === 2
) {
return true;
}
return false;
}
/**
* {@inheritdoc}
*/
public function offsetGet($offset)
{
switch ($offset) {
case -3:
return $this->sourceColumn;
case -2:
return $this->sourceLine;
case -1:
return $this->sourceIndex;
case 0:
return $this->type;
case 1:
return $this->dimension;
case 2:
return $this->units;
}
}
/**
* {@inheritdoc}
*/
public function offsetSet($offset, $value)
{
if ($offset === 1) {
$this->dimension = $value;
} elseif ($offset === 2) {
$this->units = $value;
} elseif ($offset == -1) {
$this->sourceIndex = $value;
} elseif ($offset == -2) {
$this->sourceLine = $value;
} elseif ($offset == -3) {
$this->sourceColumn = $value;
}
}
/**
* {@inheritdoc}
*/
public function offsetUnset($offset)
{
if ($offset === 1) {
$this->dimension = null;
} elseif ($offset === 2) {
$this->units = null;
} elseif ($offset === -1) {
$this->sourceIndex = null;
} elseif ($offset === -2) {
$this->sourceLine = null;
} elseif ($offset === -3) {
$this->sourceColumn = null;
}
}
/**
* Returns true if the number is unitless
*
* @return boolean
*/
public function unitless()
{
return ! array_sum($this->units);
}
/**
* Returns unit(s) as the product of numerator units divided by the product of denominator units
*
* @return string
*/
public function unitStr()
{
$numerators = [];
$denominators = [];
foreach ($this->units as $unit => $unitSize) {
if ($unitSize > 0) {
$numerators = array_pad($numerators, count($numerators) + $unitSize, $unit);
continue;
}
if ($unitSize < 0) {
$denominators = array_pad($denominators, count($denominators) + $unitSize, $unit);
continue;
}
}
return implode('*', $numerators) . (count($denominators) ? '/' . implode('*', $denominators) : '');
}
/**
* Output number
*
* @param \Leafo\ScssPhp\Compiler $compiler
*
* @return string
*/
public function output(Compiler $compiler = null)
{
$dimension = round($this->dimension, self::$precision);
$units = array_filter($this->units, function ($unitSize) {
return $unitSize;
});
if (count($units) > 1 && array_sum($units) === 0) {
$dimension = $this->dimension;
$units = [];
$this->normalizeUnits($dimension, $units, 'in');
$dimension = round($dimension, self::$precision);
$units = array_filter($units, function ($unitSize) {
return $unitSize;
});
}
$unitSize = array_sum($units);
if ($compiler && ($unitSize > 1 || $unitSize < 0 || count($units) > 1)) {
$compiler->throwError((string) $dimension . $this->unitStr() . " isn't a valid CSS value.");
}
reset($units);
list($unit, ) = each($units);
return (string) $dimension . $unit;
}
/**
* {@inheritdoc}
*/
public function __toString()
{
return $this->output();
}
/**
* Normalize units
*
* @param integer|float $dimension
* @param array $units
* @param string $baseUnit
*/
private function normalizeUnits(&$dimension, &$units, $baseUnit = 'in')
{
$dimension = $this->dimension;
$units = [];
foreach ($this->units as $unit => $exp) {
if (isset(self::$unitTable[$baseUnit][$unit])) {
$factor = pow(self::$unitTable[$baseUnit][$unit], $exp);
$unit = $baseUnit;
$dimension /= $factor;
}
$units[$unit] = $exp + (isset($units[$unit]) ? $units[$unit] : 0);
}
}
}

2478
lib/vendor/scss/Parser.class.php vendored Normal file

File diff suppressed because it is too large Load diff

463
lib/vendor/scss/Server.class.php vendored Normal file
View file

@ -0,0 +1,463 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp;
use Leafo\ScssPhp\Compiler;
use Leafo\ScssPhp\Exception\ServerException;
use Leafo\ScssPhp\Version;
/**
* Server
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
class Server
{
/**
* @var boolean
*/
private $showErrorsAsCSS;
/**
* @var string
*/
private $dir;
/**
* @var string
*/
private $cacheDir;
/**
* @var \Leafo\ScssPhp\Compiler
*/
private $scss;
/**
* Join path components
*
* @param string $left Path component, left of the directory separator
* @param string $right Path component, right of the directory separator
*
* @return string
*/
protected function join($left, $right)
{
return rtrim($left, '/\\') . DIRECTORY_SEPARATOR . ltrim($right, '/\\');
}
/**
* Get name of requested .scss file
*
* @return string|null
*/
protected function inputName()
{
switch (true) {
case isset($_GET['p']):
return $_GET['p'];
case isset($_SERVER['PATH_INFO']):
return $_SERVER['PATH_INFO'];
case isset($_SERVER['DOCUMENT_URI']):
return substr($_SERVER['DOCUMENT_URI'], strlen($_SERVER['SCRIPT_NAME']));
}
}
/**
* Get path to requested .scss file
*
* @return string
*/
protected function findInput()
{
if (($input = $this->inputName())
&& strpos($input, '..') === false
&& substr($input, -5) === '.scss'
) {
$name = $this->join($this->dir, $input);
if (is_file($name) && is_readable($name)) {
return $name;
}
}
return false;
}
/**
* Get path to cached .css file
*
* @return string
*/
protected function cacheName($fname)
{
return $this->join($this->cacheDir, md5($fname) . '.css');
}
/**
* Get path to meta data
*
* @return string
*/
protected function metadataName($out)
{
return $out . '.meta';
}
/**
* Determine whether .scss file needs to be re-compiled.
*
* @param string $out Output path
* @param string $etag ETag
*
* @return boolean True if compile required.
*/
protected function needsCompile($out, &$etag)
{
if (! is_file($out)) {
return true;
}
$mtime = filemtime($out);
$metadataName = $this->metadataName($out);
if (is_readable($metadataName)) {
$metadata = unserialize(file_get_contents($metadataName));
foreach ($metadata['imports'] as $import => $originalMtime) {
$currentMtime = filemtime($import);
if ($currentMtime !== $originalMtime || $currentMtime > $mtime) {
return true;
}
}
$metaVars = crc32(serialize($this->scss->getVariables()));
if ($metaVars !== $metadata['vars']) {
return true;
}
$etag = $metadata['etag'];
return false;
}
return true;
}
/**
* Get If-Modified-Since header from client request
*
* @return string|null
*/
protected function getIfModifiedSinceHeader()
{
$modifiedSince = null;
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
$modifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
if (false !== ($semicolonPos = strpos($modifiedSince, ';'))) {
$modifiedSince = substr($modifiedSince, 0, $semicolonPos);
}
}
return $modifiedSince;
}
/**
* Get If-None-Match header from client request
*
* @return string|null
*/
protected function getIfNoneMatchHeader()
{
$noneMatch = null;
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
$noneMatch = $_SERVER['HTTP_IF_NONE_MATCH'];
}
return $noneMatch;
}
/**
* Compile .scss file
*
* @param string $in Input path (.scss)
* @param string $out Output path (.css)
*
* @return array
*/
protected function compile($in, $out)
{
$start = microtime(true);
$css = $this->scss->compile(file_get_contents($in), $in);
$elapsed = round((microtime(true) - $start), 4);
$v = Version::VERSION;
$t = date('r');
$css = "/* compiled by scssphp $v on $t (${elapsed}s) */\n\n" . $css;
$etag = md5($css);
file_put_contents($out, $css);
file_put_contents(
$this->metadataName($out),
serialize([
'etag' => $etag,
'imports' => $this->scss->getParsedFiles(),
'vars' => crc32(serialize($this->scss->getVariables())),
])
);
return [$css, $etag];
}
/**
* Format error as a pseudo-element in CSS
*
* @param \Exception $error
*
* @return string
*/
protected function createErrorCSS(\Exception $error)
{
$message = str_replace(
["'", "\n"],
["\\'", "\\A"],
$error->getfile() . ":\n\n" . $error->getMessage()
);
return "body { display: none !important; }
html:after {
background: white;
color: black;
content: '$message';
display: block !important;
font-family: mono;
padding: 1em;
white-space: pre;
}";
}
/**
* Render errors as a pseudo-element within valid CSS, displaying the errors on any
* page that includes this CSS.
*
* @param boolean $show
*/
public function showErrorsAsCSS($show = true)
{
$this->showErrorsAsCSS = $show;
}
/**
* Compile .scss file
*
* @param string $in Input file (.scss)
* @param string $out Output file (.css) optional
*
* @return string|bool
*
* @throws \Leafo\ScssPhp\Exception\ServerException
*/
public function compileFile($in, $out = null)
{
if (! is_readable($in)) {
throw new ServerException('load error: failed to find ' . $in);
}
$pi = pathinfo($in);
$this->scss->addImportPath($pi['dirname'] . '/');
$compiled = $this->scss->compile(file_get_contents($in), $in);
if ($out !== null) {
return file_put_contents($out, $compiled);
}
return $compiled;
}
/**
* Check if file need compiling
*
* @param string $in Input file (.scss)
* @param string $out Output file (.css)
*
* @return bool
*/
public function checkedCompile($in, $out)
{
if (! is_file($out) || filemtime($in) > filemtime($out)) {
$this->compileFile($in, $out);
return true;
}
return false;
}
/**
* Compile requested scss and serve css. Outputs HTTP response.
*
* @param string $salt Prefix a string to the filename for creating the cache name hash
*/
public function serve($salt = '')
{
$protocol = isset($_SERVER['SERVER_PROTOCOL'])
? $_SERVER['SERVER_PROTOCOL']
: 'HTTP/1.0';
if ($input = $this->findInput()) {
$output = $this->cacheName($salt . $input);
$etag = $noneMatch = trim($this->getIfNoneMatchHeader(), '"');
if ($this->needsCompile($output, $etag)) {
try {
list($css, $etag) = $this->compile($input, $output);
$lastModified = gmdate('D, d M Y H:i:s', filemtime($output)) . ' GMT';
header('Last-Modified: ' . $lastModified);
header('Content-type: text/css');
header('ETag: "' . $etag . '"');
echo $css;
} catch (\Exception $e) {
if ($this->showErrorsAsCSS) {
header('Content-type: text/css');
echo $this->createErrorCSS($e);
} else {
header($protocol . ' 500 Internal Server Error');
header('Content-type: text/plain');
echo 'Parse error: ' . $e->getMessage() . "\n";
}
}
return;
}
header('X-SCSS-Cache: true');
header('Content-type: text/css');
header('ETag: "' . $etag . '"');
if ($etag === $noneMatch) {
header($protocol . ' 304 Not Modified');
return;
}
$modifiedSince = $this->getIfModifiedSinceHeader();
$mtime = filemtime($output);
if (strtotime($modifiedSince) === $mtime) {
header($protocol . ' 304 Not Modified');
return;
}
$lastModified = gmdate('D, d M Y H:i:s', $mtime) . ' GMT';
header('Last-Modified: ' . $lastModified);
echo file_get_contents($output);
return;
}
header($protocol . ' 404 Not Found');
header('Content-type: text/plain');
$v = Version::VERSION;
echo "/* INPUT NOT FOUND scss $v */\n";
}
/**
* Based on explicit input/output files does a full change check on cache before compiling.
*
* @param string $in
* @param string $out
* @param boolean $force
*
* @return string Compiled CSS results
*
* @throws \Leafo\ScssPhp\Exception\ServerException
*/
public function checkedCachedCompile($in, $out, $force = false)
{
if (! is_file($in) || ! is_readable($in)) {
throw new ServerException('Invalid or unreadable input file specified.');
}
if (is_dir($out) || ! is_writable(file_exists($out) ? $out : dirname($out))) {
throw new ServerException('Invalid or unwritable output file specified.');
}
if ($force || $this->needsCompile($out, $etag)) {
list($css, $etag) = $this->compile($in, $out);
} else {
$css = file_get_contents($out);
}
return $css;
}
/**
* Constructor
*
* @param string $dir Root directory to .scss files
* @param string $cacheDir Cache directory
* @param \Leafo\ScssPhp\Compiler|null $scss SCSS compiler instance
*/
public function __construct($dir, $cacheDir = null, $scss = null)
{
$this->dir = $dir;
if (! isset($cacheDir)) {
$cacheDir = $this->join($dir, 'scss_cache');
}
$this->cacheDir = $cacheDir;
if (! is_dir($this->cacheDir)) {
mkdir($this->cacheDir, 0755, true);
}
if (! isset($scss)) {
$scss = new Compiler();
$scss->setImportPaths($this->dir);
}
$this->scss = $scss;
$this->showErrorsAsCSS = false;
if (! ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
}
/**
* Helper method to serve compiled scss
*
* @param string $path Root path
*/
public static function serveFrom($path)
{
$server = new self($path);
$server->serve();
}
}

69
lib/vendor/scss/Type.class.php vendored Normal file
View file

@ -0,0 +1,69 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp;
/**
* Block/node types
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class Type
{
const T_ASSIGN = 'assign';
const T_AT_ROOT = 'at-root';
const T_BLOCK = 'block';
const T_BREAK = 'break';
const T_CHARSET = 'charset';
const T_COLOR = 'color';
const T_COMMENT = 'comment';
const T_CONTINUE = 'continue';
const T_CONTROL = 'control';
const T_DEBUG = 'debug';
const T_DIRECTIVE = 'directive';
const T_EACH = 'each';
const T_ELSE = 'else';
const T_ELSEIF = 'elseif';
const T_ERROR = 'error';
const T_EXPRESSION = 'exp';
const T_EXTEND = 'extend';
const T_FOR = 'for';
const T_FUNCTION = 'function';
const T_FUNCTION_CALL = 'fncall';
const T_HSL = 'hsl';
const T_IF = 'if';
const T_IMPORT = 'import';
const T_INCLUDE = 'include';
const T_INTERPOLATE = 'interpolate';
const T_INTERPOLATED = 'interpolated';
const T_KEYWORD = 'keyword';
const T_LIST = 'list';
const T_MAP = 'map';
const T_MEDIA = 'media';
const T_MEDIA_EXPRESSION = 'mediaExp';
const T_MEDIA_TYPE = 'mediaType';
const T_MEDIA_VALUE = 'mediaValue';
const T_MIXIN = 'mixin';
const T_MIXIN_CONTENT = 'mixin_content';
const T_NESTED_PROPERTY = 'nestedprop';
const T_NOT = 'not';
const T_NULL = 'null';
const T_NUMBER = 'number';
const T_RETURN = 'return';
const T_ROOT = 'root';
const T_SCSSPHP_IMPORT_ONCE = 'scssphp-import-once';
const T_SELF = 'self';
const T_STRING = 'string';
const T_UNARY = 'unary';
const T_VARIABLE = 'var';
const T_WARN = 'warn';
const T_WHILE = 'while';
}

55
lib/vendor/scss/Util.class.php vendored Normal file
View file

@ -0,0 +1,55 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp;
use Leafo\ScssPhp\Base\Range;
/**
* Utilties
*
* @author Anthon Pang <anthon.pang@gmail.com>
*/
class Util
{
/**
* Asserts that `value` falls within `range` (inclusive), leaving
* room for slight floating-point errors.
*
* @param string $name The name of the value. Used in the error message.
* @param Range $range Range of values.
* @param array $value The value to check.
* @param string $unit The unit of the value. Used in error reporting.
*
* @return mixed `value` adjusted to fall within range, if it was outside by a floating-point margin.
*
* @throws \Exception
*/
public static function checkRange($name, Range $range, $value, $unit = '')
{
$val = $value[1];
$grace = new Range(-0.00001, 0.00001);
if ($range->includes($val)) {
return $val;
}
if ($grace->includes($val - $range->first)) {
return $range->first;
}
if ($grace->includes($val - $range->last)) {
return $range->last;
}
throw new \Exception("$name {$val} must be between {$range->first} and {$range->last}$unit");
}
}

22
lib/vendor/scss/Version.class.php vendored Normal file
View file

@ -0,0 +1,22 @@
<?php
/**
* SCSSPHP
*
* @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://leafo.github.io/scssphp
*/
namespace Leafo\ScssPhp;
/**
* SCSSPHP version
*
* @author Leaf Corcoran <leafot@gmail.com>
*/
class Version
{
const VERSION = 'v0.6.3';
}

26
update.php Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/php
<?php
include __DIR__.'/bootstrap.php';
chdir(ROOT_DIR);
Shell::exec('rm ./web/css/*');
Shell::exec('git checkout master && git pull');
$scss = new \Leafo\ScssPhp\Compiler();
$scss->setImportPaths([ROOT_DIR.'/web/scss']);
$compress = true;
if ($compress)
{
$scss->setFormatter('Leafo\ScssPhp\Formatter\Crunched');
}
else
{
$scss->setFormatter('Leafo\ScssPhp\Formatter\Expanded');
$scss->setLineNumberStyle(Leafo\ScssPhp\Compiler::LINE_COMMENTS);
}
file_put_contents(ROOT_DIR.'/web/css/all.css', $scss->compile(file_get_contents(ROOT_DIR.'/web/scss/all.scss')));

View file

@ -1,6 +0,0 @@
#!/bin/sh
cd "$(dirname "$0")"
rm web/css/*
git checkout master && git pull
sass --update web/scss:web/css --style compressed -E "UTF-8"

View file

@ -62,7 +62,7 @@ class View
protected static function getFullPath($template) protected static function getFullPath($template)
{ {
return $_SERVER['ROOT_DIR'] . '/view/' . $template . '.php'; return ROOT_DIR . '/view/' . $template . '.php';
} }
public static function imagePath($image) public static function imagePath($image)
@ -89,4 +89,4 @@ class View
{ {
return static::$metaImg ?: 'http://lbry.io/img/lbry-dark-1600x528.png'; return static::$metaImg ?: 'http://lbry.io/img/lbry-dark-1600x528.png';
} }
} }

View file

@ -1,67 +1,67 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head prefix="og: http://ogp.me/ns#"> <head prefix="og: http://ogp.me/ns#">
<meta name="google-site-verification" content="QEyIHPbSKR2Z9ZNkfVHGdGv5EE7tTM7FE0Wt8tmcH50" /> <meta name="google-site-verification" content="QEyIHPbSKR2Z9ZNkfVHGdGv5EE7tTM7FE0Wt8tmcH50" />
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<?php $title = Response::getMetaTitle() ?: Response::guessMetaTitle($content) ?> <?php $title = Response::getMetaTitle() ?: Response::guessMetaTitle($content) ?>
<?php $title = $title ? <?php $title = $title ?
$title . (strpos($title, 'LBRY') === false ? ' - LBRY' : '') : $title . (strpos($title, 'LBRY') === false ? ' - LBRY' : '') :
'LBRY' ?> 'LBRY' ?>
<title><?php echo $title ?></title> <title><?php echo $title ?></title>
<link href='//fonts.googleapis.com/css?family=Raleway:600,300' rel='stylesheet' type='text/css'> <link href='//fonts.googleapis.com/css?family=Raleway:600,300' rel='stylesheet' type='text/css'>
<link href="/css/all.css" rel="stylesheet" type="text/css" media="screen,print" /> <link href="/css/all.css" rel="stylesheet" type="text/css" media="screen,print" />
<link rel="apple-touch-icon" sizes="60x60" href="/img/fav/apple-touch-icon-60x60.png"> <link rel="apple-touch-icon" sizes="60x60" href="/img/fav/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="114x114" href="/img/fav/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon" sizes="114x114" href="/img/fav/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/img/fav/apple-touch-icon-120x120.png"> <link rel="apple-touch-icon" sizes="120x120" href="/img/fav/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/img/fav/apple-touch-icon-144x144.png"> <link rel="apple-touch-icon" sizes="144x144" href="/img/fav/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="180x180" href="/img/fav/apple-touch-icon-180x180.png"> <link rel="apple-touch-icon" sizes="180x180" href="/img/fav/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="/img/fav/favicon-32x32.png" sizes="32x32"> <link rel="icon" type="image/png" href="/img/fav/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/img/fav/favicon-194x194.png" sizes="194x194"> <link rel="icon" type="image/png" href="/img/fav/favicon-194x194.png" sizes="194x194">
<link rel="icon" type="image/png" href="/img/fav/favicon-96x96.png" sizes="96x96"> <link rel="icon" type="image/png" href="/img/fav/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/img/fav/android-chrome-192x192.png" sizes="192x192"> <link rel="icon" type="image/png" href="/img/fav/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="/img/fav/favicon-16x16.png" sizes="16x16"> <link rel="icon" type="image/png" href="/img/fav/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/img/fav/manifest.json"> <link rel="manifest" href="/img/fav/manifest.json">
<meta name="description" content="<?php echo Response::getMetaDescription() ?>"> <meta name="description" content="<?php echo Response::getMetaDescription() ?>">
<meta name="msapplication-TileColor" content="#155B4A"> <meta name="msapplication-TileColor" content="#155B4A">
<meta name="msapplication-TileImage" content="/mstile-144x144.png"> <meta name="msapplication-TileImage" content="/mstile-144x144.png">
<meta name="theme-color" content="#155B4A"> <meta name="theme-color" content="#155B4A">
<!-- Twitter Card data --> <!-- Twitter Card data -->
<meta name="twitter:site" content="@lbryio"> <meta name="twitter:site" content="@lbryio">
<meta name="twitter:creator" content="@lbryio"> <meta name="twitter:creator" content="@lbryio">
<meta property="fb:app_id" content="1673146449633983" /> <meta property="fb:app_id" content="1673146449633983" />
<!-- Open Graph data --> <!-- Open Graph data -->
<meta property="og:title" content="<?php echo $title ?>" /> <meta property="og:title" content="<?php echo $title ?>" />
<meta property="og:type" content="article" /> <meta property="og:type" content="article" />
<meta property="og:image" content="<?php echo Response::getMetaImage() ?>" /> <meta property="og:image" content="<?php echo Response::getMetaImage() ?>" />
<meta property="og:description" content="<?php echo Response::getMetaDescription() ?>"/> <meta property="og:description" content="<?php echo Response::getMetaDescription() ?>"/>
<meta property="og:site_name" content="LBRY" /> <meta property="og:site_name" content="LBRY" />
<base target="_parent" /> <base target="_parent" />
</head> </head>
<body> <body>
<?php echo $content ?> <?php echo $content ?>
<div class="hide"> <div class="hide">
<div id="fb-root"></div> <div id="fb-root"></div>
<div id="js"> <div id="js">
<script id="facebook-jssdk" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1477813539180850"></script> <script id="facebook-jssdk" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1477813539180850"></script>
<script id="twitter-oct" src="https://platform.twitter.com/oct.js"></script> <script id="twitter-oct" src="https://platform.twitter.com/oct.js"></script>
<script id="twitter-wjs" src="https://platform.twitter.com/widgets.js"></script> <script id="twitter-wjs" src="https://platform.twitter.com/widgets.js"></script>
<?php foreach(Response::getJsAssets() as $src): ?> <?php foreach(Response::getJsAssets() as $src): ?>
<script src="<?php echo $src ?>"></script> <script src="<?php echo $src ?>"></script>
<?php endforeach ?> <?php endforeach ?>
<?php echo View::render('analytics/track') ?> <?php echo View::render('analytics/track') ?>
<?php $js = Response::getJsCalls() ?> <?php $js = Response::getJsCalls() ?>
<?php if ($js): ?> <?php if ($js): ?>
<script><?php echo implode("\n", $js) ?></script> <script><?php echo implode("\n", $js) ?></script>
<?php endif ?> <?php endif ?>
</div> </div>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,28 +1,28 @@
<?php if (!defined('HEADER_RENDERED')): ?> <?php if (!defined('HEADER_RENDERED')): ?>
<?php define('HEADER_RENDERED', 1) ?> <?php define('HEADER_RENDERED', 1) ?>
<?php extract([ <?php extract([
'isDark' => false 'isDark' => false
], EXTR_SKIP) ?> ], EXTR_SKIP) ?>
<div class="header <?php echo $isDark ? 'header-dark' : 'header-light' ?>"> <div class="header <?php echo $isDark ? 'header-dark' : 'header-light' ?>">
<div class="header-content"> <div class="header-content">
<a href="/" class="primary-logo"> <a href="/" class="primary-logo">
<img src="<?php echo $isDark ? View::imagePath('header-logo-light.png') : View::imagePath('header-logo-dark2.png') ?>" alt="LBRY" /> <img src="<?php echo $isDark ? View::imagePath('header-logo-light.png') : View::imagePath('header-logo-dark2.png') ?>" alt="LBRY" />
<?php /* <?php /*
<img src="<?php echo View::imagePath('header-logo-light.png') ?>" alt="LBRY" class="logo-light" /> <img src="<?php echo View::imagePath('header-logo-light.png') ?>" alt="LBRY" class="logo-light" />
<img src="<?php echo View::imagePath('header-logo-dark.png') ?>" alt="LBRY" class="logo-dark" /> <img src="<?php echo View::imagePath('header-logo-dark.png') ?>" alt="LBRY" class="logo-dark" />
*/ ?> */ ?>
</a> </a>
<div class="mobile header-navigation-mobile"> <div class="mobile header-navigation-mobile">
<a href="javascript:;" data-action="toggle-class" data-for=".header" data-class="header-open"> <a href="javascript:;" data-action="toggle-class" data-for=".header" data-class="header-open">
<span class="icon icon-bars"></span> <span class="icon icon-bars"></span>
<span class="icon icon-close"></span> <span class="icon icon-close"></span>
</a> </a>
</div> </div>
<div class="fullscreen header-navigation-fullscreen"> <div class="fullscreen header-navigation-fullscreen">
<div class="control-group"> <div class="control-group">
<?php echo View::render('nav/globalItems') ?> <?php echo View::render('nav/globalItems') ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php endif ?> <?php endif ?>

View file

@ -1,21 +1,21 @@
<?php Response::setMetaDescription('Download or install the latest version of LBRY.') ?> <?php Response::setMetaDescription('Download or install the latest version of LBRY.') ?>
<?php Response::setMetaTitle(__('Get LBRY')) ?> <?php Response::setMetaTitle(__('Get LBRY')) ?>
<main class="cover-stretch-wrap"> <main class="cover-stretch-wrap">
<div class="cover cover-stretch cover-dark cover-dark-grad"> <div class="cover cover-stretch cover-dark cover-dark-grad">
<div class="content content-dark"> <div class="content content-dark">
<div class="spacer2"> <div class="spacer2">
<a href="/"><img src="/img/lbry-white-485x160.png" alt="Fund LBRY"/></a> <a href="/"><img src="/img/lbry-white-485x160.png" alt="Fund LBRY"/></a>
</div> </div>
<div class="cover cover-light cover-light-alt-grad"> <div class="cover cover-light cover-light-alt-grad">
<div class="content content-light"> <div class="content content-light">
<h1>Thank You!!!</h1> <h1>Thank You!!!</h1>
<p>OMG thanks for paying.</p> <p>OMG thanks for paying.</p>
<p>Here is a unique URL that you can use to refer others. You get 10% bonus credits for anyone who uses it.</p> <p>Here is a unique URL that you can use to refer others. You get 10% bonus credits for anyone who uses it.</p>
<h3><a class="link-primary" href="http://lbry.io/i/butts">http://lbry.io/i/butts</a></h3> <h3><a class="link-primary" href="http://lbry.io/i/butts">http://lbry.io/i/butts</a></h3>
<p>Here are some details about how to claim them or other things you would want to know.</p> <p>Here are some details about how to claim them or other things you would want to know.</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
<?php echo View::render('nav/footer') ?> <?php echo View::render('nav/footer') ?>

View file

@ -1,193 +1,193 @@
<?php Response::setMetaTitle(__('Fund LBRY')) ?> <?php Response::setMetaTitle(__('Fund LBRY')) ?>
<?php Response::setMetaDescription('Contribute to the future of LBRY and buy credits for the LBRY network at pre-release prices.') ?> <?php Response::setMetaDescription('Contribute to the future of LBRY and buy credits for the LBRY network at pre-release prices.') ?>
<?php echo View::render('nav/header', ['isDark' => false]) ?> <?php echo View::render('nav/header', ['isDark' => false]) ?>
<main> <main>
<div class="cover cover-dark cover-dark-grad"> <div class="cover cover-dark cover-dark-grad">
<div class="row-fluid"> <div class="row-fluid">
<div class="span9 spacer2"> <div class="span9 spacer2">
<?php echo View::render('fund/header') ?> <?php echo View::render('fund/header') ?>
<h2>TEST TEST TEST TEST TEST - You probably don't want to be here</h2> <h2>TEST TEST TEST TEST TEST - You probably don't want to be here</h2>
<h3>Current Goal</h3> <h3>Current Goal</h3>
<div class="content content-dark"> <div class="content content-dark">
<?php echo View::render('fund/currentGoal') ?> <?php echo View::render('fund/currentGoal') ?>
</div> </div>
<h3>Select Your Level</h3> <h3>Select Your Level</h3>
<?php ob_start() ?> <?php ob_start() ?>
<ul> <ul>
<li><?php echo __('A personal thank you in the source code, recording your contribution for eternity.') ?></li> <li><?php echo __('A personal thank you in the source code, recording your contribution for eternity.') ?></li>
<li><?php echo __('Early access to LBRY test releases.') ?></li> <li><?php echo __('Early access to LBRY test releases.') ?></li>
<li><?php echo __('Insider newsletter about our work on LBRY.') ?></li> <li><?php echo __('Insider newsletter about our work on LBRY.') ?></li>
</ul> </ul>
<?php $basicRewardHtml = ob_get_clean() ?> <?php $basicRewardHtml = ob_get_clean() ?>
<?php ob_start() ?> <?php ob_start() ?>
<ul> <ul>
<li><?php echo __('All above rewards.') ?></li> <li><?php echo __('All above rewards.') ?></li>
<li><?php echo __('Record personal message of up to 140 characters in LBRY source code for eternity.') ?></li> <li><?php echo __('Record personal message of up to 140 characters in LBRY source code for eternity.') ?></li>
<li><?php echo __('1 year of basic support from LBRY.') ?></li> <li><?php echo __('1 year of basic support from LBRY.') ?></li>
</ul> </ul>
<?php $standardRewardHtml = ob_get_clean() ?> <?php $standardRewardHtml = ob_get_clean() ?>
<?php ob_start() ?> <?php ob_start() ?>
<ul> <ul>
<li><?php echo __('All above rewards.') ?></li> <li><?php echo __('All above rewards.') ?></li>
<li><?php echo __('LBRY T-shirt') ?></li> <li><?php echo __('LBRY T-shirt') ?></li>
<li><?php echo __('Invitation to join private LBRY team chat.') ?></li> <li><?php echo __('Invitation to join private LBRY team chat.') ?></li>
</ul> </ul>
<?php $optimalRewardHtml = ob_get_clean() ?> <?php $optimalRewardHtml = ob_get_clean() ?>
<?php ob_start() ?> <?php ob_start() ?>
<ul> <ul>
<li><?php echo __('All above rewards.') ?></li> <li><?php echo __('All above rewards.') ?></li>
<li><?php echo __('Meet with core LBRY team members for thirty minute video chat.') ?></li> <li><?php echo __('Meet with core LBRY team members for thirty minute video chat.') ?></li>
<li><?php echo __('Something else awesome?') ?></li> <li><?php echo __('Something else awesome?') ?></li>
<li><?php echo __('We will kiss you on the face (no tongue).') ?></li> <li><?php echo __('We will kiss you on the face (no tongue).') ?></li>
</ul> </ul>
<?php $prometheusRewardHtml = ob_get_clean() ?> <?php $prometheusRewardHtml = ob_get_clean() ?>
<?php ob_start() ?> <?php ob_start() ?>
<ul> <ul>
<li><?php echo __('All above rewards.') ?></li> <li><?php echo __('All above rewards.') ?></li>
<li><?php echo __('Any LBRY team member will give a presentation on LBRY in your city or most places on earth.') ?></li> <li><?php echo __('Any LBRY team member will give a presentation on LBRY in your city or most places on earth.') ?></li>
<li><?php echo __('You pick one of the ten founding publications to the LBRY blockchain.') ?></li> <li><?php echo __('You pick one of the ten founding publications to the LBRY blockchain.') ?></li>
<li><?php echo __('We will kiss you on the face, with tongue.') ?></li> <li><?php echo __('We will kiss you on the face, with tongue.') ?></li>
</ul> </ul>
<?php $apolloRewardHtml = ob_get_clean() ?> <?php $apolloRewardHtml = ob_get_clean() ?>
<?php $maxCreditAmount = 100 ?> <?php $maxCreditAmount = 100 ?>
<div class="sale-levels spacer2"> <div class="sale-levels spacer2">
<?php foreach([[ <?php foreach([[
'id' => 'basic', 'id' => 'basic',
'label' => __('Basic'), 'label' => __('Basic'),
'cost' => 10, 'cost' => 10,
'rewardHtml' => $basicRewardHtml 'rewardHtml' => $basicRewardHtml
], [ ], [
'id' => 'standard', 'id' => 'standard',
'label' => __('Standard'), 'label' => __('Standard'),
'cost' => 25, 'cost' => 25,
'rewardHtml' => $standardRewardHtml 'rewardHtml' => $standardRewardHtml
], [ ], [
'id' => 'optimal', 'id' => 'optimal',
'label' => __('Optimal'), 'label' => __('Optimal'),
'cost' => 100, 'cost' => 100,
'rewardHtml' => $optimalRewardHtml 'rewardHtml' => $optimalRewardHtml
], [ ], [
'id' => 'prometheus ', 'id' => 'prometheus ',
'label' => __('Prometheus'), 'label' => __('Prometheus'),
'cost' => 1000, 'cost' => 1000,
'rewardHtml' => $prometheusRewardHtml 'rewardHtml' => $prometheusRewardHtml
], [ ], [
'id' => 'apollo', 'id' => 'apollo',
'label' => __('Apollo'), 'label' => __('Apollo'),
'cost' => 10000, 'cost' => 10000,
'rewardHtml' => $apolloRewardHtml 'rewardHtml' => $apolloRewardHtml
]] as $level): ?> ]] as $level): ?>
<?php $creditCost = min($level['cost'], $maxCreditAmount) ?> <?php $creditCost = min($level['cost'], $maxCreditAmount) ?>
<div class="sale-level sale-level-clickable"> <div class="sale-level sale-level-clickable">
<h4 class="sale-level-label"><?php echo $level['label'] ?></h4> <h4 class="sale-level-label"><?php echo $level['label'] ?></h4>
<div class="sale-level-cost"><?php echo i18n::formatCurrency($level['cost']) ?></div> <div class="sale-level-cost"><?php echo i18n::formatCurrency($level['cost']) ?></div>
<div class="row-fluid clear"> <div class="row-fluid clear">
<div class="span3 spacer1"> <div class="span3 spacer1">
<h6 class="sale-level-reward-title"><?php echo __('Credit Reward') ?></h6> <h6 class="sale-level-reward-title"><?php echo __('Credit Reward') ?></h6>
<?php $creditsToday = $creditCost * $creditsPerDollar ?> <?php $creditsToday = $creditCost * $creditsPerDollar ?>
<?php $creditFall = $creditsToday - $creditCost * $creditsPerDollarTomorrow ?> <?php $creditFall = $creditsToday - $creditCost * $creditsPerDollarTomorrow ?>
<div class="sale-level-credits"><?php echo i18n::formatCredits($creditsToday) ?></div> <div class="sale-level-credits"><?php echo i18n::formatCredits($creditsToday) ?></div>
<div class="sale-level-help"> <div class="sale-level-help">
<?php echo __('This reward falls by %amount% tomorrow!', [ <?php echo __('This reward falls by %amount% tomorrow!', [
'%amount%' => i18n::formatCredits($creditFall) '%amount%' => i18n::formatCredits($creditFall)
]) ?> ]) ?>
</div> </div>
</div> </div>
<div class="span9"> <div class="span9">
<h6 class="sale-level-reward-title"><?php echo __('Additional Rewards') ?></h6> <h6 class="sale-level-reward-title"><?php echo __('Additional Rewards') ?></h6>
<div class="sale-level-reward"><?php echo $level['rewardHtml'] ?></div> <div class="sale-level-reward"><?php echo $level['rewardHtml'] ?></div>
</div> </div>
</div> </div>
<input name="fund-id" value="<?php echo $level['id'] ?>" type="radio" class="sale-level-radio"/> <input name="fund-id" value="<?php echo $level['id'] ?>" type="radio" class="sale-level-radio"/>
</div> </div>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
<div class="sale-checkout-acknowledgements spacer2"> <div class="sale-checkout-acknowledgements spacer2">
<h4><?php echo __('Acknowledgements') ?></h4> <h4><?php echo __('Acknowledgements') ?></h4>
<div class="content content-dark"> <div class="content content-dark">
<div class="form-row"> <div class="form-row">
<label for="fund-not-investment"> <label for="fund-not-investment">
<input type="checkbox" id="fund-not-investment" value="not_investment"> <input type="checkbox" id="fund-not-investment" value="not_investment">
<?php echo __('I am making this purchase to acquire LBC for my own personal use on the LBRY network.') ?> <?php echo __('I am making this purchase to acquire LBC for my own personal use on the LBRY network.') ?>
<?php echo __('I am not acquiring LBC for speculation purposes, investment purposes, or with any intent to resell.') ?> <?php echo __('I am not acquiring LBC for speculation purposes, investment purposes, or with any intent to resell.') ?>
</label> </label>
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="fund-not-guaranteed"> <label for="fund-not-guaranteed">
<input type="checkbox" id="fund-not-guaranteed" value="not_guaranteed"> <input type="checkbox" id="fund-not-guaranteed" value="not_guaranteed">
<?php echo __('I acknowledge that LBRY is a new, unproven venture.') ?> <?php echo __('I acknowledge that LBRY is a new, unproven venture.') ?>
<?php echo __('I understand and accept that LBRY may fail for any number of reasons and there is no guarantee my credits will be redeemable.') ?> <?php echo __('I understand and accept that LBRY may fail for any number of reasons and there is no guarantee my credits will be redeemable.') ?>
</label> </label>
</div> </div>
</div> </div>
</div> </div>
<div class="sale-checkout-select"> <div class="sale-checkout-select">
<h4><?php echo __('Select Payment') ?></h4> <h4><?php echo __('Select Payment') ?></h4>
<div class="control-group"> <div class="control-group">
<div class="control-item control-item-img"> <div class="control-item control-item-img">
<a href="/fund-after"><img src="/img/bitcoin-button-126x48.png" alt="<?php echo __('Pay with Bitcoin') ?>" /></a> <a href="/fund-after"><img src="/img/bitcoin-button-126x48.png" alt="<?php echo __('Pay with Bitcoin') ?>" /></a>
</div> </div>
<div class="control-item control-item-img"> <div class="control-item control-item-img">
<a href="/fund-after" ><img src="/img/paypal-button-170x32.png" style="margin-top: 5px" alt="<?php echo __('Pay with PayPal') ?>" /></a> <a href="/fund-after" ><img src="/img/paypal-button-170x32.png" style="margin-top: 5px" alt="<?php echo __('Pay with PayPal') ?>" /></a>
</div> </div>
<div class="control-item" style="vertical-align: top; margin-top: 7px;"> <div class="control-item" style="vertical-align: top; margin-top: 7px;">
<a href="/fund-after" class="btn-alt"><span class="icon-shopping-cart" style="margin-right: 2px"></span> <?php echo __('Pay with Credit') ?></a> <a href="/fund-after" class="btn-alt"><span class="icon-shopping-cart" style="margin-right: 2px"></span> <?php echo __('Pay with Credit') ?></a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="span3"> <div class="span3">
<div class="sale-question-bubble"> <div class="sale-question-bubble">
<h4 class="sale-question"><?php echo __('Where does my money go?') ?></h4> <h4 class="sale-question"><?php echo __('Where does my money go?') ?></h4>
<div class="sale-question-answer"> <div class="sale-question-answer">
<p> <p>
<?php echo __('These funds will fund the develop of LBRY on all platforms, spur the LBRY ecosystem, and generally help LBRY launch as a race car rather than a bus.') ?> <?php echo __('These funds will fund the develop of LBRY on all platforms, spur the LBRY ecosystem, and generally help LBRY launch as a race car rather than a bus.') ?>
</p> </p>
<p> <p>
<?php echo __('LBRY will launch even if 0 credits are sold.') ?> <?php echo __('LBRY will launch even if 0 credits are sold.') ?>
<?php echo __('Funds will be administered with complete transparency.') ?> <?php echo __('Funds will be administered with complete transparency.') ?>
</p> </p>
<a class="link-primary" href="/learn"><?php echo __('Learn More') ?></a> <a class="link-primary" href="/learn"><?php echo __('Learn More') ?></a>
</div> </div>
</div> </div>
<div class="sale-question-bubble"> <div class="sale-question-bubble">
<h4 class="sale-question"><?php echo __('What do I get?') ?> <?php echo __('What is LBC?') ?></h4> <h4 class="sale-question"><?php echo __('What do I get?') ?> <?php echo __('What is LBC?') ?></h4>
<div class="sale-question-answer"> <div class="sale-question-answer">
<p> <p>
<?php echo __('Anytime someone publishes or accesses data via the LBRY network, LBRY Credits, or LBC, are required.') ?> <?php echo __('Anytime someone publishes or accesses data via the LBRY network, LBRY Credits, or LBC, are required.') ?>
</p> </p>
<p> <p>
<?php echo __('There are two primary reasons to buy LBC now:') ?><br/> <?php echo __('There are two primary reasons to buy LBC now:') ?><br/>
<?php echo __('1) This is probably the cheapest they will ever be.') ?><br/> <?php echo __('1) This is probably the cheapest they will ever be.') ?><br/>
<?php echo __('2) You will help build the greatest information sharing network the world has ever seen.') ?> <?php echo __('2) You will help build the greatest information sharing network the world has ever seen.') ?>
</p> </p>
<a class="link-primary" href="/learn"><?php echo __('Learn More') ?></a> <a class="link-primary" href="/learn"><?php echo __('Learn More') ?></a>
</div> </div>
</div> </div>
<div class="sale-question-bubble"> <div class="sale-question-bubble">
<h4 class="sale-question"><?php echo __('Why can I only buy up to $100 worth of credits?') ?></h4> <h4 class="sale-question"><?php echo __('Why can I only buy up to $100 worth of credits?') ?></h4>
<div class="sale-question-answer"> <div class="sale-question-answer">
<p> <p>
<?php echo __('We have limited the maximum credit purchase because this pre-buy program is only intended to sell you credits for your own personal use, not for purposes of speculation or investment.') ?> <?php echo __('We have limited the maximum credit purchase because this pre-buy program is only intended to sell you credits for your own personal use, not for purposes of speculation or investment.') ?>
</p> </p>
<p> <p>
<?php echo __('However, we do want to allow those who want to contribute larger amounts to be able to do so, so we\'ve come up with some exciting non-credit rewards.') ?> <?php echo __('However, we do want to allow those who want to contribute larger amounts to be able to do so, so we\'ve come up with some exciting non-credit rewards.') ?>
</p> </p>
</div> </div>
</div> </div>
<div class="sale-question-bubble"> <div class="sale-question-bubble">
<h4 class="sale-question"><?php echo __('I want to talk to someone or have another question.') ?></h4> <h4 class="sale-question"><?php echo __('I want to talk to someone or have another question.') ?></h4>
<div class="sale-question-answer"> <div class="sale-question-answer">
<p> <p>
<?php echo __('Finding our %learn_page_title% page too complicated or too simple? Just want to talk to someone about your day? We\'re here at %address%.', [ <?php echo __('Finding our %learn_page_title% page too complicated or too simple? Just want to talk to someone about your day? We\'re here at %address%.', [
'%learn_page_title%' => '<a href="/" class="link-primary">' . __('Learn') . '</a>', '%learn_page_title%' => '<a href="/" class="link-primary">' . __('Learn') . '</a>',
'%address%' => '<a href="mailto:fund@lbry.io" class="link-primary">fund@lbry.io</a>', '%address%' => '<a href="mailto:fund@lbry.io" class="link-primary">fund@lbry.io</a>',
]) ?> ]) ?>
</p> </p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
<?php echo View::render('nav/footer') ?> <?php echo View::render('nav/footer') ?>

View file

@ -1,60 +1,60 @@
<?php Response::setMetaDescription('Download or install the latest version of LBRY.') ?> <?php Response::setMetaDescription('Download or install the latest version of LBRY.') ?>
<?php Response::setMetaTitle(__('Get LBRY')) ?> <?php Response::setMetaTitle(__('Get LBRY')) ?>
<?php echo View::render('nav/header', ['isDark' => false]) ?> <?php echo View::render('nav/header', ['isDark' => false]) ?>
<main class="column-fluid"> <main class="column-fluid">
<div class="span6"> <div class="span6">
<div class="cover cover-dark cover-dark-grad"> <div class="cover cover-dark cover-dark-grad">
<div class="content content-dark"> <div class="content content-dark">
<div class="meta meta-large"> <div class="meta meta-large">
<span class="icon-mobile"></span> <span class="icon-windows"></span> <span class="icon-android"></span> <span class="icon-mobile"></span> <span class="icon-windows"></span> <span class="icon-android"></span>
</div> </div>
<h1><?php echo __('I want LBRY for mobile, Windows, or shudder at the phrase "command line".') ?></h1> <h1><?php echo __('I want LBRY for mobile, Windows, or shudder at the phrase "command line".') ?></h1>
<p class="pflow">LBRY is coming out on your favorite platform soon. Join our list to know when.</p> <p class="pflow">LBRY is coming out on your favorite platform soon. Join our list to know when.</p>
<?php echo View::render('mail/joinList', [ <?php echo View::render('mail/joinList', [
'submitLabel' => 'Go', 'submitLabel' => 'Go',
'returnUrl' => '/get', 'returnUrl' => '/get',
'listId' => Mailchimp::LIST_GENERAL_ID, 'listId' => Mailchimp::LIST_GENERAL_ID,
'mergeFields' => ['CLI' => 'No'], 'mergeFields' => ['CLI' => 'No'],
'btnClass' => 'btn-alt' 'btnClass' => 'btn-alt'
]) ?> ]) ?>
</div> </div>
</div> </div>
</div> </div>
<div class="span6"> <div class="span6">
<div class="cover cover-light"> <div class="cover cover-light">
<div class="content"> <div class="content">
<div class="meta meta-large"> <div class="meta meta-large">
<span class="icon-linux"></span> <span class="icon-apple"></span> <span class="icon-linux"></span> <span class="icon-apple"></span>
</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="spacer1"> <div class="spacer1">
<?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' => 'Yes'], 'mergeFields' => ['CLI' => 'Yes'],
'fbEvent' => 'Alpha', 'fbEvent' => 'Alpha',
'returnUrl' => '/get?email=1' 'returnUrl' => '/get?email=1'
]) ?> ]) ?>
</div> </div>
<?php if (!$isSubscribed): ?> <?php if (!$isSubscribed): ?>
<div class="meta"> <div class="meta">
Already signed up or really hate sharing your email? <a href="/get?email=1" class="link-primary">Click here.</a> Already signed up or really hate sharing your email? <a href="/get?email=1" class="link-primary">Click here.</a>
</div> </div>
<?php else: ?> <?php else: ?>
<div class="content-inset"> <div class="content-inset">
<ul class="no-style"> <ul class="no-style">
<li> <li>
<a href="/linux" class="link-primary"><span class="icon-linux"></span> Linux</a> <a href="/linux" class="link-primary"><span class="icon-linux"></span> Linux</a>
</li> </li>
<li> <li>
<a href="/osx" class="link-primary"><span class="icon-apple"></span> OS X</a> <a href="/osx" class="link-primary"><span class="icon-apple"></span> OS X</a>
</li> </li>
</ul> </ul>
</div> </div>
<?php endif ?> <?php endif ?>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
<?php echo View::render('nav/footer') ?> <?php echo View::render('nav/footer') ?>

View file

@ -1,42 +1,42 @@
<?php Response::setMetaTitle(__('LBRY Fund Goals')) ?> <?php Response::setMetaTitle(__('LBRY Fund Goals')) ?>
<?php Response::setMetaDescription('Download or install the latest version of LBRY.') ?> <?php Response::setMetaDescription('Download or install the latest version of LBRY.') ?>
<?php echo View::render('nav/header', ['isDark' => false]) ?> <?php echo View::render('nav/header', ['isDark' => false]) ?>
<main> <main>
<div class="cover cover-dark cover-dark-grad"> <div class="cover cover-dark cover-dark-grad">
<div class="content content-dark"> <div class="content content-dark">
<?php echo View::render('fund/header') ?> <?php echo View::render('fund/header') ?>
<h2><?php echo __('Active Goal') ?></h2> <h2><?php echo __('Active Goal') ?></h2>
<?php echo View::render('fund/currentGoal') ?> <?php echo View::render('fund/currentGoal') ?>
<h1><?php echo __('All Goals') ?></h1> <h1><?php echo __('All Goals') ?></h1>
<?php ob_start() ?> <?php ob_start() ?>
<p>Core development continues through 2016.</p> <p>Core development continues through 2016.</p>
<?php $coreDevRewardHtml = ob_get_clean() ?> <?php $coreDevRewardHtml = ob_get_clean() ?>
<?php ob_start() ?> <?php ob_start() ?>
<p>Android and iPhone so cool.</p> <p>Android and iPhone so cool.</p>
<?php $appRewardHtml = ob_get_clean() ?> <?php $appRewardHtml = ob_get_clean() ?>
</div> </div>
<div class="content content-light"> <div class="content content-light">
<div class="sale-levels spacer2"> <div class="sale-levels spacer2">
<?php foreach([[ <?php foreach([[
'name' => 'Core Development Continues', 'name' => 'Core Development Continues',
'amount' => 25000, 'amount' => 25000,
'rewardHtml' => $coreDevRewardHtml 'rewardHtml' => $coreDevRewardHtml
], [ ], [
'name' => 'Android and iPhone Apps', 'name' => 'Android and iPhone Apps',
'amount' => 50000, 'amount' => 50000,
'rewardHtml' => $appRewardHtml 'rewardHtml' => $appRewardHtml
]] as $goal): ?> ]] as $goal): ?>
<div class="sale-level"> <div class="sale-level">
<h4 class="sale-level-label"><?php echo $goal['name'] ?></h4> <h4 class="sale-level-label"><?php echo $goal['name'] ?></h4>
<div class="sale-level-cost"><?php echo i18n::formatCurrency($goal['amount']) ?></div> <div class="sale-level-cost"><?php echo i18n::formatCurrency($goal['amount']) ?></div>
<div class="row-fluid clear"> <div class="row-fluid clear">
<h6 class="sale-level-reward-title"><?php echo __('Reward') ?></h6> <h6 class="sale-level-reward-title"><?php echo __('Reward') ?></h6>
<div class="sale-level-reward"><?php echo $goal['rewardHtml'] ?></div> <div class="sale-level-reward"><?php echo $goal['rewardHtml'] ?></div>
</div> </div>
</div> </div>
<?php endforeach ?> <?php endforeach ?>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
<?php echo View::render('nav/footer') ?> <?php echo View::render('nav/footer') ?>

View file

@ -1,70 +1,70 @@
<?php Response::setMetaDescription('Download or install the latest version of LBRY.') ?> <?php Response::setMetaDescription('Download or install the latest version of LBRY.') ?>
<?php Response::setMetaTitle(__('Learn About LBRY')) ?> <?php Response::setMetaTitle(__('Learn About LBRY')) ?>
<?php echo View::render('nav/header', ['isDark' => false]) ?> <?php echo View::render('nav/header', ['isDark' => false]) ?>
<main class="column-fluid"> <main class="column-fluid">
<div class="span4"> <div class="span4">
<div class="cover cover-column cover-light-alt cover-light-alt-grad"> <div class="cover cover-column cover-light-alt cover-light-alt-grad">
<div class="content content-light"> <div class="content content-light">
<h1><?php echo __('What?') ?></h1> <h1><?php echo __('What?') ?></h1>
<div class="spacer1"> <div class="spacer1">
<div class="spacer1"> <div class="spacer1">
<a href="/img/lbry-win-ss-783x272.png"> <a href="/img/lbry-win-ss-783x272.png">
<img src="/img/lbry-win-ss-783x272.png" /> <img src="/img/lbry-win-ss-783x272.png" />
</a> </a>
</div> </div>
<p><em>Puts on jargon hat.</em></p> <p><em>Puts on jargon hat.</em></p>
<p> <p>
LBRY is a decentralized, censorship-resistant, open-source, peer-to-peer information marketplace and discovery protocol. LBRY is a decentralized, censorship-resistant, open-source, peer-to-peer information marketplace and discovery protocol.
</p> </p>
<p><em>Removes jargon hat.</em></p> <p><em>Removes jargon hat.</em></p>
<p> <p>
LBRY is a new way for people to publish and share content with each other. LBRY is a new way for people to publish and share content with each other.
</p> </p>
<p> <p>
Our goal is to provide a single box that allows anyone anywhere to find and purchase digital content from anyone else. Our goal is to provide a single box that allows anyone anywhere to find and purchase digital content from anyone else.
</p> </p>
</div> </div>
<a href="/what" class="btn-primary"><?php echo __('More About LBRY') ?></a> <a href="/what" class="btn-primary"><?php echo __('More About LBRY') ?></a>
</div> </div>
</div> </div>
</div> </div>
<div class="span4"> <div class="span4">
<div class="cover cover-column cover-dark cover-dark-grad "> <div class="cover cover-column cover-dark cover-dark-grad ">
<div class="content content-dark"> <div class="content content-dark">
<h1><?php echo __('Why?') ?></h1> <h1><?php echo __('Why?') ?></h1>
<div class="spacer1"> <div class="spacer1">
<p><?php echo __('Current systems benefit huge corporations that add little but extract a lot.') ?></p> <p><?php echo __('Current systems benefit huge corporations that add little but extract a lot.') ?></p>
<p> <p>
<?php echo __('We don\'t like it when middlemen, greedy rent-seekers, and kleptocrats win.') ?></p> <?php echo __('We don\'t like it when middlemen, greedy rent-seekers, and kleptocrats win.') ?></p>
</p> </p>
<p><?php echo __('We think a better world is one in which artists and consumers are directly connected.') ?></p> <p><?php echo __('We think a better world is one in which artists and consumers are directly connected.') ?></p>
</div> </div>
<div class="spacer1"> <div class="spacer1">
<a href="/why" class="btn-alt"><?php echo __('Why Make LBRY') ?></a> <a href="/why" class="btn-alt"><?php echo __('Why Make LBRY') ?></a>
</div> </div>
<div> <div>
<img src="/img/smbc-comic.png" /> <img src="/img/smbc-comic.png" />
</div> </div>
<div class="meta text-center"> <div class="meta text-center">
Credit <a href="//www.smbc-comics.com/" class="link-primary">SMBC</a>. Credit <a href="//www.smbc-comics.com/" class="link-primary">SMBC</a>.
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="span4"> <div class="span4">
<div class="cover cover-column cover-light"> <div class="cover cover-column cover-light">
<div class="content"> <div class="content">
<h1><?php echo __('Who?') ?></h1> <h1><?php echo __('Who?') ?></h1>
<div class="spacer1"> <div class="spacer1">
<p><?php echo __('LBRY promises an awful lot.') ?> <?php echo __('Can you trust us to deliver?') ?></p> <p><?php echo __('LBRY promises an awful lot.') ?> <?php echo __('Can you trust us to deliver?') ?></p>
<p><?php echo __('Learn more about the relentless rebels changing the internet.') ?></p> <p><?php echo __('Learn more about the relentless rebels changing the internet.') ?></p>
</div> </div>
<div class="spacer1"> <div class="spacer1">
<a href="/team" class="btn-alt"><?php echo __('About The Team') ?></a> <a href="/team" class="btn-alt"><?php echo __('About The Team') ?></a>
</div> </div>
<img src="/img/cover-team.jpg" alt="<?php echo __('LBRY Founders') ?>" /> <img src="/img/cover-team.jpg" alt="<?php echo __('LBRY Founders') ?>" />
</div> </div>
</div> </div>
</div> </div>
</main> </main>
<?php echo View::render('nav/footer') ?> <?php echo View::render('nav/footer') ?>

View file

@ -1,102 +1,102 @@
<?php Response::setMetaDescription('Access information and content in ways you never dreamed possible. Earn credits for your unused bandwidth and diskspace.') ?> <?php Response::setMetaDescription('Access information and content in ways you never dreamed possible. Earn credits for your unused bandwidth and diskspace.') ?>
<?php NavActions::setNavUri('/learn') ?> <?php NavActions::setNavUri('/learn') ?>
<?php echo View::render('nav/header', ['isDark' => false]) ?> <?php echo View::render('nav/header', ['isDark' => false]) ?>
<main> <main>
<div class="content"> <div class="content">
<h1>What is LBRY?</h1> <h1>What is LBRY?</h1>
</div> </div>
<div class="hero hero-pattern spacer2"> <div class="hero hero-pattern spacer2">
<div class="hero-content text-center"> <div class="hero-content text-center">
<h2 class="hero-title">A revolution in accessing and publishing information.</h2> <h2 class="hero-title">A revolution in accessing and publishing information.</h2>
<div class="row-fluid hero-tile-row"> <div class="row-fluid hero-tile-row">
<div class="span4 hero-tile"> <div class="span4 hero-tile">
<div class="spacer1"> <div class="spacer1">
<span class="icon-money icon-mega"></span> <span class="icon-money icon-mega"></span>
</div> </div>
<h4> <h4>
<strong>Hosts</strong> earn credits for providing bandwidth and disk space. <strong>Hosts</strong> earn credits for providing bandwidth and disk space.
</h4> </h4>
</div> </div>
<div class="span4 hero-tile"> <div class="span4 hero-tile">
<div class="spacer1"> <div class="spacer1">
<span class="icon-mega icon-gears"></span> <span class="icon-mega icon-gears"></span>
</div> </div>
<h4> <h4>
<strong>Miners</strong> earn credits for securing balances and metadata. <strong>Miners</strong> earn credits for securing balances and metadata.
</h4> </h4>
</div> </div>
<div class="span4 hero-tile"> <div class="span4 hero-tile">
<div class="spacer1"> <div class="spacer1">
<span class="icon-chain-broken icon-mega"></span> <span class="icon-chain-broken icon-mega"></span>
</div> </div>
<h4> <h4>
<strong>Patrons</strong> spend credits to access content without gatekeepers. <strong>Patrons</strong> spend credits to access content without gatekeepers.
</h4> </h4>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="content"> <div class="content">
<div class="spacer2"> <div class="spacer2">
<h3>Tell Me More</h3> <h3>Tell Me More</h3>
<p>LBRY allows anyone to publish content to a location like this:</p> <p>LBRY allows anyone to publish content to a location like this:</p>
<p class="text-center"><code>lbry://wonderfullife</code></p> <p class="text-center"><code>lbry://wonderfullife</code></p>
<p>Others can access this resource, either for free or for credits. Let's look at an example:</p> <p>Others can access this resource, either for free or for credits. Let's look at an example:</p>
<ol> <ol>
<li>Ernest wants to release his comedy-horror film, "Ernie Goes To Guantanamo Bay".</li> <li>Ernest wants to release his comedy-horror film, "Ernie Goes To Guantanamo Bay".</li>
<li>The content is encrypted and sliced into many pieces. These pieces are stored by <strong>hosts</strong>.</li> <li>The content is encrypted and sliced into many pieces. These pieces are stored by <strong>hosts</strong>.</li>
<li>Ernest reserves <code>lbry://erniebythebay</code>, a shortname pointing to his content.</li> <li>Ernest reserves <code>lbry://erniebythebay</code>, a shortname pointing to his content.</li>
<li>When Ernest reserves the location, he also submits metadata, such as a description and thumbnail. This information is stored by <strong>miners</strong> in the LBRY blockchain.</li> <li>When Ernest reserves the location, he also submits metadata, such as a description and thumbnail. This information is stored by <strong>miners</strong> in the LBRY blockchain.</li>
<li>Hilary, a <strong>patron</strong>, browses the LBRY network and wants to watch the movie. <li>Hilary, a <strong>patron</strong>, browses the LBRY network and wants to watch the movie.
Her LBRY client collects the pieces from the <strong>hosts</strong> and reassembles them.</li> Her LBRY client collects the pieces from the <strong>hosts</strong> and reassembles them.</li>
<li>Hilary pays Ernest for the decryption key, allowing her to watch the film.</li> <li>Hilary pays Ernest for the decryption key, allowing her to watch the film.</li>
</ol> </ol>
</div> </div>
</div> </div>
<div class="hero hero-pattern"> <div class="hero hero-pattern">
<div class="hero-content"> <div class="hero-content">
<h2 class="text-center hero-title">If BitTorrent + BitCoin Had a Baby</h2> <h2 class="text-center hero-title">If BitTorrent + BitCoin Had a Baby</h2>
<div class="row-fluid hero-tile-row"> <div class="row-fluid hero-tile-row">
<div class="span4 hero-tile"> <div class="span4 hero-tile">
<span class="icon-mega icon-cloud"></span> <span class="icon-mega icon-cloud"></span>
<h3>Decentralized Metadata</h3> <h3>Decentralized Metadata</h3>
<p>Information about content is embedded in a blockchain, eliminating centralized failure points. Metadata and data are completely decoupled so that <strong>hosts</strong> never see metadata and <strong>miners</strong> never see data.</p> <p>Information about content is embedded in a blockchain, eliminating centralized failure points. Metadata and data are completely decoupled so that <strong>hosts</strong> never see metadata and <strong>miners</strong> never see data.</p>
</div> </div>
<div class="span4 hero-tile"> <div class="span4 hero-tile">
<span class="icon-mega icon-shopping-cart"></span> <span class="icon-mega icon-shopping-cart"></span>
<h3>Marketized Data-Transfer</h3> <h3>Marketized Data-Transfer</h3>
<p><strong>Patrons</strong> request content for free or offer credits for faster speeds or access. <strong>Hosts</strong> share or sell surplus bandwidth and disk space.</p> <p><strong>Patrons</strong> request content for free or offer credits for faster speeds or access. <strong>Hosts</strong> share or sell surplus bandwidth and disk space.</p>
</div> </div>
<div class="span4 hero-tile"> <div class="span4 hero-tile">
<span class="icon-mega icon-link"></span> <span class="icon-mega icon-link"></span>
<h3>Memorable URIs</h3> <h3>Memorable URIs</h3>
<p> <p>
<strong>Publishers</strong> can choose friendly resource indicators like <code>lbry://wonderfullife</code> instead of ugly BitTorrent magnet URIs. <strong>Publishers</strong> can choose friendly resource indicators like <code>lbry://wonderfullife</code> instead of ugly BitTorrent magnet URIs.
URIs are <em>reserved</em> rather than owned, creating strong incentive for rights holders to use LBRY. URIs are <em>reserved</em> rather than owned, creating strong incentive for rights holders to use LBRY.
</p> </p>
</div> </div>
</div> </div>
<div class="row-fluid hero-tile-row"> <div class="row-fluid hero-tile-row">
<div class="span4 hero-tile"> <div class="span4 hero-tile">
<span class="icon-mega icon-usd" style="font-size: 180px"></span> <span class="icon-mega icon-usd" style="font-size: 180px"></span>
<h3>Payments to Publishers</h3> <h3>Payments to Publishers</h3>
<p><strong>Publishers</strong> may embed an address to receive payment for data. Publishers can also create assurance contracts<sup><a href="//en.wikipedia.org/wiki/Assurance_contract">?</a></sup> for new content.</p> <p><strong>Publishers</strong> may embed an address to receive payment for data. Publishers can also create assurance contracts<sup><a href="//en.wikipedia.org/wiki/Assurance_contract">?</a></sup> for new content.</p>
</div> </div>
<div class="span4 hero-tile"> <div class="span4 hero-tile">
<span class="icon-mega icon-lock"></span> <span class="icon-mega icon-lock"></span>
<h3>Improved Privacy</h3> <h3>Improved Privacy</h3>
<p>LBRY uses novel techniques to protect publishers, providers, and consumers. <p>LBRY uses novel techniques to protect publishers, providers, and consumers.
<strong>Hosts</strong> only have small portions of an encrypted file with no information of the contents. <strong>Hosts</strong> only have small portions of an encrypted file with no information of the contents.
</p> </p>
</div> </div>
<div class="span4 hero-tile"> <div class="span4 hero-tile">
<span class="icon-mega icon-code"></span> <span class="icon-mega icon-code"></span>
<h3>Designed for Developers</h3> <h3>Designed for Developers</h3>
<p>LBRY is designed to allow others to create applications powered by its distributed, robust data store.</p> <p>LBRY is designed to allow others to create applications powered by its distributed, robust data store.</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php echo View::render('nav/learnFooter') ?> <?php echo View::render('nav/learnFooter') ?>
</main> </main>
<?php echo View::render('nav/footer') ?> <?php echo View::render('nav/footer') ?>

View file

@ -1,107 +1,107 @@
<?php NavActions::setNavUri('/learn') ?> <?php NavActions::setNavUri('/learn') ?>
<?php Response::setMetaImage('http://lbry.io/img/xkcd-comic.png') ?> <?php Response::setMetaImage('http://lbry.io/img/xkcd-comic.png') ?>
<?php Response::setMetaDescription('Learn about the inspiration behind LBRY\'s revolutionary content distribution system.') ?> <?php Response::setMetaDescription('Learn about the inspiration behind LBRY\'s revolutionary content distribution system.') ?>
<?php echo View::render('nav/header', ['isDark' => false]) ?> <?php echo View::render('nav/header', ['isDark' => false]) ?>
<main> <main>
<div class="content"><h1>Why?</h1></div> <div class="content"><h1>Why?</h1></div>
<div class="hero hero-quote hero-img spacer2" style="background-image: url(/img/cover-jcole.jpg)"> <div class="hero hero-quote hero-img spacer2" style="background-image: url(/img/cover-jcole.jpg)">
<div class="hero-content-wrapper"> <div class="hero-content-wrapper">
<div class="hero-content"> <div class="hero-content">
<blockquote> <blockquote>
<p>If you made the music, and you made the art, and you put it into the world, I should be able to use it. I'ma pay you, I'ma give you a percentage, but... you was inspired by the world; allow the world to be inspired by your [work] and to use your [work].</p> <p>If you made the music, and you made the art, and you put it into the world, I should be able to use it. I'ma pay you, I'ma give you a percentage, but... you was inspired by the world; allow the world to be inspired by your [work] and to use your [work].</p>
</blockquote> </blockquote>
<cite>J. Cole, <em><a href="https://www.youtube.com/watch?v=UMCGOAGb4Y0&amp;t=470s">Note to Self</a></em></cite> <cite>J. Cole, <em><a href="https://www.youtube.com/watch?v=UMCGOAGb4Y0&amp;t=470s">Note to Self</a></em></cite>
</div> </div>
</div> </div>
</div> </div>
<div class="content spacer2"> <div class="content spacer2">
<h3>The World We Live In</h3> <h3>The World We Live In</h3>
<p>Annual internet video traffic is approximately 500 exabytes (500,000,000,000 GB)<sup><a href="http://www.cisco.com/c/en/us/solutions/collateral/service-provider/ip-ngn-ip-next-generation-network/white_paper_c11-481360.html">1</a></sup>. <p>Annual internet video traffic is approximately 500 exabytes (500,000,000,000 GB)<sup><a href="http://www.cisco.com/c/en/us/solutions/collateral/service-provider/ip-ngn-ip-next-generation-network/white_paper_c11-481360.html">1</a></sup>.
Every second, over 10,000 hours of video are streamed. Every second, over 10,000 hours of video are streamed.
The technical term for the quantity of videos people watch every year is a million jillion. You know this.</p> The technical term for the quantity of videos people watch every year is a million jillion. You know this.</p>
<p>What you may not know: <em>video distribution is fundamentally flawed</em>.</p> <p>What you may not know: <em>video distribution is fundamentally flawed</em>.</p>
<p> <p>
The fatal flaw of existing systems is their centralized, top-down design. The consequences: The fatal flaw of existing systems is their centralized, top-down design. The consequences:
</p> </p>
<ol> <ol>
<li><p><strong>Increased costs to consumers.</strong> Providers bear significant infrastructure costs, regulatory and compliance costs, <li><p><strong>Increased costs to consumers.</strong> Providers bear significant infrastructure costs, regulatory and compliance costs,
and must create complex systems to govern a simple process (copying a number).</p></li> and must create complex systems to govern a simple process (copying a number).</p></li>
<li><p><strong>Terrible consumer experience.</strong> <li><p><strong>Terrible consumer experience.</strong>
Centralization leads to fragmentation, as providers compete to lock numbers in digit dungeons.</p> Centralization leads to fragmentation, as providers compete to lock numbers in digit dungeons.</p>
</li> </li>
<li> <li>
<p><strong>Poor producer experience.</strong> <p><strong>Poor producer experience.</strong>
The primary want of a producer is to be paid for making things. Instead, producers frequently lose control of their content and The primary want of a producer is to be paid for making things. Instead, producers frequently lose control of their content and
lose profits to the inefficiency of current systems.</p> lose profits to the inefficiency of current systems.</p>
</li> </li>
</ol> </ol>
<p>Similar issues of economics and experience exist for consumers and producers of information of all kinds (e.g. news, facts), not just videos.</p> <p>Similar issues of economics and experience exist for consumers and producers of information of all kinds (e.g. news, facts), not just videos.</p>
<p>LBRY solves these problems and throws in some other sweet innovations just for funsies.</p> <p>LBRY solves these problems and throws in some other sweet innovations just for funsies.</p>
</div> </div>
<div class="hero hero-quote hero-img spacer2" style="background-image: url(/img/cover-swartz.jpg)"> <div class="hero hero-quote hero-img spacer2" style="background-image: url(/img/cover-swartz.jpg)">
<div class="hero-content-wrapper"> <div class="hero-content-wrapper">
<div class="hero-content"> <div class="hero-content">
<blockquote> <blockquote>
<p>Information is power.</p> <p>Information is power.</p>
<p>But like all power, there are those who want to keep it for themselves. <p>But like all power, there are those who want to keep it for themselves.
</blockquote> </blockquote>
<cite>Aaron Swartz</cite> <cite>Aaron Swartz</cite>
</div> </div>
</div> </div>
</div> </div>
<div class="content spacer2"> <div class="content spacer2">
<h3>An Alternative</h3> <h3>An Alternative</h3>
<p>LBRY avoids the mistakes of centralization and middlemen. It says:</p> <p>LBRY avoids the mistakes of centralization and middlemen. It says:</p>
<ol> <ol>
<li> <li>
<p> <p>
<strong>Information isn't a thing</strong> <strong>Information isn't a thing</strong>
Things are physical and exist in the world. When I have a thing, you can't. Economists call this <em>rivalry</em><sup><a href="//en.wikipedia.org/wiki/Rivalry_%28economics%29">?</a></sup>. Things are physical and exist in the world. When I have a thing, you can't. Economists call this <em>rivalry</em><sup><a href="//en.wikipedia.org/wiki/Rivalry_%28economics%29">?</a></sup>.
</p> </p>
<p> <p>
Information is non-rival. Information is just a number. There is nothing easier to replicate than information. Information is non-rival. Information is just a number. There is nothing easier to replicate than information.
LBRY embraces (and adores) this reality. LBRY embraces (and adores) this reality.
</p> </p>
<p> <p>
LBRY breaks information into thousands of identifiable tiny pieces and spreads them throughout the internet, reducing costs LBRY breaks information into thousands of identifiable tiny pieces and spreads them throughout the internet, reducing costs
for both providers and consumers. for both providers and consumers.
</p> </p>
<div class="spacer2"> <div class="spacer2">
<img src="/img/xkcd-comic.png" alt="XKCD #1228 Prometheus"/> <img src="/img/xkcd-comic.png" alt="XKCD #1228 Prometheus"/>
<div class="meta text-center"><a href="https://xkcd.com/1228/">XKCD #1228</a></div> <div class="meta text-center"><a href="https://xkcd.com/1228/">XKCD #1228</a></div>
</div> </div>
</li> </li>
<li> <li>
<p> <p>
<strong>Connecting creators and consumers directly is best.</strong> <strong>Connecting creators and consumers directly is best.</strong>
Do we need middlemen spending billions to extract their rent and police others? Do we need middlemen spending billions to extract their rent and police others?
A better system allows consumers to easily and directly pay content creators. A better system allows consumers to easily and directly pay content creators.
We want to eliminate extortionists charging tolls. We want to eliminate extortionists charging tolls.
</p> </p>
<p> <p>
On LBRY, publishers sell directly to patrons. Publishers can charge a set fee per decryption key for content or create an assurance contract for unpublished content. On LBRY, publishers sell directly to patrons. Publishers can charge a set fee per decryption key for content or create an assurance contract for unpublished content.
</p> </p>
</li> </li>
<li> <li>
<p><strong>It's Up to Us.</strong> A smart guy once said that power corrupts and absolute power corrupts absolutely.</p> <p><strong>It's Up to Us.</strong> A smart guy once said that power corrupts and absolute power corrupts absolutely.</p>
<p> <p>
LBRY leaves no one in charge (including us). It puts power in the hands of individuals and users rather than corporations and executives. LBRY leaves no one in charge (including us). It puts power in the hands of individuals and users rather than corporations and executives.
</p> </p>
<p>We think that world will be more creative, more charitable, and more fair. We hope you'll join us in creating it.</p> <p>We think that world will be more creative, more charitable, and more fair. We hope you'll join us in creating it.</p>
</li> </li>
</ol> </ol>
<h3>What LBRY Isn't</h3> <h3>What LBRY Isn't</h3>
<p>LBRY's fully decentralized nature makes restricting content impossible. Since LBRY also aims to unseat gigantic, established media players, <p>LBRY's fully decentralized nature makes restricting content impossible. Since LBRY also aims to unseat gigantic, established media players,
we fear it may attract undeserved legal attention. So we'd like to be clear from day one:</p> we fear it may attract undeserved legal attention. So we'd like to be clear from day one:</p>
<p> <p>
<strong>LBRY is not about facilitating piracy.</strong> <strong>LBRY is not about facilitating piracy.</strong>
LBRY is about creating a network where creators and patrons can directly interact without relying on anyone in the middle. We've made choices LBRY is about creating a network where creators and patrons can directly interact without relying on anyone in the middle. We've made choices
about publisher identities and how addresses are reserved that are specifically designed to combat undue profiteering.</p> about publisher identities and how addresses are reserved that are specifically designed to combat undue profiteering.</p>
</div> </div>
<?php echo View::render('nav/learnFooter') ?> <?php echo View::render('nav/learnFooter') ?>
</main> </main>
<?php echo View::render('nav/footer') ?> <?php echo View::render('nav/footer') ?>
<?php /* It is inspired by Bitcoin, BitTorrent, and&nbsp;a comment by Julian Assange<sup><a class="link-primary" href="https://wikileaks.org/Transcript-Meeting-Assange-Schmidt.html#731">1</a></sup>.</p> */ ?> <?php /* It is inspired by Bitcoin, BitTorrent, and&nbsp;a comment by Julian Assange<sup><a class="link-primary" href="https://wikileaks.org/Transcript-Meeting-Assange-Schmidt.html#731">1</a></sup>.</p> */ ?>

View file

@ -1,8 +0,0 @@
<?php
include $_SERVER['ROOT_DIR'] . '/autoload.php';
define('IS_PRODUCTION', $_SERVER['SERVER_NAME'] == 'lbry.io');
i18n::register();
Session::init();
Controller::dispatch(strtok($_SERVER['REQUEST_URI'], '?'));

0
web/css/.gitkeep Normal file
View file

10
web/index.php Normal file
View file

@ -0,0 +1,10 @@
<?php
include __DIR__ . '/../bootstrap.php';
define('IS_PRODUCTION', $_SERVER['SERVER_NAME'] == 'lbry.io');
i18n::register();
Session::init();
Controller::dispatch(strtok($_SERVER['REQUEST_URI'], '?'));