✏️ 编辑:class-smush.php
路径:
/home/forge/kingkrunch.com/wp/wp-content/plugins/wp-defender/src/integrations/class-smush.php
大小:1.29 KB · 修改:2025-10-22 00:15:46 · 权限:0644 · 可写
← 返回目录
👁 查看
⬇ 下载
<?php /** * Handles image optimization and compression. * * @package WP_Defender\Integrations */ namespace WP_Defender\Integrations; if ( ! defined( 'ABSPATH' ) ) { die; } /** * Smush integration module. * * @since 2.5.1 */ class Smush { /** * Table name. * * @var string */ private $table; /** * Constructor for the class. * Initializes the table name for the Smush directory images. * * @return void */ public function __construct() { global $wpdb; $this->table = $wpdb->base_prefix . 'smush_dir_images'; } /** * Check if the table exists * * @return bool */ public function exist_image_table() { global $wpdb; return (bool) $wpdb->get_var( // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $this->table ) ) ); } /** * Check optimized image path * * @param string $path image path. * * @return bool */ public function exist_image_path( $path ) { global $wpdb; return (bool) $wpdb->get_var( // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->prepare( "SELECT id FROM {$this->table} WHERE path = %s", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared $path ) ); } }
💾 保存
取消
保存为 UTF-8,换行统一为 LF