You are here

function xmlsitemap_settings_form_validate in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.2 xmlsitemap.admin.inc \xmlsitemap_settings_form_validate()

Form validator; Check the sitemap files directory.

See also

xmlsitemap_settings_form()

1 string reference to 'xmlsitemap_settings_form_validate'
xmlsitemap_settings_form in ./xmlsitemap.admin.inc
Form builder; Administration settings form.

File

./xmlsitemap.admin.inc, line 417
Administrative page callbacks for the xmlsitemap module.

Code

function xmlsitemap_settings_form_validate($form, &$form_state) {

  // Check that the chunk size will not create more than 1000 chunks.
  $chunk_size = $form_state['values']['xmlsitemap_chunk_size'];
  if ($chunk_size != 'auto' && $chunk_size != 50000 && xmlsitemap_get_link_count() / $chunk_size > 1000) {
    form_set_error('xmlsitemap_chunk_size', t('The sitemap page link count of @size will create more than 1,000 sitemap pages. Please increase the link count.', array(
      '@size' => $chunk_size,
    )));
  }
  $base_url =& $form_state['values']['xmlsitemap_base_url'];
  $base_url = rtrim($base_url, '/');
  if ($base_url != '' && !valid_url($base_url, TRUE)) {
    form_set_error('xmlsitemap_base_url', t('Invalid base URL.'));
  }
}