<?php

defined( 'ABSPATH' ) || exit; // Exit if accessed directly

/*
 * Setting all options in global variables
 */
if( ! function_exists( 'gridpress_global_settings_vars' ) ) :
    add_action( 'init', 'gridpress_global_settings_vars', 1 );

    function gridpress_global_settings_vars() {

        global $gridpress_general_settings;
        global $gridpress_user_profiles_settings;

        $gridpress_general_settings = get_option( 'gridpress_general_settings', [] );
        $gridpress_user_profiles_settings = get_option( 'gridpress_user_profiles_options_data', [] );

        // Ensure arrays (safety for WP.org review)
        if ( ! is_array( $gridpress_general_settings ) ) {
            $gridpress_general_settings = [];
        }

        if ( ! is_array( $gridpress_user_profiles_settings ) ) {
            $gridpress_user_profiles_settings = [];
        }
}
endif;