1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 05:37:32 +02:00

Merge pull request #1272 from lonalore/master

Issue #6 Replaced hardcoded "ago" string with constant.
This commit is contained in:
Cameron
2015-12-12 14:01:56 -08:00
5 changed files with 204 additions and 170 deletions

View File

@@ -21,17 +21,26 @@ class comment_shortcodes extends e_shortcode
{
var $var;
function sc_subject_input($parm='')
function sc_subject_input($parm = '')
{
$tp = e107::getParser();
$pref = e107::getPref();
$form = e107::getForm();
if(vartrue($pref['nested_comments']))
{
return "<input class='tbox comment subject-input' type='text' placeholder='".COMLAN_324."' name='subject' size='61' value='".$tp->toForm($this->var['subject'])."' maxlength='100' />";
}
$options = array(
'class' => 'comment subject-input form-control',
'placeholder' => COMLAN_324,
'size' => 61,
);
return;
$text = '<div class="form-group">';
$text .= $form->text('subject', $tp->toForm($this->var['subject']), 100, $options);
$text .= '</div>';
return $text;
}
}
@@ -44,7 +53,7 @@ class comment_shortcodes extends e_shortcode
if (vartrue($pref['nested_comments']))
{
$SUBJECT = $NEWIMAGE." ".(empty($this->var['comment_subject']) ? $subject : $tp->toHTML($this->var['comment_subject'], TRUE));
$SUBJECT = $NEWIMAGE." ".(empty($this->var['comment_subject']) ? $SUBJECT : $tp->toHTML($this->var['comment_subject'], TRUE));
}
else
{
@@ -101,8 +110,7 @@ class comment_shortcodes extends e_shortcode
}
function sc_comment_avatar($parm='')
function sc_comment_avatar($parm = '')
{
$tp = e107::getParser();
@@ -113,21 +121,18 @@ class comment_shortcodes extends e_shortcode
$text = $tp->toAvatar($this->var);
$text .= "<div class='field-help' style='display:none;'>
<div class='left'>";
$text .= "<h2>".$this->sc_username()."</h2>";
$text .= '<div class="field-help" style="display:none;">';
$text .= '<div class="left">';
$text .= '<h2>' . $this->sc_username() . '</h2>';
// $text .= e107::getDate()-> // convert($this->var['user_lastvisit'],'short');
$text .= $this->sc_joined()."<br />".$this->sc_comments()."<br />".$this->sc_rating().$this->sc_location;
$text .= $this->sc_joined() . '<br />' . $this->sc_comments() . '<br />' . $this->sc_rating() . $this->sc_location;
$text .= '</div>';
$text .= '</div>';
$text .= "
</div>
</div>";
return $text;
}
function sc_avatar($parm='')
{
return $this->sc_comment_avatar($parm);
@@ -178,6 +183,7 @@ class comment_shortcodes extends e_shortcode
return 'comment-'.intval($this->var['comment_id']);
}
function sc_comment_moderate($parm='')
{
if(!getperms('0') && !getperms("B"))
@@ -190,7 +196,7 @@ class comment_shortcodes extends e_shortcode
if($this->var['comment_blocked'] == 2) // pending approval.
{
$text .= "<a href='#' data-target='".e_HTTP."comment.php' id='e-comment-approve-".$this->var['comment_id']."' class='e-comment-approve btn btn-default btn-mini btn-xs'>Approve</a> ";
$text .= "<a href='#' data-target='" . e_HTTP . "comment.php' id='e-comment-approve-" . $this->var['comment_id'] . "' class='e-comment-approve btn btn-default btn-mini btn-xs'>" . COMLAN_404 . "</a> ";
}
return $text;
/*
@@ -206,32 +212,53 @@ class comment_shortcodes extends e_shortcode
}
function sc_comment_button($parm='')
function sc_comment_button($parm = '')
{
$pref = e107::getPref('comments_sort');
$form = e107::getForm();
if($this->mode == 'edit')
{
$value = (varset($this->var['eaction']) == "edit" ? COMLAN_320 : COMLAN_9);
$pid = ($this->var['action'] == 'reply') ? $this->var['pid'] : 0;
return "<input data-pid='{$pid}' data-sort='{$pref}' data-target='".e_HTTP."comment.php' class='button btn btn-primary e-comment-submit' type='submit' name='".$this->var['action']."submit' value='".$value."' />";
}
$options = array(
'class' => 'button btn btn-primary e-comment-submit pull-right',
'data-pid' => $pid,
'data-sort' => $pref,
'data-target' => e_HTTP . 'comment.php',
);
return $form->submit($this->var['action'] . 'submit', $value, $options);
}
}
function sc_author_input($parm='')
function sc_author_input($parm = '')
{
if($this->mode == 'edit')
{
if (ANON == TRUE && USER == FALSE) // (anonymous comments - if allowed)
if(ANON == true && USER == false) // (anonymous comments - if allowed)
{
$disabled = ($_SESSION['comment_author_name']) ? "disabled='disabled'" : ""; // prevent anon users changing names on the same session.
$form = e107::getForm();
return "<input {$disabled} class='tbox comment author' type='text' placeholder=\"".COMLAN_16."\" name='author_name' size='61' value='{$_SESSION['comment_author_name']}' maxlength='100' />";
$options = array(
'class' => 'comment author form-control',
'placeholder' => COMLAN_16,
'size' => 61,
);
// Prevent anon users changing names on the same session.
if(vartrue($_SESSION['comment_author_name']))
{
$options['disabled'] = 'disabled';
}
$text = '<div class="form-group">';
$text .= $form->text('author_name', $_SESSION['comment_author_name'], 100, $options);
$text .= '</div>';
return $text;
}
}
}
@@ -255,23 +282,30 @@ class comment_shortcodes extends e_shortcode
}
function sc_comment_input($parm='')
function sc_comment_input($parm = '')
{
$options = array(
'class' => 'tbox input-xxlarge comment-input',
'placeholder' => "Leave a message..." // TODO Lan
'class' => 'comment-input form-control',
'placeholder' => COMLAN_403,
);
$text = '<div class="form-group">';
if($parm == 'bbcode')
{
return e107::getForm()->bbarea('comment',$this->var['comval'],'comment','comment-'.$this->var['itemid'],'large',$options);
$text .= e107::getForm()->bbarea('comment', $this->var['comval'], 'comment', 'comment-' . $this->var['itemid'], 'large', $options);
}
else
{
return e107::getForm()->textarea('comment',$this->var['comval'], 3, 80,$options);
$text .= e107::getForm()->textarea('comment', $this->var['comval'], 3, 80, $options);
}
$text .= '</div>';
return $text;
}
/*
function sc_user_avatar($parm='')
{
@@ -281,6 +315,7 @@ class comment_shortcodes extends e_shortcode
}
*/
function sc_comment($parm='')
{
// global $COMMENT, $pref;
@@ -293,12 +328,13 @@ class comment_shortcodes extends e_shortcode
return $tp->toHTML($this->var['comment_comment'], TRUE, FALSE, $this->var['user_id']);
}
function sc_comment_status($parm='')
{
switch ($this->var['comment_blocked'])
{
case 2:
$text = "Pending Approval"; // TODO LAN
$text = COMLAN_331;
break;
case 1:
@@ -361,7 +397,7 @@ class comment_shortcodes extends e_shortcode
global $LEVEL, $pref;
//FIXME - new level handler, currently commented to avoid parse errors
//$ldata = get_level($this->var['user_id'], $this->var['user_forums'], $this->var['user_comments'], $this->var['user_chats'], $this->var['user_visits'], $this->var['user_join'], $this->var['user_admin'], $this->var['user_perms'], $pref);
return ($this->var['user_admin'] ? $ldata[0] : $ldata[1]);
return ($this->var['user_admin'] ? vartrue($ldata[0]) : vartrue($ldata[1]));
}
@@ -381,6 +417,7 @@ class comment_shortcodes extends e_shortcode
return $SIGNATURE;
}
function sc_comment_share($parm='')
{
if(!$xup = e107::getUser()->getProviderName())
@@ -402,9 +439,4 @@ class comment_shortcodes extends e_shortcode
}
}
}
?>

View File

@@ -844,7 +844,7 @@ class news_shortcodes extends e_shortcode
}
else
{
return "None";
return LAN_NONE;
}
}

View File

@@ -211,7 +211,7 @@ class user_shortcodes extends e_shortcode
function sc_user_daysregged($parm)
{
return e107::getDate()->computeLapse($this->var['user_join'])." ".LAN_USER_34;
return e107::getDate()->computeLapse($this->var['user_join']);
}

View File

@@ -620,7 +620,7 @@ class convert
}
if($format == 'short' && count($outputArray) == 1) { break; }
}
return ($mode ? $outputArray : implode(", ", $outputArray) . " ago"); //XXX LAN
return ($mode ? $outputArray : implode(", ", $outputArray) . " " . LANDT_AGO);
}

View File

@@ -67,6 +67,8 @@ define("COMLAN_400", "approved");
define("COMLAN_401", "blocked");
define("COMLAN_402", "pending");
define("COMLAN_403", "Leave a message...");
define("COMLAN_404", "Approve");
define("COMLAN_TYPE_1", "news");
define("COMLAN_TYPE_2", "download");