| @@ -1,0 +1,37 @@ | ||
| 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 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit( 0 ); | |
| 15 | +} | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * Handles suppressing development version notices on Atomic-hosted sites. | |
| 19 | + * | |
| 20 | + * @param bool $development_version Filterable value if this is a development version of Jetpack. | |
| 21 | + * | |
| 22 | + * @return bool | |
| 23 | + */ | |
| 24 | +function atomic_weekly_override( $development_version ) { | |
| 25 | + if ( ( new Host() )->is_atomic_platform() ) { | |
| 26 | + $haystack = Constants::get_constant( 'JETPACK__PLUGIN_DIR' ); | |
| 27 | + $needle = '/jetpack-dev/'; | |
| 28 | + if ( str_ends_with( $haystack, $needle ) ) { | |
| 29 | + return $development_version; // Returns the default response if the active Jetpack version is from the beta plugin. | |
| 30 | + } | |
| 31 | + | |
| 32 | + $development_version = false; // Returns false for regular installs on Atomic. | |
| 33 | + } | |
| 34 | + return $development_version; // Return default if not on Atomic. | |
| 35 | +} | |
| 36 | + | |
| 37 | +add_filter( 'jetpack_development_version', __NAMESPACE__ . '\atomic_weekly_override' ); | |