'button', 'label' => 'Teilen' ), $atts, 'shareliascriptbtn'); if (is_singular()) { global $post; $title = get_the_title($post->ID); $content = apply_filters('the_content', $post->post_content); // Convert content to Markdown $markdownContent = $this->convert_to_markdown($content); // Append TULLU license $license = "\n\n---\n\n" . "This work is licensed under the TULLU rule. For more information, visit https://open-educational-resources.de/oer-tullu-regel/"; $markdownContent .= $license; // Convert Markdown content to gzip Base64 $contentHash = $this->create_gzip_base64_data($markdownContent); // Generate the link $link = sprintf( '%s', $contentHash, esc_attr($atts['class']), esc_html($atts['label']) ); return $link; } return ''; } private function convert_to_markdown($content) { $parsedown = new Parsedown(); $html = $parsedown->text($content); $converter = new HtmlConverter(); $markdown = $converter->convert($html); return $markdown; } private function create_gzip_base64_data($data) { $gzData = gzencode($data, 9); return base64_encode($gzData); } } // Initialize the plugin new PostToLiaScriptShortcodeButton();