You are here

function boost_settings_form in Boost 5

Declares administrative settings for the Boost module.

Called from hook_settings().

1 call to boost_settings_form()
boost_settings in ./boost.module
Implementation of hook_settings(). Declares administrative settings for a module.

File

./boost.admin.inc, line 50
All the code for the Boost module's administrative interface.

Code

function boost_settings_form($form = array()) {

  //_boost_check_htaccess(); // TODO
  $options = array(
    t('Cache every page except the listed pages.'),
    t('Cache only the listed pages.'),
  );
  $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array(
    '%blog' => 'blog',
    '%blog-wildcard' => 'blog/*',
    '%front' => '<front>',
  ));
  if (user_access('use PHP for block visibility')) {
    $options[] = t('Cache pages for which the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
    $description .= t(' If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can severely break your Drupal site.', array(
      '%php' => '<?php ?>',
    ));
  }
  $form['cacheability'] = array(
    '#type' => 'fieldset',
    '#title' => t('Cacheability settings'),
    '#collapsible' => FALSE,
  );
  $form['cacheability']['boost_cacheability_option'] = array(
    '#type' => 'radios',
    '#title' => t('Cache specific pages'),
    '#options' => $options,
    '#default_value' => BOOST_CACHEABILITY_OPTION,
  );
  $form['cacheability']['boost_cacheability_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => BOOST_CACHEABILITY_PAGES,
    '#description' => $description,
  );

  // TODO

  /*$form['throttle'] = array(
      '#type'          => 'fieldset',
      '#title'         => t('Throttle settings'),
      '#collapsible'   => FALSE,
    );
    $form['throttle']['boost_cron_limit'] = array(
      '#type'          => 'select',
      '#title'         => t('Pages to update per cron run'),
      '#default_value' => BOOST_CRON_LIMIT,
      '#options'       => drupal_map_assoc(array(10, 20, 50, 100, 200, 500, 1000)),
      '#description'   => t('The maximum number of static pages that will be built or rebuilt in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.'),
    );*/
  $form['advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['advanced']['boost_file_extension'] = array(
    '#type' => 'textfield',
    '#title' => t('Cache file extension'),
    '#default_value' => BOOST_FILE_EXTENSION,
    '#size' => 10,
    '#maxlength' => 32,
    '#required' => TRUE,
    '#description' => t('The file extension to append to the file name of the generated cache files. Note that this setting is of no relevance to any public URLs, and it is strongly recommended to leave this as the default \'.html\' unless you know what you are doing. If you change this, you must also change the URL rewrite rules in your web server configuration (.htaccess for Apache, lighttpd.conf for Lighttpd), or caching will not work.'),
  );
  $form['advanced']['boost_fetch_method'] = array(
    '#type' => 'select',
    '#title' => t('Page fetch method'),
    '#default_value' => BOOST_FETCH_METHOD,
    '#options' => array(
      'php' => t('PHP fopen() wrapper'),
      'wget' => t('Wget shell command'),
      'curl' => t('curl shell command'),
    ),
    '#description' => t('The method used to retrieve the contents of the Drupal pages to be cached. The default should work in most cases.'),
  );
  $form['advanced']['boost_pre_process_function'] = array(
    '#type' => 'textfield',
    '#title' => t('Pre-process function'),
    '#default_value' => BOOST_PRE_PROCESS_FUNCTION,
    '#maxlength' => 255,
    '#description' => t('The name of a PHP function used to pre-process the contents of each page before writing them out to static files. The function is called with the contents of the page passed as a string argument, and its return value is used as the data written out to the disk.'),
  );

  // TODO:

  /*$form['advanced']['boost_post_update_command'] = array(
      '#type'          => 'textfield',
      '#title'         => t('Post-update shell command'),
      '#default_value' => BOOST_POST_UPDATE_COMMAND,
      '#maxlength'     => 255,
      '#description'   => t('If you are synchronizing the generated static cache files to an external server through some means such as SFTP or rsync, you can enter a shell command to be executed following a successful cron-triggered cache update. Note that this is an advanced setting that should normally be left blank.'),
    );*/
  return $form;
}