Rename the ignored parameter. re #34

This commit is contained in:
Sébastien Lucas 2013-12-17 20:56:41 +01:00
parent 76e24d85f3
commit 19dcd73585
4 changed files with 12 additions and 11 deletions

View file

@ -464,22 +464,22 @@ class Page
Base::clearDb (); Base::clearDb ();
} }
} else { } else {
if (!in_array ("author", $config ['cops_ignored_search_scope'])) { if (!in_array ("author", $config ['cops_ignored_categories'])) {
array_push ($this->entryArray, Author::getCount()); array_push ($this->entryArray, Author::getCount());
} }
if (!in_array ("series", $config ['cops_ignored_search_scope'])) { if (!in_array ("series", $config ['cops_ignored_categories'])) {
$series = Serie::getCount(); $series = Serie::getCount();
if (!is_null ($series)) array_push ($this->entryArray, $series); if (!is_null ($series)) array_push ($this->entryArray, $series);
} }
if (!in_array ("publisher", $config ['cops_ignored_search_scope'])) { if (!in_array ("publisher", $config ['cops_ignored_categories'])) {
$publisher = Publisher::getCount(); $publisher = Publisher::getCount();
if (!is_null ($publisher)) array_push ($this->entryArray, $publisher); if (!is_null ($publisher)) array_push ($this->entryArray, $publisher);
} }
if (!in_array ("tag", $config ['cops_ignored_search_scope'])) { if (!in_array ("tag", $config ['cops_ignored_categories'])) {
$tags = Tag::getCount(); $tags = Tag::getCount();
if (!is_null ($tags)) array_push ($this->entryArray, $tags); if (!is_null ($tags)) array_push ($this->entryArray, $tags);
} }
if (!in_array ("language", $config ['cops_ignored_search_scope'])) { if (!in_array ("language", $config ['cops_ignored_categories'])) {
$languages = Language::getCount(); $languages = Language::getCount();
if (!is_null ($languages)) array_push ($this->entryArray, $languages); if (!is_null ($languages)) array_push ($this->entryArray, $languages);
} }

View file

@ -602,7 +602,7 @@ where data.book = books.id and data.id = ?');
PageQueryResult::SCOPE_SERIES, PageQueryResult::SCOPE_SERIES,
PageQueryResult::SCOPE_PUBLISHER, PageQueryResult::SCOPE_PUBLISHER,
PageQueryResult::SCOPE_BOOK) as $key) { PageQueryResult::SCOPE_BOOK) as $key) {
if (in_array($key, $config ['cops_ignored_search_scope']) || if (in_array($key, $config ['cops_ignored_categories']) ||
(!array_key_exists ($key, $query) && !array_key_exists ("all", $query))) { (!array_key_exists ($key, $query) && !array_key_exists ("all", $query))) {
$critArray [$i] = self::BAD_SEARCH; $critArray [$i] = self::BAD_SEARCH;
} }
@ -694,7 +694,7 @@ function getJson ($complete = false) {
PageQueryResult::SCOPE_SERIES, PageQueryResult::SCOPE_SERIES,
PageQueryResult::SCOPE_TAG, PageQueryResult::SCOPE_TAG,
PageQueryResult::SCOPE_PUBLISHER) as $key) { PageQueryResult::SCOPE_PUBLISHER) as $key) {
if (in_array($key, $config ['cops_ignored_search_scope'])) { if (in_array($key, $config ['cops_ignored_categories'])) {
continue; continue;
} }
switch ($key) { switch ($key) {

View file

@ -236,7 +236,7 @@
$config['cops_server_side_render'] = "Kindle|EBRD1101|EBRD1201|cybook"; $config['cops_server_side_render'] = "Kindle|EBRD1101|EBRD1201|cybook";
/* /*
* Specify the ignored categories with autocomplete search and standard search * Specify the ignored categories for the home screen and with search
* Meaning that if you don't want to search in publishers or tags just add them from the list * Meaning that if you don't want to search in publishers or tags just add them from the list
* Only accepted values : * Only accepted values :
* - author * - author
@ -244,8 +244,9 @@
* - series * - series
* - tag * - tag
* - publisher * - publisher
* - language
*/ */
$config ['cops_ignored_search_scope'] = array (); $config ['cops_ignored_categories'] = array ();
/* /*
* If you use a Sony eReader or Aldiko you can't download ebooks if your catalog * If you use a Sony eReader or Aldiko you can't download ebooks if your catalog

View file

@ -510,7 +510,7 @@ class PageTest extends PHPUnit_Framework_TestCase
// Match Lewis Caroll & Scarlet // Match Lewis Caroll & Scarlet
$query = "car"; $query = "car";
$config ['cops_ignored_search_scope'] = array ("author"); $config ['cops_ignored_categories'] = array ("author");
$currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage = Page::getPage ($page, $qid, $query, $n);
$currentPage->InitializeContent (); $currentPage->InitializeContent ();
@ -519,7 +519,7 @@ class PageTest extends PHPUnit_Framework_TestCase
$this->assertEquals ("A Study in Scarlet", $currentPage->entryArray [0]->title); $this->assertEquals ("A Study in Scarlet", $currentPage->entryArray [0]->title);
$this->assertTrue ($currentPage->ContainsBook ()); $this->assertTrue ($currentPage->ContainsBook ());
$config ['cops_ignored_search_scope'] = array (); $config ['cops_ignored_categories'] = array ();
$currentPage = Page::getPage ($page, $qid, $query, $n); $currentPage = Page::getPage ($page, $qid, $query, $n);
$currentPage->InitializeContent (); $currentPage->InitializeContent ();