| @@ 94-112 (lines=19) @@ | ||
| 91 | * |
|
| 92 | * @param array $processed_items Array of processed items that were synced to WordPress.com. |
|
| 93 | */ |
|
| 94 | public function maybe_clear_migrate_option( $processed_items ) { |
|
| 95 | foreach ( (array) $processed_items as $item ) { |
|
| 96 | ||
| 97 | // First, is this item a jetpack_sync_callable action? If so, then proceed. |
|
| 98 | $callable_args = ( is_array( $item ) && isset( $item[0], $item[1] ) && 'jetpack_sync_callable' === $item[0] ) |
|
| 99 | ? $item[1] |
|
| 100 | : null; |
|
| 101 | ||
| 102 | // Second, if $callable_args is set, check if the callable was home_url or site_url. If so, |
|
| 103 | // clear the migrate option. |
|
| 104 | if ( |
|
| 105 | isset( $callable_args, $callable_args[0] ) |
|
| 106 | && ( 'home_url' === $callable_args[0] || 'site_url' === $callable_args[1] ) |
|
| 107 | ) { |
|
| 108 | Jetpack_Options::delete_option( 'migrate_for_idc' ); |
|
| 109 | break; |
|
| 110 | } |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * WordPress init. |
|
| @@ 73-91 (lines=19) @@ | ||
| 70 | * |
|
| 71 | * @param $processed_items array Array of processed items that were synced to WordPress.com |
|
| 72 | */ |
|
| 73 | function maybe_clear_migrate_option( $processed_items ) { |
|
| 74 | foreach ( (array) $processed_items as $item ) { |
|
| 75 | ||
| 76 | // First, is this item a jetpack_sync_callable action? If so, then proceed. |
|
| 77 | $callable_args = ( is_array( $item ) && isset( $item[0], $item[1] ) && 'jetpack_sync_callable' === $item[0] ) |
|
| 78 | ? $item[1] |
|
| 79 | : null; |
|
| 80 | ||
| 81 | // Second, if $callable_args is set, check if the callable was home_url or site_url. If so, |
|
| 82 | // clear the migrate option. |
|
| 83 | if ( |
|
| 84 | isset( $callable_args, $callable_args[0] ) |
|
| 85 | && ( 'home_url' === $callable_args[0] || 'site_url' === $callable_args[1] ) |
|
| 86 | ) { |
|
| 87 | Jetpack_Options::delete_option( 'migrate_for_idc' ); |
|
| 88 | break; |
|
| 89 | } |
|
| 90 | } |
|
| 91 | } |
|
| 92 | ||
| 93 | function wordpress_init() { |
|
| 94 | if ( ! current_user_can( 'jetpack_disconnect' ) && is_admin() ) { |
|