for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class Jetpack_Options_Sync {
static $options_to_sync = array();
$options_to_sync
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.
static $sync = array();
$sync
static $delete = array();
$delete
static function init() {
foreach ( self::$options_to_sync as $option ) {
self::init_option( $option );
}
static function init_option( $option ) {
add_action( "delete_option_{$option}", array( __CLASS__, 'delete_option' ) );
add_action( "update_option_{$option}", array( __CLASS__, 'update_option' ) );
add_action( "add_option_{$option}", array( __CLASS__, 'add_option' ) );
static function delete_option( $option ) {
self::$delete[] = $option;
static function update_option() {
$option = current_filter();
$prefix = 'update_option_';
if ( 0 !== strpos( $option, $prefix ) ) {
return;
$option = substr( $option, strlen( $prefix ) );
self::$sync[] = $option;
static function add_option( $option ) {
static function options_to_delete() {
return array_unique( self::$delete );
static function options_to_sync() {
return array_unique( self::$sync );
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.