Skip to content

Commit efbaa1d

Browse files
authored
Merge pull request #2326 from WordPress/feature/escapeoutput-review-phpcsutils-modern-php
Security/EscapeOutput: use PHPCSUtils, allow for modern PHP and slew of bug fixes
2 parents 7cb6224 + bb0b7d6 commit efbaa1d

24 files changed

+1551
-535
lines changed

WordPress/Helpers/PrintingFunctionsTrait.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,13 @@ trait PrintingFunctionsTrait {
8787
private $allPrintingFunctions = array();
8888

8989
/**
90-
* Check if a particular function is regarded as a printing function.
90+
* Retrieve a list of all known printing functions.
9191
*
9292
* @since 3.0.0
9393
*
94-
* @param string $functionName The name of the function to check.
95-
*
96-
* @return bool
94+
* @return array<string, bool>
9795
*/
98-
public function is_printing_function( $functionName ) {
96+
public function get_printing_functions() {
9997
if ( array() === $this->allPrintingFunctions
10098
|| $this->customPrintingFunctions !== $this->addedCustomPrintingFunctions
10199
) {
@@ -107,6 +105,19 @@ public function is_printing_function( $functionName ) {
107105
$this->addedCustomPrintingFunctions = $this->customPrintingFunctions;
108106
}
109107

110-
return isset( $this->allPrintingFunctions[ strtolower( $functionName ) ] );
108+
return $this->allPrintingFunctions;
109+
}
110+
111+
/**
112+
* Check if a particular function is regarded as a printing function.
113+
*
114+
* @since 3.0.0
115+
*
116+
* @param string $functionName The name of the function to check.
117+
*
118+
* @return bool
119+
*/
120+
public function is_printing_function( $functionName ) {
121+
return isset( $this->get_printing_functions()[ strtolower( $functionName ) ] );
111122
}
112123
}

0 commit comments

Comments
 (0)