Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/LaraPress/Foundation/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Pipeline\Pipeline;
use Illuminate\Support\Facades\Facade;
use LaraPress\Routing\Matching\UriValidator;
use Symfony\Component\Debug\Exception\FatalThrowableError;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;
Expand Down Expand Up @@ -73,7 +74,11 @@ public function handle($request)
} catch (Exception $e) {

if (is_admin() && $e instanceof NotFoundHttpException) {
$response = null;
$e = new \Exception(sprintf(
'The LaraPress router could not find this route. Admin routes are matched with the %s class.',
UriValidator::class
));
$response = $this->renderException($request, $e);
} else {
$this->reportException($e);
$response = $this->renderException($request, $e);
Expand Down
2 changes: 1 addition & 1 deletion src/LaraPress/Routing/Matching/UriValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function matches(Route $route, Request $request)
$regex = $route->getCompiled()->getRegex();

if (str_contains($request->getRequestUri(), '/wp-admin')) {
return preg_match(str_replace('$#s', '(?:&.+)?$#s', $regex), rawurldecode($request->getRequestUri()));
return preg_match(str_replace('$}sDu', '}', $regex), rawurldecode($request->getRequestUri()));
}

$path = $request->path() == '/' ? '/' : '/' . $request->path();
Expand Down
2 changes: 0 additions & 2 deletions src/LaraPress/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ protected function addAdminMenuPage($uri, Route $route)

remove_menu_page($slug);

set_current_screen($slug);

if (count($uri) == 0 && !$parentSlug) {
add_menu_page($pageTitle, $menuTitle, $capability, $slug, $response, $icon, $position);
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/publishes/app/Http/Controllers/Controller.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use LaraPress\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
}
18 changes: 12 additions & 6 deletions src/publishes/app/Http/Kernel.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http;

use LaraPress\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
Expand All @@ -14,11 +14,13 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
];

/**
Expand All @@ -39,7 +41,7 @@ class Kernel extends HttpKernel

'api' => [
'throttle:60,1',
'bindings',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

Expand All @@ -51,11 +53,15 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}
}
2 changes: 1 addition & 1 deletion src/publishes/bootstrap/app.stub
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defined('LARAPRESS_THEME_TEXTDOMAIN') ?: define('LARAPRESS_THEME_TEXTDOMAIN', 'l
*/

$app = new LaraPress\Foundation\Application(
realpath(__DIR__ . '/..')
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);

/*
Expand Down
103 changes: 54 additions & 49 deletions src/publishes/config/app.stub
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ return [
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
| services the application utilizes. Set this in your ".env" file.
|
*/

Expand All @@ -39,7 +39,7 @@ return [
|
*/

'debug' => env('APP_DEBUG', false),
'debug' => (bool) env('APP_DEBUG', false),

/*
|--------------------------------------------------------------------------
Expand All @@ -54,6 +54,8 @@ return [

'url' => env('APP_URL', 'http://localhost'),

'asset_url' => env('ASSET_URL', null),

/*
|--------------------------------------------------------------------------
| Application Timezone
Expand Down Expand Up @@ -95,35 +97,31 @@ return [

/*
|--------------------------------------------------------------------------
| Encryption Key
| Faker Locale
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/

'key' => env('APP_KEY'),

'cipher' => 'AES-256-CBC',
'faker_locale' => 'en_US',

/*
|--------------------------------------------------------------------------
| Logging Configuration
| Encryption Key
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Settings: "single", "daily", "syslog", "errorlog"
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/

'log' => env('APP_LOG', 'single'),
'key' => env('APP_KEY'),

'log_level' => env('APP_LOG_LEVEL', 'debug'),
'cipher' => 'AES-256-CBC',

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -164,6 +162,10 @@ return [
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,

/*
* Package Service Providers...
*/

/*
* LaraPress Framework Service Providers
*/
Expand Down Expand Up @@ -211,39 +213,42 @@ return [

'aliases' => [

'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'Str' => Illuminate\Support\Str::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,

/* LaraPress Facades */
'Action' => LaraPress\Support\Facades\Action::class,
Expand Down
Loading
Loading