diff --git a/.babelrc b/.babelrc deleted file mode 100644 index a9b68d19ea..0000000000 --- a/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["@babel/plugin-syntax-dynamic-import"] -} diff --git a/.editorconfig b/.editorconfig index 9bfbfb933c..2ca82c5eee 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,3 +19,6 @@ indent_size = 2 [resources/views/**.php] indent_size = 2 + +[index.php] +indent_size = 2 diff --git a/.stylelintrc b/.stylelintrc index 631d5870bb..0ac2ff33cb 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -5,6 +5,7 @@ "value-list-comma-newline-after": null, "no-empty-source": null, "no-descending-specificity": null, + "at-rule-empty-line-before": null, "at-rule-no-unknown": [ true, { diff --git a/README.md b/README.md index 490a1b836d..dae23ce6cd 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ See a working example at [roots-example-project.com](https://roots-example-proje Make sure all dependencies have been installed before moving on: -* [WordPress](https://wordpress.org/) >= 5.2 -* [PHP](https://secure.php.net/manual/en/install.php) >= 7.1.3 (with [`php-mbstring`](https://secure.php.net/manual/en/book.mbstring.php) enabled) +* [WordPress](https://wordpress.org/) >= 5.4 +* [PHP](https://secure.php.net/manual/en/install.php) >= 7.2.0 (with [`php-mbstring`](https://secure.php.net/manual/en/book.mbstring.php) enabled) * [Composer](https://getcomposer.org/download/) * [Node.js](http://nodejs.org/) >= 8.0.0 * [Yarn](https://yarnpkg.com/en/docs/install) @@ -114,7 +114,7 @@ Contributions are welcome from everyone. We have [contributing guidelines](https Help support our open-source development efforts by [becoming a patron](https://www.patreon.com/rootsdev). - + ## Community diff --git a/app/View/Components/Alert.php b/app/View/Components/Alert.php new file mode 100644 index 0000000000..cc579ba125 --- /dev/null +++ b/app/View/Components/Alert.php @@ -0,0 +1,45 @@ +type = $type; + $this->message = $message; + } + + /** + * Get the view / contents that represent the component. + * + * @return \Illuminate\View\View|string + */ + public function render() + { + return $this->view('components.alert'); + } +} diff --git a/app/Composers/App.php b/app/View/Composers/App.php similarity index 95% rename from app/Composers/App.php rename to app/View/Composers/App.php index 8462717310..0d870d4438 100644 --- a/app/Composers/App.php +++ b/app/View/Composers/App.php @@ -1,6 +1,6 @@ get()) { - wp_enqueue_script('sage/vendor.js', asset('scripts/vendor.js')->uri(), ['jquery'], null, true); - wp_enqueue_script( - 'sage/editor.js', - asset('scripts/editor.js')->uri(), - array_merge($manifest['dependencies'], ['sage/vendor.js']), - $manifest['version'] - ); - - wp_add_inline_script('sage/editor.js', asset('scripts/manifest.js')->contents(), 'before'); + wp_enqueue_script('sage/vendor.js', asset('scripts/vendor.js')->uri(), $manifest['dependencies'], null, true); + wp_enqueue_script('sage/editor.js', asset('scripts/editor.js')->uri(), ['sage/vendor.js'], null, true); + + wp_add_inline_script('sage/vendor.js', asset('scripts/manifest.js')->contents(), 'before'); } wp_enqueue_style('sage/editor.css', asset('styles/editor.css')->uri(), false, null); diff --git a/composer.json b/composer.json index b2c88ee101..652f2959b8 100644 --- a/composer.json +++ b/composer.json @@ -39,11 +39,11 @@ } }, "require": { - "php": "^7.2", - "roots/acorn": "dev-master" + "php": "^7.2.5", + "roots/acorn": "^1.0.1" }, "require-dev": { - "filp/whoops": "^2.5", + "filp/whoops": "^2.7", "squizlabs/php_codesniffer": "^3.5" }, "suggest": { @@ -59,7 +59,7 @@ "prefer-stable": true, "scripts": { "lint": [ - "phpcs --ignore=vendor,resources,storage,dist --extensions=php --standard=PSR12 ." + "phpcs --ignore=index.php,vendor,resources,storage,dist --extensions=php --standard=PSR12 ." ], "post-autoload-dump": [ "Roots\\Acorn\\ComposerScripts::postAutoloadDump" diff --git a/config/app.php b/config/app.php index 3a95033b19..363b53a257 100644 --- a/config/app.php +++ b/config/app.php @@ -120,13 +120,20 @@ */ 'providers' => [ + /** + * Package Service Providers + */ + // ExamplePackage\Providers\ExamplePackageServiceProvider::class, + + /** + * Application Service Providers + */ App\Providers\ThemeServiceProvider::class, - // App\SomeService\SomeServiceServiceProvider::class, ], /* |-------------------------------------------------------------------------- - | Class Aliases (formerly "Facades") + | Class Aliases |-------------------------------------------------------------------------- | | This array of class aliases will be registered when this application @@ -137,6 +144,7 @@ 'aliases' => [ '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, @@ -152,6 +160,7 @@ '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, @@ -166,6 +175,7 @@ '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, diff --git a/config/filesystems.php b/config/filesystems.php index 491ae4a679..773e01d3fd 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -9,9 +9,9 @@ | Default Filesystem Disk |-------------------------------------------------------------------------- | - | Here you may specify the default filesystem disk that should be used. - | The "local" disk, as well as a variety of cloud-based disks are - | available to your application. Just store away! + | Here you may specify the default filesystem disk that should be used + | by the framework. The "local" disk, as well as a variety of cloud + | based disks are available to your application. Just store away! | */ @@ -39,7 +39,7 @@ | may even configure multiple disks of the same driver. Defaults have | been setup for each driver as an example of the required options. | - | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" + | Supported Drivers: "local", "ftp", "sftp", "s3" | */ diff --git a/config/logging.php b/config/logging.php index 4d80d5a007..18428d97a5 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,5 +1,6 @@ [ 'stack' => [ 'driver' => 'stack', - 'channels' => ['daily'], + 'channels' => ['single'], 'ignore_exceptions' => false, ], @@ -59,7 +60,7 @@ 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Sage Log', + 'username' => 'App Log', 'emoji' => ':boom:', 'level' => 'critical', ], @@ -92,5 +93,14 @@ 'driver' => 'errorlog', 'level' => 'debug', ], + + 'null' => [ + 'driver' => 'monolog', + 'handler' => NullHandler::class, + ], + + 'emergency' => [ + 'path' => storage_path('logs/sage.log'), + ], ], ]; diff --git a/config/view.php b/config/view.php index 52b725ec72..09f59b7a08 100755 --- a/config/view.php +++ b/config/view.php @@ -64,21 +64,6 @@ // 'MyPlugin' => WP_PLUGIN_DIR . '/my-plugin/resources/views', ], - /* - |-------------------------------------------------------------------------- - | View Composers - |-------------------------------------------------------------------------- - | - | View composers allow data to always be passed to certain views. This can - | be useful when passing data to components such as hero elements, - | navigation, banners, etc. - | - */ - - 'composers' => [ - // App\Composers\Alert::class, - ], - /* |-------------------------------------------------------------------------- | View Directives @@ -92,31 +77,4 @@ 'directives' => [ 'asset' => Roots\Acorn\Assets\AssetDirective::class, ], - - /* - |-------------------------------------------------------------------------- - | Blade Component Aliases - |-------------------------------------------------------------------------- - | - | Component aliases allow you to use a shorthand to call a Blade component. - | Instead of referencing your components like this: - | - | @component('components.alert', ['type' => 'warning']) - | {{ __('Page not found') }} - | @endcomponent - | - | You can use an alias instead: - | - | @alert(['type' => 'error']) - | {{ __('Page not found') }} - | @endalert - | - | Use the key to set the alias and the value to set the path to the - | view. - | - */ - - 'components' => [ - 'alert' => 'components.alert', - ], ]; diff --git a/functions.php b/functions.php index 94e0c82fe2..d3d5bd0aa6 100644 --- a/functions.php +++ b/functions.php @@ -1,67 +1,68 @@ roots.io/sage/docs/'; - $message = "
{$message}
{$footer}
"; - wp_die($message, $title); -}; - -/** - * Ensure a compatible version of PHP is being used. - */ -if (version_compare('7.2', phpversion(), '>')) { - $sage_error(__('You must be using PHP 7.2 or greater.', 'sage'), __('Invalid PHP version', 'sage')); +if (! file_exists($composer = __DIR__ . '/vendor/autoload.php')) { + wp_die(__('Error locating autoloader. Please runcomposer install
.', 'sage'));
}
-/**
- * Ensure a compatible version of WordPress is being used.
- */
-if (version_compare('5.2', get_bloginfo('version'), '>')) {
- $sage_error(__('You must be using WordPress 5.2 or greater.', 'sage'), __('Invalid WordPress version', 'sage'));
-}
+require $composer;
-/**
- * Ensure dependencies are loaded.
- */
-if (! file_exists($composer = __DIR__ . '/vendor/autoload.php')) {
- $sage_error(
- __('You must run composer install
from the Sage directory.', 'sage'),
- __('Autoloader not found.', 'sage')
- );
-}
-require_once $composer;
+/*
+|--------------------------------------------------------------------------
+| Register Sage Theme Files
+|--------------------------------------------------------------------------
+|
+| Out of the box, Sage ships with categorically named theme files
+| containing common functionality and setup to be bootstrapped with your
+| theme. Simply add (or remove) files from the array below to change what
+| is registered alongside Sage.
+|
+*/
-/**
- * Register any Sage theme files.
- *
- * The mapped array determines the code library included in your theme.
- * Add or remove files to the array as needed. Supports child theme overrides.
- */
-array_map(function ($file) use ($sage_error) {
- $file = "app/{$file}.php";
- if (! locate_template($file, true, true)) {
- $sage_error(
- sprintf(__('Error locating %s
for inclusion.', 'sage'), $file),
- __('File not found', 'sage')
- );
- }
-}, ['helpers', 'setup', 'filters', 'admin', 'demo']);
+collect(['helpers', 'setup', 'filters', 'admin', 'demo'])
+ ->each(function ($file) {
+ $file = "app/{$file}.php";
+
+ if (! locate_template($file, true, true)) {
+ wp_die(
+ sprintf(__('Error locating %s
for inclusion.', 'sage'), $file)
+ );
+ }
+ });
+
+/*
+|--------------------------------------------------------------------------
+| Enable Sage Theme Support
+|--------------------------------------------------------------------------
+|
+| Once our theme files are registered and available for use, we are almost
+| ready to boot our application. But first, we need to signal to Acorn
+| that we will need to initialize the necessary service providers built in
+| for Sage when booting.
+|
+*/
-/**
- * Boot Acorn with the Sage provider.
- * @link https://roots.io/acorn/
- */
add_theme_support('sage');
-Roots\bootloader();
+
+/*
+|--------------------------------------------------------------------------
+| Turn On The Lights
+|--------------------------------------------------------------------------
+|
+| We are ready to bootstrap the Acorn framework and get it ready for use.
+| Acorn will provide us support for Blade templating as well as the ability
+| to utilize the Laravel framework and its beautifully written packages.
+|
+*/
+
+new Roots\Acorn\Bootloader();
diff --git a/index.php b/index.php
index 234c9f8c28..922baccc34 100644
--- a/index.php
+++ b/index.php
@@ -1,10 +1,21 @@
-
+>
+
+
+
+
+
+
-/**
- * Loads the template hierarchy view file.
- */
+ >
+
+
-use function Roots\app;
-use function Roots\view;
+