n.addedNodes.length; i++) { if (typeof mutation.addedNodes[i].getElementsByTagName !== \'function\') { continue; } if (typeof mutation.addedNodes[i].getElementsByClassName !== \'function\') { continue; } images = mutation.addedNodes[i].getElementsByTagName(\'img\'); is_image = mutation.addedNodes[i].tagName == "IMG"; iframes = mutation.addedNodes[i].getElementsByTagName(\'iframe\'); is_iframe = mutation.addedNodes[i].tagName == "IFRAME"; rocket_lazy = mutation.addedNodes[i].getElementsByClassName(\'rocket-lazyload\'); image_count += images.length; iframe_count += iframes.length; rocketlazy_count += rocket_lazy.length; if(is_image){ image_count += 1; } if(is_iframe){ iframe_count += 1; } } } ); if(image_count > 0 || iframe_count > 0 || rocketlazy_count > 0){ lazyLoadInstance.update(); } } ); var b = document.getElementsByTagName("body")[0]; var config = { childList: true, subtree: true }; observer.observe(b, config); } }, false);'; return $script; } /** * Returns the lazyload inline script * * @param array $args Array of arguments to populate the lazyload script options. * @return string */ public function getLazyloadScript( $args = [] ) { $defaults = [ 'base_url' => '', 'version' => '', ]; $args = wp_parse_args( $args, $defaults ); $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; /** * Filters the script tag for the lazyload script * * @since 2.2.6 * * @param string $script_tag HTML tag for the lazyload script. */ return apply_filters( 'rocket_lazyload_script_tag', '' ); // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript } /** * Inserts in the HTML the script to replace the Youtube thumbnail by the iframe. * * @param array $args Array of arguments to populate the script options. * @return void */ public function insertYoutubeThumbnailScript( $args = [] ) { echo $this->getYoutubeThumbnailScript( $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Returns the Youtube Thumbnail inline script * * @param array $args Array of arguments to populate the script options. * @return string */ public function getYoutubeThumbnailScript( $args = [] ) { $defaults = [ 'resolution' => 'hqdefault', 'lazy_image' => false, 'native' => true, 'extension' => 'jpg', ]; $allowed_resolutions = [ 'default' => [ 'width' => 120, 'height' => 90, ], 'mqdefault' => [ 'width' => 320, 'height' => 180, ], 'hqdefault' => [ 'width' => 480, 'height' => 360, ], 'sddefault' => [ 'width' => 640, 'height' => 480, ], 'maxresdefault' => [ 'width' => 1280, 'height' => 720, ], ]; $args['resolution'] = ( isset( $args['resolution'] ) && isset( $allowed_resolutions[ $args['resolution'] ] ) ) ? $args['resolution'] : 'hqdefault'; $args = wp_parse_args( $args, $defaults ); $extension_uri = 'webp' === $args['extension'] ? 'vi_webp' : 'vi'; $image_url = 'https://i.ytimg.com/' . $extension_uri . '/ID/' . $args['resolution'] . '.' . $args['extension']; $image = ''; if ( isset( $args['lazy_image'] ) && $args['lazy_image'] ) { $attributes = 'alt="" width="' . $allowed_resolutions[ $args['resolution'] ]['width'] . '" height="' . $allowed_resolutions[ $args['resolution'] ]['height'] . '"'; $image = ''; if ( $args['native'] ) { $image = ''; } } /** * Filters the patterns excluded from lazyload for youtube thumbnails. * * @param array $excluded_patterns Array of excluded patterns. */ $excluded_patterns = apply_filters( 'rocket_lazyload_exclude_youtube_thumbnail', [] ); if ( ! is_array( $excluded_patterns ) ) { $excluded_patterns = []; } $excluded_patterns = wp_json_encode( $excluded_patterns ); return ""; } /** * Inserts the CSS to style the Youtube thumbnail container * * @param array $args Array of arguments to populate the CSS. * @return void */ public function insertYoutubeThumbnailCSS( $args = [] ) { wp_register_style( 'rocket-lazyload', false ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion wp_enqueue_style( 'rocket-lazyload' ); wp_add_inline_style( 'rocket-lazyload', $this->getYoutubeThumbnailCSS( $args ) ); } /** * Returns the CSS for the Youtube Thumbnail * * @param array $args Array of arguments to populate the CSS. * @return string */ public function getYoutubeThumbnailCSS( $args = [] ) { $defaults = [ 'base_url' => '', 'responsive_embeds' => true, ]; $args = wp_parse_args( $args, $defaults ); $css = '.rll-youtube-player{position:relative;padding-bottom:56.23%;height:0;overflow:hidden;max-width:100%;}.rll-youtube-player:focus-within{outline: 2px solid currentColor;outline-offset: 5px;}.rll-youtube-player iframe{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;background:0 0}.rll-youtube-player img{bottom:0;display:block;left:0;margin:auto;max-width:100%;width:100%;position:absolute;right:0;top:0;border:none;height:auto;-webkit-transition:.4s all;-moz-transition:.4s all;transition:.4s all}.rll-youtube-player img:hover{-webkit-filter:brightness(75%)}.rll-youtube-player .play{height:100%;width:100%;left:0;top:0;position:absolute;background:url(' . $args['base_url'] . 'img/youtube.png) no-repeat center;background-color: transparent !important;cursor:pointer;border:none;}'; if ( $args['responsive_embeds'] ) { $css .= '.wp-embed-responsive .wp-has-aspect-ratio .rll-youtube-player{position:absolute;padding-bottom:0;width:100%;height:100%;top:0;bottom:0;left:0;right:0}'; } return $css; } /** * Inserts the CSS needed when Javascript is not enabled to keep the display correct * * @return void */ public function insertNoJSCSS() { echo $this->getNoJSCSS(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Returns the CSS to correctly display images when JavaScript is disabled * * @return string */ public function getNoJSCSS() { return ''; } }
Fatal error: Uncaught TypeError: WP_Rocket\Engine\Media\Lazyload\Subscriber::__construct(): Argument #2 ($assets) must be of type WP_Rocket\Dependencies\RocketLazyload\Assets, string given in /html/autohaus-lange/website-autohaus-lange/web/app/plugins/wp-rocket/inc/Engine/Media/Lazyload/Subscriber.php:64 Stack trace: #0 [internal function]: WP_Rocket\Engine\Media\Lazyload\Subscriber->__construct(Object(WP_Rocket\Admin\Options_Data), '...', Object(WP_Rocket\Dependencies\RocketLazyload\Image), Object(WP_Rocket\Dependencies\RocketLazyload\Iframe)) #1 /html/autohaus-lange/website-autohaus-lange/web/app/plugins/wp-rocket/inc/Dependencies/League/Container/Definition/Definition.php(225): ReflectionClass->newInstanceArgs(Array) #2 /html/autohaus-lange/website-autohaus-lange/web/app/plugins/wp-rocket/inc/Dependencies/League/Container/Definition/Definition.php(181): WP_Rocket\Dependencies\League\Container\Definition\Definition->resolveClass('...') #3 /html/autohaus-lange/website-autohaus-lange/web/app/plugins/wp-rocket/inc/Dependencies/League/Container/Definition/Definition.php(160): WP_Rocket\Dependencies\League\Container\Definition\Definition->resolveNew() #4 /html/autohaus-lange/website-autohaus-lange/web/app/plugins/wp-rocket/inc/Dependencies/League/Container/Definition/DefinitionAggregate.php(79): WP_Rocket\Dependencies\League\Container\Definition\Definition->resolve() #5 /html/autohaus-lange/website-autohaus-lange/web/app/plugins/wp-rocket/inc/Dependencies/League/Container/Container.php(175): WP_Rocket\Dependencies\League\Container\Definition\DefinitionAggregate->resolve('...') #6 /html/autohaus-lange/website-autohaus-lange/web/app/plugins/wp-rocket/inc/Dependencies/League/Container/Container.php(118): WP_Rocket\Dependencies\League\Container\Container->resolve('...') #7 /html/autohaus-lange/website-autohaus-lange/web/app/plugins/wp-rocket/inc/Plugin.php(170): WP_Rocket\Dependencies\League\Container\Container->get('...') #8 /html/autohaus-lange/website-autohaus-lange/web/app/plugins/wp-rocket/inc/main.php(47): WP_Rocket\Plugin->load() #9 /html/autohaus-lange/website-autohaus-lange/web/wp/wp-includes/class-wp-hook.php(324): rocket_init('') #10 /html/autohaus-lange/website-autohaus-lange/web/wp/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(false, Array) #11 /html/autohaus-lange/website-autohaus-lange/web/wp/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #12 /html/autohaus-lange/website-autohaus-lange/web/wp/wp-settings.php(559): do_action('...') #13 /html/autohaus-lange/website-autohaus-lange/web/wp-config.php(20): require_once('...') #14 /html/autohaus-lange/website-autohaus-lange/web/wp/wp-load.php(55): require_once('...') #15 /html/autohaus-lange/website-autohaus-lange/web/wp/wp-blog-header.php(13): require_once('...') #16 /html/autohaus-lange/website-autohaus-lange/web/index.php(6): require('...') #17 {main} thrown in /html/autohaus-lange/website-autohaus-lange/web/app/plugins/wp-rocket/inc/Engine/Media/Lazyload/Subscriber.php on line 64