@@ 104-122 (lines=19) @@ | ||
101 | * |
|
102 | * @param array $processed_items Array of processed items that were synced to WordPress.com. |
|
103 | */ |
|
104 | public function maybe_clear_migrate_option( $processed_items ) { |
|
105 | foreach ( (array) $processed_items as $item ) { |
|
106 | ||
107 | // First, is this item a jetpack_sync_callable action? If so, then proceed. |
|
108 | $callable_args = ( is_array( $item ) && isset( $item[0], $item[1] ) && 'jetpack_sync_callable' === $item[0] ) |
|
109 | ? $item[1] |
|
110 | : null; |
|
111 | ||
112 | // Second, if $callable_args is set, check if the callable was home_url or site_url. If so, |
|
113 | // clear the migrate option. |
|
114 | if ( |
|
115 | isset( $callable_args, $callable_args[0] ) |
|
116 | && ( 'home_url' === $callable_args[0] || 'site_url' === $callable_args[1] ) |
|
117 | ) { |
|
118 | Jetpack_Options::delete_option( 'migrate_for_idc' ); |
|
119 | break; |
|
120 | } |
|
121 | } |
|
122 | } |
|
123 | ||
124 | /** |
|
125 | * 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() ) { |