This commit is contained in:
2019-11-28 17:14:34 +01:00
parent cb1835c362
commit d5807b0566
383 changed files with 3708 additions and 616 deletions
+7
View File
@@ -73,3 +73,10 @@ RewriteRule ^(LICENSE\.txt|composer\.lock|composer\.json|\.htaccess)$ error [F]
Options -Indexes
DirectoryIndex index.php index.html index.htm
# End - Prevent Browsing and Set Default Resources
RewriteCond %{HTTP_HOST} !^vocurations\.com$ [NC]
RewriteRule ^(.*)$ https://vocurations.com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
+15
View File
@@ -1,3 +1,18 @@
# v1.6.17
## 11/06/2019
1. [](#new)
* Added working ETag (304 Not Modified) support based on the final rendered HTML
1. [](#improved)
* Safer file handling + customizable null char replacement in `CsvFormatter::decode()`
* Change of Behavior: `Inflector::hyphenize` will now automatically trim dashes at beginning and end of a string.
* Change in Behavior for `Folder::all()` so no longer fails if trying to copy non-existent dot file [#2581](https://github.com/getgrav/grav/pull/2581)
* renamed composer `test-plugins` script to `phpstan-plugins` to be more explicit [#2637](https://github.com/getgrav/grav/pull/2637)
1. [](#bugfix)
* Fixed PHP 7.1 bug in FlexMedia
* Fix cache image generation when using cropResize [#2639](https://github.com/getgrav/grav/pull/2639)
* Fix `array_merge()` exception with non-array page header metadata [#2701](https://github.com/getgrav/grav/pull/2701)
# v1.6.16
## 09/19/2019
+14 -8
View File
@@ -2,7 +2,13 @@
"name": "getgrav/grav",
"type": "project",
"description": "Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS",
"keywords": ["cms","flat-file cms","flat cms","flatfile cms","php"],
"keywords": [
"cms",
"flat-file cms",
"flat cms",
"flatfile cms",
"php"
],
"homepage": "https://getgrav.org",
"license": "MIT",
"require": {
@@ -16,14 +22,11 @@
"symfony/polyfill-iconv": "^1.9",
"symfony/polyfill-php72": "^1.9",
"symfony/polyfill-php73": "^1.9",
"psr/simple-cache": "^1.0",
"psr/http-message": "^1.0",
"psr/http-server-middleware": "^1.0",
"kodus/psr7-server": "*",
"nyholm/psr7": "^1.0",
"twig/twig": "~1.40",
"erusev/parsedown": "1.6.4",
"erusev/parsedown-extra": "~0.7",
@@ -36,7 +39,6 @@
"doctrine/collections": "^1.5",
"guzzlehttp/psr7": "^1.4",
"filp/whoops": "~2.2",
"matthiasmullie/minify": "^1.3",
"monolog/monolog": "~1.0",
"gregwar/image": "2.*",
@@ -83,10 +85,14 @@
"psr-4": {
"Grav\\": "system/src/Grav"
},
"files": ["system/defines.php"]
"files": [
"system/defines.php"
]
},
"archive": {
"exclude": ["VERSION"]
"exclude": [
"VERSION"
]
},
"scripts": {
"api-16": "vendor/bin/phpdoc-md generate system/src > user/pages/14.api/default.16.md",
@@ -94,7 +100,7 @@
"post-create-project-cmd": "bin/grav install",
"phpstan": "vendor/bin/phpstan analyse -l 2 -c ./tests/phpstan/phpstan.neon system/src --memory-limit=256M",
"phpstan-framework": "vendor/bin/phpstan analyse -l 5 -c ./tests/phpstan/phpstan.neon system/src/Grav/Framework --memory-limit=256M",
"test-plugins": "vendor/bin/phpstan analyse -l 0 -c ./tests/phpstan/plugins.neon user/plugins --memory-limit=256M",
"phpstan-plugins": "vendor/bin/phpstan analyse -l 0 -c ./tests/phpstan/plugins.neon user/plugins --memory-limit=256M",
"test": "vendor/bin/codecept run unit",
"test-windows": "vendor\\bin\\codecept run unit"
},
+1 -1
View File
@@ -8,7 +8,7 @@
// Some standard defines
define('GRAV', true);
define('GRAV_VERSION', '1.6.16');
define('GRAV_VERSION', '1.6.17');
define('GRAV_TESTING', false);
define('DS', '/');
+1 -1
View File
@@ -235,7 +235,7 @@ abstract class Folder
/** @var \RecursiveDirectoryIterator $file */
foreach ($iterator as $file) {
// Ignore hidden files.
if (strpos($file->getFilename(), '.') === 0) {
if (strpos($file->getFilename(), '.') === 0 && $file->isFile()) {
continue;
}
if (!$folders && $file->isDir()) {
+13 -1
View File
@@ -247,9 +247,21 @@ class Grav extends Container
$collection = new RequestHandler($this->middleware, $default, $container);
$response = $collection->handle($this['request']);
$body = $response->getBody();
// Handle ETag and If-None-Match headers.
if ($response->getHeaderLine('ETag') === '1') {
$etag = md5($body);
$response = $response->withHeader('ETag', $etag);
if ($this['request']->getHeaderLine('If-None-Match') === $etag) {
$response = $response->withStatus(304);
$body = '';
}
}
$this->header($response);
echo $response->getBody();
echo $body;
$debugger->render();
+2
View File
@@ -193,6 +193,8 @@ class Inflector
$regex3 = preg_replace('/([0-9])([A-Z])/', '\1-\2', $regex2);
$regex4 = preg_replace('/[^A-Z^a-z^0-9]+/', '-', $regex3);
$regex4 = trim($regex4, '-');
return strtolower($regex4);
}
@@ -125,5 +125,5 @@ trait MediaTrait
/**
* @return string
*/
abstract protected function getCacheKey();
abstract protected function getCacheKey(): string;
}
+4 -4
View File
@@ -529,9 +529,9 @@ class Page implements PageInterface
$headers['Last-Modified'] = $last_modified_date;
}
// Calculate ETag based on the raw file
// Ask Grav to calculate ETag from the final content.
if ($this->eTag()) {
$headers['ETag'] = '"' . md5($this->raw() . $this->modified()).'"';
$headers['ETag'] = '1';
}
// Set Vary: Accept-Encoding header
@@ -1200,7 +1200,7 @@ class Page implements PageInterface
/**
* @return string
*/
protected function getCacheKey()
protected function getCacheKey(): string
{
return $this->id();
}
@@ -1696,7 +1696,7 @@ class Page implements PageInterface
// Get initial metadata for the page
$metadata = array_merge($metadata, Grav::instance()['config']->get('site.metadata'));
if (isset($this->header->metadata)) {
if (isset($this->header->metadata) && is_array($this->header->metadata)) {
// Merge any site.metadata settings in with page metadata
$metadata = array_merge($metadata, $this->header->metadata);
}
@@ -79,10 +79,28 @@ class CsvFormatter extends AbstractFormatter
// Get the field names
$header = str_getcsv(array_shift($lines), $delimiter);
// Allow for replacing a null string with null/empty value
$null_replace = $this->getConfig('null');
// Get the data
$list = [];
foreach ($lines as $line) {
$list[] = array_combine($header, str_getcsv($line, $delimiter));
$line = null;
try {
foreach ($lines as $line) {
if (!empty($line)) {
$csv_line = str_getcsv($line, $delimiter);
if ($null_replace) {
array_walk($csv_line, function(&$el) use ($null_replace) {
$el = str_replace($null_replace, null, $el);
});
}
$list[] = array_combine($header, $csv_line);
}
}
} catch (\Exception $e) {
throw new \Exception('Badly formatted CSV line: ' . $line);
}
return $list;
@@ -342,5 +342,5 @@ trait FlexMediaTrait
abstract public function getFlexDirectory(): FlexDirectory;
abstract public function getStorageKey();
abstract public function getStorageKey(): string;
}
Binary file not shown.
@@ -0,0 +1,2 @@
.DS_Store
/.idea
@@ -0,0 +1,237 @@
# v1.14.2
## 12/07/2018
1. [](#improved)
* Optimize, cleanup and remove typos [#163](https://github.com/getgrav/grav-plugin-simplesearch/pull/163)
* Removed `blog` as default filter [#166](https://github.com/getgrav/grav-plugin-simplesearch/pull/166)
* Polish translation [#144](https://github.com/getgrav/grav-plugin-simplesearch/pull/144)
* Kazakh translation [#153](https://github.com/getgrav/grav-plugin-simplesearch/pull/153)
* Spelling corrections [#145](https://github.com/getgrav/grav-plugin-simplesearch/pull/145)
1. [](#bugfix)
* Fix JS to work with IE11 [#161](https://github.com/getgrav/grav-plugin-simplesearch/pull/161)
* Updated javascript to be compatible with IE11 [#161](https://github.com/getgrav/grav-plugin-simplesearch/pull/161)
* Ensure `$values` is an array to prevent PHP error on implode [#146](https://github.com/getgrav/grav-plugin-simplesearch/pull/146)
# v1.14.1
## 01/11/2018
1. [](#bugfix)
* Fix for Gantry5 themes
# v1.14.0
## 01/08/2018
1. [](#new)
* Added Danish translations [#127](https://github.com/getgrav/grav-plugin-simplesearch/pull/127)
1. [](#improved)
* New option to disable built-in JS [#130](https://github.com/getgrav/grav-plugin-simplesearch/pull/130)
* Changed elipsis from `...` to `…` [#133](https://github.com/getgrav/grav-plugin-simplesearch/pull/133)
* Added missing French translations [#136](https://github.com/getgrav/grav-plugin-simplesearch/pull/136)
* Added missing German translations [#128](https://github.com/getgrav/grav-plugin-simplesearch/pull/128)
1. [](#bugfix)
* Escaped `query` in Twig templates for XSS protection
# v1.13.0
## 07/26/2017
1. [](#improved)
* Support for multiple forms and fields in the same page
1. [](#bugfix)
* Fix typo in `SEARCH_FIELD_MINIUMUM_CHARACTERS` translation string
* Fixed validation and JS submission
* Separated JS from inline to file
* Fixed issue with min query length always enforced. It is now possible to have no minimum length by setting to `false` or `0`
# v1.12.0
## 05/31/2017
1. [](#new)
* Added option to switch between Rendered HTML and Raw Markdown content searching. Raw Markdown is faster than default.
# v1.11.0
## 05/29/2017
1. [](#new)
* Allow to use "@none"/"none@" in the "Category filter" in Admin to allow removing the filter
# v1.10.2
## 04/19/2017
1. [](#bugfix)
* Only check ACL if the Login plugin is installed [#112](https://github.com/getgrav/grav-plugin-simplesearch/pull/112)
# v1.10.1
## 04/11/2017
1. [](#new)
* Added Portuguese translation
* Add hint when the minimum search field length is not matched
1. [](#bugfix)
* Default `ignore_accented_characters` to false
* Fallback to regular search if searching with `ignore_accented_characters` on an unsupported charset raises an exception [#107](https://github.com/getgrav/grav-plugin-simplesearch/issues/107)
* Check ACL before listing a page in the search results [#102](https://github.com/getgrav/grav-plugin-simplesearch/pull/102)
* Fix with ignoring `min_query_length` when using the button [#99](https://github.com/getgrav/grav-plugin-simplesearch/issues/99)
# v1.10.0
## 01/23/2017
1. [](#new)
* Added spanish translation
* Added japanese translation
* Added persian translation
1. [](#improved)
* Added option to switch between Rendered HTML and Raw Markdown content searching. Raw Markdown is faster than default.
* Removed jQuery dependency, fixes issue when jQuery is loaded in the footer [#57](https://github.com/getgrav/grav-plugin-simplesearch/pull/57)
* Added option to ignore accents when searching [#89](https://github.com/getgrav/grav-plugin-simplesearch/pull/89)
1. [](#bugfix)
* Remove unpublished and un-routable pages from the result set
* Fixed issue when using @self as route
* Fix overloaded property issue when searching on a page with simplesearch header [#80](https://github.com/getgrav/grav-plugin-simplesearch/issues/80)
* Fix issue with empty string and leading commas [#71](https://github.com/getgrav/grav-plugin-simplesearch/issues/71)
# v1.9.3
## 10/19/2016
1. [](#bugfix)
* Fixed an issue with invalid syntax in `route: @self` logic
# v1.9.2
## 09/19/2016
1. [](#bugfix)
* Reverted change in events - causing problems
* Reverted fix for `route: @self`, breaking `filter: @self` (used in getgrav.org)
# v1.9.1
## 09/08/2016
1. [](#bugfix)
* Fixed logic to use `onPageInitialized` event
# v1.9.0
## 09/06/2016
1. [](#new)
* Multiple search boxes support [#52](https://github.com/getgrav/grav-plugin-simplesearch/pull/52)
* Added Croatian and Russian translation
1. [](#improved)
* Added support for Grav's autoescape twig setting
1. [](#bugfix)
* Fix searching on `@self `[#53](https://github.com/getgrav/grav-plugin-simplesearch/pull/53)
# v1.8.0
## 07/14/2016
1. [](#new)
* Added dutch and romanian
1. [](#bugfix)
* Fix translating the search input placeholder
# v1.7.1
## 05/03/2016
1. [](#new)
* Added configurable `min length` option for how many characters needed before you can search
# v1.7.0
## 04/30/2016
1. [](#new)
* Added support for taxonomy searching in regular searches (not just on-page searches as was the case previously)
* Added support for `route: '@self'` to use the route of the current page without specifying it.
* Added display search button option - #33
* Refactored code for clarity
# v1.6.2
## 01/06/2016
1. [](#improved)
* Improved the README instructions on how to save all pages
# v1.6.1
## 11/11/2015
1. [](#improved)
* Strip HTML tags from title and content before searching
# v1.6.0
## 11/11/2015
1. [](#new)
* Removing `filter:` from configuration will search **ALL** pages
# v1.5.1
## 10/15/2015
1. [](#improved)
* Minor performance fix
* Updated README.md with more help
1. [](#bugfix)
* Fix for special character searches
# v1.5.0
## 10/07/2015
1. [](#new)
* Allow simplesearch to work with on-page collections
# v1.4.1
## 08/31/2015
1. [](#improved)
* Fixed some blueprint issues
# v1.4.0
## 08/25/2015
1. [](#improved)
* Added blueprints for Grav Admin plugin
* Added results sorting
# v1.3.0
## 07/21/2015
1. [](#new)
* Added support for modular pages in results
# v1.2.7
## 07/17/2015
1. [](#bugfix)
* Fixed "Undefined index: extension" error
# v1.2.6
## 07/14/2015
1. [](#bugfix)
* Fixed URL issue that showed up with multi-languages
# v1.2.5
## 04/24/2015
1. [](#bugfix)
* Fixed issue with broken image
# v1.2.4
## 02/19/2015
2. [](#improved)
* Implemented new `param_sep` variable from Grav 0.9.18
# v1.2.3
## 01/06/2015
1. [](#improved)
* Improved `README.md` file with more information
# v1.2.2
## 12/21/2014
1. [](#bugfix)
* Fix for invalid base_url in some instances
# v1.2.1
## 11/30/2014
1. [](#new)
* ChangeLog started...
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Grav
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,193 @@
# Grav SimpleSearch Plugin
![SimpleSearch](assets/readme_1.png)
`SimpleSearch` is a simple, yet very powerful [Grav][grav] plugin that adds search capabilities to your Grav instance. By default it can search Page **Titles**, **Content** and also **Taxonomy**.
# Installation
Installing the SimpleSearch plugin can be done in one of two ways. Our GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.
## GPM Installation (Preferred)
The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's Terminal (also called the command line). From the root of your Grav install type:
bin/gpm install simplesearch
This will install the SimpleSearch plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/simplesearch`.
## Manual Installation
To install this plugin, just download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `simplesearch`. You can find these files either on [GitHub](https://github.com/getgrav/grav-plugin-simplesearch) or via [GetGrav.org](http://getgrav.org/downloads/plugins#extras).
You should now have all the plugin files under
/your/site/grav/user/plugins/simplesearch
> NOTE: This plugin is a modular component for Grav which requires [Grav](http://github.com/getgrav/grav), the [Error](https://github.com/getgrav/grav-plugin-error) and [Problems](https://github.com/getgrav/grav-plugin-problems) plugins, and a theme to be installed in order to operate.
# Config Options
To effectively use the plugin, you first need to create an override config. To do so, create the folder `user/config/plugins` (if it doesn't exist already) and copy the [simplesearch.yaml][simplesearch] config file in there.
```
enabled: true
built_in_css: true
built_in_js: true
display_button: false
min_query_length: 3
route: /search
search_content: rendered
template: simplesearch_results
filters:
category: blog
filter_combinator: and
ignore_accented_characters: false
order:
by: date
dir: desc
```
By creating the configuration file: `user/config/plugins/simplesearch.yaml` you have effectively created a site-wide configuration for SimpleSearch. However, you may want to have multiple searches.
> NOTE: If you want to search **ALL PAGES** just keep the `filters` section empty.
To accomplish multiple search types in a single site, you should use **page-based** configuration. This is simple to do, simply provide any or all of the configuration options under a `simplesearch:` header in your page frontmatter. For example:
```
simplesearch:
route: @self
filters:
- @self
- @taxonomy: [tag]
filter_combinator: and
```
These page headers will only be taken into account if the search route points to this page. For example: here the route points to `@self` which in turn resolves to `/blog`. You can also specify the route explicitly with `route: /blog` if you so choose. This header is within the `/user/pages/blog/blog.md` file. We will cover this self-controlled form of search handling below.
# Usage
There are two approaches to using SimpleSearch.
## 1. Standalone Search Page
This is the traditional approach and involves having a searchbox 'somewhere' on your site. When you search you are shown a new page that displays the search results. On this page you will see a summary of the results and be able to click a link to visit each applicable page within your site. Think about how **Google** and other traditional search engines work.
After installing the SimpleSearch plugin, you can add a simple **searchbox** to your site by including the provided twig template. Or copy it from the plugin to your theme and customize it as you please:
```
{% include 'partials/simplesearch_searchbox.html.twig' %}
```
By default the **simplesearch_searchbox** Twig template uses the `route` as defined in the configuration. The SimpleSearch plugin uses this route and then appends a `query:` parameter to create the following final URL.
```
http://yoursite.com/search/query:something
```
1. `/search`: This is the **route** setting and it can be changed
2. `/query:something`: This is the query itself, where `something` is what you are searching for.
The plugin actively looks for URLs requested that match the configured `route` and if so it intercepts the call and renders the results template as specified by the configuration options, (defaults to `simplesearch_results.html.twig` as provided by the plugin).
With this approach, the filters control which pages are searched. You can have multiple taxonomy filters here, and can configure the combinator to require **any** match (via `or`) or require **all** conditions to match (via `and`).
You can also completely customize the look and feel of the results by overriding the template. There are two methods to do this.
1. Copy the file [templates/simplesearch_results.html.twig][results] under your theme templates `user/themes/_your-theme_/templates/` and customize it.
2. Create your very own results output. For this you need to change the `template` reference in the config (let's say **mysearch_results**). In your theme you would then create the new template under `user/themes/_your-theme_/templates/mysearch_results.html.twig` and write your customizations. This is how it looks by default:
```
{% extends 'partials/simplesearch_base.html.twig' %}
{% block content %}
<div class="content-padding">
<h1 class="search-header">Search Results</h1>
<h3>Query: "{{ query }}" - Found {{ search_results.count }} {{ 'Item'|pluralize(search_results.count) }}</h3>
{% for page in search_results %}
{% include 'partials/simplesearch_item.html.twig' with {'page':page} %}
{% endfor %}
</div>
{% endblock %}
```
## 2. Self-Controlled Search Page
This is a new feature of SimpleSearch and it's a very useful and simple way to provide a 'filter' like search of a collection listing page. In this example, we will assume you have a Blog listing page you wish to be able to search and filter based on a search box.
To accomplish this, you need to use the page-based configuration as described above, and configure multiple filters, `@self` to use the page's content collection: http://learn.getgrav.org/content/headers#collection-headers
```
content:
items: @self.children
order:
by: date
dir: desc
```
This will mean the search will only search pages that this page already is using for the collection. The Items could be anything the page collections support:
For further help with the `filters` and `order` settings, please refer to our [Taxonomy][taxonomy] and [Headers][headers] documentation.
Multiple filters can be provided, and in order to search in the page's **Tag** field you would add `- @taxonomy: [tag]` as shown in the configuration example above.
The only thing needed to provide this functionality is a search box that points to the current page and appends the `query` parameter. You can again simple include the sample `simplesearch_searchbox.html.twig` file or add your own. Because the route is configured to point to the blog page, and because the blog page already iterates over a collection, SimpleSearch will replace the page collection with the search-filtered collection. No results page is required.
## Performance
Simplesearch is not a full-fledged index-powered search engine. It merely iterates over the pages and searches the content and title for matching strings. That's it. This is not going to result in screaming fast searches if your site has lots of content. One way to optimize things a little is to change the `search_content` configuration option from `rendered` to `raw`. This means the `rawMarkdown()` method is used rather than the `content()` method, to retrieve the page content, and in turn means plugin events, markdown processing, image processing, and other time-consuming tasks are not performed. This can often yield adequate search results without the need for all this extra work.
## Searching Taxonomy
By default **SimpleSearch** will search in the **Title**, **Content**, and **Taxonomy**. All taxonomy will be searched unless you provide a **taxonomy filter** either in the page, or in the global plugin configuration:
```
filters:
- @taxonomy: [tag]
```
This will ensure that only **tag** taxonomy types will be searched for the query.
```
filters:
- @taxonomy: [tag, author]
```
Will ensure that both **tag** and **author** taxonomy types are searched.
As **all taxonomy types are searched by default**, in order to stop searching into taxonomies completely simply set the filter to false:
```
filters:
- '@taxonomy': false
```
## Ignoring accented characters
You can tell Simplesearch to return a positive value when searching for characters that have an accent. So `éè` for example will be both equivalent to `e`.
To do so, enable _Ignore accented characters_ in Admin, or manually set `ignore_accented_characters` to true in the plugin configuration.
The `en_US` locale must be installed on the server.
# Updating
As development for SimpleSearch continues, new versions may become available that add additional features and functionality, improve compatibility with newer Grav releases, and generally provide a better user experience. Updating SimpleSearch is easy, and can be done through Grav's GPM system, as well as manually.
## GPM Update (Preferred)
The simplest way to update this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm). You can do this with this by navigating to the root directory of your Grav install using your system's Terminal (also called command line) and typing the following:
bin/gpm update simplesearch
This command will check your Grav install to see if your SimpleSearch plugin is due for an update. If a newer release is found, you will be asked whether or not you wish to update. To continue, type `y` and hit enter. The plugin will automatically update and clear Grav's cache.
> Note: Any changes you have made to any of the files listed under this directory will also be removed and replaced by the new set. Any files located elsewhere (for example a YAML settings file placed in `user/config/plugins`) will remain intact.
[taxonomy]: http://learn.getgrav.org/content/taxonomy
[headers]: http://learn.getgrav.org/content/headers
[grav]: http://github.com/getgrav/grav
[simplesearch]: simplesearch.yaml
[results]: templates/simplesearch_results.html.twig
Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g><path d="M883.5,990L635.2,734.7c0,0-142.7,71.6-227.3,71.6C188.2,806.3,10,628.1,10,408.1C10,188.2,188.1,10,407.8,10c219.9,0,398,178.2,398,398.1c0,82.1-67.6,221.6-67.6,221.6L990,883.5 M692,404.1c0-158.8-128.8-287.6-287.7-287.6c-159,0-287.8,128.8-287.8,287.6c0,158.9,128.8,287.7,287.8,287.7C563.2,691.8,692,562.9,692,404.1z M429.2,236.3L429.2,236.3c-118.3,0-192.9,74.7-192.9,193.1l0,0c-10,0-41.5,0-51.9,0l0,0c0-135.3,109.7-245,244.9-245l0,0C429.2,194.9,429.2,226.4,429.2,236.3z"/></g>
</svg>

After

Width:  |  Height:  |  Size: 972 B

@@ -0,0 +1,144 @@
name: SimpleSearch
version: 1.14.2
description: "Don't be fooled, the **SimpleSearch** plugin provides a **fast** and highly **configurable** way to search your content."
icon: search
author:
name: Team Grav
email: devs@getgrav.org
url: http://getgrav.org
homepage: https://github.com/getgrav/grav-plugin-simplesearch
demo: http://demo.getgrav.org/blog-skeleton
keywords: simplesearch, plugin, search, page, content, find
bugs: https://github.com/getgrav/grav-plugin-simplesearch/issues
license: MIT
form:
validation: strict
fields:
enabled:
type: toggle
label: PLUGIN_ADMIN.PLUGIN_STATUS
highlight: 1
default: 0
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
search_content:
type: select
size: medium
classes: fancy
label: Search Content
default: rendered
options:
rendered: Rendered Content (Slower)
raw: Raw Markdown Content (Faster)
built_in_css:
type: toggle
label: Use built in CSS
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
built_in_js:
type: toggle
label: Use built in JavaScript
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
display_button:
type: toggle
label: Display Search Button
highlight: 0
default: 0
options:
1: Enabled
0: Disabled
validate:
type: bool
ignore_accented_characters:
type: toggle
label: Ignore accented characters
help: If enabled, search terms will match accented characters regardless to their diacritics i.e. search results will show up for "cafe" and "café" no matter how you typed it.
highlight: 0
default: 0
options:
1: Enabled
0: Disabled
validate:
type: bool
min_query_length:
type: text
size: x-small
label: Minimum query length
help: The mimimum number of characters needed before serach can be submitted
validate:
type: number
min: 0
route:
type: text
size: medium
label: Route
default: /random
help: Default route of the simplesearch plugin
template:
type: text
size: medium
label: Template
default: simplesearch_results
help: Name of the template for the search results
filters.category:
type: selectize
label: Category filter
help: Comma separated list of category names. Enter "@none" to search in all pages.
validate:
type: commalist
filter_combinator:
type: select
size: medium
classes: fancy
label: Filter Combinator
default: and
options:
and: And - Boolean &&
or: Or - Boolean ||
order.by:
type: select
size: long
classes: fancy
label: PLUGIN_ADMIN.DEFAULT_ORDERING
help: PLUGIN_ADMIN.DEFAULT_ORDERING_HELP
options:
default: PLUGIN_ADMIN.DEFAULT_ORDERING_DEFAULT
folder: PLUGIN_ADMIN.DEFAULT_ORDERING_FOLDER
title: PLUGIN_ADMIN.DEFAULT_ORDERING_TITLE
date: PLUGIN_ADMIN.DEFAULT_ORDERING_DATE
order.dir:
type: toggle
label: PLUGIN_ADMIN.DEFAULT_ORDER_DIRECTION
highlight: asc
default: desc
help: PLUGIN_ADMIN.DEFAULT_ORDER_DIRECTION_HELP
options:
asc: PLUGIN_ADMIN.ASCENDING
desc: PLUGIN_ADMIN.DESCENDING
@@ -0,0 +1,42 @@
.search-wrapper .search-input {
width: 80%;
display: inline-block;
}
.search-submit {
display: inline-block;
border-radius: 4px;
background: #eee;
border: 1px solid #ccc;
vertical-align: top;
}
.search-submit img {
width: 20px;
vertical-align: middle;
}
.search-image {
float: left;
}
.search-item {
margin-left: 130px;
margin-bottom: 50px;
}
.search-item p {
margin: 0;
}
.search-title h3 {
margin: 0;
}
.search-details {
font-size: 13px;
}
.search-row:last-child hr {
display: none;
}
@@ -0,0 +1,15 @@
{
"project":"grav-plugin-simplesearch",
"platforms":{
"grav":{
"nodes":{
"plugin":[
{
"source":"/",
"destination":"/user/plugins/simplesearch"
}
]
}
}
}
}
@@ -0,0 +1,32 @@
((function(){
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}
var findAncestor = function(el, selector) {
while ((el = el.parentElement) && !((el.matches || el.matchesSelector).call(el, selector))) {}
return el;
};
var fields = document.querySelectorAll('input[name="searchfield"][data-search-input]');
Array.prototype.forEach.call(fields, function(field) {
var form = findAncestor(field, 'form[data-simplesearch-form]'),
min = field.getAttribute('min') || false,
location = field.getAttribute('data-search-input'),
separator = field.getAttribute('data-search-separator');
if (min) {
var invalid = field.getAttribute('data-search-invalid');
field.addEventListener('keydown', function() {
field.setCustomValidity(field.value.length >= min ? '' : invalid);
});
}
form.addEventListener('submit', function(event) {
event.preventDefault();
if (field.checkValidity()) {
window.location.href = location + separator + field.value;
}
});
});
})());
@@ -0,0 +1,127 @@
en:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Search …"
SEARCH_RESULTS: "Search Results"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Query: <strong>%s</strong> found one result"
SEARCH_RESULTS_SUMMARY_PLURAL: "Query: <strong>%s</strong> found %s results"
SEARCH_FIELD_MINIMUM_CHARACTERS: "Please add at least %s characters"
ro:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Caută …"
SEARCH_RESULTS: "Rezultatele căutării"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Căutarea: <strong>%s</strong> a găsit un rezultat"
SEARCH_RESULTS_SUMMARY_PLURAL: "Căutarea: <strong>%s</strong> a găsit %s rezultate"
de:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Suche …"
SEARCH_RESULTS: "Suchergebnisse"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Suche: <strong>%s</strong> fand ein Ergebnis"
SEARCH_RESULTS_SUMMARY_PLURAL: "Suche: <strong>%s</strong> fand %s Ergebnisse"
SEARCH_FIELD_MINIMUM_CHARACTERS: "Bitte geben Sie mindestens %s Zeichen ein"
SEARCH_VALUE: 'Suchen'
fr:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Recherche …"
SEARCH_RESULTS: "Résultats de la recherche"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Recherche : Un résultat trouvé pour <strong>%s</strong>"
SEARCH_RESULTS_SUMMARY_PLURAL: "Recherche : %2$s résultats trouvés pour <strong>%1$s</strong>"
SEARCH_FIELD_MINIMUM_CHARACTERS: "Veuillez ajouter au moins %s caractères"
it:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Cerca …"
SEARCH_RESULTS: "Risultati della ricerca"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Ricerca: <strong>%s</strong>. Trovato un risultato"
SEARCH_RESULTS_SUMMARY_PLURAL: "Ricerca: <strong>%s</strong>. Trovati %s risultati"
SEARCH_FIELD_MINIMUM_CHARACTERS: "Inserisci almeno %s caratteri"
zh:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "搜索 …"
SEARCH_RESULTS: "搜索结果"
SEARCH_RESULTS_SUMMARY_SINGULAR: "查询: <strong>%s</strong> 找到 1 个结果"
SEARCH_RESULTS_SUMMARY_PLURAL: "查询: <strong>%s</strong> 找到 %s 个结果"
nl:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Zoeken …"
SEARCH_RESULTS: "Zoek resultaten"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Query: <strong>%s</strong> is 1 keer gevonden"
SEARCH_RESULTS_SUMMARY_PLURAL: "Query: <strong>%s</strong> is %s keer gevonden"
SEARCH_FIELD_MINIMUM_CHARACTERS: "Geef minstens %s tekens in"
hr:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Traži …"
SEARCH_RESULTS: "Rezultati pretrage"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Upit: <strong>%s</strong> je pronašao jedan rezultat"
SEARCH_RESULTS_SUMMARY_PLURAL: "Upit: <strong>%s</strong> je pronašao %s rezultata"
ru:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Найти …"
SEARCH_RESULTS: "Результат поиска"
SEARCH_RESULTS_SUMMARY_SINGULAR: "По запросу: <strong>%s</strong> результатов найдено 1"
SEARCH_RESULTS_SUMMARY_PLURAL: "По запросу: <strong>%s</strong> результатов найдено %s"
SEARCH_FIELD_MINIMUM_CHARACTERS: "Добавьте не менее %s символов"
es:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Buscar …"
SEARCH_RESULTS: "Resultados de la búsqueda"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Consulta: <strong>%s</strong> se encontró 1 resultado"
SEARCH_RESULTS_SUMMARY_PLURAL: "Consulta: <strong>%s</strong> se encontraron %s resultados"
ja:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "検索する …"
SEARCH_RESULTS: "検索結果"
SEARCH_RESULTS_SUMMARY_SINGULAR: "検索 : <strong>%s</strong> に一つの結果があります。"
SEARCH_RESULTS_SUMMARY_PLURAL: "検索 : <strong>%s</strong> に %s の結果があります。"
fa:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "جستجو …"
SEARCH_RESULTS: "نتایج جستجو"
SEARCH_RESULTS_SUMMARY_SINGULAR: "جستار: <strong>%s</strong> یک نتیجه یافت شد"
SEARCH_RESULTS_SUMMARY_PLURAL: "جستار: <strong>%s</strong> %s نتیجه یافت شد"
cs:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Vyhledat …"
SEARCH_RESULTS: "Výsledky hledání"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Hledání výrazu '<strong>%s</strong>' našlo jeden výsledek"
SEARCH_RESULTS_SUMMARY_PLURAL: "Hledání výrazu '<strong>%s</strong>' našlo %s výsledků"
pt:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "O que você procura?"
SEARCH_RESULTS: "Resultados da pesquisa"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Pesquisa: <strong>%s</strong>. Foram encontrados 1 resultados"
SEARCH_RESULTS_SUMMARY_PLURAL: "Pesquisa: <strong>%s</strong>. Foram encontrados %s resultados"
sv:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Sök …"
SEARCH_RESULTS: "Sökresultat"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Sökning: <strong>%s</strong> hittade ett resultat"
SEARCH_RESULTS_SUMMARY_PLURAL: "Sökning: <strong>%s</strong> hittade %s resultat"
da:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Søg …"
SEARCH_RESULTS: "Søgeresultat"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Søgning: <strong>%s</strong> fandt et resultat"
SEARCH_RESULTS_SUMMARY_PLURAL: "Søgning: <strong>%s</strong> fandt %s resultater"
kk:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "іздеу …"
SEARCH_RESULTS: "Іздеу нәтижесі"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Сұраныс бойынша: <strong>%s</strong> табылды 1"
SEARCH_RESULTS_SUMMARY_PLURAL: "Сұраныс бойынша: <strong>%s</strong> табылды %s"
SEARCH_FIELD_MINIMUM_CHARACTERS: "Кемінде %s таңба қосу"
pl:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Szukaj…"
SEARCH_RESULTS: "Wyniki wyszukiwania"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Znaleziono jeden wynik dla frazy <strong>%s</strong>."
SEARCH_RESULTS_SUMMARY_PLURAL: "Znaleziono %2$s wyników dla frazy <strong>%1$s</strong>."
SEARCH_FIELD_MINIMUM_CHARACTERS: "Fraza musi składać się z minimum %s znaków."
@@ -0,0 +1,7 @@
---
title: Search Results
order_by: date
order_dir: desc
template: simplesearch_results
---
@@ -0,0 +1,370 @@
<?php
namespace Grav\Plugin;
use Grav\Common\Config\Config;
use Grav\Common\Data\Data;
use Grav\Common\Page\Collection;
use Grav\Common\Page\Page;
use Grav\Common\Page\Types;
use Grav\Common\Plugin;
use Grav\Common\Taxonomy;
use Grav\Common\Uri;
use Grav\Common\Utils;
use RocketTheme\Toolbox\Event\Event;
class SimplesearchPlugin extends Plugin
{
/**
* @var array
*/
protected $query;
/**
* @var string
*/
protected $query_id;
/**
* @var Collection
*/
protected $collection;
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'onPluginsInitialized' => ['onPluginsInitialized', 0],
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
'onGetPageTemplates' => ['onGetPageTemplates', 0],
];
}
/**
* Add page template types. (for Admin plugin)
*/
public function onGetPageTemplates(Event $event)
{
/** @var Types $types */
$types = $event->types;
$types->scanTemplates('plugins://simplesearch/templates');
}
/**
* Add current directory to twig lookup paths.
*/
public function onTwigTemplatePaths()
{
$this->grav['twig']->twig_paths[] = __DIR__ . '/templates';
}
/**
* Enable search only if url matches to the configuration.
*/
public function onPluginsInitialized()
{
if ($this->isAdmin()) {
return;
}
$this->enable([
'onPagesInitialized' => ['onPagesInitialized', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
]);
}
/**
* Build search results.
*/
public function onPagesInitialized()
{
$page = $this->grav['page'];
$route = null;
if (isset($page->header()->simplesearch['route'])) {
$route = $page->header()->simplesearch['route'];
// Support `route: '@self'` syntax
if ($route === '@self') {
$route = $page->route();
$page->header()->simplesearch['route'] = $route;
}
}
// If a page exists merge the configs
if ($page) {
$this->config->set('plugins.simplesearch', $this->mergeConfig($page));
}
/** @var Uri $uri */
$uri = $this->grav['uri'];
$query = $uri->param('query') ?: $uri->query('query');
$route = $this->config->get('plugins.simplesearch.route');
// performance check for route
if (!($route && $route == $uri->path())) {
return;
}
// Explode query into multiple strings. Drop empty values
$this->query = array_filter(array_filter(explode(',', $query), 'trim'), 'strlen');
/** @var Taxonomy $taxonomy_map */
$taxonomy_map = $this->grav['taxonomy'];
$taxonomies = [];
$find_taxonomy = [];
$filters = (array)$this->config->get('plugins.simplesearch.filters');
$operator = $this->config->get('plugins.simplesearch.filter_combinator', 'and');
$new_approach = false;
// if @none found, skip processing taxonomies
$should_process = true;
if (is_array($filters)) {
$the_filter = reset($filters);
if (is_array($the_filter)) {
if (in_array(reset($the_filter), ['@none', 'none@'])) {
$should_process = false;
}
}
}
if (!$should_process || !$filters || $query === false || (count($filters) == 1 && !reset($filters))) {
/** @var \Grav\Common\Page\Pages $pages */
$pages = $this->grav['pages'];
$this->collection = $pages->all();
} else {
foreach ($filters as $key => $filter) {
// flatten item if it's wrapped in an array
if (is_int($key)) {
if (is_array($filter)) {
$key = key($filter);
$filter = $filter[$key];
} else {
$key = $filter;
}
}
// see if the filter uses the new 'items-type' syntax
if ($key === '@self' || $key === 'self@') {
$new_approach = true;
} elseif ($key === '@taxonomy' || $key === 'taxonomy@') {
$taxonomies = $filter === false ? false : array_merge($taxonomies, (array)$filter);
} else {
$find_taxonomy[$key] = $filter;
}
}
if ($new_approach) {
$params = $page->header()->content;
$params['query'] = $this->config->get('plugins.simplesearch.query');
$this->collection = $page->collection($params, false);
} else {
$this->collection = new Collection();
$this->collection->append($taxonomy_map->findTaxonomy($find_taxonomy, $operator)->toArray());
}
}
//Drop unpublished and unroutable pages
$this->collection->published()->routable();
//Check if user has permission to view page
if ($this->grav['config']->get('plugins.login.enabled')) {
$this->collection = $this->checkForPermissions($this->collection);
}
$extras = [];
if ($query) {
foreach ($this->collection as $cpage) {
foreach ($this->query as $query) {
$query = trim($query);
if ($this->notFound($query, $cpage, $taxonomies)) {
$this->collection->remove($cpage);
continue;
}
if ($cpage->modular()) {
$this->collection->remove($cpage);
$parent = $cpage->parent();
$extras[$parent->path()] = ['slug' => $parent->slug()];
}
}
}
}
if (!empty($extras)) {
$this->collection->append($extras);
}
// use a configured sorting order if not already done
if (!$new_approach) {
$this->collection = $this->collection->order(
$this->config->get('plugins.simplesearch.order.by'),
$this->config->get('plugins.simplesearch.order.dir')
);
}
// if page doesn't have settings set, create a page
if (!isset($page->header()->simplesearch)) {
// create the search page
$page = new Page;
$page->init(new \SplFileInfo(__DIR__ . '/pages/simplesearch.md'));
// override the template is set in the config
$template_override = $this->config->get('plugins.simplesearch.template');
if ($template_override) {
$page->template($template_override);
}
// fix RuntimeException: Cannot override frozen service "page" issue
unset($this->grav['page']);
$this->grav['page'] = $page;
}
}
/**
* Filter the pages, and return only the pages the user has access to.
* Implementation based on Login Plugin authorizePage() function.
*/
public function checkForPermissions($collection)
{
$user = $this->grav['user'];
$returnCollection = new Collection();
foreach ($collection as $page) {
$header = $page->header();
$rules = isset($header->access) ? (array)$header->access : [];
if ($this->config->get('plugins.login.parent_acl')) {
// If page has no ACL rules, use its parent's rules
if (!$rules) {
$parent = $page->parent();
while (!$rules and $parent) {
$header = $parent->header();
$rules = isset($header->access) ? (array)$header->access : [];
$parent = $parent->parent();
}
}
}
// Continue to the page if it has no ACL rules.
if (!$rules) {
$returnCollection[$page->path()] = ['slug' => $page->slug()];
} else {
// Continue to the page if user is authorized to access the page.
foreach ($rules as $rule => $value) {
if (is_array($value)) {
foreach ($value as $nested_rule => $nested_value) {
if ($user->authorize($rule . '.' . $nested_rule) == $nested_value) {
$returnCollection[$page->path()] = ['slug' => $page->slug()];
break;
}
}
} else {
if ($user->authorize($rule) == $value) {
$returnCollection[$page->path()] = ['slug' => $page->slug()];
break;
}
}
}
}
}
return $returnCollection;
}
/**
* @param $query
* @param Page $page
* @param $taxonomies
* @return bool
*/
private function notFound($query, $page, $taxonomies)
{
$searchable_types = ['title', 'content', 'taxonomy'];
$results = true;
$search_content = $this->config->get('plugins.simplesearch.search_content');
foreach ($searchable_types as $type) {
if ($type === 'title') {
$result = $this->matchText(strip_tags($page->title()), $query) === false;
} elseif ($type === 'taxonomy') {
if ($taxonomies === false) {
continue;
}
$page_taxonomies = $page->taxonomy();
$taxonomy_match = false;
foreach ((array)$page_taxonomies as $taxonomy => $values) {
// if taxonomies filter set, make sure taxonomy filter is valid
if (!is_array($values) || (is_array($taxonomies) && !empty($taxonomies) && !in_array($taxonomy, $taxonomies))) {
continue;
}
$taxonomy_values = implode('|', $values);
if ($this->matchText($taxonomy_values, $query) !== false) {
$taxonomy_match = true;
break;
}
}
$result = !$taxonomy_match;
} else {
if ($search_content == 'raw') {
$content = $page->rawMarkdown();
} else {
$content = $page->content();
}
$result = $this->matchText(strip_tags($content), $query) === false;
}
$results = $results && $result;
if ($results === false) {
break;
}
}
return $results;
}
private function matchText($haystack, $needle)
{
if ($this->config->get('plugins.simplesearch.ignore_accented_characters')) {
setlocale(LC_ALL, 'en_US');
try {
$result = mb_stripos(iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $haystack), iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $needle));
} catch (\Exception $e) {
$result = mb_stripos($haystack, $needle);
}
setlocale(LC_ALL, '');
return $result;
} else {
return mb_stripos($haystack, $needle);
}
}
/**
* Set needed variables to display the search results.
*/
public function onTwigSiteVariables()
{
$twig = $this->grav['twig'];
if ($this->query) {
$twig->twig_vars['query'] = implode(', ', $this->query);
$twig->twig_vars['search_results'] = $this->collection;
}
if ($this->config->get('plugins.simplesearch.built_in_css')) {
$this->grav['assets']->add('plugin://simplesearch/css/simplesearch.css');
}
if ($this->config->get('plugins.simplesearch.built_in_js')) {
$this->grav['assets']->addJs('plugin://simplesearch/js/simplesearch.js', ['group' => 'bottom']);
}
}
}
@@ -0,0 +1,15 @@
enabled: true
built_in_css: true
built_in_js: true
display_button: false
min_query_length: 3
route: /search
search_content: rendered
template: simplesearch_results
filters:
category:
filter_combinator: and
ignore_accented_characters: false
order:
by: date
dir: desc
@@ -0,0 +1 @@
{% extends 'partials/base.html.twig' %}
@@ -0,0 +1,23 @@
<section class="search-row">
{% set banner = page.media.images|first %}
{% if banner %}
<div class="search-image">
<a href="{{ page.url }}">{{ banner.cropZoom(100,100).html|raw }}</a>
</div>
{% endif %}
<div class="search-item">
<div class="search-title">
<h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
</div>
<div class="search-details">
<span class="search-date">{{ page.date|date(config.system.pages.dateformat.short) }}</span>
</div>
<p>{{ page.summary|raw }}</p>
<hr/>
</div>
</section>
@@ -0,0 +1,22 @@
{% set min_chars = config.get('plugins.simplesearch.min_query_length', 3) %}
<div class="search-wrapper">
<form name="search" data-simplesearch-form>
<input
name="searchfield"
class="search-input"
type="text"
{% if min_chars > 0 %} min="{{- min_chars -}}" {% endif %}
required
placeholder="{{"PLUGIN_SIMPLESEARCH.SEARCH_PLACEHOLDER"|t}}"
value="{{ query|e }}"
data-search-invalid="{{ "PLUGIN_SIMPLESEARCH.SEARCH_FIELD_MINIMUM_CHARACTERS"|t(min_chars)|raw }}"
data-search-separator="{{ config.system.param_sep }}"
data-search-input="{{ base_url }}{{ config.plugins.simplesearch.route == '@self' ? '' : (config.plugins.simplesearch.route == '/' ? '' : config.plugins.simplesearch.route) }}/query"
/>
{% if config.plugins.simplesearch.display_button %}
<button type="submit" class="search-submit">
<img src="{{ url('plugin://simplesearch/assets/search.svg') }}" />
</button>
{% endif %}
</form>
</div>
@@ -0,0 +1,23 @@
{% extends 'partials/simplesearch_base.html.twig' %}
{% block content %}
<div class="content-padding simplesearch">
<h1 class="search-header">{{ "PLUGIN_SIMPLESEARCH.SEARCH_RESULTS"|t }}</h1>
<div class="center">
{% include 'partials/simplesearch_searchbox.html.twig' %}
</div>
<p>
{% if query %}
{% set count = search_results ? search_results.count : 0 %}
{% if count is same as( 1 ) %}
{{ "PLUGIN_SIMPLESEARCH.SEARCH_RESULTS_SUMMARY_SINGULAR"|t(query|e)|raw }}
{% else %}
{{ "PLUGIN_SIMPLESEARCH.SEARCH_RESULTS_SUMMARY_PLURAL"|t(query|e, count)|raw }}
{% endif %}
{% endif %}
</p>
{% for page in search_results %}
{% include 'partials/simplesearch_item.html.twig' with {'page': page} %}
{% endfor %}
</div>
{% endblock %}
@@ -0,0 +1,5 @@
{"results":[
{%- for search_result in search_results -%}
{{- search_result.route|json_encode -}}{{ not loop.last ? ',' }}
{%- endfor -%}
]}
@@ -0,0 +1,13 @@
form: custom_form
unique_id: nmkstfiidw3gqvw8y0ur
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574953420
updated: 1574953425
data: null
files:
portfolio:
Utopie_logiciel_libre__Broca__Le_passager_clandestin.pdf: null
portfolio/original:
Utopie_logiciel_libre__Broca__Le_passager_clandestin.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: 26c5vgkhyx9e7naquaid
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574692884
updated: 1574692884
data: null
files:
portfolio:
test_upload.pdf:
name: test_upload.pdf
type: application/pdf
tmp_name: phpoLRnf0
size: 1035
path: user/data/files/test_upload.pdf
portfolio/original:
test_upload.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: 4xoyculrmns8igjeetac
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574693921
updated: 1574693921
data: null
files:
portfolio:
Screenshot_20191113_234226.png:
name: Screenshot_20191113_234226.png
type: image/png
tmp_name: phpSmq5oe
size: 1662053
path: user/data/files/Screenshot_20191113_234226.png
portfolio/original:
Screenshot_20191113_234226.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,18 @@
form: custom_form
unique_id: 5rpzbmlhyxjvg0firet4
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694191
updated: 1574694191
data: null
files:
portfolio:
Screenshot_20191113_234226.png:
name: Screenshot_20191113_234226.png
type: image/png
tmp_name: phpoHsb8t
size: 1662053
path: user/data/files/Screenshot_20191113_234226.png
portfolio/original:
Screenshot_20191113_234226.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,15 @@
form: custom_form
unique_id: 68nr3jcai01gtcpetxxh
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694667
updated: 1574694678
data: null
files:
portfolio:
test_upload.pdf: null
elements_client.pdf: null
portfolio/original:
test_upload.pdf: null
elements_client.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: adfhehrxmkr36goucw2m
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694302
updated: 1574694302
data: null
files:
portfolio:
Screenshot_20191113_234204.png:
name: Screenshot_20191113_234204.png
type: image/png
tmp_name: phpub4agk
size: 1166517
path: user/data/files/Screenshot_20191113_234204.png
portfolio/original:
Screenshot_20191113_234204.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

@@ -0,0 +1,18 @@
form: custom_form
unique_id: ciqaoxobfztwrxjzmgi4
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694964
updated: 1574694964
data: null
files:
portfolio:
Screenshot_20191113_234204.png:
name: Screenshot_20191113_234204.png
type: image/png
tmp_name: phpEh6g4p
size: 1166517
path: user/data/files/Screenshot_20191113_234204.png
portfolio/original:
Screenshot_20191113_234204.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

@@ -0,0 +1,18 @@
form: custom_form
unique_id: cs8pzowvx1rqehkz7knu
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574695187
updated: 1574695187
data: null
files:
portfolio:
test_upload.pdf:
name: test_upload.pdf
type: application/pdf
tmp_name: phpQ4M8d5
size: 1035
path: user/data/files/test_upload.pdf
portfolio/original:
test_upload.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: ft7jqy0tlwyei1cxvcdn
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574693493
updated: 1574693493
data: null
files:
portfolio:
test_upload.pdf:
name: test_upload.pdf
type: application/pdf
tmp_name: phpw7RXmA
size: 1035
path: user/data/files/test_upload.pdf
portfolio/original:
test_upload.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: hfjngg6h4cblzplya20c
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694149
updated: 1574694149
data: null
files:
portfolio:
Screenshot_20191113_234226.png:
name: Screenshot_20191113_234226.png
type: image/png
tmp_name: phpyJkAfo
size: 1662053
path: user/data/files/Screenshot_20191113_234226.png
portfolio/original:
Screenshot_20191113_234226.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,18 @@
form: custom_form
unique_id: hw7ki2p8qduutbxf9hm1
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694270
updated: 1574694270
data: null
files:
portfolio:
Screenshot_20191113_234226.png:
name: Screenshot_20191113_234226.png
type: image/png
tmp_name: phpovqIP9
size: 1662053
path: user/data/files/Screenshot_20191113_234226.png
portfolio/original:
Screenshot_20191113_234226.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,18 @@
form: custom_form
unique_id: i6u2xq35t7ubzmfpcdfn
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574693676
updated: 1574693676
data: null
files:
portfolio:
test_upload.pdf:
name: test_upload.pdf
type: application/pdf
tmp_name: php6TLuPl
size: 1035
path: user/data/files/test_upload.pdf
portfolio/original:
test_upload.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: ipjlcp5q7s3sckgvzhej
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694507
updated: 1574694507
data: null
files:
portfolio:
Screenshot_20191113_234226.png:
name: Screenshot_20191113_234226.png
type: image/png
tmp_name: php4sRkfz
size: 1662053
path: user/data/files/Screenshot_20191113_234226.png
portfolio/original:
Screenshot_20191113_234226.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,13 @@
form: custom_form
unique_id: jpxwkjmupmvtqxn9deob
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574696636
updated: 1574696636
data: null
files:
portfolio:
Utopie_logiciel_libre__Broca__Le_passager_clandestin.pdf: null
portfolio/original:
Utopie_logiciel_libre__Broca__Le_passager_clandestin.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: kpmraqw1ivjzhes06sah
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574693435
updated: 1574693435
data: null
files:
portfolio:
test_upload.pdf:
name: test_upload.pdf
type: application/pdf
tmp_name: phpq6SSIl
size: 1035
path: user/data/files/test_upload.pdf
portfolio/original:
test_upload.pdf: null
@@ -0,0 +1,20 @@
form: custom_form
unique_id: kslnqml0xpmheeidjvrx
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574693737
updated: 1574693746
data: null
files:
portfolio:
test_upload.pdf: null
Screenshot_20191113_234226.png:
name: Screenshot_20191113_234226.png
type: image/png
tmp_name: php2puast
size: 1662053
path: user/data/files/Screenshot_20191113_234226.png
portfolio/original:
test_upload.pdf: null
Screenshot_20191113_234226.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,18 @@
form: custom_form
unique_id: m850zlr1jna627kvklv9
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694469
updated: 1574694469
data: null
files:
portfolio:
Screenshot_20191113_234226.png:
name: Screenshot_20191113_234226.png
type: image/png
tmp_name: phpUYelt5
size: 1662053
path: user/data/files/Screenshot_20191113_234226.png
portfolio/original:
Screenshot_20191113_234226.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,13 @@
form: custom_form
unique_id: pcsaxge1wazcthlw8lrn
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574695606
updated: 1574695608
data: null
files:
portfolio:
test_upload.pdf: null
portfolio/original:
test_upload.pdf: null
@@ -0,0 +1,13 @@
form: custom_form
unique_id: pv2nwxyygkiehh8vmfob
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694524
updated: 1574694534
data: null
files:
portfolio:
Screenshot_20191113_234226.png: null
portfolio/original:
Screenshot_20191113_234226.png: null
@@ -0,0 +1,15 @@
form: custom_form
unique_id: qhemfvuusclcwk0b8zxx
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574695282
updated: 1574695324
data: null
files:
portfolio:
test_upload.pdf: null
Screenshot_20191113_234226.png: null
portfolio/original:
test_upload.pdf: null
Screenshot_20191113_234226.png: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: ritmsbd5ofgvkkzoarw9
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574695219
updated: 1574695219
data: null
files:
portfolio:
test_upload.pdf:
name: test_upload.pdf
type: application/pdf
tmp_name: phpyh3HF4
size: 1035
path: user/data/files/test_upload.pdf
portfolio/original:
test_upload.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: rv6lqgyobh5m1uxitpme
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574693329
updated: 1574693329
data: null
files:
portfolio:
test_upload.pdf:
name: test_upload.pdf
type: application/pdf
tmp_name: php8P75GK
size: 1035
path: user/data/files/test_upload.pdf
portfolio/original:
test_upload.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: sbxnw7ohazamjpccr0no
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574693601
updated: 1574693601
data: null
files:
portfolio:
test_upload.pdf:
name: test_upload.pdf
type: application/pdf
tmp_name: php6M9RVK
size: 1035
path: user/data/files/test_upload.pdf
portfolio/original:
test_upload.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: ujpd7so4ai0qvmrw3jns
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574695046
updated: 1574695046
data: null
files:
portfolio:
Screenshot_20191113_234226.png:
name: Screenshot_20191113_234226.png
type: image/png
tmp_name: php6scfAx
size: 1662053
path: user/data/files/Screenshot_20191113_234226.png
portfolio/original:
Screenshot_20191113_234226.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,13 @@
form: custom_form
unique_id: ur5fnqyhqdy8czgnjb6p
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574696830
updated: 1574696837
data: null
files:
portfolio:
Utopie_logiciel_libre__Broca__Le_passager_clandestin.pdf: null
portfolio/original:
Utopie_logiciel_libre__Broca__Le_passager_clandestin.pdf: null
@@ -0,0 +1,18 @@
form: custom_form
unique_id: xgzsrmmcbtibul7s6nhx
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694978
updated: 1574694979
data: null
files:
portfolio:
Screenshot_20191113_234226.png:
name: Screenshot_20191113_234226.png
type: image/png
tmp_name: phpE6xq1q
size: 1662053
path: user/data/files/Screenshot_20191113_234226.png
portfolio/original:
Screenshot_20191113_234226.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

@@ -0,0 +1,24 @@
form: custom_form
unique_id: yyozpexcsm61fb4oj3rv
url: 'http://127.0.0.1/studio-programme/formulaire'
user: null
timestamps:
created: 1574694829
updated: 1574694870
data: null
files:
portfolio:
test_upload.pdf: null
Screenshot_20191113_234204.png: null
img3.png: null
Screenshot_20191113_234226.png:
name: Screenshot_20191113_234226.png
type: image/png
tmp_name: phpgOSHu3
size: 1662053
path: user/data/files/Screenshot_20191113_234226.png
portfolio/original:
test_upload.pdf: null
Screenshot_20191113_234204.png: null
img3.png: null
Screenshot_20191113_234226.png: null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

+1
View File
@@ -39,6 +39,7 @@ Administrator:
configuration_site: 'true'
configuration_media: 'false'
configuration_info: 'false'
configuration_lieux: 'true'
settings: 'true'
pages: 'true'
maintenance: 'false'
@@ -4,3 +4,4 @@ pagination:
per_page: '20'
custom_permissions:
- admin.data-manager
- admin.configuration_lieux
+2 -1
View File
@@ -1,2 +1,3 @@
enabled: true
enabled: false
mode: html
event: null
+6
View File
@@ -0,0 +1,6 @@
enabled: false
text_var: 'Custom Text added by the **Informations** plugin (disable plugin to remove)'
active: true
route: /random
filters:
category: blog
+3
View File
@@ -0,0 +1,3 @@
enabled: false
built_in_css: true
delta: 0
@@ -0,0 +1,7 @@
enabled: false
default_lang: en
disable_css: false
inject_template: false
grecaptcha_sitekey: 6LcJX8MUAAAAAMTGTA75qprUncZ7xm8e2N0m464N
grecaptcha_secret: 6LcJX8MUAAAAAHVGLHS3fIbMmt5BOQDZRD-NebDG
grecaptcha_callback: false
+13
View File
@@ -0,0 +1,13 @@
enabled: true
built_in_css: true
built_in_js: true
display_button: true
min_query_length: 3
route: /search
search_content: raw
template: simplesearch_results
filter_combinator: or
ignore_accented_characters: false
order:
by: title
dir: desc
+2 -1
View File
@@ -1,4 +1,5 @@
absolute_urls: false
timezone: Europe/London
param_sep: ':'
wrapped_site: false
reverse_proxy_setup: false
@@ -27,7 +28,7 @@ pages:
count: 50
dateformat:
short: 'jS M Y'
long: 'F jS \a\t g:ia'
long: 'jS M Y'
publish_dates: true
process:
markdown: true
@@ -13,6 +13,6 @@ content:
pagination: true
url_taxonomy_filters: true
aura:
pagetype: website
pagetype: article
---
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 MiB

After

Width:  |  Height:  |  Size: 984 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

Some files were not shown because too many files have changed in this diff Show More