| 1 |
<?php |
| 2 |
|
| 3 |
namespace WP_Defender\Integrations; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
die; |
| 7 |
} |
| 8 |
|
| 9 |
/** |
| 10 |
* Smush integration module. |
| 11 |
* Class Smush |
| 12 |
* |
| 13 |
* @since 2.5.1 |
| 14 |
* @package WP_Defender\Integrations |
| 15 |
*/ |
| 16 |
class Smush { |
| 17 |
private $table; |
| 18 |
|
| 19 |
public function __construct() { |
| 20 |
global $wpdb; |
| 21 |
$this->table = $wpdb->base_prefix . 'smush_dir_images'; |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Check if the table exists |
| 26 |
* |
| 27 |
* @return bool |
| 28 |
*/ |
| 29 |
public function exist_image_table() { |
| 30 |
global $wpdb; |
| 31 |
|
| 32 |
return (bool) $wpdb->get_var( $wpdb->prepare( |
| 33 |
'SHOW TABLES LIKE %s', |
| 34 |
$wpdb->esc_like( $this->table ) |
| 35 |
) ); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Check optimized image path |
| 40 |
* @param string |
| 41 |
* |
| 42 |
* @return bool |
| 43 |
*/ |
| 44 |
public function exist_image_path( $path ) { |
| 45 |
global $wpdb; |
| 46 |
|
| 47 |
return (bool) $wpdb->get_var( |
| 48 |
$wpdb->prepare( |
| 49 |
"SELECT id FROM {$this->table} WHERE path = %s", |
| 50 |
$path |
| 51 |
) |
| 52 |
); |
| 53 |
} |
| 54 |
} |
| 55 |
|