From a18589ee0a9d2f8809b6280af688621e7bd343b7 Mon Sep 17 00:00:00 2001
From: Matthew Barbour
Date: Fri, 2 Aug 2019 15:05:49 -0500
Subject: [PATCH] Help extension
Provides foundation for help pages that are generated from loaded extensions, starting with comprehensive search documentation. Addresses #522
---
core/sys_config.php | 2 +-
ext/artists/main.php | 13 +-
ext/artists/theme.php | 10 +
ext/comment/main.php | 10 +
ext/comment/theme.php | 24 +++
ext/favorites/main.php | 10 +
ext/favorites/theme.php | 24 +++
.../baseline_help_outline_black_18dp.png | Bin 0 -> 290 bytes
ext/help_pages/main.php | 94 +++++++++
ext/help_pages/style.css | 13 ++
ext/help_pages/theme.php | 31 +++
ext/index/main.php | 12 ++
ext/index/theme.php | 197 ++++++++++++++++++
ext/media/main.php | 11 +
ext/media/theme.php | 16 ++
ext/notes/main.php | 14 +-
ext/notes/theme.php | 25 +++
ext/numeric_score/main.php | 10 +
ext/numeric_score/theme.php | 43 ++++
ext/pools/main.php | 11 +
ext/pools/theme.php | 28 +++
ext/rating/main.php | 15 ++
ext/rating/theme.php | 28 +++
ext/relatationships/main.php | 11 +
ext/relatationships/theme.php | 28 +++
ext/tag_categories/main.php | 15 +-
ext/tag_categories/theme.php | 17 ++
ext/trash/main.php | 14 ++
ext/trash/theme.php | 12 ++
ext/user/main.php | 11 +
ext/user/theme.php | 26 +++
31 files changed, 769 insertions(+), 6 deletions(-)
create mode 100644 ext/help_pages/baseline_help_outline_black_18dp.png
create mode 100644 ext/help_pages/main.php
create mode 100644 ext/help_pages/style.css
create mode 100644 ext/help_pages/theme.php
diff --git a/core/sys_config.php b/core/sys_config.php
index 9eac5f59..5dc80459 100644
--- a/core/sys_config.php
+++ b/core/sys_config.php
@@ -40,7 +40,7 @@ _d("SEARCH_ACCEL", false); // boolean use search accelerator
_d("WH_SPLITS", 1); // int how many levels of subfolders to put in the warehouse
_d("VERSION", '2.7-beta'); // string shimmie version
_d("TIMEZONE", null); // string timezone
-_d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,setup,upgrade,handle_404,handle_static,comment,tag_list,index,tag_edit,alias_editor,media,system"); // extensions to always enable
+_d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,setup,upgrade,handle_404,handle_static,comment,tag_list,index,tag_edit,alias_editor,media,help_pages,system"); // extensions to always enable
_d("EXTRA_EXTS", ""); // string optional extra extensions
_d("BASE_URL", null); // string force a specific base URL (default is auto-detect)
_d("MIN_PHP_VERSION", '7.1');// string minimum supported PHP version
diff --git a/ext/artists/main.php b/ext/artists/main.php
index 568933de..b1f6efcc 100644
--- a/ext/artists/main.php
+++ b/ext/artists/main.php
@@ -47,12 +47,23 @@ class Artists extends Extension
public function onSearchTermParse(SearchTermParseEvent $event)
{
$matches = [];
- if (preg_match("/^author[=|:](.*)$/i", $event->term, $matches)) {
+ if (preg_match("/^(author|artist)[=|:](.*)$/i", $event->term, $matches)) {
$char = $matches[1];
$event->add_querylet(new Querylet("Author = :author_char", ["author_char"=>$char]));
}
}
+ public function onHelpPageBuilding(HelpPageBuildingEvent $event)
+ {
+ if($event->key===HelpPages::SEARCH) {
+ $block = new Block();
+ $block->header = "Artist";
+ $block->body = $this->theme->get_help_html();
+ $event->add_block($block);
+ }
+ }
+
+
public function onInitExt(InitExtEvent $event)
{
global $config, $database;
diff --git a/ext/artists/theme.php b/ext/artists/theme.php
index aebd2757..1e5e5afb 100644
--- a/ext/artists/theme.php
+++ b/ext/artists/theme.php
@@ -545,4 +545,14 @@ class ArtistsTheme extends Themelet
}
return $html;
}
+
+ public function get_help_html()
+ {
+ return '
Search for images with a particular artist.
+
+
artist=leonardo
+
Returns images with the artist "leonardo".
+
+ ';
+ }
}
diff --git a/ext/comment/main.php b/ext/comment/main.php
index 7ea23d37..f58a3076 100644
--- a/ext/comment/main.php
+++ b/ext/comment/main.php
@@ -366,6 +366,16 @@ class CommentList extends Extension
}
}
+ public function onHelpPageBuilding(HelpPageBuildingEvent $event)
+ {
+ if($event->key===HelpPages::SEARCH) {
+ $block = new Block();
+ $block->header = "Comments";
+ $block->body = $this->theme->get_help_html();
+ $event->add_block($block);
+ }
+ }
+
// page building {{{
private function build_page(int $current_page)
{
diff --git a/ext/comment/theme.php b/ext/comment/theme.php
index 1bdc70cb..7e62da6b 100644
--- a/ext/comment/theme.php
+++ b/ext/comment/theme.php
@@ -290,4 +290,28 @@ class CommentListTheme extends Themelet
';
}
+
+ public function get_help_html()
+ {
+ return '
Search for images containing a certain number of comments, or comments by a particular individual.
+
+
comments=1
+
Returns images with exactly 1 comment.
+
+
+
comments>0
+
Returns images with 1 or more comments.
+
+
Can use <, <=, >, >=, or =.
+
+
commented_by:username
+
Returns images that have been commented on by "username".
+
+
+
commented_by_userno:123
+
Returns images that have been commented on by user 123.
+
+ ';
+
+ }
}
diff --git a/ext/favorites/main.php b/ext/favorites/main.php
index 91ac1c2d..950d6178 100644
--- a/ext/favorites/main.php
+++ b/ext/favorites/main.php
@@ -155,6 +155,16 @@ class Favorites extends Extension
}
}
+ public function onHelpPageBuilding(HelpPageBuildingEvent $event)
+ {
+ if($event->key===HelpPages::SEARCH) {
+ $block = new Block();
+ $block->header = "Favorites";
+ $block->body = $this->theme->get_help_html();
+ $event->add_block($block);
+ }
+ }
+
public function onPageSubNavBuilding(PageSubNavBuildingEvent $event)
{
global $user;
diff --git a/ext/favorites/theme.php b/ext/favorites/theme.php
index 89509ce2..22367347 100644
--- a/ext/favorites/theme.php
+++ b/ext/favorites/theme.php
@@ -34,4 +34,28 @@ class FavoritesTheme extends Themelet
$page->add_block(new Block("Favorited By", $html, "left", 25));
}
+
+ public function get_help_html()
+ {
+ return '
Search for images that have been favorited a certain number of times, or favorited by a particular individual.
+
+
favorites=1
+
Returns images that have been favorited once.
+
+
+
favorites>0
+
Returns images that have been favorited 1 or more times
+
+
Can use <, <=, >, >=, or =.
+
+
favorited_by:username
+
Returns images that have been favorited by "username".
+
+
+
favorited_by_userno:123
+
Returns images that have been favorited by user 123.
+
+ ';
+
+ }
}
diff --git a/ext/help_pages/baseline_help_outline_black_18dp.png b/ext/help_pages/baseline_help_outline_black_18dp.png
new file mode 100644
index 0000000000000000000000000000000000000000..b6126844b84d7153d5561010b0e0a77c353434c8
GIT binary patch
literal 290
zcmV+-0p0$IP);g1gBJS?apEPbh&UeKcG${7nv-~&e
z^q!3Q=MfPW?dcK1~
zOj-2TUkj!|j}za3GN-aZvl7s13uHT02{bzO)g3|RjDxREH3CgeeFhL~!>k|Rvr|n#
z#cez2x8o-u%c+XTgF})u0KIpEGvGunV8R3-$B6*|{#mjt8dRwQ(U-@3@S3n^-xBT-
o|BSu$;Iko;N-hwBk_xE+087+T346!Kga7~l07*qoM6N<$f-#MEa{vGU
literal 0
HcmV?d00001
diff --git a/ext/help_pages/main.php b/ext/help_pages/main.php
new file mode 100644
index 00000000..d2821b00
--- /dev/null
+++ b/ext/help_pages/main.php
@@ -0,0 +1,94 @@
+
+ * License: MIT
+ * Description: Provides documentation screens
+ */
+
+class HelpPageListBuildingEvent extends Event
+{
+ public $pages = [];
+
+ public function add_page(string $key, string $name)
+ {
+ $this->pages[$key] = $name;
+ }
+
+}
+
+class HelpPageBuildingEvent extends Event
+{
+ public $key;
+ public $blocks = [];
+
+ public function __construct(string $key)
+ {
+ $this->key = $key;
+ }
+
+ function add_block(Block $block, int $position = 50)
+ {
+ if(!array_key_exists("$position",$this->blocks))
+ {
+ $this->blocks["$position"] = [];
+ }
+ $this->blocks["$position"][] = $block;
+ }
+}
+
+class HelpPages extends Extension
+{
+ public const SEARCH = "search";
+
+ public function onPageRequest(PageRequestEvent $event)
+ {
+ global $page, $user;
+
+ if ($event->page_matches("help")) {
+ $e = new HelpPageListBuildingEvent();
+ send_event($e);
+ $page->set_mode(PageMode::PAGE);
+
+ if ($event->count_args() == 0) {
+ $this->theme->display_list_page($e->pages);
+ } else {
+ $name = $event->get_arg(0);
+ $title = $name;
+ if(array_key_exists($name, $e->pages)) {
+ $title = $e->pages[$name];
+ }
+
+ $this->theme->display_help_page($title);
+
+ $hpbe = new HelpPageBuildingEvent($name);
+ send_event($hpbe);
+ asort($hpbe->blocks);
+
+ foreach ($hpbe->blocks as $key=>$value) {
+ foreach($value as $block) {
+ $page->add_block($block);
+ }
+ }
+ }
+ }
+ }
+
+ public function onHelpPageListBuilding(HelpPageListBuildingEvent $event)
+ {
+ $event->add_page("search", "Searching");
+ }
+
+ public function onPageNavBuilding(PageNavBuildingEvent $event)
+ {
+ $event->add_nav_link("help", new Link('help'), "Help");
+ }
+
+ public function onUserBlockBuilding(UserBlockBuildingEvent $event)
+ {
+ global $user;
+ $event->add_link("Help", make_link("help"));
+ }
+
+
+}
diff --git a/ext/help_pages/style.css b/ext/help_pages/style.css
new file mode 100644
index 00000000..85a40f5b
--- /dev/null
+++ b/ext/help_pages/style.css
@@ -0,0 +1,13 @@
+.command_example {
+ margin: 12pt;
+ padding-left: 16pt;
+}
+
+.command_example pre {
+ padding:4pt;
+ border: dashed 2px black;
+}
+
+.command_example p {
+ padding-left: 16pt;
+}
\ No newline at end of file
diff --git a/ext/help_pages/theme.php b/ext/help_pages/theme.php
new file mode 100644
index 00000000..2b3b7818
--- /dev/null
+++ b/ext/help_pages/theme.php
@@ -0,0 +1,31 @@
+set_title("Help Pages");
+ $page->set_heading("Help Pages");
+
+ $nav_block = new Block("Help", "", "left", 0);
+ foreach ($pages as $link=>$desc) {
+ $link = make_link("help/{$link}");
+ $nav_block->body .= "".html_escape($desc)." ";
+ }
+
+ $page->add_block($nav_block);
+ $page->add_block(new Block("Help Pages", "See list of pages to left"));
+ }
+
+ public function display_help_page(String $title)
+ {
+ global $page;
+
+ $page->set_title("Help - $title");
+ $page->set_heading("Help - $title");
+ }
+
+}
diff --git a/ext/index/main.php b/ext/index/main.php
index 80c4b610..9bf22091 100644
--- a/ext/index/main.php
+++ b/ext/index/main.php
@@ -344,6 +344,17 @@ class Index extends Extension
}
}
+ public function onHelpPageBuilding(HelpPageBuildingEvent $event)
+ {
+ if($event->key===HelpPages::SEARCH) {
+ $block = new Block();
+ $block->header = "General";
+ $block->body = $this->theme->get_help_html();
+ $event->add_block($block, 0);
+ }
+ }
+
+
public function onSearchTermParse(SearchTermParseEvent $event)
{
$matches = [];
@@ -392,6 +403,7 @@ class Index extends Extension
$event->add_querylet(new Querylet('images.source LIKE :src', ["src"=>"%$source%"]));
}
} elseif (preg_match("/^posted([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])([0-9-]*)$/i", $event->term, $matches)) {
+ // TODO Make this able to search = without needing a time component.
$cmp = ltrim($matches[1], ":") ?: "=";
$val = $matches[2];
$event->add_querylet(new Querylet("images.posted $cmp :posted{$this->stpen}", ["posted{$this->stpen}"=>$val]));
diff --git a/ext/index/theme.php b/ext/index/theme.php
index f04e124c..e216ea06 100644
--- a/ext/index/theme.php
+++ b/ext/index/theme.php
@@ -144,4 +144,201 @@ and of course start organising your images :-)
$this->display_paginator($page, "post/list", null, $this->page_number, $this->total_pages, true);
}
}
+
+ public function get_help_html()
+ {
+ return '
Searching is largely based on tags, with a number of special keywords available that allow searching based on properties of the images.
+
+
+
tagname
+
Returns images that are tagged with "tagname".
+
+
+
+
tagname othertagname
+
Returns images that are tagged with "tagname" and "othertagname".
+
+
+
Most tags and keywords can be prefaced with a negative sign (-) to indicate that you want to search for images that do not match something.
+
+
+
-tagname
+
Returns images that are not tagged with "tagname".
+
+
+
+
-tagname -othertagname
+
Returns images that are not tagged with "tagname" and "othertagname". This is different than without the negative sign, as images with "tagname" or "othertagname" can still be returned as long as the other one is not present.
+
+
+
+
tagname -othertagname
+
Returns images that are tagged with "tagname", but are not tagged with "othertagname".
+
+
+
Wildcard searches are possible as well using * for "any one, more, or none" and ? for "any one".
+
+
+
tagn*
+
Returns images that are tagged with "tagname", "tagnot", or anything else that starts with "tagn".
+
+
+
+
tagn?me
+
Returns images that are tagged with "tagname", "tagnome", or anything else that starts with "tagn", has one character, and ends with "me".
+
+
+
+
tags=1
+
Returns images with exactly 1 tag.
+
+
+
+
tags>0
+
Returns images with 1 or more tags.
+
+
+
Can use <, <=, >, >=, or =.
+
+
+
+
Search for images by aspect ratio
+
+
+
ratio=4:3
+
Returns images with an aspect ratio of 4:3.
+
+
+
+
ratio>16:9
+
Returns images with an aspect ratio greater than 16:9.
+
+
+
Can use <, <=, >, >=, or =. The relation is calculated by dividing width by height.
+
+
+
+
Search for images by file size
+
+
+
filesize=1
+
Returns images exactly 1 byte in size.
+
+
+
+
filesize>100mb
+
Returns images greater than 100 megabytes in size.
+
+
+
Can use <, <=, >, >=, or =. Supported suffixes are kb, mb, and gb. Uses multiples of 1024.
+
+
+
+
Search for images by MD5 hash
+
+
+
hash=0D3512CAA964B2BA5D7851AF5951F33B
+
Returns image with an MD5 hash 0D3512CAA964B2BA5D7851AF5951F33B.
+
+
+
+
+
Search for images by file type
+
+
+
filetype=jpg
+
Returns images that are of type "jpg".
+
+
+
+
+
Search for images by file name
+
+
+
filename=picasso.jpg
+
Returns images that are named "picasso.jpg".
+
+
+
+
+
Search for images by source
+
+
+
source=http://google.com/
+
Returns images with a source of "http://google.com/".
+
+
+
+
source=any
+
Returns images with a source set.
+
+
+
+
source=none
+
Returns images without a source set.
+
+
+
+
+
Search for images by date posted.
+
+
+
posted>=07-19-2019
+
Returns images posted on or after 07-19-2019.
+
+
+
Can use <, <=, >, >=, or =. Date format is mm-dd-yyyy. Date posted includes time component, so = will not work unless the time is exact.
+
+
+
+
Search for images by image dimensions
+
+
+
size=640x480
+
Returns images exactly 640 pixels wide by 480 pixels high.
+
+
+
+
size>1920x1080
+
Returns images with a width larger than 1920 and a height larger than 1080.
+
+
+
+
width=1000
+
Returns images exactly 1000 pixels wide.
+
+
+
+
height=1000
+
Returns images exactly 1000 pixels high.
+
+
+
Can use <, <=, >, >=, or =.
+
+
+
+
Sorting search results can be done using the pattern order:field_direction. _direction can be either _asc or _desc, indicating ascending (123) or descending (321) order.
+
+
+
order:id_asc
+
Returns images sorted by ID, smallest first.
+
+
+
+
order:width_desc
+
Returns images sorted by width, largest first.
+
+
+
These fields are supported:
+
+
id
+
width
+
height
+
filesize
+
filename
+
+
+ ';
+
+ }
}
diff --git a/ext/media/main.php b/ext/media/main.php
index acce17ab..012507b3 100644
--- a/ext/media/main.php
+++ b/ext/media/main.php
@@ -419,6 +419,17 @@ class Media extends Extension
}
}
+ public function onHelpPageBuilding(HelpPageBuildingEvent $event)
+ {
+ if($event->key===HelpPages::SEARCH) {
+ $block = new Block();
+ $block->header = "Media";
+ $block->body = $this->theme->get_help_html();
+ $event->add_block($block);
+ }
+ }
+
+
public function onTagTermParse(TagTermParseEvent $event)
{
$matches = [];
diff --git a/ext/media/theme.php b/ext/media/theme.php
index 12d77f32..7871ee69 100644
--- a/ext/media/theme.php
+++ b/ext/media/theme.php
@@ -28,4 +28,20 @@ class MediaTheme extends Themelet
";
}
+
+ public function get_help_html()
+ {
+ return '
Search for items based on the type of media.
+
+
content:audio
+
Returns items that contain audio, including videos and audio files.
+
+
+
content:video
+
Returns items that contain video, including animated GIFs.
+
+
These search terms depend on the items being scanned for media content. Automatic scanning was implemented in mid-2019, so items uploaded before, or items uploaded on a system without ffmpeg, will require additional scanning before this will work.
+ ';
+
+ }
}
diff --git a/ext/notes/main.php b/ext/notes/main.php
index aafa928f..18c45f82 100644
--- a/ext/notes/main.php
+++ b/ext/notes/main.php
@@ -210,12 +210,22 @@ class Notes extends Extension
}
$event->add_querylet(new Querylet("images.id IN (SELECT image_id FROM notes WHERE user_id = $user_id)"));
- } elseif (preg_match("/^notes_by_userno[=|:](\d+)$/i", $event->term, $matches)) {
- $user_id = int_escape($matches[1]);
+ } elseif (preg_match("/^(notes_by_userno|notes_by_user_id)[=|:](\d+)$/i", $event->term, $matches)) {
+ $user_id = int_escape($matches[2]);
$event->add_querylet(new Querylet("images.id IN (SELECT image_id FROM notes WHERE user_id = $user_id)"));
}
}
+ public function onHelpPageBuilding(HelpPageBuildingEvent $event)
+ {
+ if($event->key===HelpPages::SEARCH) {
+ $block = new Block();
+ $block->header = "Notes";
+ $block->body = $this->theme->get_help_html();
+ $event->add_block($block);
+ }
+ }
+
/**
* HERE WE GET ALL NOTES FOR DISPLAYED IMAGE.
diff --git a/ext/notes/theme.php b/ext/notes/theme.php
index 912ec615..6878c9c2 100644
--- a/ext/notes/theme.php
+++ b/ext/notes/theme.php
@@ -247,4 +247,29 @@ class NotesTheme extends Themelet
$this->display_paginator($page, "note/updated", null, $pageNumber, $totalPages);
}
+
+ public function get_help_html()
+ {
+ return '
Search for images with notes.
+
+
note=noted
+
Returns images with a note matching "noted".
+
+
+
notes>0
+
Returns images with 1 or more notes.
+
+
Can use <, <=, >, >=, or =.
+
+
notes_by=username
+
Returns images with note(s) by "username".
+
+
+
notes_by_user_id=123
+
Returns images with note(s) by user 123.
+
+ ';
+
+ }
+
}
diff --git a/ext/numeric_score/main.php b/ext/numeric_score/main.php
index 84179f7c..0b93c369 100644
--- a/ext/numeric_score/main.php
+++ b/ext/numeric_score/main.php
@@ -228,6 +228,16 @@ class NumericScore extends Extension
$event->replace('$score', $event->image->numeric_score);
}
+ public function onHelpPageBuilding(HelpPageBuildingEvent $event)
+ {
+ if($event->key===HelpPages::SEARCH) {
+ $block = new Block();
+ $block->header = "Numeric Score";
+ $block->body = $this->theme->get_help_html();
+ $event->add_block($block);
+ }
+ }
+
public function onSearchTermParse(SearchTermParseEvent $event)
{
$matches = [];
diff --git a/ext/numeric_score/theme.php b/ext/numeric_score/theme.php
index 05199b11..e6dbe7fa 100644
--- a/ext/numeric_score/theme.php
+++ b/ext/numeric_score/theme.php
@@ -91,4 +91,47 @@ class NumericScoreTheme extends Themelet
$page->add_block(new Block("Navigation", $nav_html, "left", 10));
$page->add_block(new Block(null, $html, "main", 30));
}
+
+
+ public function get_help_html()
+ {
+ return '
Search for images that have received numeric scores by the score or by the scorer.
+
+
score=1
+
Returns images with a score of 1.
+
+
+
score>0
+
Returns images with a score of 1 or more.
+
+
Can use <, <=, >, >=, or =.
+
+
+
upvoted_by=username
+
Returns images upvoted by "username".
+
+
+
upvoted_by_id=123
+
Returns images upvoted by user 123.
+
+
+
downvoted_by=username
+
Returns images downvoted by "username".
+
+
+
downvoted_by_id=123
+
Returns images downvoted by user 123.
+
+
+
+
order:score_desc
+
Sorts the search results by score, descending.
+
+
+
order:score_asc
+
Sorts the search results by score, ascending.
+
+ ';
+
+ }
}
diff --git a/ext/pools/main.php b/ext/pools/main.php
index cbdf5164..71d3f492 100644
--- a/ext/pools/main.php
+++ b/ext/pools/main.php
@@ -372,6 +372,17 @@ class Pools extends Extension
}
}
+ public function onHelpPageBuilding(HelpPageBuildingEvent $event)
+ {
+ if($event->key===HelpPages::SEARCH) {
+ $block = new Block();
+ $block->header = "Pools";
+ $block->body = $this->theme->get_help_html();
+ $event->add_block($block);
+ }
+ }
+
+
public function onSearchTermParse(SearchTermParseEvent $event)
{
$matches = [];
diff --git a/ext/pools/theme.php b/ext/pools/theme.php
index bb798c8d..86a2406c 100644
--- a/ext/pools/theme.php
+++ b/ext/pools/theme.php
@@ -403,4 +403,32 @@ class PoolsTheme extends Themelet
{
return "";
}
+
+
+ public function get_help_html()
+ {
+ return '
Search for images that are in a pool.
+
+
pool=1
+
Returns images in pool #1.
+
+
+
pool=any
+
Returns images in any pool.
+
+
+
pool=none
+
Returns images not in any pool.
+
+
+
pool_by_name=swimming
+
Returns images in the "swimming" pool.
+
+
+
pool_by_name=swimming_pool
+
Returns images in the "swimming pool" pool. Note that the underscore becomes a space
+
+ ';
+
+ }
}
diff --git a/ext/rating/main.php b/ext/rating/main.php
index c62fd03e..e4dc0180 100644
--- a/ext/rating/main.php
+++ b/ext/rating/main.php
@@ -126,6 +126,21 @@ class Ratings extends Extension
$event->replace('$rating', $this->rating_to_human($event->image->rating));
}
+ public function onHelpPageBuilding(HelpPageBuildingEvent $event)
+ {
+ global $user;
+
+ if($event->key===HelpPages::SEARCH) {
+ $block = new Block();
+ $block->header = "Ratings";
+
+ $ratings = self::get_sorted_ratings();
+
+ $block->body = $this->theme->get_help_html($ratings);
+ $event->add_block($block);
+ }
+ }
+
public function onSearchTermParse(SearchTermParseEvent $event)
{
global $user;
diff --git a/ext/rating/theme.php b/ext/rating/theme.php
index d414e3f6..faec02dc 100644
--- a/ext/rating/theme.php
+++ b/ext/rating/theme.php
@@ -55,4 +55,32 @@ class RatingsTheme extends Themelet
";
}
+
+ public function get_help_html(array $ratings)
+ {
+ $output = '
Search for images with one or more possible ratings.
+
+
rating:'.$ratings[0]->search_term.'
+
Returns images with the '.$ratings[0]->name.' rating.
+
+
Ratings can be abbreviated to a single letter as well
+
+
rating:'.$ratings[0]->code.'
+
Returns images with the '.$ratings[0]->name.' rating.
+
+
If abbreviations are used, multiple ratings can be searched for.
+
+
rating:'.$ratings[0]->code.$ratings[1]->code.'
+
Returns images with the '.$ratings[0]->name.' or '.$ratings[1]->name.' rating.