Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| DS_Utils | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
90 | |
0.00% |
0 / 1 |
| is_debug | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
12 | |||
| debug_disable | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
42 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\Jetpack\WP_JS_Data_Sync; |
| 4 | |
| 5 | use Automattic\Jetpack\Schema\Utils as Schema_Utils; |
| 6 | |
| 7 | class DS_Utils { |
| 8 | /** |
| 9 | * Is the current environment a development environment? |
| 10 | * |
| 11 | * @return bool |
| 12 | */ |
| 13 | public static function is_debug(): bool { |
| 14 | return ( defined( 'DATASYNC_DEBUG' ) && \DATASYNC_DEBUG ) || Schema_Utils::is_debug(); |
| 15 | } |
| 16 | |
| 17 | public static function debug_disable( $name ) { |
| 18 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 19 | if ( isset( $_GET['ds-debug-disable'] ) && ( is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) { |
| 20 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 21 | $values = explode( ',', sanitize_key( $_GET['ds-debug-disable'] ) ); |
| 22 | if ( $values === array( 'all' ) ) { |
| 23 | return true; |
| 24 | } |
| 25 | return in_array( $name, $values, true ); |
| 26 | } |
| 27 | return false; |
| 28 | } |
| 29 | } |