Merge pull request #1765 from roots/blade

Blade
This commit is contained in:
Ben Word
2016-12-06 17:07:38 -07:00
committed by GitHub
51 changed files with 1086 additions and 522 deletions

View File

@@ -3,7 +3,6 @@ language: php
php: php:
- 7.0 - 7.0
- 5.6 - 5.6
- 5.5
- nightly - nightly
env: env:
@@ -33,7 +32,7 @@ before_install:
- composer self-update - composer self-update
install: install:
- source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION && nvm use $TRAVIS_NODE_VERSION - source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION && nvm use $TRAVIS_NODE_VERSION
- travis_retry npm install -g npm@latest - travis_retry npm install -g npm@latest
- travis_retry npm install -g eslint - travis_retry npm install -g eslint
- node -v && npm -v - node -v && npm -v

View File

@@ -1,4 +1,5 @@
### HEAD ### HEAD
* Add Blade ([#1765](https://github.com/roots/sage/pull/1765))
* Remove sidebar defaults ([#1760](https://github.com/roots/sage/pull/1760)) * Remove sidebar defaults ([#1760](https://github.com/roots/sage/pull/1760))
* Remove post formats ([#1759](https://github.com/roots/sage/pull/1759)) * Remove post formats ([#1759](https://github.com/roots/sage/pull/1759))

View File

@@ -14,7 +14,7 @@ Sage is a WordPress starter theme with a modern development workflow.
* [Webpack](https://webpack.github.io/) for compiling assets, optimizing images, and concatenating and minifying files * [Webpack](https://webpack.github.io/) for compiling assets, optimizing images, and concatenating and minifying files
* [BrowserSync](http://www.browsersync.io/) for synchronized browser testing * [BrowserSync](http://www.browsersync.io/) for synchronized browser testing
* [Bootstrap 4](http://getbootstrap.com/) for a front-end framework (can be removed or replaced) * [Bootstrap 4](http://getbootstrap.com/) for a front-end framework (can be removed or replaced)
* Template inheritance with the [theme wrapper](https://roots.io/sage/docs/theme-wrapper/) * [Laravel Blade](https://laravel.com/docs/5.3/blade) as a templating engine
See a working example at [roots-example-project.com](https://roots-example-project.com/). See a working example at [roots-example-project.com](https://roots-example-project.com/).
@@ -22,16 +22,16 @@ See a working example at [roots-example-project.com](https://roots-example-proje
Make sure all dependencies have been installed before moving on: Make sure all dependencies have been installed before moving on:
* [PHP](http://php.net/manual/en/install.php) >= 5.5.x * [PHP](http://php.net/manual/en/install.php) >= 5.6.4
* [Composer](https://getcomposer.org/download/) * [Composer](https://getcomposer.org/download/)
* [Node.js](http://nodejs.org/) >= 4.5 * [Node.js](http://nodejs.org/) >= 6.9.x
## Theme installation ## Theme installation
Install Sage using Composer from your WordPress themes directory (replace `your-theme-name` below with the name of your theme): Install Sage using Composer from your WordPress themes directory (replace `your-theme-name` below with the name of your theme):
```shell ```shell
# @ example.com/site/web/app/themes/ # @ app/themes/ or wp-content/themes/
$ composer create-project roots/sage your-theme-name dev-master $ composer create-project roots/sage your-theme-name dev-master
``` ```
@@ -55,7 +55,7 @@ themes/your-theme-name/ # → Root of your Sage based theme
├── package.json # → Node.js dependencies and scripts ├── package.json # → Node.js dependencies and scripts
├── screenshot.png # → Theme screenshot for WP admin ├── screenshot.png # → Theme screenshot for WP admin
├── src/ # → Theme PHP ├── src/ # → Theme PHP
│   ├── lib/Sage/ # → Theme wrapper, asset manifest │   ├── lib/Sage/ # → Blade implementation, asset manifest
│   ├── admin.php # → Theme customizer setup │   ├── admin.php # → Theme customizer setup
│   ├── filters.php # → Theme filters │   ├── filters.php # → Theme filters
│   ├── helpers.php # → Helper functions │   ├── helpers.php # → Helper functions
@@ -98,9 +98,9 @@ You now have all the necessary dependencies to run the build process.
* `npm run lint` — Run eslint against your assets and build scripts * `npm run lint` — Run eslint against your assets and build scripts
* `composer test` — Check your PHP for code smells with `phpmd` and PSR-2 compliance with `phpcs` * `composer test` — Check your PHP for code smells with `phpmd` and PSR-2 compliance with `phpcs`
### Using BrowserSync ### Using Browsersync
To use BrowserSync during `npm start` you need to update `devUrl` at the bottom of `assets/config.json` to reflect your local development hostname. To use Browsersync during `npm start` you need to update `devUrl` at the bottom of `assets/config.json` to reflect your local development hostname.
If your local development URL is `https://project-name.dev`, update the file to read: If your local development URL is `https://project-name.dev`, update the file to read:
```json ```json
@@ -117,9 +117,9 @@ If you are not using [Bedrock](https://roots.io/bedrock/), update `publicPath` t
... ...
``` ```
By default, BrowserSync will use webpack's [HMR](https://webpack.github.io/docs/hot-module-replacement.html), which won't trigger a page reload in your browser. By default, Browsersync will use webpack's [HMR](https://webpack.github.io/docs/hot-module-replacement.html), which won't trigger a page reload in your browser.
If you would like to force BrowserSync to reload the page whenever certain file types are edited, then add them to `watch` in `assets/config.json`. If you would like to force Browsersync to reload the page whenever certain file types are edited, then add them to `watch` in `assets/config.json`.
```json ```json
... ...

View File

@@ -29,8 +29,10 @@
} }
}, },
"require": { "require": {
"php": ">=5.5.0", "php": ">=5.6.4",
"composer/installers": "~1.0" "composer/installers": "~1.0",
"illuminate/view": "^5.3",
"jenssegers/blade": "dev-master#59ba2cc"
}, },
"require-dev": { "require-dev": {
"squizlabs/php_codesniffer": "^2.5.1", "squizlabs/php_codesniffer": "^2.5.1",

716
composer.lock generated
View File

@@ -4,21 +4,21 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "5f4d419852a5551e2b54ef851cab83b4", "hash": "91797de2d3afdfa1a932e8c0dfe808fe",
"content-hash": "1ee82adf8a4565a48214e5686e6b3293", "content-hash": "b772c090cb59fb89a2df691ecd1ffe98",
"packages": [ "packages": [
{ {
"name": "composer/installers", "name": "composer/installers",
"version": "v1.0.23", "version": "v1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/installers.git", "url": "https://github.com/composer/installers.git",
"reference": "6213d900e92647831f7a406d5c530ea1f3d4360e" "reference": "d78064c68299743e0161004f2de3a0204e33b804"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/6213d900e92647831f7a406d5c530ea1f3d4360e", "url": "https://api.github.com/repos/composer/installers/zipball/d78064c68299743e0161004f2de3a0204e33b804",
"reference": "6213d900e92647831f7a406d5c530ea1f3d4360e", "reference": "d78064c68299743e0161004f2de3a0204e33b804",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -40,8 +40,8 @@
} }
}, },
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"Composer\\Installers\\": "src/" "Composer\\Installers\\": "src/Composer/Installers"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@@ -56,28 +56,35 @@
} }
], ],
"description": "A multi-framework Composer library installer", "description": "A multi-framework Composer library installer",
"homepage": "http://composer.github.com/installers/", "homepage": "https://composer.github.io/installers/",
"keywords": [ "keywords": [
"Craft", "Craft",
"Dolibarr", "Dolibarr",
"Hurad", "Hurad",
"ImageCMS",
"MODX Evo", "MODX Evo",
"Mautic",
"OXID", "OXID",
"Plentymarkets",
"RadPHP",
"SMF", "SMF",
"Thelia", "Thelia",
"WolfCMS", "WolfCMS",
"agl", "agl",
"aimeos", "aimeos",
"annotatecms", "annotatecms",
"attogram",
"bitrix", "bitrix",
"cakephp", "cakephp",
"chef", "chef",
"cockpit",
"codeigniter", "codeigniter",
"concrete5", "concrete5",
"croogo", "croogo",
"dokuwiki", "dokuwiki",
"drupal", "drupal",
"elgg", "elgg",
"expressionengine",
"fuelphp", "fuelphp",
"grav", "grav",
"installer", "installer",
@@ -94,31 +101,634 @@
"piwik", "piwik",
"ppi", "ppi",
"puppet", "puppet",
"reindex",
"roundcube", "roundcube",
"shopware", "shopware",
"silverstripe", "silverstripe",
"symfony", "symfony",
"typo3", "typo3",
"wordpress", "wordpress",
"yawik",
"zend", "zend",
"zikula" "zikula"
], ],
"time": "2016-01-27 12:54:22" "time": "2016-08-13 20:53:52"
},
{
"name": "doctrine/inflector",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae",
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "4.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Inflector\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Common String Manipulations with regard to casing and singular/plural rules.",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"inflection",
"pluralize",
"singularize",
"string"
],
"time": "2015-11-06 14:35:42"
},
{
"name": "illuminate/container",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/container.git",
"reference": "8047b47e1f731c975d9aa0fe0b269064d3f1346d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/container/zipball/8047b47e1f731c975d9aa0fe0b269064d3f1346d",
"reference": "8047b47e1f731c975d9aa0fe0b269064d3f1346d",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.3.*",
"php": ">=5.6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Container\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Container package.",
"homepage": "https://laravel.com",
"time": "2016-10-02 01:14:30"
},
{
"name": "illuminate/contracts",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/contracts.git",
"reference": "ce5d73c6015b2054d32f3f8530767847b358ae4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/contracts/zipball/ce5d73c6015b2054d32f3f8530767847b358ae4e",
"reference": "ce5d73c6015b2054d32f3f8530767847b358ae4e",
"shasum": ""
},
"require": {
"php": ">=5.6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Contracts\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Contracts package.",
"homepage": "https://laravel.com",
"time": "2016-09-26 20:36:27"
},
{
"name": "illuminate/events",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/events.git",
"reference": "cb29124d4eaba8a60bad40e95e3d8b199d040d77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/events/zipball/cb29124d4eaba8a60bad40e95e3d8b199d040d77",
"reference": "cb29124d4eaba8a60bad40e95e3d8b199d040d77",
"shasum": ""
},
"require": {
"illuminate/container": "5.3.*",
"illuminate/contracts": "5.3.*",
"illuminate/support": "5.3.*",
"php": ">=5.6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Events\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Events package.",
"homepage": "https://laravel.com",
"time": "2016-08-12 14:24:30"
},
{
"name": "illuminate/filesystem",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/filesystem.git",
"reference": "82576e0a6193e76929c929c8a2d3e1552ab64e76"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/filesystem/zipball/82576e0a6193e76929c929c8a2d3e1552ab64e76",
"reference": "82576e0a6193e76929c929c8a2d3e1552ab64e76",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.3.*",
"illuminate/support": "5.3.*",
"php": ">=5.6.4",
"symfony/finder": "3.1.*"
},
"suggest": {
"league/flysystem": "Required to use the Flysystem local and FTP drivers (~1.0).",
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).",
"league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0)."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Filesystem\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Filesystem package.",
"homepage": "https://laravel.com",
"time": "2016-11-07 22:09:46"
},
{
"name": "illuminate/support",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/support.git",
"reference": "050d0ed3e1c0e1d129d73b2eaa14044e46a66f77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/support/zipball/050d0ed3e1c0e1d129d73b2eaa14044e46a66f77",
"reference": "050d0ed3e1c0e1d129d73b2eaa14044e46a66f77",
"shasum": ""
},
"require": {
"doctrine/inflector": "~1.0",
"ext-mbstring": "*",
"illuminate/contracts": "5.3.*",
"paragonie/random_compat": "~1.4|~2.0",
"php": ">=5.6.4"
},
"replace": {
"tightenco/collect": "self.version"
},
"suggest": {
"illuminate/filesystem": "Required to use the composer class (5.2.*).",
"symfony/process": "Required to use the composer class (3.1.*).",
"symfony/var-dumper": "Required to use the dd function (3.1.*)."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Support\\": ""
},
"files": [
"helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Support package.",
"homepage": "https://laravel.com",
"time": "2016-11-03 15:25:28"
},
{
"name": "illuminate/view",
"version": "v5.3.23",
"source": {
"type": "git",
"url": "https://github.com/illuminate/view.git",
"reference": "f840676c98e3cb1224267786f35eb420de55d41c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/view/zipball/f840676c98e3cb1224267786f35eb420de55d41c",
"reference": "f840676c98e3cb1224267786f35eb420de55d41c",
"shasum": ""
},
"require": {
"illuminate/container": "5.3.*",
"illuminate/contracts": "5.3.*",
"illuminate/events": "5.3.*",
"illuminate/filesystem": "5.3.*",
"illuminate/support": "5.3.*",
"php": ">=5.6.4",
"symfony/debug": "3.1.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\View\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate View package.",
"homepage": "https://laravel.com",
"time": "2016-10-24 18:18:15"
},
{
"name": "jenssegers/blade",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/jenssegers/blade.git",
"reference": "59ba2cc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jenssegers/blade/zipball/59ba2cc",
"reference": "59ba2cc",
"shasum": ""
},
"require": {
"illuminate/view": "^5.1"
},
"require-dev": {
"mockery/mockery": "^0.9",
"phpunit/phpunit": "^4.0|^5.0",
"satooshi/php-coveralls": "^1.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Jenssegers\\Blade\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jens Segers",
"homepage": "https://jenssegers.com"
}
],
"description": "The standalone version of Laravel's Blade templating engine for use outside of Laravel.",
"keywords": [
"blade",
"laravel",
"render",
"template",
"view"
],
"time": "2016-08-23 11:51:53"
},
{
"name": "paragonie/random_compat",
"version": "v2.0.4",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"type": "library",
"autoload": {
"files": [
"lib/random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"pseudorandom",
"random"
],
"time": "2016-11-07 23:38:38"
},
{
"name": "psr/log",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2016-10-10 12:19:37"
},
{
"name": "symfony/debug",
"version": "v3.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "c058661c32f5b462722e36d120905940089cbd9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/c058661c32f5b462722e36d120905940089cbd9a",
"reference": "c058661c32f5b462722e36d120905940089cbd9a",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"psr/log": "~1.0"
},
"conflict": {
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
},
"require-dev": {
"symfony/class-loader": "~2.8|~3.0",
"symfony/http-kernel": "~2.8|~3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Debug\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2016-11-15 12:55:20"
},
{
"name": "symfony/finder",
"version": "v3.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "9925935bf7144f9e4d2b976905881b4face036fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/9925935bf7144f9e4d2b976905881b4face036fb",
"reference": "9925935bf7144f9e4d2b976905881b4face036fb",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2016-11-03 08:04:31"
} }
], ],
"packages-dev": [ "packages-dev": [
{ {
"name": "pdepend/pdepend", "name": "pdepend/pdepend",
"version": "2.2.4", "version": "2.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pdepend/pdepend.git", "url": "https://github.com/pdepend/pdepend.git",
"reference": "b086687f3a01dc6bb92d633aef071d2c5dd0db06" "reference": "8d7ab8fe8c1f9de5056bb7ea2c0852f4ddd44f90"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pdepend/pdepend/zipball/b086687f3a01dc6bb92d633aef071d2c5dd0db06", "url": "https://api.github.com/repos/pdepend/pdepend/zipball/8d7ab8fe8c1f9de5056bb7ea2c0852f4ddd44f90",
"reference": "b086687f3a01dc6bb92d633aef071d2c5dd0db06", "reference": "8d7ab8fe8c1f9de5056bb7ea2c0852f4ddd44f90",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -145,25 +755,25 @@
"BSD-3-Clause" "BSD-3-Clause"
], ],
"description": "Official version of pdepend to be handled with Composer", "description": "Official version of pdepend to be handled with Composer",
"time": "2016-03-10 15:15:04" "time": "2016-11-23 20:25:02"
}, },
{ {
"name": "phpmd/phpmd", "name": "phpmd/phpmd",
"version": "2.4.2", "version": "2.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpmd/phpmd.git", "url": "https://github.com/phpmd/phpmd.git",
"reference": "fccbdb6b222f6d7a6d35af1c396ba5435cec76a9" "reference": "9298602a922cd8c46666df8d540a60bc5925ce55"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpmd/phpmd/zipball/fccbdb6b222f6d7a6d35af1c396ba5435cec76a9", "url": "https://api.github.com/repos/phpmd/phpmd/zipball/9298602a922cd8c46666df8d540a60bc5925ce55",
"reference": "fccbdb6b222f6d7a6d35af1c396ba5435cec76a9", "reference": "9298602a922cd8c46666df8d540a60bc5925ce55",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"pdepend/pdepend": "~2.0", "pdepend/pdepend": "^2.0.4",
"php": ">=5.3.0" "php": ">=5.3.9"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.0", "phpunit/phpunit": "^4.0",
@@ -210,23 +820,24 @@
"phpmd", "phpmd",
"pmd" "pmd"
], ],
"time": "2016-03-10 17:17:44" "time": "2016-11-23 20:33:32"
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "2.5.1", "version": "2.7.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "6731851d6aaf1d0d6c58feff1065227b7fda3ba8" "reference": "9b324f3a1132459a7274a0ace2e1b766ba80930f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6731851d6aaf1d0d6c58feff1065227b7fda3ba8", "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9b324f3a1132459a7274a0ace2e1b766ba80930f",
"reference": "6731851d6aaf1d0d6c58feff1065227b7fda3ba8", "reference": "9b324f3a1132459a7274a0ace2e1b766ba80930f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-simplexml": "*",
"ext-tokenizer": "*", "ext-tokenizer": "*",
"ext-xmlwriter": "*", "ext-xmlwriter": "*",
"php": ">=5.1.2" "php": ">=5.1.2"
@@ -287,33 +898,36 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"time": "2016-01-19 23:39:10" "time": "2016-11-30 04:02:31"
}, },
{ {
"name": "symfony/config", "name": "symfony/config",
"version": "v3.0.4", "version": "v3.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/config.git", "url": "https://github.com/symfony/config.git",
"reference": "980ee40c28f00acff8906c11b778aab5f0db74c2" "reference": "4a68f8953180bf77ea65f585020f4db0b18600b4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/980ee40c28f00acff8906c11b778aab5f0db74c2", "url": "https://api.github.com/repos/symfony/config/zipball/4a68f8953180bf77ea65f585020f4db0b18600b4",
"reference": "980ee40c28f00acff8906c11b778aab5f0db74c2", "reference": "4a68f8953180bf77ea65f585020f4db0b18600b4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.5.9", "php": ">=5.5.9",
"symfony/filesystem": "~2.8|~3.0" "symfony/filesystem": "~2.8|~3.0"
}, },
"require-dev": {
"symfony/yaml": "~3.0"
},
"suggest": { "suggest": {
"symfony/yaml": "To use the yaml reference dumper" "symfony/yaml": "To use the yaml reference dumper"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.0-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@@ -340,39 +954,43 @@
], ],
"description": "Symfony Config Component", "description": "Symfony Config Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-03-04 07:55:57" "time": "2016-11-29 11:12:32"
}, },
{ {
"name": "symfony/dependency-injection", "name": "symfony/dependency-injection",
"version": "v3.0.4", "version": "v3.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/dependency-injection.git", "url": "https://github.com/symfony/dependency-injection.git",
"reference": "6a9058101b591edced21ca3c83c80a3978f5c6b0" "reference": "f5419adad083c90e0dfd8588ef83683d7dbcc20d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6a9058101b591edced21ca3c83c80a3978f5c6b0", "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f5419adad083c90e0dfd8588ef83683d7dbcc20d",
"reference": "6a9058101b591edced21ca3c83c80a3978f5c6b0", "reference": "f5419adad083c90e0dfd8588ef83683d7dbcc20d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.5.9" "php": ">=5.5.9"
}, },
"conflict": {
"symfony/yaml": "<3.2"
},
"require-dev": { "require-dev": {
"symfony/config": "~2.8|~3.0", "symfony/config": "~2.8|~3.0",
"symfony/expression-language": "~2.8|~3.0", "symfony/expression-language": "~2.8|~3.0",
"symfony/yaml": "~2.8|~3.0" "symfony/yaml": "~3.2"
}, },
"suggest": { "suggest": {
"symfony/config": "", "symfony/config": "",
"symfony/expression-language": "For using expressions in service container configuration",
"symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them",
"symfony/yaml": "" "symfony/yaml": ""
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.0-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@@ -399,20 +1017,20 @@
], ],
"description": "Symfony DependencyInjection Component", "description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-03-30 10:41:14" "time": "2016-11-25 12:32:42"
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v3.0.4", "version": "v3.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "f82499a459dcade2ea56df94cc58b19c8bde3d20" "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/f82499a459dcade2ea56df94cc58b19c8bde3d20", "url": "https://api.github.com/repos/symfony/filesystem/zipball/8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4",
"reference": "f82499a459dcade2ea56df94cc58b19c8bde3d20", "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -421,7 +1039,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.0-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@@ -448,16 +1066,18 @@
], ],
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-03-27 10:24:39" "time": "2016-11-24 00:46:43"
} }
], ],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {
"jenssegers/blade": 20
},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": ">=5.5.0" "php": ">=5.6.4"
}, },
"platform-dev": [] "platform-dev": []
} }

View File

@@ -1,3 +1,3 @@
<?php <?php
include __DIR__ . '/templates/index.php'; // this file is deliberately blank

View File

@@ -2,9 +2,6 @@
namespace App; namespace App;
use Roots\Sage\Template;
use Roots\Sage\Template\Wrapper;
/** /**
* Add <body> classes * Add <body> classes
*/ */
@@ -32,11 +29,28 @@ add_filter('excerpt_more', function () {
}); });
/** /**
* Use theme wrapper * Template Hierarchy should search for .blade.php files
*/ */
add_filter('template_include', function ($main) { array_map(function ($tag) {
if (!is_string($main) && !(is_object($main) && method_exists($main, '__toString'))) { add_filter("{$tag}_template_hierarchy", function ($templates) {
return $main; return array_merge(str_replace('.php', '.blade.php', $templates), $templates);
} });
return ((new Template(new Wrapper($main)))->layout()); }, [
}, 109); 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date', 'home',
'front_page', 'page', 'paged', 'search', 'single', 'singular', 'attachment'
]);
/**
* Render page using Blade
*/
add_filter('template_include', function ($template) {
echo template($template);
// Return a blank file to make WordPress happy
return get_template_directory() . '/index.php';
}, 1000);
/**
* Tell WordPress how to find the compiled path of comments.blade.php
*/
add_filter('comments_template', 'App\\template_path');

View File

@@ -2,30 +2,50 @@
namespace App; namespace App;
use Roots\Sage\Asset; use Roots\Sage\Container;
use Roots\Sage\Assets\JsonManifest;
use Roots\Sage\Template;
function template($layout = 'base') /**
* @param string $name
* @return Container|mixed
*/
function sage($name = '')
{ {
return Template::$instances[$layout]; static $container;
} if (!$container) {
$container = new Container;
function template_part($template, array $context = [], $layout = 'base') }
{ return $name ? (isset($container[$name]) ? $container[$name] : $container["sage.{$name}"]) : $container;
extract($context);
include template($layout)->partial($template);
} }
/** /**
* @param $filename *
* @param string $file
* @param array $data
* @return string * @return string
*/ */
function asset_path($filename) function template($file, $data = [])
{ {
static $manifest; return sage('blade')->render($file, $data);
isset($manifest) || $manifest = new JsonManifest(get_stylesheet_directory() . '/' . Asset::$dist . '/assets.json'); }
return (string) new Asset($filename, $manifest);
/**
* Retrieve path to a compiled blade view
* @param $file
* @param array $data
* @return string
*/
function template_path($file, $data = [])
{
return sage('blade')->compiledPath($file, $data);
}
/**
* @param $asset
* @return string
*/
function asset_path($asset)
{
return sage('assets')->getUri($asset);
} }
/** /**

View File

@@ -1,39 +0,0 @@
<?php
namespace Roots\Sage;
use Roots\Sage\Assets\ManifestInterface;
/**
* Class Template
* @package Roots\Sage
* @author QWp6t
*/
class Asset
{
public static $dist = '/dist';
/** @var ManifestInterface Currently used manifest */
protected $manifest;
protected $asset;
protected $dir;
public function __construct($file, ManifestInterface $manifest = null)
{
$this->manifest = $manifest;
$this->asset = $file;
}
public function __toString()
{
return $this->getUri();
}
public function getUri()
{
$file = ($this->manifest ? $this->manifest->get($this->asset) : $this->asset);
return get_template_directory_uri() . self::$dist . "/$file";
}
}

View File

@@ -10,26 +10,32 @@ namespace Roots\Sage\Assets;
class JsonManifest implements ManifestInterface class JsonManifest implements ManifestInterface
{ {
/** @var array */ /** @var array */
protected $manifest = []; public $manifest;
/** @var string */
public $dist;
/** /**
* JsonManifest constructor * JsonManifest constructor
*
* @param string $manifestPath Local filesystem path to JSON-encoded manifest * @param string $manifestPath Local filesystem path to JSON-encoded manifest
* @param string $distUri Remote URI to assets root
*/ */
public function __construct($manifestPath) public function __construct($manifestPath, $distUri)
{ {
$this->manifest = file_exists($manifestPath) ? json_decode(file_get_contents($manifestPath), true) : []; $this->manifest = file_exists($manifestPath) ? json_decode(file_get_contents($manifestPath), true) : [];
$this->dist = $distUri;
} }
/** @inheritdoc */ /** @inheritdoc */
public function get($file) public function get($asset)
{ {
return isset($this->manifest[$file]) ? $this->manifest[$file] : $file; return isset($this->manifest[$asset]) ? $this->manifest[$asset] : $asset;
} }
/** @inheritdoc */ /** @inheritdoc */
public function getAll() public function getUri($asset)
{ {
return $this->manifest; return "{$this->dist}/{$this->get($asset)}";
} }
} }

View File

@@ -12,17 +12,20 @@ interface ManifestInterface
/** /**
* Get the cache-busted filename * Get the cache-busted filename
* *
* If the manifest does not have an entry for $file, then return $file * If the manifest does not have an entry for $asset, then return $asset
* *
* @param string $file The original name of the file before cache-busting * @param string $asset The original name of the file before cache-busting
* @return string * @return string
*/ */
public function get($file); public function get($asset);
/** /**
* Get the asset manifest * Get the cache-busted URI
* *
* @return array * If the manifest does not have an entry for $asset, then return URI for $asset
*
* @param string $asset The original name of the file before cache-busting
* @return string
*/ */
public function getAll(); public function getUri($asset);
} }

View File

@@ -0,0 +1,10 @@
<?php
namespace Roots\Sage;
use Illuminate\Container\Container as BaseContainer;
class Container extends BaseContainer
{
}

View File

@@ -1,46 +0,0 @@
<?php
namespace Roots\Sage;
use Roots\Sage\Template\Partial;
use Roots\Sage\Template\WrapperInterface;
class Template
{
/** @var Template[] */
public static $instances = [];
/** @var WrapperInterface */
protected $wrapper;
public function __construct(WrapperInterface $wrapper)
{
$this->wrapper = $wrapper;
self::$instances[$wrapper->slug()] = $this;
}
/**
* @return string Layout (FQPN of, e.g., `base-page.php`, `base.php`)
*/
public function layout()
{
return $this->wrapper->wrap();
}
/**
* @return string Main template (FQPN of, e.g., `page.php`, `single.php`, `singular.php`)
*/
public function main()
{
return $this->wrapper->unwrap();
}
/**
* @param string $template Delimited template path
* @return string Partial template (FQPN of, e.g., `content.php`, `page-header.php`
*/
public function partial($template)
{
return (new Partial($template, $this->main()))->path();
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace Roots\Sage\Template;
use Jenssegers\Blade\Blade;
use Illuminate\View\Engines\CompilerEngine;
class BladeProvider extends Blade
{
/** @var Blade */
public $blade;
/** @var string */
protected $cachePath;
/**
* @param string $view
* @param array $data
* @param array $mergeData
* @return \Illuminate\View\View
*/
public function make($view, $data = [], $mergeData = [])
{
return $this->container['view']->make($this->normalizeViewPath($view), $data, $mergeData);
}
/**
* @param string $view
* @param array $data
* @param array $mergeData
* @return string
*/
public function render($view, $data = [], $mergeData = [])
{
return $this->make($view, $data, $mergeData)->render();
}
/**
* @param string $file
* @param array $data
* @param array $mergeData
* @return string
*/
public function compiledPath($file, $data = [], $mergeData = [])
{
$rendered = $this->make($file, $data, $mergeData);
$engine = $rendered->getEngine();
if (!($engine instanceof CompilerEngine)) {
// Using PhpEngine, so just return the file
return $file;
}
$compiler = $engine->getCompiler();
$compiledPath = $compiler->getCompiledPath($rendered->getPath());
if ($compiler->isExpired($compiledPath)) {
$compiler->compile($file);
}
return $compiledPath;
}
/**
* @param string $file
* @return string
*/
public function normalizeViewPath($file)
{
// Convert `\` to `/`
$view = str_replace('\\', '/', $file);
// Remove unnecessary parts of the path
$view = str_replace(array_merge((array) $this->viewPaths, ['.blade.php', '.php']), '', $view);
// Remove leading slashes
$view = ltrim($view, '/');
// Convert `/` to `.`
return str_replace('/', '.', $view);
}
}

View File

@@ -1,72 +0,0 @@
<?php
namespace Roots\Sage\Template;
class Partial
{
protected static $cache = [];
public $main;
public $template;
public $delimiter = '-';
public function __construct($template, $main = '')
{
$this->template = $template;
$this->main = $main;
}
public function __toString()
{
return (string) $this->path();
}
/**
* Converts template into array of parts to be passed to locate_template()
*
* Here's an example of what happens:
* (new Template('partials/content-single-audio'))->parts();
* // => ['partials/content-single-audio.php', 'partials/content-single.php', 'partials/content.php']
* @return array Array of parts to pass to locate_template()
*/
public function parts()
{
if ($parts = $this->cache('parts')) {
return $parts;
}
$parts = explode($this->delimiter, str_replace('.php', '', $this->template));
$templates[] = array_shift($parts);
foreach ($parts as $i => $part) {
$templates[] = $templates[$i] . $this->delimiter . $part;
}
if ($this->main) {
$templates = array_merge($templates, array_map(function ($template) {
return $template . $this->delimiter . basename($this->main, '.php');
}, $templates));
}
$templates = array_map(function ($template) {
return $template . '.php';
}, $templates);
return $this->cache('parts', array_reverse($templates));
}
/**
* Passes $this->parts() to locate_template() to retrieve template location
* @return string Location of template
*/
public function path()
{
if (!$path = $this->cache('path')) {
$path = $this->cache('path', locate_template($this->parts()));
}
return apply_filters('sage/partial_' . basename($path, '.php'), $path, $this->parts()) ?: $path;
}
protected function cache($key, $value = null)
{
if ($value !== null) {
self::$cache[$this->template][$key] = $value;
}
return isset(self::$cache[$this->template][$key]) ? self::$cache[$this->template][$key] : null;
}
}

View File

@@ -1,64 +0,0 @@
<?php
namespace Roots\Sage\Template;
/**
* Class Wrapper
* @package Roots\Sage
* @author QWp6t
*/
class Wrapper implements WrapperInterface
{
/** @var string Wrapper slug */
protected $slug;
/** @var string Template file that is being wrapped */
protected $template = '';
/** @var string[] Array of template wrappers; e.g., `base-singular.php`, `base-page.php`, `base.php` */
protected $wrapper = [];
/**
* Wrapper constructor
*
* @param string $template Template file, as from Template Hierarchy; e.g., `page.php`, `single.php`, `singular.php`
* @param string $base Wrapper's base template, this is what will wrap around $template
*/
public function __construct($template, $base = 'layouts/base.php')
{
$this->slug = sanitize_title(basename($base, '.php'));
$this->wrapper = [$base];
$this->template = $template;
$str = substr($base, 0, -4);
array_unshift($this->wrapper, sprintf($str . '-%s.php', basename($template, '.php')));
}
/**
* @return string
* @see getTemplate
*/
public function __toString()
{
return $this->unwrap();
}
/** {@inheritdoc} */
public function wrap()
{
$wrappers = apply_filters('sage/wrap_' . $this->slug, $this->wrapper) ?: $this->wrapper;
return locate_template($wrappers);
}
/** {@inheritdoc} */
public function slug()
{
return $this->slug;
}
/** {@inheritdoc} */
public function unwrap()
{
$template = apply_filters('sage/unwrap_' . $this->slug, $this->template) ?: $this->template;
return locate_template($template) ?: $template;
}
}

View File

@@ -1,29 +0,0 @@
<?php
namespace Roots\Sage\Template;
/**
* Interface WrapperInterface
* @package Roots\Sage
* @author QWp6t
*/
interface WrapperInterface
{
/**
* Get wrapper template file
*
* @return string Wrapper template (FQPN of, e.g., `base-page.php`, `base.php`)
*/
public function wrap();
/**
* @return string Wrapped template (FQPN of, e.g., `page.php`, `single.php`, `singular.php`)
*/
public function unwrap();
/**
* @return string Slug of the WrapperInterface; e.g., `base`
*/
public function slug();
}

View File

@@ -2,7 +2,36 @@
namespace App; namespace App;
use Roots\Sage\Template; use Roots\Sage\Assets\JsonManifest;
use Roots\Sage\Template\BladeProvider;
/**
* Add JsonManifest to Sage container
*/
sage()->singleton('sage.assets', function () {
return new JsonManifest(
get_stylesheet_directory().'/dist/assets.json',
get_stylesheet_directory_uri().'/dist'
);
});
/**
* Add Blade to Sage container
*/
sage()->singleton('sage.blade', function () {
$cachePath = wp_upload_dir()['basedir'].'/cache/compiled';
if (!file_exists($cachePath)) {
wp_mkdir_p($cachePath);
}
return new BladeProvider(TEMPLATEPATH, $cachePath, sage());
});
/**
* Create @asset() Blade directive
*/
sage('blade')->compiler()->directive('asset', function ($asset) {
return '<?= App\\asset_path(\''.trim($asset, '\'"').'\'); ?>';
});
/** /**
* Theme assets * Theme assets

14
templates/404.blade.php Normal file
View File

@@ -0,0 +1,14 @@
@extends('layouts.base')
@section('content')
@include('partials.page-header')
@if (!have_posts())
<div class="alert alert-warning">
{{ __('Sorry, but the page you were trying to view does not exist.', 'sage') }}
</div>
{!! get_search_form(false) !!}
@endif
{!! get_the_posts_navigation() !!}
@endsection

View File

@@ -1,7 +0,0 @@
<?php get_template_part('partials/page-header'); ?>
<div class="alert alert-warning">
<?php _e('Sorry, but the page you were trying to view does not exist.', 'sage'); ?>
</div>
<?php get_search_form(); ?>

18
templates/index.blade.php Normal file
View File

@@ -0,0 +1,18 @@
@extends('layouts.base')
@section('content')
@include('partials.page-header')
@if (!have_posts())
<div class="alert alert-warning">
{{ __('Sorry, no results were found.', 'sage') }}
</div>
{!! get_search_form(false) !!}
@endif
@while (have_posts()) @php the_post() @endphp
@include ('partials.content')
@endwhile
{!! get_the_posts_navigation() !!}
@endsection

View File

@@ -1,14 +0,0 @@
<?php get_template_part('partials/page-header'); ?>
<?php if (!have_posts()) : ?>
<div class="alert alert-warning">
<?php _e('Sorry, no results were found.', 'sage'); ?>
</div>
<?php get_search_form(); ?>
<?php endif; ?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/content', get_post_type() != 'post' ? get_post_type() : get_post_format()); ?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>

View File

@@ -0,0 +1,28 @@
<!doctype html>
<html @php language_attributes() @endphp>
@include('partials.head')
<body @php body_class() @endphp>
<!--[if IE]>
<div class="alert alert-warning">
{!! __('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'sage') !!}
</div>
<![endif]-->
@php do_action('get_header') @endphp
@include('partials.header')
<div class="wrap container" role="document">
<div class="content row">
<main class="main">
@yield('content')
</main>
@if (App\display_sidebar())
<aside class="sidebar">
@include('partials.sidebar')
</aside>
@endif
</div>
</div>
@php do_action('get_footer') @endphp
@include('partials.footer')
@php wp_footer() @endphp
</body>
</html>

View File

@@ -1,32 +0,0 @@
<!doctype html>
<html <?php language_attributes(); ?>>
<?php get_template_part('partials/head'); ?>
<body <?php body_class(); ?>>
<!--[if IE]>
<div class="alert alert-warning">
<?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'sage'); ?>
</div>
<![endif]-->
<?php
do_action('get_header');
get_template_part('partials/header');
?>
<div class="wrap container" role="document">
<div class="content row">
<main class="main">
<?php include App\template()->main(); ?>
</main>
<?php if (App\display_sidebar()) : ?>
<aside class="sidebar">
<?php App\template_part('partials/sidebar'); ?>
</aside>
<?php endif; ?>
</div>
</div>
<?php
do_action('get_footer');
get_template_part('partials/footer');
wp_footer();
?>
</body>
</html>

8
templates/page.blade.php Normal file
View File

@@ -0,0 +1,8 @@
@extends('layouts.base')
@section('content')
@while(have_posts()) @php the_post() @endphp
@include('partials.page-header')
@include('partials.content-page')
@endwhile
@endsection

View File

@@ -1,4 +0,0 @@
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/page-header'); ?>
<?php get_template_part('partials/content-page'); ?>
<?php endwhile; ?>

View File

@@ -0,0 +1,38 @@
@php
if (post_password_required()) {
return;
}
@endphp
<section id="comments" class="comments">
@if (have_comments())
<h2>
{!! sprintf(_nx('One response to &ldquo;%2$s&rdquo;', '%1$s responses to &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'sage'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>') !!}
</h2>
<ol class="comment-list">
{!! wp_list_comments(['style' => 'ol', 'short_ping' => true]) !!}
</ol>
@if (get_comment_pages_count() > 1 && get_option('page_comments'))
<nav>
<ul class="pager">
@if (get_previous_comments_link())
<li class="previous">{!! previous_comments_link(__('&larr; Older comments', 'sage')) !!}</li>
@endif
@if (get_next_comments_link())
<li class="next">{!! next_comments_link(__('Newer comments &rarr;', 'sage')) !!}</li>
@endif
</ul>
</nav>
@endif
@endif
@if (!comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments'))
<div class="alert alert-warning">
{{ __('Comments are closed.', 'sage') }}
</div>
@endif
@php comment_form() @endphp
</section>

View File

@@ -1,36 +0,0 @@
<?php
if (post_password_required()) {
return;
}
?>
<section id="comments" class="comments">
<?php if (have_comments()) : ?>
<h2><?php printf(_nx('One response to &ldquo;%2$s&rdquo;', '%1$s responses to &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'sage'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>'); ?></h2>
<ol class="comment-list">
<?php wp_list_comments(['style' => 'ol', 'short_ping' => true]); ?>
</ol>
<?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
<nav>
<ul class="pager">
<?php if (get_previous_comments_link()) : ?>
<li class="previous"><?php previous_comments_link(__('&larr; Older comments', 'sage')); ?></li>
<?php endif; ?>
<?php if (get_next_comments_link()) : ?>
<li class="next"><?php next_comments_link(__('Newer comments &rarr;', 'sage')); ?></li>
<?php endif; ?>
</ul>
</nav>
<?php endif; ?>
<?php endif; // have_comments() ?>
<?php if (!comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments')) : ?>
<div class="alert alert-warning">
<?php _e('Comments are closed.', 'sage'); ?>
</div>
<?php endif; ?>
<?php comment_form(); ?>
</section>

View File

@@ -0,0 +1,2 @@
@php the_content() @endphp
{!! wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}

View File

@@ -1,2 +0,0 @@
<?php the_content(); ?>
<?php wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']); ?>

View File

@@ -0,0 +1,11 @@
<article @php post_class() @endphp>
<header>
<h2 class="entry-title"><a href="{{ get_permalink() }}">{{ get_the_title() }}</a></h2>
@if (get_post_type() === 'post')
@include('partials/entry-meta')
@endif
</header>
<div class="entry-summary">
@php the_excerpt() @endphp
</div>
</article>

View File

@@ -1,9 +0,0 @@
<article <?php post_class(); ?>>
<header>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php if (get_post_type() === 'post') { get_template_part('partials/entry-meta'); } ?>
</header>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div>
</article>

View File

@@ -0,0 +1,13 @@
<article @php post_class() @endphp>
<header>
<h1 class="entry-title">{{ get_the_title() }}</h1>
@include('partials/entry-meta')
</header>
<div class="entry-content">
@php the_content() @endphp
</div>
<footer>
{!! wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}
</footer>
@php comments_template('/templates/partials/comments.blade.php') @endphp
</article>

View File

@@ -1,13 +0,0 @@
<article <?php post_class(); ?>>
<header>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php get_template_part('partials/entry-meta'); ?>
</header>
<div class="entry-content">
<?php the_content(); ?>
</div>
<footer>
<?php wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']); ?>
</footer>
<?php comments_template('/templates/partials/comments.php'); ?>
</article>

View File

@@ -0,0 +1,9 @@
<article @php post_class() @endphp>
<header>
<h2 class="entry-title"><a href="{{ get_permalink() }}">{{ get_the_title() }}</a></h2>
@include('partials/entry-meta')
</header>
<div class="entry-summary">
@php the_excerpt() @endphp
</div>
</article>

View File

@@ -1,9 +0,0 @@
<article <?php post_class(); ?>>
<header>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php get_template_part('partials/entry-meta'); ?>
</header>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div>
</article>

View File

@@ -0,0 +1,6 @@
<time class="updated" datetime="{{ get_post_time('c', true) }}">{{ get_the_date() }}</time>
<p class="byline author vcard">
{{ __('By', 'sage') }} <a href="{{ get_author_posts_url(get_the_author_meta('ID')) }}" rel="author" class="fn">
{{ get_the_author() }}
</a>
</p>

View File

@@ -1,2 +0,0 @@
<time class="updated" datetime="<?= get_post_time('c', true); ?>"><?= get_the_date(); ?></time>
<p class="byline author vcard"><?= __('By', 'sage'); ?> <a href="<?= get_author_posts_url(get_the_author_meta('ID')); ?>" rel="author" class="fn"><?= get_the_author(); ?></a></p>

View File

@@ -1,5 +1,5 @@
<footer class="content-info"> <footer class="content-info">
<div class="container"> <div class="container">
<?php dynamic_sidebar('sidebar-footer'); ?> @php dynamic_sidebar('sidebar-footer') @endphp
</div> </div>
</footer> </footer>

View File

@@ -2,5 +2,5 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge"> <meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php wp_head(); ?> @php wp_head() @endphp
</head> </head>

View File

@@ -0,0 +1,10 @@
<header class="banner">
<div class="container">
<a class="brand" href="{{ home_url('/') }}">{{ get_bloginfo('name', 'display') }}</a>
<nav class="nav-primary">
@if (has_nav_menu('primary_navigation'))
{!! wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav']) !!}
@endif
</nav>
</div>
</header>

View File

@@ -1,12 +0,0 @@
<header class="banner">
<div class="container">
<a class="brand" href="<?= esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
<nav class="nav-primary">
<?php
if (has_nav_menu('primary_navigation')) :
wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav']);
endif;
?>
</nav>
</div>
</header>

View File

@@ -1,3 +1,3 @@
<div class="page-header"> <div class="page-header">
<h1><?= App\title(); ?></h1> <h1>{!! App\title() !!}</h1>
</div> </div>

View File

@@ -0,0 +1 @@
@php dynamic_sidebar('sidebar-primary') @endphp

View File

@@ -1 +0,0 @@
<?php dynamic_sidebar('sidebar-primary'); ?>

View File

@@ -0,0 +1,18 @@
@extends('layouts.base')
@section('content')
@include('partials.page-header')
@if (!have_posts())
<div class="alert alert-warning">
{{ __('Sorry, no results were found.', 'sage') }}
</div>
{!! get_search_form(false) !!}
@endif
@while(have_posts()) @php the_post() @endphp
@include('partials.content-search')
@endwhile
{!! get_the_posts_navigation() !!}
@endsection

View File

@@ -1,14 +0,0 @@
<?php get_template_part('partials/page-header'); ?>
<?php if (!have_posts()) : ?>
<div class="alert alert-warning">
<?php _e('Sorry, no results were found.', 'sage'); ?>
</div>
<?php get_search_form(); ?>
<?php endif; ?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/content-search'); ?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>

View File

@@ -0,0 +1,8 @@
@extends('layouts.base')
@section('content')
@while(have_posts()) @php the_post() @endphp
@include('partials/content-single')
@endwhile
@endsection

View File

@@ -1,3 +0,0 @@
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/content-single', get_post_type()); ?>
<?php endwhile; ?>

View File

@@ -0,0 +1,14 @@
@php
/**
* Template Name: Custom Template
*/
@endphp
@extends('layouts.base')
@section('content')
@while(have_posts()) @php the_post() @endphp
@include('partials.page-header')
@include('partials.content-page')
@endwhile
@endsection

View File

@@ -1,10 +0,0 @@
<?php
/**
* Template Name: Custom Template
*/
?>
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('partials/page-header'); ?>
<?php get_template_part('partials/content-page'); ?>
<?php endwhile; ?>