add_block(new Block( "Link to Post", "
BBCode ". $this->link_code("Link", $this->url($post_link, $text_link, "ubb"), "ubb_text-link"). $this->link_code("Thumb", $this->url($post_link, $this->img($thumb_src, "ubb"), "ubb"), "ubb_thumb-link"). $this->link_code("File", $this->img($image_src, "ubb"), "ubb_full-img"). "
HTML ". $this->link_code("Link", $this->url($post_link, $text_link, "html"), "html_text-link"). $this->link_code("Thumb", $this->url($post_link, $this->img($thumb_src, "html"), "html"), "html_thumb-link"). $this->link_code("File", $this->img($image_src, "html"), "html_full-image"). "
Plain Text ". $this->link_code("Link", $post_link, "text_post-link"). $this->link_code("Thumb", $thumb_src, "text_thumb-url"). $this->link_code("File", $image_src, "text_image-src"). "
", "main", 50 )); } protected function url(string $url, ?string $content, string $type): string { if (empty($content)) { $content = $url; } switch ($type) { case "html": $text = "".$content.""; break; case "ubb": $text = "[url=".$url."]".$content."[/url]"; break; default: $text = $url." - ".$content; } return $text; } protected function img(string $src, string $type): string { switch ($type) { case "html": $text = "\"\""; break; case "ubb": $text = "[img]".$src."[/img]"; break; default: $text = $src; } return $text; } protected function link_code(string $label, string $content, string $id): string { return " "; } }