X7ROOT File Manager
Current Path:
/home/okeydcqc/brownbrommel.com/wp-content/plugins/wp-optimize/optimizations
home
/
okeydcqc
/
brownbrommel.com
/
wp-content
/
plugins
/
wp-optimize
/
optimizations
/
ðŸ“
..
📄
attachments.php
(3.15 KB)
📄
autodraft.php
(5.33 KB)
📄
commentmeta.php
(7.53 KB)
📄
inactive-tags.php
(569 B)
📄
optimizetables.php
(6.7 KB)
📄
orphandata.php
(2.39 KB)
📄
orphanedtables.php
(5.42 KB)
📄
pingbacks.php
(4.51 KB)
📄
postmeta.php
(4.55 KB)
📄
repairtables.php
(4.38 KB)
📄
revisions.php
(8.07 KB)
📄
spam.php
(8.17 KB)
📄
trackbacks.php
(4.41 KB)
📄
transient.php
(14.3 KB)
📄
trash.php
(6.78 KB)
📄
unapproved.php
(5.94 KB)
📄
usermeta.php
(4.45 KB)
Editing: pingbacks.php
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); class WP_Optimization_pingbacks extends WP_Optimization { public $ui_sort_order = 6000; public $available_for_saving = true; /** * Prepare data for preview widget. * * @param array $params * * @return array */ public function preview($params) { // get data requested for preview. // `$this->wpdb` is `$wpdb` // phpcs:disable $sql = $this->wpdb->prepare( "SELECT comment_ID, comment_author, SUBSTR(comment_content, 1, 128) AS comment_content FROM `" . $this->wpdb->comments . "`". " WHERE comment_type = 'pingback'". " ORDER BY `comment_ID` LIMIT %d, %d;", array( $params['offset'], $params['limit'], ) ); $posts = $this->wpdb->get_results($sql, ARRAY_A); // phpcs:enable // fix empty revision titles. if (!empty($posts)) { foreach ($posts as $key => $post) { $posts[$key]['post_title'] = array( 'text' => '' == $post['post_title'] ? '('.__('no title', 'wp-optimize').')' : $post['post_title'], 'url' => get_edit_post_link($post['ID']), ); } } // get total count comments for optimization. $sql = "SELECT COUNT(*) FROM `" . $this->wpdb->comments . "` WHERE comment_type = 'pingback';"; $total = $this->wpdb->get_var($sql); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- SQL is safe, no user input used return array( 'id_key' => 'comment_ID', 'columns' => array( 'comment_ID' => __('ID', 'wp-optimize'), 'comment_author' => __('Author', 'wp-optimize'), 'comment_content' => __('Comment', 'wp-optimize'), ), 'offset' => $params['offset'], 'limit' => $params['limit'], 'total' => $total, 'data' => $this->htmlentities_array($posts, array('comment_ID')), 'message' => $total > 0 ? '' : __('No pingbacks found', 'wp-optimize'), ); } /** * Do actions after optimize() function. */ public function after_optimize() { // translators: %s is number of pingback deleted $message = sprintf(_n('%s pingback deleted', '%s pingbacks deleted', $this->processed_count, 'wp-optimize'), number_format_i18n($this->processed_count)); if ($this->is_multisite_mode()) { // translators: %s is number of sites $message .= ' '.sprintf(_n('across %s site', 'across %s sites', count($this->blogs_ids), 'wp-optimize'), count($this->blogs_ids)); } $this->logger->info($message); $this->register_output($message); } /** * Do optimization. */ public function optimize() { $clean = "DELETE FROM `" . $this->wpdb->comments . "` WHERE comment_type = 'pingback'"; // if posted ids in params, then remove only selected items. used by preview widget. if (isset($this->data['ids'])) { $clean .= ' AND comment_ID in ('.join(',', $this->data['ids']).')'; } $clean .= ";"; $comments = $this->query($clean); $this->processed_count += $comments; // update comment count $update = "UPDATE `" . $this->wpdb->posts . "` as p INNER JOIN (SELECT comment_post_ID as cid, COUNT(comment_post_ID) as cc FROM `" . $this->wpdb->comments . "` GROUP BY comment_post_ID) AS c ON p.ID = c.cid SET p.comment_count = c.cc WHERE p.ID = c.cid"; $this->query($update); // clean orphaned comment meta $clean = "DELETE cm FROM `" . $this->wpdb->commentmeta . "` cm LEFT JOIN `" . $this->wpdb->comments . "` c ON cm.comment_id = c.comment_ID WHERE c.comment_ID IS NULL"; $this->query($clean); } /** * Do actions after get_info() function. */ public function after_get_info() { if ($this->found_count > 0) { // translators: %s is number of pingbacks $message = sprintf(_n('%s pingback found', '%s pingbacks found', $this->found_count, 'wp-optimize'), number_format_i18n($this->found_count)); } else { $message = __('No pingbacks found', 'wp-optimize'); } if ($this->is_multisite_mode()) { // translators: %s is number of sites $message .= ' '.sprintf(_n('across %s site', 'across %s sites', count($this->blogs_ids), 'wp-optimize'), count($this->blogs_ids)); } // add preview link to message. if ($this->found_count > 0) { $message = $this->get_preview_link($message); } $this->register_output($message); } /** * Get count of unoptimized items. */ public function get_info() { $sql = "SELECT COUNT(*) FROM `" . $this->wpdb->comments . "` WHERE comment_type='pingback';"; $comments = $this->wpdb->get_var($sql); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- SQL is safe, no user input used $this->found_count += $comments; } public function settings_label() { return __('Remove pingbacks', 'wp-optimize'); } }
Upload File
Create Folder