diff --git a/e107_core/shortcodes/batch/comment_shortcodes.php b/e107_core/shortcodes/batch/comment_shortcodes.php index 94f29bca3..50fdcc83e 100644 --- a/e107_core/shortcodes/batch/comment_shortcodes.php +++ b/e107_core/shortcodes/batch/comment_shortcodes.php @@ -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) { diff --git a/e107_core/templates/comment_template.php b/e107_core/templates/comment_template.php index 12cca6e4d..0b7b8d5e8 100644 --- a/e107_core/templates/comment_template.php +++ b/e107_core/templates/comment_template.php @@ -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'] = ""; -$sc_style['TIMEDATE']['post'] = ""; - -$sc_style['AVATAR']['pre'] = ""; -$sc_style['AVATAR']['post'] = ""; - -$sc_style['COMMENTS']['pre'] = ""; -$sc_style['COMMENTS']['post'] = "
"; - -$sc_style['JOINED']['pre'] = ""; -$sc_style['JOINED']['post'] = "
"; - -$sc_style['COMMENT']['pre'] = ""; -$sc_style['COMMENT']['post'] = "
"; - -$sc_style['RATING']['pre'] = ""; -$sc_style['RATING']['post'] = "
"; - -$sc_style['IPADDRESS']['pre'] = ""; -$sc_style['IPADDRESS']['post'] = "
"; - -$sc_style['LEVEL']['pre'] = ""; -$sc_style['LEVEL']['post'] = "
"; - -$sc_style['LOCATION']['pre'] = ""; -$sc_style['LOCATION']['post'] = "
"; - -$sc_style['SIGNATURE']['pre'] = ""; -$sc_style['SIGNATURE']['post'] = "
"; +// Shortcode wrappers. +$COMMENT_WRAPPER['item']['COMENT_TIMEDATE'] = '{---}'; +$COMMENT_WRAPPER['item']['COMMENT_EDIT'] = '{---}'; +$COMMENT_WRAPPER['item']['COMENT_REPLY'] = '{---}'; +$COMMENT_WRAPPER['item']['COMMENT_AVATAR'] = '
{---}
'; +$COMMENT_WRAPPER['item']['COMMENT_MODERATE'] = '{---}'; -// from e107.org -$sc_style['REPLY']['pre'] = ""; -$sc_style['REPLY']['post'] = ""; - -$sc_style['COMMENTEDIT']['pre'] = ''; -$sc_style['COMMENTEDIT']['post'] = ''; - -$sc_style['COMMENT_AVATAR']['pre'] = '
'; -$sc_style['COMMENT_AVATAR']['post'] = '
'; - -$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'] = '
'; -//$sc_style['USER_AVATAR']['post'] = '
'; - -$sc_style['COMMENT_MODERATE']['pre'] = ''; -$sc_style['COMMENT_MODERATE']['post'] = ''; - -$sc_style['MODERATE']['pre'] = '
'; -$sc_style['MODERATE']['post'] = '
'; +$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}
@@ -127,7 +60,7 @@ $COMMENT_TEMPLATE['item'] = '
{USERNAME}
-
{TIMEDATE=relative}
+
{COMMENT_TIMEDATE=relative}
@@ -140,7 +73,7 @@ $COMMENT_TEMPLATE['item'] = '
{COMMENT_STATUS}
-
{COMMENT_RATE} {REPLY} {COMMENTEDIT} {COMMENT_MODERATE}
+
{COMMENT_RATE} {COMMENT_REPLY} {COMMENT_EDIT} {COMMENT_MODERATE}
diff --git a/e107_core/templates/user_template.php b/e107_core/templates/user_template.php index 7f1727640..38dbfae1b 100644 --- a/e107_core/templates/user_template.php +++ b/e107_core/templates/user_template.php @@ -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 = "{EXTENDED_NAME}"; - -$EXTENDED_CATEGORY_TABLE = " - - {EXTENDED_ICON}{EXTENDED_NAME} - - {EXTENDED_VALUE} - - "; - -$EXTENDED_CATEGORY_END = ""; - - -// Preparing for huge markup/css changes - -$USER_SHORT_TEMPLATE_START = " -
-
".LAN_USER_56." {TOTAL_USERS} -
-
- {USER_FORM_START} -
- ".LAN_SHOW.": {USER_FORM_RECORDS} ".LAN_USER_57." {USER_FORM_ORDER} - {USER_FORM_SUBMIT} -
- {USER_FORM_END} -
-
-
- - - - - - - - - - - {SETIMAGE: w=40} -"; -$USER_SHORT_TEMPLATE_END = " - -
 ".LAN_USER_58."".LAN_USER_60."".LAN_USER_59."
-
-"; - -$USER_SHORT_TEMPLATE = " - - {USER_PICTURE} - {USER_ID}: {USER_NAME_LINK} - {USER_EMAIL} - {USER_JOIN} - -"; - -$sc_style['USER_SIGNATURE']['pre'] = ""; -$sc_style['USER_SIGNATURE']['post'] = ""; - -$sc_style['USER_COMMENTS_LINK']['pre'] = ""; -$sc_style['USER_COMMENTS_LINK']['post'] = ""; - -$sc_style['USER_FORUM_LINK']['pre'] = ""; -$sc_style['USER_FORUM_LINK']['post'] = ""; - -$sc_style['USER_UPDATE_LINK']['pre'] = ""; -$sc_style['USER_UPDATE_LINK']['post'] = ""; - -$sc_style['USER_RATING']['pre'] = "
".LAN_RATING."
"; -$sc_style['USER_RATING']['post'] = "
"; - -$sc_style['USER_LOGINNAME']['pre'] = " : "; - -$sc_style['USER_COMMENTPOSTS']['pre'] = "".LAN_USER_68.""; -$sc_style['USER_COMMENTPOSTS']['post'] = ""; - -$sc_style['USER_COMMENTPER']['pre'] = " ( "; -$sc_style['USER_COMMENTPER']['post'] = "% )"; - - -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'] = "
"; -$sc_style['USER_SENDPM']['post'] = "
".LAN_USER_62."
"; - -// 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']=""; -//$sc_style['USER_PICTURE']['post']=""; - - - - - -$USER_FULL_TEMPLATE = "{SETIMAGE: w=250} -
- - - - - - - - - - - - - - - - - - - - -{USER_SENDPM} -{USER_RATING} -{USER_SIGNATURE} -{USER_EXTENDED_ALL} - - - - - - - - - - - - - - -{USER_ADDONS} - -{USER_COMMENTPOSTS} -{USER_COMMENTPER} - - -{USER_UPDATE_LINK} -
".LAN_USER_58." {USER_ID} : {USER_NAME}{USER_LOGINNAME}
{USER_PICTURE} -
{USER_ICON=realname} ".LAN_USER_63."
-
{USER_REALNAME}
-
-
{USER_ICON=email} ".LAN_USER_60."
-
{USER_EMAIL}
-
-
{USER_ICON=level} ".LAN_USER_54.":
-
{USER_LEVEL}
-
-
{USER_ICON=lastvisit} ".LAN_USER_65.":  
-
{USER_LASTVISIT}
{USER_LASTVISIT_LAPSE}
-
".LAN_USER_64."
".LAN_USER_59."{USER_JOIN}
{USER_DAYSREGGED}
".LAN_USER_66."{USER_VISITS}
- -
-{PROFILE_COMMENTS} -{PROFILE_COMMENT_FORM} -"; - -$USER_EMBED_USERPROFILE_TEMPLATE = " - - {USER_ADDON_LABEL} - {USER_ADDON_TEXT} -"; - - -// 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'] = ' diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php index 525ec08e0..41ab2c203 100644 --- a/e107_handlers/comment_class.php +++ b/e107_handlers/comment_class.php @@ -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
\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; }