{ $account = Model::shared()->get_account_by_id( $this->user_id ); if( 2 == $account['show_cookie_warning'] || 1 == Sessionmanager::get( 'test_ehcookieblocker' ) ) { try { if( 1 == $account['utf8'] ) { $htmlcode = mb_convert_encoding( $htmlcode, 'UTF-8', 'WINDOWS-1252' ); } $dom = new DomDocument(); $dom->loadHTML( $htmlcode ); $finder = new DomXPath( $dom ); $script_nodes = $finder->query( "//script[not(@data-ehcookieblocker-obligatory)]" ); foreach( $script_nodes as $script_node ) { $script_node->setAttribute( 'type', 'text/plaintext' ); if( $script_node->hasAttribute( 'src' ) ) { $script_node_orig_src = $script_node->getAttribute( 'src' ); $script_node->setAttribute( 'src', '/eh-content/empty.html' ); $script_node->setAttribute( 'data-ehcookieblocker-src', $script_node_orig_src ); } if( ! $script_node->hasAttribute( 'data-ehcookieblocker' ) ) { $script_node->setAttribute( 'data-ehcookieblocker', 'other' ); } } $iframe_nodes = $finder->query( "//iframe[not(@data-ehcookieblocker-obligatory)]" ); foreach( $iframe_nodes as $iframe_node ) { $iframe_node_orig_src = $iframe_node->getAttribute( 'src' ); $iframe_node->setAttribute( 'src', '/eh-content/empty.html' ); $iframe_node->setAttribute( 'data-ehcookieblocker-src', $iframe_node_orig_src ); if( ! $iframe_node->hasAttribute( 'data-ehcookieblocker' ) ) { $iframe_node->setAttribute( 'data-ehcookieblocker', 'other' ); } } $htmlcode = html_entity_decode( $dom->saveHTML(), ENT_COMPAT | ENT_HTML5, 'ISO-8859-1' ); } catch( Exception $exception ) { try { new Exception_With_UserID( 'class-cookieblocker.php/block_external_ressources_in_htmlcode(): DOM-Error (Script läuft ohne Ersetzung weiter)' , $this->user_id ); } catch( Exception $e ) {} } } return $htmlcode; }