| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace BitCode\BitForm\Core\Util; |
| 3 | 4 | |
| 4 | 5 | /** |
| 5 | 6 | * Class handling plugin deactivation. |
| @@ -9,29 +10,28 @@ | ||
| 9 | 10 | * @ignore |
| 10 | 11 | */ |
| 11 | 12 | final class Deactivation |
| 12 | 13 | { |
| 14 | + /** | |
| 15 | + * Registers functionality through WordPress hooks. | |
| 16 | + * | |
| 17 | + * @since 1.0.0 | |
| 18 | + */ | |
| 19 | + public function register() | |
| 20 | + { | |
| 21 | + add_action('bitforms_deactivation', [$this, 'deactive']); | |
| 22 | + } | |
| 13 | 23 | |
| 14 | - /** | |
| 15 | - * Registers functionality through WordPress hooks. | |
| 16 | - * | |
| 17 | - * @since 1.0.0 | |
| 18 | - */ | |
| 19 | - public function register() | |
| 20 | - { | |
| 21 | - add_action('bitforms_deactivation', array($this, 'deactive')); | |
| 24 | + public function deactive() | |
| 25 | + { | |
| 26 | + $routes = get_option('bitforms_routes'); | |
| 27 | + if ($routes && isset($routes['root'])) { | |
| 28 | + $root_page = ['ID' => $routes['root'], 'post_status' => 'draft']; | |
| 29 | + wp_update_post($root_page); | |
| 22 | 30 | } |
| 23 | - | |
| 24 | - public function deactive() | |
| 25 | - { | |
| 26 | - $routes = get_option('bitforms_routes'); | |
| 27 | - if ($routes && isset($routes['root'])) { | |
| 28 | - $root_page = array( 'ID' => $routes['root'], 'post_status' => 'draft' ); | |
| 29 | - wp_update_post($root_page); | |
| 30 | - } | |
| 31 | - if ($routes && isset($routes['file'])) { | |
| 32 | - $file_page = array( 'ID' => $routes['file'], 'post_status' => 'draft' ); | |
| 33 | - wp_update_post($file_page); | |
| 34 | - } | |
| 35 | - flush_rewrite_rules(); | |
| 31 | + if ($routes && isset($routes['file'])) { | |
| 32 | + $file_page = ['ID' => $routes['file'], 'post_status' => 'draft']; | |
| 33 | + wp_update_post($file_page); | |
| 36 | 34 | } |
| 35 | + flush_rewrite_rules(); | |
| 36 | + } | |
| 37 | 37 | } |