1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

Forum code formatting and cleanup.

This commit is contained in:
Cameron
2016-05-31 13:22:52 -07:00
parent d2d1478f7b
commit 347a17823e

View File

@@ -28,34 +28,42 @@ class forum_shortcodes extends e_shortcode
{ {
return LAN_FORUM_0002; return LAN_FORUM_0002;
} }
function sc_replytitle() function sc_replytitle()
{ {
return LAN_FORUM_0003; return LAN_FORUM_0003;
} }
function sc_lastpostitle() function sc_lastpostitle()
{ {
return LAN_FORUM_0004; return LAN_FORUM_0004;
} }
function sc_infotitle() function sc_infotitle()
{ {
return LAN_FORUM_0009; return LAN_FORUM_0009;
} }
function sc_newthreadtitle() function sc_newthreadtitle()
{ {
return LAN_FORUM_0075; return LAN_FORUM_0075;
} }
function sc_postedtitle() function sc_postedtitle()
{ {
return LAN_FORUM_0074; return LAN_FORUM_0074;
} }
function sc_tracktitle() function sc_tracktitle()
{ {
return LAN_FORUM_0073; return LAN_FORUM_0073;
} }
function sc_statlink() function sc_statlink()
{ {
return "<a href='".e_PLUGIN."forum/forum_stats.php'>".LAN_FORUM_0017."</a>\n"; return "<a href='".e_PLUGIN."forum/forum_stats.php'>".LAN_FORUM_0017."</a>\n";
} }
function sc_iconkey() function sc_iconkey()
{ {
return " return "
@@ -74,6 +82,7 @@ class forum_shortcodes extends e_shortcode
{ {
return IMAGE_e; return IMAGE_e;
} }
function sc_newimage() function sc_newimage()
{ {
return IMAGE_new_small; return IMAGE_new_small;
@@ -120,6 +129,7 @@ if(!empty($trackPref))
{ {
$uInfo[2] = "<a href='".e107::url('forum','track')."'>".LAN_FORUM_0030."</a>"; $uInfo[2] = "<a href='".e107::url('forum','track')."'>".LAN_FORUM_0030."</a>";
} }
return implode(" | ",$uInfo); return implode(" | ",$uInfo);
} }
@@ -142,6 +152,7 @@ if(!empty($trackPref))
$c ++; $c ++;
$text .= "<a href='".e_HTTP."user.php ?id.$oid'>$oname</a>".($c == MEMBERS_ONLINE ? "." :", "); $text .= "<a href='".e_HTTP."user.php ?id.$oid'>$oname</a>".($c == MEMBERS_ONLINE ? "." :", ");
} }
} }
// String candidate for USERLIST wrapper // String candidate for USERLIST wrapper
$text .= "<br /><a rel='external' href='".e_BASE."online.php'>".LAN_FORUM_0037."</a> ".LAN_FORUM_0038; $text .= "<br /><a rel='external' href='".e_BASE."online.php'>".LAN_FORUM_0037."</a> ".LAN_FORUM_0038;
@@ -151,7 +162,7 @@ if(!empty($trackPref))
function sc_search() function sc_search()
{ {
// $tp = e107::getParser();
if(!$srchIcon = e107::getParser()->toGlyph('fa-search')) if(!$srchIcon = e107::getParser()->toGlyph('fa-search'))
{ {
$srchIcon = LAN_SEARCH; $srchIcon = LAN_SEARCH;
@@ -296,9 +307,9 @@ if(!defined('e_TRACKING_DISABLED'))
return str_replace("[x]", ($total_topics+$total_replies), LAN_FORUM_0031)." ($total_topics ".($total_topics == 1 ? LAN_FORUM_0032 : LAN_FORUM_0033).", $total_replies ".($total_replies == 1 ? LAN_FORUM_0034 : LAN_FORUM_0035).") return str_replace("[x]", ($total_topics+$total_replies), LAN_FORUM_0031)." ($total_topics ".($total_topics == 1 ? LAN_FORUM_0032 : LAN_FORUM_0033).", $total_replies ".($total_replies == 1 ? LAN_FORUM_0034 : LAN_FORUM_0035).")
".(!defined("e_TRACKING_DISABLED") ? "" : "<br />".$users." ".($users == 1 ? LAN_FORUM_0059 : LAN_FORUM_0060)." (".$member_users." ".($member_users == 1 ? LAN_FORUM_0061 : LAN_FORUM_0062).", ".$guest_users." ".($guest_users == 1 ? LAN_FORUM_0063 : LAN_FORUM_0064).")<br />".LAN_FORUM_0066." ".$total_members."<br />".LAN_FORUM_0065." <a href='".e_HTTP."user.php ?id.".$nuser_id."'>".$nuser_name."</a>.\n"); // FIXME cannot find other references to e_TRACKING_DISABLED, use pref? ".(!defined("e_TRACKING_DISABLED") ? "" : "<br />".$users." ".($users == 1 ? LAN_FORUM_0059 : LAN_FORUM_0060)." (".$member_users." ".($member_users == 1 ? LAN_FORUM_0061 : LAN_FORUM_0062).", ".$guest_users." ".($guest_users == 1 ? LAN_FORUM_0063 : LAN_FORUM_0064).")<br />".LAN_FORUM_0066." ".$total_members."<br />".LAN_FORUM_0065." <a href='".e_HTTP."user.php ?id.".$nuser_id."'>".$nuser_name."</a>.\n"); // FIXME cannot find other references to e_TRACKING_DISABLED, use pref?
} }
// END OF $FVARS
// START OF $PVARS
function sc_parentstatus() function sc_parentstatus()
{ {
//---- return $this->parentstatus; //---- return $this->parentstatus;
@@ -309,18 +320,15 @@ return str_replace("[x]", ($total_topics+$total_replies), LAN_FORUM_0031)." ($to
} }
return vartrue($status); return vartrue($status);
} }
function sc_parentname() function sc_parentname()
{ {
//---- return $this->parentname;
// return $this->fparent['forum_name'];
return $this->var['forum_name']; return $this->var['forum_name'];
} }
// END OF $PVARS
// Function to show the retrieval of parent ID, not really needed by core template // Function to show the retrieval of parent ID, not really needed by core template
function sc_parentid() function sc_parentid()
{ {
//---- return $this->parentname;
// return $this->fparent['forum_id'];
return $this->var['forum_id']; return $this->var['forum_id'];
} }
@@ -329,7 +337,7 @@ return str_replace("[x]", ($total_topics+$total_replies), LAN_FORUM_0031)." ($to
function sc_newflag() function sc_newflag()
{ {
global $newflag_list; global $newflag_list;
// $e107 = e107::getInstance();
if(USER && is_array($newflag_list) && in_array($this->var['forum_id'], $newflag_list)) if(USER && is_array($newflag_list) && in_array($this->var['forum_id'], $newflag_list))
{ {
@@ -340,11 +348,11 @@ return str_replace("[x]", ($total_topics+$total_replies), LAN_FORUM_0031)." ($to
{ {
return IMAGE_noreplies; return IMAGE_noreplies;
} }
//---- else
//---- {
return IMAGE_nonew; return IMAGE_nonew;
//---- }
} }
function sc_forumname() function sc_forumname()
{ {
// global $f; // global $f;
@@ -357,7 +365,9 @@ return str_replace("[x]", ($total_topics+$total_replies), LAN_FORUM_0031)." ($to
$url = e107::url('forum', 'forum', $this->var); $url = e107::url('forum', 'forum', $this->var);
return "<a href='".$url."'>{$this->var['forum_name']}</a>"; return "<a href='".$url."'>{$this->var['forum_name']}</a>";
} }
function sc_forumdescription() function sc_forumdescription()
{ {
// global $f, $restricted_string; // global $f, $restricted_string;
@@ -366,32 +376,38 @@ return str_replace("[x]", ($total_topics+$total_replies), LAN_FORUM_0031)." ($to
$this->var['forum_description'] = e107::getParser()->toHTML($this->var['forum_description'], true, 'no_hook'); $this->var['forum_description'] = e107::getParser()->toHTML($this->var['forum_description'], true, 'no_hook');
return $this->var['forum_description'].($restricted_string ? "<br /><span class='smalltext'><i>$restricted_string</i></span>" : ""); return $this->var['forum_description'].($restricted_string ? "<br /><span class='smalltext'><i>$restricted_string</i></span>" : "");
} }
function sc_threads() function sc_threads()
{ {
return $this->var['forum_threads']; return $this->var['forum_threads'];
} }
function sc_replies() function sc_replies()
{ {
return $this->var['forum_replies']; return $this->var['forum_replies'];
} }
function sc_threadsx() function sc_threadsx()
{ {
// global $f; // global $f;
// return "<span class='badge ".(($f['forum_threads']) ? "badge-info" : "")."'>".$f['forum_threads']."</span>"; // return "<span class='badge ".(($f['forum_threads']) ? "badge-info" : "")."'>".$f['forum_threads']."</span>";
return "<span class='badge ".(($this->var['forum_threads']) ? "badge-info" : "")."'>".$this->var['forum_threads']."</span>"; return "<span class='badge ".(($this->var['forum_threads']) ? "badge-info" : "")."'>".$this->var['forum_threads']."</span>";
} }
function sc_repliesx() function sc_repliesx()
{ {
// global $f; // global $f;
// return "<span class='badge ".(($f['forum_replies']) ? "badge-info" : "")."'>".$f['forum_replies']."</span>"; // return "<span class='badge ".(($f['forum_replies']) ? "badge-info" : "")."'>".$f['forum_replies']."</span>";
return "<span class='badge ".(($this->var['forum_replies']) ? "badge-info" : "")."'>".$this->var['forum_replies']."</span>"; return "<span class='badge ".(($this->var['forum_replies']) ? "badge-info" : "")."'>".$this->var['forum_replies']."</span>";
} }
function sc_forumsubforums() function sc_forumsubforums()
{ {
// VAR_DUMP ($this->ret); // VAR_DUMP ($this->ret);
// return ($this->ret)?"<br /><div class='smalltext'>".LAN_FORUM_0069.": {$this->ret['text']}</div>":""; // return ($this->ret)?"<br /><div class='smalltext'>".LAN_FORUM_0069.": {$this->ret['text']}</div>":"";
return ($this->var['text'])?"<br /><div class='smalltext'>".LAN_FORUM_0069.": {$this->var['text']}</div>":""; return ($this->var['text'])?"<br /><div class='smalltext'>".LAN_FORUM_0069.": {$this->var['text']}</div>":"";
} }
function sc_lastpostuser() function sc_lastpostuser()
{ {
// global $f; // global $f;
@@ -411,7 +427,7 @@ return str_replace("[x]", ($total_topics+$total_replies), LAN_FORUM_0031)." ($to
{ {
// $lastpost_name = "<a href='".$e107->url->create('user/profile/view', array('name' => $f['user_name'], 'id' => $f['forum_lastpost_user']))."'>{$f['user_name']}</a>"; // $lastpost_name = "<a href='".$e107->url->create('user/profile/view', array('name' => $f['user_name'], 'id' => $f['forum_lastpost_user']))."'>{$f['user_name']}</a>";
$lastpost_name = "<a href='".e107::getInstance()->url->create('user/profile/view', array('name' => $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['user_name']}</a>"; $lastpost_name = "<a href='".e107::getUrl()->create('user/profile/view', array('name' => $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['user_name']}</a>";
} }
//---- else //---- else
//---- { //---- {
@@ -482,9 +498,8 @@ $gen = new convert;
} }
function sc_lastpost() function sc_lastpost()
{ {
// global $f;
$e107 = e107::getInstance(); $e107 = e107::getInstance();
// $tp = e107::getParser();
$gen = new convert; $gen = new convert;
// if ($f['forum_lastpost_info']) // if ($f['forum_lastpost_info'])
@@ -496,11 +511,11 @@ $gen = new convert;
// $lastpost_name = e107::getParser()->toHTML($f['forum_lastpost_user_anon']); // $lastpost_name = e107::getParser()->toHTML($f['forum_lastpost_user_anon']);
// if ($f['user_name']) // if ($f['user_name'])
$lastpost_name = e107::getParser()->toHTML($this->var['forum_lastpost_user_anon']); $lastpost_name = e107::getParser()->toHTML($this->var['forum_lastpost_user_anon']);
if ($this->var['user_name']) if ($this->var['user_name'])
{ {
// $lastpost_name = "<a href='".$e107->url->create('user/profile/view', array('name' => $f['user_name'], 'id' => $f['forum_lastpost_user']))."'>{$f['user_name']}</a>"; // $lastpost_name = "<a href='".$e107->url->create('user/profile/view', array('name' => $f['user_name'], 'id' => $f['forum_lastpost_user']))."'>{$f['user_name']}</a>";
$lastpost_name = "<a href='".$e107->url->create('user/profile/view', array('name' => $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['user_name']}</a>"; $lastpost_name = "<a href='".e107::getUrl()->create('user/profile/view', array('name' => $this->var['user_name'], 'id' => $this->var['forum_lastpost_user']))."'>{$this->var['user_name']}</a>";
} }
//---- else //---- else
//---- { //---- {
@@ -526,9 +541,8 @@ $gen = new convert;
return '-'; return '-';
//---- } //---- }
} }
// END OF parse_forum function $FVARS
// START OF $NVARS
function sc_startertitle() function sc_startertitle()
{ {
// global $thread; // global $thread;
@@ -548,9 +562,10 @@ $gen = new convert;
//---- { //---- {
// $e107 = e107::getInstance(); // $e107 = e107::getInstance();
// return "<a href='".$e107->url->create('user/profile/view', array('id' => $thread['thread_lastuser'], 'name' => $sc->author_name))."'>{$sc->author_name}</a><br />".$sc->datestamp; // return "<a href='".$e107->url->create('user/profile/view', array('id' => $thread['thread_lastuser'], 'name' => $sc->author_name))."'>{$sc->author_name}</a><br />".$sc->datestamp;
return "<a href='".e107::getInstance()->url->create('user/profile/view', array('id' => $this->var['thread_lastuser'], 'name' => $author_name))."'>{$author_name}</a><br />".$datestamp; return "<a href='".e107::getUrl()->create('user/profile/view', array('id' => $this->var['thread_lastuser'], 'name' => $author_name))."'>{$author_name}</a><br />".$datestamp;
//---- } //---- }
} }
function sc_newspostname() function sc_newspostname()
{ {
// global $thread; // global $thread;
@@ -559,7 +574,7 @@ $gen = new convert;
// return empty($thread)?LAN_FORUM_0029:"<a href='".$e107->url->create('forum/thread/last', $thread)."'>".$tp->toHTML($thread['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>'; // return empty($thread)?LAN_FORUM_0029:"<a href='".$e107->url->create('forum/thread/last', $thread)."'>".$tp->toHTML($thread['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
// Only $this->var???' // Only $this->var???'
return empty($this->var)?LAN_FORUM_0029:"<a href='".e107::getInstance()->url->create('forum/thread/last', $this->var)."'>".e107::getParser()->toHTML($this->var['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>'; return empty($this->var)?LAN_FORUM_0029:"<a href='".e107::getUrl()->create('forum/thread/last', $this->var)."'>".e107::getParser()->toHTML($this->var['thread_name'], TRUE, 'no_make_clickable, no_hook').'</a>';
} }
// END OF $NVARS // END OF $NVARS
@@ -572,4 +587,3 @@ return $frm->breadcrumb($breadarray);
} }
} }
?>