function seotools_dashboard_keywords_box in Drupal SEO Tools 6
Same name and namespace in other branches
- 7 seotools.report.inc \seotools_dashboard_keywords_box()
1 call to seotools_dashboard_keywords_box()
File
- ./
seotools.report.inc, line 873
Code
function seotools_dashboard_keywords_box($gid, $siteURL, $date_range, $enabled_modules) {
$output = '<h3 class="keywords">' . t('Keywords') . '</h3>';
$links[] = l(t('report'), 'admin/content/seotools/keywords');
$links[] = l(t('analytics'), 'https://www.google.com/analytics/reporting/keywords', array(
'query' => "id={$gid}",
'attributes' => array(
'target' => 'googleanalytics',
),
));
if ($enabled_modules['kwresearch']) {
$links[] = l(t('research'), 'admin/content/kwresearch/keyword_report', array(
'attributes' => array(
'target' => 'kwresearch',
),
));
}
$links[] = l(t('search queries'), 'https://www.google.com/webmasters/tools/top-search-queries', array(
'query' => "siteUrl={$siteURL}#",
'attributes' => array(
'target' => 'googlewebmastertools',
),
));
$links[] = l(t('found'), 'https://www.google.com/webmasters/tools/keywords', array(
'query' => "siteUrl={$siteURL}#",
'attributes' => array(
'target' => 'googlewebmastertools',
),
));
$output .= '<div class="dashboard-links">';
$output .= implode(' | ', $links);
$output .= '</div>';
$output .= seotools_generate_report_top_and_trends('keywords', t('keywords'), $mode, $gid, $siteURL, $date_range, $enabled_modules);
// By priority
if ($enabled_modules['kwresearch']) {
$filter = array();
$options['mode'] = 'site';
$header[] = array(
'data' => t('Priority'),
'field' => 'k.priority',
'sort' => 'desc',
);
$result = kwresearch_load_filtered_keyword_result($filter, $options, $header = array(), $limit = 100000);
$kw_counts = array(
'top' => 0,
'high' => 0,
'standard' => 0,
'total' => 0,
);
while ($row = db_fetch_object($result)) {
$kw_counts['total']++;
if ($row->priority > 80) {
$kw_counts['top']++;
}
else {
if ($row->priority > 60) {
$kw_counts['high']++;
}
else {
if ($row->priority > 40) {
$kw_counts['standard']++;
}
}
}
}
$rows = array();
$header = array(
array(
'data' => t('Keywords by priority'),
'class' => 'label-header',
),
array(
'data' => t('Count'),
'class' => 'numeric-header',
),
);
$rows[] = array(
l(t('All site keywords'), 'admin/content/kwresearch/keyword_list/site'),
array(
'data' => number_format($kw_counts['total']),
'class' => 'numeric-cell',
),
);
$rows[] = array(
' ' . l(t('Top'), 'admin/content/kwresearch/keyword_list/site', array(
'query' => 'filters={"priority":90}',
'attributes' => array(
'target' => 'kwresearch',
),
)),
array(
'data' => number_format($kw_counts['top']),
'class' => 'numeric-cell',
),
);
$rows[] = array(
' ' . l(t('High'), 'admin/content/kwresearch/keyword_list/site', array(
'query' => 'filters={"priority":70}',
'attributes' => array(
'target' => 'kwresearch',
),
)) . '|' . l(t('& up'), 'admin/content/kwresearch/keyword_list/site', array(
'query' => 'filters={"priority":{"1":90,"2":70}}',
'attributes' => array(
'target' => 'kwresearch',
),
)),
array(
'data' => number_format($kw_counts['high']),
'class' => 'numeric-cell',
),
);
$rows[] = array(
' ' . l(t('Standard'), 'admin/content/kwresearch/keyword_list/site', array(
'query' => 'filters={"priority":50}',
'attributes' => array(
'target' => 'kwresearch',
),
)) . '|' . l(t('& up'), 'admin/content/kwresearch/keyword_list/site', array(
'query' => 'filters={"priority":{"1":90,"2":70,"3":50}}',
'attributes' => array(
'target' => 'kwresearch',
),
)),
array(
'data' => number_format($kw_counts['standard']),
'class' => 'numeric-cell',
),
);
$output .= theme('table', $header, $rows, array(
'id' => 'seotools-dashboard-keyword-box',
));
}
return $output;
}