| @@ -491,31 +491,8 @@ | ||
| 491 | 491 | </div> |
| 492 | 492 | <?php |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - public function render_markdown(): string { | |
| 496 | - $settings = $this->get_settings_for_display(); | |
| 497 | - $title = Utils::html_to_plain_text( $settings['title'] ?? '' ); | |
| 498 | - $rating = floatval( $settings['rating'] ?? 0 ); | |
| 499 | - $scale = intval( $settings['rating_scale'] ?? 5 ); | |
| 500 | - | |
| 501 | - if ( empty( $rating ) ) { | |
| 502 | - return ''; | |
| 503 | - } | |
| 504 | - | |
| 505 | - $full_stars = intval( floor( $rating ) ); | |
| 506 | - $empty_stars = $scale - $full_stars; | |
| 507 | - $stars = str_repeat( '★', $full_stars ) . str_repeat( '☆', max( 0, $empty_stars ) ); | |
| 508 | - | |
| 509 | - $md = $stars . ' ' . $rating . '/' . $scale; | |
| 510 | - | |
| 511 | - if ( ! empty( $title ) ) { | |
| 512 | - $md .= "\n\n" . $title; | |
| 513 | - } | |
| 514 | - | |
| 515 | - return $md; | |
| 516 | - } | |
| 517 | - | |
| 518 | 495 | /** |
| 519 | 496 | * @since 2.9.0 |
| 520 | 497 | * @access protected |
| 521 | 498 | */ |