| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('WPO_VERSION')) die('No direct access allowed'); |
| 4 |
|
| 5 |
class WP_Optimization_pingbacks extends WP_Optimization { |
| 6 |
|
| 7 |
public $ui_sort_order = 6000; |
| 8 |
|
| 9 |
public function optimize() { |
| 10 |
|
| 11 |
$clean = "DELETE FROM `".$this->wpdb->comments."` WHERE comment_type = 'pingback';"; |
| 12 |
|
| 13 |
$comments = $this->query($clean); |
| 14 |
|
| 15 |
$this->register_output(sprintf(_n('%d pingback deleted', '%d pingbacks deleted', $comments, 'wp-optimize'), number_format_i18n($comments))); |
| 16 |
} |
| 17 |
|
| 18 |
public function get_info() { |
| 19 |
|
| 20 |
$sql = "SELECT COUNT(*) FROM `".$this->wpdb->comments."` WHERE comment_type='pingback';"; |
| 21 |
|
| 22 |
$comments = $this->wpdb->get_var($sql); |
| 23 |
|
| 24 |
if (!$comments == NULL || !$comments == 0) { |
| 25 |
$message = sprintf(_n('%d Pingback found', '%d Pingbacks found', $comments, 'wp-optimize'), number_format_i18n($comments)); |
| 26 |
} else { |
| 27 |
$message = __('No pingbacks found', 'wp-optimize'); |
| 28 |
} |
| 29 |
|
| 30 |
$this->register_output($message); |
| 31 |
} |
| 32 |
|
| 33 |
public function settings_label() { |
| 34 |
return __('Remove pingbacks', 'wp-optimize'); |
| 35 |
} |
| 36 |
} |
| 37 |
|