# automatic-youtube-gallery/1.2.0/admin/admin.php

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

- Page: https://pluginprobe.com/plugins/automatic-youtube-gallery/1.2.0/code/admin/admin.php
- Raw: https://pluginprobe.com/plugins/automatic-youtube-gallery/1.2.0/raw/admin/admin.php
- Modified: 2019-07-09T16:20:40+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/1.2.0/code/admin/admin.php#L10-L20`.

```php
<?php

/**
 * The admin-specific functionality of the plugin.
 *
 * @link    https://plugins360.com
 * @since   1.0.0
 *
 * @package Automatic_YouTube_Gallery
 */

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

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

	/**
	 * Enqueue styles for the admin area.
	 *
	 * @since 1.0.0
	 */
	public function enqueue_styles() {
		wp_enqueue_style( 'wp-color-picker' );

		wp_enqueue_style( 
			AYG_SLUG . '-admin', 
			AYG_URL . 'admin/assets/css/admin.css', 
			array(), 
			AYG_VERSION, 
			'all' 
		);
	}

	/**
	 * Enqueue scripts for the admin area.
	 *
	 * @since 1.0.0
	 */
	public function enqueue_scripts() {
		wp_enqueue_media();
		wp_enqueue_script( 'wp-color-picker' );

		wp_enqueue_script( 
			AYG_SLUG . '-admin', 
			AYG_URL . 'admin/assets/js/admin.js', 
			array( 'jquery' ), 
			AYG_VERSION, 
			false 
		);

		wp_localize_script( 
			AYG_SLUG . '-admin', 
			'ayg_admin', 
			array(
				'i18n' => array(
					'cleared' => __( 'Cleared', 'automatic-youtube-gallery' )
				)
			)
		);		
	}	

	/**
	 * Add settings page link on the plugins menu.
	 *
	 * @since  1.0.0
	 * @param  array  $links An array of plugin action links.
	 * @return string $links Array of filtered plugin action links.
	 */
	public function plugin_action_links( $links ) {
		$settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=automatic-youtube-gallery' ), __( 'Settings', 'automatic-youtube-gallery' ) );
        array_unshift( $links, $settings_link );
		
    	return $links;
	}

	/**
	 * Display admin notice.
	 *
	 * @since 1.0.0
	 */
	public function admin_notice() {		
		$screen = get_current_screen();

		$post_type = $screen->post_type;
		if ( 'post' == $post_type || 'page' == $post_type ) {
			return;
		}
		
		if ( false == get_option( 'ayg_admin_notice_dismissed' ) ) : ?>    
            <div id="ayg-admin-notice" class="notice notice-info is-dismissible" data-security="<?php echo wp_create_nonce( 'ayg_admin_notice_nonce' ); ?>">
                <p>
					<span class="dashicons-before dashicons-video-alt3"></span> <strong><?php _e( 'Automatic YouTube Gallery', 'automatic-youtube-gallery' ); ?></strong>: 
                    <a href="https://plugins360.com/automatic-youtube-gallery/documentation/" target="_blank"><?php _e( 'Getting Started', 'automatic-youtube-gallery' ); ?></a>
					<span class="ayg-admin-notice-separator"> | </span> 
                    <a href="<?php echo admin_url( 'admin.php?page=automatic-youtube-gallery-contact' ); ?>"><?php _e( 'Contact Us', 'automatic-youtube-gallery' ); ?></a>
					<?php if ( ayg_fs()->is_not_paying() ) : ?>
						<span class="ayg-admin-notice-separator"> | </span> 
                    	<a href="<?php echo ayg_fs()->get_upgrade_url(); ?>" class="ayg-admin-notice-link-premium"><?php _e( 'Upgrade Pro', 'automatic-youtube-gallery' ); ?></a>
					<?php endif; ?>
                </p>
            </div>        
		<?php endif;		
	}

	/**
	 * Dismiss admin notice.
	 *
	 * @since 1.0.0
	 */
	public function ajax_callback_dismiss_admin_notice() {	
		check_ajax_referer( 'ayg_admin_notice_nonce', 'security' );
		
		add_option( 'ayg_admin_notice_dismissed', 1 );
		wp_die();	
	}	

}

```
