Пример #1
0
 /**
  * Obtain analytics information, as stored in cache
  * by checkAnalytics
  *
  */
 public static function getData($options)
 {
     // main option: are we forcing update, or only using the cached data ?
     $options['forced'] = empty($options['forced']) ? 0 : $options['forced'];
     $sefConfig = Sh404sefFactory::getConfig();
     $dataTypeString = str_replace('ga:', '', $sefConfig->analyticsDashboardDataType);
     // store options
     self::$_options = $options;
     // create cache Id and get cache object
     $cacheId = md5($dataTypeString . $options['accountId'] . $options['showFilters'] . $options['groupBy'] . $options['startDate'] . $options['endDate'] . $options['cpWidth'] . $options['report'] . $options['subrequest']);
     $cache = JFactory::getCache('sh404sef_analytics');
     $cache->setLifetime(60);
     // cache result for 1 hours
     $cache->setCaching(1);
     // force caching on
     // empty cache if we are going to look for updates or if reports are disabled (so that next time
     // they enabled, we start wih fresh data
     if (self::$_options['forced'] || !$sefConfig->analyticsReportsEnabled) {
         // clean our cache
         $cache->remove($cacheId);
     }
     $response = $cache->get(array('Sh404sefHelperAnalytics', '_doCheck'), $args = array(), $cacheId);
     // return response, either dummy or from cache
     return $response;
 }