Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : claqxcrl ( 523)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /home/claqxcrl/anfangola.com/wp-content/plugins/wp-smushit/core/integrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/claqxcrl/anfangola.com/wp-content/plugins/wp-smushit/core/integrations/class-envira.php
<?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;
	}
}

ZeroDay Forums Mini