ate( $block, $string_translations, $lang ); if ( isset( $block->innerBlocks ) ) { $block->innerBlocks = $this->update_block_translations( $block->innerBlocks, $string_translations, $lang ); } } return $blocks; } /** * @param array|WP_Block_Parser_Block $block * * @return string */ public static function render_block( $block ) { $content = ''; $block = self::sanitize_block( $block ); if ( self::CLASSIC_BLOCK_NAME !== $block->blockName ) { $block_content = self::render_inner_HTML( $block ); $block_type = preg_replace( '/^core\//', '', $block->blockName ); $block_attributes = ''; if ( self::has_non_empty_attributes( $block ) ) { $block_attributes = ' ' . json_encode( $block->attrs, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); } $content .= self::GUTENBERG_OPENING_START . $block_type . $block_attributes . ' '; if ( $block_content ) { $content .= '-->' . $block_content . self::GUTENBERG_CLOSING_START . $block_type . ' -->'; } else { $content .= '/-->'; } } else { $content = wpautop( $block->innerHTML ); } return $content; } public static function has_non_empty_attributes( WP_Block_Parser_Block $block ) { return (bool) ( (array) $block->attrs ); } /** * @param WP_Block_Parser_Block $block * * @return string */ private static function render_inner_HTML( $block ) { if ( isset ( $block->innerBlocks ) && count( $block->innerBlocks ) ) { if ( isset( $block->innerContent ) ) { $content = self::render_inner_HTML_with_innerContent( $block ); } else { $content = self::render_inner_HTML_with_guess_parts( $block ); } } else { $content = $block->innerHTML; } return $content; } /** * Since Gutenberg 4.2.0 and WP 5.0.0 we have a new * property WP_Block_Parser_Block::$innerContent which * provides the sequence of inner elements: * strings or null if it's an inner block. * * @see WP_Block_Parser_Block::$innerContent * * @param WP_Block_Parser_Block $block * * @return string */ private static function render_inner_HTML_with_innerContent( $block ) { $content = ''; $inner_block_index = 0; foreach ( $block->innerContent as $inner_content ) { if ( is_string( $inner_content ) ) { $content .= $inner_content; } else { $content .= self::render_block( $block->innerBlocks[ $inner_block_index ] ); $inner_block_index++; } } return $content; } /** * @param WP_Block_Parser_Block $block * * @return string */ private static function render_inner_HTML_with_guess_parts( $block ) { $inner_html_parts = self::guess_inner_HTML_parts( $block ); $content = $inner_html_parts[0]; foreach ( $block->innerBlocks as $inner_block ) { $content .= self::render_block( $inner_block ); } $content .= $inner_html_parts[1]; return $content; } /** * The gutenberg parser prior to version 4.2.0 (Gutenberg) and 5.0.0 (WP) * doesn't handle inner blocks correctly. * It should really return the HTML before and after the blocks * We're just guessing what it is here * The usual innerHTML would be:
* The columns block also includes new lines:
\n\n
* So we try to split at >innerHTML; $parts = array( $inner_HTML, '' ); switch( $block->blockName ) { case 'core/media-text': $html_to_find = '
'; $pos = mb_strpos( $inner_HTML, $html_to_find ) + mb_strlen( $html_to_find ); $parts = array( mb_substr( $inner_HTML, 0, $pos ), mb_substr( $inner_HTML, $pos ) ); break; default: preg_match( '#>\s*" char plus half the remaining between the tags $parts[0] .= mb_substr( $matches[0], 0, $match_mid_point ); $parts[1] = mb_substr( $matches[0], $match_mid_point ) . $parts[1]; } } break; } return $parts; } /** * @param array $config_data * * @return array */ public function wpml_config_filter( $config_data ) { $this->config_option->update_from_config( $config_data ); return $config_data; } /** * @param bool $translate * @param WP_Post $post * @param string $context * * @return bool */ public function should_body_be_translated_filter( $translate, WP_Post $post, $context = '' ) { if ( 'translate_images_in_post_content' === $context && $this->is_gutenberg_post( $post ) ) { $translate = true; } return $translate; } /** * @param WP_Post $post * * @return bool */ private function is_gutenberg_post( WP_Post $post ) { return (bool) preg_match( '/' . self::GUTENBERG_OPENING_START . '/', $post->post_content ); } public static function parse_blocks( $content ) { global $wp_version; if ( version_compare( $wp_version, '5.0-beta1', '>=' ) ) { return parse_blocks( $content ); } else { // @phpstan-ignore-next-line return gutenberg_parse_blocks( $content ); } } /** * Remove Gutenberg (string package) from translation dashboard filters * * @param array $types * * @return mixed */ public function remove_package_strings_type_filter( $types ) { if ( array_key_exists( 'gutenberg', $types ) ) { unset( $types['gutenberg'] ); } return $types; } }
Fatal error: Uncaught Error: Class "WPML_Gutenberg_Integration" not found in /home/pirizoe/public_html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Gutenberg/class-wpml-gutenberg-integration-factory.php:76 Stack trace: #0 /home/pirizoe/public_html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Gutenberg/class-wpml-gutenberg-integration-factory.php(12): WPML_Gutenberg_Integration_Factory->create_gutenberg_integration() #1 /home/pirizoe/public_html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/class-wpml-page-builders-app.php(43): WPML_Gutenberg_Integration_Factory->create() #2 /home/pirizoe/public_html/wp-includes/class-wp-hook.php(324): WPML_Page_Builders_App->load_integration('') #3 /home/pirizoe/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #4 /home/pirizoe/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /home/pirizoe/public_html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/class-wpml-pb-loader.php(15): do_action('wpml_load_page_...') #6 /home/pirizoe/public_html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/App.php(28): WPML_PB_Loader->__construct(Object(WPML_ST_Settings)) #7 /home/pirizoe/public_html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/app.php(25): WPML\PB\App::run() #8 /home/pirizoe/public_html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/loader.php(33): require_once('/home/pirizoe/p...') #9 /home/pirizoe/public_html/wp-includes/class-wp-hook.php(324): {closure}('') #10 /home/pirizoe/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #11 /home/pirizoe/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #12 /home/pirizoe/public_html/wp-settings.php(727): do_action('init') #13 /home/pirizoe/public_html/wp-config.php(106): require_once('/home/pirizoe/p...') #14 /home/pirizoe/public_html/wp-load.php(50): require_once('/home/pirizoe/p...') #15 /home/pirizoe/public_html/wp-blog-header.php(13): require_once('/home/pirizoe/p...') #16 /home/pirizoe/public_html/index.php(17): require('/home/pirizoe/p...') #17 {main} thrown in /home/pirizoe/public_html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Gutenberg/class-wpml-gutenberg-integration-factory.php on line 76
WordPress › Error

There has been a critical error on this website.

Learn more about troubleshooting WordPress.