| @@ 235-253 (lines=19) @@ | ||
| 232 | $callable_checksums = (array) Jetpack_Options::get_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, array() ); |
|
| 233 | $has_changed = false; |
|
| 234 | // only send the callables that have changed |
|
| 235 | foreach ( $callables as $name => $value ) { |
|
| 236 | $checksum = $this->get_check_sum( $value ); |
|
| 237 | // explicitly not using Identical comparison as get_option returns a string |
|
| 238 | if ( ! is_null( $value ) && $this->should_send_callable( $callable_checksums, $name, $checksum ) ) { |
|
| 239 | /** |
|
| 240 | * Tells the client to sync a callable (aka function) to the server |
|
| 241 | * |
|
| 242 | * @since 4.2.0 |
|
| 243 | * |
|
| 244 | * @param string The name of the callable |
|
| 245 | * @param mixed The value of the callable |
|
| 246 | */ |
|
| 247 | do_action( 'jetpack_sync_callable', $name, $value ); |
|
| 248 | $callable_checksums[ $name ] = $checksum; |
|
| 249 | $has_changed = true; |
|
| 250 | } else { |
|
| 251 | $callable_checksums[ $name ] = $checksum; |
|
| 252 | } |
|
| 253 | } |
|
| 254 | if ( $has_changed ) { |
|
| 255 | Jetpack_Options::update_raw_option( self::CALLABLES_CHECKSUM_OPTION_NAME, $callable_checksums ); |
|
| 256 | } |
|
| @@ 77-94 (lines=18) @@ | ||
| 74 | ||
| 75 | $constants_checksums = (array) get_option( self::CONSTANTS_CHECKSUM_OPTION_NAME, array() ); |
|
| 76 | ||
| 77 | foreach ( $constants as $name => $value ) { |
|
| 78 | $checksum = $this->get_check_sum( $value ); |
|
| 79 | // explicitly not using Identical comparison as get_option returns a string |
|
| 80 | if ( ! $this->still_valid_checksum( $constants_checksums, $name, $checksum ) && ! is_null( $value ) ) { |
|
| 81 | /** |
|
| 82 | * Tells the client to sync a constant to the server |
|
| 83 | * |
|
| 84 | * @since 4.2.0 |
|
| 85 | * |
|
| 86 | * @param string The name of the constant |
|
| 87 | * @param mixed The value of the constant |
|
| 88 | */ |
|
| 89 | do_action( 'jetpack_sync_constant', $name, $value ); |
|
| 90 | $constants_checksums[ $name ] = $checksum; |
|
| 91 | } else { |
|
| 92 | $constants_checksums[ $name ] = $checksum; |
|
| 93 | } |
|
| 94 | } |
|
| 95 | update_option( self::CONSTANTS_CHECKSUM_OPTION_NAME, $constants_checksums ); |
|
| 96 | } |
|
| 97 | ||