Code Duplication    Length = 4-9 lines in 2 locations

modules/sharedaddy/sharing-service.php 2 locations

@@ 388-396 (lines=9) @@
385
		if ( !$_blog_id ) {
386
			$_blog_id = $blog_id;
387
		}
388
		if ( $service_name == false ) {
389
			if ( $post_id > 0 ) {
390
				// total number of shares for this post
391
				return (int) $wpdb->get_var( $wpdb->prepare( "SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d AND post_id = %d", $_blog_id, $post_id ) );
392
			} else {
393
				// total number of shares for this blog
394
				return (int) $wpdb->get_var( $wpdb->prepare( "SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d", $_blog_id ) );
395
			}
396
		}
397
398
		if ( $post_id > 0 )
399
			return (int) $wpdb->get_var( $wpdb->prepare( "SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d AND post_id = %d AND share_service = %s", $_blog_id, $post_id, $service_name ) );
@@ 398-401 (lines=4) @@
395
			}
396
		}
397
398
		if ( $post_id > 0 )
399
			return (int) $wpdb->get_var( $wpdb->prepare( "SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d AND post_id = %d AND share_service = %s", $_blog_id, $post_id, $service_name ) );
400
		else
401
			return (int) $wpdb->get_var( $wpdb->prepare( "SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d AND share_service = %s", $_blog_id, $service_name ) );
402
	}
403
404
	public function get_services_total( $post_id = false ) {