| Server IP : 173.249.148.11 / Your IP : 216.73.216.179 Web Server : Apache/2.4.68 (AlmaLinux) System : Linux developmentwebsite.ca 4.18.0-553.168.1.el8_10.x86_64 #1 SMP Thu Sep 24 18:05:46 UTC 2026 x86_64 User : devinter ( 1006) PHP Version : 8.3.35 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /chroot/home/devinter/public_html/wp-content/plugins/wp-smushit/core/integrations/ |
Upload File : |
<?php
/**
* Integration with Envira Gallery
*
* @since 3.3.0
* @package Smush\Core\Integrations
*/
namespace Smush\Core\Integrations;
use Smush\Core\Controller;
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Class Envira
*/
class Envira extends Controller {
/**
* Envira constructor.
*
* @since 3.3.0
*/
public function __construct() {
$this->register_filter( 'wp_smush_get_image_attribute_names', array( $this, 'allow_envira_image_attributes_to_convert' ) );
$this->register_filter( 'smush_skip_adding_srcset', array( $this, 'maybe_skip_generating_srcset' ), 10, 3 );
$this->register_filter( 'wp_smush_lazyload_excluded_attributes', array( $this, 'skip_envira_image_lazyload_attribute_from_lazy_loading' ) );
}
public function should_run() {
return class_exists( 'Envira_Gallery' ) || class_exists( 'Envira_Gallery_Lite' );
}
public function allow_envira_image_attributes_to_convert( $attribute_names ) {
$attribute_names[] = 'data-envira-src';
$attribute_names[] = 'data-envira-srcset';
return $attribute_names;
}
public function maybe_skip_generating_srcset( $skip, $src_url, $element_markup ) {
return $skip || strpos( $element_markup, 'data-envira-srcset' );
}
public function skip_envira_image_lazyload_attribute_from_lazy_loading( $attribute_names ) {
$attribute_names[] = 'envira-lazy';
return $attribute_names;
}
}