1 call to _advagg_admin_form_general()
advagg_advagg_admin_form in includes/admin.inc
Implements hook_advagg_admin_form(). @see: advagg_form_system_performance_settings_alter().

File

includes/admin.inc, line 108

Code

function _advagg_admin_form_general(&$form, &$form_state) {
    $file_path = drupal_get_path('module', 'advagg');
    drupal_add_js(array(
        'advagg' => array(
            'key' => md5(drupal_get_private_key()),
        ),
    ), 'setting');
    drupal_add_js($file_path . '/advagg.admin.js');
    $readme = $file_path . '/README.txt';
    $advagg_enabled = isset($form_state['values']['advagg_enabled']) ? (int) $form_state['values']['advagg_enabled'] : (int) variable_get('advagg_enabled', ADVAGG_ENABLED);
    $form['advagg_closure'] = array(
        '#type' => 'checkbox',
        '#title' => t('Aggregate footer JavaScript'),
        '#default_value' => variable_get('advagg_closure', ADVAGG_CLOSURE),
        '#description' => t('If enabled javascript files in the closure region will be aggregated.'),
    );
    // Make sure the advagg_check_missing_handler function is available.
    module_load_install('advagg');
    $ret = advagg_check_missing_handler();
    $form['advagg_async_generation'] = array(
        '#type' => 'checkbox',
        '#title' => t('Generate CSS/JS files on request (async mode)'),
        '#default_value' => variable_get('advagg_async_generation', ADVAGG_ASYNC_GENERATION),
        '#disabled' => $ret['advagg_async_generation']['severity'] == REQUIREMENT_ERROR ? TRUE : FALSE,
        '#description' => t('Current State: !value', array(
            '!value' => filter_xss(' ' . $ret['advagg_async_generation']['value'] . ' ' . (!empty($ret['advagg_async_generation']['description']) ? $ret['advagg_async_generation']['description'] : '') . ' '),
        )),
    );
    $form['advagg_gzip_compression'] = array(
        '#type' => 'checkbox',
        '#title' => t('Gzip CSS/JS files'),
        '#default_value' => variable_get('advagg_gzip_compression', ADVAGG_GZIP_COMPRESSION),
        '#description' => t('This might break CSS/JS handling at the Apache level. If it does, use the rules for your webroot level htaccess file before re-enabling. Directions on what to change are located in the <a href="@readme">readme</a> file. In short, be sure to test this out.', array(
            '@readme' => url($readme),
        )),
    );
    $form['advagg_dir_htaccess'] = array(
        '#type' => 'checkbox',
        '#title' => t('Generate .htaccess files in the advagg_* dirs'),
        '#default_value' => variable_get('advagg_dir_htaccess', ADVAGG_DIR_HTACCESS),
        '#description' => t('Disable if your using the rules from the <a href="@readme">readme</a> file in your webroot level htaccess file.', array(
            '@readme' => url($readme),
        )),
    );
    $form['advagg_rebuild_on_flush'] = array(
        '#type' => 'checkbox',
        '#title' => t('Regenerate flushed bundles in the cache flush request'),
        '#default_value' => variable_get('advagg_rebuild_on_flush', ADVAGG_REBUILD_ON_FLUSH),
        '#description' => t('You can enable if your server will not timeout on a request. This will call advagg_rebuild_bundle() as a <a href="http://php.net/register-shutdown-function">shutdown function</a> for every bundle that has been marked as expired; thus rebuilding that bundle in the same request as the flush.'),
    );
    if (file_default_scheme() !== 'public') {
        $extra = module_exists('boost') ? t('If boost is installed, you can use the cache directory for advagg files.') : '';
        $form['advagg_custom_files_dir'] = array(
            '#type' => 'textfield',
            '#field_prefix' => '<div>' . t('You are using a private file system. You must serve aggregated files via a public folder.') . '</div>',
            '#title' => t('Use a different directory for storing advagg files'),
            '#default_value' => variable_get('advagg_custom_files_dir', ADVAGG_CUSTOM_FILES_DIR),
            '#description' => check_plain(t('You need to create a publicly writable directory (same permissions as Drupals files folder).') . ' ' . $extra . ' ' . t('If you do not need this, you can put a space in this box.')),
            '#required' => TRUE,
        );
    }
    $options = array(
        0 => t('Wait for locks'),
        1 => t('Do not wait for locks'),
        2 => t('Only serve aggregated files if they are already built (only works if async is enabled)'),
    );
    $form['advagg_aggregate_mode'] = array(
        '#type' => 'radios',
        '#title' => t('Aggregation Inclusion Mode'),
        '#default_value' => variable_get('advagg_aggregate_mode', ADVAGG_AGGREGATE_MODE),
        '#options' => $options,
        '#description' => t('Should the page wait for the aggregate to be built before including the file, or should it send out the page with aggregates not included.'),
    );
    $form['advagg_page_cache_mode'] = array(
        '#type' => 'checkbox',
        '#title' => t('Disable page caching if all aggregates are not included on the page.'),
        '#default_value' => variable_get('advagg_page_cache_mode', ADVAGG_PAGE_CACHE_MODE),
    );
    $form['advagg_checksum_mode'] = array(
        '#type' => 'radios',
        '#title' => t('File Checksum Mode'),
        '#default_value' => variable_get('advagg_checksum_mode', ADVAGG_CHECKSUM_MODE),
        '#options' => array(
            'filemtime' => function_exists('filemtime') ? 'filemtime' : 'filemtime (not installed)',
            'md5' => function_exists('md5') ? 'md5' : 'md5 (not installed)',
        ),
        '#description' => t('If Drupal is on multiple servers and the file system is not shared;  using md5 is recommended. The file modification time (filemtime) could be different with this type of setup. WARNING: Changing this value will invalidate all bundles and new ones will have to be built.'),
    );
    $form['advagg_server_addr'] = array(
        '#type' => 'textfield',
        '#title' => t('IP Address to send all asynchronous requests to'),
        '#default_value' => variable_get('advagg_server_addr', FALSE),
        '#description' => t('If left blank it will use the same server as the request. If set to -1 it will use the host name instead of an IP address.'),
    );
    //   $form['advagg_debug'] = array(
    //     '#type'           => 'checkbox',
    //     '#title'          => t('Debug to watchdog.'),
    //     '#default_value'  => variable_get('advagg_debug', ADVAGG_DEBUG),
    //   );
}