�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`� 0x0x
PHP 8.1.34
Preview: module.php Size: 10.82 KB
/home2/astrociv/www/wp-content/plugins/elementor/modules/image-loading-optimization/module.php
<?php
namespace Elementor\Modules\ImageLoadingOptimization;

use Elementor\Core\Base\Module as BaseModule;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class Module extends BaseModule {
	/**
	 * @var int Minimum square-pixels threshold.
	 */
	private $min_priority_img_pixels = 50000;

	/**
	 * @var int The number of content media elements to not lazy-load.
	 */
	private $omit_threshold = 3;

	/**
	 * @var array Keep a track of images for which loading optimization strategy were computed.
	 */
	private static $image_visited = [];

	/**
	 * Get Module name.
	 */
	public function get_name() {
		return 'image-loading-optimization';
	}

	/**
	 * Constructor.
	 */
	public function __construct() {
		if ( ! static::is_optimized_image_loading_enabled() ) {
			return;
		}

		parent::__construct();

		// Stop wp core logic.
		add_action( 'init', [ $this, 'stop_core_fetchpriority_high_logic' ] );
		add_filter( 'wp_lazy_loading_enabled', '__return_false' );

		// Run optimization logic on header.
		add_action( 'get_header', [ $this, 'set_buffer' ] );

		// Ensure buffer is flushed (if any) before the content logic.
		add_filter( 'the_content', [ $this, 'flush_header_buffer' ], 0 );

		// Run optimization logic on content.
		add_filter( 'wp_content_img_tag', [ $this, 'loading_optimization_image' ] );
	}

	/**
	 * Check whether the "Optimized Image Loading" settings is enabled.
	 *
	 * The 'optimized_image_loading' option can be enabled/disabled from the Elementor settings.
	 *
	 * @since 3.21.0
	 * @access private
	 */
	private static function is_optimized_image_loading_enabled(): bool {
		return '1' === get_option( 'elementor_optimized_image_loading', '1' );
	}

	/**
	 * Stop WordPress core fetchpriority logic by setting the wp_high_priority_element_flag flag to false.
	 */
	public function stop_core_fetchpriority_high_logic() {
		wp_high_priority_element_flag( false );
	}

	/**
	 * Set buffer to handle header and footer content.
	 */
	public function set_buffer() {
		ob_start( [ $this, 'handle_buffer_content' ] );
	}

	/**
	 * This function ensure that buffer if any is flushed before the content is called.
	 * This function behaves more like an action than a filter.
	 *
	 * @param string $content the content.
	 * @return string We simply return the content from parameter.
	 */
	public function flush_header_buffer( $content ) {
		$buffer_status = ob_get_status();

		if ( ! empty( $buffer_status ) &&
			1 === $buffer_status['type'] &&
			get_class( $this ) . '::handle_buffer_content' === $buffer_status['name'] ) {
			ob_end_flush();
		}

		return $content;
	}

	/**
	 * Callback to handle image optimization logic on buffered content.
	 *
	 * @param string $buffer Buffered content.
	 * @return string Content with optimized images.
	 */
	public function handle_buffer_content( $buffer ) {
		return $this->filter_images( $buffer );
	}

	/**
	 * Check for image in the content provided and apply optimization logic on them.
	 *
	 * @param string $content Content to be analyzed.
	 * @return string Content with optimized images.
	 */
	private function filter_images( $content ) {
		return preg_replace_callback(
			'/<img\s[^>]+>/',
			function ( $matches ) {
				return $this->loading_optimization_image( $matches[0] );
			},
			$content
		);
	}

	/**
	 * Apply loading optimization logic on the image.
	 *
	 * @param mixed $image Original image tag.
	 * @return string Optimized image.
	 */
	public function loading_optimization_image( $image ) {
		if ( isset( self::$image_visited[ $image ] ) ) {
			return self::$image_visited[ $image ];
		}

		$optimized_image = $this->add_loading_optimization_attrs( $image );
		self::$image_visited[ $image ] = $optimized_image;

		return $optimized_image;
	}

	/**
	 * Adds optimization attributes to an `img` HTML tag.
	 *
	 * @param string $image   The HTML `img` tag where the attribute should be added.
	 * @return string Converted `img` tag with optimization attributes added.
	 */
	private function add_loading_optimization_attrs( $image ) {
		$width             = preg_match( '/ width=["\']([0-9]+)["\']/', $image, $match_width ) ? (int) $match_width[1] : null;
		$height            = preg_match( '/ height=["\']([0-9]+)["\']/', $image, $match_height ) ? (int) $match_height[1] : null;
		$loading_val       = preg_match( '/ loading=["\']([A-Za-z]+)["\']/', $image, $match_loading ) ? $match_loading[1] : null;
		$fetchpriority_val = preg_match( '/ fetchpriority=["\']([A-Za-z]+)["\']/', $image, $match_fetchpriority ) ? $match_fetchpriority[1] : null;

		// Images should have height and dimension width for the loading optimization attributes to be added.
		if ( ! str_contains( $image, ' width="' ) || ! str_contains( $image, ' height="' ) ) {
			return $image;
		}

		$optimization_attrs = $this->get_loading_optimization_attributes(
			[
				'width'         => $width,
				'height'        => $height,
				'loading'       => $loading_val,
				'fetchpriority' => $fetchpriority_val,
			]
		);

		if ( ! empty( $optimization_attrs['fetchpriority'] ) ) {
			$image = str_replace( '<img', '<img fetchpriority="' . esc_attr( $optimization_attrs['fetchpriority'] ) . '"', $image );
		}

		if ( ! empty( $optimization_attrs['loading'] ) ) {
			$image = str_replace( '<img', '<img loading="' . esc_attr( $optimization_attrs['loading'] ) . '"', $image );
		}

		return $image;
	}

	/**
	 * Return loading Loading optimization attributes for a image with give attribute.
	 *
	 * @param array $attr Existing image attributes.
	 * @return array Loading optimization attributes.
	 */
	private function get_loading_optimization_attributes( $attr ) {
		$loading_attrs = [];

		// For any resources, width and height must be provided, to avoid layout shifts.
		if ( ! isset( $attr['width'], $attr['height'] ) ) {
			return $loading_attrs;
		}

		/*
		 * The key function logic starts here.
		 */
		$maybe_in_viewport    = null;
		$increase_count       = false;
		$maybe_increase_count = false;

		/*
		 * Logic to handle a `loading` attribute that is already provided.
		 *
		 * Copied from `wp_get_loading_optimization_attributes()`.
		 */
		if ( isset( $attr['loading'] ) ) {
			/*
			 * Interpret "lazy" as not in viewport. Any other value can be
			 * interpreted as in viewport (realistically only "eager" or `false`
			 * to force-omit the attribute are other potential values).
			 */
			if ( 'lazy' === $attr['loading'] ) {
				$maybe_in_viewport = false;
			} else {
				$maybe_in_viewport = true;
			}
		}

		// Logic to handle a `fetchpriority` attribute that is already provided.
		$has_fetchpriority_high_attr = ( isset( $attr['fetchpriority'] ) && 'high' === $attr['fetchpriority'] );

		/*
		 * Handle cases where a `fetchpriority="high"` has already been set.
		 *
		 * Copied from `wp_get_loading_optimization_attributes()`.
		 */
		if ( $has_fetchpriority_high_attr ) {
			/*
			 * If the image was already determined to not be in the viewport (e.g.
			 * from an already provided `loading` attribute), trigger a warning.
			 * Otherwise, the value can be interpreted as in viewport, since only
			 * the most important in-viewport image should have `fetchpriority` set
			 * to "high".
			 */
			if ( false === $maybe_in_viewport ) {
				_doing_it_wrong(
					__FUNCTION__,
					esc_html__( 'An image should not be lazy-loaded and marked as high priority at the same time.', 'elementor' ),
					''
				);

				/*
				 * Set `fetchpriority` here for backward-compatibility as we should
				 * not override what a developer decided, even though it seems
				 * incorrect.
				 */
				$loading_attrs['fetchpriority'] = 'high';
			} else {
				$maybe_in_viewport = true;
			}
		}

		if ( null === $maybe_in_viewport && ! is_admin() ) {
			$content_media_count = $this->increase_content_media_count( 0 );
			$increase_count      = true;
			if ( $content_media_count < $this->omit_threshold ) {
				$maybe_in_viewport = true;
			} else {
				$maybe_in_viewport = false;
			}
		}

		if ( $maybe_in_viewport ) {
			$loading_attrs = $this->maybe_add_fetchpriority_high_attr( $loading_attrs, $attr );
		} else {
			$loading_attrs['loading'] = 'lazy';
		}

		if ( $increase_count ) {
			$this->increase_content_media_count();
		} elseif ( $maybe_increase_count ) {
			if ( $this->get_min_priority_img_pixels() <= $attr['width'] * $attr['height'] ) {
				$this->increase_content_media_count();
			}
		}

		return $loading_attrs;
	}

	/**
	 * Helper to get the minimum threshold for number of pixels an image needs to have to be considered "priority".
	 *
	 * @return int The minimum number of pixels (width * height). Default is 50000.
	 */
	private function get_min_priority_img_pixels() {
		/**
		 * Filter the minimum pixel threshold used to determine if an image should have fetchpriority="high" applied.
		 *
		 * @see https://developer.wordpress.org/reference/hooks/wp_min_priority_img_pixels/
		 *
		 * @param int $pixels The minimum number of pixels (with * height).
		 * @return int The filtered value.
		 */
		return apply_filters( 'elementor/image-loading-optimization/min_priority_img_pixels', $this->min_priority_img_pixels );
	}

	/**
	 * Keeps a count of media image.
	 *
	 * @param int $amount Amount by which count must be increased.
	 * @return int current image count.
	 */
	private function increase_content_media_count( $amount = 1 ) {
		static $content_media_count = 0;

		$content_media_count += $amount;

		return $content_media_count;
	}

	/**
	 * Determines whether to add `fetchpriority='high'` to loading attributes.
	 *
	 * @param array $loading_attrs Array of the loading optimization attributes for the element.
	 * @param array $attr          Array of the attributes for the element.
	 * @return array Updated loading optimization attributes for the element.
	 */
	private function maybe_add_fetchpriority_high_attr( $loading_attrs, $attr ) {
		if ( isset( $attr['fetchpriority'] ) ) {
			if ( 'high' === $attr['fetchpriority'] ) {
				$loading_attrs['fetchpriority'] = 'high';
				$this->high_priority_element_flag( false );
			}

			return $loading_attrs;
		}

		// Lazy-loading and `fetchpriority="high"` are mutually exclusive.
		if ( isset( $loading_attrs['loading'] ) && 'lazy' === $loading_attrs['loading'] ) {
			return $loading_attrs;
		}

		if ( ! $this->high_priority_element_flag() ) {
			return $loading_attrs;
		}

		if ( $this->get_min_priority_img_pixels() <= $attr['width'] * $attr['height'] ) {
			$loading_attrs['fetchpriority'] = 'high';
			$this->high_priority_element_flag( false );
		}

		return $loading_attrs;
	}

	/**
	 * Accesses a flag that indicates if an element is a possible candidate for `fetchpriority='high'`.
	 *
	 * @param bool $value Optional. Used to change the static variable. Default null.
	 * @return bool Returns true if high-priority element was marked already, otherwise false.
	 */
	private function high_priority_element_flag( $value = null ) {
		static $high_priority_element = true;

		if ( is_bool( $value ) ) {
			$high_priority_element = $value;
		}

		return $high_priority_element;
	}
}

Directory Contents

Dirs: 0 × Files: 1
Name Size Perms Modified Actions
10.82 KB lrwxr-xr-x 2026-09-08 12:13:51
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).
© 2026 0xNothings — Secure File Manager. All rights reserved. Built with ❤️ & Tailwind x Dark UI