Skip to content

Commit

Permalink
Add debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Feb 9, 2025
1 parent 74c611a commit de3fd6c
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion includes/Lister/Lister.php
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ protected function replaceTagParameters( $tag, Article $article ) {
$title = $article->mTitle->getText();
$replaceInTitle = $this->getParameters()->getParameter( 'replaceintitle' );

$pageProps = MediaWikiServices::getInstance()->getPageProps();
/* $pageProps = MediaWikiServices::getInstance()->getPageProps();
// Get DisplayTitle
$values = $pageProps->getProperties( $article->mTitle, 'displaytitle' );
Expand All @@ -802,6 +802,33 @@ protected function replaceTagParameters( $tag, Article $article ) {
if ( trim( str_replace( ' ', '', strip_tags( $value ) ) ) !== '' ) {
$displayTitle = $value;
}
} */

$pageProps = MediaWikiServices::getInstance()->getPageProps();
$values = $pageProps->getProperties( $article->mTitle, 'displaytitle' );
$id = $article->mTitle->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.

var_dump( "Page ID:", $id );
var_dump( "Retrieved displaytitle values:", $values );

if ( isset( $values[$id] ) ) {
$value = $values[$id];

var_dump( "Raw displaytitle value:", $value );

$cleanValue = trim( htmlspecialchars_decode( strip_tags( $value ) ) );

var_dump( "Cleaned displaytitle value:", $cleanValue );

if ( $cleanValue !== '' ) {
$displayTitle = $value;

var_dump( "Final displayTitle:", $displayTitle );
} else {
var_dump( "DisplayTitle not set because the cleaned value is empty." );
}
} else {

Check warning

Code scanning / Phpmd (reported by Codacy)

Use return statements instead of else expression Warning

The method replaceTagParameters uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
var_dump( "DisplayTitle key not found in retrieved values." );
}

if ( is_array( $replaceInTitle ) && count( $replaceInTitle ) === 2 ) {
Expand Down

0 comments on commit de3fd6c

Please sign in to comment.