8f95800d52
WordPress' code just... wasn't. This is now dealt with. Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS. Fixes #41057. git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
17 lines
382 B
PHP
17 lines
382 B
PHP
<?php
|
|
|
|
/**
|
|
* Legacy plural form function.
|
|
*
|
|
* @param int $nplurals
|
|
* @param string $expression
|
|
*/
|
|
function tests_make_plural_form_function( $nplurals, $expression ) {
|
|
$expression = str_replace( 'n', '$n', $expression );
|
|
$func_body = "
|
|
\$index = (int)($expression);
|
|
return (\$index < $nplurals)? \$index : $nplurals - 1;";
|
|
|
|
return create_function( '$n', $func_body );
|
|
}
|