Code Duplication    Length = 14-16 lines in 2 locations

projects/plugins/jetpack/modules/sharedaddy/sharing-service.php 1 location

@@ 499-512 (lines=14) @@
496
		return $totals;
497
	}
498
499
	public function get_posts_total() {
500
		$totals = array();
501
		global $wpdb, $blog_id;
502
503
		$my_data = $wpdb->get_results( $wpdb->prepare( 'SELECT post_id as id, SUM( count ) as total FROM sharing_stats WHERE blog_id = %d GROUP BY post_id ORDER BY count DESC ', $blog_id ) );
504
505
		if ( ! empty( $my_data ) ) {
506
			foreach ( $my_data as $row ) {
507
				$totals[] = new Sharing_Post_Total( $row->id, $row->total );
508
			}
509
		}
510
511
		usort( $totals, array( 'Sharing_Post_Total', 'cmp' ) );
512
513
		return $totals;
514
	}
515
}

projects/plugins/jetpack/modules/sharedaddy/sharing-sources.php 1 location

@@ 359-374 (lines=16) @@
356
		return (int) $wpdb->get_var( $wpdb->prepare( 'SELECT count FROM sharing_stats WHERE blog_id = %d AND post_id = %d AND share_service = %s', $blog_id, $post->ID, $name ) );
357
	}
358
359
	public function get_posts_total() {
360
		global $wpdb, $blog_id;
361
362
		$totals = array();
363
		$name	= strtolower( $this->get_id() );
364
365
		$my_data = $wpdb->get_results( $wpdb->prepare( 'SELECT post_id as id, SUM( count ) as total FROM sharing_stats WHERE blog_id = %d AND share_service = %s GROUP BY post_id ORDER BY count DESC ', $blog_id, $name ) );
366
367
		if ( ! empty( $my_data ) ) {
368
			foreach ( $my_data as $row ) {
369
				$totals[] = new Sharing_Post_Total( $row->id, $row->total );
370
			}
371
		}
372
373
		usort( $totals, array( 'Sharing_Post_Total', 'cmp' ) );
374
375
		return $totals;
376
	}
377