| Server IP : 198.38.94.67 / Your IP : 216.73.217.178 Web Server : LiteSpeed System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64 User : azfilmst ( 1070) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/azfilmst/www/wp-content/plugins/wp-smushit/core/ |
Upload File : |
<?php
namespace Smush\Core;
use Smush\Core\Stats\Global_Stats;
class Optimization_Controller extends Controller {
/**
* @var Global_Stats
*/
private $global_stats;
public function __construct() {
$this->global_stats = Global_Stats::get();
$this->register_action( 'wp_smush_image_sizes_changed', array( $this, 'mark_global_stats_as_outdated' ) );
$this->register_action( 'wp_smush_settings_updated', array(
$this,
'maybe_mark_global_stats_as_outdated',
), 10, 2 );
// TODO: handle auto optimization when media item is uploaded
// TODO: handle bulk smush ajax
}
public function mark_global_stats_as_outdated() {
$this->global_stats->mark_as_outdated();
}
public function maybe_mark_global_stats_as_outdated( $old_settings, $settings ) {
$old_original = ! empty( $old_settings['original'] );
$new_original = ! empty( $settings['original'] );
$original_status_changed = $old_original !== $new_original;
if ( $original_status_changed ) {
$this->mark_global_stats_as_outdated();
}
}
}