aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_search.inc.php
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2013-10-19 17:43:04 +0000
committermistic100 <mistic@piwigo.org>2013-10-19 17:43:04 +0000
commitae707279a1945e383c312cd648d288606a79e341 (patch)
tree917bdc6e0609ed0eefed5f3693de3a017685acc4 /include/functions_search.inc.php
parent35ff1b7c1f933799397a0ce0a6723cf82f416ff3 (diff)
remove all array_push (50% slower than []) + some changes missing for feature:2978
git-svn-id: http://piwigo.org/svn/trunk@25018 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_search.inc.php49
1 files changed, 15 insertions, 34 deletions
diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php
index 6494f0d61..6c57b9e90 100644
--- a/include/functions_search.inc.php
+++ b/include/functions_search.inc.php
@@ -68,18 +68,15 @@ function get_sql_search_clause($search)
$local_clauses = array();
foreach ($search['fields'][$textfield]['words'] as $word)
{
- array_push($local_clauses, $textfield." LIKE '%".$word."%'");
+ $local_clauses[] = $textfield." LIKE '%".$word."%'";
}
// adds brackets around where clauses
$local_clauses = prepend_append_array_items($local_clauses, '(', ')');
- array_push(
- $clauses,
- implode(
- ' '.$search['fields'][$textfield]['mode'].' ',
- $local_clauses
- )
+ $clauses[] = implode(
+ ' '.$search['fields'][$textfield]['mode'].' ',
+ $local_clauses
);
}
}
@@ -100,15 +97,12 @@ function get_sql_search_clause($search)
$field_clauses = array();
foreach ($fields as $field)
{
- array_push($field_clauses, $field." LIKE '%".$word."%'");
+ $field_clauses[] = $field." LIKE '%".$word."%'";
}
// adds brackets around where clauses
- array_push(
- $word_clauses,
- implode(
- "\n OR ",
- $field_clauses
- )
+ $word_clauses[] = implode(
+ "\n OR ",
+ $field_clauses
);
}
@@ -117,26 +111,18 @@ function get_sql_search_clause($search)
create_function('&$s','$s="(".$s.")";')
);
- array_push(
- $clauses,
- "\n ".
+ $clauses[] = "\n ".
implode(
- "\n ".
- $search['fields']['allwords']['mode'].
- "\n ",
+ "\n ". $search['fields']['allwords']['mode']. "\n ",
$word_clauses
- )
- );
+ );
}
foreach (array('date_available', 'date_creation') as $datefield)
{
if (isset($search['fields'][$datefield]))
{
- array_push(
- $clauses,
- $datefield." = '".$search['fields'][$datefield]['date']."'"
- );
+ $clauses[] = $datefield." = '".$search['fields'][$datefield]['date']."'"
}
foreach (array('after','before') as $suffix)
@@ -145,15 +131,10 @@ function get_sql_search_clause($search)
if (isset($search['fields'][$key]))
{
- array_push(
- $clauses,
-
- $datefield.
+ $clauses[] = $datefield.
($suffix == 'after' ? ' >' : ' <').
($search['fields'][$key]['inc'] ? '=' : '').
- " '".$search['fields'][$key]['date']."'"
-
- );
+ " '".$search['fields'][$key]['date']."'";
}
}
}
@@ -171,7 +152,7 @@ function get_sql_search_clause($search)
}
$local_clause = 'category_id IN ('.implode(',', $cat_ids).')';
- array_push($clauses, $local_clause);
+ $clauses[] = $local_clause;
}
// adds brackets around where clauses