Skip to content

Commit

Permalink
Address some PHPCS comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
bordoni committed Oct 22, 2024
1 parent 48080c7 commit 6e5fccb
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/functions/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ function tribe_exit( $status = '' ) {
*
* @see tec_get_request_var()
*
* @param string|array $var The variable to check for.
* @param mixed $default The default value to return if the variable is not set.
* @param string|array $var The variable to check for.
* @param mixed $default_value The default value to return if the variable is not set.
*
* @return mixed
*/
function tribe_get_request_var( $var, $default = null ) {
return tec_get_request_var( $var, $default );
function tribe_get_request_var( $var, $default_value = null ) {
return tec_get_request_var( $var, $default_value );
}
}

Expand All @@ -187,32 +187,32 @@ function tribe_get_request_var( $var, $default = null ) {
* @see Tribe__Utils__Array::get_in_any()
* @see tribe_sanitize_deep()
*
* @param string|array $var The variable to check for.
* @param mixed $default The default value to return if the variable is not set.
* @param string|array $var The variable to check for.
* @param mixed $default_value The default value to return if the variable is not set.
*
* @return mixed
*/
function tec_get_request_var( $var, $default = null ) {
function tec_get_request_var( $var, $default_value = null ) {
$requests = [];

// Prevent a slew of warnings every time we call this.
if ( isset( $_REQUEST ) ) {
$requests[] = (array) $_REQUEST;
$requests[] = (array) $_REQUEST; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended
}

if ( isset( $_GET ) ) {
$requests[] = (array) $_GET;
$requests[] = (array) $_GET; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended
}

if ( isset( $_POST ) ) {
$requests[] = (array) $_POST;
$requests[] = (array) $_POST; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended
}

if ( empty( $requests ) ) {
return $default;
return $default_value;
}

$unsafe = Tribe__Utils__Array::get_in_any( $requests, $var, $default );
$unsafe = Tribe__Utils__Array::get_in_any( $requests, $var, $default_value );

// Sanitize and return.
return tribe_sanitize_deep( $unsafe );
Expand All @@ -235,32 +235,32 @@ function tec_get_request_var( $var, $default = null ) {
*
* @see Tribe__Utils__Array::get_in_any()
*
* @param string|array $var The variable to check for.
* @param mixed $default The default value to return if the variable is not set.
* @param string|array $var The variable to check for.
* @param mixed $default_value The default value to return if the variable is not set.
*
* @return mixed
*/
function tec_get_request_var_raw( $var, $default = null ) {
function tec_get_request_var_raw( $var, $default_value = null ) {
$requests = [];

// Prevent a slew of warnings every time we call this.
if ( isset( $_REQUEST ) ) {
$requests[] = (array) $_REQUEST;
$requests[] = (array) $_REQUEST; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended
}

if ( isset( $_GET ) ) {
$requests[] = (array) $_GET;
$requests[] = (array) $_GET; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended
}

if ( isset( $_POST ) ) {
$requests[] = (array) $_POST;
$requests[] = (array) $_POST; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended
}

if ( empty( $requests ) ) {
return $default;
return $default_value;
}

$unsafe = Tribe__Utils__Array::get_in_any( $requests, $var, $default );
$unsafe = Tribe__Utils__Array::get_in_any( $requests, $var, $default_value );

// Return the value as is.
return $unsafe;
Expand Down

0 comments on commit 6e5fccb

Please sign in to comment.