stats_build_view_data

Stats Build View Data.

Description

(array.) stats_build_view_data(); 

Returns (array.)


Usage

  1. if ( !function_exists( 'stats_build_view_data' ) ) { 
  2. require_once '/modules/stats.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = stats_build_view_data(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/modules/stats.php  
  1. function stats_build_view_data() { 
  2. global $wp_the_query; 
  3.  
  4. $blog = Jetpack_Options::get_option( 'id' ); 
  5. $tz = get_option( 'gmt_offset' ); 
  6. $v = 'ext'; 
  7. $blog_url = parse_url( site_url() ); 
  8. $srv = $blog_url['host']; 
  9. $j = sprintf( '%s:%s', JETPACK__API_VERSION, JETPACK__VERSION ); 
  10. if ( $wp_the_query->is_single || $wp_the_query->is_page || $wp_the_query->is_posts_page ) { 
  11. // Store and reset the queried_object and queried_object_id 
  12. // Otherwise, redirect_canonical() will redirect to home_url( '/' ) for show_on_front = page sites where home_url() is not all lowercase. 
  13. // Repro: 
  14. // 1. Set home_url = https://ExamPle.com/ 
  15. // 2. Set show_on_front = page 
  16. // 3. Set page_on_front = something 
  17. // 4. Visit https://example.com/ ! 
  18. $queried_object = ( isset( $wp_the_query->queried_object ) ) ? $wp_the_query->queried_object : null; 
  19. $queried_object_id = ( isset( $wp_the_query->queried_object_id ) ) ? $wp_the_query->queried_object_id : null; 
  20. $post = $wp_the_query->get_queried_object_id(); 
  21. $wp_the_query->queried_object = $queried_object; 
  22. $wp_the_query->queried_object_id = $queried_object_id; 
  23. } else { 
  24. $post = '0'; 
  25.  
  26. return compact( 'v', 'j', 'blog', 'post', 'tz', 'srv' );