Automattic /
jetpack
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | class Jetpack_Options_Sync { |
||
| 4 | |||
| 5 | static $options_to_sync = array(); |
||
|
0 ignored issues
–
show
|
|||
| 6 | |||
| 7 | static $sync = array(); |
||
|
0 ignored issues
–
show
The visibility should be declared for property
$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. Loading history...
|
|||
| 8 | static $delete = array(); |
||
|
0 ignored issues
–
show
The visibility should be declared for property
$delete.
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. Loading history...
|
|||
| 9 | |||
| 10 | static function init() { |
||
| 11 | |||
| 12 | foreach ( self::$options_to_sync as $option ) { |
||
| 13 | self::init_option( $option ); |
||
| 14 | } |
||
| 15 | } |
||
| 16 | |||
| 17 | static function init_option( $option ) { |
||
| 18 | add_action( "delete_option_{$option}", array( __CLASS__, 'delete_option' ) ); |
||
| 19 | add_action( "update_option_{$option}", array( __CLASS__, 'update_option' ) ); |
||
| 20 | add_action( "add_option_{$option}", array( __CLASS__, 'add_option' ) ); |
||
| 21 | } |
||
| 22 | |||
| 23 | static function delete_option( $option ) { |
||
| 24 | self::$delete[] = $option; |
||
| 25 | } |
||
| 26 | |||
| 27 | View Code Duplication | static function update_option() { |
|
| 28 | $option = current_filter(); |
||
| 29 | $prefix = 'update_option_'; |
||
| 30 | if ( 0 !== strpos( $option, $prefix ) ) { |
||
| 31 | return; |
||
| 32 | } |
||
| 33 | $option = substr( $option, strlen( $prefix ) ); |
||
| 34 | self::$sync[] = $option; |
||
| 35 | } |
||
| 36 | |||
| 37 | static function add_option( $option ) { |
||
| 38 | self::$sync[] = $option; |
||
| 39 | } |
||
| 40 | |||
| 41 | static function options_to_delete() { |
||
| 42 | return array_unique( self::$delete ); |
||
| 43 | } |
||
| 44 | |||
| 45 | static function options_to_sync() { |
||
| 46 | return array_unique( self::$sync ); |
||
| 47 | } |
||
| 48 | } |
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.