function kwresearch_admin_settings in Keyword Research 6
Same name and namespace in other branches
- 7 kwresearch.admin.inc \kwresearch_admin_settings()
Displays the form for the standard settings tab.
Return value
array A structured array for use with Forms API.
1 string reference to 'kwresearch_admin_settings'
- kwresearch_menu in ./
kwresearch.module - Implementation of hook_menu().
File
- ./
kwresearch.admin.inc, line 14 - Admin include file.
Code
function kwresearch_admin_settings() {
$sources = module_invoke_all('kwresearch_sources');
if (is_array($sources) && count($sources) > 1) {
foreach ($sources as $aid => $source) {
$s[] = $source['title'];
}
$form['sources'] = array(
'#type' => 'item',
'#title' => t('Enabled keyword statistics sources'),
'#value' => theme_item_list($s),
'#description' => t('Sources provide data for keyword stats reports.'),
);
}
else {
$form['sources'] = array(
'#type' => 'item',
'#title' => t('Sources'),
'#value' => t('No keyword statistics sources have been enabled. To access keyword popularity data enable a data source such as the Keyword Research Google (Keyword Research sub-module), !scribe, !wordstream or !wordtracker modules.', array(
'!scribe' => l('Scribe SEO', 'http://drupal.org/project/scribeseo'),
'!wordstream' => l('WordStream', 'http://drupal.org/project/wordstream'),
'!wordtracker' => l('Wordtracker', 'http://drupal.org/project/wordtracker'),
)),
);
$sources = array();
}
/*
if (!module_exists('scribeseo')) {
$msg = t('You can also use the Scribe SEO API as a source for keyword statitics; !link.',
array(
'!link' => l(t('download and install Scribe SEO'), 'http://drupal.org/project/scribeseo', array('attributes' => array('target' => 'drupal'))),
)
);
}
elseif (!variable_get('scribeseo_apikey', '')) {
$msg .= t('You can also use the Scribe SEO API as a source for keyword statitics. The Scribe module is installed, however an the API key is missing; !link.',
array(
'!link' => l(t('enable the Scribe API key'), 'admin/settings/scribeseo', array('attributes' => array('target' => 'drupal'))),
)
);
}
else {
$msg = t('The Scribe API is enabled as a keyword data source.');
}
$form['scribe_apikey'] = array(
'#type' => 'item',
'#title' => t('Scribe API Key'),
'#value' => $msg,
);
*/
$form['kwresearch_stats_report_options'] = array(
'#type' => 'fieldset',
'#title' => t('Stats report options'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
require_once './' . drupal_get_path('module', 'kwresearch') . "/includes/stats_report.inc";
$options = kwresearch_get_report_data_options();
$def_values = kwresearch_get_report_data_options_defaults();
//dsm(variable_get('kwresearch_popularity_report_columns', $def_values));
$form['kwresearch_stats_report_options']['kwresearch_stats_report_data_options'] = array(
'#type' => 'checkboxes',
'#title' => t('Report data'),
'#options' => $options,
'#default_value' => variable_get('kwresearch_stats_report_data_options', $def_values),
);
$options = kwresearch_get_report_links_options();
$def_values = kwresearch_get_report_links_options_defaults();
$form['kwresearch_stats_report_options']['kwresearch_stats_report_links_options'] = array(
'#type' => 'checkboxes',
'#title' => t('Report links'),
'#options' => $options,
'#default_value' => variable_get('kwresearch_stats_report_links_options', $def_values),
);
$form['kwresearch_stats_report_options']['kwresearch_stats_report_item_limit'] = array(
'#type' => 'textfield',
'#title' => t('Item limit'),
'#size' => 5,
'#default_value' => variable_get('kwresearch_stats_report_item_limit', KWARESEARCH_STATS_REPORT_ITEM_LIMIT_DEFAULT),
'#description' => t('The maximum number of items to show in the report'),
);
$form['kwresearch_site_report_options'] = array(
'#type' => 'fieldset',
'#title' => t('Site report options'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
require_once './' . drupal_get_path('module', 'kwresearch') . "/includes/site_report.inc";
$options = kwresearch_get_report_data_options('site');
$def_values = kwresearch_get_site_report_data_options_defaults();
//dsm(variable_get('kwresearch_popularity_report_columns', $def_values));
$form['kwresearch_site_report_options']['kwresearch_site_report_data_options'] = array(
'#type' => 'checkboxes',
'#title' => t('Report data'),
'#options' => $options,
'#default_value' => variable_get('kwresearch_site_report_data_options', $def_values),
);
$form['vocab'] = array(
'#type' => 'fieldset',
'#title' => t('Taxonomy settings'),
'#description' => t('Use the below drop downs to select any vocabularies for tagging nodes with keywords. The Keyword Reserach stores tags in its own tables with meta data and suport for non-nodes. If you want to sync this data with a vocabulary, use the "sync" selection. If you want to store terms in vocabulary independent of Keyword Research\'s data, use the "tag" selection.'),
);
$vocabs = taxonomy_get_vocabularies();
$options = array(
0 => t('None'),
);
$options2 = array();
if (is_array($vocabs) && count($vocabs) > 0) {
foreach ($vocabs as $vid => $v) {
if ($v->tags) {
$options[$vid] = $v->name;
$options2[$vid] = $v->name;
}
}
$form['vocab']['kwresearch_keyword_sync_vocabulary'] = array(
'#type' => 'select',
'#title' => t('Page keyword sync vocabulary'),
'#options' => $options,
'#default_value' => variable_get('kwresearch_keyword_sync_vocabulary', 0),
'#description' => t('Select a vocabulary to sync with Keyword Research\'s internal page keywords.'),
);
$form['vocab']['kwresearch_keyword_tag_vocabulary'] = array(
'#type' => 'select',
'#title' => t('Page keyword tag vocabulary'),
'#options' => $options,
'#default_value' => variable_get('kwresearch_keyword_tag_vocabulary', 0),
'#description' => t('Select a vocabulary for storing keywords independed of Keyword Research\'s page keywords.'),
);
$form['vocab']['kwresearch_report_vocabulary'] = array(
'#type' => 'checkboxes',
'#title' => t('Report vocabulary'),
'#options' => $options2,
'#default_value' => variable_get('kwresearch_report_vocabulary', 0),
'#description' => t('Select any vocabulary you would like to attach the keyword reports.'),
);
}
else {
$form['vocab']['no'] = array(
'#type' => 'item',
'#title' => t('No vocabularies exist'),
'#description' => t('To sync keyword research you need to !create_a_vocabulary first.', array(
'!create_a_vocabulary' => l(t('create a vocabulary'), 'admin/content/taxonomy/add/vocabulary'),
)),
);
}
return system_settings_form($form);
}