| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class of activation/deactivation of the plugin. Must be registered in file includes/class.plugin.php |
| 4 |
* |
| 5 |
* @author Webcraftic <wordpress.webraftic@gmail.com> |
| 6 |
* @copyright (c) 02.12.2018, Webcraftic |
| 7 |
* @see Wbcr_Factory410_Activator |
| 8 |
* |
| 9 |
* @version 1.0.1 |
| 10 |
*/ |
| 11 |
|
| 12 |
// Exit if accessed directly |
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
class WINP_Activation extends Wbcr_Factory410_Activator { |
| 18 |
|
| 19 |
/** |
| 20 |
* Method is executed during the activation of the plugin. |
| 21 |
* |
| 22 |
* @since 1.0.0 |
| 23 |
*/ |
| 24 |
public function activate() { |
| 25 |
|
| 26 |
// Write information about the first activation of plugin |
| 27 |
if ( ! get_option( $this->plugin->getOptionName( 'first_activation' ) ) ) { |
| 28 |
update_option( $this->plugin->getOptionName( 'first_activation' ), array( |
| 29 |
'version' => $this->plugin->getPluginVersion(), |
| 30 |
'timestamp' => time() |
| 31 |
) ); |
| 32 |
} |
| 33 |
|
| 34 |
// Create a demo snippets with examples of use |
| 35 |
if ( ! get_option( $this->plugin->getOptionName( 'demo_snippets_created' ) ) ) { |
| 36 |
WINP_Helper::create_demo_snippets(); |
| 37 |
} |
| 38 |
|
| 39 |
update_option( $this->plugin->getOptionName( 'what_new_210' ), 1 ); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* The method is executed during the deactivation of the plugin. |
| 44 |
* |
| 45 |
* @since 1.0.0 |
| 46 |
*/ |
| 47 |
public function deactivate() { |
| 48 |
// Code to be executed during plugin deactivation |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
|