PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / 2.6.19
Search Atlas SEO – OTTO AI SEO Automation for WordPress v2.6.19
2.6.26 2.6.25 2.6.24 2.6.23 2.6.22 2.6.21 2.6.20 2.6.19 2.6.18 2.6.17 2.6.16 2.6.15 2.6.14 2.6.13 2.6.12 2.6.11 2.6.10 2.6.9 2.6.8 2.6.7 2.6.6 2.6.5 2.6.4 2.6.3 2.5.23 All 138 releases
metasync / includes / metasync-runtime-init.php

metasync-runtime-init.php in Search Atlas SEO – OTTO AI SEO Automation for WordPress 2.6.19, at includes/metasync-runtime-init.php

93 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * MetaSync — Runtime Feature Initialisers
4 *
5 * GA4 analytics, API backoff, review notice, the global metasync_get_jwt_token()
6 * accessor, and the debug mode manager. Extracted from metasync.php to
7 * keep the plugin entry file a lean bootstrap. Loaded via require_once from
8 * metasync.php; each initialiser registers its own hook. Function names and hook
9 * timing are unchanged.
10 *
11 * @package Search Atlas SEO
12 */
13
14 if (!defined('WPINC')) {
15 die;
16 }
17
18 /**
19 * Initialize GA4 Analytics for Admin Area
20 * Hooked to admin_init for proper WordPress lifecycle integration
21 * Only loads after WordPress, plugins, and themes are fully loaded
22 */
23 function metasync_init_analytics() {
24 // Only initialize in admin area (excludes AJAX and REST API requests)
25 if (is_admin() && !wp_doing_ajax() && !defined('REST_REQUEST')) {
26 Metasync_GA4::get_instance();
27 }
28 }
29 add_action('admin_init', 'metasync_init_analytics', 10);
30
31 /**
32 * Initialize API Backoff System
33 * Hooked to init for proper WordPress lifecycle integration
34 * Monitors API responses and manages exponential backoff for rate limiting
35 * @since 2.7.1
36 */
37 function metasync_init_api_backoff() {
38 if (metasync_is_non_metasync_admin_ajax()) {
39 return;
40 }
41 // Initialize backoff manager (registers HTTP response filters)
42 Metasync_API_Backoff_Manager::get_instance();
43
44 // Initialize admin notices (only in admin area)
45 if (is_admin()) {
46 Metasync_API_Backoff_Notices::get_instance();
47 }
48 }
49 add_action('init', 'metasync_init_api_backoff', 5);
50
51 /**
52 * Initialize Review Notice
53 * Shows a dismissible notice asking users to rate the plugin after a usage period
54 * @since 2.8.0
55 */
56 function metasync_init_review_notice() {
57 if (metasync_is_non_metasync_admin_ajax()) {
58 return;
59 }
60 if (is_admin()) {
61 Metasync_Review_Notice::get_instance();
62 }
63 }
64 add_action('init', 'metasync_init_review_notice');
65
66 /**
67 * Global convenience function to get active JWT token
68 * Can be called from anywhere in WordPress (themes, other plugins, etc.)
69 *
70 * @param bool $force_refresh Force generation of new token even if cached one exists
71 * @return string|false JWT token on success, false on failure
72 */
73 if (!function_exists('metasync_get_jwt_token')) {
74 function metasync_get_jwt_token($force_refresh = false)
75 {
76 return Metasync::get_jwt_token($force_refresh);
77 }
78 }
79
80
81 /**
82 * Initialize Debug Mode Manager
83 * Hooked to 'init' for proper WordPress lifecycle integration
84 */
85 function metasync_init_debug_mode_manager() {
86 if (metasync_is_non_metasync_admin_ajax()) {
87 return;
88 }
89 // Initialize the Debug Mode Manager singleton
90 Metasync_Debug_Mode_Manager::get_instance();
91 }
92 add_action('init', 'metasync_init_debug_mode_manager', 10);
93