activation-actions.php
4 years ago
build-inline-scripts.php
3 weeks ago
build-modules.php
4 months ago
build-widgets.php
4 months ago
config-list.php
4 months ago
editor-promotion.php
3 weeks ago
handler-api.php
6 months ago
handler-widget.php
4 years ago
plugin-unsubscribe.php
3 weeks ago
activation-actions.php
47 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ElementsKit_Lite\Core; |
| 4 | |
| 5 | use ElementsKit_Lite\Libs\Framework\Classes\Onboard_Status; |
| 6 | |
| 7 | defined( 'ABSPATH' ) || exit; |
| 8 | |
| 9 | class Activation_Actions { |
| 10 | |
| 11 | private $key = 'elementskit-lite__plugin_activated'; |
| 12 | private $has_key = false; |
| 13 | |
| 14 | public function init() { |
| 15 | if ( ! is_admin() ) { |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | $this->process_key(); |
| 20 | |
| 21 | if ( $this->has_key === false ) { |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | // call activation job classes or methods here. |
| 26 | $this->flush_rewrite_rules(); |
| 27 | $this->redirect_to_onboard(); |
| 28 | } |
| 29 | |
| 30 | private function process_key() { |
| 31 | if ( ! empty( get_option( $this->key ) ) ) { |
| 32 | $this->has_key = true; |
| 33 | delete_option( $this->key ); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | private function flush_rewrite_rules() { |
| 38 | // all CPTs must be declared completely before flushing rewrite rules. otherwise, it won't work as expected. |
| 39 | flush_rewrite_rules(); |
| 40 | } |
| 41 | |
| 42 | private function redirect_to_onboard() { |
| 43 | // Onboard_Status::redirect_onboard(); |
| 44 | } |
| 45 | |
| 46 | } |
| 47 |