You are here

function seotools_cache_get in Drupal SEO Tools 6

Same name and namespace in other branches
  1. 7 seotools.report.inc \seotools_cache_get()
5 calls to seotools_cache_get()
seotools_dashboard_analytics_box in ./seotools.report.inc
seotools_dashboard_map_box in ./seotools.report.inc
seotools_dashboard_referrers_box in ./seotools.report.inc
seotools_dashboard_sources_box in ./seotools.report.inc
seotools_generate_report_top_and_trends in ./seotools.report.inc
valid ids: keywords

File

./seotools.report.inc, line 284

Code

function seotools_cache_get($cid, $date_range = NULL, $records = NULL) {

  // don't cache if end date is today
  if ($date_range['end_date'] == date("Y-d-m")) {
    return FALSE;
  }
  $where = "cid = '%s'";
  $args[] = $cid;
  if ($date_range['start_date']) {
    $where .= " AND start_date = '%s'";
    $args[] = $date_range['start_date'];
  }
  if ($date_range['end_date']) {
    $where .= " AND end_date = '%s'";
    $args[] = $date_range['end_date'];
  }
  if ($records) {
    $where .= " AND records >= %d";
    $args[] = $records;
  }
  $sql = "\n    SELECT data\n    FROM {seotools_cache}\n    WHERE {$where}\n  ";
  $data = db_result(db_query($sql, $args));
  if ($data) {
    $ret = unserialize($data);
    return $ret;
  }
  else {
    return FALSE;
  }
}