From 06d4b31fbe0a94c8b429e9f1f940554a34a836f9 Mon Sep 17 00:00:00 2001 From: Tijn Kuyper Date: Wed, 20 Mar 2019 11:42:24 +0100 Subject: [PATCH] Allow for more styling of forum SC - FORUMNAME, REPLIESX and THREADSX Perhaps related to #2060 --- .../shortcodes/batch/forum_shortcodes.php | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php index ac957b6bb..4b2a244bf 100644 --- a/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/forum_shortcodes.php @@ -384,16 +384,22 @@ class forum_shortcodes extends e_shortcode } - function sc_forumname() + function sc_forumname($parm = '') { if(substr($this->var['forum_name'], 0, 1) == '*') { $this->var['forum_name'] = substr($this->var['forum_name'], 1); } + $this->var['forum_name'] = e107::getParser()->toHTML($this->var['forum_name'], true, 'no_hook'); + if(!empty($parm['class'])) + { + $class = $parm['class']; + } + $url = e107::url('forum', 'forum', $this->var); - return "{$this->var['forum_name']}"; + return "{$this->var['forum_name']}"; } @@ -414,21 +420,36 @@ class forum_shortcodes extends e_shortcode } - function sc_replies() + function sc_replies($parm = '') { - return $this->sc_repliesx(); + return $this->sc_repliesx($parm); } - function sc_threadsx() // EQUAL TO SC_THREADS....................... + function sc_threadsx($parm = '') // EQUAL TO SC_THREADS....................... { - return e107::getParser()->toBadge($this->var['forum_threads']); + $val = ($this->var['forum_threads']) ? $this->var['forum_threads'] : '0'; + + if(!empty($parm['raw'])) + { + return $val; + } + + return e107::getParser()->toBadge($val); } - function sc_repliesx() // EQUAL TO SC_REPLIES....................... + function sc_repliesx($parm = '') // EQUAL TO SC_REPLIES....................... { - return e107::getParser()->toBadge($this->var['forum_replies']); + //print_a($parm); + $val = ($this->var['forum_replies']) ? $this->var['forum_replies'] : '0'; + + if(!empty($parm['raw'])) + { + return $val; + } + + return e107::getParser()->toBadge($val); }