<?php

    // prevent direct file access
	if( !defined( 'ABSPATH' ) ) exit;
    
    function pixe_plugin_settings_general_script(){
        pixe_enqueue_admin_styles(array('utility', 'settings'));
        pixe_enqueue_admin_scripts(array('jquery', 'utility', 'plugin-option'));
        wp_localize_script('pixe-plugin-option', 'pixeData', pixe_plugin_settings_script_data(array('post-type', 'user-role')));
    }

    // content area
    function pixe_plugin_settings_general(){
        pixe_plugin_settings_head('general');

?>
<div class="pixe-plugin-settings-content" >
    <div class="pixe-plugin-settings-content-option" >
        <div class="pixe-plugin-settings-content-inner" >
            <div class="pixe-plugin-settings-tab-head" >
                <div class="pixe-title" ><?php esc_html_e('General', 'pixebuilder'); ?></div>
                <div class="pixe-description" ><?php esc_html_e('Configure how PixeBuilder behaves across your site.', 'pixebuilder'); ?></div>
            </div>
            <div class="pixe-plugin-settings-area" id="pixe-plugin-settings-area" data-type="general" data-value="<?php
                $general_settings = get_option('pixe_general', array());
                if( !empty($general_settings) ){
                    echo esc_attr(json_encode($general_settings));
                }
            ?>" ></div>
        </div>
    </div>
</div>
<?php
    }

    // save option
    function pixe_save_plugin_settings_general($value){
        if( empty($value) ){
            delete_option('pixe_general');
        }else{
            update_option('pixe_general', $value, true);
        }
    }