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() {
$query_string = self::getQueryString();
$constantCheckSum = crc32( $query_string );
if ( Jetpack_Options::get_option( 'constant_check_sum' ) !== $constantCheckSum ) {
Jetpack_Options::update_option( 'constant_check_sum', $constantCheckSum );
return $query_string;
}
return null;
static function sync_all() {
return self::getQueryString();
static function getQueryString() {
$constants_values = array();
foreach( self::$constants as $constant ) {
$constants_values[ $constant ] = self::getConstant( $constant );
return build_query( $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.