From 4d0524ad3f8fe801fe9b03838b73a5041e9ed793 Mon Sep 17 00:00:00 2001 From: scossar Date: Wed, 18 Apr 2018 12:59:43 -0700 Subject: [PATCH] Add discourse_comments_number argument --- templates/html-templates.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/templates/html-templates.php b/templates/html-templates.php index 5e88207..692c140 100644 --- a/templates/html-templates.php +++ b/templates/html-templates.php @@ -21,24 +21,28 @@ class HTMLTemplates { * * @param string $option The option key. * - * @return void + * @return string */ protected static function get_text_options( $option ) { $text_options = get_option( 'discourse_configurable_text' ); - echo esc_html( $text_options[ $option ] ); + $text = ! empty( $text_options[ $option ] ) ? $text_options[ $option ] : ''; + + return $text; } /** * Sets the target attribute. * - * @return void + * @return string */ protected static function target() { $comment_options = get_option( 'discourse_comment' ); if ( ! empty( $comment_options['discourse-new-tab'] ) ) { - echo 'target="_blank"'; + return 'target="_blank"'; } + + return ''; } /** @@ -91,13 +95,16 @@ class HTMLTemplates { * @static * @return mixed|void */ - public static function no_replies_html() { + public static function no_replies_html( $discourse_comments_number = null ) { ob_start(); ?>

- + 0 ? self::get_text_options( 'join-discussion-text' ) : self::get_text_options( 'start-discussion-text' ); + ?> + href="{topic_url}"> {discourse_url_name}

@@ -158,7 +165,7 @@ class HTMLTemplates { width="64"> {username} - +