for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class Jetpack_Constants_Sync {
static $constants = array(
$constants
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
class A { var $property; }
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.
'EMPTY_TRASH_DAYS',
'WP_POST_REVISIONS',
'AUTOMATIC_UPDATER_DISABLED',
'ABSPATH',
'WP_CONTENT_DIR',
'FS_METHOD',
'DISALLOW_FILE_EDIT',
'DISALLOW_FILE_MODS',
'WP_AUTO_UPDATE_CORE',
'WP_HTTP_BLOCK_EXTERNAL',
'WP_ACCESSIBLE_HOSTS',
);
static function sync() {
$values = self::constant_values();
$constantCheckSum = self::getCheckSum( $values );
if ( Jetpack_Options::get_option( 'constant_check_sum' ) !== $constantCheckSum ) {
Jetpack_Options::update_option( 'constant_check_sum', $constantCheckSum );
return $values;
}
return null;
static function sync_all() {
return self::constant_values();
static function getCheckSum( $values ) {
return crc32( self::getQueryString( $values ) );
static function getQueryString( $values ) {
return build_query( $values );
static function constant_values() {
$constants_values = array();
foreach ( self::$constants as $constant ) {
$value = self::getConstant( $constant );
if ( ! is_null( $value ) ) {
$constants_values[ $constant ] = $value;
return $constants_values;
static function getConstant( $constant ) {
if ( defined( $constant ) ) {
return constant( $constant );
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.