PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 1.2.0
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v1.2.0
2.9.1 2.9.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 2.0.0 2.1.0 2.2.0 2.3.2 2.3.3 2.3.5 2.3.6 2.3.8 2.3.9 2.4.3 All 37 releases
automatic-youtube-gallery / admin / admin.php

admin.php in Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels 1.2.0, at admin/admin.php

125 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The admin-specific functionality of the plugin.
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_Admin class.
19 *
20 * @since 1.0.0
21 */
22 class AYG_Admin {
23
24 /**
25 * Enqueue styles for the admin area.
26 *
27 * @since 1.0.0
28 */
29 public function enqueue_styles() {
30 wp_enqueue_style( 'wp-color-picker' );
31
32 wp_enqueue_style(
33 AYG_SLUG . '-admin',
34 AYG_URL . 'admin/assets/css/admin.css',
35 array(),
36 AYG_VERSION,
37 'all'
38 );
39 }
40
41 /**
42 * Enqueue scripts for the admin area.
43 *
44 * @since 1.0.0
45 */
46 public function enqueue_scripts() {
47 wp_enqueue_media();
48 wp_enqueue_script( 'wp-color-picker' );
49
50 wp_enqueue_script(
51 AYG_SLUG . '-admin',
52 AYG_URL . 'admin/assets/js/admin.js',
53 array( 'jquery' ),
54 AYG_VERSION,
55 false
56 );
57
58 wp_localize_script(
59 AYG_SLUG . '-admin',
60 'ayg_admin',
61 array(
62 'i18n' => array(
63 'cleared' => __( 'Cleared', 'automatic-youtube-gallery' )
64 )
65 )
66 );
67 }
68
69 /**
70 * Add settings page link on the plugins menu.
71 *
72 * @since 1.0.0
73 * @param array $links An array of plugin action links.
74 * @return string $links Array of filtered plugin action links.
75 */
76 public function plugin_action_links( $links ) {
77 $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=automatic-youtube-gallery' ), __( 'Settings', 'automatic-youtube-gallery' ) );
78 array_unshift( $links, $settings_link );
79
80 return $links;
81 }
82
83 /**
84 * Display admin notice.
85 *
86 * @since 1.0.0
87 */
88 public function admin_notice() {
89 $screen = get_current_screen();
90
91 $post_type = $screen->post_type;
92 if ( 'post' == $post_type || 'page' == $post_type ) {
93 return;
94 }
95
96 if ( false == get_option( 'ayg_admin_notice_dismissed' ) ) : ?>
97 <div id="ayg-admin-notice" class="notice notice-info is-dismissible" data-security="<?php echo wp_create_nonce( 'ayg_admin_notice_nonce' ); ?>">
98 <p>
99 <span class="dashicons-before dashicons-video-alt3"></span> <strong><?php _e( 'Automatic YouTube Gallery', 'automatic-youtube-gallery' ); ?></strong>:
100 <a href="https://plugins360.com/automatic-youtube-gallery/documentation/" target="_blank"><?php _e( 'Getting Started', 'automatic-youtube-gallery' ); ?></a>
101 <span class="ayg-admin-notice-separator"> | </span>
102 <a href="<?php echo admin_url( 'admin.php?page=automatic-youtube-gallery-contact' ); ?>"><?php _e( 'Contact Us', 'automatic-youtube-gallery' ); ?></a>
103 <?php if ( ayg_fs()->is_not_paying() ) : ?>
104 <span class="ayg-admin-notice-separator"> | </span>
105 <a href="<?php echo ayg_fs()->get_upgrade_url(); ?>" class="ayg-admin-notice-link-premium"><?php _e( 'Upgrade Pro', 'automatic-youtube-gallery' ); ?></a>
106 <?php endif; ?>
107 </p>
108 </div>
109 <?php endif;
110 }
111
112 /**
113 * Dismiss admin notice.
114 *
115 * @since 1.0.0
116 */
117 public function ajax_callback_dismiss_admin_notice() {
118 check_ajax_referer( 'ayg_admin_notice_nonce', 'security' );
119
120 add_option( 'ayg_admin_notice_dismissed', 1 );
121 wp_die();
122 }
123
124 }
125