| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> |
| 2 |
<?php |
| 3 |
|
| 4 |
include('settings.php'); // Load the files to get the databse info |
| 5 |
|
| 6 |
// ---------------------------------------------- |
| 7 |
// checking if the data existing on the db and |
| 8 |
// if not we will create it with initial settings |
| 9 |
// ---------------------------------------------- |
| 10 |
|
| 11 |
if( !get_option($wp_options_name) ) { |
| 12 |
|
| 13 |
// ---------------------------------------------- |
| 14 |
// getting all the values and clear data |
| 15 |
// ---------------------------------------------- |
| 16 |
|
| 17 |
$display_button_checkbox = 1; |
| 18 |
|
| 19 |
$background_color = '#09547c'; |
| 20 |
$button_width = 45; |
| 21 |
$button_height = 45; |
| 22 |
$button_movment = 'fixed'; |
| 23 |
|
| 24 |
$horizontal_position = 'left'; |
| 25 |
$horizontal_spacing = '0px'; |
| 26 |
$vertical_position = 'top'; |
| 27 |
$vertical_spacing = '50px'; |
| 28 |
|
| 29 |
// getting the image arrow icon |
| 30 |
$icon_image_url = plugin_dir_url(dirname(__FILE__)) . 'images/accessibility-icon.png'; |
| 31 |
|
| 32 |
$hide_on_mobile_checkbox = 0; |
| 33 |
$hide_on_desktop_checkbox = 0; |
| 34 |
$mobile_width = 960; |
| 35 |
$mobile_button_position_checkbox = 0; |
| 36 |
$mobile_horizontal_position = 'left'; |
| 37 |
$mobile_horizontal_spacing = '0px'; |
| 38 |
$mobile_vertical_position = 'top'; |
| 39 |
$mobile_vertical_spacing = '0px'; |
| 40 |
$accessibility_background_color = '#157cb0'; |
| 41 |
$accessibility_page_url = ''; |
| 42 |
$accessibility_page_text = __('Accessibility Statement', 'yydevelopment-accessibility'); |
| 43 |
|
| 44 |
$z_index = 99999; |
| 45 |
|
| 46 |
$exclude_option = ''; |
| 47 |
$exclude_ids = ''; |
| 48 |
|
| 49 |
// ---------------------------------------------- |
| 50 |
// insert the data into an array |
| 51 |
// ---------------------------------------------- |
| 52 |
|
| 53 |
$plugin_data_array = array( |
| 54 |
'display_button_checkbox' => $display_button_checkbox, |
| 55 |
'background_color' => $background_color, |
| 56 |
'button_width' => $button_width, |
| 57 |
'button_height' => $button_height, |
| 58 |
'button_movment' => $button_movment, |
| 59 |
'horizontal_position' => $horizontal_position, |
| 60 |
'horizontal_spacing' => $horizontal_spacing, |
| 61 |
'vertical_position' => $vertical_position, |
| 62 |
'vertical_spacing' => $vertical_spacing, |
| 63 |
'icon_image_url' => $icon_image_url, |
| 64 |
'hide_on_mobile_checkbox' => $hide_on_mobile_checkbox, |
| 65 |
'hide_on_desktop_checkbox' => $hide_on_desktop_checkbox, |
| 66 |
'mobile_width' => $mobile_width, |
| 67 |
'mobile_button_position_checkbox' => $mobile_button_position_checkbox, |
| 68 |
'mobile_horizontal_position' => $mobile_horizontal_position, |
| 69 |
'mobile_horizontal_spacing' => $mobile_horizontal_spacing, |
| 70 |
'mobile_vertical_position' => $mobile_vertical_position, |
| 71 |
'mobile_vertical_spacing' => $mobile_vertical_spacing, |
| 72 |
'accessibility_background_color' => $accessibility_background_color, |
| 73 |
'accessibility_page_url' => $accessibility_page_url, |
| 74 |
'accessibility_page_text' => $accessibility_page_text, |
| 75 |
'z_index' => $z_index, |
| 76 |
|
| 77 |
'exclude_option' => $exclude_option, |
| 78 |
'exclude_ids' => $exclude_ids, |
| 79 |
); // $creating_data_array = array( |
| 80 |
|
| 81 |
// ---------------------------------------------- |
| 82 |
// creating a value with all the array data |
| 83 |
// ---------------------------------------------- |
| 84 |
|
| 85 |
$array_key_name = ""; |
| 86 |
$array_item_value = ""; |
| 87 |
|
| 88 |
foreach($plugin_data_array as $key=>$item) { |
| 89 |
$array_key_name .= "####" . $key; |
| 90 |
$array_item_value .= "####" . $item; |
| 91 |
} // foreach($medical_form_array as $key=>$item) { |
| 92 |
|
| 93 |
// ---------------------------------------------- |
| 94 |
// inserting all the data to datbase |
| 95 |
// ---------------------------------------------- |
| 96 |
|
| 97 |
$plugin_data = $array_key_name . "***" . $array_item_value; |
| 98 |
$plugin_data = sanitize_text_field($plugin_data); |
| 99 |
|
| 100 |
// update optuon on the database into wp_options |
| 101 |
update_option($wp_options_name, $plugin_data); |
| 102 |
|
| 103 |
} // if( !get_option($wp_options_name) ) { |