# ibamu/trunk/options/options.php

Lawwwing | Textos legales web y Banner de cookies, version trunk. 69 lines.

- Page: https://pluginprobe.com/plugins/ibamu/trunk/code/options/options.php
- Raw: https://pluginprobe.com/plugins/ibamu/trunk/raw/options/options.php
- Modified: 2025-05-13T10:48:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ibamu/trunk/code/options/options.php#L10-L20`.

```php
<?php
// Exit if accessed directly.
if (!defined('ABSPATH')) {
    exit;
}

// Include the options page logic.
require_once plugin_dir_path(__FILE__) . 'options-init.php';
require_once plugin_dir_path(__FILE__) . 'options-page.php';

/**
 * Register styles on admin_enqueue_scripts hook.
 */
function lawwwing_required_assets() {
    wp_enqueue_style('lawwwing-admin-styles', plugins_url('../css/lw-styles.css', __FILE__ ), array(), LW_PLUGIN_VERSION);
    wp_enqueue_style('lawwwing-font-awesome', "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css", array(), LW_PLUGIN_VERSION);
}
add_action('admin_enqueue_scripts', 'lawwwing_required_assets');


/**
 * Adds the Lawwwing menu page to the WordPress admin.
 */
function lawwwing_register_admin_menu() {
    add_menu_page(
        esc_html__('Lawwwing', 'text-domain'),   // Page title
        esc_html__('Lawwwing', 'text-domain'),   // Menu title
        'manage_options',                        // Capability
        'ibamu',                                 // Menu slug
        '_lawwwing_render_options_page',         // Callback function
        'https://cdn.lawwwing.com/static/assets/img/logos/favicon/lawwwing/favicon-16x16.png', // Icon URL
    );
}
add_action('admin_menu', 'lawwwing_register_admin_menu');

/**
 * Callback function to render the options page content.
 * Delegates rendering to a function from the included file.
 */
function _lawwwing_render_options_page() {
    if (function_exists('lawwwing_options_page_html')) {
        lawwwing_options_page_html();
    } else {
        echo esc_html__('Options page content not available.', 'text-domain');
    }
}

/**
 * Retrieves the Lawwwing option from the WordPress database.
 *
 * This function determines whether the plugin is activated in a multisite
 * environment and uses the appropriate function to fetch the option:
 * - `get_site_option` for multisite installations.
 * - `get_option` for single-site installations.
 *
 * Ensure that the correct option retrieval method is used based on the
 * activation context to maintain compatibility with both multisite and
 * single-site setups.
 */
// Retrieve Lawwwing option using 'get_site_option' or 'get_option' based on multisite activation
function get_lawwwing_option($option_name) {
    $option_function = (defined('LW_NETWORK_MODE') && LW_NETWORK_MODE === true) ? 'get_site_option' : 'get_option';
    $lw_options = $option_function("ibamu_options");

    return (!empty($lw_options) && isset($lw_options[$option_name])) ? $lw_options[$option_name] : false;
}

?>

```
