public_html/wp-content/plugins/wp-statistics/includes/functions/functions.php
// This function will return the statistics for a given search engine for a given time frame.
This function will return the statistics for a given search engine for a given time frame.
This function will return the statistics for a given search engine for a given time frame .
function wp_statistics_searchword( $search_engine = 'all', $time = 'total' ) {
		global $wpdb, $WP_Statistics;
		$tablename = $wpdb->prefix . 'statistics_';
		if( $WP_Statistics->get_option( 'search_converted' ) ) {
			$tablename .= 'search';
		} else {
			$tablename .= 'visitor';
		}
		$search_query = wp_statistics_searchword_query( $search_engine );
		switch( $time ) {
			case 'today':
				$result = $wpdb->query( "SELECT * FROM `{$tablename}` WHERE `last_counter` = '{$WP_Statistics->Current_Date( 'Y-m-d' )}' AND {$search_query}");
				break;
			case 'yesterday':
				$result = $wpdb->query( "SELECT * FROM `{$tablename}` WHERE `last_counter` = '{$WP_Statistics->Current_Date( 'Y-m-d', -1 )}' AND {$search_query}");
				break;
			case 'week':
				$result = $wpdb->query( "SELECT * FROM `{$tablename}` WHERE `last_counter` = '{$WP_Statistics->Current_Date( 'Y-m-d', -7 )}' AND {$search_query}");
				break;
			case 'month':
				$result = $wpdb->query( "SELECT * FROM `{$tablename}` WHERE `last_counter` = '{$WP_Statistics->Current_Date( 'Y-m-d', -30 )}' AND {$search_query}");
				break;
			case 'year':
				$result = $wpdb->query( "SELECT * FROM `{$tablename}` WHERE `last_counter` = '{$WP_Statistics->Current_Date( 'Y-m-d', -365 )}' AND {$search_query}");
				break;
			case 'total':
				$result = $wpdb->query( "SELECT * FROM `{$tablename}` WHERE {$search_query}");
				break;
			default:
				$result = $wpdb->query( "SELECT * FROM `{$tablename}` WHERE `last_counter` = '{$WP_Statistics->Current_Date( 'Y-m-d', $time )}' AND {$search_query}");
				break;
		}
		return $result;
	}
function wp_statistics_searchword ( $ search_engine = 'all' , $ time = 'total' ) { global $ wpdb , $ WP_Statistics ; $ tablename = $ wpdb -> prefix . 'statistics_' ; if ( $ WP_Statistics -> get_option ( 'search_converted' ) ) { $ tablename .= 'search' ; } else { $ tablename .= 'visitor' ; } $ search_query = wp_statistics_searchword_query ( $ search_engine ) ; switch ( $ time ) { case 'today' : $ result = $ wpdb -> query ( " SELECT * FROM ` { $ tablename } ` WHERE `last_counter` = ' { $ WP_Statistics -> Current_Date ( 'Y-m-d' ) } ' AND  { $ search_query } " ) ; break ; case 'yesterday' : $ result = $ wpdb -> query ( " SELECT * FROM ` { $ tablename } ` WHERE `last_counter` = ' { $ WP_Statistics -> Current_Date ( 'Y-m-d' , - 1 ) } ' AND  { $ search_query } " ) ; break ; case 'week' : $ result = $ wpdb -> query ( " SELECT * FROM ` { $ tablename } ` WHERE `last_counter` = ' { $ WP_Statistics -> Current_Date ( 'Y-m-d' , - 7 ) } ' AND  { $ search_query } " ) ; break ; case 'month' : $ result = $ wpdb -> query ( " SELECT * FROM ` { $ tablename } ` WHERE `last_counter` = ' { $ WP_Statistics -> Current_Date ( 'Y-m-d' , - 30 ) } ' AND  { $ search_query } " ) ; break ; case 'year' : $ result = $ wpdb -> query ( " SELECT * FROM ` { $ tablename } ` WHERE `last_counter` = ' { $ WP_Statistics -> Current_Date ( 'Y-m-d' , - 365 ) } ' AND  { $ search_query } " ) ; break ; case 'total' : $ result = $ wpdb -> query ( " SELECT * FROM ` { $ tablename } ` WHERE  { $ search_query } " ) ; break ; default : $ result = $ wpdb -> query ( " SELECT * FROM ` { $ tablename } ` WHERE `last_counter` = ' { $ WP_Statistics -> Current_Date ( 'Y-m-d' , $ time ) } ' AND  { $ search_query } " ) ; break ; } return $ result ; }
This function will return the statistics for a given search engine for a given time frame.
This function will return the statistics for a given search engine for a given time frame .
// Determine if we're using the old or new method of storing search engine info and build the appropriate table name. // Get a complete list of search engines // This function accepts several options for time parameter, each one has a unique SQL query string. // They're pretty self explanatory.