Plugin Directory

Changeset 3262130


Ignore:
Timestamp:
03/26/2025 11:41:52 AM (11 months ago)
Author:
sofkpvtltd
Message:

Update file

Location:
sofk-air-conditioning-calaculate/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sofk-air-conditioning-calaculate/trunk/readme.txt

    r3253320 r3262130  
    33Tags: air conditioning, calculator, HVAC
    44Requires at least: 4.6
    5 Tested up to: 6.7.1
     5Tested up to: 6.7
    66Stable tag: 1.1
    77License: GPL2
  • sofk-air-conditioning-calaculate/trunk/sofk-air-conditioning-calculate.php

    r3253320 r3262130  
    1212License:      GPL2
    1313License URI:  https://www.gnu.org/licenses/gpl-2.0.html
    14 Text Domain:  sofk-air-conditioning-calculate
    15 Domain Path:  /languages
     14
    1615*/
     16
    1717if ( ! defined( 'ABSPATH' ) ) exit;
    18 global  $plugin_url ,$plugin_dir;
    19 $plugin_url = plugins_url()."/sofk-air-conditioning-calculate";
    20 $plugin_dir = plugin_dir_path( __FILE__ );
    21 if (!function_exists('SFACC_hook_css')) {
    22 function SFACC_hook_css() {
    23     global $wpdb,$woocommerce,$plugin_url;     
    24                           wp_enqueue_script('air_cond-prototype');             
    25                           wp_enqueue_script('air_cond_bootstrap',$plugin_url."/js/bootstrap.min.js");                             
    26                                   wp_enqueue_style( 'bootsrap-air_cond',$plugin_url."/css/bootstrap.min.css");
    27                   wp_enqueue_style( 'style-air_cond',$plugin_url."/css/air-con-cala-style.css");
    28 }
    29 add_action('wp_head', 'SFACC_hook_css');
    30 }
     18define('PLUGIN_URL', plugin_dir_url(__FILE__));
     19define('PLUGIN_DIR', plugin_dir_path(__FILE__));
     20
     21
     22function SFACC_enqueue_assets() {
     23
     24    // Register Scripts
     25    wp_register_script('air_cond_bootstrap', PLUGIN_URL . "js/bootstrap.min.js", array('jquery'), '5.3.2', true);
     26    wp_register_script('sfacc', PLUGIN_URL . "js/sfacc.js", array('jquery'), '1.0.0', true);
     27
     28    // Enqueue Scripts
     29    wp_enqueue_script('air_cond_bootstrap');
     30    wp_enqueue_script('sfacc');
     31
     32    // Register Styles
     33    wp_register_style('bootstrap-air_cond', PLUGIN_URL . "css/bootstrap.min.css", array(), '5.3.2', 'all');
     34    wp_register_style('style-air_cond', PLUGIN_URL . "css/air-con-cala-style.css", array(), '1.0.0', 'all');
     35
     36    // Enqueue Styles
     37    wp_enqueue_style('bootstrap-air_cond');
     38    wp_enqueue_style('style-air_cond');
     39
     40    // Get dynamic colors from options with default values
     41    $btn_color = get_option('btn_color', 'black');
     42    $btn_bg = get_option('btn_bg', 'transparent');
     43    $btn_border = get_option('btn_border', 'black');
     44    $btn_hover_color = get_option('btn_hover_color', 'black');
     45    $btn_hover_bg = get_option('btn_hover_bg', 'transparent');
     46    $btn_hover_border = get_option('btn_hover_border', 'black');
     47
     48    // Create dynamic CSS
     49    $custom_css = "
     50      .air_condition_cal button {
     51          background-color: {$btn_bg};
     52          border-color: {$btn_border};
     53          color: {$btn_color};
     54      }
     55      .air_condition_cal button:hover {
     56          background-color: {$btn_hover_bg};
     57          border-color: {$btn_hover_border};
     58          color: {$btn_hover_color};
     59      }
     60    ";
     61
     62    // Add inline style
     63    wp_add_inline_style('style-air_cond', $custom_css);
     64}
     65add_action('wp_enqueue_scripts', 'SFACC_enqueue_assets');
     66
     67
     68function SFACC_admin_styles() {
     69    // Enqueue WordPress default admin styles
     70    wp_enqueue_style('wp-admin');
     71
     72    // Create dynamic admin CSS
     73    $admin_custom_css = "
     74        .myheader input { width: 100%; }
     75        .myheader .button-primary { width: 10%; }
     76        .air_condition_cal_settings label {
     77            width: 100%;
     78            float: left;
     79        }
     80        .air_condition_cal_settings input[type='color'] {
     81            max-width: 40px;
     82        }
     83    ";
     84
     85    // Add inline CSS for admin panel
     86    wp_add_inline_style('wp-admin', $admin_custom_css);
     87}
     88add_action('admin_enqueue_scripts', 'SFACC_admin_styles');
     89
     90
    3191if (!function_exists('SFACC_cal_function')) {
    32   function SFACC_cal_function() {
    33   ob_start();
    34   $room_length_min = !empty(get_option('room_length_min'))?get_option('room_length_min'): 2.5;
    35   $room_length_max = !empty(get_option('room_length_max'))?get_option('room_length_max'): 10;
    36   $room_width_min = !empty(get_option('room_width_min'))?get_option('room_width_min'): 2.5;
    37   $room_width_max = !empty(get_option('room_width_max'))?get_option('room_width_max'): 10;
    38   $room_height_below_27 = !empty(get_option('room_height_below_27'))?get_option('room_height_below_27'): 1;
    39   $room_height_27_to_30 = !empty(get_option('room_height_27_to_30'))?get_option('room_height_27_to_30'): 1.1;
    40   $room_height_above_30 = !empty(get_option('room_height_above_30'))?get_option('room_height_above_30'): 1.2;
    41   $sunlight_exposure_shaded = !empty(get_option('sunlight_exposure_shaded'))?get_option('sunlight_exposure_shaded'): 1;
    42   $sunlight_exposure_sunny = !empty(get_option('sunlight_exposure_sunny'))?get_option('sunlight_exposure_sunny'): 1.15;
    43   $insulated_yes = !empty(get_option('insulated_yes'))?get_option('insulated_yes'): 1;
    44   $insulated_no = !empty(get_option('insulated_no'))?get_option('insulated_no'): '1.11';
    45   $btn_text = !empty(get_option('btn_text'))?get_option('btn_text'): 'Calculate Your Space';
    46   $btn_color = !empty(get_option('btn_color'))?get_option('btn_color'): 'black';
    47   $btn_bg = !empty(get_option('btn_bg'))?get_option('btn_bg'): 'transparent';
    48   $btn_border = !empty(get_option('btn_border'))?get_option('btn_border'): 'black';
    49   $btn_hover_color = !empty(get_option('btn_hover_color'))?get_option('btn_hover_color'): 'black';
    50   $btn_hover_bg = !empty(get_option('btn_hover_bg'))?get_option('btn_hover_bg'): 'transparent';
    51   $btn_hover_border = !empty(get_option('btn_hover_border'))?get_option('btn_hover_border'): 'black';
    52   $toshiba_ac_url = !empty(get_option('toshiba_ac_url'))?get_option('toshiba_ac_url'): plugin_dir_url( __FILE__ ).'/woocommerce-placeholder.png';
    53   $daikin_ac_url = !empty(get_option('daikin_ac_url'))?get_option('daikin_ac_url'): plugin_dir_url( __FILE__ ).'/woocommerce-placeholder.png';
    54   $contact_url = !empty(get_option('contact_url'))?get_option('contact_url'): '#';
    55   ?>
    56   <style>
    57       .air_condition_cal button{    background-color: <?php echo esc_html($btn_bg)?>;
    58       border-color: <?php echo esc_html($btn_border)?>;
    59       color: <?php echo esc_html($btn_color)?>;}
    60       .air_condition_cal button:hover{    background-color: <?php echo esc_html($btn_hover_bg)?>;
    61       border-color: <?php echo esc_html($btn_hover_border)?>;
    62       color: <?php echo esc_html($btn_hover_color)?>;}
    63   </style>
    64   <div class="air_condition_cal">
    65       <div class="container">
    66           <div class="air_condition_cal_div">
    67               <form>
    68                   <div class="form-group">
    69                       <div class="row">
    70                           <div class="col range-wrap">
    71                               <label for="length" class="form-label">Room Length</label>
    72                               <output class="bubble"></output>
    73                               <input type="range" class="form-range range" id="length"  min="<?php echo esc_html($room_length_min);?>" max="<?php echo esc_html($room_length_max);?>" step="0.5" value="0" name="length">
    74                              
    75                           </div>
    76                           <div class="col range-wrap">
    77                               <label for="width" class="form-label">Room Width</label>
    78                               <output class="bubble"></output>
    79                               <input type="range" class="form-range range" id="width"  min="<?php echo esc_html($room_width_min);?>" max="<?php echo esc_html($room_width_max);?>" step="0.5" value="0" name="width">
    80                           </div>
    81                       </div>
    82                   </div>
    83                   <div class="form-group">
    84                       <label for="exampleFormControlInput1">Room Height</label>
    85                       <div class="check_group row">
    86                           <div class="form-check form-check-inline col">
    87                             <input class="form-check-input" type="radio" name="room_height" id="room_height1" value="<?php echo esc_html($room_height_below_27);?>">
    88                             <label class="form-check-label" for="room_height1">Below 2.7m</label>
    89                           </div>
    90                           <div class="form-check form-check-inline col">
    91                             <input class="form-check-input" type="radio" name="room_height" id="room_height2" value="<?php echo esc_html($room_height_27_to_30);?>">
    92                             <label class="form-check-label" for="room_height2">2.7m to 3.0m</label>
    93                           </div>
    94                           <div class="form-check form-check-inline col">
    95                             <input class="form-check-input" type="radio" name="room_height" id="room_height3" value="<?php echo esc_html($room_height_above_30);?>">
    96                             <label class="form-check-label" for="room_height3">3.0m Above</label>
    97                           </div>
    98                       </div>
    99                   </div>
    100                   <div class="form-group">
    101                       <label for="exampleFormControlInput1">Sunlight Exposure</label>
    102                       <div class="check_group row">                       
    103                           <div class="form-check form-check-inline col">
    104                             <input class="form-check-input" type="radio" name="sunlight" id="sunlight1" value="<?php echo esc_html($sunlight_exposure_shaded);?>">
    105                             <label class="form-check-label" for="sunlight1">Shaded</label>
    106                           </div>
    107                           <div class="form-check form-check-inline col">
    108                             <input class="form-check-input" type="radio" name="sunlight" id="sunlight2" value="<?php echo esc_html($sunlight_exposure_sunny);?>">
    109                             <label class="form-check-label" for="sunlight2">Sunny</label>
    110                           </div>       
    111                       </div>             
    112                   </div>
    113                   <div class="form-group">
    114                       <label for="exampleFormControlInput1">Is the roof area insulated?</label>
    115                       <div class="check_group row">
    116                           <div class="form-check form-check-inline col">
    117                             <input class="form-check-input" type="radio" name="insulated" id="insulated1" value="<?php echo esc_html($insulated_yes);?>">
    118                             <label class="form-check-label" for="insulated1">Yes</label>
    119                           </div>
    120                           <div class="form-check form-check-inline col">
    121                             <input class="form-check-input" type="radio" name="insulated" id="insulated2" value="<?php echo esc_html($insulated_no);?>">
    122                             <label class="form-check-label" for="insulated2">No</label>
    123                           </div>   
    124                       </div>               
    125                   </div>
    126                   <span class="error_message text-danger"></span>
    127                   <div class="form-group">
    128                       <button type="button" class="air_calculate"><?php echo esc_html($btn_text);?></button>
    129                       <div class="air_cal_result">Result: <span class="result_value">NaN kW</span></div>
    130                       <div class="form-group floor-input">Floor: <span class="floor"></span></div>
    131                   </div>
    132               </form>
    133               <div class="ac_listing">
    134                   <div class="row">
    135                      
    136                   </div>
    137               </div>
    138           </div>
    139       </div>
    140   </div>
    141   <script>
    142       jQuery(".air_calculate").click(function(){
    143         flag = 1;
    144         length = jQuery('input[name="length"]').val();
    145         if(length == ''){
    146           jQuery('.error_message').html('Enter your Room Length');
    147           flag = 0;
    148           return;
    149         }
    150        
    151         width = jQuery('input[name="width"]').val();
    152         if(width == ''){
    153           jQuery('.error_message').html('Enter your Room width');
    154           flag = 0;
    155           return;
    156         }
    157        
    158         room_height = jQuery('input[name="room_height"]:checked').val();
    159      
    160         // if(room_height == '' || room_height == undefined){
    161         if(isNaN(room_height)){
    162           jQuery('.error_message').html('Enter your Room Height');
    163           flag = 0;
    164           return;
    165         }
    166        
    167         sunlight = jQuery('input[name="sunlight"]:checked').val();
    168         // if(sunlight == '' || sunlight == undefined){
    169         if(isNaN(sunlight)){
    170           jQuery('.error_message').html('Enter your Sunlight Exposure');
    171           flag = 0;
    172           return;
    173         }
    174        
    175         insulated = jQuery('input[name="insulated"]:checked').val();
    176         // if(insulated == '' || insulated == undefined){
    177         if(isNaN(insulated)){
    178           jQuery('.error_message').html('Enter your Roof Area Insulated');
    179           flag = 0;
    180           return;
    181         }
    182         result = '';
    183         Sunlight = '';
    184         rooHeight = '';
    185         width_length = (length * width);
    186         new_width_length = width_length * 0.135;
    187         if (!isNaN(room_height)) {
    188             rooHeight = new_width_length * room_height;
    189         }
    190         if (!isNaN(sunlight)) {
    191             Sunlight = rooHeight * sunlight;
    192         }
    193         if (!isNaN(insulated)) {
    194             if (insulated == '1') {
    195                 result = Sunlight * 1.1;
    196             }else{
    197                 result = Sunlight * insulated;
    198             }
    199         }
    200        
    201         // result = length * width * room_height * sunlight * insulated;
    202        
    203         if(result != ''){
    204           jQuery('.result_value').html(result.toFixed(2)+' kW');
    205           jQuery('.air_cal_result').show();
    206           jQuery('.error_message').hide();
    207           jQuery('.floor-input').show();
    208           jQuery('.floor').html(width_length.toFixed(2)+' m2');
    209         }
    210    
    211   });
    212   </script>
    213   <script>
    214       const allRanges = document.querySelectorAll(".range-wrap");
    215   allRanges.forEach(wrap => {
    216     const range = wrap.querySelector(".range");
    217     const bubble = wrap.querySelector(".bubble");
    218     range.addEventListener("input", () => {
    219       setBubble(range, bubble);
    220     });
    221     setBubble(range, bubble);
    222   });
    223   function setBubble(range, bubble) {
    224     const val = range.value;
    225     const min = range.min ? range.min : 0;
    226     const max = range.max ? range.max : 100;
    227     const newVal = Number(((val - min) * 100) / (max - min));
    228     bubble.innerHTML = val+'m';
    229     // Sorta magic numbers based on size of the native UI thumb
    230     bubble.style.left = `calc(${newVal}% + (${18 - newVal * 0.3}px))`;
    231   }
    232   </script>
    233   <?php
    234   $output = ob_get_clean();
    235     return  $output;
    236     ob_end_clean();
    237      
    238   }
    239   add_shortcode( 'air_condition_cal', 'SFACC_cal_function' );
    240 }
     92    function SFACC_cal_function() {
     93        ob_start();
     94
     95        // Get options with default values
     96        $room_length_min = get_option('room_length_min', 2.5);
     97        $room_length_max = get_option('room_length_max', 10);
     98        $room_width_min = get_option('room_width_min', 2.5);
     99        $room_width_max = get_option('room_width_max', 10);
     100        $room_height_below_27 = get_option('room_height_below_27', 1);
     101        $room_height_27_to_30 = get_option('room_height_27_to_30', 1.1);
     102        $room_height_above_30 = get_option('room_height_above_30', 1.2);
     103        $sunlight_exposure_shaded = get_option('sunlight_exposure_shaded', 1);
     104        $sunlight_exposure_sunny = get_option('sunlight_exposure_sunny', 1.15);
     105        $insulated_yes = get_option('insulated_yes', 1);
     106        $insulated_no = get_option('insulated_no', 1.11);
     107        $btn_text = get_option('btn_text', 'Calculate Your Space');
     108        $toshiba_ac_url = get_option('toshiba_ac_url', PLUGIN_URL . 'woocommerce-placeholder.png');
     109        $daikin_ac_url = get_option('daikin_ac_url', PLUGIN_URL . 'woocommerce-placeholder.png');
     110        $contact_url = get_option('contact_url', '#');
     111        ?>
     112
     113        <div class="air_condition_cal">
     114            <div class="container">
     115                <div class="air_condition_cal_div">
     116                    <form>
     117                        <div class="form-group">
     118                            <div class="row">
     119                                <div class="col range-wrap">
     120                                    <label for="length" class="form-label">Room Length</label>
     121                                    <output class="bubble"></output>
     122                                    <input type="range" class="form-range range" id="length" min="<?php echo esc_attr($room_length_min); ?>" max="<?php echo esc_attr($room_length_max); ?>" step="0.5" value="<?php echo esc_attr($room_length_min); ?>" name="length">
     123                                </div>
     124                                <div class="col range-wrap">
     125                                    <label for="width" class="form-label">Room Width</label>
     126                                    <output class="bubble"></output>
     127                                    <input type="range" class="form-range range" id="width" min="<?php echo esc_attr($room_width_min); ?>" max="<?php echo esc_attr($room_width_max); ?>" step="0.5" value="<?php echo esc_attr($room_width_min); ?>" name="width">
     128                                </div>
     129                            </div>
     130                        </div>
     131
     132                        <div class="form-group">
     133                            <label for="room_height">Room Height</label>
     134                            <div class="check_group row">
     135                                <div class="form-check form-check-inline col">
     136                                    <input class="form-check-input" type="radio" name="room_height" id="room_height1" value="<?php echo esc_attr($room_height_below_27); ?>">
     137                                    <label class="form-check-label" for="room_height1">Below 2.7m</label>
     138                                </div>
     139                                <div class="form-check form-check-inline col">
     140                                    <input class="form-check-input" type="radio" name="room_height" id="room_height2" value="<?php echo esc_attr($room_height_27_to_30); ?>">
     141                                    <label class="form-check-label" for="room_height2">2.7m to 3.0m</label>
     142                                </div>
     143                                <div class="form-check form-check-inline col">
     144                                    <input class="form-check-input" type="radio" name="room_height" id="room_height3" value="<?php echo esc_attr($room_height_above_30); ?>">
     145                                    <label class="form-check-label" for="room_height3">3.0m Above</label>
     146                                </div>
     147                            </div>
     148                        </div>
     149
     150                        <div class="form-group">
     151                            <label for="sunlight">Sunlight Exposure</label>
     152                            <div class="check_group row">
     153                                <div class="form-check form-check-inline col">
     154                                    <input class="form-check-input" type="radio" name="sunlight" id="sunlight1" value="<?php echo esc_attr($sunlight_exposure_shaded); ?>">
     155                                    <label class="form-check-label" for="sunlight1">Shaded</label>
     156                                </div>
     157                                <div class="form-check form-check-inline col">
     158                                    <input class="form-check-input" type="radio" name="sunlight" id="sunlight2" value="<?php echo esc_attr($sunlight_exposure_sunny); ?>">
     159                                    <label class="form-check-label" for="sunlight2">Sunny</label>
     160                                </div>
     161                            </div>
     162                        </div>
     163
     164                        <div class="form-group">
     165                            <label for="insulated">Is the roof area insulated?</label>
     166                            <div class="check_group row">
     167                                <div class="form-check form-check-inline col">
     168                                    <input class="form-check-input" type="radio" name="insulated" id="insulated1" value="<?php echo esc_attr($insulated_yes); ?>">
     169                                    <label class="form-check-label" for="insulated1">Yes</label>
     170                                </div>
     171                                <div class="form-check form-check-inline col">
     172                                    <input class="form-check-input" type="radio" name="insulated" id="insulated2" value="<?php echo esc_attr($insulated_no); ?>">
     173                                    <label class="form-check-label" for="insulated2">No</label>
     174                                </div>
     175                            </div>
     176                        </div>
     177
     178                        <span class="error_message text-danger"></span>
     179                        <div class="form-group">
     180                            <button type="button" class="air_calculate"><?php echo esc_html($btn_text); ?></button>
     181                            <div class="air_cal_result">Result: <span class="result_value">NaN kW</span></div>
     182                            <div class="form-group floor-input">Floor: <span class="floor"></span></div>
     183                        </div>
     184                    </form>
     185                </div>
     186            </div>
     187        </div>
     188
     189        <?php
     190        return ob_get_clean();
     191    }
     192    add_shortcode('air_condition_cal', 'SFACC_cal_function');
     193}
     194
     195
    241196/* air condition calculation admin setting*/
    242197add_action('admin_menu', 'SFACC_cal_create_menu');
     
    250205}
    251206if (!function_exists('SFACC_cool_plugin_settings')) {
    252 function SFACC_cool_plugin_settings() {
    253     //register our settings
    254     register_setting( 'SFACC-cool-plugin-settings-group', 'room_length_min' );
    255     register_setting( 'SFACC-cool-plugin-settings-group', 'room_length_max' );
    256     register_setting( 'SFACC-cool-plugin-settings-group', 'room_width_min' );
    257     register_setting( 'SFACC-cool-plugin-settings-group', 'room_width_max' );
    258     register_setting( 'SFACC-cool-plugin-settings-group', 'room_height_below_27' );
    259     register_setting( 'SFACC-cool-plugin-settings-group', 'room_height_27_to_30' );
    260     register_setting( 'SFACC-cool-plugin-settings-group', 'room_height_above_30' );
    261     register_setting( 'SFACC-cool-plugin-settings-group', 'sunlight_exposure_shaded' );
    262     register_setting( 'SFACC-cool-plugin-settings-group', 'sunlight_exposure_sunny' );
    263     register_setting( 'SFACC-cool-plugin-settings-group', 'insulated_yes' );
    264     register_setting( 'SFACC-cool-plugin-settings-group', 'insulated_no' );
    265     register_setting( 'SFACC-cool-plugin-settings-group', 'btn_text' );
    266     register_setting( 'SFACC-cool-plugin-settings-group', 'btn_color' );
    267     register_setting( 'SFACC-cool-plugin-settings-group', 'btn_bg' );
    268     register_setting( 'SFACC-cool-plugin-settings-group', 'btn_border' );
    269     register_setting( 'SFACC-cool-plugin-settings-group', 'btn_hover_color' );
    270     register_setting( 'SFACC-cool-plugin-settings-group', 'btn_hover_bg' );
    271     register_setting( 'SFACC-cool-plugin-settings-group', 'btn_hover_border' );
    272     register_setting( 'SFACC-cool-plugin-settings-group', 'toshiba_ac_url' );
    273     register_setting( 'SFACC-cool-plugin-settings-group', 'daikin_ac_url' );
    274     register_setting( 'SFACC-cool-plugin-settings-group', 'contact_url' );
    275 }
    276 }
     207    function SFACC_cool_plugin_settings() {
     208        // Register settings with proper sanitization functions
     209        register_setting( 'SFACC-cool-plugin-settings-group', 'room_length_min', 'sanitize_text_field' );
     210        register_setting( 'SFACC-cool-plugin-settings-group', 'room_length_max', 'sanitize_text_field' );
     211        register_setting( 'SFACC-cool-plugin-settings-group', 'room_width_min', 'sanitize_text_field' );
     212        register_setting( 'SFACC-cool-plugin-settings-group', 'room_width_max', 'sanitize_text_field' );
     213        register_setting( 'SFACC-cool-plugin-settings-group', 'room_height_below_27', 'sanitize_text_field' );
     214        register_setting( 'SFACC-cool-plugin-settings-group', 'room_height_27_to_30', 'sanitize_text_field' );
     215        register_setting( 'SFACC-cool-plugin-settings-group', 'room_height_above_30', 'sanitize_text_field' );
     216        register_setting( 'SFACC-cool-plugin-settings-group', 'sunlight_exposure_shaded', 'sanitize_text_field' );
     217        register_setting( 'SFACC-cool-plugin-settings-group', 'sunlight_exposure_sunny', 'sanitize_text_field' );
     218        register_setting( 'SFACC-cool-plugin-settings-group', 'insulated_yes', 'sanitize_text_field' );
     219        register_setting( 'SFACC-cool-plugin-settings-group', 'insulated_no', 'sanitize_text_field' );
     220        register_setting( 'SFACC-cool-plugin-settings-group', 'btn_text', 'sanitize_text_field' );
     221       
     222        // Colors should be sanitized using sanitize_hex_color if they are in hex format
     223        register_setting( 'SFACC-cool-plugin-settings-group', 'btn_color', 'sanitize_hex_color' );
     224        register_setting( 'SFACC-cool-plugin-settings-group', 'btn_bg', 'sanitize_hex_color' );
     225        register_setting( 'SFACC-cool-plugin-settings-group', 'btn_border', 'sanitize_hex_color' );
     226        register_setting( 'SFACC-cool-plugin-settings-group', 'btn_hover_color', 'sanitize_hex_color' );
     227        register_setting( 'SFACC-cool-plugin-settings-group', 'btn_hover_bg', 'sanitize_hex_color' );
     228        register_setting( 'SFACC-cool-plugin-settings-group', 'btn_hover_border', 'sanitize_hex_color' );
     229       
     230        // URLs should be sanitized using esc_url_raw
     231        register_setting( 'SFACC-cool-plugin-settings-group', 'toshiba_ac_url', 'esc_url_raw' );
     232        register_setting( 'SFACC-cool-plugin-settings-group', 'daikin_ac_url', 'esc_url_raw' );
     233        register_setting( 'SFACC-cool-plugin-settings-group', 'contact_url', 'esc_url_raw' );
     234    }
     235}
     236
    277237if (!function_exists('SFACC_cal_settings_page')) {
    278238  function SFACC_cal_settings_page() {
    279239  ?>
    280   <style>
    281   .myheader input{ width: 100%; }
    282   .myheader .button-primary { width: 10%; }
    283   .air_condition_cal_settings label{    width: 100%;
    284       float: left;}
    285   .air_condition_cal_settings input[type='color']{max-width: 40px;}
    286   </style>
    287240  <div class="wrap myheader">
    288241  <h1>Air Condition Cal Settings</h1>
Note: See TracChangeset for help on using the changeset viewer.