Add $enforce_max_height parameter to getSignature() #2146

This commit is contained in:
Kijin Sung 2023-07-16 15:13:27 +09:00
parent 4d6591145e
commit 0fce8eef93
2 changed files with 7 additions and 4 deletions

View file

@ -691,7 +691,7 @@ class CommentItem extends BaseObject
* Return author's signiture
* @return string
*/
function getSignature()
function getSignature($enforce_max_height = true)
{
// pass if the posting not exists.
if(!$this->isExists() || $this->get('member_srl') <= 0)
@ -711,7 +711,7 @@ class CommentItem extends BaseObject
$max_signature_height = $GLOBALS['__member_signature_max_height'];
if($max_signature_height)
if($max_signature_height && $enforce_max_height)
{
$signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
}

View file

@ -1516,7 +1516,7 @@ class DocumentItem extends BaseObject
* Return author's signiture
* @return string
*/
function getSignature()
function getSignature($enforce_max_height = true)
{
// Pass if a document doesn't exist
if(!$this->isExists() || $this->get('member_srl') <= 0) return;
@ -1531,7 +1531,10 @@ class DocumentItem extends BaseObject
if($signature)
{
$max_signature_height = $GLOBALS['__member_signature_max_height'];
if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
if($max_signature_height && $enforce_max_height)
{
$signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
}
}
return $signature;