mirror of
https://github.com/getgrav/grav.git
synced 2026-02-25 16:11:33 +01:00
merged
This commit is contained in:
47
CHANGELOG.md
47
CHANGELOG.md
@@ -1,9 +1,52 @@
|
||||
# v1.1.0
|
||||
## XX/XX/2016
|
||||
|
||||
1. [](#new)
|
||||
* **Blueprint Improvements**: The main improvements to Grav take the form of a major rewrite of our blueprint functionality. Blueprints are an essential piece of functionality within Grav that helps define configuration fields. These allow us to create a definition of a form field that can be rendered in the administrator plugin and allow the input, validation, and storage of values into the various configuration and page files that power Grav. Grav 1.0 had extensive support for building and extending blueprints, but Grav 1.1 takes this even further and adds improvements to our existing system.
|
||||
* **Extending Blueprints**: You could extend forms in Grav 1.0, but now you can use a newer `extends@:` default syntax rather than the previous `'@extends'` string that needed to be quoted in YAML. Also this new format allows for the defining of a `context` which lets you define where to look for the base blueprint. Another new feature is the ability to extend from multiple blueprints.
|
||||
* **Embedding/Importing Blueprints**: One feature that has been requested is the ability to embed or import one blueprint into another blueprint. This allows you to share fields or sub-form between multiple forms. This is accomplished via the `import@` syntax.
|
||||
* **Removing Existing Fields and Properties**: Another new feature is the ability to remove completely existing fields or properties from an extended blueprint. This allows the user a lot more flexibility when creating custom forms by simply using the new `unset@: true` syntax. To remove a field property you would use `unset-<property>@: true` in your extended field definition, for example: `unset-options@: true`.
|
||||
* **Replacing Existing Fields and Properties**: Similar to removing, you can now replace an existing field or property with the `replace@: true` syntax for the whole field, and `replace-<property>@: true` for a specific property.
|
||||
* **Field Ordering**: Probably the most frequently requested blueprint functionality that we have added is the ability to change field ordering. Imagine that you want to extend the default page blueprint but add a new tab. Previously, this meant your tab would be added at the end of the form, but now you can define that you wish the new tab to be added right after the `content` tab. This works for any field too, so you can extend a blueprint and add your own custom fields anywhere you wish! This is accomplished by using the new `ordering@:` syntax with either an existing property name or an integer.
|
||||
* **Configuration Properties**: Another useful new feature is the ability to directly access Grav configuration in blueprints with `config-<property>@` syntax. For example you can set a default for a field via `config-default@: site.author.name` which will use the author.name value from the `site.yaml` file as the `default` value for this field.
|
||||
* **Function Calls**: The ability to call PHP functions for values has been improved in Grav 1.1 to be more powerful. You can use the `data-<property>@` syntax to call static methods to obtain values. For example: `data-default@: '\Grav\Plugin\Admin::route'`. You can now even pass parameters to these methods.
|
||||
* **Validation Rules**: You can now define a custom blueprint-level validation rule and assign this rule to a form field.
|
||||
* **Custom Form Field Types**: This advanced new functionality allows you to create a custom field type via a new plugin event called getFormFieldTypes(). This allows you to provide extra functionality or instructions on how to handle the form form field.
|
||||
* **GPM Versioning**: A new feature that we have wanted to add to our GPM package management system is the ability to control dependencies by version. We have opted to use a syntax very similar to the Composer Package Manager that is already familiar to most PHP developers. This new versioning system allows you to define specific minimum version requirements of dependent packages within Grav. This should ensure that we have less (hopefully none!) issues when you update one package that also requires a specific minimum version of another package. The admin plugin for example may have an update that requires a specific version of Grav itself.
|
||||
* Added the ability to provide blueprints via a plugin (previously limited to Themes only).
|
||||
* Added Developer CLI Tools to easily create a new theme or plugin
|
||||
* Allow authentication for proxies - [#698](https://github.com/getgrav/grav/pull/698)
|
||||
* Allow to override the default Parsedown behavior - [#747](https://github.com/getgrav/grav/pull/747)
|
||||
* Added an option to allow to exclude external files from the pipeline, and to render the pipeline before/after excluded files
|
||||
* Added the possibility to store translations of themes in separate files inside the `languages` folder
|
||||
* Added a method to the Uri class to return the base relative URL including the language prefix, or the base relative url if multilanguage is not enabled
|
||||
* Added a shortcut for pages.find() alias
|
||||
1. [](#improved)
|
||||
* Now supporting hostnames with localhost environments for better vhost support/development
|
||||
* Refactor hard-coded paths to use PHP Streams that allow a setup file to configure where certain parts of Grav are stored in the physical filesystem.
|
||||
* If multilanguage is active, include the Intl Twig Extension to allow translating dates automatically (http://twig.sensiolabs.org/doc/extensions/intl.html)
|
||||
* Allow having local themes with the same name as GPM themes, by adding `gpm: false` to the theme blueprint - [#767](https://github.com/getgrav/grav/pull/767)
|
||||
* Caddyfile and Lighttpd config files updated
|
||||
* Removed `node_modules` folder from backups to make them faster
|
||||
* Display error when `bin/grav install` hasn't been run instead of throwing exception. Prevents "white page" errors if error display is off
|
||||
* Improved command line flow when installing multiple packages: don't reinstall packages if already installed, ask once if should use symlinks if symlinks are found
|
||||
* Added more tests to our testing suite
|
||||
* Added x-ua-compatible to http_equiv metadata processing
|
||||
1. [](#bugfix)
|
||||
* Fix Zend Opcache `opcache.validate_timestamps=0` not detecting changes in compiled yaml and twig files
|
||||
* Avoid losing params, query and fragment from the URL when auto-redirecting to a language-specific route - [#759](https://github.com/getgrav/grav/pull/759)
|
||||
* Fix for non-pipeline assets getting lost when pipeline is cached to filesystem
|
||||
* Fix for double encoding resulting from Markdown Extra
|
||||
* Fix for a remote link breaking all CSS rewrites for pipeline
|
||||
* Fix an issue with Retina alternatives not clearing properly between repeat uses
|
||||
* Fix for non standard http/s external markdown links - [#738](https://github.com/getgrav/grav/issues/738)
|
||||
|
||||
# v1.0.10
|
||||
## 02/11/2016
|
||||
|
||||
1. [](#new)
|
||||
* Added new `Page::contentMeta()` mechanism to store content-level meta data alongside content
|
||||
* Added Japanese language translation
|
||||
* Added Japanese language translation
|
||||
1. [](#improved)
|
||||
* Updated some vendor libraries
|
||||
1. [](#bugfix)
|
||||
@@ -18,7 +61,7 @@
|
||||
* New **page-level SSL** functionality when using `absolute_urls`
|
||||
* Added `reverse_proxy` config option for issues with non-standard ports
|
||||
* Added `proxy_url` config option to support GPM behind proxy servers #639
|
||||
* New `Pages::parentsRawRoutes()` method
|
||||
* New `Pages::parentsRawRoutes()` method
|
||||
* Enhanced `bin/gpm info` CLI command with Changelog support #559
|
||||
* Ability to add empty *Folder* via admin plugin
|
||||
* Added latest `jQuery 2.2.0` library to core
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#  Grav
|
||||
#  Grav
|
||||
|
||||
[](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad) [](https://gitter.im/getgrav/grav?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://travis-ci.org/getgrav/grav)
|
||||
|
||||
@@ -29,7 +29,7 @@ These are the options to get Grav:
|
||||
|
||||
You can download a **ready-built** package from the [Downloads page on http://getgrav.org](http://getgrav.org/downloads)
|
||||
|
||||
### With composer
|
||||
### With Composer
|
||||
|
||||
You can create a new project with the latest **stable** Grav release with the following command:
|
||||
|
||||
|
||||
20
bin/grav
20
bin/grav
@@ -32,15 +32,17 @@ if (!file_exists(ROOT_DIR . 'index.php')) {
|
||||
exit('FATAL: Must be run from ROOT directory of Grav!');
|
||||
}
|
||||
|
||||
$app = new Application('Grav CLI Application', '0.1.0');
|
||||
$app = new Application('Grav CLI Application', GRAV_VERSION);
|
||||
$app->addCommands(array(
|
||||
new Grav\Console\Cli\InstallCommand(),
|
||||
new Grav\Console\Cli\ComposerCommand(),
|
||||
new Grav\Console\Cli\SandboxCommand(),
|
||||
new Grav\Console\Cli\CleanCommand(),
|
||||
new Grav\Console\Cli\ClearCacheCommand(),
|
||||
new Grav\Console\Cli\BackupCommand(),
|
||||
new Grav\Console\Cli\NewProjectCommand(),
|
||||
new Grav\Console\Cli\NewUserCommand(),
|
||||
new \Grav\Console\Cli\InstallCommand(),
|
||||
new \Grav\Console\Cli\ComposerCommand(),
|
||||
new \Grav\Console\Cli\SandboxCommand(),
|
||||
new \Grav\Console\Cli\CleanCommand(),
|
||||
new \Grav\Console\Cli\ClearCacheCommand(),
|
||||
new \Grav\Console\Cli\BackupCommand(),
|
||||
new \Grav\Console\Cli\NewProjectCommand(),
|
||||
new \Grav\Console\Cli\NewUserCommand(),
|
||||
new \Grav\Console\Cli\DevTools\NewPluginCommand(),
|
||||
new \Grav\Console\Cli\DevTools\NewThemeCommand(),
|
||||
));
|
||||
$app->run();
|
||||
|
||||
@@ -26,10 +26,12 @@
|
||||
"maximebf/debugbar": "~1.10",
|
||||
"ext-mbstring": "*",
|
||||
"ext-openssl": "*",
|
||||
"ext-curl": "*"
|
||||
"ext-curl": "*",
|
||||
"twig/extensions": "^1.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/codeception": "^2.1",
|
||||
"phpunit/php-code-coverage": "~2.0",
|
||||
"fzaninotto/faker": "^1.5"
|
||||
},
|
||||
"autoload": {
|
||||
|
||||
163
composer.lock
generated
163
composer.lock
generated
@@ -4,7 +4,8 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "dafb943040964731630ab4992b1ea540",
|
||||
"hash": "ff44cbc35ded0b6491ab74b32f62cd9f",
|
||||
"content-hash": "5d8b4ff937850c8b1cd333f5855369a6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
@@ -215,16 +216,16 @@
|
||||
},
|
||||
{
|
||||
"name": "filp/whoops",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/filp/whoops.git",
|
||||
"reference": "8da9523f07c62d56fe1cf36f8ae29b333afc181f"
|
||||
"reference": "d13505b240a6f580bc75ba591da30299d6cb0eec"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/filp/whoops/zipball/8da9523f07c62d56fe1cf36f8ae29b333afc181f",
|
||||
"reference": "8da9523f07c62d56fe1cf36f8ae29b333afc181f",
|
||||
"url": "https://api.github.com/repos/filp/whoops/zipball/d13505b240a6f580bc75ba591da30299d6cb0eec",
|
||||
"reference": "d13505b240a6f580bc75ba591da30299d6cb0eec",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -271,7 +272,7 @@
|
||||
"whoops",
|
||||
"zf2"
|
||||
],
|
||||
"time": "2016-03-13 10:22:39"
|
||||
"time": "2016-04-07 06:16:25"
|
||||
},
|
||||
{
|
||||
"name": "gregwar/cache",
|
||||
@@ -427,16 +428,16 @@
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.18.1",
|
||||
"version": "1.18.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45"
|
||||
"reference": "064b38c16790249488e7a8b987acf1c9d7383c09"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/a5f2734e8c16f3aa21b3da09715d10e15b4d2d45",
|
||||
"reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/064b38c16790249488e7a8b987acf1c9d7383c09",
|
||||
"reference": "064b38c16790249488e7a8b987acf1c9d7383c09",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -451,13 +452,13 @@
|
||||
"doctrine/couchdb": "~1.0@dev",
|
||||
"graylog2/gelf-php": "~1.0",
|
||||
"jakub-onderka/php-parallel-lint": "0.9",
|
||||
"php-amqplib/php-amqplib": "~2.4",
|
||||
"php-console/php-console": "^3.1.3",
|
||||
"phpunit/phpunit": "~4.5",
|
||||
"phpunit/phpunit-mock-objects": "2.3.0",
|
||||
"raven/raven": "^0.13",
|
||||
"ruflin/elastica": ">=0.90 <3.0",
|
||||
"swiftmailer/swiftmailer": "~5.3",
|
||||
"videlalvaro/php-amqplib": "~2.4"
|
||||
"swiftmailer/swiftmailer": "~5.3"
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||
@@ -466,11 +467,11 @@
|
||||
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
|
||||
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
||||
"raven/raven": "Allow sending log messages to a Sentry server",
|
||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
||||
"videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@@ -501,7 +502,7 @@
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-03-13 16:08:35"
|
||||
"time": "2016-04-02 13:12:58"
|
||||
},
|
||||
{
|
||||
"name": "mrclay/minify",
|
||||
@@ -682,16 +683,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v2.8.3",
|
||||
"version": "v2.8.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "56cc5caf051189720b8de974e4746090aaa10d44"
|
||||
"reference": "9a5aef5fc0d4eff86853d44202b02be8d5a20154"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/56cc5caf051189720b8de974e4746090aaa10d44",
|
||||
"reference": "56cc5caf051189720b8de974e4746090aaa10d44",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/9a5aef5fc0d4eff86853d44202b02be8d5a20154",
|
||||
"reference": "9a5aef5fc0d4eff86853d44202b02be8d5a20154",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -738,20 +739,20 @@
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-02-28 16:20:50"
|
||||
"time": "2016-03-17 09:19:04"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v2.8.3",
|
||||
"version": "v2.8.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "78c468665c9568c3faaa9c416a7134308f2d85c3"
|
||||
"reference": "47d2d8cade9b1c3987573d2943bb9352536cdb87"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/78c468665c9568c3faaa9c416a7134308f2d85c3",
|
||||
"reference": "78c468665c9568c3faaa9c416a7134308f2d85c3",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/47d2d8cade9b1c3987573d2943bb9352536cdb87",
|
||||
"reference": "47d2d8cade9b1c3987573d2943bb9352536cdb87",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -798,7 +799,7 @@
|
||||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-01-27 05:14:19"
|
||||
"time": "2016-03-07 14:04:32"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-iconv",
|
||||
@@ -920,16 +921,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v2.8.3",
|
||||
"version": "v2.8.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
"reference": "19b697abe08833ddf38c3ab0cb1bfad236b13bde"
|
||||
"reference": "1f840df081f59cbe25140742bbe94a0dfac0222a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/19b697abe08833ddf38c3ab0cb1bfad236b13bde",
|
||||
"reference": "19b697abe08833ddf38c3ab0cb1bfad236b13bde",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/1f840df081f59cbe25140742bbe94a0dfac0222a",
|
||||
"reference": "1f840df081f59cbe25140742bbe94a0dfac0222a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -979,20 +980,20 @@
|
||||
"debug",
|
||||
"dump"
|
||||
],
|
||||
"time": "2016-02-13 09:21:29"
|
||||
"time": "2016-03-07 14:04:32"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v2.8.3",
|
||||
"version": "v2.8.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "2a4ee40acb880c56f29fb1b8886e7ffe94f3b995"
|
||||
"reference": "584e52cb8f788a887553ba82db6caacb1d6260bb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/2a4ee40acb880c56f29fb1b8886e7ffe94f3b995",
|
||||
"reference": "2a4ee40acb880c56f29fb1b8886e7ffe94f3b995",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/584e52cb8f788a887553ba82db6caacb1d6260bb",
|
||||
"reference": "584e52cb8f788a887553ba82db6caacb1d6260bb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1028,7 +1029,59 @@
|
||||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-02-23 07:41:20"
|
||||
"time": "2016-03-04 07:54:35"
|
||||
},
|
||||
{
|
||||
"name": "twig/extensions",
|
||||
"version": "v1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig-extensions.git",
|
||||
"reference": "449e3c8a9ffad7c2479c7864557275a32b037499"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/449e3c8a9ffad7c2479c7864557275a32b037499",
|
||||
"reference": "449e3c8a9ffad7c2479c7864557275a32b037499",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"twig/twig": "~1.20|~2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/translation": "~2.3"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/translation": "Allow the time_diff output to be translated"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Twig_Extensions_": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Common additional features for Twig that do not directly belong in core",
|
||||
"homepage": "http://twig.sensiolabs.org/doc/extensions/index.html",
|
||||
"keywords": [
|
||||
"i18n",
|
||||
"text"
|
||||
],
|
||||
"time": "2015-08-22 16:38:35"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
@@ -2395,16 +2448,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/browser-kit",
|
||||
"version": "v3.0.3",
|
||||
"version": "v3.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/browser-kit.git",
|
||||
"reference": "dde849a0485b70a24b36f826ed3fb95b904d80c3"
|
||||
"reference": "e07127ac31230b30887c2dddf3708d883d239b14"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/dde849a0485b70a24b36f826ed3fb95b904d80c3",
|
||||
"reference": "dde849a0485b70a24b36f826ed3fb95b904d80c3",
|
||||
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/e07127ac31230b30887c2dddf3708d883d239b14",
|
||||
"reference": "e07127ac31230b30887c2dddf3708d883d239b14",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2448,20 +2501,20 @@
|
||||
],
|
||||
"description": "Symfony BrowserKit Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-01-27 11:34:55"
|
||||
"time": "2016-03-04 07:55:57"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v3.0.3",
|
||||
"version": "v3.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
"reference": "6605602690578496091ac20ec7a5cbd160d4dff4"
|
||||
"reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/6605602690578496091ac20ec7a5cbd160d4dff4",
|
||||
"reference": "6605602690578496091ac20ec7a5cbd160d4dff4",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/65e764f404685f2dc20c057e889b3ad04b2e2db0",
|
||||
"reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2501,20 +2554,20 @@
|
||||
],
|
||||
"description": "Symfony CssSelector Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-01-27 05:14:46"
|
||||
"time": "2016-03-04 07:55:57"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v3.0.3",
|
||||
"version": "v3.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dom-crawler.git",
|
||||
"reference": "981c8edb4538f88ba976ed44bdcaa683fce3d6c6"
|
||||
"reference": "18a06d7a9af41718c20764a674a0ebba3bc40d1f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/981c8edb4538f88ba976ed44bdcaa683fce3d6c6",
|
||||
"reference": "981c8edb4538f88ba976ed44bdcaa683fce3d6c6",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/18a06d7a9af41718c20764a674a0ebba3bc40d1f",
|
||||
"reference": "18a06d7a9af41718c20764a674a0ebba3bc40d1f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2557,20 +2610,20 @@
|
||||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-02-28 16:24:34"
|
||||
"time": "2016-03-23 13:23:25"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v3.0.3",
|
||||
"version": "v3.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "623bda0abd9aa29e529c8e9c08b3b84171914723"
|
||||
"reference": "c54e407b35bc098916704e9fd090da21da4c4f52"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/623bda0abd9aa29e529c8e9c08b3b84171914723",
|
||||
"reference": "623bda0abd9aa29e529c8e9c08b3b84171914723",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/c54e407b35bc098916704e9fd090da21da4c4f52",
|
||||
"reference": "c54e407b35bc098916704e9fd090da21da4c4f52",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2606,7 +2659,7 @@
|
||||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-01-27 05:14:46"
|
||||
"time": "2016-03-10 11:13:05"
|
||||
}
|
||||
],
|
||||
"aliases": [
|
||||
|
||||
@@ -567,6 +567,28 @@ form:
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
assets.css_pipeline_include_externals:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.CSS_PIPELINE_INCLUDE_EXTERNALS
|
||||
help: PLUGIN_ADMIN.CSS_PIPELINE_INCLUDE_EXTERNALS_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
assets.css_pipeline_before_excludes:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.CSS_PIPELINE_BEFORE_EXCLUDES
|
||||
help: PLUGIN_ADMIN.CSS_PIPELINE_BEFORE_EXCLUDES_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
assets.css_minify:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.CSS_MINIFY
|
||||
@@ -611,6 +633,28 @@ form:
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
assets.js_pipeline_include_externals:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.JAVASCRIPT_PIPELINE_INCLUDE_EXTERNALS
|
||||
help: PLUGIN_ADMIN.JAVASCRIPT_PIPELINE_INCLUDE_EXTERNALS_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
assets.js_pipeline_before_excludes:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.JAVASCRIPT_PIPELINE_BEFORE_EXCLUDES
|
||||
help: PLUGIN_ADMIN.JAVASCRIPT_PIPELINE_BEFORE_EXCLUDES_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
assets.js_minify:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.JAVASCRIPT_MINIFY
|
||||
|
||||
@@ -268,12 +268,9 @@ form:
|
||||
type: bool
|
||||
|
||||
header.template:
|
||||
type: select
|
||||
type: text
|
||||
toggleable: true
|
||||
classes: fancy
|
||||
label: PLUGIN_ADMIN.DISPLAY_TEMPLATE
|
||||
default: default
|
||||
'@data-options': '\Grav\Common\Page\Pages::types'
|
||||
|
||||
header.append_url_extension:
|
||||
type: text
|
||||
|
||||
@@ -80,10 +80,14 @@ twig:
|
||||
|
||||
assets: # Configuration for Assets Manager (JS, CSS)
|
||||
css_pipeline: false # The CSS pipeline is the unification of multiple CSS resources into one file
|
||||
css_pipeline_include_externals: true # Include external URLs in the pipeline by default
|
||||
css_pipeline_before_excludes: true # Render the pipeline before any excluded files
|
||||
css_minify: true # Minify the CSS during pipelining
|
||||
css_minify_windows: false # Minify Override for Windows platforms. False by default due to ThreadStackSize
|
||||
css_rewrite: true # Rewrite any CSS relative URLs during pipelining
|
||||
js_pipeline: false # The JS pipeline is the unification of multiple JS resources into one file
|
||||
js_pipeline_include_externals: true # Include external URLs in the pipeline by default
|
||||
js_pipeline_before_excludes: true # Render the pipeline before any excluded files
|
||||
js_minify: true # Minify the JS during pipelining
|
||||
enable_asset_timestamp: false # Enable asset timestamps
|
||||
collections:
|
||||
|
||||
@@ -13,9 +13,7 @@ if (!defined('GRAV_ROOT')) {
|
||||
define('ROOT_DIR', GRAV_ROOT . '/');
|
||||
define('USER_PATH', 'user/');
|
||||
define('USER_DIR', ROOT_DIR . USER_PATH);
|
||||
define('SYSTEM_DIR', ROOT_DIR .'system/');
|
||||
define('CACHE_DIR', ROOT_DIR . 'cache/');
|
||||
define('LOG_DIR', ROOT_DIR .'logs/');
|
||||
|
||||
// DEPRECATED: Do not use!
|
||||
define('ASSETS_DIR', ROOT_DIR . 'assets/');
|
||||
@@ -23,10 +21,12 @@ define('IMAGES_DIR', ROOT_DIR . 'images/');
|
||||
define('ACCOUNTS_DIR', USER_DIR .'accounts/');
|
||||
define('PAGES_DIR', USER_DIR .'pages/');
|
||||
define('DATA_DIR', USER_DIR .'data/');
|
||||
define('SYSTEM_DIR', ROOT_DIR .'system/');
|
||||
define('LIB_DIR', SYSTEM_DIR .'src/');
|
||||
define('PLUGINS_DIR', USER_DIR .'plugins/');
|
||||
define('THEMES_DIR', USER_DIR .'themes/');
|
||||
define('VENDOR_DIR', ROOT_DIR .'vendor/');
|
||||
define('LOG_DIR', ROOT_DIR .'logs/');
|
||||
// END DEPRECATED
|
||||
|
||||
// Some extensions
|
||||
|
||||
@@ -61,7 +61,11 @@ class Assets
|
||||
|
||||
// Configuration toggles to enable/disable the pipelining feature
|
||||
protected $css_pipeline = false;
|
||||
protected $css_pipeline_include_externals = true;
|
||||
protected $css_pipeline_before_excludes = true;
|
||||
protected $js_pipeline = false;
|
||||
protected $js_pipeline_include_externals = true;
|
||||
protected $js_pipeline_before_excludes = true;
|
||||
|
||||
// The asset holding arrays
|
||||
protected $collections = [];
|
||||
@@ -120,10 +124,26 @@ class Assets
|
||||
$this->css_pipeline = $config['css_pipeline'];
|
||||
}
|
||||
|
||||
if (isset($config['css_pipeline_include_externals'])) {
|
||||
$this->css_pipeline_include_externals = $config['css_pipeline_include_externals'];
|
||||
}
|
||||
|
||||
if (isset($config['css_pipeline_before_excludes'])) {
|
||||
$this->css_pipeline_before_excludes = $config['css_pipeline_before_excludes'];
|
||||
}
|
||||
|
||||
if (isset($config['js_pipeline'])) {
|
||||
$this->js_pipeline = $config['js_pipeline'];
|
||||
}
|
||||
|
||||
if (isset($config['js_pipeline_include_externals'])) {
|
||||
$this->js_pipeline_include_externals = $config['js_pipeline_include_externals'];
|
||||
}
|
||||
|
||||
if (isset($config['js_pipeline_before_excludes'])) {
|
||||
$this->js_pipeline_before_excludes = $config['js_pipeline_before_excludes'];
|
||||
}
|
||||
|
||||
// Pipeline requires public dir
|
||||
if (($this->js_pipeline || $this->css_pipeline) && !is_dir($this->assets_dir)) {
|
||||
throw new \Exception('Assets: Public dir not found');
|
||||
@@ -526,8 +546,10 @@ class Assets
|
||||
|
||||
if ($this->css_pipeline) {
|
||||
$pipeline_result = $this->pipelineCss($group);
|
||||
if ($pipeline_result) {
|
||||
$output .= '<link href="' . $pipeline_result . '"' . $attributes . ' />' . "\n";
|
||||
$pipeline_html = '<link href="' . $pipeline_result . '"' . $attributes . ' />' . "\n";
|
||||
|
||||
if ($this->css_pipeline_before_excludes && $pipeline_result) {
|
||||
$output .= $pipeline_html;
|
||||
}
|
||||
foreach ($this->css_no_pipeline as $file) {
|
||||
if ($group && $file['group'] == $group) {
|
||||
@@ -535,6 +557,9 @@ class Assets
|
||||
$output .= '<link href="' . $file['asset'] . $this->timestamp . '"' . $attributes . $media . ' />' . "\n";
|
||||
}
|
||||
}
|
||||
if (!$this->css_pipeline_before_excludes && $pipeline_result) {
|
||||
$output .= $pipeline_html;
|
||||
}
|
||||
} else {
|
||||
foreach ($this->css as $file) {
|
||||
if ($group && $file['group'] == $group) {
|
||||
@@ -600,14 +625,19 @@ class Assets
|
||||
|
||||
if ($this->js_pipeline) {
|
||||
$pipeline_result = $this->pipelineJs($group);
|
||||
if ($pipeline_result) {
|
||||
$output .= '<script src="' . $pipeline_result . '"' . $attributes . ' ></script>' . "\n";
|
||||
$pipeline_html = '<script src="' . $pipeline_result . '"' . $attributes . ' ></script>' . "\n";
|
||||
|
||||
if ($this->js_pipeline_before_excludes && $pipeline_result) {
|
||||
$output .= $pipeline_html;
|
||||
}
|
||||
foreach ($this->js_no_pipeline as $file) {
|
||||
if ($group && $file['group'] == $group) {
|
||||
$output .= '<script src="' . $file['asset'] . $this->timestamp . '"' . $attributes . ' ' . $file['loading'] . '></script>' . "\n";
|
||||
}
|
||||
}
|
||||
if (!$this->js_pipeline_before_excludes && $pipeline_result) {
|
||||
$output .= $pipeline_html;
|
||||
}
|
||||
} else {
|
||||
foreach ($this->js as $file) {
|
||||
if ($group && $file['group'] == $group) {
|
||||
@@ -649,20 +679,27 @@ class Assets
|
||||
// clear no-pipeline assets lists
|
||||
$this->css_no_pipeline = [];
|
||||
|
||||
$file = md5(json_encode($this->css) . $this->css_minify . $this->css_rewrite . $group) . '.css';
|
||||
$uid = md5(json_encode($this->css) . $this->css_minify . $this->css_rewrite . $group);
|
||||
$file = $uid . '.css';
|
||||
$inline_file = $uid . '-inline.css';
|
||||
|
||||
$relative_path = "{$this->base_url}{$this->assets_url}/{$file}";
|
||||
$absolute_path = $this->assets_dir . $file;
|
||||
|
||||
// If inline files exist set them on object
|
||||
if (file_exists($this->assets_dir . $inline_file)) {
|
||||
$this->css_no_pipeline = json_decode(file_get_contents($this->assets_dir . $inline_file), true);
|
||||
}
|
||||
|
||||
// If pipeline exist return it
|
||||
if (file_exists($absolute_path)) {
|
||||
if (file_exists($this->assets_dir . $file)) {
|
||||
return $relative_path . $key;
|
||||
}
|
||||
|
||||
// Remove any non-pipeline files
|
||||
foreach ($this->css as $id => $asset) {
|
||||
if ($asset['group'] == $group) {
|
||||
if (!$asset['pipeline']) {
|
||||
if (!$asset['pipeline'] ||
|
||||
($this->isRemoteLink($asset['asset']) && $this->css_pipeline_include_externals === false)) {
|
||||
$this->css_no_pipeline[$id] = $asset;
|
||||
} else {
|
||||
$temp_css[$id] = $asset;
|
||||
@@ -675,6 +712,12 @@ class Assets
|
||||
return false;
|
||||
}
|
||||
|
||||
// Write non-pipeline files out
|
||||
if (!empty($this->css_no_pipeline)) {
|
||||
file_put_contents($this->assets_dir . $inline_file, json_encode($this->css_no_pipeline));
|
||||
}
|
||||
|
||||
|
||||
$css_minify = $this->css_minify;
|
||||
|
||||
// If this is a Windows server, and minify_windows is false (default value) skip the
|
||||
@@ -693,7 +736,7 @@ class Assets
|
||||
|
||||
// Write file
|
||||
if (strlen(trim($buffer)) > 0) {
|
||||
file_put_contents($absolute_path, $buffer);
|
||||
file_put_contents($this->assets_dir . $file, $buffer);
|
||||
|
||||
return $relative_path . $key;
|
||||
} else {
|
||||
@@ -720,20 +763,27 @@ class Assets
|
||||
// clear no-pipeline assets lists
|
||||
$this->js_no_pipeline = [];
|
||||
|
||||
$file = md5(json_encode($this->js) . $this->js_minify . $group) . '.js';
|
||||
$uid = md5(json_encode($this->js) . $this->js_minify . $group);
|
||||
$file = $uid . '.js';
|
||||
$inline_file = $uid . '-inline.js';
|
||||
|
||||
$relative_path = "{$this->base_url}{$this->assets_url}/{$file}";
|
||||
$absolute_path = $this->assets_dir . $file;
|
||||
|
||||
// If inline files exist set them on object
|
||||
if (file_exists($this->assets_dir . $inline_file)) {
|
||||
$this->js_no_pipeline = json_decode(file_get_contents($this->assets_dir . $inline_file), true);
|
||||
}
|
||||
|
||||
// If pipeline exist return it
|
||||
if (file_exists($absolute_path)) {
|
||||
if (file_exists($this->assets_dir . $file)) {
|
||||
return $relative_path . $key;
|
||||
}
|
||||
|
||||
// Remove any non-pipeline files
|
||||
foreach ($this->js as $id => $asset) {
|
||||
if ($asset['group'] == $group) {
|
||||
if (!$asset['pipeline']) {
|
||||
if (!$asset['pipeline'] ||
|
||||
($this->isRemoteLink($asset['asset']) && $this->js_pipeline_include_externals === false)) {
|
||||
$this->js_no_pipeline[] = $asset;
|
||||
} else {
|
||||
$temp_js[$id] = $asset;
|
||||
@@ -746,6 +796,11 @@ class Assets
|
||||
return false;
|
||||
}
|
||||
|
||||
// Write non-pipeline files out
|
||||
if (!empty($this->js_no_pipeline)) {
|
||||
file_put_contents($this->assets_dir . $inline_file, json_encode($this->js_no_pipeline));
|
||||
}
|
||||
|
||||
// Concatenate files
|
||||
$buffer = $this->gatherLinks($temp_js, JS_ASSET);
|
||||
if ($this->js_minify) {
|
||||
@@ -754,7 +809,7 @@ class Assets
|
||||
|
||||
// Write file
|
||||
if (strlen(trim($buffer)) > 0) {
|
||||
file_put_contents($absolute_path, $buffer);
|
||||
file_put_contents($this->assets_dir . $file, $buffer);
|
||||
|
||||
return $relative_path . $key;
|
||||
} else {
|
||||
@@ -1010,10 +1065,11 @@ class Assets
|
||||
protected function gatherLinks(array $links, $css = true)
|
||||
{
|
||||
$buffer = '';
|
||||
$local = true;
|
||||
|
||||
|
||||
foreach ($links as $asset) {
|
||||
$relative_dir = '';
|
||||
$local = true;
|
||||
|
||||
$link = $asset['asset'];
|
||||
$relative_path = $link;
|
||||
|
||||
@@ -136,7 +136,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface
|
||||
&& !isset($data[$name])) {
|
||||
$value = isset($field['label']) ? $field['label'] : $field['name'];
|
||||
$language = Grav::instance()['language'];
|
||||
$message = sprintf($language->translate('FORM.MISSING_REQUIRED_FIELD', null, true) . ' %s', $value);
|
||||
$message = sprintf($language->translate('FORM.MISSING_REQUIRED_FIELD', null, true) . ' %s', $language->translate($value));
|
||||
$messages[$field['name']][] = $message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,11 @@ trait CompiledFile
|
||||
if ($file->locked() !== false) {
|
||||
$file->save($cache);
|
||||
$file->unlock();
|
||||
|
||||
// Compile cached file into bytecode cache
|
||||
if (function_exists('opcache_invalidate')) {
|
||||
opcache_invalidate($file->filename(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
$file->free();
|
||||
|
||||
@@ -194,7 +194,7 @@ class GPM extends Iterator
|
||||
}
|
||||
|
||||
foreach ($this->installed['plugins'] as $slug => $plugin) {
|
||||
if (!isset($repository[$slug]) || $plugin->symlink) {
|
||||
if (!isset($repository[$slug]) || $plugin->symlink || !$plugin->version || $plugin->gpm === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ class GPM extends Iterator
|
||||
}
|
||||
|
||||
foreach ($this->installed['themes'] as $slug => $plugin) {
|
||||
if (!isset($repository[$slug]) || $plugin->symlink) {
|
||||
if (!isset($repository[$slug]) || $plugin->symlink || !$plugin->version || $plugin->gpm === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -568,6 +568,14 @@ class GPM extends Iterator
|
||||
public function getDependencies($packages) {
|
||||
$dependencies = $this->calculateMergedDependenciesOfPackages($packages);
|
||||
foreach ($dependencies as $dependency_slug => $dependencyVersionWithOperator) {
|
||||
//First, check for Grav dependency. If a dependency requires Grav > the current version, abort and tell.
|
||||
if ($dependency_slug == 'grav') {
|
||||
if (version_compare($this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator), GRAV_VERSION) === 1) {
|
||||
//Needs a Grav update first
|
||||
throw new \Exception("<red>One of the packages require Grav " . $dependencies['grav'] . ". Please update Grav to the latest release.");
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->isPluginInstalled($dependency_slug)) {
|
||||
$dependencyVersion = $this->calculateVersionNumberFromDependencyVersion($dependencyVersionWithOperator);
|
||||
|
||||
|
||||
@@ -199,7 +199,15 @@ class Response
|
||||
// if proxy set add that
|
||||
$proxy_url = Grav::instance()['config']->get('system.proxy_url');
|
||||
if ($proxy_url) {
|
||||
$options['fopen']['proxy'] = $proxy_url;
|
||||
$parsed_url = parse_url($proxy_url);
|
||||
|
||||
$options['fopen']['proxy'] = ($parsed_url['scheme'] ?: 'http') . '://' . $parsed_url['host'] . (isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '');
|
||||
$options['fopen']['request_fulluri'] = true;
|
||||
|
||||
if (isset($parsed_url['user']) && isset($parsed_url['pass'])) {
|
||||
$auth = base64_encode($parsed_url['user'] . ':' . $parsed_url['pass']);
|
||||
$options['fopen']['header'] = "Proxy-Authorization: Basic $auth";
|
||||
}
|
||||
}
|
||||
|
||||
if ($callback) {
|
||||
@@ -267,7 +275,18 @@ class Response
|
||||
// if proxy set add that
|
||||
$proxy_url = Grav::instance()['config']->get('system.proxy_url');
|
||||
if ($proxy_url) {
|
||||
$options['curl'][CURLOPT_PROXY] = $proxy_url;
|
||||
$parsed_url = parse_url($proxy_url);
|
||||
|
||||
$options['curl'][CURLOPT_PROXY] = $parsed_url['host'];
|
||||
$options['curl'][CURLOPT_PROXYTYPE] = 'HTTP';
|
||||
|
||||
if (isset($parsed_url['port'])) {
|
||||
$options['curl'][CURLOPT_PROXYPORT] = $parsed_url['port'];
|
||||
}
|
||||
|
||||
if (isset($parsed_url['user']) && isset($parsed_url['pass'])) {
|
||||
$options['curl'][CURLOPT_PROXYUSERPWD] = $parsed_url['user'] . ':' . $parsed_url['pass'];
|
||||
}
|
||||
}
|
||||
|
||||
// no open_basedir set, we can proceed normally
|
||||
@@ -276,7 +295,7 @@ class Response
|
||||
return curl_exec($ch);
|
||||
}
|
||||
|
||||
$max_redirects = isset($options['curl'][CURLOPT_MAXREDIRS]) ? $options['curl'][CURLOPT_MAXREDIRS] : 3;
|
||||
$max_redirects = isset($options['curl'][CURLOPT_MAXREDIRS]) ? $options['curl'][CURLOPT_MAXREDIRS] : 3;
|
||||
$options['curl'][CURLOPT_FOLLOWLOCATION] = false;
|
||||
|
||||
// open_basedir set but no redirects to follow, we can disable followlocation and proceed normally
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace Grav\Common\Markdown;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Uri;
|
||||
use Grav\Common\Utils;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
|
||||
/**
|
||||
@@ -22,7 +23,6 @@ trait ParsedownGravTrait
|
||||
protected $pages_dir;
|
||||
protected $special_chars;
|
||||
protected $twig_link_regex = '/\!*\[(?:.*)\]\((\{([\{%#])\s*(.*?)\s*(?:\2|\})\})\)/';
|
||||
protected $special_protocols = ['xmpp', 'mailto', 'tel', 'sms'];
|
||||
|
||||
public $completable_blocks = [];
|
||||
public $continuable_blocks = [];
|
||||
@@ -63,9 +63,13 @@ trait ParsedownGravTrait
|
||||
* @param $type
|
||||
* @param $tag
|
||||
*/
|
||||
public function addBlockType($type, $tag, $continuable = false, $completable = false)
|
||||
public function addBlockType($type, $tag, $continuable = false, $completable = false, $index = null)
|
||||
{
|
||||
$this->BlockTypes[$type] [] = $tag;
|
||||
if (!isset($index)) {
|
||||
$this->BlockTypes[$type] [] = $tag;
|
||||
} else {
|
||||
array_splice($this->BlockTypes[$type], $index, 0, $tag);
|
||||
}
|
||||
|
||||
if ($continuable) {
|
||||
$this->continuable_blocks[] = $tag;
|
||||
@@ -82,10 +86,17 @@ trait ParsedownGravTrait
|
||||
* @param $type
|
||||
* @param $tag
|
||||
*/
|
||||
public function addInlineType($type, $tag)
|
||||
public function addInlineType($type, $tag, $index = null)
|
||||
{
|
||||
$this->InlineTypes[$type] [] = $tag;
|
||||
$this->inlineMarkerList .= $type;
|
||||
if (!isset($index)) {
|
||||
$this->InlineTypes[$type] [] = $tag;
|
||||
} else {
|
||||
array_splice($this->InlineTypes[$type], $index, 0, $tag);
|
||||
}
|
||||
|
||||
if (strpos($this->inlineMarkerList, $type) === false) {
|
||||
$this->inlineMarkerList .= $type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,6 +240,7 @@ trait ParsedownGravTrait
|
||||
|
||||
// if there is a query, then parse it and build action calls
|
||||
if (isset($url['query'])) {
|
||||
$url['query'] = htmlspecialchars_decode(urldecode($url['query']));
|
||||
$actions = array_reduce(explode('&', $url['query']), function ($carry, $item) {
|
||||
$parts = explode('=', $item, 2);
|
||||
$value = isset($parts[1]) ? $parts[1] : null;
|
||||
@@ -330,7 +342,7 @@ trait ParsedownGravTrait
|
||||
}
|
||||
|
||||
// if special scheme, just return
|
||||
if(isset($url['scheme']) && in_array($url['scheme'], $this->special_protocols)) {
|
||||
if(isset($url['scheme']) && !Utils::startsWith($url['scheme'], 'http')) {
|
||||
return $excerpt;
|
||||
}
|
||||
|
||||
|
||||
@@ -2134,7 +2134,7 @@ class Page
|
||||
/** @var Pages $pages */
|
||||
$pages = Grav::instance()['pages'];
|
||||
|
||||
return $pages->dispatch($url, $all);
|
||||
return $pages->find($url, $all);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -287,6 +287,19 @@ class Pages
|
||||
return new Collection($children, [], $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* alias method to return find a page.
|
||||
*
|
||||
* @param string $url The relative URL of the page
|
||||
* @param bool $all
|
||||
*
|
||||
* @return Page|null
|
||||
*/
|
||||
public function find($url, $all = false)
|
||||
{
|
||||
return $this->dispatch($url, $all);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch URI to a page.
|
||||
*
|
||||
@@ -704,7 +717,7 @@ class Pages
|
||||
$last_modified = Folder::lastModifiedFile($pages_dir);
|
||||
}
|
||||
|
||||
$page_cache_id = md5(USER_DIR . $last_modified . $language->getActive() . $config->checksum());
|
||||
$page_cache_id = md5($pages_dir . $last_modified . $language->getActive() . $config->checksum());
|
||||
|
||||
list($this->instances, $this->routes, $this->children, $taxonomy_map, $this->sort) = $cache->fetch($page_cache_id);
|
||||
if (!$this->instances) {
|
||||
|
||||
@@ -5,16 +5,23 @@ use Pimple\Container;
|
||||
use Pimple\ServiceProviderInterface;
|
||||
use \Monolog\Logger;
|
||||
use \Monolog\Handler\StreamHandler;
|
||||
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
|
||||
|
||||
class LoggerServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
public function register(Container $container)
|
||||
{
|
||||
$log = new Logger('grav');
|
||||
$log_file = LOG_DIR.'grav.log';
|
||||
$container['log'] = function ($c) {
|
||||
$log = new Logger('grav');
|
||||
|
||||
$log->pushHandler(new StreamHandler($log_file, Logger::DEBUG));
|
||||
/** @var UniformResourceLocator $locator */
|
||||
$locator = $c['locator'];
|
||||
|
||||
$container['log'] = $log;
|
||||
$log_file = $locator->findResource('log://grav.log', true, true);
|
||||
|
||||
$log->pushHandler(new StreamHandler($log_file, Logger::DEBUG));
|
||||
|
||||
return $log;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,15 +278,23 @@ class Themes extends Iterator
|
||||
$locator = $this->grav['locator'];
|
||||
|
||||
if ($config->get('system.languages.translations', true)) {
|
||||
$languageFiles = array_reverse($locator->findResources("theme://languages" . YAML_EXT));
|
||||
|
||||
$languages = [];
|
||||
foreach ($languageFiles as $language) {
|
||||
$languages[] = CompiledYamlFile::instance($language)->content();
|
||||
$language_file = $locator->findResource("theme://languages" . YAML_EXT);
|
||||
if ($language_file) {
|
||||
$language = CompiledYamlFile::instance($language_file)->content();
|
||||
$this->grav['languages']->mergeRecursive($language);
|
||||
}
|
||||
$languages_folder = $locator->findResource("theme://languages/");
|
||||
if (file_exists($languages_folder)) {
|
||||
$languages = [];
|
||||
$iterator = new \DirectoryIterator($languages_folder);
|
||||
|
||||
if ($languages) {
|
||||
$languages = call_user_func_array('array_replace_recursive', $languages);
|
||||
/** @var \DirectoryIterator $directory */
|
||||
foreach ($iterator as $file) {
|
||||
if ($file->getExtension() != 'yaml') {
|
||||
continue;
|
||||
}
|
||||
$languages[$file->getBasename('.yaml')] = CompiledYamlFile::instance($file->getPathname())->content();
|
||||
}
|
||||
$this->grav['languages']->mergeRecursive($languages);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ class Twig
|
||||
protected $loaderArray;
|
||||
|
||||
|
||||
protected $autoescape;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -105,7 +107,12 @@ class Twig
|
||||
|
||||
$params = $config->get('system.twig');
|
||||
if (!empty($params['cache'])) {
|
||||
$params['cache'] = $locator->findResource('cache://twig', true, true);
|
||||
$cachePath = $locator->findResource('cache://twig', true, true);
|
||||
$params['cache'] = new \Twig_Cache_Filesystem($cachePath, \Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION);
|
||||
}
|
||||
|
||||
if (!empty($this->autoescape)) {
|
||||
$params['autoescape'] = $this->autoescape;
|
||||
}
|
||||
|
||||
$this->twig = new TwigEnvironment($loader_chain, $params);
|
||||
@@ -144,6 +151,13 @@ class Twig
|
||||
}
|
||||
$this->twig->addExtension(new TwigExtension());
|
||||
|
||||
// enable the Intl Twig extension if translations are enabled
|
||||
if (count($config->get('system.languages.supported', [])) > 0) {
|
||||
if (class_exists('\Twig_Extensions_Extension_Intl')) {
|
||||
$this->twig->addExtension(new \Twig_Extensions_Extension_Intl());
|
||||
}
|
||||
}
|
||||
|
||||
$this->grav->fireEvent('onTwigExtensions');
|
||||
|
||||
// Set some standard variables for twig
|
||||
@@ -365,4 +379,13 @@ class Twig
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the autoescape setting
|
||||
*
|
||||
* @param boolean $state
|
||||
*/
|
||||
public function setAutoescape($state) {
|
||||
$this->autoescape = (bool) $state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ class TwigExtension extends \Twig_Extension
|
||||
new \Twig_SimpleFilter('*ize', [$this, 'inflectorFilter']),
|
||||
new \Twig_SimpleFilter('absolute_url', [$this, 'absoluteUrlFilter']),
|
||||
new \Twig_SimpleFilter('contains', [$this, 'containsFilter']),
|
||||
new \Twig_SimpleFilter('date', [$this, 'dateFilter'], array('needs_environment' => true)),
|
||||
new \Twig_SimpleFilter('defined', [$this, 'definedDefaultFilter']),
|
||||
new \Twig_SimpleFilter('ends_with', [$this, 'endsWithFilter']),
|
||||
new \Twig_SimpleFilter('fieldName', [$this, 'fieldNameFilter']),
|
||||
@@ -318,67 +317,6 @@ class TwigExtension extends \Twig_Extension
|
||||
return (strpos($haystack, $needle) !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the built-in date filter to output dates in the set locale
|
||||
*
|
||||
* @param TwigEnvironment $env A Twig_Environment instance
|
||||
* @param DateTime|DateTimeInterface|DateInterval|string $date A date
|
||||
* @param string|null $format The target format, null to use the default
|
||||
* @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
|
||||
*
|
||||
* @return string The formatted date
|
||||
*/
|
||||
function dateFilter(TwigEnvironment $env, $date, $format = null, $timezone = null)
|
||||
{
|
||||
$this->grav->setLocale();
|
||||
|
||||
if (null === $format) {
|
||||
$formats = $env->getExtension('core')->getDateFormat();
|
||||
$format = $date instanceof DateInterval ? $formats[1] : $formats[0];
|
||||
}
|
||||
|
||||
if ($date instanceof DateInterval) {
|
||||
return strftime($this->dateFormatToStrftime($format), $date->getTimestamp());
|
||||
}
|
||||
|
||||
return strftime($this->dateFormatToStrftime($format), \twig_date_converter($env, $date, $timezone)->getTimestamp());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date format to a strftime format
|
||||
*
|
||||
* Timezone conversion is done for unix. Windows users must exchange %z and %Z.
|
||||
*
|
||||
* Unsupported date formats : S, n, t, L, B, G, u, e, I, P, Z, c, r
|
||||
* Unsupported strftime formats : %U, %W, %C, %g, %r, %R, %T, %X, %c, %D, %F, %x
|
||||
*
|
||||
* @param string $dateFormat a date format
|
||||
* @return string
|
||||
*
|
||||
* @author https://secure.php.net/manual/it/function.strftime.php#96424
|
||||
*/
|
||||
public function dateFormatToStrftime($dateFormat)
|
||||
{
|
||||
$caracs = array(
|
||||
// Day - no strf eq : S
|
||||
'd' => '%d', 'D' => '%a', 'j' => '%e', 'l' => '%A', 'N' => '%u', 'w' => '%w', 'z' => '%j',
|
||||
// Week - no date eq : %U, %W
|
||||
'W' => '%V',
|
||||
// Month - no strf eq : n, t
|
||||
'F' => '%B', 'm' => '%m', 'M' => '%b',
|
||||
// Year - no strf eq : L; no date eq : %C, %g
|
||||
'o' => '%G', 'Y' => '%Y', 'y' => '%y',
|
||||
// Time - no strf eq : B, G, u; no date eq : %r, %R, %T, %X
|
||||
'a' => '%P', 'A' => '%p', 'g' => '%l', 'h' => '%I', 'H' => '%H', 'i' => '%M', 's' => '%S',
|
||||
// Timezone - no strf eq : e, I, P, Z
|
||||
'O' => '%z', 'T' => '%Z',
|
||||
// Full Date / Time - no strf eq : c, r; no date eq : %c, %D, %F, %x
|
||||
'U' => '%s'
|
||||
);
|
||||
|
||||
return strtr((string)$dateFormat, $caracs);
|
||||
}
|
||||
|
||||
/**
|
||||
* displays a facebook style 'time ago' formatted date/time
|
||||
*
|
||||
|
||||
@@ -159,17 +159,12 @@ class Uri
|
||||
|
||||
private function buildEnvironment()
|
||||
{
|
||||
// set hostname
|
||||
$address = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '::1';
|
||||
|
||||
// check for localhost variations
|
||||
if ($this->name == 'localhost' || $address == '::1' || $address == '127.0.0.1') {
|
||||
$env = 'localhost';
|
||||
if ($this->name == '127.0.0.1' || $this->name== '::1') {
|
||||
return 'localhost';
|
||||
} else {
|
||||
$env = $this->name;
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
return $env;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -479,7 +474,7 @@ class Uri
|
||||
* Gets the Fragment portion of a URI (eg #target)
|
||||
*
|
||||
* @param null $fragment
|
||||
*
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function fragment($fragment = null)
|
||||
@@ -601,6 +596,27 @@ class Uri
|
||||
return $this->base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the base relative URL including the language prefix
|
||||
* or the base relative url if multilanguage is not enabled
|
||||
*
|
||||
* @return String The base of the URI
|
||||
*/
|
||||
public function baseIncludingLanguage()
|
||||
{
|
||||
$grav = Grav::instance();
|
||||
|
||||
// Link processing should prepend language
|
||||
$language = $grav['language'];
|
||||
$language_append = '';
|
||||
if ($language->enabled()) {
|
||||
$language_append = $language->getLanguageURLPrefix();
|
||||
}
|
||||
|
||||
$base = $grav['base_url_relative'];
|
||||
return rtrim($base . $grav['pages']->base(), '/') . $language_append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return root URL to the site.
|
||||
*
|
||||
|
||||
192
system/src/Grav/Console/Cli/DevTools/DevToolsCommand.php
Normal file
192
system/src/Grav/Console/Cli/DevTools/DevToolsCommand.php
Normal file
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
namespace Grav\Console\Cli\DevTools;
|
||||
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Data;
|
||||
use Grav\Common\Filesystem\Folder;
|
||||
use Grav\Common\GPM\GPM;
|
||||
use Grav\Common\Inflector;
|
||||
use Grav\Common\Twig\Twig;
|
||||
use Grav\Common\Utils;
|
||||
use RocketTheme\Toolbox\File\File;
|
||||
use Grav\Console\ConsoleCommand;
|
||||
|
||||
/**
|
||||
* Class DevToolsCommand
|
||||
* @package Grav\Console\Cli\
|
||||
*/
|
||||
class DevToolsCommand extends ConsoleCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $component = [];
|
||||
|
||||
/**
|
||||
* @var Grav
|
||||
*/
|
||||
protected $grav;
|
||||
|
||||
/**
|
||||
* @var Inflector
|
||||
*/
|
||||
protected $inflector;
|
||||
|
||||
/**
|
||||
* @var Locator
|
||||
*/
|
||||
protected $locator;
|
||||
|
||||
/**
|
||||
* @var Twig
|
||||
*/
|
||||
protected $twig;
|
||||
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* @var gpm
|
||||
*/
|
||||
protected $gpm;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the basic requirements for the developer tools
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
$autoload = require_once GRAV_ROOT . '/vendor/autoload.php';
|
||||
if (!function_exists('curl_version')) {
|
||||
exit('FATAL: DEVTOOLS requires PHP Curl module to be installed');
|
||||
}
|
||||
|
||||
$this->grav = Grav::instance(array('loader' => $autoload));
|
||||
$this->grav['config']->init();
|
||||
$this->grav['uri']->init();
|
||||
$this->grav['streams'];
|
||||
$this->inflector = $this->grav['inflector'];
|
||||
$this->locator = $this->grav['locator'];
|
||||
$this->twig = new Twig($this->grav);
|
||||
$this->gpm = new GPM(true);
|
||||
|
||||
//Add `theme://` to prevent fail
|
||||
$this->locator->addPath('theme', '', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the component type and renames accordingly
|
||||
*/
|
||||
protected function createComponent()
|
||||
{
|
||||
$name = $this->component['name'];
|
||||
$folderName = strtolower($this->inflector->hyphenize($name));
|
||||
$type = $this->component['type'];
|
||||
|
||||
$template = $this->component['template'];
|
||||
$templateFolder = __DIR__ . '/components/' . $type . DS . $template;
|
||||
$componentFolder = $this->locator->findResource($type . 's://') . DS . $folderName;
|
||||
|
||||
//Copy All files to component folder
|
||||
try {
|
||||
Folder::copy($templateFolder, $componentFolder);
|
||||
} catch (\Exception $e) {
|
||||
$this->output->writeln("<red>" . $e->getMessage() . "</red>");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Add Twig vars and templates then initialize
|
||||
$this->twig->twig_vars['component'] = $this->component;
|
||||
$this->twig->twig_paths[] = $templateFolder;
|
||||
$this->twig->init();
|
||||
|
||||
//Get all templates of component then process each with twig and save
|
||||
$templates = Folder::all($componentFolder);
|
||||
|
||||
try {
|
||||
foreach($templates as $templateFile) {
|
||||
if (Utils::endsWith($templateFile, '.twig') && !Utils::endsWith($templateFile, '.html.twig')) {
|
||||
$content = $this->twig->processTemplate($templateFile);
|
||||
$file = File::instance($componentFolder . DS . str_replace('.twig', '', $templateFile));
|
||||
$file->content($content);
|
||||
$file->save();
|
||||
|
||||
//Delete twig template
|
||||
$file = File::instance($componentFolder . DS . $templateFile);
|
||||
$file->delete();
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->output->writeln("<red>" . $e->getMessage() . "</red>");
|
||||
$this->output->writeln("Rolling back...");
|
||||
Folder::delete($componentFolder);
|
||||
$this->output->writeln($type . "creation failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
rename($componentFolder . DS . $type . '.php', $componentFolder . DS . $this->inflector->hyphenize($name) . '.php');
|
||||
rename($componentFolder . DS . $type . '.yaml', $componentFolder . DS . $this->inflector->hyphenize($name) . '.yaml');
|
||||
|
||||
$this->output->writeln('');
|
||||
$this->output->writeln('<green>SUCCESS</green> ' . $type . ' <magenta>' . $name . '</magenta> -> Created Successfully');
|
||||
$this->output->writeln('');
|
||||
$this->output->writeln('Path: <cyan>' . $componentFolder . '</cyan>');
|
||||
$this->output->writeln('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through all options and validate
|
||||
*/
|
||||
protected function validateOptions()
|
||||
{
|
||||
foreach (array_filter($this->options) as $type => $value) {
|
||||
$this->validate($type, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @param $value
|
||||
* @param string $extra
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function validate($type, $value, $extra = '')
|
||||
{
|
||||
switch ($type) {
|
||||
case 'name':
|
||||
//Check If name
|
||||
if ($value == null || trim($value) == '') {
|
||||
throw new \RuntimeException('Name cannot be empty');
|
||||
}
|
||||
if (false != $this->gpm->findPackage($value)) {
|
||||
throw new \RuntimeException('Package name exists in GPM');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'description':
|
||||
if($value == null || trim($value) == '') {
|
||||
throw new \RuntimeException('Description cannot be empty');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'developer':
|
||||
if ($value === null || trim($value) == '') {
|
||||
throw new \RuntimeException('Developer\'s Name cannot be empty');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'email':
|
||||
if (!preg_match('/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/', $value)) {
|
||||
throw new \RuntimeException('Not a valid email address');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
129
system/src/Grav/Console/Cli/DevTools/NewPluginCommand.php
Normal file
129
system/src/Grav/Console/Cli/DevTools/NewPluginCommand.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
namespace Grav\Console\Cli\DevTools;
|
||||
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Helper\Helper;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
|
||||
/**
|
||||
* Class NewPluginCommand
|
||||
* @package Grav\Console\Cli\DevTools
|
||||
*/
|
||||
class NewPluginCommand extends DevToolsCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('new-plugin')
|
||||
->setAliases(['newplugin'])
|
||||
->addOption(
|
||||
'name',
|
||||
'pn',
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'The name of your new Grav plugin'
|
||||
)
|
||||
->addOption(
|
||||
'description',
|
||||
'd',
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'A description of your new Grav plugin'
|
||||
)
|
||||
->addOption(
|
||||
'developer',
|
||||
'dv',
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'The name/username of the developer'
|
||||
)
|
||||
->addOption(
|
||||
'email',
|
||||
'e',
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'The developer\'s email'
|
||||
)
|
||||
->setDescription('Creates a new Grav plugin with the basic required files')
|
||||
->setHelp('The <info>new-plugin</info> command creates a new Grav instance and performs the creation of a plugin.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null|void
|
||||
*/
|
||||
protected function serve()
|
||||
{
|
||||
$this->init();
|
||||
|
||||
/**
|
||||
* @var array DevToolsCommand $component
|
||||
*/
|
||||
$this->component['type'] = 'plugin';
|
||||
$this->component['template'] = 'blank';
|
||||
$this->component['version'] = '0.1.0'; // @todo add optional non prompting version argument
|
||||
|
||||
$this->options = [
|
||||
'name' => $this->input->getOption('name'),
|
||||
'description' => $this->input->getOption('description'),
|
||||
'author' => [
|
||||
'name' => $this->input->getOption('developer'),
|
||||
'email' => $this->input->getOption('email')
|
||||
]
|
||||
];
|
||||
|
||||
$this->validateOptions();
|
||||
|
||||
$this->component = array_replace($this->component, $this->options);
|
||||
|
||||
$helper = $this->getHelper('question');
|
||||
|
||||
if (!$this->options['name']) {
|
||||
$question = new Question('Enter <yellow>Plugin Name</yellow>: ');
|
||||
$question->setValidator(function ($value) {
|
||||
return $this->validate('name', $value);
|
||||
});
|
||||
|
||||
$this->component['name'] = $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
|
||||
if (!$this->options['description']) {
|
||||
$question = new Question('Enter <yellow>Plugin Description</yellow>: ');
|
||||
$question->setValidator(function ($value) {
|
||||
return $this->validate('description', $value);
|
||||
});
|
||||
|
||||
$this->component['description'] = $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
|
||||
if (!$this->options['author']['name']) {
|
||||
$question = new Question('Enter <yellow>Developer Name</yellow>: ');
|
||||
$question->setValidator(function ($value) {
|
||||
return $this->validate('developer', $value);
|
||||
});
|
||||
|
||||
$this->component['author']['name'] = $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
|
||||
if (!$this->options['author']['email']) {
|
||||
$question = new Question('Enter <yellow>Developer Email</yellow>: ');
|
||||
$question->setValidator(function ($value) {
|
||||
return $this->validate('email', $value);
|
||||
});
|
||||
|
||||
$this->component['author']['email'] = $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
|
||||
$this->component['template'] = 'blank';
|
||||
|
||||
$this->createComponent();
|
||||
}
|
||||
|
||||
}
|
||||
145
system/src/Grav/Console/Cli/DevTools/NewThemeCommand.php
Normal file
145
system/src/Grav/Console/Cli/DevTools/NewThemeCommand.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
namespace Grav\Console\Cli\DevTools;
|
||||
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Helper\Helper;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
|
||||
/**
|
||||
* Class NewThemeCommand
|
||||
* @package Grav\Console\Cli\DevTools
|
||||
*/
|
||||
class NewThemeCommand extends DevToolsCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $options = [];
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('new-theme')
|
||||
->setAliases(['newtheme'])
|
||||
->addOption(
|
||||
'name',
|
||||
'pn',
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'The name of your new Grav theme'
|
||||
)
|
||||
->addOption(
|
||||
'description',
|
||||
'd',
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'A description of your new Grav theme'
|
||||
)
|
||||
->addOption(
|
||||
'developer',
|
||||
'dv',
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'The name/username of the developer'
|
||||
)
|
||||
->addOption(
|
||||
'email',
|
||||
'e',
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'The developer\'s email'
|
||||
)
|
||||
->setDescription('Creates a new Grav theme with the basic required files')
|
||||
->setHelp('The <info>new-theme</info> command creates a new Grav instance and performs the creation of a theme.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null|void
|
||||
*/
|
||||
protected function serve()
|
||||
{
|
||||
$this->init();
|
||||
|
||||
/**
|
||||
* @var array DevToolsCommand $component
|
||||
*/
|
||||
$this->component['type'] = 'theme';
|
||||
$this->component['template'] = 'blank';
|
||||
$this->component['version'] = '0.1.0'; // @todo add optional non prompting version argument
|
||||
|
||||
$this->options = [
|
||||
'name' => $this->input->getOption('name'),
|
||||
'description' => $this->input->getOption('description'),
|
||||
'author' => [
|
||||
'name' => $this->input->getOption('developer'),
|
||||
'email' => $this->input->getOption('email')
|
||||
]
|
||||
];
|
||||
|
||||
$this->validateOptions();
|
||||
|
||||
$this->component = array_replace($this->component, $this->options);
|
||||
|
||||
$helper = $this->getHelper('question');
|
||||
|
||||
if (!$this->options['name']) {
|
||||
$question = new Question('Enter <yellow>Theme Name</yellow>: ');
|
||||
$question->setValidator(function ($value) {
|
||||
return $this->validate('name', $value);
|
||||
});
|
||||
|
||||
$this->component['name'] = $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
|
||||
if (!$this->options['description']) {
|
||||
$question = new Question('Enter <yellow>Theme Description</yellow>: ');
|
||||
$question->setValidator(function ($value) {
|
||||
return $this->validate('description', $value);
|
||||
});
|
||||
|
||||
$this->component['description'] = $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
|
||||
if (!$this->options['author']['name']) {
|
||||
$question = new Question('Enter <yellow>Developer Name</yellow>: ');
|
||||
$question->setValidator(function ($value) {
|
||||
return $this->validate('developer', $value);
|
||||
});
|
||||
|
||||
$this->component['author']['name'] = $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
|
||||
if (!$this->options['author']['email']) {
|
||||
$question = new Question('Enter <yellow>Developer Email</yellow>: ');
|
||||
$question->setValidator(function ($value) {
|
||||
return $this->validate('email', $value);
|
||||
});
|
||||
|
||||
$this->component['author']['email'] = $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
|
||||
$question = new ChoiceQuestion(
|
||||
'Please choose a template type',
|
||||
array('pure-blank', 'inheritence')
|
||||
);
|
||||
$this->component['template'] = $helper->ask($this->input, $this->output, $question);
|
||||
|
||||
if ($this->component['template'] == 'inheritence') {
|
||||
$themes = $this->gpm->getInstalledThemes();
|
||||
$installedThemes = [];
|
||||
foreach($themes as $key => $theme) {
|
||||
array_push($installedThemes, $key);
|
||||
}
|
||||
$question = new ChoiceQuestion(
|
||||
'Please choose a theme to extend: ',
|
||||
$installedThemes
|
||||
);
|
||||
$this->component['extends'] = $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
$this->createComponent();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
# v0.1.0
|
||||
## {{ "now"|date("m/d/Y") }}
|
||||
|
||||
1. [](#new)
|
||||
* ChangeLog started...
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) {{ "now"|date("Y") }} {{ component.author.name }}
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,7 @@
|
||||
# {{ component.name|titleize }} Plugin
|
||||
|
||||
The **{{ component.name|titleize }}** Plugin is for [Grav CMS](http://github.com/getgrav/grav). This README.md file should be modified to describe the features, installation, configuration, and general usage of this plugin.
|
||||
|
||||
## Description
|
||||
|
||||
{{ component.description }}
|
||||
@@ -0,0 +1,31 @@
|
||||
name: {{ component.name|titleize }}
|
||||
version: 0.1.0
|
||||
description: {{ component.description }}
|
||||
icon: plug
|
||||
author:
|
||||
name: {{ component.author.name }}
|
||||
email: {{ component.author.email }}
|
||||
homepage: https://github.com/{{ component.author.name|hyphenize }}/grav-plugin-{{ component.name|hyphenize }}
|
||||
demo: http://demo.yoursite.com
|
||||
keywords: grav, plugin, etc
|
||||
bugs: https://github.com/{{ component.author.name|hyphenize }}/grav-plugin-{{ component.name|hyphenize }}/issues
|
||||
readme: https://github.com/{{ component.author.name|hyphenize }}/grav-plugin-{{ component.name|hyphenize }}/blob/develop/README.md
|
||||
license: MIT
|
||||
|
||||
form:
|
||||
validation: strict
|
||||
fields:
|
||||
enabled:
|
||||
type: toggle
|
||||
label: Plugin status
|
||||
highlight: 1
|
||||
default: 0
|
||||
options:
|
||||
1: Enabled
|
||||
0: Disabled
|
||||
validate:
|
||||
type: bool
|
||||
text_var:
|
||||
type: text
|
||||
label: Text Variable
|
||||
help: Text to add to the top of a page
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
namespace Grav\Plugin;
|
||||
|
||||
use Grav\Common\Plugin;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
|
||||
/**
|
||||
* Class {{ component.name|camelize }}Plugin
|
||||
* @package Grav\Plugin
|
||||
*/
|
||||
class {{ component.name|camelize }}Plugin extends Plugin
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* The getSubscribedEvents() gives the core a list of events
|
||||
* that the plugin wants to listen to. The key of each
|
||||
* array section is the event that the plugin listens to
|
||||
* and the value (in the form of an array) contains the
|
||||
* callable (or function) as well as the priority. The
|
||||
* higher the number the higher the priority.
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
'onPluginsInitialized' => ['onPluginsInitialized', 0]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the plugin
|
||||
*/
|
||||
public function onPluginsInitialized()
|
||||
{
|
||||
// Don't proceed if we are in the admin plugin
|
||||
if ($this->isAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable the main event we are interested in
|
||||
$this->enable([
|
||||
'onPageContentRaw' => ['onPageContentRaw', 0]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do some work for this event, full details of events can be found
|
||||
* on the learn site: http://learn.getgrav.org/plugins/event-hooks
|
||||
*
|
||||
* @param Event $e
|
||||
*/
|
||||
public function onPageContentRaw(Event $e)
|
||||
{
|
||||
// Get a variable from the plugin configuration
|
||||
$text = $this->grav['config']->get('plugins.{{ component.name|hyphenize }}.text_var');
|
||||
|
||||
// Get the current raw content
|
||||
$content = $e['page']->getRawContent();
|
||||
|
||||
// Prepend the output with the custom text and set back on the page
|
||||
$e['page']->setRawContent($text . "\n\n" . $content);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
enabled: true
|
||||
text_var: Custom Text added by the **{{ component.name|titleize }}** plugin (disable plugin to remove)
|
||||
@@ -0,0 +1,5 @@
|
||||
# v0.1.0
|
||||
## {{ "now"|date("m/d/Y") }}
|
||||
|
||||
1. [](#new)
|
||||
* ChangeLog started...
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) {{ "now"|date("Y") }} {{ component.author.name }}
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,7 @@
|
||||
# {{ component.name|titleize }} Plugin
|
||||
|
||||
The **{{ component.name|titleize }}** Theme is for [Grav CMS](http://github.com/getgrav/grav). This README.md file should be modified to describe the features, installation, configuration, and general usage of this theme.
|
||||
|
||||
## Description
|
||||
|
||||
{{ component.description }}
|
||||
@@ -0,0 +1,13 @@
|
||||
name: {{ component.name|titleize }}
|
||||
version: 0.1.0
|
||||
description: {{ component.description }}
|
||||
icon: rebel
|
||||
author:
|
||||
name: {{ component.author.name }}
|
||||
email: {{ component.author.email }}
|
||||
homepage: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}
|
||||
demo: http://demo.yoursite.com
|
||||
keywords: grav, theme, etc
|
||||
bugs: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}/issues
|
||||
readme: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}/blob/develop/README.md
|
||||
license: MIT
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 370 KiB |
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace Grav\Theme;
|
||||
|
||||
use Grav\Common\Theme;
|
||||
|
||||
class {{ component.name|camelize }}Theme extends Theme
|
||||
{
|
||||
// Access plugin events in this class
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
streams:
|
||||
schemes:
|
||||
theme:
|
||||
type: ReadOnlyStream
|
||||
prefixes:
|
||||
'':
|
||||
- user/themes/{{ component.name|hyphenize }}
|
||||
- user/themes/{{ component.extends }}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 332 KiB |
@@ -0,0 +1,5 @@
|
||||
# v0.1.0
|
||||
## {{ "now"|date("m/d/Y") }}
|
||||
|
||||
1. [](#new)
|
||||
* ChangeLog started...
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) {{ "now"|date("Y") }} {{ component.author.name }}
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,7 @@
|
||||
# {{ component.name|titleize }} Theme
|
||||
|
||||
The **{{ component.name|titleize }}** Theme is for [Grav CMS](http://github.com/getgrav/grav). This README.md file should be modified to describe the features, installation, configuration, and general usage of this theme.
|
||||
|
||||
## Description
|
||||
|
||||
{{ component.description }}
|
||||
@@ -0,0 +1,27 @@
|
||||
name: {{ component.name|titleize }}
|
||||
version: 0.1.0
|
||||
description: {{ component.description }}
|
||||
icon: rebel
|
||||
author:
|
||||
name: {{ component.author.name }}
|
||||
email: {{ component.author.email }}
|
||||
homepage: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}
|
||||
demo: http://demo.yoursite.com
|
||||
keywords: grav, theme, etc
|
||||
bugs: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}/issues
|
||||
readme: https://github.com/{{ component.author.name|hyphenize }}/grav-theme-{{ component.name|hyphenize }}/blob/develop/README.md
|
||||
license: MIT
|
||||
|
||||
form:
|
||||
validation: loose
|
||||
fields:
|
||||
dropdown.enabled:
|
||||
type: toggle
|
||||
label: Dropdown in Menu
|
||||
highlight: 1
|
||||
default: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.ENABLED
|
||||
0: PLUGIN_ADMIN.DISABLED
|
||||
validate:
|
||||
type: bool
|
||||
@@ -0,0 +1,175 @@
|
||||
/* Core Stuff */
|
||||
* {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-size: 1rem;
|
||||
line-height: 1.7;
|
||||
color: #606d6e;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
color: #454B4D;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #1F8CD6;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #175E91;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: #F0F0F0;
|
||||
margin: 1rem 0;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
border-left: 10px solid #eee;
|
||||
margin: 0;
|
||||
padding: 0 2rem;
|
||||
}
|
||||
|
||||
/* Utility Classes */
|
||||
.wrapper {
|
||||
margin: 0 3rem;
|
||||
}
|
||||
|
||||
.padding {
|
||||
padding: 3rem 1rem;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.text-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Content Styling */
|
||||
.header .padding {
|
||||
padding: 1rem 0;
|
||||
}
|
||||
|
||||
.header {
|
||||
background-color: #1F8DD6;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.header a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.header .logo {
|
||||
font-size: 1.7rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.footer {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
/* Menu Settings */
|
||||
.main-nav ul {
|
||||
text-align: center;
|
||||
letter-spacing: -1em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.main-nav ul li {
|
||||
display: inline-block;
|
||||
letter-spacing: normal;
|
||||
}
|
||||
|
||||
.main-nav ul li a {
|
||||
position: relative;
|
||||
display: block;
|
||||
line-height: 45px;
|
||||
color: #fff;
|
||||
padding: 0 20px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.main-nav > ul > li > a {
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/*Active dropdown nav item */
|
||||
.main-nav ul li:hover > a {
|
||||
background-color: #175E91;
|
||||
}
|
||||
|
||||
/* Selected Dropdown nav item */
|
||||
.main-nav ul li.selected > a {
|
||||
background-color: #fff;
|
||||
color: #175E91;
|
||||
}
|
||||
|
||||
/* Dropdown CSS */
|
||||
.main-nav ul li {position: relative;}
|
||||
|
||||
.main-nav ul li ul {
|
||||
position: absolute;
|
||||
background-color: #1F8DD6;
|
||||
min-width: 100%;
|
||||
text-align: left;
|
||||
z-index: 999;
|
||||
|
||||
display: none;
|
||||
}
|
||||
.main-nav ul li ul li {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Dropdown CSS */
|
||||
.main-nav ul li ul ul {
|
||||
left: 100%;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/* Active on Hover */
|
||||
.main-nav li:hover > ul {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Child Indicator */
|
||||
.main-nav .has-children > a {
|
||||
padding-right: 30px;
|
||||
}
|
||||
.main-nav .has-children > a:after {
|
||||
font-family: FontAwesome;
|
||||
content: '\f107';
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
right: 8px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.main-nav .has-children .has-children > a:after {
|
||||
content: '\f105';
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 370 KiB |
@@ -0,0 +1,5 @@
|
||||
{% extends 'partials/base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
{{ page.content }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,8 @@
|
||||
{% extends 'partials/base.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="lead text-center">
|
||||
<h1>Errror!</h1>
|
||||
{{ page.content }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,68 @@
|
||||
{% set theme_config = attribute(config.themes, config.system.pages.theme) %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ grav.language.getActive ?: theme_config.default_lang }}">
|
||||
<head>
|
||||
{% block head %}
|
||||
<meta charset="utf-8" />
|
||||
<title>{% if header.title %}{{ header.title|e('html') }} | {% endif %}{{ site.title|e('html') }}</title>
|
||||
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
{% include 'partials/metadata.html.twig' %}
|
||||
|
||||
<link rel="icon" type="image/png" href="{{ url('theme://images/logo.png') }}" />
|
||||
<link rel="canonical" href="{{ page.url(true, true) }}" />
|
||||
|
||||
{% block stylesheets %}
|
||||
{% do assets.addCss('http://yui.yahooapis.com/pure/0.6.0/pure-min.css', 100) %}
|
||||
{% do assets.addCss('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', 99) %}
|
||||
{% do assets.addCss('theme://css/custom.css', 98) %}
|
||||
{% endblock %}
|
||||
{{ assets.css() }}
|
||||
|
||||
{% block javascripts %}
|
||||
{% do assets.addJs('jquery', 100) %}
|
||||
{% endblock %}
|
||||
{{ assets.js() }}
|
||||
|
||||
{% endblock head%}
|
||||
</head>
|
||||
<body id="top" class="{{ page.header.body_classes }}">
|
||||
|
||||
{% block header %}
|
||||
<div class="header">
|
||||
<div class="wrapper padding">
|
||||
<a class="logo left" href="{{ base_url == '' ? '/' : base_url }}">
|
||||
<i class="fa fa-rebel"></i>
|
||||
{{ config.site.title }}
|
||||
</a>
|
||||
{% block header_navigation %}
|
||||
<nav class="main-nav">
|
||||
{% include 'partials/navigation.html.twig' %}
|
||||
</nav>
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<section id="body">
|
||||
<div class="wrapper padding">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
<div class="footer text-center">
|
||||
<div class="wrapper padding">
|
||||
<p><a href="http://getgrav.org">Grav</a> was <i class="fa fa-code"></i> with <i class="fa fa-heart"></i> by <a href="http://www.rockettheme.com">RocketTheme</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block bottom %}
|
||||
{{ assets.js('bottom') }}
|
||||
{% endblock %}
|
||||
|
||||
</body>
|
||||
@@ -0,0 +1,23 @@
|
||||
<nav class="navbar navbar-default navbar-inverse navbar-static-top" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#">Grav</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{% for page in pages.children %}
|
||||
{% if page.visible %}
|
||||
{% set current_page = (page.active or page.activeChild) ? 'active' : '' %}
|
||||
<li class="{{ current_page }}"><a href="{{ page.url }}">{{ page.menu }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -0,0 +1,3 @@
|
||||
{% for meta in page.metadata %}
|
||||
<meta {% if meta.name %}name="{{ meta.name }}" {% endif %}{% if meta.http_equiv %}http-equiv="{{ meta.http_equiv }}" {% endif %}{% if meta.charset %}charset="{{ meta.charset }}" {% endif %}{% if meta.property %}property="{{ meta.property }}" {% endif %}{% if meta.content %}content="{{ meta.content }}" {% endif %}/>
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,48 @@
|
||||
{% macro loop(page) %}
|
||||
{% for p in page.children.visible %}
|
||||
{% set current_page = (p.active or p.activeChild) ? 'selected' : '' %}
|
||||
{% if p.children.visible.count > 0 %}
|
||||
<li class="has-children {{ current_page }}">
|
||||
<a href="{{ p.url }}">
|
||||
{% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
|
||||
{{ p.menu }}
|
||||
</a>
|
||||
<ul>
|
||||
{{ _self.loop(p) }}
|
||||
</ul>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="{{ current_page }}">
|
||||
<a href="{{ p.url }}">
|
||||
{% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
|
||||
{{ p.menu }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
<ul>
|
||||
{% if theme_config.dropdown.enabled %}
|
||||
{{ _self.loop(pages) }}
|
||||
{% else %}
|
||||
{% for page in pages.children.visible %}
|
||||
{% set current_page = (page.active or page.activeChild) ? 'selected' : '' %}
|
||||
<li class="{{ current_page }}">
|
||||
<a href="{{ page.url }}">
|
||||
{% if page.header.icon %}<i class="fa fa-{{ page.header.icon }}"></i>{% endif %}
|
||||
{{ page.menu }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% for mitem in site.menu %}
|
||||
<li>
|
||||
<a href="{{ mitem.url }}">
|
||||
{% if mitem.icon %}<i class="fa fa-{{ mitem.icon }}"></i>{% endif %}
|
||||
{{ mitem.text }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace Grav\Theme;
|
||||
|
||||
use Grav\Common\Theme;
|
||||
|
||||
class {{ component.name|camelize }}Theme extends Theme
|
||||
{
|
||||
// Access plugin events in this class
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
enabled: true
|
||||
dropdown:
|
||||
enabled: true
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 332 KiB |
@@ -109,10 +109,18 @@ class InstallCommand extends ConsoleCommand
|
||||
$this->output->writeln('');
|
||||
|
||||
foreach ($this->config['git'] as $repo => $data) {
|
||||
$this->destination = rtrim($this->destination, DS);
|
||||
$path = $this->destination . DS . $data['path'];
|
||||
if (!file_exists($path)) {
|
||||
exec('cd "' . $this->destination . '" && git clone -b ' . $data['branch'] . ' ' . $data['url'] . ' ' . $data['path']);
|
||||
$this->output->writeln('<green>SUCCESS</green> cloned <magenta>' . $data['url'] . '</magenta> -> <cyan>' . $path . '</cyan>');
|
||||
exec('cd "' . $this->destination . '" && git clone -b ' . $data['branch'] . ' ' . $data['url'] . ' ' . $data['path'], $output, $return);
|
||||
|
||||
if (!$return) {
|
||||
$this->output->writeln('<green>SUCCESS</green> cloned <magenta>' . $data['url'] . '</magenta> -> <cyan>' . $path . '</cyan>');
|
||||
} else {
|
||||
$this->output->writeln('<red>ERROR</red> cloning <magenta>' . $data['url']);
|
||||
|
||||
}
|
||||
|
||||
$this->output->writeln('');
|
||||
} else {
|
||||
$this->output->writeln('<red>' . $path . ' already exists, skipping...</red>');
|
||||
|
||||
@@ -155,16 +155,6 @@ class InstallCommand extends ConsoleCommand
|
||||
}
|
||||
|
||||
if ($dependencies) {
|
||||
//First, check for Grav dependency. If a dependency requires Grav > the current version, abort and tell.
|
||||
if (isset($dependencies['grav'])) {
|
||||
if (version_compare($this->gpm->calculateVersionNumberFromDependencyVersion($dependencies['grav']), GRAV_VERSION) === 1) {
|
||||
//Needs a Grav update first
|
||||
$this->output->writeln("<red>One of the package dependencies requires Grav " . $dependencies['grav'] . ". Please update Grav first with `bin/gpm selfupgrade`</red>");
|
||||
return false;
|
||||
}
|
||||
unset($dependencies['grav']);
|
||||
}
|
||||
|
||||
try {
|
||||
$this->installDependencies($dependencies, 'install', "The following dependencies need to be installed...");
|
||||
$this->installDependencies($dependencies, 'update', "The following dependencies need to be updated...");
|
||||
|
||||
@@ -6,6 +6,7 @@ use Grav\Common\GPM\Upgrader;
|
||||
use Grav\Console\ConsoleCommand;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
* Class VersionCommand
|
||||
@@ -70,10 +71,26 @@ class VersionCommand extends ConsoleCommand
|
||||
}
|
||||
|
||||
} else {
|
||||
// get currently installed version
|
||||
$locator = \Grav\Common\Grav::instance()['locator'];
|
||||
$blueprints_path = $locator->findResource('plugins://' . $package . DS . 'blueprints.yaml');
|
||||
if (!file_exists($blueprints_path)) { // theme?
|
||||
$blueprints_path = $locator->findResource('themes://' . $package . DS . 'blueprints.yaml');
|
||||
if (!file_exists($blueprints_path)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$package_yaml = Yaml::parse(file_get_contents($blueprints_path));
|
||||
$currentlyInstalledVersion = $package_yaml['version'];
|
||||
|
||||
if (!$currentlyInstalledVersion) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$installed = $this->gpm->findPackage($package);
|
||||
if ($installed) {
|
||||
$name = $installed->name;
|
||||
$version = $installed->version;
|
||||
|
||||
if ($this->gpm->isUpdatable($package)) {
|
||||
$updatable = ' [updatable: v<green>' . $installed->available . '</green>]';
|
||||
@@ -84,7 +101,7 @@ class VersionCommand extends ConsoleCommand
|
||||
$updatable = $updatable ?: '';
|
||||
|
||||
if ($installed || $package == 'grav') {
|
||||
$this->output->writeln('You are running <white>' . $name . '</white> v<cyan>' . $version . '</cyan>' . $updatable);
|
||||
$this->output->writeln('You are running <white>' . $name . '</white> v<cyan>' . $currentlyInstalledVersion . '</cyan>' . $updatable);
|
||||
} else {
|
||||
$this->output->writeln('Package <red>' . $package . '</red> not found');
|
||||
}
|
||||
|
||||
@@ -71,6 +71,12 @@ class AssetsTest extends \Codeception\TestCase\Test
|
||||
'group' => 'head'
|
||||
], reset($array));
|
||||
|
||||
//test addCss() adding asset to a separate group, and with an alternate rel attribute
|
||||
$this->assets->reset();
|
||||
$this->assets->addCSS('test.css', ['group' => 'alternate']);
|
||||
$css = $this->assets->css('alternate', ['rel' => 'alternate']);
|
||||
$this->assertSame('<link href="/test.css" type="text/css" rel="alternate" />' . PHP_EOL, $css);
|
||||
|
||||
//test addJs()
|
||||
$this->assets->reset();
|
||||
$this->assets->addJs('test.js');
|
||||
|
||||
@@ -586,6 +586,8 @@ class ParsedownTest extends \Codeception\TestCase\Test
|
||||
$this->parsedown->text('[tel](tel:123-555-12345)'));
|
||||
$this->assertSame('<p><a href="sms:123-555-12345">sms</a></p>',
|
||||
$this->parsedown->text('[sms](sms:123-555-12345)'));
|
||||
$this->assertSame('<p><a href="rdp://ts.example.com">ts.example.com</a></p>',
|
||||
$this->parsedown->text('[ts.example.com](rdp://ts.example.com)'));
|
||||
}
|
||||
|
||||
public function testSpecialProtocolsSubDir()
|
||||
@@ -600,6 +602,8 @@ class ParsedownTest extends \Codeception\TestCase\Test
|
||||
$this->parsedown->text('[tel](tel:123-555-12345)'));
|
||||
$this->assertSame('<p><a href="sms:123-555-12345">sms</a></p>',
|
||||
$this->parsedown->text('[sms](sms:123-555-12345)'));
|
||||
$this->assertSame('<p><a href="rdp://ts.example.com">ts.example.com</a></p>',
|
||||
$this->parsedown->text('[ts.example.com](rdp://ts.example.com)'));
|
||||
}
|
||||
|
||||
public function testSpecialProtocolsSubDirAbsoluteUrl()
|
||||
@@ -615,6 +619,8 @@ class ParsedownTest extends \Codeception\TestCase\Test
|
||||
$this->parsedown->text('[tel](tel:123-555-12345)'));
|
||||
$this->assertSame('<p><a href="sms:123-555-12345">sms</a></p>',
|
||||
$this->parsedown->text('[sms](sms:123-555-12345)'));
|
||||
$this->assertSame('<p><a href="rdp://ts.example.com">ts.example.com</a></p>',
|
||||
$this->parsedown->text('[ts.example.com](rdp://ts.example.com)'));
|
||||
}
|
||||
|
||||
public function testReferenceLinks()
|
||||
|
||||
@@ -55,13 +55,12 @@ class TwigExtensionTest extends \Codeception\TestCase\Test
|
||||
public function testNicetimeFilter()
|
||||
{
|
||||
$now = time();
|
||||
$threeSeconds = time() - (3);
|
||||
$threeMinutes = time() - (60*3);
|
||||
$threeHours = time() - (60*60*3);
|
||||
$threeDays = time() - (60*60*24*3);
|
||||
$threeMonths = time() - (60*60*24*30*3);
|
||||
$threeYears = time() - (60*60*24*365*3);
|
||||
$measures = ['seconds','minutes','hours','days','months','years'];
|
||||
$measures = ['minutes','hours','days','months','years'];
|
||||
|
||||
$this->assertSame('No date provided', $this->twig_ext->nicetimeFilter(null));
|
||||
|
||||
@@ -69,8 +68,6 @@ class TwigExtensionTest extends \Codeception\TestCase\Test
|
||||
$time = 'three' . ucfirst($measures[$i]);
|
||||
$this->assertSame('3 ' . $measures[$i] . ' ago', $this->twig_ext->nicetimeFilter($$time));
|
||||
}
|
||||
|
||||
$this->assertSame('3 secs ago', $this->twig_ext->nicetimeFilter($threeSeconds, false));
|
||||
}
|
||||
|
||||
public function testSafeEmailFilter()
|
||||
|
||||
@@ -273,19 +273,16 @@ class UriTest extends \Codeception\TestCase\Test
|
||||
|
||||
public function testEnvironment()
|
||||
{
|
||||
$address = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '::1';
|
||||
if ($this->uri->host() == 'localhost' || $address == '::1' || $address == '127.0.0.1') {
|
||||
$address = 'localhost';
|
||||
}
|
||||
|
||||
$this->uri->initializeWithURL('http://localhost/a-page')->init();
|
||||
$this->assertSame($address, $this->uri->environment());
|
||||
$this->assertSame('localhost', $this->uri->environment());
|
||||
$this->uri->initializeWithURL('http://127.0.0.1/a-page')->init();
|
||||
$this->assertSame('localhost', $this->uri->environment());
|
||||
$this->uri->initializeWithURL('http://localhost:8080/a-page')->init();
|
||||
$this->assertSame($address, $this->uri->environment());
|
||||
$this->assertSame('localhost', $this->uri->environment());
|
||||
$this->uri->initializeWithURL('http://foobar.it:443/a-page')->init();
|
||||
$this->assertSame($address, $this->uri->environment());
|
||||
$this->assertSame('foobar.it', $this->uri->environment());
|
||||
$this->uri->initializeWithURL('https://google.com/a-page')->init();
|
||||
$this->assertSame($address, $this->uri->environment());
|
||||
$this->assertSame('google.com', $this->uri->environment());
|
||||
}
|
||||
|
||||
public function testBasename()
|
||||
|
||||
@@ -1,8 +1,31 @@
|
||||
:8080
|
||||
gzip
|
||||
fastcgi / 127.0.0.1:9000 php
|
||||
|
||||
# Begin - Security
|
||||
# deny all direct access for these folders
|
||||
rewrite {
|
||||
regexp .*
|
||||
ext /
|
||||
to /index.php?_url={uri}
|
||||
r /(.git|cache|bin|logs|backups|tests)/.*$
|
||||
status 403
|
||||
}
|
||||
# deny running scripts inside core system folders
|
||||
rewrite {
|
||||
r /(system|vendor)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$
|
||||
status 403
|
||||
}
|
||||
# deny running scripts inside user folder
|
||||
rewrite {
|
||||
r /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$
|
||||
status 403
|
||||
}
|
||||
# deny access to specific files in the root folder
|
||||
rewrite {
|
||||
r /(LICENSE.txt|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess)
|
||||
status 403
|
||||
}
|
||||
## End - Security
|
||||
|
||||
# global rewrite should come last.
|
||||
rewrite {
|
||||
to {path} {path}/ /index.php?_url={uri}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user