Skip to content

Commit

Permalink
Remove unneeded string copy operations from text processing
Browse files Browse the repository at this point in the history
Fixes #23411
  • Loading branch information
atrol committed Sep 29, 2017
1 parent c368606 commit ce5ba70
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions plugins/MantisCoreFormatting/MantisCoreFormatting.php
Expand Up @@ -81,13 +81,9 @@ function config() {
*/
private function processText( $p_string, $p_multiline = true ){

$t_string = $p_string;

$t_string = string_strip_hrefs( $t_string );
$t_string = string_strip_hrefs( $p_string );
$t_string = string_html_specialchars( $t_string );
$t_string = string_restore_valid_html_tags( $t_string, $p_multiline );

return $t_string;
return string_restore_valid_html_tags( $t_string, $p_multiline );
}

/**
Expand All @@ -98,12 +94,8 @@ private function processText( $p_string, $p_multiline = true ){
*/
private function processBugAndNoteLinks( $p_string ){

$t_string = $p_string;

$t_string = string_process_bug_link( $t_string );
$t_string = string_process_bugnote_link( $t_string );

return $t_string;
$t_string = string_process_bug_link( $p_string );
return string_process_bugnote_link( $t_string );
}

/**
Expand All @@ -122,22 +114,21 @@ private function processBugAndNoteLinks( $p_string ){
function text( $p_event, $p_string, $p_multiline = true ) {
static $s_text;

$t_string = $p_string;

if( null === $s_text ) {
$s_text = plugin_config_get( 'process_text' );
}

if( ON == $s_text ) {
$t_string = $this->processText( $t_string, $p_multiline );
$t_string = $this->processText( $p_string, $p_multiline );

if( $p_multiline ) {
$t_string = string_preserve_spaces_at_bol( $t_string );
$t_string = string_nl2br( $t_string );
}
return $t_string;
} else {
return $p_string;
}

return $t_string;
}

/**
Expand Down

0 comments on commit ce5ba70

Please sign in to comment.