Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wp-smush.../core/photon
File: class-photon-controller.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Smush\Core\Photon;
[2] Fix | Delete
[3] Fix | Delete
use Smush\Core\Controller;
[4] Fix | Delete
use Smush\Core\Media\Media_Item;
[5] Fix | Delete
use WP_Smush;
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Photon is an image acceleration and modification service for Jetpack-connected WordPress sites. When Photon is active, only the main file is kept on the server as a physical file, everything else is on a CDN.
[9] Fix | Delete
* @see https://developer.wordpress.com/docs/photon/
[10] Fix | Delete
*/
[11] Fix | Delete
class Photon_Controller extends Controller {
[12] Fix | Delete
public function __construct() {
[13] Fix | Delete
$this->register_filter( 'wp_smush_media_item_size', array( $this, 'only_handle_full_size' ), 10, 2 );
[14] Fix | Delete
[15] Fix | Delete
$this->register_action( 'smush_setting_column_right_outside', array( $this, 'render_site_accelerator_notice' ), 20, 2 );
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
public function is_photon_active() {
[19] Fix | Delete
return has_filter( 'wp_image_editors', 'photon_subsizes_override_image_editors' );
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
public function only_handle_full_size( $size, $key ) {
[23] Fix | Delete
if ( ! $this->is_photon_active() ) {
[24] Fix | Delete
return $size;
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
return $key === Media_Item::SIZE_KEY_FULL
[28] Fix | Delete
? $size
[29] Fix | Delete
: false;
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
public function render_site_accelerator_notice( $name ) {
[33] Fix | Delete
if ( ! $this->is_photon_active() || 'bulk' !== $name ) {
[34] Fix | Delete
return;
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
$text = sprintf( /* translators: %1$s - <a>, %2$s - </a> */
[38] Fix | Delete
esc_html__( "We noticed that your site is configured to completely offload intermediate thumbnail sizes (they don't exist in your Media Library), so Smush can't optimize those images. You can still optimize your %1\$sOriginal Images%2\$s if you want to.", 'wp-smushit' ),
[39] Fix | Delete
'<a href="#original">',
[40] Fix | Delete
'</a>'
[41] Fix | Delete
);
[42] Fix | Delete
?>
[43] Fix | Delete
<div class="sui-notice sui-notice-warning" style="margin-top: -20px">
[44] Fix | Delete
<div class="sui-notice-content">
[45] Fix | Delete
<div class="sui-notice-message">
[46] Fix | Delete
<i class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></i>
[47] Fix | Delete
<p><?php echo wp_kses_post( $text ); ?></p>
[48] Fix | Delete
</div>
[49] Fix | Delete
</div>
[50] Fix | Delete
</div>
[51] Fix | Delete
<?php
[52] Fix | Delete
}
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function