You are here

function phpexcel_settings_form in PHPExcel 8.3

Same name and namespace in other branches
  1. 6.2 phpexcel.module \phpexcel_settings_form()
  2. 6 phpexcel.module \phpexcel_settings_form()
  3. 7.3 phpexcel.module \phpexcel_settings_form()
  4. 7 phpexcel.module \phpexcel_settings_form()
  5. 7.2 phpexcel.module \phpexcel_settings_form()

Settings form.

2 string references to 'phpexcel_settings_form'
phpexcel_menu in ./phpexcel.module
Implements hook_menu().
SettingsForm::getFormID in src/Form/SettingsForm.php

File

./phpexcel.module, line 69
The module file.

Code

function phpexcel_settings_form() {
  $form = array();
  $form['phpexcel_cache_mechanism'] = array(
    '#type' => 'radios',
    '#title' => t("Cache mechanism"),
    '#description' => t("The PHPExcel library uses an average of 1k of memory for <em>each cell</em>. This can quickly use up available memory. This can be reduced, however, by specifiying a caching method. This will cache each cell, reducing memory usage. Note, however, that all caching methods are slower than the default <em>Cache in memory</em> method."),
    '#options' => array(
      'cache_in_memory' => t("Cache in memory. Default method. Fastest, but uses a lot of memory"),
      'cache_in_memory_serialized' => t("Cache in memory, serialized. Fast, uses slightly less memory than the previous option."),
      'cache_in_memory_gzip' => t("Cache in memory, GZipped. Fast, uses slightly less memory that the previous option."),
      'cache_to_phpTemp' => t("Cache to php://temp. Slow. Will still cache to memory up to a certain limit (default 1MB) to speed up the process."),
      'cache_to_apc' => t("Cache to APC. Fast."),
      'cache_to_memcache' => t("Cache to Memcache. Fast."),
      'cache_to_sqlite3' => t("Cache to SQLite 3. Slowest, but most memory-efficient."),
    ),
    '#default_value' => variable_get('phpexcel_cache_mechanism', 'cache_in_memory'),
  );

  // PHPTemp settings.
  $form['phptemp'] = array(
    '#type' => 'fieldset',
    '#title' => t("PHPTemp options"),
    '#collapsible' => TRUE,
    '#collapsed' => variable_get('phpexcel_cache_mechanism') != 'cache_to_phpTemp',
  );
  $form['phptemp']['phpexcel_phptemp_limit'] = array(
    '#title' => t("PHPTemp memory cache size"),
    '#description' => t("The limit before which PHPExcel will still use memory instead of disk for cell caching. Value in MB (only give a numerical value)."),
    '#type' => 'textfield',
    '#default_value' => variable_get('phpexcel_phptemp_limit', 1),
  );

  // APC settings.
  $form['apc'] = array(
    '#type' => 'fieldset',
    '#title' => t("APC options"),
    '#collapsible' => TRUE,
    '#collapsed' => variable_get('phpexcel_cache_mechanism') != 'cache_to_apc',
  );
  $form['apc']['phpexcel_apc_cachetime'] = array(
    '#title' => t("APC cache timeout"),
    '#description' => t("The time the cell data remains valid in APC. Defaults to 600 seconds. Data is automatically cleared from the cache when the script terminates."),
    '#type' => 'textfield',
    '#default_value' => variable_get('phpexcel_apc_cachetime', '600'),
  );

  // Memcache settings.
  $form['memcache'] = array(
    '#type' => 'fieldset',
    '#title' => t("Memcache options"),
    '#collapsible' => TRUE,
    '#collapsed' => variable_get('phpexcel_cache_mechanism') != 'cache_to_memcache',
  );
  $form['memcache']['phpexcel_memcache_host'] = array(
    '#title' => t("Memcache server"),
    '#description' => t("If you use Memcache, specify it's host here (e.g. 'localhost')."),
    '#type' => 'textfield',
    '#default_value' => variable_get('phpexcel_memcache_host', 'localhost'),
  );
  $form['memcache']['phpexcel_memcache_port'] = array(
    '#title' => t("Memcache port"),
    '#description' => t("If you use Memcache, specify it's port here."),
    '#type' => 'textfield',
    '#default_value' => variable_get('phpexcel_memcache_port', '11211'),
  );
  $form['memcache']['phpexcel_memcache_cachetime'] = array(
    '#title' => t("Memcache cache timeout"),
    '#description' => t("The time the cell data remains valid in Memcache. Defaults to 600 seconds. Data is automatically cleared from the cache when the script terminates."),
    '#type' => 'textfield',
    '#default_value' => variable_get('phpexcel_memcache_cachetime', '600'),
  );
  return system_settings_form($form);
}