Check changelog

This commit is contained in:
R. Eric Wheeler 2016-07-08 14:58:30 -07:00
parent a8de1cbdf1
commit 21b043cfa3
33 changed files with 1153 additions and 307 deletions

46
.php_cs Normal file
View File

@ -0,0 +1,46 @@
<?php
$header = <<<EOF
This file is part of Resume.PHP.
(copyleft) R. Eric Wheeler <sikofitt@gmail.com>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;
Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);
$finder = Symfony\CS\Finder\DefaultFinder::create()
->exclude('vendor')
->exclude('tests')
->exclude('var')
->exclude('node_modules')
->ignoreDotFiles(true)
->ignoreVCS(true)
->name('*.php')
->in(__DIR__)
;
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers(
[
'header_comment',
'ordered_use',
'php_unit_construct',
'php_unit_strict',
'strict',
'strict_param',
'symfony',
'newline_after_open_tag',
'phpdoc_order',
'short_array_syntax',
'short_echo_tag',
]
)
->finder($finder)
;

View File

@ -1,6 +1,17 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Sikofitt\Config\ConfigTrait;
use Sikofitt\Json\JsonFileTrait;
use Sikofitt\Json\JsonTrait;
use Silex\Application;
require '../vendor/autoload.php';
@ -8,16 +19,17 @@ require '../vendor/autoload.php';
/**
* Class App
*/
class App extends Application {
class App extends Application
{
use ConfigTrait;
use Application\TwigTrait;
use Application\MonologTrait;
use Application\SwiftmailerTrait;
use Application\TranslationTrait;
use Application\UrlGeneratorTrait;
public $conf;
use ConfigTrait;
use JsonTrait;
use JsonFileTrait;
use Application\TwigTrait;
use Application\MonologTrait;
use Application\SwiftmailerTrait;
use Application\TranslationTrait;
use Application\UrlGeneratorTrait;
/**
* Returns the application directory.
@ -25,9 +37,10 @@ class App extends Application {
* @return string
* The main application directory.
*/
public function getAppDirectory() {
$r = new ReflectionClass($this);
return dirname($r->getFileName());
public function getAppDirectory()
{
$r = new ReflectionClass($this);
return dirname($r->getFileName());
}
/**
@ -36,38 +49,48 @@ class App extends Application {
* @return string
* The root directory of the application.
*/
public function getRootDirectory() {
return dirname($this->getAppDirectory());
public function getRootDirectory()
{
return dirname($this->getAppDirectory());
}
/**
* @return string
*/
public function getConfDirectory() {
return $this->getAppDirectory() . '/config';
public function getConfDirectory()
{
return $this->getAppDirectory() . '/config';
}
/**
* @return string
*/
public function getDataDirectory() {
return $this->getRootDirectory() . '/data';
public function getDataDirectory()
{
return $this->getRootDirectory() . '/data';
}
/**
* @return string
*/
public function getResumeJson() {
return $this->getDataDirectory() . '/resume.json';
public function getResumeJson()
{
return $this->getDataDirectory() . '/resume.json';
}
/**
* @return string
*/
public function getResumeSchema() {
return $this->getDataDirectory() . '/resume.schema.json';
public function getResumeSchema()
{
return $this->getDataDirectory() . '/resume.schema.json';
}
public function getLogDirectory()
{
return $this->getDataDirectory() . '/logs';
}
/**
* Registers media icons
*
@ -77,15 +100,64 @@ class App extends Application {
{
$this->config(sprintf('app.icons.%s', $icon->getName()), ['icon' => $icon->getIcon(), 'url' => $icon->getDefaultUrl()]);
}
public function setDebug()
{
$this['debug'] = null !== $this->config('app.debug') ? $this->config('app.debug') : true;
$this['env'] = getenv('PHP_ENV');
if (!$this['env']) {
$this['env'] = null !== $this->config('app.environment') ? $this->config('app.environment') : 'dev';
}
}
public function registerExtenders()
{
if (!$this['debug']) {
$this->error(function (\Exception $e, \Symfony\Component\HttpFoundation\Request $request, $code) {
switch ($code) {
case 405:
public function boot() {
// register default icons
$this->registerIcon(new \Sikofitt\Image\Profile\TwitterProfileIcon());
$this->registerIcon(new \Sikofitt\Image\Profile\FacebookProfileIcon());
$this->registerIcon(new \Sikofitt\Image\Profile\GithubProfileIcon());
$this->registerIcon(new \Sikofitt\Image\Profile\GitlabProfileIcon());
$this->registerIcon(new \Sikofitt\Image\Profile\LinkedinProfileIcon());
return parent::boot();
preg_match('/\(Allow\:(.+)\)/', $e->getMessage(), $matches);
if(isset($matches[1])) {
$matches = trim($matches[1]);
} elseif(isset($matches[0])) {
$matches = trim($matches[0]);
} else {
$matches = 'Available methods are unknown.';
}
$message = json_encode(['status' => 'error', 'message' => 'Method not allowed', 'allowedMethods' => $matches, 'requestedMethod' => $request->getMethod(), 'code' => $code]);
//$message = 'Sorry bout that.<br />' . $e->getMessage();
break;
default:
$message = $this['twig']->render('error500.html.twig');
}
return new \Symfony\Component\HttpFoundation\Response($message, $code);
});
}
$this->extend('twig', function (\Twig_Environment $twig) {
if ($this['debug']) {
$twig->enableDebug();
}
$twig->addExtension(new Twig_Extensions_Extension_Date());
$twig->addExtension(new Sikofitt\Twig\Date());
$twig->addExtension(new Sikofitt\Twig\RenderProfile());
$twig->addGlobal('config', $this->config('all'));
return $twig;
});
}
}
public function boot()
{
$this->registerExtenders();
// register default icons
$this->registerDefaultIcons();
return parent::boot();
}
public function registerDefaultIcons()
{
$this->registerIcon(new \Sikofitt\Image\Profile\TwitterProfileIcon());
$this->registerIcon(new \Sikofitt\Image\Profile\FacebookProfileIcon());
$this->registerIcon(new \Sikofitt\Image\Profile\GithubProfileIcon());
$this->registerIcon(new \Sikofitt\Image\Profile\GitlabProfileIcon());
$this->registerIcon(new \Sikofitt\Image\Profile\LinkedinProfileIcon());
}
}

View File

@ -1,7 +1,10 @@
app:
debug: true
environment: dev
debug: false
environment: prod
title: R. Eric Wheeler | Resume
email: eric@rewiv.com
phone: 510-646-2135
schema: https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json
twig:
paths:
- views

View File

@ -1,5 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'app' => 'neat',
];
];

51
app/providers.php Normal file
View File

@ -0,0 +1,51 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$app->register(new \Sikofitt\Config\ConfigServiceProvider(), [
'config.path' => $app->getConfDirectory(),
]);
$app->setDebug();
if (null === $app->config('app.schema')) {
$app->config('app.schema', 'https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json');
}
$app->register(new \Silex\Provider\TwigServiceProvider(), [
'twig.path' => [
$app->getRootDirectory() . '/app/views',
],
]);
$app->register(new \Sikofitt\Json\JsonServiceProvider());
$app->register(new \Silex\Provider\AssetServiceProvider());
$app->register(new \Silex\Provider\MonologServiceProvider());
$app->register(new \Silex\Provider\SessionServiceProvider());
$app->register(new \Silex\Provider\HttpKernelServiceProvider());
$app->register(new \Silex\Provider\FormServiceProvider());
$app->register(new \Silex\Provider\MonologServiceProvider(),
[
'monolog.logfile' => sprintf('%s/%s.log', $app->getLogDirectory(), $app['env']),
]
);
$app->register(new \Silex\Provider\RoutingServiceProvider());
$app->register(new \Silex\Provider\ServiceControllerServiceProvider());
$app->register(new \Silex\Provider\HttpFragmentServiceProvider());
if ($app['debug'] || 0 === strcasecmp($app['env'], 'dev')) {
$app->register(new \Silex\Provider\WebProfilerServiceProvider(), [
'profiler.cache_dir' => $app->getDataDirectory() . '/cache/profiler',
]);
$app->register(new \WhoopsSilex\WhoopsServiceProvider());
$app->register(new \Silex\Provider\VarDumperServiceProvider());
}

View File

@ -5,7 +5,6 @@
{% endblock %}
{% block body %}
<div class="uk-grid" data-uk-grid-margin>
<div class="uk-width-1-1">
<h1 class="uk-heading-large">
@ -62,7 +61,7 @@
<dl class="uk-description-list-horizontal uk-animation-slide-right">
<dt>Highlights</dt>
{% for highlight in position.highlights %}
<dd class="uk-margin-small-top uk-margin-small-bottom">{{ highlight|raw }}</dd>
<dd class="uk-margin-small-top uk-margin-small-bottom">{{ highlight|raw }} {# raw is deprecated in 2.0 #}</dd>
{% endfor %}
</dl>
{% endif %}
@ -73,6 +72,7 @@
</div>
</div>
<div class="uk-width-medium-1-4">
<div class="uk-panel uk-panel-header uk-panel-box" data-uk-sticky="{top:35}">
@ -86,12 +86,10 @@
<ul class="uk-list uk-list-line">
{% if basics.email is not empty %}
<li class="uk-list-space"><a href="#" class="hidden-email">[Click to view email]</a></li>
{% if app.config.app.email is not empty %}
<li class="uk-list-space"><a href="#captcha" class="hidden-email" data-uk-modal>[Hidden information]</a></li>
{% endif %}
{% if basics.phone is not empty %}
<li class="uk-list-space">{{ basics.phone }}</li>
{% endif %}
{% if basics.website is not empty %}
<li class="uk-list-space"><a href="{{ basics.website }}" target="_blank"
title="Home page">{{ basics.website }}</a></li>
@ -143,7 +141,31 @@
</div>
</div>
<div id="captcha" class="uk-modal">
<div class="uk-modal-dialog uk-modal-dialog-blank">
<button class="uk-modal-close uk-close" type="button"></button>
<div class="uk-grid uk-flex-center uk-grid-match uk-grid-divider uk-flex-middle uk-height-viewport uk-cover-background" data-uk-grid-match>
<div id="recaptcha-wrapper">
<h1>Verify</h1>
<div>
<p> Verify that you are a human please.</p>
<form class="uk-form" id="recaptcha" method="post" action="/api/v1/captcha" onsubmit="return false;">
<div class="uk-form-row">
<div class="g-recaptcha" data-sitekey="6LcvmSQTAAAAAMmf9w6mhCbpdLvknuD9SGVHT0q-"></div>
</div>
<div class="uk-form-row">
<input type="submit" class="uk-button" id="submit" name="submit" value="Verify" />
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div id="offcanvas" class="uk-offcanvas">
<div class="uk-offcanvas-bar">
@ -179,5 +201,36 @@
</li>
</ul>
</div>
</div>
{% endblock %}
{% block javascripts_foot %}
<script src='https://www.google.com/recaptcha/api.js'></script>
{% endblock %}
{% block inline_js_foot %}
<script type="text/javascript">
jQuery(document).ready(function($) {
jQuery('form#recaptcha').on('submit', function(event) {
event.stopImmediatePropagation();
event.stopPropagation();
jQuery.post(jQuery(this).attr('action'), jQuery(this).serialize(), function(response) {
data = JSON.parse(response);
if(false === data.valid) {
data.message.every(function (d) {
UIkit.notify('<i class="uk-icon-medium uk-icon-frown-o uk-icon-justify"></i> ' + d, {pos:'bottom-center', status: 'danger'});
})
} else if(true === data.valid) {
var divRoot = jQuery('<div />');
var h1 = jQuery('<h1 />');
h1.append(data.message.email);
var h2 = jQuery('<h2 />');
h2.append(data.message.phone);
divRoot.append(h1).append(h2);
jQuery('#recaptcha-wrapper').replaceWith(divRoot);
}
});
});
});
</script>
{% endblock %}

View File

@ -18,6 +18,7 @@
<script src="js/vendor/jquery.min.js"></script>
<script src="js/vendor/uikit.min.js"></script>
<script src="js/vendor/sticky.min.js"></script>
<script src="{{ asset('js/vendor/notify.min.js') }}"></script>
{% block javascripts_head %}{% endblock %}
{% block inline_js_head %}{% endblock %}
</head>

View File

@ -31,7 +31,8 @@
"**/scrollspy.min.js",
"**/parallax.min.js",
"**/offcanvas.min.js",
"**/sticky.min.js"
"**/sticky.min.js",
"**/notify.min.js"
]
},
"jquery": {

View File

@ -49,11 +49,13 @@
"symfony/var-dumper": "^3.1",
"symfony/console": "^3.1",
"texthtml/whoops-silex": "^1.0",
"symfony/debug-bundle": "^3.1"
"symfony/debug-bundle": "^3.1",
"friendsofphp/php-cs-fixer": "^1.11"
},
"autoload": {
"psr-4": {
"Sikofitt\\": "src/Sikofitt"
}
},
"classmap": ["app/App.php"]
}
}

224
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "2e202af761710c5e2279e9f5b83a5192",
"content-hash": "3c41da3f56c72d6c1bc86d0a1889d6d9",
"hash": "84ec84a01cd2f9b1398d356bc5e7dc63",
"content-hash": "d91f02739d0cdaa4d0346a6c0f765fc3",
"packages": [
{
"name": "google/recaptcha",
@ -719,23 +719,23 @@
},
{
"name": "swiftmailer/swiftmailer",
"version": "v5.4.2",
"version": "v5.4.3",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "d8db871a54619458a805229a057ea2af33c753e8"
"reference": "4cc92842069c2bbc1f28daaaf1d2576ec4dfe153"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/d8db871a54619458a805229a057ea2af33c753e8",
"reference": "d8db871a54619458a805229a057ea2af33c753e8",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/4cc92842069c2bbc1f28daaaf1d2576ec4dfe153",
"reference": "4cc92842069c2bbc1f28daaaf1d2576ec4dfe153",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"mockery/mockery": "~0.9.1,<0.9.4"
"mockery/mockery": "~0.9.1"
},
"type": "library",
"extra": {
@ -768,7 +768,7 @@
"mail",
"mailer"
],
"time": "2016-05-01 08:45:47"
"time": "2016-07-08 11:51:25"
},
{
"name": "symfony/asset",
@ -2506,6 +2506,116 @@
],
"time": "2016-04-07 06:16:25"
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v1.11.5",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
"reference": "d3d08b76753092a232a4d8c3b94095ac06898719"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/d3d08b76753092a232a4d8c3b94095ac06898719",
"reference": "d3d08b76753092a232a4d8c3b94095ac06898719",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.6",
"sebastian/diff": "~1.1",
"symfony/console": "~2.3|~3.0",
"symfony/event-dispatcher": "~2.1|~3.0",
"symfony/filesystem": "~2.1|~3.0",
"symfony/finder": "~2.1|~3.0",
"symfony/process": "~2.3|~3.0",
"symfony/stopwatch": "~2.5|~3.0"
},
"conflict": {
"hhvm": "<3.9"
},
"require-dev": {
"phpunit/phpunit": "^4.5|^5",
"satooshi/php-coveralls": "^0.7.1"
},
"bin": [
"php-cs-fixer"
],
"type": "application",
"autoload": {
"psr-4": {
"Symfony\\CS\\": "Symfony/CS/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Dariusz Rumiński",
"email": "dariusz.ruminski@gmail.com"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "A tool to automatically fix PHP code style",
"time": "2016-07-06 22:49:35"
},
{
"name": "sebastian/diff",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2015-12-08 07:14:41"
},
{
"name": "symfony/console",
"version": "v3.1.2",
@ -2627,6 +2737,104 @@
"homepage": "https://symfony.com",
"time": "2016-02-13 09:24:02"
},
{
"name": "symfony/filesystem",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "322da5f0910d8aa0b25fa65ffccaba68dbddb890"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/322da5f0910d8aa0b25fa65ffccaba68dbddb890",
"reference": "322da5f0910d8aa0b25fa65ffccaba68dbddb890",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Filesystem\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2016-06-29 05:41:56"
},
{
"name": "symfony/finder",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "8201978de88a9fa0923e18601bb17f1df9c721e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/8201978de88a9fa0923e18601bb17f1df9c721e7",
"reference": "8201978de88a9fa0923e18601bb17f1df9c721e7",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2016-06-29 05:41:56"
},
{
"name": "symfony/phpunit-bridge",
"version": "v3.1.2",

View File

@ -1,5 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once 'vendor/autoload.php';
@ -8,5 +17,3 @@ $decoder = new Webmozart\Json\JsonDecoder();
$json = $decoder->decodeFile('data/resume.json');
dump($json);

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Created by PhpStorm.
* User: eric
@ -8,7 +18,6 @@
namespace Sikofitt\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@ -29,11 +38,11 @@ class SchemaValidationCommand extends Command
* Configures the command.
*
*/
public function configure ()
public function configure()
{
$this->setName ('resume:schema:validate')
->setDescription ('Validates resume.json schema')
->setProcessTitle ('Validating Schema');
$this->setName('resume:schema:validate')
->setDescription('Validates resume.json schema')
->setProcessTitle('Validating Schema');
}
/**
@ -42,13 +51,11 @@ class SchemaValidationCommand extends Command
* @param InputInterface $input
* @param OutputInterface $output
*/
public function interact (InputInterface $input, OutputInterface $output)
public function interact(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$this->file = $io->ask('Path to file? ');
$this->schema = $io->ask('Path to schema? ');
}
/**
@ -59,7 +66,7 @@ class SchemaValidationCommand extends Command
*
* @return void
*/
public function execute (InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output)
{
$validator = new JsonValidator();
$decoder = new JsonDecoder();
@ -68,20 +75,16 @@ class SchemaValidationCommand extends Command
try {
$decoded = $decoder->decodeFile($dataDir . $this->file);
$errors = $validator->validate ($decoded, $dataDir . $this->schema);
} catch(\Exception $e) {
$errors = $validator->validate($decoded, $dataDir . $this->schema);
} catch (\Exception $e) {
$class = new \ReflectionClass($e);
$io->block([$class->getName(), $e->getMessage()], 'Exception', 'error');
exit(255);
}
if(isset($errors) && !empty($errors)) {
if (isset($errors) && !empty($errors)) {
$io->block($errors, 'Error', 'error');
} else {
$io->block([$this->file, 'There were no errors reported.'], 'Valid Schema', 'fg=black;bg=green');
}
}
}
}

View File

@ -1,14 +1,20 @@
<?php
/**
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sikofitt\Config;
use Noodlehaus\Config;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Silex\Application;
use Noodlehaus\Config;
/**
* Class ConfigServiceProvider
@ -19,11 +25,11 @@ class ConfigServiceProvider implements ServiceProviderInterface
/**
* @param Container $app
*/
public function register (Container $app)
public function register(Container $app)
{
$app['config'] = function($app) {
$app['config'] = function ($app) {
$config = Config::load($app['config.path']);
return $config;
};
}
}
}

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
*/
@ -12,15 +22,15 @@ trait ConfigTrait
* @param null $value
* @return mixed
*/
public function config($name, $value = null) {
if(strcasecmp($name, 'all') === 0) {
public function config($name, $value = null)
{
if (strcasecmp($name, 'all') === 0) {
return $this['config']->all();
}
if(null === $value) {
return $this['config']->get ($name);
if (null === $value) {
return $this['config']->get($name);
} else {
$this['config']->set($name, $value);
}
}
}
}

View File

@ -0,0 +1,76 @@
<?php
/**
* This file is part of test.
*
* @file ApiControllerProvider.php
*
* R. Eric Wheeler <reric@ee.stanford.edu>
*
* 7/8/16 / 10:11 AM
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sikofitt\Controller;
use ReCaptcha\ReCaptcha;
use Silex\Application;
use Silex\Api\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
class ApiControllerProvider implements ControllerProviderInterface {
public function connect(Application $app) {
$controllers = $app['controllers_factory'];
$controllers->get('/v1/schema', function() {
return new \Symfony\Component\HttpFoundation\Response('Success!');
});
$controllers->post('/v1/captcha', function(Request $request) use ($app) {
$captcha = new ReCaptcha('6LcvmSQTAAAAAITkvYJjgLar1LqGGLz-ic0ZMiXo');
$valid = $captcha->verify(
$request->request->get('g-recaptcha-response'),
$request->server->get('REMOTE_ADDR')
);
if($valid->isSuccess()) {
$return = [
'valid' => true,
'message' => [
'email' => null !== $app->config('app.email') ? $app->config('app.email') : 'No email has been set in the configuration. Please let the owner know.',
'phone' => null !== $app->config('app.phone') ? $app->config('app.phone') : 'No phone has been set in the configuration. Please let the owner know.',
],
];
} else {
$errorCodes = [
'missing-input-secret' => 'The secret parameter is missing.',
'invalid-input-secret' => 'The secret parameter is invalid or malformed.',
'missing-input-response' =>'The response parameter is missing.',
'invalid-input-response' => 'The response parameter is invalid or malformed.'
];
foreach($valid->getErrorCodes() as $code)
{
if(array_key_exists($code, $errorCodes)) {
$errors[] = $errorCodes[$code];
}
}
if(!isset($errors)) {
$errors[] = 'An unknown error occurred.';
}
$return = [
'valid' => false,
'message' => $errors,
];
}
return new JsonResponse(json_encode($return));
});
return $controllers;
}
}

View File

@ -0,0 +1,145 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sikofitt\Controller;
use ReCaptcha\ReCaptcha;
use Silex\Api\ControllerProviderInterface;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
/**
* Class ResumeControllerProvider
* @package Sikofitt\Controller
*/
class ResumeControllerProvider implements ControllerProviderInterface
{
/**
* @var object
*/
private $resumeData;
/**
* @param Application $app
* @return mixed
*/
public function connect(Application $app)
{
$this->resumeData = $app->decodeFile(
$app->getDataDirectory() . '/resume.json',
$app->getDataDirectory() . '/schema/schema.v1.json'
);
$controllers = $app['controllers_factory'];
$controllers->get('/', function (Request $request) use ($app) {
return $app['twig']->render('resume.html.twig', [
'fullData' => $this->resumeData,
'basics' => $this->getResumeBasics(),
'work' => $this->getResumeWork(),
'volunteer' => $this->getResumeVolunteer(),
'education' => $this->getResumeEducation(),
'awards' => $this->getResumeAwards(),
'publications' => $this->getResumePublications(),
'skills' => $this->getResumeSkills(),
'languages' => $this->getResumeLanguages(),
'interests' => $this->getResumeInterests(),
'references' => $this->getResumeReferences(),
]);
});
return $controllers;
}
/**
* @return null
*/
public function getResumeBasics()
{
return (isset($this->resumeData->basics) && count($this->resumeData->basics) > 0) ? $this->resumeData->basics : null;
}
/**
* @return null
*/
public function getResumeWork()
{
return (isset($this->resumeData->work) && count($this->resumeData->work) > 0) ? $this->resumeData->work : null;
}
/**
* @return null
*/
public function getResumeVolunteer()
{
return (isset($this->resumeData->volunteer) && count($this->resumeData->volunteer) > 0) ? $this->resumeData->volunteer : null;
}
/**
* @return null
*/
public function getResumeEducation()
{
return (isset($this->resumeData->education) && count($this->resumeData->education) > 0) ? $this->resumeData->education : null;
}
/**
* @return null
*/
public function getResumeAwards()
{
return (isset($this->resumeData->awards) && count($this->resumeData->awards) > 0) ? $this->resumeData->awards : null;
}
/**
* @return null
*/
public function getResumePublications()
{
return (isset($this->resumeData->publications) && count($this->resumeData->publications) > 0) ? $this->resumeData->publications : null;
}
/**
* @return null
*/
public function getResumeSkills()
{
return (isset($this->resumeData->skills) && count($this->resumeData->skills) > 0) ? $this->resumeData->skills : null;
}
/**
* @return null
*/
public function getResumeLanguages()
{
return (isset($this->resumeData->languages) && count($this->resumeData->languages) > 0) ? $this->resumeData->languages : null;
}
/**
* @return null
*/
public function getResumeInterests()
{
return (isset($this->resumeData->interests) && count($this->resumeData->interests) > 0) ? $this->resumeData->interests : null;
}
/**
* @return null
*/
public function getResumeReferences()
{
return (isset($this->resumeData->references) && count($this->resumeData->references) > 0) ? $this->resumeData->references : null;
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This file is part of test.
*
@ -20,21 +30,24 @@ namespace Sikofitt\Image\Profile;
*/
class GithubProfileIcon implements ProfileIconInterface
{
/**
/**
* {@inheritdoc}
*/
public function getName() {
return 'github';
public function getName()
{
return 'github';
}
public function getDefaultUrl() {
return 'https://github.com';
}
public function getDefaultUrl()
{
return 'https://github.com';
}
/**
* {@inheritdoc}
*/
public function getIcon() {
public function getIcon()
{
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHEBUg5ZowJwAABmBJREFUSMeVVm1wVOUVft67d7+zjdnNdpcuZJpdgtAwgBiinWkJRhKUII5jM9qOQ8o0teq0HcWUKdNOpx1sRcFOZxxMBacGQgjWQZCiAzEKWgupxaBANo752EzdzX5nN7t7N3vv3vue/kiyiLRKz8zz473nnnPuOc8577nAF6S1tRVEVDpns1lToVBwpNOppYXCTIssy60zMzMbUqmUj4gqpqamjPPvJhIJ/F8SDAYrFEV5iIheLRaLqVBokvz+Yfr440s0/MknFIlGiHM+SURdsizfNzAwYAJwzQfOC/v8IRqNwuVyIZ1ObygvL39KluXVPYd7hffeex/xeBxSPg9N06AXRVjLrHC73WhuWo/W790vAxhIJpPbKisrBwOBAKqrq68PEolE4Ha7kclkHrLZbAdOvvGm8Nvf7YQsy1+aMRHB7rDjud3PYk3drdl0On1vRUXFmfHxcXi9XgCA0N7eDgBwu92YTqe3iKLYveuZ3cKTHdtRKBRARF8KAEgmktjSthUvdx20WSyWd5LJZIPX6y3pGRGBMYZkMtlit9tPPPX7p4Xunh6AgEKhAL3BAKPBcDVnupo/EUGWZahFFWaLGTqdDr948gn8sK0tMzk5+R2Px3M5EAhAYIxhfHTUabfbdx458lfhYPchECc0rF2LvlNv4gfffwBEhLyUhyTloaoqpJyEvJSHXtTjp489inff6UfVoiqoRRW7ntmDf1348Gtut/uP27ZtE0vcSJK0NRGP0/KVq2nZ8pX0Td8SenHfftJUlYiIhvzDNDY6RsQ5ERGpxSIN+f0UGA8QESfinDq2/5J8S5bR0toV9N2GO0hT1Vwmk9kIAEIsGrWYTcb7/9J1AJqqAkQAAblsbrYchQJurlmMqqpFUB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PhgWg4XOx8oZNe2v8SRUIhioXDJYSDQdqz+zk61H2IpuLxfDgY7D/79tsrAKD38OH//SPxednX2Vm+bt26u20222YwNDIwFxOEa7qIMfxb07S+bCZ7Ymtb2+nzFy4o8yX6yiCkqmCiCAA4e/as6abycuvY2Jjd5XRW6Q0Ga6FQyExPT0/4Fi+eDkxMSJs2bVIAYHxkBN6amuv8/QcU+jJuyipKzgAAAABJRU5ErkJggg==';
}
}
}

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This file is part of test.
*
@ -18,23 +28,27 @@ namespace Sikofitt\Image\Profile;
* Class GitlabProfileIcon
* @package Sikofitt\Image\Profile
*/
class GitlabProfileIcon implements ProfileIconInterface {
class GitlabProfileIcon implements ProfileIconInterface
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'gitlab';
}
public function getDefaultUrl()
{
return 'https://gitlab.com';
}
/**
* {@inheritdoc}
*/
public function getName() {
return 'gitlab';
public function getIcon()
{
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAXCAYAAAD+4+QTAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHECQRchk3rwAAA3VJREFUSMe1lU1oXFUYhp/vnJtJMplJ2iQttElMbCY3uYlaKAqCddEm00K1iFakZFIQoVBciNalRURdueim4MqFYCJ0Uze6sGqhCxcuXCia1JtuatJpuhAUxJ9m7ve5mJnM3PyQZOELF845l/e87/dzzhGasDw5JiLuGvBW39fz8+wCvxUj/jHGzLjS/81Csfmfqw/uHB8jEIeanTSz99gler5aQI1TClPlYjS8qcjgjVtUzIoG7QZHl6fGszsVuHdioj58FUCV5zYVAUB4H8CgB7O+nYocuP4z5WL0MDBc458EWDoepUXKU9F+NZ6oTT3w4m7Spcrr1phOAgzcWEiLqHGsmWQiF3ey+a2nRlkuRi1197VI/N2p8ZkN6TJ4JiVi1luejI5sJ5Lv8JiSNxhax39ns5o8vyEF8Mp2In3X5wGeBVpTIjB0dyoauHNshABg6enohCq56r8GEji6o4IYb5vV914TcaY8PnhzcSkAOHg+uSQ/AQ/WcY3DS0Fkplvv71vgQJSApQwKDrNxXuImnzmbDbtNOKyHUE2Q5g+D7F5LzLYWyXapagVS3ApohFkbZwFcAiNAnhyOAkmzHzPo3KeyzmUKmRyyLnXwEEo7DoNkLjzrBF6Aqmu68fSizVuKx2WyW4u0tltaoAulvypQW7vogFMpVgFHG9pMbO0w2aTYZLssEdcUSRtGiJA0dzKPORwvi/Brys0j1cKtcfO2IWEG5PaZNNXLGMVwqfTdF88Z56fj751LhkS41mgZhBCtO2rNmaxv7yCDBRlrnLNRoK1x7sTxnTiG/XT8havGFJific+I4wJSa+Q9eAZraTOko8dStcpkazEosB9lTyMCcbzhS/GTvhT/Ve3nGiqfFAjO3Sb5NDyI8oMZvQjwI8rfOK2gK794h1S7rntAtb3THHkSJvAoINxD7EhQWlzZ9KoPzt0mmQvx03FZHH3iuAy1+rRi4nE+Q/1cW7bTBMEYQVAQ4Yp3hEFpcWV1doQt3xNfiuvDB74UvynCaYTfKSAi0NJWbYDsXlME4VGghX+957yfiV9LjD8BWmYWtxZZW5yOSWZDfCn+3DkKkudbRqGjy8wMct3qrB8ky6LAIZmOP7Kr4wQNk7uDzoXVy3I2/EDfDVeXi5GuXgpNr4aX+T9gX4YTf1wYvV/5MFx71Fc/LmzL+w9fiFeX9RDTWwAAAABJRU5ErkJggg==';
}
public function getDefaultUrl() {
return 'https://gitlab.com';
}
/**
* {@inheritdoc}
*/
public function getIcon() {
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAXCAYAAAD+4+QTAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHECQRchk3rwAAA3VJREFUSMe1lU1oXF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kr4wQNk7uDzoXVy3I2/EDfDVeXi5GuXgpNr4aX+T9gX4YTf1wYvV/5MFx71Fc/LmzL+w9fiFeX9RDTWwAAAABJRU5ErkJggg==';
}
}
}

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This file is part of test.
*
@ -14,18 +24,21 @@
namespace Sikofitt\Image\Profile;
class LinkedinProfileIcon implements ProfileIconInterface
{
class LinkedinProfileIcon implements ProfileIconInterface {
public function getName()
{
return 'linkedin';
}
public function getName() {
return 'linkedin';
}
public function getDefaultUrl()
{
return 'https://linkedin.com/in';
}
public function getDefaultUrl() {
return 'https://linkedin.com/in';
}
public function getIcon() {
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHETMTmFa4IgAAA/1JREFUSMeVlk2IXEUQx3/V783sfOxKdjeKQqImCJpsBC9qwFxC1KCiEW8eRQVBPXjxInjwJoin6CXEsyhCcvIDRUQkGoOgyaJgPlAS2GQlX7tmZ3fm1d9D93tvZnZzsKHpnqrurqp//aveGMDk7qdnWlt37DSzhrDcwABE2qQ9lcJKSTUEmNWX5N5bPXfy1NKJzy/n3YeempnZ/9Lh0J58BrNQPmxYekbUTxpChLSOGwnJC0kg0Znbc5SJzouhfefOXaE9+SwQJDAJSbgcKPfxkuSYiLokQ4BUyd2jToC1ugead2yfy2WhJQIux0wUDjf6BQImmxm2DrYUXxVe0lpcJVVnMQMLrSCgSFcHLu6e6XDmzb2ceH0PU60GnmDzBJynvWtYJiTDUwTCRmaQQC7cRWaBL154kE2tnO3TbQ49d38M3eN0OUpwyoUE7l7rvIa3hE4SuZJXAJu7TbrNrErmbKdBMwusDKLP46ySJ2iSWIqEibkECxGFUHrmLv5cXOLI/CVIhj87ucC1Xj95Fc946akLIZyx3+6RKOXeRe4SRRK2mhmvHPmNg8em6Lvz+6VlQrB0yWI2VFOgKEQhyIKRGeDGEN8RQiZyIgMp163Tba71Bgi4rTvBwtIqjWBs3dTGESt9Z+F6j9luk913zXD71ASnF5f5Y3GZxX/XIhuSITNDDnmkewz16kqff95+rML85/NX2XfoR7ZNT3L8tUcAOH7+Gu9/f44PDswx22lUZ6/3Brzz7WkO//QXWQgJ8uh9ZJcMFRGNQnVie33HCyi8ruwdt3b5+PkHRgwA3NLKee+J+9iyqUNRCC8EHiMJoqzu2vJwqxguQICpiRyAT04u8O53Zzj295WRO2/tu4cbawPKd2UiL2vEyhYxZqZwj14NjY9+ucCrn/7KRCPwYbvJVy8/zL2buwDs3TbL2sBp5QFLfSyUPcCHGUBNBAGyUfnBH86SZYYLLi71uLi0WummW3nVu8quk8eqjbVSVeXQcBfyUdmFKyup+ERJnHLkmYGr7p+q2LUBUkPRjOeqKOoedbM8uupPRF2MG0RSGhjqq1U3cK+rWuMepjxj8X5VJ+tPloaE3NfJqoreAGJSq6ogLGP04U45Hs06ztUQymwD1yxFb2UkYjCUGHdBSNh7lJXeFhKZGYWXDRFwp3BVRewePS7cMTOQYfbkG4+HXfu+jL1GDG70a4eCkU3k8YHeoAojpGovYyhWByMoZJ1GbPVm6NQ3+3Pce0pemSC0GmMsgUCAVmMELw2dCc28+pNhUFE+5bMXWDw7773lo/HbQDU1NH1Mt16fSDByRnhv+agWz87HiOcenWHL3C6CtW5aMP9nGODqcX7+FPNfX/4PZFb8sTBvluQAAAAASUVORK5CYII=';
}
}
public function getIcon()
{
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHETMTmFa4IgAAA/1JREFUSMeVlk2IXEUQx3/V783sfOxKdjeKQqImCJpsBC9qwFxC1K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jCUGHdBSNh7lJXeFhKZGYWXDRFwp3BVRewePS7cMTOQYfbkG4+HXfu+jL1GDG70a4eCkU3k8YHeoAojpGovYyhWByMoZJ1GbPVm6NQ3+3Pce0pemSC0GmMsgUCAVmMELw2dCc28+pNhUFE+5bMXWDw7773lo/HbQDU1NH1Mt16fSDByRnhv+agWz87HiOcenWHL3C6CtW5aMP9nGODqcX7+FPNfX/4PZFb8sTBvluQAAAAASUVORK5CYII=';
}
}

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This file is part of resume.
*
@ -18,9 +28,10 @@ namespace Sikofitt\Image\Profile;
* Interface ProfileIconInterface
* @package Sikofitt\Image\Profile
*/
interface ProfileIconInterface {
interface ProfileIconInterface
{
/**
/**
* @return string
* The name of the network.
*/
@ -38,5 +49,4 @@ interface ProfileIconInterface {
* Can be a url, a relative path, or base64 encoded uri.
*/
public function getIcon();
}
}

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This file is part of resume.
*
@ -14,19 +24,20 @@
namespace Sikofitt\Image\Profile;
class TwitterProfileIcon implements ProfileIconInterface
{
class TwitterProfileIcon implements ProfileIconInterface {
public function getName()
{
return 'twitter';
}
public function getDefaultUrl()
{
return 'https://twitter.com';
}
public function getName()
{
return 'twitter';
}
public function getDefaultUrl() {
return 'https://twitter.com';
}
public function getIcon() {
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4AcHEBgWn47b8wAAAedJREFUSMfllj1LHEEYgJ/du/hxCYOkCXIOwSJdhIQ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A2pbSX2FJ655xNgT2q7npGb6ax8Bh6tAJtGiXMfsh0orkltL6S281LbqtT2gRf7PGkDL4wSB9eJd2EpAYfAaMqh38AZ0ABGgGoO5CcwDrSMEvg5mQEOMmI9DDwHXhcAADT94ikHhmZvqf++GyVanZfYC5e+qyb3w2WBj1519CJf88bKJPCtB8CeUeLNX54EstujF7VwIQ0y3wNgyyhRDydFlDGbFoFV4DEwUBBwCrwCfoWTIuoyBCNgp2BZN4Axo8RR2mbZGS4Dgw5akdrOAV8KemCASeA4S6HTjAPAJrAAPCpovAm8Bz4ZJS5zm8YL0VvgHTDVpVfqLsGr/9yZ4bUrtR0Pxg5A2yjxw78h7+SnICzP+yVXFk+tI1UN56QAAAAASUVORK5CYII=';
}
}

View File

@ -0,0 +1,39 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This file is part of test.
*
* @file JsonFileTrait.php
*
* R. Eric Wheeler <reric@ee.stanford.edu>
*
* 7/8/16 / 8:12 AM
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sikofitt\Json;
trait JsonFileTrait
{
public function encodeFile($array, $file, $schema = null)
{
return $this['json.encode']->encodeFile($array, $file, $schema);
}
public function decodeFile($file, $schema = null)
{
return $this['json.decode']->decodeFile($file, $file, $schema);
}
}

View File

@ -0,0 +1,42 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sikofitt\Json;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Webmozart\Json\JsonDecoder;
use Webmozart\Json\JsonEncoder;
use Webmozart\Json\JsonValidator;
/**
* Class JsonServiceProvider
* @package Sikofitt\Json
*/
class JsonServiceProvider implements ServiceProviderInterface
{
/**
* @param Container $app
*/
public function register(Container $app)
{
$app['json.encode'] = function ($app) {
return new JsonEncoder();
};
$app['json.decode'] = function ($app) {
return new JsonDecoder();
};
$app['json.validate'] = function ($app) {
return new JsonValidator();
};
}
}

View File

@ -0,0 +1,50 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sikofitt\Json;
/**
* Class JsonTrait
* @package Sikofitt\Json
*/
trait JsonTrait
{
/**
* @param $array
* @param null $schema
* @return mixed
*/
public function encode($array, $schema = null)
{
return $this['json.encode']->encode($array, $schema);
}
/**
* @param $json
* @param null $schema
* @return mixed
*/
public function decode($json, $schema = null)
{
return $this['json.decode']->decode($json, $schema);
}
/**
* @param $json
* @param $schema
* @return mixed
*/
public function validate($json, $schema)
{
return $this['json.validate']->validate($json, $schema);
}
}

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Created by PhpStorm.
* User: eric
@ -8,17 +18,16 @@
namespace Sikofitt\Json;
use Webmozart\Json\JsonDecoder;
use Webmozart\Json\JsonEncoder;
use App;
use Webmozart\Json\DecodingFailedException;
use Webmozart\Json\EncodingFailedException;
use Webmozart\Json\JsonValidator;
use Webmozart\Json\ValidationFailedException;
use Webmozart\Json\FileNotFoundException;
use Webmozart\Json\IOException;
use App;
use Webmozart\Json\JsonDecoder;
use Webmozart\Json\JsonEncoder;
use Webmozart\Json\JsonValidator;
use Webmozart\Json\ValidationFailedException;
/**
* Class ResumeBuilder
* @package Sikofitt\Json
@ -27,38 +36,34 @@ class ResumeBuilder
{
private $app;
public function __construct (App $app)
public function __construct(App $app)
{
$this->app = $app;
}
public function toJson ($resumeArray, array $options = array ())
public function toJson($resumeArray, array $options = [])
{
$encoder = new JsonEncoder();
$validator = new JsonValidator();
if(!isset($options['file'])) {
if (!isset($options['file'])) {
throw new \InvalidArgumentException('file is a required argument.');
}
$errors = $validator->validate((object)$resumeArray, $options['app']->getResumeSchema());
dump($errors);
try {
// $encoder->encodeFile ($resumeArray, 'test.json');
// $encoder->encodeFile ($resumeArray, 'test.json');
} catch (\Exception $e) {
$r = new \ReflectionClass($e);
$exceptionClass = $r->getName();
return new $exceptionClass($e->getMessage());
}
}
public function fromJson ($resumeJson, array $options = array ())
public function fromJson($resumeJson, array $options = [])
{
$decoder = new JsonDecoder();
$resumeObject = $decoder->decodeFile($this->app->getResumeJson(), $this->app->getResumeSchema());
return $resumeObject;
}
}
}

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Created by PhpStorm.
* User: eric
@ -8,7 +18,6 @@
namespace Sikofitt\Resume;
use Webmozart\Json\Conversion\JsonConverter;
/**
@ -23,7 +32,7 @@ class ResumeParser implements JsonConverter
*
* @return void
*/
public function fromJson ($jsonData, array $options = array ())
public function fromJson($jsonData, array $options = [])
{
// TODO: Implement fromJson() method.
}
@ -34,10 +43,8 @@ class ResumeParser implements JsonConverter
*
* @return void
*/
public function toJson ($data, array $options = array ())
public function toJson($data, array $options = [])
{
// TODO: Implement toJson() method.
}
}
}

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This file is part of resume.
*
@ -14,12 +24,13 @@
namespace Sikofitt\Twig;
class Date extends \Twig_Extension
{
class Date extends \Twig_Extension {
public function getName() {
return 'date_diff';
}
public function getName()
{
return 'date_diff';
}
/**
* @return array
@ -27,7 +38,7 @@ class Date extends \Twig_Extension {
*/
public function getFilters()
{
return [
return [
new \Twig_SimpleFilter('date_diff', [$this, 'dateDiff']),
];
}
@ -42,9 +53,8 @@ class Date extends \Twig_Extension {
*/
public function dateDiff($startDate, $endDate = 'now')
{
$dt = new \DateTimeImmutable($startDate);
$dateDifference = $dt->diff(new \DateTime($endDate));
return $dateDifference->format('%y years');
$dt = new \DateTimeImmutable($startDate);
$dateDifference = $dt->diff(new \DateTime($endDate));
return $dateDifference->format('%y years');
}
}
}

View File

@ -1,4 +1,14 @@
<?php
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* This file is part of test.
*
@ -14,41 +24,42 @@
namespace Sikofitt\Twig;
class RenderProfile extends \Twig_Extension
{
class RenderProfile extends \Twig_Extension {
public function getName()
{
return 'render_profile';
}
public function getName() {
return 'render_profile';
}
public function getFunctions() {
return [
public function getFunctions()
{
return [
new \Twig_SimpleFunction('render_profile', [$this, 'renderProfile'], ['needs_context' => true]),
];
}
}
public function renderProfile($context, $iconData)
{
$imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAIAAABLixI0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHEQYsjAFXqQAAAEVpVFh0Q29tbWVudAAAAAAAQ1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2ODApLCBxdWFsaXR5ID0gOTAKqozFDgAAAiVJREFUOMutlT/oOWEcx+8OX5fLDVwx2ZQFSQYzmZgMzCaDzaCUMpmQkowM2G+gFFnUGXRKSQwGIYtyisif+w2n+973ucef4fde7u75fD6v5/l8Ps/zHMLDxHFcp9OJxWJOp1Ov1ysUChzHLRZLNBrt9Xrn8xkahciH6vW6VqtFXouiqOFw+JmVz+eR79Rqtd6xSqUS8rUwDGNZFs7a7/c4jku9lUplOByuVqvtdpum6Xg8jqKo1MHn88FZHo8HmPnn50co8+PxeLVwjuNA1mq1giaSTCaDwaDX653P58+Av6pUKiJLKQxNJhMUReWumUxGeGFZ1mw2yydbLpe/FRQeh8NBDhJFkmQgEEAQJJ1OAyaDwfD7ISyv2+0CdZV2YL1e8zw/Go3UajXQSkjtj8fjK1YkEnmWQ6kETEajUcp65qjRaAqFApRls9kQBBkMBrfbDTBtt9tGowHmKMhqtUJzJAhCpVJBZ9LpdKfTCbLvGYaRe2ez2d1uV6vV5CahLAzDwM9jIpEAAjabDXRnCSqXy5fLBc46HA4kSUq9c7kcz/PQdQElAlnX69XhcHx5vP1+P6SP0i0DnPD3rD+xgPnxeJhMpm9AKIra7faXCYtaLBYURUHjRWEYJnbw5R0t6HK5hEIhKYggiGazOZ1O+/1+u90ej8ef73up3G63yEqlUu+dP7Du97vL5RL+F/wnIR89ZrMZhmHFYvE/sHiep2lavFff6B8xFGrMmf/uPQAAAABJRU5ErkJggg==';
public function renderProfile($context, $iconData)
{
$imageData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAIAAABLixI0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AcHEQYsjAFXqQAAAEVpVFh0Q29tbWVudAAAAAAAQ1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcgSlBFRyB2ODApLCBxdWFsaXR5ID0gOTAKqozFDgAAAiVJREFUOMutlT/oOWEcx+8OX5fLDVwx2ZQFSQYzmZgMzCaDzaCUMpmQkowM2G+gFFnUGXRKSQwGIYtyisif+w2n+973ucef4fde7u75fD6v5/l8Ps/zHMLDxHFcp9OJxWJOp1Ov1ysUChzHLRZLNBrt9Xrn8xkahciH6vW6VqtFXouiqOFw+JmVz+eR79Rqtd6xSqUS8rUwDGNZFs7a7/c4jku9lUplOByuVqvtdpum6Xg8jqKo1MHn88FZHo8HmPnn50co8+PxeLVwjuNA1mq1giaSTCaDwaDX653P58+Av6pUKiJLKQxNJhMUReWumUxGeGFZ1mw2yydbLpe/FRQeh8NBDhJFkmQgEEAQJJ1OAyaDwfD7ISyv2+0CdZV2YL1e8zw/Go3UajXQSkjtj8fjK1YkEnmWQ6kETEajUcp65qjRaAqFApRls9kQBBkMBrfbDTBtt9tGowHmKMhqtUJzJAhCpVJBZ9LpdKfTCbLvGYaRe2ez2d1uV6vV5CahLAzDwM9jIpEAAjabDXRnCSqXy5fLBc46HA4kSUq9c7kcz/PQdQElAlnX69XhcHx5vP1+P6SP0i0DnPD3rD+xgPnxeJhMpm9AKIra7faXCYtaLBYURUHjRWEYJnbw5R0t6HK5hEIhKYggiGazOZ1O+/1+u90ej8ef73up3G63yEqlUu+dP7Du97vL5RL+F/wnIR89ZrMZhmHFYvE/sHiep2lavFff6B8xFGrMmf/uPQAAAABJRU5ErkJggg==';
//network": "Twitter" +"username": "sikofitt" +"url": ""
$icons = $context['app']->config('app.icons');
$network = strtolower($iconData->network);
$haveNetwork = isset($icons[$network]);
if($haveNetwork) {
$imageData = $icons[strtolower($iconData->network)];
} else {
return;
$network = strtolower($iconData->network);
$haveNetwork = isset($icons[$network]);
if ($haveNetwork) {
$imageData = $icons[strtolower($iconData->network)];
} else {
return;
}
if (!isset($iconData->url) || empty($iconData->url)) {
$iconData->url = $icons[strtolower($iconData->network)]['url'] . '/' . $iconData->username;
}
$imageUrl = sprintf('<img src="%s" alt="%s" />', $imageData['icon'], $iconData->network);
if (isset($iconData->url) && !empty($iconData->url)) {
return sprintf('<a class="profile-link" href="%s" title="%s" target="_blank">%s</a>', $iconData->url, $iconData->network, $imageUrl);
} else {
return $imageUrl;
}
}
if(!isset($iconData->url) || empty($iconData->url))
{
$iconData->url = $icons[strtolower($iconData->network)]['url'] . '/' . $iconData->username;
}
$imageUrl = sprintf('<img src="%s" alt="%s" />', $imageData['icon'], $iconData->network);
if(isset($iconData->url) && !empty($iconData->url)) {
return sprintf('<a class="profile-link" href="%s" title="%s" target="_blank">%s</a>', $iconData->url, $iconData->network,$imageUrl);
} else {
return $imageUrl;
}
}
}
}

View File

@ -1,4 +1,5 @@
@import 'uikit.less';
@import 'components/notify.less';
@import 'https://fonts.googleapis.com/css?family=Lato:300|Eczar';
@base-body-font-family : 'Lato';

View File

@ -1,106 +1,20 @@
<?php
use Sikofitt\Json\ResumeBuilder;
use Symfony\Component\HttpFoundation\Response;
use Silex\Provider\TwigServiceProvider;
use WhoopsSilex\WhoopsServiceProvider;
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
/*
* This file is part of Resume.PHP.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../app/App.php';
define('APP_ROOT', __DIR__ . '/../');
define('SCHEMA_URL', 'https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json');
$app = new App();
$app['debug'] = true;
$app->register(new Sikofitt\Config\ConfigServiceProvider(), [
'config.path' => $app->getConfDirectory(),
]);
$app->register(new TwigServiceProvider(), [
'twig.path' => [
APP_ROOT . 'app/views',
APP_ROOT . 'vendor/symfony/web-profiler-bundle/Resources/views/Profiler'
],
]);
$app->register(new WhoopsServiceProvider());
$app->register(new \Silex\Provider\AssetServiceProvider());
$app->register(new \Silex\Provider\MonologServiceProvider());
$app->register(new \Silex\Provider\HttpKernelServiceProvider());
$app->register(new \Silex\Provider\AssetServiceProvider());
$app->register(new \Silex\Provider\FormServiceProvider());
$app->register(new \Silex\Provider\HttpFragmentServiceProvider());
$app->register(new \Silex\Provider\ServiceControllerServiceProvider());
$app->register(new \Silex\Provider\RoutingServiceProvider());
$app->register(new \Silex\Provider\VarDumperServiceProvider(), array(
'var_dumper.dump_destination' => new \Symfony\Component\VarDumper\Cloner\VarCloner(),
));
$app->register(new \Silex\Provider\MonologServiceProvider(), array(
'monolog.logfile' => $app->getDataDirectory() . '/logs/' . (null !== $app->config('app.environment') ? $app->config('app.environment') . '.log' : 'dev.log'),
));
$app->register(new \Silex\Provider\SessionServiceProvider());
$app->register(new \Silex\Provider\WebProfilerServiceProvider(), array(
'profiler.cache_dir' => $app->getDataDirectory() . '/cache/profiler',
));
$app->extend('twig', function (\Twig_Environment $twig, $app) {
$twig->enableDebug();
$twig->addExtension(new Twig_Extensions_Extension_Date());
$twig->addExtension(new Sikofitt\Twig\Date());
$twig->addExtension(new Sikofitt\Twig\RenderProfile());
$twig->addGlobal('config', $app['config']->all());
return $twig;
});
$app->error(function (\Exception $e, $code) use ($app) {
switch ($code) {
case 404:
$message = $app['twig']->render('error404.html.twig');
break;
default:
$message = $app['twig']->render('error500.html.twig');
}
return new Response($message, $code);
});
$app['json.decoder'] = function ($app) {
return new Webmozart\Json\JsonDecoder();
};
$app['json.encoder'] = function ($app) {
return new Webmozart\Json\JsonEncoder();
};
$app['json.validator'] = function ($app) {
return new Webmozart\Json\JsonValidator();
};
$app->get('/', function () use ($app) {
$resumeData = $app['json.decoder']->decodeFile($app->getDataDirectory() . '/resume.json', $app->getDataDirectory() . '/resume.schema.json');
$basics = (isset($resumeData->basics) && count($resumeData->basics) > 0) ? $resumeData->basics : null;
$work = (isset($resumeData->work) && count($resumeData->work) > 0) ? $resumeData->work : null;
$volunteer = (isset($resumeData->volunteer) && count($resumeData->volunteer) > 0) ? $resumeData->volunteer : null;
$education = (isset($resumeData->education) && count($resumeData->education) > 0) ? $resumeData->education : null;
$awards = (isset($resumeData->awards) && count($resumeData->awards) > 0) ? $resumeData->awards : null;
$publications = (isset($resumeData->publications) && count($resumeData->publications) > 0) ? $resumeData->publications : null;
$skills = (isset($resumeData->skills) && count($resumeData->skills) > 0) ? $resumeData->skills : null;
$languages = (isset($resumeData->languages) && count($resumeData->languages) > 0) ? $resumeData->languages : null;
$interests = (isset($resumeData->interests) && count($resumeData->interests) > 0) ? $resumeData->interests : null;
$references = (isset($resumeData->references) && count($resumeData->references) > 0) ? $resumeData->references : null;
return $app['twig']->render('resume.html.twig', [
'basics' => $basics,
'work' => $work,
'volunteer' => $volunteer,
'education' => $education,
'awards' => $awards,
'publications' => $publications,
'skills' => $skills,
'languages' => $languages,
'interests' => $interests,
'references' => $references,
]);
});
require_once $app->getAppDirectory() . '/providers.php';
$app->mount('/', new \Sikofitt\Controller\ResumeControllerProvider());
$app->mount('/api', new \Sikofitt\Controller\ApiControllerProvider());
$app->run();