PluginProbe
Lawwwing | Textos legales web y Banner de cookies / trunk
Lawwwing | Textos legales web y Banner de cookies vtrunk
1.5.3 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.26 1.0.27 1.0.28 1.0.29 1.0.3 All 59 releases
ibamu / options / options.php

options.php in Lawwwing | Textos legales web y Banner de cookies trunk, at options/options.php

69 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly.
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 // Include the options page logic.
8 require_once plugin_dir_path(__FILE__) . 'options-init.php';
9 require_once plugin_dir_path(__FILE__) . 'options-page.php';
10
11 /**
12 * Register styles on admin_enqueue_scripts hook.
13 */
14 function lawwwing_required_assets() {
15 wp_enqueue_style('lawwwing-admin-styles', plugins_url('../css/lw-styles.css', __FILE__ ), array(), LW_PLUGIN_VERSION);
16 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);
17 }
18 add_action('admin_enqueue_scripts', 'lawwwing_required_assets');
19
20
21 /**
22 * Adds the Lawwwing menu page to the WordPress admin.
23 */
24 function lawwwing_register_admin_menu() {
25 add_menu_page(
26 esc_html__('Lawwwing', 'text-domain'), // Page title
27 esc_html__('Lawwwing', 'text-domain'), // Menu title
28 'manage_options', // Capability
29 'ibamu', // Menu slug
30 '_lawwwing_render_options_page', // Callback function
31 'https://cdn.lawwwing.com/static/assets/img/logos/favicon/lawwwing/favicon-16x16.png', // Icon URL
32 );
33 }
34 add_action('admin_menu', 'lawwwing_register_admin_menu');
35
36 /**
37 * Callback function to render the options page content.
38 * Delegates rendering to a function from the included file.
39 */
40 function _lawwwing_render_options_page() {
41 if (function_exists('lawwwing_options_page_html')) {
42 lawwwing_options_page_html();
43 } else {
44 echo esc_html__('Options page content not available.', 'text-domain');
45 }
46 }
47
48 /**
49 * Retrieves the Lawwwing option from the WordPress database.
50 *
51 * This function determines whether the plugin is activated in a multisite
52 * environment and uses the appropriate function to fetch the option:
53 * - `get_site_option` for multisite installations.
54 * - `get_option` for single-site installations.
55 *
56 * Ensure that the correct option retrieval method is used based on the
57 * activation context to maintain compatibility with both multisite and
58 * single-site setups.
59 */
60 // Retrieve Lawwwing option using 'get_site_option' or 'get_option' based on multisite activation
61 function get_lawwwing_option($option_name) {
62 $option_function = (defined('LW_NETWORK_MODE') && LW_NETWORK_MODE === true) ? 'get_site_option' : 'get_option';
63 $lw_options = $option_function("ibamu_options");
64
65 return (!empty($lw_options) && isset($lw_options[$option_name])) ? $lw_options[$option_name] : false;
66 }
67
68 ?>
69