1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-13 04:13:29 +02:00

[ticket/16247] Quote PM has no identifier

Code review

PHPBB3-16247
This commit is contained in:
3D-I 2019-12-05 23:41:44 +01:00
parent 8c42a9d900
commit e6c45623ea
2 changed files with 11 additions and 11 deletions

View File

@ -20,6 +20,11 @@ class quote_helper
*/
protected $post_url;
/**
* @var string Base URL for a private message link, uses {MSG_ID} as placeholder
*/
protected $msg_url;
/**
* @var string Base URL for a profile link, uses {USER_ID} as placeholder
*/
@ -53,31 +58,26 @@ class quote_helper
*/
public function inject_metadata($xml)
{
$post_url = $this->post_url;
$msg_url = $this->msg_url;
$profile_url = $this->profile_url;
$user = $this->user;
return \s9e\TextFormatter\Utils::replaceAttributes(
$xml,
'QUOTE',
function ($attributes) use ($post_url, $profile_url, $user)
function ($attributes)
{
if (isset($attributes['post_id']))
{
$attributes['post_url'] = str_replace('{POST_ID}', $attributes['post_id'], $post_url);
$attributes['post_url'] = str_replace('{POST_ID}', $attributes['post_id'], $this->post_url);
}
if (isset($attributes['msg_id']))
{
$attributes['msg_url'] = str_replace('{MSG_ID}', $attributes['msg_id'], $msg_url);
$attributes['msg_url'] = str_replace('{MSG_ID}', $attributes['msg_id'], $this->msg_url);
}
if (isset($attributes['time']))
{
$attributes['date'] = $user->format_date($attributes['time']);
$attributes['date'] = $this->user->format_date($attributes['time']);
}
if (isset($attributes['user_id']))
{
$attributes['profile_url'] = str_replace('{USER_ID}', $attributes['user_id'], $profile_url);
$attributes['profile_url'] = str_replace('{USER_ID}', $attributes['user_id'], $this->profile_url);
}
return $attributes;

View File

@ -39,7 +39,7 @@
</xsl:if>
<xsl:if test="@msg_url">
<xsl:text> </xsl:text>
<a href="{@msg_url}" data-msg-id="{@msg_id}" onclick="if(document.getElementById(hash.substr(1)))href=hash">&#8593;</a>
<a href="{@msg_url}" data-msg-id="{@msg_id}">&#8593;</a>
</xsl:if>
<xsl:if test="@date">
<div class="responsive-hide"><xsl:value-of select="@date"/></div>