PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 2.3.2
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v2.3.2
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
← All changes | includes/init.php +45 -6 1.6.22.3.2 View file →
@@ -44,8 +44,9 @@
44 44 $this->set_locale();
45 45 $this->define_admin_hooks();
46 46 $this->define_public_hooks();
47 47 $this->define_block_hooks();
48 + $this->define_widget_hooks();
48 49 }
49 50
50 51 /**
51 52 * Load the required dependencies for this plugin.
@@ -81,9 +82,9 @@
81 82
82 83 /**
83 84 * The classes responsible for defining all actions that occur in the admin area.
84 85 */
85 - require_once AYG_DIR . 'admin/admin.php';
86 + require_once AYG_DIR . 'admin/admin.php';
86 87 require_once AYG_DIR . 'admin/settings.php';
87 88
88 89 /**
89 90 * The class responsible for defining all actions that occur in the public-facing
@@ -89,13 +90,19 @@
89 90 * The class responsible for defining all actions that occur in the public-facing
90 91 * side of the site.
91 92 */
92 93 require_once AYG_DIR . 'public/public.php';
94 + require_once AYG_DIR . 'public/cron.php';
93 95
94 96 /**
95 97 * The class responsible for defining all actions that occur in the gutenberg block.
96 98 */
97 - require_once AYG_DIR. 'block/block.php';
99 + require_once AYG_DIR. 'block/block.php';
100 +
101 + /**
102 + * The class responsible for defining all actions that occur in the widget.
103 + */
104 + require_once AYG_DIR . 'widget/widget.php';
98 105
99 106 /**
100 107 * Create an instance of the loader.
101 108 */
@@ -123,11 +130,13 @@
123 130 private function define_admin_hooks() {
124 131 // Hooks common to all admin pages
125 132 $admin = new AYG_Admin();
126 133
134 + $this->loader->add_action( 'admin_init', $admin, 'insert_missing_options', 1 );
127 135 $this->loader->add_action( 'admin_enqueue_scripts', $admin, 'enqueue_styles' );
128 136 $this->loader->add_action( 'admin_enqueue_scripts', $admin, 'enqueue_scripts' );
129 137 $this->loader->add_action( 'admin_menu', $admin, 'admin_menu' );
138 + $this->loader->add_action( 'admin_notices', $admin, 'admin_notices' );
130 139 $this->loader->add_action( 'wp_ajax_ayg_save_api_key', $admin, 'ajax_callback_save_api_key' );
131 140
132 141 $this->loader->add_filter( 'plugin_action_links_' . AYG_FILE_NAME, $admin, 'plugin_action_links' );
133 142
@@ -135,9 +144,9 @@
135 144 $settings = new AYG_Admin_Settings();
136 145
137 146 $this->loader->add_action( 'admin_menu', $settings, 'admin_menu' );
138 147 $this->loader->add_action( 'admin_init', $settings, 'admin_init' );
139 - $this->loader->add_action( 'wp_ajax_ayg_delete_cache', $settings, 'ajax_callback_delete_cache' );
148 + $this->loader->add_action( 'wp_ajax_ayg_delete_cache', $settings, 'ajax_callback_delete_cache' );
140 149 }
141 150
142 151 /**
143 152 * Register all of the hooks related to the public-facing functionality
@@ -146,17 +155,28 @@
146 155 * @since 1.0.0
147 156 * @access private
148 157 */
149 158 private function define_public_hooks() {
159 + // Hooks common to all public pages
150 160 $public = new AYG_Public();
151 -
161 +
152 162 $this->loader->add_action( 'wp_enqueue_scripts', $public, 'register_styles' );
153 163 $this->loader->add_action( 'wp_enqueue_scripts', $public, 'register_scripts' );
154 164 $this->loader->add_action( 'enqueue_block_editor_assets', $public, 'enqueue_block_editor_assets' );
155 165 $this->loader->add_action( 'wp_ajax_ayg_load_more_videos', $public, 'ajax_callback_load_more_videos' );
156 166 $this->loader->add_action( 'wp_ajax_nopriv_ayg_load_more_videos', $public, 'ajax_callback_load_more_videos' );
167 + $this->loader->add_action( 'wp_ajax_ayg_set_cookie', $public, 'set_gdpr_cookie' );
168 + $this->loader->add_action( 'wp_ajax_nopriv_ayg_set_cookie', $public, 'set_gdpr_cookie' );
157 169
158 170 $this->loader->add_filter( 'smush_skip_iframe_from_lazy_load', $public, 'smush', 999, 2 );
171 +
172 + // Hooks specific to the cron jobs
173 + $cron = new AYG_Public_Cron();
174 +
175 + $this->loader->add_action( 'wp', $cron, 'schedule_events' );
176 + $this->loader->add_action( 'ayg_schedule_weekly', $cron, 'cron_event' );
177 +
178 + $this->loader->add_filter( 'cron_schedules', $cron, 'cron_schedules' );
159 179 }
160 180
161 181 /**
162 182 * Register all of the hooks related to the gutenberg block.
@@ -181,11 +201,30 @@
181 201 $this->loader->add_filter( 'block_categories_all', $block, 'block_categories' );
182 202 } else {
183 203 $this->loader->add_filter( 'block_categories', $block, 'block_categories' );
184 204 }
185 - }
205 + }
206 +
207 + /**
208 + * Register all of the hooks related to the widget.
209 + *
210 + * @since 2.1.0
211 + * @access private
212 + */
213 + private function define_widget_hooks() {
214 + $this->loader->add_action( 'widgets_init', $this, 'register_widget' );
215 + }
186 216
187 217 /**
218 + * Register the widget.
219 + *
220 + * @since 2.1.0
221 + */
222 + public function register_widget() {
223 + register_widget( 'AYG_Widget' );
224 + }
225 +
226 + /**
188 227 * Run the loader to execute all of the hooks with WordPress.
189 228 *
190 229 * @since 1.0.0
191 230 */
@@ -192,5 +231,5 @@
192 231 public function run() {
193 232 $this->loader->run();
194 233 }
195 234
196 -}
235 +}