@@ 270-282 (lines=13) @@ | ||
267 | return $return; |
|
268 | } |
|
269 | ||
270 | public function get_total( $post = false ) { |
|
271 | global $wpdb, $blog_id; |
|
272 | ||
273 | $name = strtolower( $this->get_id() ); |
|
274 | ||
275 | if ( $post == false ) { |
|
276 | // get total number of shares for service |
|
277 | return (int) $wpdb->get_var( $wpdb->prepare( "SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d AND share_service = %s", $blog_id, $name ) ); |
|
278 | } |
|
279 | ||
280 | // get total shares for a post |
|
281 | 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 ) ); |
|
282 | } |
|
283 | ||
284 | public function get_posts_total() { |
|
285 | global $wpdb, $blog_id; |
|
@@ 1151-1163 (lines=13) @@ | ||
1148 | } |
|
1149 | } |
|
1150 | ||
1151 | public function get_total( $post = false ) { |
|
1152 | global $wpdb, $blog_id; |
|
1153 | ||
1154 | $name = strtolower( $this->get_id() ); |
|
1155 | ||
1156 | if ( $post == false ) { |
|
1157 | // get total number of shares for service |
|
1158 | return $wpdb->get_var( $wpdb->prepare( "SELECT SUM( count ) FROM sharing_stats WHERE blog_id = %d AND share_service = %s", $blog_id, $name ) ); |
|
1159 | } |
|
1160 | ||
1161 | //get total shares for a post |
|
1162 | return $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 ) ); |
|
1163 | } |
|
1164 | } |
|
1165 | ||
1166 | class Share_Custom extends Sharing_Advanced_Source { |