public_html/wp-content/plugins/wp-statistics/includes/functions/functions.php
// This function will return the SQL WHERE clause for getting the search engine.
This function will return the SQL WHERE clause for getting the search engine.
This function will return the SQL WHERE clause for getting the search engine .
function wp_statistics_searchengine_query( $search_engine = 'all' ) {
		GLOBAL $WP_Statistics;
		$searchengine_list = wp_statistics_searchengine_list();
		$search_query = '';
		if( $WP_Statistics->get_option( 'search_converted' ) ) {
						if( strtolower( $search_engine ) == 'all' ) {
				foreach( $searchengine_list as $key => $se ) {
					$search_query .= "`engine` = '{$key}' OR ";
				}
				$search_query = substr( $search_query, 0, strlen( $search_query ) - 4 );
			} else {
				$search_query .= "`engine` = '{$search_engine}'";
			}
		} else {
						if( strtolower( $search_engine ) == 'all' ) {
				foreach( $searchengine_list as $se ) {
					if( is_array( $se['sqlpattern'] ) ) {
						foreach( $se['sqlpattern'] as $subse ) {
							$search_query .= "`referred` LIKE '{$subse}' OR ";
						}
					} else {
						$search_query .= "`referred` LIKE '{$se['sqlpattern']}' OR ";
					}
				}
				$search_query = substr( $search_query, 0, strlen( $search_query ) - 4 );
			} else {
				if( is_array( $searchengine_list[$search_engine]['sqlpattern'] ) ) {
					foreach( $searchengine_list[$search_engine]['sqlpattern'] as $se ) {
						$search_query .= "`referred` LIKE '{$se}' OR ";
					}
					$search_query = substr( $search_query, 0, strlen( $search_query ) - 4 );
				}
				else {
					$search_query .= "`referred` LIKE '{$searchengine_list[$search_engine]['sqlpattern']}'";
				}
			}
		}
		return $search_query;
	}
function wp_statistics_searchengine_query ( $ search_engine = 'all' ) { GLOBAL $ WP_Statistics ; $ searchengine_list = wp_statistics_searchengine_list ( ) ; $ search_query = '' ; if ( $ WP_Statistics -> get_option ( 'search_converted' ) ) { if ( strtolower ( $ search_engine ) == 'all' ) { foreach ( $ searchengine_list as $ key => $ se ) { $ search_query .= " `engine` = ' { $ key } ' OR  " ; } $ search_query = substr ( $ search_query , 0 , strlen ( $ search_query ) - 4 ) ; } else { $ search_query .= " `engine` = ' { $ search_engine } ' " ; } } else { if ( strtolower ( $ search_engine ) == 'all' ) { foreach ( $ searchengine_list as $ se ) { if ( is_array ( $ se [ 'sqlpattern' ] ) ) { foreach ( $ se [ 'sqlpattern' ] as $ subse ) { $ search_query .= " `referred` LIKE ' { $ subse } ' OR  " ; } } else { $ search_query .= " `referred` LIKE ' { $ se [ 'sqlpattern' ] } ' OR  " ; } } $ search_query = substr ( $ search_query , 0 , strlen ( $ search_query ) - 4 ) ; } else { if ( is_array ( $ searchengine_list [ $ search_engine ] [ 'sqlpattern' ] ) ) { foreach ( $ searchengine_list [ $ search_engine ] [ 'sqlpattern' ] as $ se ) { $ search_query .= " `referred` LIKE ' { $ se } ' OR  " ; } $ search_query = substr ( $ search_query , 0 , strlen ( $ search_query ) - 4 ) ; } else { $ search_query .= " `referred` LIKE ' { $ searchengine_list [ $ search_engine ] [ 'sqlpattern' ] } ' " ; } } } return $ search_query ; }
This function will return the SQL WHERE clause for getting the search engine.
This function will return the SQL WHERE clause for getting the search engine .
// Get a complete list of search engines // Are we getting results for all search engines or a specific one?
 // For all of them?  Ok, look through the search engine list and create a SQL query string to get them all from the database. // Trim off the last ' OR ' for the loop above. // Are we getting results for all search engines or a specific one?
 // For all of them?  Ok, look through the search engine list and create a SQL query string to get them all from the database. // NOTE:  This SQL query can be long. // The SQL pattern for a search engine may be an array if it has to handle multiple domains (like google.com and google.ca) or other factors. // Trim off the last ' OR ' for the loop above. // For just one?  Ok, the SQL pattern for a search engine may be an array if it has to handle multiple domains (like google.com and google.ca) or other factors. // Trim off the last ' OR ' for the loop above.