PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 2.2.3
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v2.2.3
4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 3.8.0 All 110 releases
wp-optimize / optimizations / pingbacks.php

pingbacks.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 2.2.3, at optimizations/pingbacks.php

64 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 /**
10 * Do actions after optimize() function.
11 */
12 public function after_optimize() {
13 $message = sprintf(_n('%s pingback deleted', '%s pingbacks deleted', $this->processed_count, 'wp-optimize'), number_format_i18n($this->processed_count));
14
15 if ($this->is_multisite_mode()) {
16 $message .= ' '.sprintf(_n('across %s site', 'across %s sites', count($this->blogs_ids), 'wp-optimize'), count($this->blogs_ids));
17 }
18
19 $this->logger->info($message);
20 $this->register_output($message);
21 }
22
23 /**
24 * Do optimization.
25 */
26 public function optimize() {
27 $clean = "DELETE FROM `" . $this->wpdb->comments . "` WHERE comment_type = 'pingback';";
28
29 $comments = $this->query($clean);
30 $this->processed_count += $comments;
31 }
32
33 /**
34 * Do actions after get_info() function.
35 */
36 public function after_get_info() {
37 if ($this->found_count > 0) {
38 $message = sprintf(_n('%s pingback found', '%s pingbacks found', $this->found_count, 'wp-optimize'), number_format_i18n($this->found_count));
39 } else {
40 $message = __('No pingbacks found', 'wp-optimize');
41 }
42
43 if ($this->is_multisite_mode()) {
44 $message .= ' '.sprintf(_n('across %s site', 'across %s sites', count($this->blogs_ids), 'wp-optimize'), count($this->blogs_ids));
45 }
46
47 $this->register_output($message);
48 }
49
50 /**
51 * Get count of unoptimized items.
52 */
53 public function get_info() {
54 $sql = "SELECT COUNT(*) FROM `" . $this->wpdb->comments . "` WHERE comment_type='pingback';";
55
56 $comments = $this->wpdb->get_var($sql);
57 $this->found_count += $comments;
58 }
59
60 public function settings_label() {
61 return __('Remove pingbacks', 'wp-optimize');
62 }
63 }
64