$matched_class_name = $class_token; break; } $class_token = strtok( $token_delimiter ); } if ( null === $matched_class_name ) { return $block_content; } $tags = new WP_HTML_Tag_Processor( $block_content ); if ( $tags->next_tag() ) { $tags->add_class( 'has-custom-css' ); $tags->add_class( $matched_class_name ); } return $tags->get_updated_html(); } add_filter( 'render_block', 'wp_render_custom_css_class_name', 10, 2 ); add_filter( 'render_block_data', 'wp_render_custom_css_support_styles', 10, 1 ); add_action( 'wp_enqueue_scripts', 'wp_enqueue_block_custom_css', 1 ); /** * Registers the style block attribute for block types that support it. * * @param WP_Block_Type $block_type Block Type. */ function wp_register_custom_css_support( $block_type ) { // Setup attributes and styles within that if needed. if ( ! $block_type->attributes ) { $block_type->attributes = array(); } // Check for existing style attribute definition e.g. from block.json. if ( array_key_exists( 'style', $block_type->attributes ) ) { return; } $has_custom_css_support = block_has_support( $block_type, array( 'customCSS' ), true ); if ( $has_custom_css_support ) { $block_type->attributes['style'] = array( 'type' => 'object', ); } } /** * Strips custom CSS (`style.css` in attributes) from all blocks in post content. * * Uses {@see WP_Block_Parser::next_token()} to scan block tokens and surgically * replace only the attribute JSON that changed — no parse_blocks() + * serialize_blocks() round-trip needed. * * @since 7.0.0 * @access private * * @param string $content Post content to filter, expected to be escaped with slashes. * @return string Filtered post content with block custom CSS removed. */ function wp_strip_custom_css_from_blocks( $content ) { if ( ! has_blocks( $content ) ) { return $content; } $unslashed = stripslashes( $content ); $parser = new WP_Block_Parser(); $parser->document = $unslashed; $parser->offset = 0; $end = strlen( $unslashed ); $replacements = array(); while ( $parser->offset < $end ) { $next_token = $parser->next_token(); if ( 'no-more-tokens' === $next_token[0] ) { break; } list( $token_type, , $attrs, $start_offset, $token_length ) = $next_token; $parser->offset = $start_offset + $token_length; if ( 'block-opener' !== $token_type && 'void-block' !== $token_type ) { continue; } if ( ! isset( $attrs['style']['css'] ) ) { continue; } // Remove css and clean up empty style. unset( $attrs['style']['css'] ); if ( empty( $attrs['style'] ) ) { unset( $attrs['style'] ); } // Locate the JSON portion within the token. $token_string = substr( $unslashed, $start_offset, $token_length ); $json_rel_start = strcspn( $token_string, '{' ); $json_rel_end = strrpos( $token_string, '}' ); $json_start = $start_offset + $json_rel_start; $json_length = $json_rel_end - $json_rel_start + 1; // Re-encode attributes. If attrs is now empty, remove JSON and trailing space. if ( empty( $attrs ) ) { // Remove the trailing space after JSON. $replacements[] = array( $json_start, $json_length + 1, '' ); } else { $replacements[] = array( $json_start, $json_length, serialize_block_attributes( $attrs ) ); } } if ( empty( $replacements ) ) { return $content; } // Build the result by splicing replacements into the original string. $result = ''; $was_at = 0; foreach ( $replacements as $replacement ) { list( $offset, $length, $new_json ) = $replacement; $result .= substr( $unslashed, $was_at, $offset - $was_at ) . $new_json; $was_at = $offset + $length; } if ( $was_at < $end ) { $result .= substr( $unslashed, $was_at ); } return addslashes( $result ); } /** * Adds the filters to strip custom CSS from block content on save. * Priority of 8 to run before wp_filter_global_styles_post (priority 9) and wp_filter_post_kses (priority 10). * * @since 7.0.0 * @access private */ function wp_custom_css_kses_init_filters() { add_filter( 'content_save_pre', 'wp_strip_custom_css_from_blocks', 8 ); add_filter( 'content_filtered_save_pre', 'wp_strip_custom_css_from_blocks', 8 ); } /** * Removes the filters that strip custom CSS from block content on save. * Priority of 8 to run before wp_filter_global_styles_post (priority 9) and wp_filter_post_kses (priority 10). * * @since 7.0.0 * @access private */ function wp_custom_css_remove_filters() { remove_filter( 'content_save_pre', 'wp_strip_custom_css_from_blocks', 8 ); remove_filter( 'content_filtered_save_pre', 'wp_strip_custom_css_from_blocks', 8 ); } /** * Registers the custom CSS content filters if the user does not have the edit_css capability. * * @since 7.0.0 * @access private */ function wp_custom_css_kses_init() { wp_custom_css_remove_filters(); if ( ! current_user_can( 'edit_css' ) ) { wp_custom_css_kses_init_filters(); } } /** * Initializes custom CSS content filters when imported data should be filtered. * * Runs at priority 999 on {@see 'force_filtered_html_on_import'} to ensure it * fires after general KSES initialization, independently of user capabilities. * If the input of the filter is true it means we are in an import situation and should * enable the custom CSS filters, independently of the user capabilities. * * @since 7.0.0 * @access private * * @param mixed $arg Input argument of the filter. * @return mixed Input argument of the filter. */ function wp_custom_css_force_filtered_html_on_import_filter( $arg ) { if ( $arg ) { wp_custom_css_kses_init_filters(); } return $arg; } // Run before wp_filter_global_styles_post (priority 9) and wp_filter_post_kses (priority 10). add_action( 'init', 'wp_custom_css_kses_init', 20 ); add_action( 'set_current_user', 'wp_custom_css_kses_init' ); add_filter( 'force_filtered_html_on_import', 'wp_custom_css_force_filtered_html_on_import_filter', 999 ); // Register the block support. WP_Block_Supports::get_instance()->register( 'custom-css', array( 'register_attribute' => 'wp_register_custom_css_support', ) ); unsichtbar – DaisyDougs https://www.daisydougs.de Fahrtwind & Impressionen Sun, 12 Feb 2023 22:07:42 +0000 de hourly 1 https://wordpress.org/?v=7.0 Ein Schild lässt mich verschwinden… https://www.daisydougs.de/motorradaengste/ein-schild-laesst-mich-verschwinden/ https://www.daisydougs.de/motorradaengste/ein-schild-laesst-mich-verschwinden/#comments Sun, 12 Feb 2023 21:44:09 +0000 http://www.daisydougs.de/?p=145
Schild lässt mich unsichtbar werden!

Eigentlich nichts besonders bis zu einem Zeitpunkt wo man unweigerlich eine Angst entwickelt umgehauen zu werden.

 

Hättest Du es geahnt? Klicke aufs Bild und sehe Dir die Szene doch mal an. Meine Geschwindigkeit lag bei knappen 80 km/h, und ich fahre mit der Sonne an der Zu-/Abfahrt vorbei.

 

Jetzt zurück zur Frage. Hättest Du es erwartet? Schreibe hier oder direkt unter dem #short -Video Deine Meinung.

 

Es ist nichts passiert doch der ersten Schrecken sitzt nun in mir. Es dauerte ein paar Minuten bis man das Gefühl „des möglichen Todes“ in den Gliedern nicht mehr spürt. Man ist natürlich Gedanklich noch bei der Situation und denkt unweigerlich auch an die Familie – was wäre wenn der mich nun erwischt hätte.
Der Fahrer konnte mich durch das Schild einfach nicht sehen und hat sich sicherlich auch erschrocken und gut reagiert. Schwamm drüber, ich lebe ja noch – unversehrt.

 

Jedoch 12 Minuten eine – für jene Vorgeschichte – weitere Situation die sämtliche eben erlebten Ereignisse ganz schnell wieder „aufflammen“ lassen. Der PKW am Torfhaus scheint nicht auch erst viel zu spät zu sehen und hält.

Eigentlich nichts wildes, sowas passiert ständig. Jedoch mit dem vor 12 Minuten passierten Beinaheunfall fühlt man anders. Zwei Mal jenes Gefühl zu erleben das ich vom Motorrad geholt werden sollte…

Als Zuschauer solch kleinen Begebenheit, vom Sofa aus, ist das nicht mal wirklich eine Gefahr und schon gar nicht die zweite „Gefährdung“. Eher Langweilig. Doch die Erfahrung auf dem Motorrad selbst ist eine andere.

Man kommt dann schnell auf den Gedanken die Unfallversicherung eventuell doch mal zu erhöhen oder zumindest die Hinterbliebenen-Abfindung deutlich aufzustocken. Denn, so sieht man es – es kann zu jeder Zeit passieren.

Ich kann zumindest darüber schreiben und eine bleibende Angst ist nicht geblieben, sonst müsste ich das Hobby Motorrad ja gleich beenden.

]]>
https://www.daisydougs.de/motorradaengste/ein-schild-laesst-mich-verschwinden/feed/ 1