function custom_search_preprocess_search_result in Custom Search 6
Same name and namespace in other branches
- 8 custom_search.pages.inc \custom_search_preprocess_search_result()
- 7 theme/custom_search.pages.inc \custom_search_preprocess_search_result()
File
- theme/
custom_search.pages.inc, line 50 - User page callbacks for the custom_search module.
Code
function custom_search_preprocess_search_result(&$variables) {
// used to identify the correct info string
$comment_str = preg_replace("/[0-9] (\\b[a-z]*\\b).*/", "\$1", t('1 comment'));
$attachment_str = preg_replace("/@*[a-z0-9]* (\\b[a-z]*\\b).*/", "\$1", t('1 attachment'));
$infos = array();
if (isset($variables['info_split'])) {
foreach ($variables['info_split'] as $key => $info) {
if (!is_numeric($key)) {
if (variable_get('custom_search_results_info_' . $key, TRUE)) {
array_push($infos, $info);
}
}
else {
if (variable_get('custom_search_results_info_comment', TRUE) && !empty($comment_str) && strpos($info, $comment_str) !== FALSE) {
array_push($infos, $info);
}
if (variable_get('custom_search_results_info_upload', TRUE) && !empty($attachment_str) && strpos($info, $attachment_str) !== FALSE) {
array_push($infos, $info);
}
}
}
}
$variables['info'] = implode(' - ', $infos);
}