web/drupal/modules/xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.admin.inc
branchdrupal
changeset 74 0ff3ba646492
equal deleted inserted replaced
73:fcf75e232c5b 74:0ff3ba646492
       
     1 <?php
       
     2 // $Id: xmlsitemap_engines.admin.inc,v 1.1.2.15 2009/06/17 14:52:41 earnie Exp $
       
     3 
       
     4 
       
     5 /**
       
     6  * @file
       
     7  * XML sitemap engines settings UI.
       
     8  */
       
     9 
       
    10 /**
       
    11  * @addtogroup xmlsitemap
       
    12  * @{
       
    13  */
       
    14 
       
    15 /*****************************************************************************
       
    16  * Menu callbacks / form builders, submit/validate functions.
       
    17  ****************************************************************************/
       
    18 
       
    19 /**
       
    20  * Form builder; return the search engine settings form.
       
    21  */
       
    22 function xmlsitemap_engines_settings() {
       
    23   $form['submission'] = array(
       
    24     '#type' => 'fieldset',
       
    25     '#title' => t('Submission settings'),
       
    26     '#collapsible' => TRUE,
       
    27   );
       
    28   $form['submission']['xmlsitemap_engines_submit'] = array(
       
    29     '#type' => 'checkbox',
       
    30     '#title' => t('Submit the sitemap when content changes'),
       
    31     '#description' => t('If enabled, the search engines will be notified of changes to the sitemap each time the sitemap content is changed.'),
       
    32     '#default_value' => variable_get('xmlsitemap_engines_submit', FALSE),
       
    33   );
       
    34   $form['submission']['xmlsitemap_engines_cron_submit_frequency'] = array(
       
    35     '#type' => 'select',
       
    36     '#title' => t('Frequency of sitemap submission'),
       
    37     '#description' => t('The rate at which the sitemap is submitted to the search engines.'),
       
    38     '#default_value' => variable_get('xmlsitemap_engines_cron_submit_frequency', 3600),
       
    39     '#options' => array(
       
    40       '29030400' => t('Yearly'),
       
    41       '14515200' => t('Every 6 months'),
       
    42       '2419200' => t('Monthly'),
       
    43       '1296000' => t('Every 15 days'),
       
    44       '604800' => t('Weekly'),
       
    45       '86400' => t('Daily'),
       
    46       '3600' => t('Hourly'),
       
    47       '-1' => t('Never'),
       
    48     ),
       
    49   );
       
    50   // Ask.com fields.
       
    51   $form['ask'] = array(
       
    52     '#type' => 'fieldset',
       
    53     '#title' => t('Ask.com'),
       
    54     '#collapsible' => TRUE,
       
    55     '#collapsed' => TRUE,
       
    56   );
       
    57   $form['ask']['xmlsitemap_engines_ask_submit'] = array(
       
    58     '#type' => 'checkbox',
       
    59     '#title' => t('Submit the sitemap to Ask.com'),
       
    60     '#default_value' => variable_get('xmlsitemap_engines_ask_submit', FALSE),
       
    61   );
       
    62   $form['ask']['xmlsitemap_engines_ask_url'] = array(
       
    63     '#type' => 'textfield',
       
    64     '#title' => t('Submission URL'),
       
    65     '#description' => t('The URL to submit the sitemap to. Use %placeholder as placeholder for the sitemap URL.', array('%placeholder' => '[sitemap]')),
       
    66     '#default_value' => variable_get('xmlsitemap_engines_ask_url', 'http://submissions.ask.com/ping?sitemap=[sitemap]'),
       
    67   );
       
    68   // Google fields.
       
    69   $form['google'] = array(
       
    70     '#type' => 'fieldset',
       
    71     '#title' => t('Google'),
       
    72     '#collapsible' => TRUE,
       
    73     '#collapsed' => TRUE,
       
    74   );
       
    75   $form['google']['xmlsitemap_engines_google_submit'] = array(
       
    76     '#type' => 'checkbox',
       
    77     '#title' => t('Submit the sitemap to Google'),
       
    78     '#default_value' => variable_get('xmlsitemap_engines_google_submit', FALSE),
       
    79   );
       
    80   $form['google']['xmlsitemap_engines_google_url'] = array(
       
    81     '#type' => 'textfield',
       
    82     '#title' => t('Submission URL'),
       
    83     '#description' => t('The URL to submit the sitemap to. Use %placeholder like placeholder for the sitemap URL.', array('%placeholder' => '[sitemap]')),
       
    84     '#default_value' => variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap=[sitemap]'),
       
    85   );
       
    86   $form['google']['xmlsitemap_engines_google_verify'] = array(
       
    87     '#type' => 'textfield',
       
    88     '#title' => t('Verification link'),
       
    89     '#description' => t('In order to show statistics, Google will ask you to verify that you control this site by creating a file with a certain name. Enter that name here and the XML sitemap module will create a path to that file name. This will only work if you have clean URLs enabled.'),
       
    90     '#default_value' => variable_get('xmlsitemap_engines_google_verify', ''),
       
    91   );
       
    92   // Moreover.com fields.
       
    93   $form['moreover'] = array(
       
    94     '#type' => 'fieldset',
       
    95     '#title' => t('Moreover.com'),
       
    96     '#collapsible' => TRUE,
       
    97     '#collapsed' => TRUE,
       
    98   );
       
    99   $form['moreover']['xmlsitemap_engines_moreover_submit'] = array(
       
   100     '#type' => 'checkbox',
       
   101     '#title' => t('Submit the sitemap to Moreover.com'),
       
   102     '#default_value' => variable_get('xmlsitemap_engines_moreover_submit', FALSE),
       
   103   );
       
   104   $form['moreover']['xmlsitemap_engines_moreover_url'] = array(
       
   105     '#type' => 'textfield',
       
   106     '#title' => t('Submission URL'),
       
   107     '#description' => t('The URL to submit the sitemap to. Use %placeholder like placeholder for the sitemap URL.', array('%placeholder' => '[sitemap]')),
       
   108     '#default_value' => variable_get('xmlsitemap_engines_moreover_url', 'http://api.moreover.com/ping?u=[sitemap]'),
       
   109   );
       
   110   // Bing fields.
       
   111   $form['bing'] = array(
       
   112     '#type' => 'fieldset',
       
   113     '#title' => t('Bing (formerly Live Search)'),
       
   114     '#collapsible' => TRUE,
       
   115     '#collapsed' => TRUE,
       
   116   );
       
   117   $form['bing']['xmlsitemap_engines_bing_submit'] = array(
       
   118     '#type' => 'checkbox',
       
   119     '#title' => t('Submit the sitemap to Bing'),
       
   120     '#default_value' => variable_get('xmlsitemap_engines_bing_submit', FALSE),
       
   121   );
       
   122   $form['bing']['xmlsitemap_engines_bing_url'] = array(
       
   123     '#type' => 'textfield',
       
   124     '#title' => t('Submission URL'),
       
   125     '#description' => t('The URL to submit the sitemap to. Use %placeholder like placeholder for the sitemap URL.', array('%placeholder' => '[sitemap]')),
       
   126     '#default_value' => variable_get('xmlsitemap_engines_bing_url', 'http://www.bing.com/webmaster/ping.aspx?siteMap=[sitemap]'),
       
   127   );
       
   128   $form['bing']['xmlsitemap_engines_bing_verify'] = array(
       
   129     '#type' => 'textfield',
       
   130     '#title' => t('Authentication file'),
       
   131     '#description' => t('Before allowing you to view additional information, Bing will ask you to verify that you control this site by creating a file with a certain name. Enter that name here, and XML sitemap will create a path to that file name. This will only work if you have clean URLs enabled.'),
       
   132     '#default_value' => variable_get('xmlsitemap_engines_bing_verify', ''),
       
   133   );
       
   134   $form['bing']['xmlsitemap_engines_bing_verify_string'] = array(
       
   135     '#type' => 'textfield',
       
   136     '#title' => t('Bing authentication tag'),
       
   137     '#description' => t('Bing will give you an authentication tag.'),
       
   138     '#default_value' => variable_get('xmlsitemap_engines_bing_verify_string', ''),
       
   139   );
       
   140   // Yahoo! fields.
       
   141   $form['yahoo'] = array(
       
   142     '#type' => 'fieldset',
       
   143     '#title' => t('Yahoo!'),
       
   144     '#collapsible' => TRUE,
       
   145     '#collapsed' => TRUE,
       
   146   );
       
   147   $form['yahoo']['xmlsitemap_engines_yahoo_submit'] = array(
       
   148     '#type' => 'checkbox',
       
   149     '#title' => t('Submit the sitemap to Yahoo!'),
       
   150     '#default_value' => variable_get('xmlsitemap_engines_yahoo_submit', FALSE),
       
   151   );
       
   152   $form['yahoo']['xmlsitemap_engines_yahoo_url'] = array(
       
   153     '#type' => 'textfield',
       
   154     '#title' => t('Submission URL'),
       
   155     '#description' => t('The URL to submit the sitemap to. Use %placeholder like placeholder for the sitemap URL.', array('%placeholder' => '[sitemap]')),
       
   156     '#default_value' => variable_get('xmlsitemap_engines_yahoo_url', 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=[sitemap]'),
       
   157   );
       
   158   $form['yahoo']['xmlsitemap_engines_yahoo_verify'] = array(
       
   159     '#type' => 'textfield',
       
   160     '#title' => t('Verification link'),
       
   161     '#description' => t('Before allowing you to view additional information, Yahoo! will ask you to verify that you control this site by creating a file with a certain name. Enter that name here, and XML sitemap will create a path to that file name. This will only work if you have clean URLs enabled.'),
       
   162     '#default_value' => variable_get('xmlsitemap_engines_yahoo_verify', ''),
       
   163   );
       
   164   $form['yahoo']['xmlsitemap_engines_yahoo_verify_string'] = array(
       
   165     '#type' => 'textfield',
       
   166     '#title' => t('Authentication key'),
       
   167     '#description' => t('Yahoo! will ask you to put an authentication key in the verification file.'),
       
   168     '#default_value' => variable_get('xmlsitemap_engines_yahoo_verify_string', ''),
       
   169   );
       
   170   $form = system_settings_form($form);
       
   171   $form['#submit'][] = 'xmlsitemap_engines_settings_submit';
       
   172   return $form;
       
   173 }
       
   174 
       
   175 /**
       
   176  * Submit the settings form.
       
   177  */
       
   178 function xmlsitemap_engines_settings_submit($form, &$form_state) {
       
   179   variable_set('menu_rebuild_needed', TRUE);
       
   180 }
       
   181 
       
   182 /**
       
   183  * @} End of "addtogroup xmlsitemap".
       
   184  */
       
   185