1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-15 11:04:18 +02:00

Comment template cleanup.

This commit is contained in:
Cameron
2021-01-04 08:16:21 -08:00
parent 11c768d3c0
commit 26899dcfbc
4 changed files with 68 additions and 321 deletions

View File

@@ -77,7 +77,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_timedate($parm = null)
function sc_comment_timedate($parm = null)
{
if($parm == 'relative')
{
@@ -87,8 +87,19 @@ class comment_shortcodes extends e_shortcode
return e107::getDate()->convert_date($this->var['comment_datestamp'], "short");
}
/**
* @deprecated
* @param null $parm
* @return array|string
*/
function sc_timedate($parm = null)
{
return $this->sc_comment_timedate($parm);
function sc_reply($parm = null)
}
function sc_comment_reply($parm = null)
{
global $REPLY, $action, $table, $id, $thisaction, $thistable, $thisid;
@@ -107,6 +118,16 @@ class comment_shortcodes extends e_shortcode
return $REPLY;
}
/**
* @deprecated
* @param null $parm
* @return string
*/
function sc_reply($parm=null)
{
return $this->sc_comment_reply($parm);
}
function sc_comment_avatar($parm = '')
{
@@ -136,7 +157,11 @@ class comment_shortcodes extends e_shortcode
return $text;
}
/**
* @deprecated
* @param null $parm
* @return string
*/
function sc_avatar($parm = null)
{
return $this->sc_comment_avatar($parm);
@@ -372,7 +397,7 @@ class comment_shortcodes extends e_shortcode
function sc_commentedit($parm = null)
function sc_comment_edit($parm = null)
{
global $COMMENTEDIT, $comment_edit_query;
$pref = e107::getPref();
@@ -397,6 +422,17 @@ class comment_shortcodes extends e_shortcode
}
}
/**
* @deprecated
* @param null $parm
* @return string
*/
function sc_commentedit($parm = null)
{
global $COMMENTEDIT, $comment_edit_query;
return $this->sc_comment_edit($parm);
}
function sc_rating($parm = null)
{

View File

@@ -15,86 +15,18 @@
*/
if (!defined('e107_INIT')) { exit; }
if (!defined("USER_WIDTH")){ define("USER_WIDTH", "width:100%"); }
global $sc_style;
global $pref, $comrow, $row2, $tp, $NEWIMAGE, $USERNAME, $RATING;
$sc_style['SUBJECT']['pre'] = "";
$sc_style['SUBJECT']['post'] = "";
$sc_style['USERNAME']['pre'] = "";
$sc_style['USERNAME']['post'] = "";
$sc_style['TIMEDATE']['pre'] = "<small>";
$sc_style['TIMEDATE']['post'] = "</small>";
$sc_style['AVATAR']['pre'] = "";
$sc_style['AVATAR']['post'] = "";
$sc_style['COMMENTS']['pre'] = "";
$sc_style['COMMENTS']['post'] = "<br />";
$sc_style['JOINED']['pre'] = "";
$sc_style['JOINED']['post'] = "<br />";
$sc_style['COMMENT']['pre'] = "";
$sc_style['COMMENT']['post'] = "<br />";
$sc_style['RATING']['pre'] = "";
$sc_style['RATING']['post'] = "<br />";
$sc_style['IPADDRESS']['pre'] = "";
$sc_style['IPADDRESS']['post'] = "<br />";
$sc_style['LEVEL']['pre'] = "";
$sc_style['LEVEL']['post'] = "<br />";
$sc_style['LOCATION']['pre'] = "";
$sc_style['LOCATION']['post'] = "<br />";
$sc_style['SIGNATURE']['pre'] = "";
$sc_style['SIGNATURE']['post'] = "<br />";
// Shortcode wrappers.
$COMMENT_WRAPPER['item']['COMENT_TIMEDATE'] = '<small>{---}</small>';
$COMMENT_WRAPPER['item']['COMMENT_EDIT'] = '<span class="comment-edit">{---}</span>';
$COMMENT_WRAPPER['item']['COMENT_REPLY'] = '<span class="comment-reply">{---}</span>';
$COMMENT_WRAPPER['item']['COMMENT_AVATAR'] = '<div class="comment-avatar center">{---}</div>';
$COMMENT_WRAPPER['item']['COMMENT_MODERATE'] = '<span class="comment-moderate">{---}</span>';
// from e107.org
$sc_style['REPLY']['pre'] = "<span class='comment-reply'>";
$sc_style['REPLY']['post'] = "</span>";
$sc_style['COMMENTEDIT']['pre'] = '<span class="comment-edit">';
$sc_style['COMMENTEDIT']['post'] = '</span>';
$sc_style['COMMENT_AVATAR']['pre'] = '<div class="comment-avatar center">';
$sc_style['COMMENT_AVATAR']['post'] = '</div>';
$sc_style['SUBJECT_INPUT']['pre'] = ""; //COMLAN_324
$sc_style['SUBJECT_INPUT']['post'] = "";
$sc_style['AUTHOR_INPUT']['pre'] = ""; // COMLAN_16
$sc_style['AUTHOR_INPUT']['post'] = "";
$sc_style['COMMENT_INPUT']['pre'] = "";// COMLAN_8
$sc_style['COMMENT_INPUT']['post'] = "";
$sc_style['COMMENT_BUTTON']['pre'] = "";
$sc_style['COMMENT_BUTTON']['post'] = "";
$sc_style['COMMENT_SHARE']['pre'] = "";
$sc_style['COMMENT_SHARE']['post'] = "";
$sc_style['COMMENT_RATE']['pre'] = '';
$sc_style['COMMENT_RATE']['post'] = '';
//$sc_style['USER_AVATAR']['pre'] = '<div class="comment-avatar center">';
//$sc_style['USER_AVATAR']['post'] = '</div>';
$sc_style['COMMENT_MODERATE']['pre'] = '<span class="comment-moderate">';
$sc_style['COMMENT_MODERATE']['post'] = '</span>';
$sc_style['MODERATE']['pre'] = '<div class="span12" style="padding:10px">';
$sc_style['MODERATE']['post'] = '</div>';
$COMMENT_WRAPPER['form'] = $COMMENT_WRAPPER['item']; // use the above wrappers for the 'form' as well.
// Templates
$COMMENT_TEMPLATE['form'] = "
{SETIMAGE: w=90&h=90&crop=1}
@@ -118,6 +50,7 @@ $COMMENT_TEMPLATE['form'] = "
$COMMENT_TEMPLATE['item'] = '
{SETIMAGE: w=90&h=90&crop=1}
<div class="media-object comment-box-left pull-left span1">
@@ -127,7 +60,7 @@ $COMMENT_TEMPLATE['item'] = '
<div class="row">
<div class="comment-box-username span2 col-xs-6 col-sm-6 col-md-6">{USERNAME}</div>
<div class="comment-box-date span2 col-xs-6 col-sm-6 col-md-6 text-right text-muted">{TIMEDATE=relative}</div>
<div class="comment-box-date span2 col-xs-6 col-sm-6 col-md-6 text-right text-muted">{COMMENT_TIMEDATE=relative}</div>
</div>
@@ -140,7 +73,7 @@ $COMMENT_TEMPLATE['item'] = '
</div>
<div class="row">
<div class="comment-status span2 col-sm-12 col-md-6">{COMMENT_STATUS}</div>
<div class="comment-moderate span6 col-sm-12 col-md-6 text-right">{COMMENT_RATE} {REPLY} {COMMENTEDIT} {COMMENT_MODERATE}</div>
<div class="comment-moderate span6 col-sm-12 col-md-6 text-right">{COMMENT_RATE} {COMMENT_REPLY} {COMMENT_EDIT} {COMMENT_MODERATE}</div>
</div>

View File

@@ -17,236 +17,10 @@
if (!defined('e107_INIT')) { exit; }
/*
global $user_shortcodes, $pref, $user;
//Set this to TRUE if you would like any extended user field that is empty to NOT be shown on the profile page
define("HIDE_EMPTY_FIELDS", FALSE);
/// --------------------- Start of Legacy Code --------------------------------------- //
$EXTENDED_CATEGORY_START = "<tr><td colspan='2' class='forumheader center'>{EXTENDED_NAME}</td></tr>";
$EXTENDED_CATEGORY_TABLE = "
<tr>
<td style='width:30%' class='forumheader3'>{EXTENDED_ICON}{EXTENDED_NAME}
</td>
<td style='width:70%' class='forumheader3'>{EXTENDED_VALUE}</td>
</tr>
";
$EXTENDED_CATEGORY_END = "";
// Preparing for huge markup/css changes
$USER_SHORT_TEMPLATE_START = "
<div class='content user-list'>
<div class='center'>".LAN_USER_56." {TOTAL_USERS}
<br />
<br />
{USER_FORM_START}
<div class='form-inline'>
".LAN_SHOW.": {USER_FORM_RECORDS} ".LAN_USER_57." {USER_FORM_ORDER}
{USER_FORM_SUBMIT}
</div>
{USER_FORM_END}
</div>
<br />
<br />
<table style='".USER_WIDTH."' class='table fborder e-list'>
<thead>
<tr>
<th class='fcaption' style='width:2%'>&nbsp;</th>
<th class='fcaption' style='width:20%'>".LAN_USER_58."</th>
<th class='fcaption' style='width:20%'>".LAN_USER_60."</th>
<th class='fcaption' style='width:20%'>".LAN_USER_59."</th>
</tr>
</thead>
<tbody>
{SETIMAGE: w=40}
";
$USER_SHORT_TEMPLATE_END = "
</tbody>
</table>
</div>
";
$USER_SHORT_TEMPLATE = "
<tr>
<td class='forumheader3' style='width:2%'>{USER_PICTURE}</td>
<td class='forumheader3' style='width:20%'>{USER_ID}: {USER_NAME_LINK}</td>
<td class='forumheader3' style='width:20%'>{USER_EMAIL}</td>
<td class='forumheader3' style='width:20%'>{USER_JOIN}</td>
</tr>
";
$sc_style['USER_SIGNATURE']['pre'] = "<tr><td colspan='2' class='forumheader3 left'>";
$sc_style['USER_SIGNATURE']['post'] = "</td></tr>";
$sc_style['USER_COMMENTS_LINK']['pre'] = "<tr><td colspan='2' class='forumheader3 left'>";
$sc_style['USER_COMMENTS_LINK']['post'] = "</td></tr>";
$sc_style['USER_FORUM_LINK']['pre'] = "<tr><td colspan='2' class='forumheader3 left'>";
$sc_style['USER_FORUM_LINK']['post'] = "</td></tr>";
$sc_style['USER_UPDATE_LINK']['pre'] = "<tr><td colspan='2' class='forumheader3 center'>";
$sc_style['USER_UPDATE_LINK']['post'] = "</td></tr>";
$sc_style['USER_RATING']['pre'] = "<tr><td colspan='2' class='forumheader3'><div class='f-left'>".LAN_RATING."</div><div class='f-right'>";
$sc_style['USER_RATING']['post'] = "</div></td></tr>";
$sc_style['USER_LOGINNAME']['pre'] = " : ";
$sc_style['USER_COMMENTPOSTS']['pre'] = "<tr><td style='width:30%' class='forumheader3'>".LAN_USER_68."</td><td style='width:70%' class='forumheader3'>";
$sc_style['USER_COMMENTPOSTS']['post'] = "";
$sc_style['USER_COMMENTPER']['pre'] = " ( ";
$sc_style['USER_COMMENTPER']['post'] = "% )</td></tr>";
if(isset($pref['photo_upload']) && $pref['photo_upload'])
{
$user_picture = "{USER_PICTURE}";
$colspan = " colspan='2'";
$main_colspan = "";
}
else
{
$user_picture = "";
$colspan = "";
$main_colspan = " colspan = '2' ";
}
$sc_style['USER_SENDPM']['pre'] = "<tr><td colspan='2' class='forumheader3'><div class='f-left'>";
$sc_style['USER_SENDPM']['post'] = "</div><div class='f-right'>".LAN_USER_62."</div></td></tr>";
// Determine which other bits are installed; let photo span those rows (can't do signature - will vary with user)
$span = 4;
if (e107::getParser()->parseTemplate("{USER_SENDPM}", FALSE, $user_shortcodes)) $span++;
$span = " rowspan='".$span."' ";
//$sc_style['USER_PICTURE']['pre']="<td {$span} class='forumheader3 center middle' style='width:20%'>";
//$sc_style['USER_PICTURE']['post']="</td>";
$USER_FULL_TEMPLATE = "{SETIMAGE: w=250}
<div class='content user'>
<table style='".USER_WIDTH."' class='table fborder'>
<tr>
<td colspan='2' class='fcaption center'>".LAN_USER_58." {USER_ID} : {USER_NAME}{USER_LOGINNAME}</td>
</tr>
<tr>
<td {$span} class='forumheader3 center middle' style='width:20%'>{USER_PICTURE}</td>
<td {$main_colspan} class='forumheader3'>
<div class='f-left'>{USER_ICON=realname} ".LAN_USER_63."</div>
<div class='f-right right'>{USER_REALNAME}</div>
</td>
</tr>
<tr>
<td {$main_colspan} class='forumheader3'>
<div class='f-left'>{USER_ICON=email} ".LAN_USER_60."</div>
<div class='f-right right'>{USER_EMAIL}</div>
</td>
</tr>
<tr>
<td {$main_colspan} class='forumheader3'>
<div class='f-left'>{USER_ICON=level} ".LAN_USER_54.":</div>
<div class='f-right right'>{USER_LEVEL}</div>
</td>
</tr>
<tr>
<td {$main_colspan} class='forumheader3'>
<div class='f-left'>{USER_ICON=lastvisit} ".LAN_USER_65.":&nbsp;&nbsp;</div>
<div class='f-right right'>{USER_LASTVISIT}<br />{USER_LASTVISIT_LAPSE}</div>
</td>
</tr>
{USER_SENDPM}
{USER_RATING}
{USER_SIGNATURE}
{USER_EXTENDED_ALL}
<tr>
<td colspan='2' class='forumheader'>".LAN_USER_64."</td>
</tr>
<tr>
<td style='width:30%' class='forumheader3'>".LAN_USER_59."</td>
<td style='width:70%' class='forumheader3'>{USER_JOIN}<br />{USER_DAYSREGGED}</td>
</tr>
<tr>
<td style='width:30%' class='forumheader3'>".LAN_USER_66."</td>
<td style='width:70%' class='forumheader3'>{USER_VISITS}</td>
</tr>
{USER_ADDONS}
{USER_COMMENTPOSTS}
{USER_COMMENTPER}
{USER_UPDATE_LINK}
</table>
<ul class='pager user-view-nextprev'>
<li class='previous'>
{USER_JUMP_LINK=prev}
</li>
<li>
<!-- Back to List? -->
</li>
<li class='next'>
{USER_JUMP_LINK=next}
</li>
</ul>
</div>
{PROFILE_COMMENTS}
{PROFILE_COMMENT_FORM}
";
$USER_EMBED_USERPROFILE_TEMPLATE = "
<tr>
<td class='forumheader3'>{USER_ADDON_LABEL}</td>
<td class='forumheader3'>{USER_ADDON_TEXT}</td>
</tr>";
// Convert Shortcode Wrappers from v1.x to v2.x standards.
$USER_TEMPLATE['view'] = $USER_FULL_TEMPLATE;
$USER_WRAPPER['view']['USER_COMMENTS_LINK'] = $sc_style['USER_COMMENTS_LINK']['pre']."{---}".$sc_style['USER_COMMENTS_LINK']['post'];
$USER_WRAPPER['view']['USER_SIGNATURE'] = $sc_style['USER_SIGNATURE']['pre']."{---}".$sc_style['USER_SIGNATURE']['post'];
$USER_WRAPPER['view']['USER_UPDATE_LINK'] = $sc_style['USER_UPDATE_LINK']['pre']."{---}".$sc_style['USER_UPDATE_LINK']['post'];
$USER_WRAPPER['view']['USER_FORUM_LINK'] = $sc_style['USER_FORUM_LINK']['pre']."{---}".$sc_style['USER_FORUM_LINK']['post'];
$USER_WRAPPER['view']['USER_RATING'] = $sc_style['USER_RATING']['pre']."{---}".$sc_style['USER_RATING']['post'];
$USER_WRAPPER['view']['USER_SENDPM'] = $sc_style['USER_SENDPM']['pre']."{---}".$sc_style['USER_SENDPM']['post'];
$USER_WRAPPER['view']['USER_LOGINNAME'] = $sc_style['USER_LOGINNAME']['pre']."{---}";
$USER_WRAPPER['view']['USER_COMMENTPOSTS'] = $sc_style['USER_COMMENTPOSTS']['pre']."{---}";
$USER_WRAPPER['view']['USER_COMMENTPER'] = $sc_style['USER_COMMENTPER']['pre']."{---}".$sc_style['USER_COMMENTPER']['post'];
$USER_TEMPLATE['addon'] = $USER_EMBED_USERPROFILE_TEMPLATE;
$USER_TEMPLATE['extended']['start'] = $EXTENDED_CATEGORY_START;
$USER_TEMPLATE['extended']['item'] = $EXTENDED_CATEGORY_TABLE ;
$USER_TEMPLATE['extended']['start'] = $EXTENDED_CATEGORY_END;
$USER_TEMPLATE['list']['start'] = $USER_SHORT_TEMPLATE_START;
$USER_TEMPLATE['list']['item'] = $USER_SHORT_TEMPLATE;
$USER_TEMPLATE['list']['end'] = $USER_SHORT_TEMPLATE_END;
*/
// ------------ End of Legacy Code ------------------------------- //
// v2.x Standards.
$USER_TEMPLATE = array(); // reset the legacy template above.
$USER_WRAPPER = array(); // reset all the legacy wrappers above.
$USER_TEMPLATE = array();
$USER_WRAPPER = array();
$USER_TEMPLATE['addon'] = '

View File

@@ -63,7 +63,8 @@ class comment
if (empty($COMMENTSTYLE) || !deftrue('THEME_LEGACY')) // v2.x
{
require(e107::coreTemplatePath('comment')); // using require_once() could cause an empty template if the template is already loaded, for example, by the comment-menu al
//require(e107::coreTemplatePath('comment')); // using require_once() could cause an empty template if the template is already loaded, for example, by the comment-menu al
$COMMENT_TEMPLATE = e107::getCoreTemplate('comment');
}
elseif(!vartrue($COMMENT_TEMPLATE)) // BC template.
{
@@ -280,12 +281,13 @@ class comment
'eaction' => varset($eaction),
'rate' => $rating
);
e107::getScBatch('comment')->setVars($data);
e107::getScBatch('comment')->setMode('edit');
$sc = e107::getScBatch('comment');
$sc->setVars($data);
$sc->setMode('edit');
$sc->wrapper('comment/form');
$text .= $tp->parseTemplate($this->template['form'], TRUE, e107::getScBatch('comment'));
$text .= $tp->parseTemplate($this->template['form'], true, $sc);
$text .= "\n<div>\n"; // All Hidden Elements.
@@ -449,8 +451,10 @@ class comment
}
$row['rating_enabled'] = true; // Toggles rating shortcode. //TODO add pref
e107::getScBatch('comment')->setVars($row);
$comment_shortcodes = e107::getScBatch('comment');
$comment_shortcodes->setVars($row);
$comment_shortcodes->wrapper('comment/item');
$COMMENT_TEMPLATE = $this->template;
@@ -466,7 +470,7 @@ class comment
{
$COMMENT_TEMPLATE['item'] = str_replace("row", "row-fluid", $COMMENT_TEMPLATE['item']);
}
e107::getParser()->setThumbSize(100,100); // BC FIx. Set a default image size, in case the template doesn't have one.
@@ -529,7 +533,7 @@ class comment
// $RATING = ($addrating == TRUE && $comrow['user_id'] ? $rater->composerating($thistable, $thisid, FALSE, $comrow['user_id']) : "");
$comment_shortcodes = e107::getScBatch('comment');
$text = $tp->parseTemplate($renderstyle, TRUE, $comment_shortcodes);
@@ -579,7 +583,7 @@ class comment
$this->totalComments = $this->totalComments + $sub_total;
} // End (nested comment handling)
return $text;
}