public_html/wp-content/plugins/wp-statistics/includes/functions/functions.php
// This function returns a multi-dimensional array, with the total number of pages and an array or URI's sorted in order with their URI, count, id and title.
This function returns a multi-dimensional array, with the total number of pages and an array or URI's sorted in order with their URI, count, id and title.
This function returns a multi - dimensional array with the total number of pages and an array or URI ' s sorted in order with their URI count id and title .
function wp_statistics_get_top_pages( $rangestartdate = null, $rangeenddate = null ) {
		global $wpdb;
		if( $rangestartdate != null && $rangeenddate != null ) {
			$result = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT uri FROM {$wpdb->prefix}statistics_pages WHERE `date` BETWEEN %s AND %s", $rangestartdate, $rangeenddate ), ARRAY_N);
		} else {
			$result = $wpdb->get_results( "SELECT DISTINCT uri FROM {$wpdb->prefix}statistics_pages", ARRAY_N );
		}
		$total = 0;
		$uris = array();
		foreach( $result as $out ) {
			$total ++;
			$id = wp_statistics_uri_to_id( $out[0] );
			$post = get_post($id);
			if( is_object( $post ) ) { 
				$title = $post->post_title;
			}
			else {
				if( $out[0] == '/' ) {
					$title = get_bloginfo();
				}
				else {
					$title = '';
				}
			}
			if( $rangestartdate != null && $rangeenddate != null ) {
				$uris[] = array( $out[0], wp_statistics_pages( 'range', $out[0], -1, $rangestartdate, $rangeenddate ), $id, $title );
			} else {
				$uris[] = array( $out[0], wp_statistics_pages( 'total', $out[0] ), $id, $title );
			}
		}
		if( count( $uris ) > 1 ) {
			usort( $uris, 'wp_stats_compare_uri_hits');
		} 
		return array( $total, $uris );
	}
function wp_statistics_get_top_pages ( $ rangestartdate = null , $ rangeenddate = null ) { global $ wpdb ; if ( $ rangestartdate != null && $ rangeenddate != null ) { $ result = $ wpdb -> get_results ( $ wpdb -> prepare ( " SELECT DISTINCT uri FROM  { $ wpdb -> prefix } statistics_pages WHERE `date` BETWEEN %s AND %s " , $ rangestartdate , $ rangeenddate ) , ARRAY_N ) ; } else { $ result = $ wpdb -> get_results ( " SELECT DISTINCT uri FROM  { $ wpdb -> prefix } statistics_pages " , ARRAY_N ) ; } $ total = 0 ; $ uris = array ( ) ; foreach ( $ result as $ out ) { $ total ++ ; $ id = wp_statistics_uri_to_id ( $ out [ 0 ] ) ; $ post = get_post ( $ id ) ; if ( is_object ( $ post ) ) { $ title = $ post -> post_title ; } else { if ( $ out [ 0 ] == '/' ) { $ title = get_bloginfo ( ) ; } else { $ title = '' ; } } if ( $ rangestartdate != null && $ rangeenddate != null ) { $ uris [ ] = array ( $ out [ 0 ] , wp_statistics_pages ( 'range' , $ out [ 0 ] , - 1 , $ rangestartdate , $ rangeenddate ) , $ id , $ title ) ; } else { $ uris [ ] = array ( $ out [ 0 ] , wp_statistics_pages ( 'total' , $ out [ 0 ] ) , $ id , $ title ) ; } } if ( count ( $ uris ) > 1 ) { usort ( $ uris , 'wp_stats_compare_uri_hits' ) ; } return array ( $ total , $ uris ) ; }
This function returns a multi-dimensional array, with the total number of pages and an array or URI's sorted in order with their URI, count, id and title.
This function returns a multi - dimensional array with the total number of pages and an array or URI ' s sorted in order with their URI count id and title .
// Get every unique URI from the pages database. // Now get the total page visit count for each unique URI. // Increment the total number of results. // Retreive the post ID for the URI. // Lookup the post title. // Add the current post to the array. // If we have more than one result, let's sort them using usort. // Sort the URI's based on their hit count.