| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\Base\Module as BaseModule; |
| 5 | 5 | |
| 6 | 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | - exit; // Exit if accessed directly. | |
| 7 | + exit; // Exit if accessed directly | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | class Module extends BaseModule { |
| 11 | 11 | /** |
| @@ -69,9 +69,12 @@ | ||
| 69 | 69 | /** |
| 70 | 70 | * Stop WordPress core fetchpriority logic by setting the wp_high_priority_element_flag flag to false. |
| 71 | 71 | */ |
| 72 | 72 | public function stop_core_fetchpriority_high_logic() { |
| 73 | - wp_high_priority_element_flag( false ); | |
| 73 | + // wp_high_priority_element_flag was only introduced in 6.3.0 | |
| 74 | + if ( function_exists( 'wp_high_priority_element_flag' ) ) { | |
| 75 | + wp_high_priority_element_flag( false ); | |
| 76 | + } | |
| 74 | 77 | } |
| 75 | 78 | |
| 76 | 79 | /** |
| 77 | 80 | * Set buffer to handle header and footer content. |
| @@ -239,9 +242,8 @@ | ||
| 239 | 242 | __FUNCTION__, |
| 240 | 243 | esc_html__( 'An image should not be lazy-loaded and marked as high priority at the same time.', 'elementor' ), |
| 241 | 244 | '' |
| 242 | 245 | ); |
| 243 | - | |
| 244 | 246 | /* |
| 245 | 247 | * Set `fetchpriority` here for backward-compatibility as we should |
| 246 | 248 | * not override what a developer decided, even though it seems |
| 247 | 249 | * incorrect. |
| @@ -312,10 +314,10 @@ | ||
| 312 | 314 | |
| 313 | 315 | /** |
| 314 | 316 | * Determines whether to add `fetchpriority='high'` to loading attributes. |
| 315 | 317 | * |
| 316 | - * @param array $loading_attrs Array of the loading optimization attributes for the element. | |
| 317 | - * @param array $attr Array of the attributes for the element. | |
| 318 | + * @param array $loading_attrs Array of the loading optimization attributes for the element. | |
| 319 | + * @param array $attr Array of the attributes for the element. | |
| 318 | 320 | * @return array Updated loading optimization attributes for the element. |
| 319 | 321 | */ |
| 320 | 322 | private function maybe_add_fetchpriority_high_attr( $loading_attrs, $attr ) { |
| 321 | 323 | if ( isset( $attr['fetchpriority'] ) ) { |