function kwresearch_analyze_js in Keyword Research 7
Same name and namespace in other branches
- 6 kwresearch.module \kwresearch_analyze_js()
AJAX handler to generate keyword stats report for content analysis display
1 string reference to 'kwresearch_analyze_js'
- kwresearch_menu in ./
kwresearch.module - Implements hook_menu()
File
- ./
kwresearch.module, line 1009
Code
function kwresearch_analyze_js() {
// check if valid request containing Drupal generated token
if (empty($_POST['kwresearch_token']) || !drupal_valid_token($_POST['kwresearch_token'], 'kwresearch')) {
drupal_access_denied();
drupal_exit();
}
$output = array(
'report' => array(),
);
require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'kwresearch') . "/includes/stats_report.inc";
$analysis['inputs'] = array(
'keyword' => check_plain($_POST['kwresearch_keyword']),
'kwresearch_include_misspellings' => check_plain($_POST['kwresearch_include_misspellings']),
'kwresearch_include_plurals' => check_plain($_POST['kwresearch_include_plurals']),
//'kwresearch_adult_filter' => !empty($_POST['kwresearch_adult_filter']) ? check_plain($_POST['kwresearch_adult_filter']) : 0,
'nid' => check_plain($_POST['kwresearch_nid']),
);
if ($analysis['inputs']['nid'] == -1) {
$analysis['inputs']['nid'] = NULL;
}
$analysis['analysis'] = kwresearch_get_keyword_stats_data($analysis['inputs']['keyword'], $msgs, $analysis['inputs']);
if (!empty($msgs)) {
$analysis['messages'] = $msgs;
}
$output['report']['data'] = $analysis;
$output['report']['output'] = theme_keyword_stats_report($analysis);
drupal_json_output($output);
}