92 lines
2.1 KiB
PHP
92 lines
2.1 KiB
PHP
<?php
|
|
|
|
use Sikofitt\Config\ConfigTrait;
|
|
use Silex\Application;
|
|
|
|
require '../vendor/autoload.php';
|
|
|
|
/**
|
|
* Class App
|
|
*/
|
|
class App extends Application {
|
|
|
|
use ConfigTrait;
|
|
use Application\TwigTrait;
|
|
use Application\MonologTrait;
|
|
use Application\SwiftmailerTrait;
|
|
use Application\TranslationTrait;
|
|
use Application\UrlGeneratorTrait;
|
|
|
|
public $conf;
|
|
|
|
/**
|
|
* Returns the application directory.
|
|
*
|
|
* @return string
|
|
* The main application directory.
|
|
*/
|
|
public function getAppDirectory() {
|
|
$r = new ReflectionClass($this);
|
|
return dirname($r->getFileName());
|
|
}
|
|
|
|
/**
|
|
* Returns the root directory of the application.
|
|
*
|
|
* @return string
|
|
* The root directory of the application.
|
|
*/
|
|
public function getRootDirectory() {
|
|
return dirname($this->getAppDirectory());
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getConfDirectory() {
|
|
return $this->getAppDirectory() . '/config';
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getDataDirectory() {
|
|
return $this->getRootDirectory() . '/data';
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getResumeJson() {
|
|
return $this->getDataDirectory() . '/resume.json';
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getResumeSchema() {
|
|
return $this->getDataDirectory() . '/resume.schema.json';
|
|
}
|
|
|
|
/**
|
|
* Registers media icons
|
|
*
|
|
* @param \Sikofitt\Image\Profile\ProfileIconInterface $icon
|
|
*/
|
|
public function registerIcon(\Sikofitt\Image\Profile\ProfileIconInterface $icon)
|
|
{
|
|
$this->config(sprintf('app.icons.%s', $icon->getName()), ['icon' => $icon->getIcon(), 'url' => $icon->getDefaultUrl()]);
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|
|
|