(Grav GitSync) Automatic Commit from RealStickman

This commit is contained in:
RealStickman 2022-05-27 11:01:29 +02:00 committed by GitSync
parent c562ef9aee
commit 9942aa0a1d
30 changed files with 2195 additions and 0 deletions

2
plugins/simplesearch/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.DS_Store
/.idea

View File

@ -0,0 +1,285 @@
# v2.2.2
## 05/25/2021
1. [](#bugfix)
* `|raw` missing in JSON template
# v2.2.1
## 12/02/2020
1. [](#new)
* Require Grav 1.6.0+
* Added autoloader
* Pass phpstan level 3 tests
1. [](#bugfix)
* Fixed `header_keys_ignored` configuration option not taking effect
# v2.2.0
## 09/14/2020
1. [](#improved)
* Added config option to choose keys to ignore when searching header
* Added ability to opt-out of page search by setting: `simplesearch: process: false` in page header
* Added `form` and `forms` to default list of ignores in page header searches
1. [](#bugfix)
* Fix issue to ensure matching ignore keys only checked at root level
* Fix issue where searchable header content was growing exponentially
# v2.1.0
## 05/27/2020
1. [](#new)
* Added ability to search page headers (excluding title, taxonomy, content)
# v2.0.0
## 05/13/2020
1. [](#new)
* Allow searching the content of modular pages [#170](https://github.com/getgrav/grav-plugin-simplesearch/pull/170)
* Allow configuration of Title/Content/Taxononmy searchable types [#184](https://github.com/getgrav/grav-plugin-simplesearch/pull/184)
1. [](#improved)
* Improved default vs custom search page functionality [#186](https://github.com/getgrav/grav-plugin-simplesearch/pull/186)
* Add field label for screen reader accessibility [#171](https://github.com/getgrav/grav-plugin-simplesearch/pull/171)
* Added Traditional Chinese [#169](https://github.com/getgrav/grav-plugin-simplesearch/pull/169)
* Updated Russian and English [#165](https://github.com/getgrav/grav-plugin-simplesearch/pull/165)
* Added Galacian [#155](https://github.com/getgrav/grav-plugin-simplesearch/pull/155)
1. [](#bugfix)
* Fixed input attribute [#165](https://github.com/getgrav/grav-plugin-simplesearch/pull/165)
# 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...

View File

@ -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.

View File

@ -0,0 +1,209 @@
# 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**, **Taxonomy**, and also a raw page **Header**.
# 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:
filter_combinator: and
ignore_accented_characters: false
order:
by: date
dir: desc
searchable_types:
title: true
content: true
taxonomy: true
header: false
header_keys_ignored: ['title', 'taxonomy','content', 'form', 'forms', 'media_order']
```
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:
process: true
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 a page
A page can be setup to "opt-out" of being included in the search results by setting the following in page frontmatter:
```yaml
simplesearch:
process: 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

View File

@ -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

View File

@ -0,0 +1,172 @@
name: SimpleSearch
type: plugin
slug: simplesearch
version: 2.2.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
dependencies:
- { name: grav, version: '>=1.6.0' }
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: PLUGIN_SIMPLESEARCH.SEARCH_CONTENT
default: rendered
options:
rendered: PLUGIN_SIMPLESEARCH.RENDERED_CONTENT
raw: PLUGIN_SIMPLESEARCH.RAW_CONTENT
built_in_css:
type: toggle
label: PLUGIN_SIMPLESEARCH.BUILTIN_CSS
help: PLUGIN_SIMPLESEARCH.BUILTIN_CSS_HELP
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
built_in_js:
type: toggle
label: PLUGIN_SIMPLESEARCH.BUILTIN_JS
help: PLUGIN_SIMPLESEARCH.BUILTIN_JS_HELP
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
display_button:
type: toggle
label: PLUGIN_SIMPLESEARCH.DISPLAY_SEARCH_BUTTON
help: PLUGIN_SIMPLESEARCH.DISPLAY_SEARCH_BUTTON_HELP
highlight: 0
default: 0
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
ignore_accented_characters:
type: toggle
label: PLUGIN_SIMPLESEARCH.IGNORE_ACCENDED_CHARACTERS
help: PLUGIN_SIMPLESEARCH.IGNORE_ACCENDED_CHARACTERS_HELP
highlight: 0
default: 0
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
min_query_length:
type: text
size: x-small
label: PLUGIN_SIMPLESEARCH.MIN_QUERY_LENGTH
help: PLUGIN_SIMPLESEARCH.MIN_QUERY_LENGTH_HELP
validate:
type: number
min: 0
route:
type: text
size: medium
label: PLUGIN_SIMPLESEARCH.SEARCH_PAGE_ROUTE
help: PLUGIN_SIMPLESEARCH.SEARCH_PAGE_ROUTE_HELP
default: /random
searchable_types:
type: checkboxes
label: PLUGIN_SIMPLESEARCH.SEARCHABLE_TYPES
description: PLUGIN_SIMPLESEARCH.SEARCHABLE_TYPES_DESCRIPTION
options:
title: Title
content: Content
header: Header
taxonomy: Taxonomy
use: keys
header_keys_ignored:
type: selectize
size: large
label: PLUGIN_SIMPLESEARCH.HEADER_KEYS_IGNORED
help: PLUGIN_SIMPLESEARCH.HEADER_KEYS_IGNORED_HELP
classes: fancy
validate:
type: commalist
template:
type: text
size: medium
label: PLUGIN_SIMPLESEARCH.SEARCH_PAGE_TEMPLATE
help: PLUGIN_SIMPLESEARCH.SEARCH_PAGE_TEMPLATE_HELP
default: simplesearch_results
filters.category:
type: selectize
label: PLUGIN_SIMPLESEARCH.CATEGORY_FILTER
help: PLUGIN_SIMPLESEARCH.CATEGORY_FILTER_HELP
validate:
type: commalist
filter_combinator:
type: select
size: medium
classes: fancy
label: PLUGIN_SIMPLESEARCH.FILTER_COMBINATOR
default: and
options:
and: PLUGIN_SIMPLESEARCH.AND_COMBINATOR
or: PLUGIN_SIMPLESEARCH.OR_COMBINATOR
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

View File

@ -0,0 +1,35 @@
{
"name": "getgrav/grav-plugin-simplesearch",
"type": "grav-plugin",
"description": "Simple search plugin for Grav CMS",
"keywords": ["simplesearch", "search", "plugin"],
"homepage": "https://github.com/getgrav/grav-plugin-simplesearch",
"license": "MIT",
"authors": [
{
"name": "Team Grav",
"email": "devs@getgrav.org",
"homepage": "https://getgrav.org",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/getgrav/grav-plugin-simplesearch/issues",
"irc": "https://chat.getgrav.org",
"forum": "https://discourse.getgrav.org",
"docs": "https://github.com/getgrav/grav-plugin-simplesearch/blob/master/README.md"
},
"require": {
"php": ">=7.1.3"
},
"autoload": {
"classmap": [
"simplesearch.php"
]
},
"config": {
"platform": {
"php": "7.1.3"
}
}
}

22
plugins/simplesearch/composer.lock generated Normal file
View File

@ -0,0 +1,22 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "9386d6cf08fcab33be418ed5d678b2ce",
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.1.3"
},
"platform-dev": [],
"platform-overrides": {
"php": "7.1.3"
}
}

View File

@ -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;
}

View File

@ -0,0 +1,15 @@
{
"project":"grav-plugin-simplesearch",
"platforms":{
"grav":{
"nodes":{
"plugin":[
{
"source":"/",
"destination":"/user/plugins/simplesearch"
}
]
}
}
}
}

View File

@ -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('data-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;
}
});
});
})());

View File

@ -0,0 +1,226 @@
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'
SEARCH_CONTENT: 'Search Content'
RENDERED_CONTENT: 'Rendered Content (Slower)'
RAW_CONTENT: 'Raw Markdown Content (Faster)'
BUILTIN_CSS: 'Use built in CSS'
BUILTIN_CSS_HELP: 'Include the CSS provided by the simplesearch plugin'
BUILTIN_JS: 'Use built in JavaScript'
BUILTIN_JS_HELP: 'Include the JavaScript provided by the simplesearch plugin'
DISPLAY_SEARCH_BUTTON: 'Display Search Button'
DISPLAY_SEARCH_BUTTON_HELP: 'Display a search button near the search field'
IGNORE_ACCENDED_CHARACTERS: 'Ignore accented characters'
IGNORE_ACCENDED_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.'
MIN_QUERY_LENGTH: 'Minimum query length'
MIN_QUERY_LENGTH_HELP: 'The minimum number of characters needed before search can be submitted'
SEARCH_PAGE_ROUTE: 'Route'
SEARCH_PAGE_ROUTE_HELP: 'Default route of the simplesearch plugin'
SEARCH_PAGE_TEMPLATE: 'Template'
SEARCH_PAGE_TEMPLATE_HELP: 'Name of the template for the search results'
CATEGORY_FILTER: 'Category filter'
CATEGORY_FILTER_HELP: 'Comma separated list of category names. Enter "@none" to search in all pages.'
FILTER_COMBINATOR: 'Filter Combinator'
AND_COMBINATOR: 'And - Boolean &&'
OR_COMBINATOR: 'Or - Boolean ||'
SEARCHABLE_TYPES: "Searchable Types"
SEARCHABLE_TYPES_DESCRIPTION: "<b>Title</b> = Search Page Title<br><b>Content</b> = Search Page Content<br><b>Header</b> = Search Raw Page Headers<br><b>Taxonomy</b> = Search Taxonomy"
HEADER_KEYS_IGNORED: Header Keys to Ignore
HEADER_KEYS_IGNORED_HELP: The root-level header keys that should be skipped when searching type "Header"
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 个结果"
zh-TW:
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 個字元"
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 символов'
SEARCH_CONTENT: 'Поиск контента'
RENDERED_CONTENT: 'Обработанный контент (медленнее)'
RAW_CONTENT: 'Необработанный Markdown контент (быстрее)'
BUILTIN_CSS: 'Использовать встроенный CSS'
BUILTIN_CSS_HELP: 'Использовать CSS, предоставленный плагином simplesearch'
BUILTIN_JS: 'Использовать встроенный JavaScript'
BUILTIN_JS_HELP: 'Использовать JavaScript, предоставленный плагином simplesearch'
DISPLAY_SEARCH_BUTTON: 'Показать кнопку поиска'
DISPLAY_SEARCH_BUTTON_HELP: 'Показать кнопку поиска рядом с полем поиска'
IGNORE_ACCENDED_CHARACTERS: 'Игнорировать акцентированные символы'
IGNORE_ACCENDED_CHARACTERS_HELP: 'Если этот параметр включен, поисковые термины будут совпадать с акцентированными символами, независимо от их диакритических знаков, т.е. результаты поиска будут отображаться как "кафе" и "кафе́", независимо от того, как вы их набрали'
MIN_QUERY_LENGTH: 'Минимальная длина запроса'
MIN_QUERY_LENGTH_HELP: 'Минимальное количество символов, необходимое для отправки запроса'
SEARCH_PAGE_ROUTE: 'Маршрут'
SEARCH_PAGE_ROUTE_HELP: 'Маршрут по умолчанию для плагина simplesearch'
SEARCH_PAGE_TEMPLATE: 'Шаблон'
SEARCH_PAGE_TEMPLATE_HELP: 'Имя шаблона для страницы результатов поиска'
CATEGORY_FILTER: 'Фильтр категорий'
CATEGORY_FILTER_HELP: 'Разделенный запятыми список названий категорий. Введите "@none" для поиска на всех страницах'
FILTER_COMBINATOR: 'Фильтр комбинатор'
AND_COMBINATOR: 'И - Булева &&'
OR_COMBINATOR: 'Или - Булева ||'
uk:
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 символів'
SEARCH_CONTENT: 'Пошук контенту'
RENDERED_CONTENT: 'Оброблений контент (повільніше)'
RAW_CONTENT: 'Необроблений Markdown контент (швидше)'
BUILTIN_CSS: 'Використовувати вбудований CSS'
BUILTIN_CSS_HELP: 'Використовувати CSS, наданий плагіном simplesearch'
BUILTIN_JS: 'Використовувати вбудований JavaScript'
BUILTIN_JS_HELP: 'Використовувати JavaScript, наданий плагіном simplesearch'
DISPLAY_SEARCH_BUTTON: 'Показати кнопку пошуку'
DISPLAY_SEARCH_BUTTON_HELP: 'Показати кнопку пошуку поряд з полем пошуку'
IGNORE_ACCENDED_CHARACTERS: 'Ігнорувати акцентовані символи'
IGNORE_ACCENDED_CHARACTERS_HELP: 'Якщо цей параметр включений, пошукові терміни будуть збігатися з акцентованими символами, незалежно від їх діакритичних знаків, тобто результати пошуку будуть відображатися як "кафе" і "кафе́", незалежно від того, як ви їх набрали'
MIN_QUERY_LENGTH: 'Мінімальна довжина запиту'
MIN_QUERY_LENGTH_HELP: 'Мінімальна кількість символів, необхідна для відправлення запиту'
SEARCH_PAGE_ROUTE: 'Маршрут'
SEARCH_PAGE_ROUTE_HELP: 'Маршрут за замовчуванням для плагіна simplesearch'
SEARCH_PAGE_TEMPLATE: 'Шаблон'
SEARCH_PAGE_TEMPLATE_HELP: "Ім'я шаблону для сторінки результатів пошуку"
CATEGORY_FILTER: 'Фільтр категорій'
CATEGORY_FILTER_HELP: 'Розділений комами список назв категорій. Введіть "@none" для пошуку на всіх сторінках'
FILTER_COMBINATOR: 'Фільтр комбінатор'
AND_COMBINATOR: 'І - Булева &&'
OR_COMBINATOR: 'Або - Булева ||'
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."
gl:
PLUGIN_SIMPLESEARCH:
SEARCH_PLACEHOLDER: "Procurar …"
SEARCH_RESULTS: "Resultados da procura"
SEARCH_RESULTS_SUMMARY_SINGULAR: "Consulta: <strong>%s</strong> atopouse 1 resultado"
SEARCH_RESULTS_SUMMARY_PLURAL: "Consulta: <strong>%s</strong> atopáronse %s resultados"

View File

@ -0,0 +1,7 @@
---
title: Search Results
order_by: date
order_dir: desc
template: simplesearch_results
---

View File

@ -0,0 +1,450 @@
<?php
namespace Grav\Plugin;
use Grav\Common\Page\Collection;
use Grav\Common\Page\Page;
use Grav\Common\Page\Pages;
use Grav\Common\Page\Types;
use Grav\Common\Plugin;
use Grav\Common\Taxonomy;
use Grav\Common\Uri;
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)
*
* @return void
*/
public function onGetPageTemplates(Event $event)
{
/** @var Types $types */
$types = $event->types;
$types->scanTemplates('plugins://simplesearch/templates');
}
/**
* Add current directory to twig lookup paths.
*
* @return void
*/
public function onTwigTemplatePaths()
{
$this->grav['twig']->twig_paths[] = __DIR__ . '/templates';
}
/**
* Enable search only if url matches to the configuration.
*
* @return void
*/
public function onPluginsInitialized()
{
if ($this->isAdmin()) {
return;
}
$this->enable([
'onPagesInitialized' => ['onPagesInitialized', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
]);
}
/**
* Build search results.
*
* @return void
*/
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 (isset($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;
}
// set the template is not set in the page header (the page header setting takes precedence over the plugin config setting)
if (!isset($page->header()->template)) {
$template_override = $this->config->get('plugins.simplesearch.template', 'simplesearch_results');
$page->template($template_override);
}
// Explode query into multiple strings. Drop empty values
// @phpstan-ignore-next-line
$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 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 pages, but do not drop unroutable pages right now to be able to search modular pages which are unroutable per se
$this->collection->published();
/** @var Collection $modularPageCollection */
$modularPageCollection = $this->collection->copy();
//Get published modular pages
$modularPageCollection->modular();
foreach ($modularPageCollection as $cpage) {
$parent = $cpage->parent();
if (!$parent || !$parent->published()) {
$modularPageCollection->remove($cpage);
}
}
//Drop unroutable pages
$this->collection->routable();
//Add modular pages again
$this->collection->merge($modularPageCollection);
//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) {
$header = $cpage->header();
if (isset($header->simplesearch['process']) && $header->simplesearch['process'] === false) {
$this->collection->remove($cpage);
continue;
}
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')
);
}
// Display simplesearch page if no page was found for the current route
$pages = $this->grav['pages'];
$page = $pages->dispatch($this->config->get('plugins.simplesearch.route', '/search'), true);
if (!isset($page)) {
// create the search page
$page = new Page;
$page->init(new \SplFileInfo(__DIR__ . '/pages/simplesearch.md'));
// override the template is set in the plugin config (the plugin config setting takes precedence over the page header setting)
$template_override = $this->config->get('plugins.simplesearch.template');
if (isset($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.
*
* @param Collection $collection
* @return Collection
*/
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 string $query
* @param Page $page
* @param array|false $taxonomies
* @return bool
*/
private function notFound($query, $page, $taxonomies)
{
$searchable_types = $search_content = $this->config->get('plugins.simplesearch.searchable_types');
$results = true;
$search_content = $this->config->get('plugins.simplesearch.search_content');
$result = null;
foreach ($searchable_types as $type => $enabled) {
if ($type === 'title' && $enabled) {
$result = $this->matchText(strip_tags($page->title()), $query) === false;
} elseif ($type === 'taxonomy' && $enabled) {
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;
} elseif ($type === 'content' && $enabled) {
if ($search_content === 'raw') {
$content = $page->rawMarkdown();
} else {
$content = $page->content();
}
$result = $this->matchText(strip_tags($content), $query) === false;
} elseif ($type === 'header' && $enabled) {
$header = (array) $page->header();
$content = $this->getArrayValues($header);
$result = $this->matchText(strip_tags($content), $query) === false;
}
$results = (bool)$result;
if ($results === false) {
break;
}
}
return $results;
}
/**
* @param string $haystack
* @param string $needle
* @return false|int
*/
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;
}
return mb_stripos($haystack, $needle);
}
/**
* Set needed variables to display the search results.
*
* @return void
*/
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']);
}
}
/**
* @param array $array
* @param array|null $ignore_keys
* @param int $level
* @return string
*/
protected function getArrayValues($array, $ignore_keys = null, $level = 0) {
$output = '';
if (is_null($ignore_keys)) {
$config = $this->config();
$ignore_keys = $config['header_keys_ignored'] ?? ['title', 'taxonomy','content', 'form', 'forms', 'media_order'];
}
foreach ($array as $key => $child) {
if ($level === 0 && in_array($key, $ignore_keys, true)) {
continue;
}
if (is_array($child)) {
$output .= " " . $this->getArrayValues($child, $ignore_keys, $level + 1);
} else {
$output .= " " . $child;
}
}
return trim($output);
}
}

View File

@ -0,0 +1,21 @@
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
searchable_types:
title: true
content: true
taxonomy: true
header: false
header_keys_ignored: [ 'title', 'taxonomy','content', 'form', 'forms', 'media_order' ]

View File

@ -0,0 +1 @@
{% extends 'partials/base.html.twig' %}

View File

@ -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>

View File

@ -0,0 +1,23 @@
{% 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"
aria-label="search"
type="text"
{% if min_chars > 0 %} data-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>

View File

@ -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 %}

View File

@ -0,0 +1,5 @@
{"results":[
{%- for search_result in search_results -%}
{{- search_result.route|json_encode|raw -}}{{ not loop.last ? ',' }}
{%- endfor -%}
]}

View File

@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitca0f44aa14891d4b4dfc9b834c0e0763::getLoader();

View File

@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

View File

@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
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.

View File

@ -0,0 +1,10 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Grav\\Plugin\\SimplesearchPlugin' => $baseDir . '/simplesearch.php',
);

View File

@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@ -0,0 +1,9 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@ -0,0 +1,52 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitca0f44aa14891d4b4dfc9b834c0e0763
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitca0f44aa14891d4b4dfc9b834c0e0763', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitca0f44aa14891d4b4dfc9b834c0e0763', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitca0f44aa14891d4b4dfc9b834c0e0763::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}

View File

@ -0,0 +1,20 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInitca0f44aa14891d4b4dfc9b834c0e0763
{
public static $classMap = array (
'Grav\\Plugin\\SimplesearchPlugin' => __DIR__ . '/../..' . '/simplesearch.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->classMap = ComposerStaticInitca0f44aa14891d4b4dfc9b834c0e0763::$classMap;
}, null, ClassLoader::class);
}
}

View File

@ -0,0 +1 @@
[]