diff --git a/e107_plugins/comment_menu/comment_menu.php b/e107_plugins/comment_menu/comment_menu.php
index ce07faac2..f11d0d8df 100644
--- a/e107_plugins/comment_menu/comment_menu.php
+++ b/e107_plugins/comment_menu/comment_menu.php
@@ -31,7 +31,7 @@ if (file_exists(THEME."comment_menu_template.php"))
}
else
{
- require_once (e_PLUGIN."comment_menu/comment_menu_template.php");
+ require_once(e_PLUGIN."comment_menu/comment_menu_template.php");
}
$data = $cobj->getCommentData(intval($menu_pref['comment_display']));
@@ -43,13 +43,34 @@ if (empty($data) || !is_array($data))
$text = CM_L1;
}
+if(!is_array($COMMENT_MENU_TEMPLATE)) // Convert to v2.x standard.
+{
+ $TEMPLATE = array();
+ $TEMPLATE['start'] = "";
+ $TEMPLATE['item'] = $COMMENT_MENU_TEMPLATE;
+ $TEMPLATE['end'] = "";
+}
+else
+{
+ $TEMPLATE = $COMMENT_MENU_TEMPLATE;
+}
+
+$comment_menu_shortcodes = new comment_menu_shortcodes;
+
+$text .= $tp->parseTemplate($TEMPLATE['start'], true, $comment_menu_shortcodes);
+
foreach ($data as $row)
{
- e107::setRegistry('plugin/comment_menu/current', $row);
- $text .= $tp->parseTemplate($COMMENT_MENU_TEMPLATE, true, $comment_menu_shortcodes);
+ //e107::setRegistry('plugin/comment_menu/current', $row);
+ $comment_menu_shortcodes->setVars($row);
+ $text .= $tp->parseTemplate($TEMPLATE['item'], true, $comment_menu_shortcodes);
}
-e107::setRegistry('plugin/comment_menu/current', null);
+
+$text .= $tp->parseTemplate($TEMPLATE['end'], true, $comment_menu_shortcodes);
+
+//e107::setRegistry('plugin/comment_menu/current', null);
$title = e107::getConfig('menu')->get('comment_caption');
+
e107::getRender()->tablerender(defset($title, $title), $text, 'comment_menu');
?>
\ No newline at end of file
diff --git a/e107_plugins/comment_menu/comment_menu_shortcodes.php b/e107_plugins/comment_menu/comment_menu_shortcodes.php
index 9eed8e627..0f7b54adb 100644
--- a/e107_plugins/comment_menu/comment_menu_shortcodes.php
+++ b/e107_plugins/comment_menu/comment_menu_shortcodes.php
@@ -15,9 +15,88 @@
*/
if (!defined('e107_INIT')) { exit; }
-global $tp;
-$comment_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
-e107::getRegistry('plugin/comment_menu/current');
+
+//$comment_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
+//e107::getRegistry('plugin/comment_menu/current');
+
+class comment_menu_shortcodes extends e_shortcode
+{
+ /**
+ * @DEPRECATED - use css styling instead.
+ */
+ function sc_cm_icon()
+ {
+ //TODO review bullet
+ $bullet = '';
+ if(defined('BULLET'))
+ {
+ $bullet = '';
+ }
+ elseif(file_exists(THEME.'images/bullet2.gif'))
+ {
+ $bullet = '
';
+ }
+ return $bullet;
+ }
+
+ function sc_cm_datestamp()
+ {
+ $gen = new convert;
+ return $gen->convert_date($this->var['comment_datestamp'], "relative");
+ }
+
+ function sc_cm_heading()
+ {
+ return $this->var['comment_title'];
+ }
+
+ function sc_cm_url_pre()
+ {
+ return ($this->var['comment_url'] ? "" : "");
+ }
+
+ function sc_cm_url_post()
+ {
+ return ($this->var['comment_url'] ? "" : "");
+ }
+
+ function sc_cm_type()
+ {
+ return $this->var['comment_type'];
+ }
+
+ function sc_cm_author()
+ {
+ return $this->var['comment_author'];
+ }
+
+
+ function sc_cm_comment($parm='')
+ {
+ $menu_pref = e107::getConfig('menu')->getPref();
+ $tp = e107::getParser();
+ $COMMENT = '';
+
+ if($menu_pref['comment_characters'] > 0)
+ {
+ $COMMENT = strip_tags($tp->toHTML($this->var['comment_comment'], TRUE, "emotes_off, no_make_clickable", "", e107::getPref('menu_wordwrap')));
+ if ($tp->ustrlen($COMMENT) > $menu_pref['comment_characters'])
+ {
+ $COMMENT = $tp->text_truncate($COMMENT, $menu_pref['comment_characters'],'').($this->var['comment_url'] ? " " : "").defset($menu_pref['comment_postfix'], $menu_pref['comment_postfix']).($this->var['comment_url'] ? "" : "");
+ }
+ }
+
+ return $COMMENT;
+ }
+
+}
+
+
+
+
+
+
+
/*
SC_BEGIN CM_ICON
//TODO review bullet
@@ -36,7 +115,7 @@ SC_END
SC_BEGIN CM_DATESTAMP
$row = e107::getRegistry('plugin/comment_menu/current');
$gen = new convert;
-return $gen->convert_date($row['comment_datestamp'], "short");
+return $gen->convert_date($row['comment_datestamp'], "relative");
SC_END
SC_BEGIN CM_HEADING
@@ -69,6 +148,7 @@ $row = e107::getRegistry('plugin/comment_menu/current');
$menu_pref = e107::getConfig('menu')->getPref();
$tp = e107::getParser();
$COMMENT = '';
+
if($menu_pref['comment_characters'] > 0)
{
$COMMENT = strip_tags($tp->toHTML($row['comment_comment'], TRUE, "emotes_off, no_make_clickable", "", e107::getPref('menu_wordwrap')));
diff --git a/e107_plugins/comment_menu/comment_menu_template.php b/e107_plugins/comment_menu/comment_menu_template.php
index 844dfa87a..0bc25a435 100644
--- a/e107_plugins/comment_menu/comment_menu_template.php
+++ b/e107_plugins/comment_menu/comment_menu_template.php
@@ -17,19 +17,27 @@
$sc_style['CM_TYPE']['pre'] = "[";
$sc_style['CM_TYPE']['post'] = "]";
-$sc_style['CM_AUTHOR']['pre'] = CM_L13." ";
-$sc_style['CM_AUTHOR']['post'] = "";
+$sc_style['CM_AUTHOR']['pre'] = CM_L13." ";
+$sc_style['CM_AUTHOR']['post'] = "";
-$sc_style['CM_DATESTAMP']['pre'] = " ".CM_L11." ";
+$sc_style['CM_DATESTAMP']['pre'] = " ";
$sc_style['CM_DATESTAMP']['post'] = "";
$sc_style['CM_COMMENT']['pre'] = "";
-$sc_style['CM_COMMENT']['post'] = "
";
+$sc_style['CM_COMMENT']['post'] = "";
-if (!isset($COMMENT_MENU_TEMPLATE)){
- $COMMENT_MENU_TEMPLATE = "
- {CM_ICON} {CM_URL_PRE}{CM_TYPE} {CM_HEADING}{CM_URL_POST}
- {CM_AUTHOR} {CM_DATESTAMP}
- {CM_COMMENT}";
+// $SC_WRAPPER['CM_AUTHOR'] = CM_L13."{---}"; //XXX Not working at time of review
+
+if (!isset($COMMENT_MENU_TEMPLATE))
+{
+ $COMMENT_MENU_TEMPLATE['start'] = "