# automatic-youtube-gallery/trunk/includes/activator.php

Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists &amp; Channels, version trunk. 46 lines.

- Page: https://pluginprobe.com/plugins/automatic-youtube-gallery/trunk/code/includes/activator.php
- Raw: https://pluginprobe.com/plugins/automatic-youtube-gallery/trunk/raw/includes/activator.php
- Modified: 2025-04-04T08:35:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/automatic-youtube-gallery/trunk/code/includes/activator.php#L10-L20`.

```php
<?php

/**
 * Fired during plugin activation
 *
 * @link    https://plugins360.com
 * @since   1.0.0
 *
 * @package Automatic_YouTube_Gallery
 */

// Exit if accessed directly
if ( ! defined( 'WPINC' ) ) {
	die;
}

/**
 * AYG_Activator class.
 *
 * @since 1.0.0
 */
class AYG_Activator {

	/**
	 * Called when the plugin is activated.
	 *
	 * @since 1.0.0
	 */
	public static function activate() {
		// Insert the plugin settings and default values for the first time
		$defaults = ayg_get_default_settings();

		foreach ( $defaults as $option_name => $values ) {
			if ( false == get_option( $option_name ) ) {	
        		add_option( $option_name, $values );						
    		}
		}
		
		// Create custom database tables
		ayg_db_create_custom_tables();

		// Insert the plugin version
		add_option( 'ayg_version', AYG_VERSION );
	}

}
```
