1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Added settings helper and formatted code in some files

This commit is contained in:
Dan Brown
2016-03-06 12:55:08 +00:00
parent e744d4c82c
commit 66c56e9d02
10 changed files with 37 additions and 25 deletions

View File

@ -107,7 +107,7 @@ abstract class Entity extends Ownable
$exactTerms = [];
foreach ($terms as $key => $term) {
$term = htmlentities($term, ENT_QUOTES);
$term = preg_replace('/[+\-><\(\)~*\"@]+/', ' ', $term);
$term = preg_replace('/[+\-><\(\)~*\"@]+/', ' ', $term);
if (preg_match('/\s/', $term)) {
$exactTerms[] = '%' . $term . '%';
$term = '"' . $term . '"';
@ -123,7 +123,7 @@ abstract class Entity extends Ownable
// Ensure at least one exact term matches if in search
if (count($exactTerms) > 0) {
$search = $search->where(function($query) use ($exactTerms, $fieldsToSearch) {
$search = $search->where(function ($query) use ($exactTerms, $fieldsToSearch) {
foreach ($exactTerms as $exactTerm) {
foreach ($fieldsToSearch as $field) {
$query->orWhere($field, 'like', $exactTerm);