-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22e6dfc
commit aeb0694
Showing
41 changed files
with
458 additions
and
642 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Exception; | ||
use Psr\Http\Message\ResponseInterface; | ||
use Rareloop\Lumberjack\Exceptions\Handler as LumberjackHandler; | ||
use Zend\Diactoros\ServerRequest; | ||
|
||
class Handler extends LumberjackHandler | ||
{ | ||
protected $dontReport = []; | ||
|
||
public function report(Exception $e) | ||
{ | ||
parent::report($e); | ||
} | ||
|
||
public function render(ServerRequest $request, Exception $e) : ResponseInterface | ||
{ | ||
return parent::render($request, $e); | ||
} | ||
} |
0
lumberjack/src/PostTypes/.gitkeep → app/Http/Controllers/.gitkeep
100755 → 100644
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace App\Http; | ||
|
||
use Rareloop\Lumberjack\Http\Lumberjack as LumberjackCore; | ||
|
||
class Lumberjack extends LumberjackCore | ||
{ | ||
public function addToContext($context) | ||
{ | ||
$context['is_home'] = is_home(); | ||
$context['is_front_page'] = is_front_page(); | ||
$context['is_logged_in'] = is_user_logged_in(); | ||
|
||
// In Timber, you can use TimberMenu() to make a standard Wordpress menu available to the | ||
// Twig template as an object you can loop through. And once the menu becomes available to | ||
// the context, you can get items from it in a way that is a little smoother and more | ||
// versatile than Wordpress's wp_nav_menu. (You need never again rely on a | ||
// crazy "Walker Function!") | ||
$context['menu'] = new Menu('main-nav'); | ||
|
||
return $context; | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App\Menu; | ||
|
||
use Timber\Menu as TimberMenu; | ||
|
||
class Menu extends TimberMenu | ||
{ | ||
public $MenuItemClass = 'App\Menu\Item'; | ||
public $PostClass = 'Rareloop\Lumberjack\Post'; | ||
} |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
use Rareloop\Lumberjack\Application; | ||
use App\Exceptions\Handler; | ||
use Rareloop\Lumberjack\Exceptions\HandlerInterface; | ||
|
||
$autoloader = require_once('autoload.php'); | ||
|
||
$autoloader('App\\', dirname(__DIR__) . '/app/'); | ||
|
||
$app = new Application(dirname(__DIR__)); | ||
|
||
$app->bind(HandlerInterface::class, $app->make(Handler::class)); | ||
|
||
return $app; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
return function ($prefix, $baseDir) { | ||
/** | ||
* An example of a project-specific implementation. | ||
* | ||
* After registering this autoload function with SPL, the following line | ||
* would cause the function to attempt to load the \Foo\Bar\Baz\Qux class | ||
* from /path/to/project/src/Baz/Qux.php: | ||
* | ||
* new \Foo\Bar\Baz\Qux; | ||
* | ||
* @param string $class The fully-qualified class name. | ||
* @return void | ||
*/ | ||
spl_autoload_register(function ($class) use ($prefix, $baseDir) { | ||
// does the class use the namespace prefix? | ||
$len = strlen($prefix); | ||
|
||
if (strncmp($prefix, $class, $len) !== 0) { | ||
// no, move to the next registered autoloader | ||
return; | ||
} | ||
|
||
// get the relative class name | ||
$relativeClass = substr($class, $len); | ||
|
||
// replace the namespace prefix with the base directory, replace namespace | ||
// separators with directory separators in the relative class name, append | ||
// with .php | ||
$file = $baseDir . str_replace('\\', '/', $relativeClass) . '.php'; | ||
|
||
// if the file exists, require it | ||
if (file_exists($file)) { | ||
require $file; | ||
} | ||
}); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
return [ | ||
/** | ||
* The current application environment | ||
*/ | ||
'environment' => getenv('WP_ENV'), | ||
|
||
/** | ||
* Is debug mode enabled? | ||
*/ | ||
'debug' => WP_DEBUG ?? false, | ||
|
||
/** | ||
* List of providers to initialise during app boot | ||
*/ | ||
'providers' => [ | ||
Rareloop\Lumberjack\Providers\RouterServiceProvider::class, | ||
Rareloop\Lumberjack\Providers\WordPressControllersServiceProvider::class, | ||
Rareloop\Lumberjack\Providers\TimberServiceProvider::class, | ||
Rareloop\Lumberjack\Providers\ImageSizesServiceProvider::class, | ||
Rareloop\Lumberjack\Providers\CustomPostTypesServiceProvider::class, | ||
Rareloop\Lumberjack\Providers\MenusServiceProvider::class, | ||
Rareloop\Lumberjack\Providers\LogServiceProvider::class, | ||
Rareloop\Lumberjack\Providers\ThemeSupportServiceProvider::class, | ||
], | ||
|
||
'themeSupport' => [ | ||
'post-thumbnail', | ||
], | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
return [ | ||
/** | ||
* List of image sizes to register, each image size looks like: | ||
* [ | ||
* 'name' => 'thumb' | ||
* 'width' => 100, | ||
* 'height' => 200, | ||
* 'crop' => true, | ||
* ] | ||
*/ | ||
'sizes' => [ | ||
], | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
return [ | ||
/** | ||
* List of menus to register with WordPress during bootstrap | ||
*/ | ||
'menus' => [ | ||
'main-nav' => __('Main Navigation'), | ||
], | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
return [ | ||
/** | ||
* List all the sub-classes of Rareloop\Lumberjack\Post in your app that you wish to | ||
* automatically register with WordPress as part of the bootstrap process. | ||
*/ | ||
'register' => [ | ||
], | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
return [ | ||
/** | ||
* List of directories to load Twig files from | ||
*/ | ||
'paths' => [ | ||
'views', | ||
], | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
<?php | ||
|
||
use Timber\Timber; | ||
use App\Http\Lumberjack; | ||
|
||
// Timber::$cache = true; | ||
// Create the Application Container | ||
$app = require_once('bootstrap/app.php'); | ||
|
||
Timber::$dirname = [ | ||
'views', | ||
'views/templates', | ||
]; | ||
// Bootstrap Lumberjack from the Container | ||
$lumberjack = $app->make(Lumberjack::class); | ||
$lumberjack->bootstrap(); | ||
|
||
require_once('lumberjack/bootstrap.php'); | ||
// Import our routes file | ||
require_once('routes.php'); | ||
|
||
// Set global params in the Timber context | ||
add_filter('timber_context', [$lumberjack, 'addToContext']); |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.