| 1 |
<?php |
| 2 |
/** |
| 3 |
* Helper functions for the Atomic platform. |
| 4 |
* |
| 5 |
* @package automattic/jetpack |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Automattic\Jetpack\Third_Party; |
| 9 |
|
| 10 |
use Automattic\Jetpack\Constants; |
| 11 |
use Automattic\Jetpack\Status\Host; |
| 12 |
|
| 13 |
/** |
| 14 |
* Handles suppressing development version notices on Atomic-hosted sites. |
| 15 |
* |
| 16 |
* @param bool $development_version Filterable value if this is a development version of Jetpack. |
| 17 |
* |
| 18 |
* @return bool |
| 19 |
*/ |
| 20 |
function atomic_weekly_override( $development_version ) { |
| 21 |
if ( ( new Host() )->is_atomic_platform() ) { |
| 22 |
$haystack = Constants::get_constant( 'JETPACK__PLUGIN_DIR' ); |
| 23 |
$needle = '/jetpack-dev/'; |
| 24 |
if ( |
| 25 |
( function_exists( 'str_ends_with' ) && str_ends_with( $haystack, $needle ) ) || // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.str_ends_withFound |
| 26 |
0 === substr_compare( $haystack, $needle, -13 ) |
| 27 |
) { |
| 28 |
return $development_version; // Returns the default response if the active Jetpack version is from the beta plugin. |
| 29 |
} |
| 30 |
|
| 31 |
$development_version = false; // Returns false for regular installs on Atomic. |
| 32 |
} |
| 33 |
return $development_version; // Return default if not on Atomic. |
| 34 |
} |
| 35 |
|
| 36 |
add_filter( 'jetpack_development_version', __NAMESPACE__ . '\atomic_weekly_override' ); |
| 37 |
|