array( 'type' => 'warning', 'message' => 'Detected high pagination limit, `%s` is set to `%s`', 'keys' => array( 'posts_per_page', 'numberposts', ), ), ); } /** * Callback to process each confirmed key, to check value. * * @param string $key Array index / key. * @param mixed $val Assigned value. * @param int $line Token line. * @param array $group Group definition. * * @return bool FALSE if no match, TRUE if matches. */ public function callback( $key, $val, $line, $group ) { $stripped_val = TextStrings::stripQuotes( $val ); if ( $val !== $stripped_val ) { // The value was a text string. For text strings, we only accept purely numeric values. if ( preg_match( '`^[0-9]+$`', $stripped_val ) !== 1 ) { // Not a purely numeric value, so any comparison would be a false comparison. return false; } // Purely numeric string, treat it as an integer from here on out. $val = $stripped_val; } $first_char = $val[0]; if ( '-' === $first_char || '+' === $first_char ) { $val = ltrim( $val, '-+' ); } else { $first_char = ''; } $real_value = Numbers::getDecimalValue( $val ); if ( false === $real_value ) { // This wasn't a purely numeric value, so any comparison would be a false comparison. return false; } $val = $first_char . $real_value; return ( (int) $val > (int) $this->posts_per_page ); } }