options = $options; $this->settings = $settings; } /** * Return an array of events that this subscriber wants to listen to. * * @return array */ public static function get_subscribed_events() { return [ 'admin_notices' => [ [ 'maybe_display_preload_notice' ], ], 'rocket_options_changed' => 'preload_homepage', 'switch_theme' => 'preload_homepage', 'rocket_after_clean_used_css' => 'preload_homepage', 'rocket_input_sanitize' => 'sanitize_options', ]; } /** * Maybe display the preload notice. * * @return void */ public function maybe_display_preload_notice() { $this->settings->maybe_display_preload_notice(); } /** * Preload the homepage after changing the settings * * @return void */ public function preload_homepage() { $this->settings->preload_homepage(); } /** * Sanitizes Preload Excluded URI option when saving the settings * * @param array $input Array of values submitted from the form. * * @return array */ public function sanitize_options( $input ) : array { if ( empty( $input['preload_excluded_uri'] ) ) { $input['preload_excluded_uri'] = []; return $input; } $input['preload_excluded_uri'] = rocket_sanitize_textarea_field( 'preload_excluded_uri', $input['preload_excluded_uri'] ); return $input; } }