mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/13901] Add more whitespace to long quotes for readability
PHPBB3-13901
This commit is contained in:
parent
073f3e6fdc
commit
2f0d11ba3c
5 changed files with 23 additions and 6 deletions
|
@ -942,10 +942,10 @@ function compose_pm($id, $mode, $action, $user_folders = array())
|
||||||
$message_link = '';
|
$message_link = '';
|
||||||
}
|
}
|
||||||
$quote_text = $phpbb_container->get('text_formatter.utils')->generate_quote(
|
$quote_text = $phpbb_container->get('text_formatter.utils')->generate_quote(
|
||||||
censor_text(trim($message_parser->message)),
|
censor_text($message_parser->message),
|
||||||
array('author' => $quote_username)
|
array('author' => $quote_username)
|
||||||
);
|
);
|
||||||
$message_parser->message = $message_link . $quote_text . "\n";
|
$message_parser->message = $message_link . $quote_text . "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh)
|
if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh)
|
||||||
|
@ -974,7 +974,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
|
||||||
$forward_text[] = sprintf($user->lang['FWD_TO'], implode($user->lang['COMMA_SEPARATOR'], $fwd_to_field['to']));
|
$forward_text[] = sprintf($user->lang['FWD_TO'], implode($user->lang['COMMA_SEPARATOR'], $fwd_to_field['to']));
|
||||||
|
|
||||||
$quote_text = $phpbb_container->get('text_formatter.utils')->generate_quote(
|
$quote_text = $phpbb_container->get('text_formatter.utils')->generate_quote(
|
||||||
censor_text(trim($message_parser->message)),
|
censor_text($message_parser->message),
|
||||||
array('author' => $quote_username)
|
array('author' => $quote_username)
|
||||||
);
|
);
|
||||||
$message_parser->message = implode("\n", $forward_text) . "\n\n" . $quote_text;
|
$message_parser->message = implode("\n", $forward_text) . "\n\n" . $quote_text;
|
||||||
|
|
|
@ -56,6 +56,7 @@ class utils implements \phpbb\textformatter\utils_interface
|
||||||
*/
|
*/
|
||||||
public function generate_quote($text, array $attributes = array())
|
public function generate_quote($text, array $attributes = array())
|
||||||
{
|
{
|
||||||
|
$text = trim($text);
|
||||||
$quote = '[quote';
|
$quote = '[quote';
|
||||||
if (isset($attributes['author']))
|
if (isset($attributes['author']))
|
||||||
{
|
{
|
||||||
|
@ -67,7 +68,9 @@ class utils implements \phpbb\textformatter\utils_interface
|
||||||
{
|
{
|
||||||
$quote .= ' ' . $name . '=' . $this->enquote($value);
|
$quote .= ' ' . $name . '=' . $this->enquote($value);
|
||||||
}
|
}
|
||||||
$quote .= ']' . $text . '[/quote]';
|
$quote .= ']';
|
||||||
|
$newline = (strlen($quote . $text . '[/quote]') > 80) ? "\n" : '';
|
||||||
|
$quote .= $newline . $text . $newline . '[/quote]';
|
||||||
|
|
||||||
return $quote;
|
return $quote;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1598,10 +1598,10 @@ if ($generate_quote)
|
||||||
if ($config['allow_bbcode'])
|
if ($config['allow_bbcode'])
|
||||||
{
|
{
|
||||||
$message_parser->message = $phpbb_container->get('text_formatter.utils')->generate_quote(
|
$message_parser->message = $phpbb_container->get('text_formatter.utils')->generate_quote(
|
||||||
censor_text(trim($message_parser->message)),
|
censor_text($message_parser->message),
|
||||||
array('author' => $post_data['quote_username'])
|
array('author' => $post_data['quote_username'])
|
||||||
);
|
);
|
||||||
$message_parser->message .= "\n";
|
$message_parser->message .= "\n\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -221,6 +221,10 @@ class phpbb_textformatter_s9e_default_formatting_test extends phpbb_test_case
|
||||||
'[quote="http://example.org"]...[/quote]',
|
'[quote="http://example.org"]...[/quote]',
|
||||||
'<blockquote><div><cite><a href="http://example.org" class="postlink">http://example.org</a> wrote:</cite>...</div></blockquote>'
|
'<blockquote><div><cite><a href="http://example.org" class="postlink">http://example.org</a> wrote:</cite>...</div></blockquote>'
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
"[quote]\nThis is a long quote that is definitely going to exceed 80 characters\n[/quote]\n\nFollowed by a reply",
|
||||||
|
"<blockquote class=\"uncited\"><div>\nThis is a long quote that is definitely going to exceed 80 characters\n</div></blockquote>\n\nFollowed by a reply"
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,16 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case
|
||||||
),
|
),
|
||||||
'[quote="user" post_id="123" url="http://example.org"]...[/quote]',
|
'[quote="user" post_id="123" url="http://example.org"]...[/quote]',
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'This is a long quote that is definitely going to exceed 80 characters',
|
||||||
|
array(),
|
||||||
|
"[quote]\nThis is a long quote that is definitely going to exceed 80 characters\n[/quote]",
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
' This is a short quote on its own line ',
|
||||||
|
array(),
|
||||||
|
'[quote]This is a short quote on its own line[/quote]',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue