function _imagepicker_search_opts in Image Picker 6.2
Same name and namespace in other branches
- 7 imagepicker.functions.inc \_imagepicker_search_opts()
3 calls to _imagepicker_search_opts()
- imagepicker_browse_admin_form in ./
imagepicker.functions.inc - list of images with bulk operations
- _imagepicker_browse in ./
imagepicker.functions.inc - _imagepicker_browse_public in ./
imagepicker.functions.inc
File
- ./
imagepicker.functions.inc, line 2415 - Imagepicker functions
Code
function _imagepicker_search_opts($searchs) {
$search_opts = variable_get('imagepicker_browser_search_opts', array());
if (!isset($search_opts['name'])) {
$search_opts['name'] = FALSE;
}
if (!isset($search_opts['desc'])) {
$search_opts['desc'] = FALSE;
}
if (!isset($search_opts['title'])) {
$search_opts['title'] = FALSE;
}
if ($search_opts['name'] && !$search_opts['desc'] && !$search_opts['title']) {
$s = " AND i.img_name LIKE '%%%s%%' ";
$sarr = array(
$searchs,
);
}
elseif ($search_opts['name'] && $search_opts['desc'] && !$search_opts['title']) {
$s = " AND (i.img_name LIKE '%%%s%%' OR i.img_description LIKE '%%%s%%') ";
$sarr = array(
$searchs,
$searchs,
);
}
elseif ($search_opts['name'] && !$search_opts['desc'] && $search_opts['title']) {
$s = " AND (i.img_name LIKE '%%%s%%' OR i.img_title LIKE '%%%s%%') ";
$sarr = array(
$searchs,
$searchs,
);
}
elseif (!$search_opts['name'] && $search_opts['desc'] && $search_opts['title']) {
$s = " AND (i.img_description LIKE '%%%s%%' OR i.img_title LIKE '%%%s%%') ";
$sarr = array(
$searchs,
$searchs,
);
}
elseif (!$search_opts['name'] && !$search_opts['desc'] && $search_opts['title']) {
$s = " AND i.img_title LIKE '%%%s%%' ";
$sarr = array(
$searchs,
);
}
elseif (!$search_opts['name'] && $search_opts['desc'] && !$search_opts['title']) {
$s = " AND i.img_description LIKE '%%%s%%' ";
$sarr = array(
$searchs,
);
}
else {
$s = " AND (i.img_name LIKE '%%%s%%' OR i.img_description LIKE '%%%s%%' OR i.img_title LIKE '%%%s%%') ";
$sarr = array(
$searchs,
$searchs,
$searchs,
);
}
return array(
0 => $s,
1 => $sarr,
);
}