Migrated site to Slim v4 and supporting libraries; removed some old band info (namely removed Andrew and Zakk from the about page); added Grunt.js config for compiling SASS/CoffeeScript

This commit is contained in:
2023-05-12 23:34:43 -04:00
parent d071bdeba6
commit e34ec3b947
29 changed files with 3078 additions and 644 deletions

View File

@ -1,16 +1,11 @@
<?php
// Slim deps
use Slim\Slim;
use DI\Container;
use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\Views\TwigExtension;
use Slim\Views\TwigMiddleware;
// Config struff
use Noodlehaus\Config;
// Our dependencies
use Fieldprotocol\Music\Album;
use Fieldprotocol\Music\Song;
require __DIR__ . '/../vendor/autoload.php';
// Let's get this session started
session_cache_limiter(false);
@ -19,55 +14,18 @@ session_start();
// For now, display some errors
ini_set('display_errors', 'On');
// The app's root directory
define('INC_ROOT', dirname(__DIR__));
// Create new container object
$container = new Container();
// Set container to create App with on AppFactory
AppFactory::setContainer($container);
$app = AppFactory::create();
// Autoload our stuff >:D
require INC_ROOT . '/vendor/autoload.php';
// Time to create our app
$app = new Slim([
'mode' => trim(file_get_contents(INC_ROOT . '/mode.php')),
'view' => new Twig(),
'templates.path' => INC_ROOT . '/app/views'
]);
// Run some crap before the middleware
//$app->add(new BeforeMiddleware);
//$app->add(new CSRFMiddleware);
$app->configureMode($app->config('mode'), function() use ($app) {
$app->config = Config::load(INC_ROOT . "/app/config/{$app->mode}.php");
});
// Create Twig
$twig = Twig::create(__DIR__ . '/../views', ['cache' => false]);
// Add Twig-View Middleware
$app->add(TwigMiddleware::create($app, $twig));
// Database configs
require 'database.php';
// Filters
require 'filters.php';
//require 'database.php';
// Routes configs
require 'routes.php';
//$app->auth = false;
// Album singleton
$app->container->set('album', function() {
return new Album;
});
// Song singleton
$app->container->set('song', function() {
return new Song;
});
// Slappin' some hoes with our views
$view = $app->view();
$view->parserOptions = [
'debug' => $app->config->get('twig.debug')
];
$view->setTemplatesDirectory('../app/views');
$view->parserExtensions = [
new TwigExtension()
];
// Run Slim
$app->run();