| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Fired during plugin activation |
| 5 |
* |
| 6 |
* @link https://plugins360.com |
| 7 |
* @since 1.0.0 |
| 8 |
* |
| 9 |
* @package Automatic_YouTube_Gallery |
| 10 |
*/ |
| 11 |
|
| 12 |
// Exit if accessed directly |
| 13 |
if ( ! defined( 'WPINC' ) ) { |
| 14 |
die; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* AYG_Activator class. |
| 19 |
* |
| 20 |
* @since 1.0.0 |
| 21 |
*/ |
| 22 |
class AYG_Activator { |
| 23 |
|
| 24 |
/** |
| 25 |
* Called when the plugin is activated. |
| 26 |
* |
| 27 |
* @since 1.0.0 |
| 28 |
*/ |
| 29 |
public static function activate() { |
| 30 |
// Insert the plugin settings and default values for the first time |
| 31 |
$defaults = ayg_get_default_settings(); |
| 32 |
|
| 33 |
foreach ( $defaults as $option_name => $values ) { |
| 34 |
if ( false == get_option( $option_name ) ) { |
| 35 |
add_option( $option_name, $values ); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
// Create custom database tables |
| 40 |
ayg_db_create_custom_tables(); |
| 41 |
|
| 42 |
// Insert the plugin version |
| 43 |
add_option( 'ayg_version', AYG_VERSION ); |
| 44 |
} |
| 45 |
|
| 46 |
} |