You are here

function search404_settings in Search 404 5

Same name and namespace in other branches
  1. 6 search404.module \search404_settings()
  2. 7 search404.admin.inc \search404_settings()

Settings form

1 string reference to 'search404_settings'
search404_menu in ./search404.module
Implementation of hook_menu().

File

./search404.module, line 166

Code

function search404_settings() {
  $form['search404_jump'] = array(
    '#type' => 'checkbox',
    '#title' => t('Jump directly to the search result when there is only one result.'),
    '#default_value' => variable_get('search404_jump', FALSE),
  );
  $form['search404_first'] = array(
    '#type' => 'checkbox',
    '#title' => t('Jump directly to the first search result when there are multiple results.'),
    '#default_value' => variable_get('search404_first', FALSE),
  );
  $form['advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced settings'),
    '#description' => t("WARNING. Some of these settings can mess up stuff, don't touch unless you know what you are doing."),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['advanced']['search404_use_or'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use OR between keywords when searching.'),
    '#default_value' => variable_get('search404_use_or', FALSE),
  );
  $form['advanced']['search404_use_search_engine'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use auto-detection of keywords from search engine referer. BETA! Not for production sites, use at your own risk.'),
    '#default_value' => variable_get('search404_use_search_engine', FALSE),
  );
  $form['advanced']['search404_ignore'] = array(
    '#type' => 'textfield',
    '#title' => t('Words to ignore'),
    '#description' => t('These words will be ignored from query. Separate words with a space, e.g.: "and or the".'),
    '#default_value' => variable_get('search404_ignore', 'and or the'),
  );
  $form['advanced']['search404_ignore_extensions'] = array(
    '#type' => 'textfield',
    '#title' => t('Extensions to ignore'),
    '#description' => t('These extensions will be ignored from query. Separate extensions with a space, e.g.: "htm html php". Do not include leading dot.'),
    '#default_value' => variable_get('search404_ignore_extensions', 'htm html php'),
  );
  $form['advanced']['search404_ignore_query'] = array(
    '#type' => 'textfield',
    '#title' => t('Extensions to abort search'),
    '#description' => t('A search will not be performed for a query ending in the following extensions. Separate extensions with a space, e.g.: "gif jpg jpeg bmp png". Do not include leading dot.'),
    '#default_value' => variable_get('search404_ignore_query', 'gif jpg jpeg bmp png'),
  );
  $form['advanced']['search404_regex'] = array(
    '#type' => 'textfield',
    '#title' => t('PCRE REGEX'),
    '#description' => t('This regex will applied to all queries. It uses the code:<p>%code</p>Look directly at the source code to understand underlying syntax. See also <a href="http://php.net/pcre">PCRE pages in the PHP Manual</a>.', array(
      '%code' => "\$keys = preg_grep(variable_get('search404_regex'), \$keys);\n\$keys = \$keys[0];",
      '%function' => 'search404_get_keys()',
    )),
    '#default_value' => variable_get('search404_regex', ''),
  );
  return system_settings_form($form);
}