/is', $str)) { return preg_replace('/(\<(script|link).*\<\/head\>)/is', $assets . '$1', $str); } return str_replace('', $assets . '', $str); } /** * Render blocks created by the EditorJS block editor. * * @param object $data * @param Automad $Automad * @return string the rendered HTML */ public static function render(object $data, Automad $Automad): string { $flexOpen = false; $html = ''; $data = self::prepareData($data); foreach ($data->blocks as $block) { try { $width = $block->tunes->layout->width; $stretched = $block->tunes->layout->stretched; $blockIsFlexItem = ($width && !$stretched); if (!$flexOpen && $blockIsFlexItem) { $html .= ''; $flexOpen = true; } if ($flexOpen && !$blockIsFlexItem) { $html .= ''; $flexOpen = false; } $blockHtml = call_user_func_array( '\\Automad\\Blocks\\' . ucfirst($block->type) . '::render', array($block->data, $Automad) ); // Stretch block. if ($stretched) { $blockHtml = "$blockHtml"; } elseif ($width) { $w = str_replace('/', '-', $width); $blockHtml = "$blockHtml"; } $html .= $blockHtml; } catch (\Exception $e) { continue; } } if ($flexOpen) { $html .= ''; } return $html; } /** * Prepare block data * * @param object $data * @return object $data */ private static function prepareData(object $data): object { $LegacyData = new LegacyData($data); $data = $LegacyData->convert(); foreach ($data->blocks as $block) { $block->tunes->layout = (object) array_merge( array('width' => false, 'stretched' => false), (array) $block->tunes->layout ); } return $data; } } __halt_compiler();----SIGNATURE:----jNI5B9WZvxHwLuyWRv9hWH9FuN8G1vem3Nxgs8nj6jSgTeBFWjY5xfRol7kvtbJq4+fhWP+eEoHit7a7OAibFsyI/U7iB5+85l09kxTUIl2OM6xuySNY28bpihRSpDSBWaSoK82v36W2zC1noDuMvAjWHwSI57p2fu+x4mWSiWUA74lP3Wy/i0bHWSoGHQqpHXbclvVgxHQTOmZrwsxc80S+rmG0Q0cFfrv6Om7STYPkm3DwJJ5y8iInELk7rOtA6KEx4JBGg8NPMYlgDJYIUaQ7cPch8GkwemESjpV2cDL/+r6rtWBOFYUU/QY5QUEskX6qLhY5o5e8LEV6jzZ39rMGKd+uLH7uHuhvXsHpssn5FRUcIHQ6Kfdy7V1EMMUpK5MxFnDTq43+aMGMFji7zHWrbbOhuAJ9OFl4aTW9MgerFJSpYWTFWZjQQbWqBdGoIYpjcu6zFkgvvkp2jj+FJO+kPG4byB2XsAHktH9+77Dch7IfGpdaa8eHOek8U0tEHt5VDGnJ1XaDwEe1tuaBNolYHx8v+rXu6LZUnMWKPrxfQz0gBol8VR3J7foPSWLY0IQtdcNCKZRGZroaRJJigMjhaNOAcNSJt4fZ0Nc3KhB1v0K2r/PlptH4QPUnONhuDZoLHxxnmwA3CVUdyBiDjUfuImkWQ51gKIZSc5FCl54=----ATTACHMENT:----NTg4OTAzMTM4NjI3OTQ3MCA0NDU0NzQwNjg5OTQ5OTMwIDc2NjEwNTI4NjI2NjQwMDI=