Created
July 16, 2015 06:19
-
-
Save Boorj/151597e0f071d431a32f to your computer and use it in GitHub Desktop.
Custom init for bolt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Mapple\Bolt; | |
use Bolt; | |
use Mapple\Bolt\CustomTranslationsProvider; | |
use SilexMtHaml\MtHamlServiceProvider; | |
Class AppInit { | |
public function __construct ($path) { | |
$this->path = $path; | |
} | |
public function run() { | |
$vendor_dir = "vendor"; | |
$app_dir = "app"; | |
$src_dir = "src"; | |
$web_dir = "web"; | |
$upload_dir = "up"; | |
$site_dir = "{$src_dir}/Site"; | |
$res_dir = "{$site_dir}/Resources"; | |
$configuration = new Bolt\Configuration\Composer($this->path); | |
$configuration->setPath("vendor_dir", $vendor_dir); | |
$configuration->setPath("cache", "{$app_dir}/vars/cache"); | |
$configuration->setPath("logs", "{$app_dir}/vars/logs"); | |
$configuration->setPath("database", "{$app_dir}/database"); | |
$configuration->setPath("extensionspath", "{$app_dir}/extensions"); | |
$configuration->setPath("themebase", "{$res_dir}"); | |
$configuration->setPath("config", "{$res_dir}/config"); | |
$configuration->setPath("extensionsconfig", "{$res_dir}/config/extensions"); | |
$configuration->setPath("translations", "{$res_dir}/translations"); | |
$configuration->setPath("web", "{$web_dir}"); | |
$configuration->setPath("files", "{$web_dir}/{$upload_dir}"); | |
$configuration->setPath("thumbs", "/{$upload_dir}/thumbs"); | |
$configuration->getVerifier()->disableApacheChecks(); | |
$configuration->verify(); | |
$app = new Bolt\Application(array("resources"=>$configuration)); | |
$app->initialize(); | |
$app->mount($configuration->getPath('thumbs'), new \Bolt\Thumbs\ThumbnailProvider()); | |
$app->register(new MtHamlServiceProvider()); | |
$app->register(new CustomTranslationsProvider()); | |
$app->run(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once "../vendor/autoload.php"; | |
$app = new \Mapple\Bolt\AppInit(dirname(__DIR__)); | |
$app->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment