Skip to content

Commit

Permalink
Try
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Feb 9, 2025
1 parent 2afd5ca commit 6aade74
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion includes/Lister/Lister.php
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,21 @@ protected function replaceTagParameters( $tag, Article $article ) {
$tag = str_replace( '%EDITSUMMARY%', $article->mComment, $tag );

$title = $article->mTitle->getText();
$displayTitle = $this->parser->getOutput()->getPageProperty( 'displaytitle' );
$replaceInTitle = $this->getParameters()->getParameter( 'replaceintitle' );

$pageProps = MediaWikiServices::getInstance()->getPageProps();

// Get DisplayTitle
$titleTarget = $article->mTitle->createFragmentTarget( '' );
$values = $pageProps->getPropeties( $titleTarget, 'displaytitle' );
$id = $titleTarget->getArticleID();

Check warning

Code scanning / Phpmd (reported by Codacy)

Detects when a field, local, or parameter has a very short name. Warning

Avoid variables with short names like $id. Configured minimum length is 3.
if ( array_key_exists( $id, $values ) ) {
$value = $values[$id];
if ( trim( str_replace( ' ', '', strip_tags( $value ) ) ) !== '' ) {
$displaytitle = $value;

Check notice

Code scanning / Phpmd (reported by Codacy)

Prohibit the definition or assignment of unused local variables Note

Avoid unused local variables such as '$displaytitle'.
}
}

if ( is_array( $replaceInTitle ) && count( $replaceInTitle ) === 2 ) {
$title = preg_replace( $replaceInTitle[0], $replaceInTitle[1], $title );
}
Expand Down

0 comments on commit 6aade74

Please sign in to comment.