ority_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;
}
}
Fatal error: Uncaught Error: Class 'Elementor\Modules\ImageLoadingOptimization\Module' not found in /var/www/html/dportilho.com.br/web/wp-content/plugins/elementor/core/modules-manager.php:53
Stack trace:
#0 /var/www/html/dportilho.com.br/web/wp-content/plugins/elementor/includes/plugin.php(755): Elementor\Core\Modules_Manager->__construct()
#1 /var/www/html/dportilho.com.br/web/wp-content/plugins/elementor/includes/plugin.php(673): Elementor\Plugin->init_components()
#2 /var/www/html/dportilho.com.br/web/wp-includes/class-wp-hook.php(324): Elementor\Plugin->init('')
#3 /var/www/html/dportilho.com.br/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#4 /var/www/html/dportilho.com.br/web/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /var/www/html/dportilho.com.br/web/wp-settings.php(704): do_action('init')
#6 /var/www/html/dportilho.com.br/web/wp-config.php(126): require_once('/var/www/html/d...')
#7 /var/www/html/dportilho.com.br/web/wp-load.php(50): require_once('/var/www/html/d...') in /var/www/html/dportilho.com.br/web/wp-content/plugins/elementor/core/modules-manager.php on line 53