entity_iframe_statistics.module

  1. cis7 sites/all/modules/elmsln_contrib/entity_iframe/modules/entity_iframe_statistics/entity_iframe_statistics.module
  2. cle7 sites/all/modules/elmsln_contrib/entity_iframe/modules/entity_iframe_statistics/entity_iframe_statistics.module
  3. ecd7 sites/all/modules/elmsln_contrib/entity_iframe/modules/entity_iframe_statistics/entity_iframe_statistics.module
  4. elmsmedia7 sites/all/modules/elmsln_contrib/entity_iframe/modules/entity_iframe_statistics/entity_iframe_statistics.module
  5. harmony7 sites/all/modules/elmsln_contrib/entity_iframe/modules/entity_iframe_statistics/entity_iframe_statistics.module
  6. icor7 sites/all/modules/elmsln_contrib/entity_iframe/modules/entity_iframe_statistics/entity_iframe_statistics.module
  7. meedjum_blog7 sites/all/modules/elmsln_contrib/entity_iframe/modules/entity_iframe_statistics/entity_iframe_statistics.module
  8. mooc7 sites/all/modules/elmsln_contrib/entity_iframe/modules/entity_iframe_statistics/entity_iframe_statistics.module

Functions

Namesort descending Description
entity_iframe_statistics_exit Implements hook_exit().

File

sites/all/modules/elmsln_contrib/entity_iframe/modules/entity_iframe_statistics/entity_iframe_statistics.module
View source
  1. <?php
  2. /**
  3. * Implements hook_exit().
  4. *
  5. * Gathers statistics for iframe page accesses.
  6. */
  7. function entity_iframe_statistics_exit() {
  8. global $user;
  9. // When serving cached pages with the 'page_cache_without_database'
  10. // configuration, system variables need to be loaded. This is a major
  11. // performance decrease for non-database page caches, but with Statistics
  12. // module, it is likely to also have 'statistics_enable_access_log' enabled,
  13. // in which case we need to bootstrap to the session phase anyway.
  14. drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES);
  15. if (variable_get('statistics_count_content_views', 0)) {
  16. // We are counting content views.
  17. if (arg(0) == 'entity_iframe' && arg(1) == 'node' && is_numeric(arg(2)) && arg(3) == NULL) {
  18. // A node has been viewed, so update the node's counters.
  19. db_merge('node_counter')
  20. ->key(array('nid' => arg(2)))
  21. ->fields(array(
  22. 'daycount' => 1,
  23. 'totalcount' => 1,
  24. 'timestamp' => REQUEST_TIME,
  25. ))
  26. ->expression('daycount', 'daycount + 1')
  27. ->expression('totalcount', 'totalcount + 1')
  28. ->execute();
  29. }
  30. }
  31. if (variable_get('statistics_enable_access_log', 0)) {
  32. drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
  33. // For anonymous users unicode.inc will not have been loaded.
  34. include_once DRUPAL_ROOT . '/includes/unicode.inc';
  35. // Log this page access.
  36. db_insert('accesslog')
  37. ->fields(array(
  38. 'title' => truncate_utf8(strip_tags(drupal_get_title()), 255),
  39. 'path' => truncate_utf8($_GET['q'], 255),
  40. 'url' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
  41. 'hostname' => ip_address(),
  42. 'uid' => $user->uid,
  43. 'sid' => session_id(),
  44. 'timer' => (int) timer_read('page'),
  45. 'timestamp' => REQUEST_TIME,
  46. ))
  47. ->execute();
  48. }
  49. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.