| @@ -82,9 +82,9 @@ | ||
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * The classes responsible for defining all actions that occur in the admin area. |
| 85 | 85 | */ |
| 86 | - require_once AYG_DIR . 'admin/admin.php'; | |
| 86 | + require_once AYG_DIR . 'admin/admin.php'; | |
| 87 | 87 | require_once AYG_DIR . 'admin/settings.php'; |
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * The class responsible for defining all actions that occur in the public-facing |
| @@ -90,8 +90,9 @@ | ||
| 90 | 90 | * The class responsible for defining all actions that occur in the public-facing |
| 91 | 91 | * side of the site. |
| 92 | 92 | */ |
| 93 | 93 | require_once AYG_DIR . 'public/public.php'; |
| 94 | + require_once AYG_DIR . 'public/cron.php'; | |
| 94 | 95 | |
| 95 | 96 | /** |
| 96 | 97 | * The class responsible for defining all actions that occur in the gutenberg block. |
| 97 | 98 | */ |
| @@ -143,9 +144,9 @@ | ||
| 143 | 144 | $settings = new AYG_Admin_Settings(); |
| 144 | 145 | |
| 145 | 146 | $this->loader->add_action( 'admin_menu', $settings, 'admin_menu' ); |
| 146 | 147 | $this->loader->add_action( 'admin_init', $settings, 'admin_init' ); |
| 147 | - $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' ); | |
| 148 | 149 | } |
| 149 | 150 | |
| 150 | 151 | /** |
| 151 | 152 | * Register all of the hooks related to the public-facing functionality |
| @@ -154,8 +155,9 @@ | ||
| 154 | 155 | * @since 1.0.0 |
| 155 | 156 | * @access private |
| 156 | 157 | */ |
| 157 | 158 | private function define_public_hooks() { |
| 159 | + // Hooks common to all public pages | |
| 158 | 160 | $public = new AYG_Public(); |
| 159 | 161 | |
| 160 | 162 | $this->loader->add_action( 'wp_enqueue_scripts', $public, 'register_styles' ); |
| 161 | 163 | $this->loader->add_action( 'wp_enqueue_scripts', $public, 'register_scripts' ); |
| @@ -165,8 +167,16 @@ | ||
| 165 | 167 | $this->loader->add_action( 'wp_ajax_ayg_set_cookie', $public, 'set_gdpr_cookie' ); |
| 166 | 168 | $this->loader->add_action( 'wp_ajax_nopriv_ayg_set_cookie', $public, 'set_gdpr_cookie' ); |
| 167 | 169 | |
| 168 | 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' ); | |
| 169 | 179 | } |
| 170 | 180 | |
| 171 | 181 | /** |
| 172 | 182 | * Register all of the hooks related to the gutenberg block. |