
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php
/* -----------------------------------------------------------------------------
 * 
 * Mockup Adapter when no plugin activated
 * 
 * -------------------------------------------------------------------------- */


/* -----------------------------------------------------------------------------
 * Get Post Views
 * -------------------------------------------------------------------------- */

if ( ! function_exists( 'presso_get_post_views' ) ) {
	function presso_get_post_views( $post_id='' ) {
		return 0;
	}
}


/* -----------------------------------------------------------------------------
 * Get Popular Post List
 * -------------------------------------------------------------------------- */

if ( ! function_exists( 'presso_get_popular_posts' ) ) {
	function presso_get_popular_posts( $count, $range = 'daily' ) {
		global $wpdb;
		
		if ( ! empty( $range ) ) $range = 'daily';
		$count = intval( $count );
		
		$transient_key = 'presso_get_popular_posts_'.$count.$range;

		$result = get_transient( $transient_key );

		if ( empty( $result ) ) {

			$result = $wpdb->query( presso_build_query( array( 'posts_per_page' => 0 )) );

			set_transient( $transient_key, $result, PRESSO_POPULAR_POSTS_CACHE_EXPIRATION );
		}

		return $result;
	}
}


/* -----------------------------------------------------------------------------
 * Get Post Views Query
 * -------------------------------------------------------------------------- */

if ( ! function_exists( 'presso_get_post_views_raw_query' ) ) {
	function presso_get_post_views_raw_query() {
		return '';
	}
}