HEX
Server: Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System: Linux box12.multicloud.host 4.18.0-553.52.1.el8_10.x86_64 #1 SMP Wed May 14 09:36:12 EDT 2025 x86_64
User: kashmira (1008)
PHP: 8.1.32
Disabled: NONE
Upload Files
File: /home/kashmira/public_html/razitahir.com/wp-content/plugins/stylo-core/inc/settings.php
<?php
function stylo_settings_page_html() {
    //Check if current user have admin access.
    if(!is_admin()) {
        return;
    }
        echo '<div class="wrap">';
            //echo '<h1 class="stylo-plugin-settings-head">'.esc_html(get_admin_page_title()).'</h1>';
            echo '<form action="options.php" method="post" class="stylo-setting-form">';
                // output security fields for the registered setting "stylo-settings"
                settings_fields( 'stylo-settings' );

                // output setting sections and their fields
                // (sections are registered for "stylo-settings", each field is registered to a specific section)
                do_settings_sections( 'stylo-settings' );

                // output save settings button
                submit_button( 'Save Changes' );
            echo '</form>';
        echo '</div>';

}

//Top Level Administration Menu
function stylo_register_menu_page() {
    add_menu_page(
        'STYLO THEMES SETTINGS',
        'StyloThemes',
        'manage_options',
        'stylo-settings',
        'stylo_settings_page_html',
        'dashicons-admin-generic', 0 );
}
add_action('admin_menu', 'stylo_register_menu_page');

//Sub-Level Administration Menu
/* function stylo_register_menu_page() {
    add_theme_page( 'WPAC Like System', 'WPAC Settings', 'manage_options', 'stylo-settings', 'stylo_settings_page_html', 30 );
}
add_action('admin_menu', 'stylo_register_menu_page'); */

// Register settings, sections & fields.
function stylo_plugin_settings(){

    // register settings for "stylo-settings" page
    register_setting( 'stylo-settings', 'stylothemes_license' ,['default' => '']);


    // register a new section in the "stylo-setings" page
    add_settings_section(
        'stylo_license_section',
        'Product Activation',
        'stylo_license_section_cb',
        'stylo-settings'
    );

    // register fields for settings in "stylo-settings" page

    // Form Fields
    add_settings_field(
        'stylo_license_key_field',
        'License Key',
        'stylo_license_key_field_cb',
        'stylo-settings',
        'stylo_license_section'
    );
    
}
add_action('admin_init', 'stylo_plugin_settings');

// Section callback functions
function stylo_license_section_cb(){
    _e('<p>Enter Your License Information</p>', 'stylocore');
}

// Field callback functions
// Button Label Fields Callback Functions
function stylo_license_key_field_cb(){ 
    // get the value of the setting we've registered with register_setting()

    global $stylo_sdk_license;

    $license_key = get_option('stylothemes_license', '');
    $license_validation = stylothemes_is_valid_license();


    if($license_validation == true) {
     echo '<input type="text" name="stylothemes_license" value="**************" placeholder="***********" disabled>';
    }
    else { 
        if(isset( $license_key )) {
            echo '<input type="text" name="stylothemes_license" value="'.$license_key.'" placeholder="'.$license_key.'">';
        } else {
            echo '<input type="text" name="stylothemes_license" value="" placeholder="Enter your license key">'; 
        }
    } 
    if($license_key != '') { 
        echo '<div class="license_action_btns">';
            if($license_validation == true) {
                echo '<a href="javascript:" onclick="stylo_deactivate_license()" id="deactiavtionBTN" class="button">Deactivate License</a>';
            } else {
                echo '<a href="javascript:" onclick="stylo_activate_license()" id="actiavtionBTN" class="button">Activate License</a>';
            }
            echo '</div>';
        echo '<div id="wpacAjaxResponse"><span></span></div>';
    }
    else { 
        echo '<div class="invalid-license-message">Invalid License Key</div>';
    } 
}