| Server IP : 80.74.154.100 / Your IP : 216.73.217.0 Web Server : Apache System : Linux marissa.metanet.ch 4.18.0-553.141.2.lve.el7h.x86_64 #1 SMP Wed Jul 8 17:20:31 UTC 2026 x86_64 User : onlineadmin ( 10487) PHP Version : 8.5.7 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/httpd/vhosts/comeonline.ch/httpdocs/wp-content/plugins/wpsso/lib/integ/media/ |
Upload File : |
<?php
/*
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl.txt
* Copyright 2022-2026 Jean-Sebastien Morisset (https://wpsso.com/)
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'These aren\'t the droids you\'re looking for.' );
}
if ( ! class_exists( 'WpssoIntegMediaWpRetina2x' ) ) {
class WpssoIntegMediaWpRetina2x {
private $p; // Wpsso class object.
public function __construct( &$plugin ) {
$this->p =& $plugin;
if ( $this->p->debug->enabled ) {
$this->p->debug->mark();
}
/*
* Filter for the get_option() and update_option() functions.
*/
add_filter( 'option_wr2x_retina_sizes', array( $this, 'update_wr2x_retina_sizes' ), 1000, 1 );
add_filter( 'pre_update_option_wr2x_retina_sizes', array( $this, 'update_wr2x_retina_sizes' ), 1000, 1 );
add_filter( 'wr2x_custom_crop', array( $this, 'filter_set_image_src_args' ), -1000, 3 );
add_action( 'wr2x_generate_retina', array( $this, 'action_reset_image_src_args' ), -1000, 1 );
}
/*
* Filter for the get_option() and update_option() functions.
*
* Prevent Perfect Images + Retina (aka WP Retina 2x) from creating 2x images for WPSSO image sizes.
*/
public function update_wr2x_retina_sizes( $mixed ) {
if ( is_array( $mixed ) ) {
foreach ( $mixed as $num => $size_name ) {
if ( 0 === strpos( $size_name, 'wpsso-' ) ) {
unset( $mixed[ $num ] );
}
}
}
return $mixed;
}
/*
* Save arguments for the 'image_make_intermediate_size' and 'image_resize_dimensions' filters.
*/
public function filter_set_image_src_args( $custom_crop, $pid, $size_name ) {
WpssoMedia::set_image_src_args( $args = array(
'pid' => $pid,
'size_name' => $size_name,
) );
return $custom_crop;
}
public function action_reset_image_src_args( $pid ) {
WpssoMedia::reset_image_src_args();
}
}
}