Example #1
0
function wpdev_sql_get_booking_listing($args)
{
    global $wpdb;
    $num_per_page_check = get_bk_option('bookings_num_per_page');
    if (empty($num_per_page_check)) {
        $num_per_page_check = '10';
        update_bk_option('bookings_num_per_page', $num_per_page_check);
    }
    ////////////////////////////////////////////////////////////////////////
    // CONSTANTS
    ////////////////////////////////////////////////////////////////////////
    $defaults = array('wh_booking_type' => '', 'wh_approved' => '', 'wh_booking_id' => '', 'wh_is_new' => '', 'wh_pay_status' => '', 'wh_keyword' => '', 'wh_booking_date' => '', 'wh_booking_date2' => '', 'wh_modification_date' => '', 'wh_modification_date2' => '', 'wh_cost' => '', 'wh_cost2' => '', 'or_sort' => get_bk_option('booking_sort_order'), 'page_num' => '1', 'page_items_count' => $num_per_page_check);
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $page_start = ($page_num - 1) * $page_items_count;
    $posible_sorts = array('booking_id_asc', 'sort_date', 'sort_date_asc', 'booking_type', 'booking_type_asc', 'cost', 'cost_asc');
    if ($or_sort == '' || $or_sort == 'id' || !in_array($or_sort, $posible_sorts)) {
        $or_sort = 'booking_id';
    }
    ////////////////////////////////////////////////////////////////////////
    // S Q L
    ////////////////////////////////////////////////////////////////////////
    // GET ONLY ROWS OF THE     B o o k i n g s    - So we can limit the requests
    $sql_start_select = " SELECT * ";
    $sql_start_count = " SELECT COUNT(*) as count";
    $sql = " FROM {$wpdb->prefix}booking as bk";
    $sql_where = " WHERE " . "       EXISTS (\n                                SELECT *\n                                FROM {$wpdb->prefix}bookingdates as dt\n                                WHERE  bk.booking_id = dt.booking_id ";
    if ($wh_approved !== '') {
        $sql_where .= " AND approved = {$wh_approved}  ";
    }
    // Approved or Pending
    $sql_where .= set_dates_filter_for_sql($wh_booking_date, $wh_booking_date2);
    $sql_where .= "   ) ";
    if ($wh_is_new !== '') {
        $sql_where .= " AND  bk.is_new = " . $wh_is_new . " ";
    }
    // P
    $sql_where .= apply_bk_filter('get_bklist_sql_keyword', '', $wh_keyword);
    $sql_where .= set_creation_dates_filter_for_sql($wh_modification_date, $wh_modification_date2);
    // BS
    $sql_where .= apply_bk_filter('get_bklist_sql_paystatus', '', $wh_pay_status);
    $sql_where .= apply_bk_filter('get_bklist_sql_cost', '', $wh_cost, $wh_cost2);
    // P  || BL
    $sql_where .= apply_bk_filter('get_bklist_sql_resources', '', $wh_booking_type, $wh_approved, $wh_booking_date, $wh_booking_date2);
    if (!empty($wh_booking_id)) {
        if (strpos($wh_booking_id, ',') !== false) {
            $sql_where = " WHERE bk.booking_id IN (" . $wh_booking_id . ") ";
        } else {
            $sql_where = " WHERE bk.booking_id = " . $wh_booking_id . " ";
        }
    }
    if (strpos($or_sort, '_asc') !== false) {
        // Order
        $or_sort = str_replace('_asc', '', $or_sort);
        $sql_order = " ORDER BY " . $or_sort . " ASC ";
    } else {
        $sql_order = " ORDER BY " . $or_sort . " DESC ";
    }
    // Order
    $sql_limit = $wpdb->prepare(" LIMIT %d, %d ", $page_start, $page_items_count);
    return array($sql_start_count, $sql_start_select, $sql, $sql_where, $sql_order, $sql_limit);
}
Example #2
0
 function wpdev_booking_activate()
 {
     update_bk_option('booking_version_num', WP_BK_VERSION_NUM);
     $version = get_bk_version();
     $is_demo = wpdev_bk_is_this_demo();
     load_bk_Translation();
     // set execution time to 15 minutes, its not worked if we have SAFE MODE ON at PHP
     if (function_exists('set_time_limit')) {
         if (!in_array(ini_get('safe_mode'), array('1', 'On'))) {
             set_time_limit(900);
         }
     }
     add_bk_option('booking_admin_cal_count', $is_demo ? '3' : '2');
     add_bk_option('booking_skin', '/css/skins/traditional.css');
     add_bk_option('bookings_num_per_page', '10');
     add_bk_option('booking_sort_order', '');
     add_bk_option('booking_default_toolbar_tab', 'filter');
     add_bk_option('bookings_listing_default_view_mode', 'vm_calendar');
     //,'vm_listing');
     if ($version == 'free') {
         add_bk_option('booking_view_days_num', '90');
     } else {
         add_bk_option('booking_view_days_num', '30');
     }
     // Month view for several resources
     //add_bk_option( 'booking_sort_order_direction', 'ASC');
     add_bk_option('booking_max_monthes_in_calendar', '1y');
     add_bk_option('booking_client_cal_count', '1');
     add_bk_option('booking_start_day_weeek', '0');
     add_bk_option('booking_title_after_reservation', sprintf(__('Thank you for your online booking. %s We will send confirmation of your booking as soon as possible.', 'wpdev-booking'), ''));
     add_bk_option('booking_title_after_reservation_time', '7000');
     add_bk_option('booking_type_of_thank_you_message', 'message');
     add_bk_option('booking_thank_you_page_URL', '/thank-you');
     add_bk_option('booking_is_use_autofill_4_logged_user', $is_demo ? 'On' : 'Off');
     add_bk_option('booking_date_format', get_option('date_format'));
     add_bk_option('booking_date_view_type', 'short');
     // short / wide
     add_bk_option('booking_is_delete_if_deactive', $is_demo ? 'On' : 'Off');
     // check
     add_bk_option('booking_dif_colors_approval_pending', 'On');
     add_bk_option('booking_is_use_hints_at_admin_panel', 'On');
     add_bk_option('booking_is_not_load_bs_script_in_client', 'Off');
     add_bk_option('booking_is_not_load_bs_script_in_admin', 'Off');
     // Set the type of days selections based on the previous saved data ....
     $booking_type_of_day_selections = 'multiple';
     //'single';
     if (get_bk_option('booking_multiple_day_selections') == 'On') {
         $booking_type_of_day_selections = 'multiple';
     }
     if (get_bk_option('booking_range_selection_is_active') == 'On') {
         $booking_type_of_day_selections = 'range';
     }
     if ($is_demo) {
         $booking_type_of_day_selections = 'multiple';
     }
     add_bk_option('booking_type_of_day_selections', $booking_type_of_day_selections);
     add_bk_option('booking_form_is_using_bs_css', 'On');
     add_bk_option('booking_form_format_type', 'vertical');
     add_bk_option('booking_form_field_active1', 'On');
     add_bk_option('booking_form_field_required1', 'On');
     add_bk_option('booking_form_field_label1', 'First Name');
     add_bk_option('booking_form_field_active2', 'On');
     add_bk_option('booking_form_field_required2', 'On');
     add_bk_option('booking_form_field_label2', 'Last Name');
     add_bk_option('booking_form_field_active3', 'On');
     add_bk_option('booking_form_field_required3', 'On');
     add_bk_option('booking_form_field_label3', 'Email');
     add_bk_option('booking_form_field_active4', 'On');
     add_bk_option('booking_form_field_required4', 'Off');
     add_bk_option('booking_form_field_label4', 'Phone');
     add_bk_option('booking_form_field_active5', 'On');
     add_bk_option('booking_form_field_required5', 'Off');
     add_bk_option('booking_form_field_label5', 'Details');
     add_bk_option('booking_unavailable_days_num_from_today', '0');
     add_bk_option('booking_unavailable_day0', 'Off');
     add_bk_option('booking_unavailable_day1', 'Off');
     add_bk_option('booking_unavailable_day2', 'Off');
     add_bk_option('booking_unavailable_day3', 'Off');
     add_bk_option('booking_unavailable_day4', 'Off');
     add_bk_option('booking_unavailable_day5', 'Off');
     add_bk_option('booking_unavailable_day6', 'Off');
     if ($is_demo) {
         add_bk_option('booking_user_role_booking', 'subscriber');
         add_bk_option('booking_user_role_addbooking', 'subscriber');
         add_bk_option('booking_user_role_resources', 'subscriber');
         add_bk_option('booking_user_role_settings', 'subscriber');
     } else {
         add_bk_option('booking_user_role_booking', 'editor');
         add_bk_option('booking_user_role_addbooking', 'editor');
         add_bk_option('booking_user_role_resources', 'editor');
         add_bk_option('booking_user_role_settings', 'administrator');
     }
     $blg_title = get_option('blogname');
     $blg_title = str_replace('"', '', $blg_title);
     $blg_title = str_replace("'", '', $blg_title);
     add_bk_option('booking_email_reservation_adress', htmlspecialchars('"Booking system" <' . get_option('admin_email') . '>'));
     add_bk_option('booking_email_reservation_from_adress', '[visitoremail]');
     //htmlspecialchars('"Booking system" <' .get_option('admin_email').'>'));
     add_bk_option('booking_email_reservation_subject', __('New booking', 'wpdev-booking'));
     add_bk_option('booking_email_reservation_content', htmlspecialchars(sprintf(__('You need to approve a new booking %s for: %s Person detail information:%s Currently a new booking is waiting for approval. Please visit the moderation panel%sThank you, %s', 'wpdev-booking'), '[bookingtype]', '[dates]<br/><br/>', '<br/> [content]<br/><br/>', ' [moderatelink]<br/><br/>', $blg_title . '<br/>[siteurl]')));
     add_bk_option('booking_email_approval_adress', htmlspecialchars('"Booking system" <' . get_option('admin_email') . '>'));
     add_bk_option('booking_email_approval_subject', __('Your booking has been approved', 'wpdev-booking'));
     if ($this->wpdev_bk_personal !== false) {
         add_bk_option('booking_email_approval_content', htmlspecialchars(sprintf(__('Your reservation %s for: %s has been approved.%sYou can edit the booking on this page: %s Thank you, %s', 'wpdev-booking'), '[bookingtype]', '[dates]', '<br/><br/>[content]<br/><br/>', '[visitorbookingediturl]<br/><br/>', $blg_title . '<br/>[siteurl]')));
     } else {
         add_bk_option('booking_email_approval_content', htmlspecialchars(sprintf(__('Your booking %s for: %s has been approved.%sThank you, %s', 'wpdev-booking'), '[bookingtype]', '[dates]', '<br/><br/>[content]<br/><br/>', $blg_title . '<br/>[siteurl]')));
     }
     add_bk_option('booking_email_deny_adress', htmlspecialchars('"Booking system" <' . get_option('admin_email') . '>'));
     add_bk_option('booking_email_deny_subject', __('Your booking has been declined', 'wpdev-booking'));
     add_bk_option('booking_email_deny_content', htmlspecialchars(sprintf(__('Your booking %s for: %s has been  canceled. %sThank you, %s', 'wpdev-booking'), '[bookingtype]', '[dates]', '<br/><br/>[denyreason]<br/><br/>[content]<br/><br/>', $blg_title . '<br/>[siteurl]')));
     add_bk_option('booking_is_email_reservation_adress', 'On');
     add_bk_option('booking_is_email_approval_adress', 'On');
     add_bk_option('booking_is_email_deny_adress', 'On');
     add_bk_option('booking_widget_title', __('Booking form', 'wpdev-booking'));
     add_bk_option('booking_widget_show', 'booking_form');
     add_bk_option('booking_widget_type', '1');
     add_bk_option('booking_widget_calendar_count', '1');
     add_bk_option('booking_widget_last_field', '');
     add_bk_option('booking_wpdev_copyright_adminpanel', 'On');
     add_bk_option('booking_is_show_powered_by_notice', 'On');
     add_bk_option('booking_is_use_captcha', 'Off');
     add_bk_option('booking_is_show_legend', 'Off');
     add_bk_option('booking_legend_is_show_item_available', 'On');
     add_bk_option('booking_legend_text_for_item_available', __('Available', 'wpdev-booking'));
     add_bk_option('booking_legend_is_show_item_pending', 'On');
     add_bk_option('booking_legend_text_for_item_pending', __('Pending', 'wpdev-booking'));
     add_bk_option('booking_legend_is_show_item_approved', 'On');
     add_bk_option('booking_legend_text_for_item_approved', __('Booked', 'wpdev-booking'));
     if (class_exists('wpdev_bk_biz_s')) {
         add_bk_option('booking_legend_is_show_item_partially', 'On');
         add_bk_option('booking_legend_text_for_item_partially', __('Partially booked', 'wpdev-booking'));
     }
     // Create here tables which is needed for using plugin
     global $wpdb;
     $charset_collate = '';
     //if ( $wpdb->has_cap( 'collation' ) ) {
     if (!empty($wpdb->charset)) {
         $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
     }
     if (!empty($wpdb->collate)) {
         $charset_collate .= " COLLATE {$wpdb->collate}";
     }
     //}
     $wp_queries = array();
     if (!$this->is_table_exists('booking')) {
         // Cehck if tables not exist yet
         $simple_sql = "CREATE TABLE {$wpdb->prefix}booking (\n                     booking_id bigint(20) unsigned NOT NULL auto_increment,\n                     form text ,\n                     booking_type bigint(10) NOT NULL default 1,\n                     PRIMARY KEY  (booking_id)\n                    ) {$charset_collate};";
         $wpdb->query($simple_sql);
     } elseif ($this->is_field_in_table_exists('booking', 'form') == 0) {
         $wp_queries[] = "ALTER TABLE {$wpdb->prefix}booking ADD form TEXT AFTER booking_id";
     }
     if ($this->is_field_in_table_exists('booking', 'modification_date') == 0) {
         $wp_queries[] = "ALTER TABLE {$wpdb->prefix}booking ADD modification_date datetime AFTER booking_id";
     }
     if ($this->is_field_in_table_exists('booking', 'sort_date') == 0) {
         $wp_queries[] = "ALTER TABLE {$wpdb->prefix}booking ADD sort_date datetime AFTER booking_id";
     }
     if ($this->is_field_in_table_exists('booking', 'status') == 0) {
         $wp_queries[] = "ALTER TABLE {$wpdb->prefix}booking ADD status varchar(200) NOT NULL default '' AFTER booking_id";
     }
     if ($this->is_field_in_table_exists('booking', 'is_new') == 0) {
         $wp_queries[] = "ALTER TABLE {$wpdb->prefix}booking ADD is_new bigint(10) NOT NULL default 1 AFTER booking_id";
     }
     if (!$this->is_table_exists('bookingdates')) {
         // Cehck if tables not exist yet
         $simple_sql = "CREATE TABLE {$wpdb->prefix}bookingdates (\n                     booking_id bigint(20) unsigned NOT NULL,\n                     booking_date datetime NOT NULL default '0000-00-00 00:00:00',\n                     approved bigint(20) unsigned NOT NULL default 0\n                    ) {$charset_collate}";
         $wpdb->query($simple_sql);
         if ($this->wpdev_bk_personal == false) {
             $wp_queries[] = "INSERT INTO {$wpdb->prefix}booking ( form, modification_date ) VALUES (\n                     'text^name1^Jony~text^secondname1^Smith~text^email1^example-free@wpbookingcalendar.com~text^phone1^8(038)458-77-77~textarea^details1^Reserve a room with sea view', NOW() );";
         }
     }
     if (!class_exists('wpdev_bk_biz_l')) {
         if ($this->is_index_in_table_exists('bookingdates', 'booking_id_dates') == 0) {
             $simple_sql = "CREATE UNIQUE INDEX booking_id_dates ON {$wpdb->prefix}bookingdates (booking_id, booking_date);";
             $wpdb->query($simple_sql);
         }
     } else {
         if ($this->is_index_in_table_exists('bookingdates', 'booking_id_dates') != 0) {
             $simple_sql = "DROP INDEX booking_id_dates ON  {$wpdb->prefix}bookingdates ;";
             $wpdb->query($simple_sql);
         }
     }
     if (count($wp_queries) > 0) {
         foreach ($wp_queries as $wp_q) {
             $wpdb->query($wp_q);
         }
         if ($this->wpdev_bk_personal == false) {
             $temp_id = $wpdb->insert_id;
             $wp_queries_sub = "INSERT INTO {$wpdb->prefix}bookingdates (\n                         booking_id,\n                         booking_date\n                        ) VALUES\n                        ( " . $temp_id . ", CURDATE()+ INTERVAL 2 day ),\n                        ( " . $temp_id . ", CURDATE()+ INTERVAL 3 day ),\n                        ( " . $temp_id . ", CURDATE()+ INTERVAL 4 day );";
             $wpdb->query($wp_queries_sub);
         }
     }
     // if( $this->wpdev_bk_personal !== false )  $this->wpdev_bk_personal->pro_activate();
     make_bk_action('wpdev_booking_activation');
     // Examples in demos
     if ($is_demo) {
         $this->createExamples4Demo();
     }
     /*
             // Fill Development server by initial bookings
             if (  $_SERVER['HTTP_HOST'] === 'dev'  ) {  
                 for ($i = 0; $i < 5; $i++) {
                     //if (!class_exists('wpdev_bk_personal')) 
                     $this->createExamples4Demo( array(1,2,3,4,5,6,7,8,9,10,11,12) ); 
                 }
             }
             $this->setDefaultInitialValues();/**/
     $this->reindex_booking_db();
 }
function wpdev_bk_settings_form_labels()
{
    ?>
            <div class="clear" style="height:0px;"></div>
            <div id="ajax_working"></div>
            <div id="poststuff0" class="metabox-holder">
                <form  name="post_settings_form_fields" action="" method="post" id="post_settings_form_fields" class="form-horizontal">
                
                  <div id="visibility_container_form_fields" class="visibility_container wpdevbk" style="display:block;">
                    <div class='meta-box'>
                        <div <?php 
    $my_close_open_win_id = 'bk_settings_form_fields';
    ?>
  id="<?php 
    echo $my_close_open_win_id;
    ?>
" class="postbox <?php 
    if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
        echo 'closed';
    }
    ?>
" > <div title="<?php 
    _e('Click to toggle', 'wpdev-booking');
    ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
    echo get_bk_current_user_id();
    ?>
, '<?php 
    echo $my_close_open_win_id;
    ?>
');"><br></div>
                            <h3 class='hndle'><span><?php 
    _e('Form fields labels', 'wpdev-booking');
    ?>
</span></h3><div class="inside">

                                
                                <?php 
    // FIELD # 1 //////////////////////////////////////////////////////////////////////////////////////////////////////////
    if (isset($_POST['Submit'])) {
        if (isset($_POST['booking_form_field_active1'])) {
            $booking_form_field_active1 = 'On';
        } else {
            $booking_form_field_active1 = 'Off';
        }
        update_bk_option('booking_form_field_active1', $booking_form_field_active1);
        if (isset($_POST['booking_form_field_required1'])) {
            $booking_form_field_required1 = 'On';
        } else {
            $booking_form_field_required1 = 'Off';
        }
        update_bk_option('booking_form_field_required1', $booking_form_field_required1);
        update_bk_option('booking_form_field_label1', $_POST['booking_form_field_label1']);
    }
    $booking_form_field_active1 = get_bk_option('booking_form_field_active1');
    $booking_form_field_required1 = get_bk_option('booking_form_field_required1');
    $booking_form_field_label1 = get_bk_option('booking_form_field_label1');
    ?>
                                <div class="control-group">
                                  <label for="name" class="control-label" style="font-weight:bold;"><?php 
    _e('Field Label', 'wpdev-booking');
    ?>
 #1:</label>
                                  <div class="controls"> 
                                      
                                    <input type="text" class="large-text" 
                                           name="booking_form_field_label1" value="<?php 
    echo $booking_form_field_label1;
    ?>
">&nbsp;&nbsp;&nbsp;
                                    
                                    <label class="checkbox inline">
                                        <input type="checkbox"  name="booking_form_field_active1"
                                            <?php 
    if ($booking_form_field_active1 == 'On') {
        echo ' checked="checked" ';
    }
    ?>
  
                                            value="<?php 
    echo $booking_form_field_active1;
    ?>
" >
                                        <?php 
    _e('Active', 'wpdev-booking');
    ?>
                                    </label> 
                                    
                                    <label class="checkbox inline">
                                        <input type="checkbox"  name="booking_form_field_required1"
                                            <?php 
    if ($booking_form_field_required1 == 'On') {
        echo ' checked="checked" ';
    }
    ?>
  
                                            value="<?php 
    echo $booking_form_field_required1;
    ?>
" >
                                        <?php 
    _e('Required', 'wpdev-booking');
    ?>
                                    </label> 
                                    
                                    <p class="help-block"><?php 
    _e('Activate or deactivate field and change the label title', 'wpdev-booking');
    ?>
</p>
                                  </div>
                                </div>

                                <?php 
    // FIELD # 2 //////////////////////////////////////////////////////////////////////////////////////////////////////////
    if (isset($_POST['Submit'])) {
        if (isset($_POST['booking_form_field_active2'])) {
            $booking_form_field_active2 = 'On';
        } else {
            $booking_form_field_active2 = 'Off';
        }
        update_bk_option('booking_form_field_active2', $booking_form_field_active2);
        if (isset($_POST['booking_form_field_required2'])) {
            $booking_form_field_required2 = 'On';
        } else {
            $booking_form_field_required2 = 'Off';
        }
        update_bk_option('booking_form_field_required2', $booking_form_field_required2);
        update_bk_option('booking_form_field_label2', $_POST['booking_form_field_label2']);
    }
    $booking_form_field_active2 = get_bk_option('booking_form_field_active2');
    $booking_form_field_required2 = get_bk_option('booking_form_field_required2');
    $booking_form_field_label2 = get_bk_option('booking_form_field_label2');
    ?>
                                <div class="control-group">
                                  <label for="name" class="control-label" style="font-weight:bold;"><?php 
    _e('Field Label', 'wpdev-booking');
    ?>
 #2:</label>
                                  <div class="controls"> 
                                      
                                    <input type="text" class="large-text" 
                                           name="booking_form_field_label2" value="<?php 
    echo $booking_form_field_label2;
    ?>
">&nbsp;&nbsp;&nbsp;
                                    
                                    <label class="checkbox inline">
                                        <input type="checkbox"  name="booking_form_field_active2"
                                            <?php 
    if ($booking_form_field_active2 == 'On') {
        echo ' checked="checked" ';
    }
    ?>
  
                                            value="<?php 
    echo $booking_form_field_active2;
    ?>
" >
                                        <?php 
    _e('Active', 'wpdev-booking');
    ?>
                                    </label> 
                                    
                                    <label class="checkbox inline">
                                        <input type="checkbox"  name="booking_form_field_required2"
                                            <?php 
    if ($booking_form_field_required2 == 'On') {
        echo ' checked="checked" ';
    }
    ?>
  
                                            value="<?php 
    echo $booking_form_field_required2;
    ?>
" >
                                        <?php 
    _e('Required', 'wpdev-booking');
    ?>
                                    </label> 
                                    
                                    <p class="help-block"><?php 
    _e('Activate or deactivate field and change the label title', 'wpdev-booking');
    ?>
</p>
                                  </div>
                                </div>

                                <?php 
    // FIELD # 3 //////////////////////////////////////////////////////////////////////////////////////////////////////////
    if (isset($_POST['Submit'])) {
        //if (isset( $_POST['booking_form_field_active3'] )) $booking_form_field_active3 = 'On';
        //else                                               $booking_form_field_active3 = 'Off';
        $booking_form_field_active3 = 'On';
        update_bk_option('booking_form_field_active3', $booking_form_field_active3);
        //if (isset( $_POST['booking_form_field_required3'] )) $booking_form_field_required3 = 'On';
        //else                                                 $booking_form_field_required3 = 'Off';
        $booking_form_field_required3 = 'On';
        update_bk_option('booking_form_field_required3', $booking_form_field_required3);
        update_bk_option('booking_form_field_label3', $_POST['booking_form_field_label3']);
    }
    $booking_form_field_active3 = get_bk_option('booking_form_field_active3');
    $booking_form_field_required3 = get_bk_option('booking_form_field_required3');
    $booking_form_field_label3 = get_bk_option('booking_form_field_label3');
    ?>
                                <div class="control-group">
                                  <label for="name" class="control-label" style="font-weight:bold;"><?php 
    _e('Email Label', 'wpdev-booking');
    ?>
:</label>
                                  <div class="controls"> 
                                      
                                    <input type="text" class="large-text" 
                                           name="booking_form_field_label3" value="<?php 
    echo $booking_form_field_label3;
    ?>
">&nbsp;&nbsp;&nbsp;
                                    
                                    <label class="checkbox inline">
                                        <input type="checkbox"  name="booking_form_field_active3" disabled=""
                                            <?php 
    if ($booking_form_field_active3 == 'On' || true) {
        echo ' checked="checked" ';
    }
    ?>
  
                                            value="<?php 
    echo $booking_form_field_active3;
    ?>
" >
                                        <?php 
    _e('Active', 'wpdev-booking');
    ?>
                                    </label> 
                                    
                                    <label class="checkbox inline">
                                        <input type="checkbox"  name="booking_form_field_required3" disabled=""
                                            <?php 
    if ($booking_form_field_required3 == 'On' || true) {
        echo ' checked="checked" ';
    }
    ?>
  
                                            value="<?php 
    echo $booking_form_field_required3;
    ?>
" >
                                        <?php 
    _e('Required', 'wpdev-booking');
    ?>
                                    </label> 
                                    
                                    <p class="help-block"><?php 
    _e('Change the label title of this field. Email is obligatory field in booking form.', 'wpdev-booking');
    ?>
</p>
                                  </div>
                                </div>

                                <?php 
    // FIELD # 4 //////////////////////////////////////////////////////////////////////////////////////////////////////////
    if (isset($_POST['Submit'])) {
        if (isset($_POST['booking_form_field_active4'])) {
            $booking_form_field_active4 = 'On';
        } else {
            $booking_form_field_active4 = 'Off';
        }
        update_bk_option('booking_form_field_active4', $booking_form_field_active4);
        if (isset($_POST['booking_form_field_required4'])) {
            $booking_form_field_required4 = 'On';
        } else {
            $booking_form_field_required4 = 'Off';
        }
        update_bk_option('booking_form_field_required4', $booking_form_field_required4);
        update_bk_option('booking_form_field_label4', $_POST['booking_form_field_label4']);
    }
    $booking_form_field_active4 = get_bk_option('booking_form_field_active4');
    $booking_form_field_required4 = get_bk_option('booking_form_field_required4');
    $booking_form_field_label4 = get_bk_option('booking_form_field_label4');
    ?>
                                <div class="control-group">
                                  <label for="name" class="control-label" style="font-weight:bold;"><?php 
    _e('Field Label', 'wpdev-booking');
    ?>
 #4:</label>
                                  <div class="controls"> 
                                      
                                    <input type="text" class="large-text" 
                                           name="booking_form_field_label4" value="<?php 
    echo $booking_form_field_label4;
    ?>
">&nbsp;&nbsp;&nbsp;
                                    
                                    <label class="checkbox inline">
                                        <input type="checkbox"  name="booking_form_field_active4"
                                            <?php 
    if ($booking_form_field_active4 == 'On') {
        echo ' checked="checked" ';
    }
    ?>
  
                                            value="<?php 
    echo $booking_form_field_active4;
    ?>
" >
                                        <?php 
    _e('Active', 'wpdev-booking');
    ?>
                                    </label> 
                                    
                                    <label class="checkbox inline">
                                        <input type="checkbox"  name="booking_form_field_required4"
                                            <?php 
    if ($booking_form_field_required4 == 'On') {
        echo ' checked="checked" ';
    }
    ?>
  
                                            value="<?php 
    echo $booking_form_field_required4;
    ?>
" >
                                        <?php 
    _e('Required', 'wpdev-booking');
    ?>
                                    </label> 
                                    
                                    <p class="help-block"><?php 
    _e('Activate or deactivate field and change the label title', 'wpdev-booking');
    ?>
</p>
                                  </div>
                                </div>

                                <?php 
    // FIELD # 5 //////////////////////////////////////////////////////////////////////////////////////////////////////////
    if (isset($_POST['Submit'])) {
        if (isset($_POST['booking_form_field_active5'])) {
            $booking_form_field_active5 = 'On';
        } else {
            $booking_form_field_active5 = 'Off';
        }
        update_bk_option('booking_form_field_active5', $booking_form_field_active5);
        if (isset($_POST['booking_form_field_required5'])) {
            $booking_form_field_required5 = 'On';
        } else {
            $booking_form_field_required5 = 'Off';
        }
        update_bk_option('booking_form_field_required5', $booking_form_field_required5);
        update_bk_option('booking_form_field_label5', $_POST['booking_form_field_label5']);
    }
    $booking_form_field_active5 = get_bk_option('booking_form_field_active5');
    $booking_form_field_required5 = get_bk_option('booking_form_field_required5');
    $booking_form_field_label5 = get_bk_option('booking_form_field_label5');
    ?>
                                <div class="control-group">
                                  <label for="name" class="control-label" style="font-weight:bold;"><?php 
    _e('Textarea Label', 'wpdev-booking');
    ?>
:</label>
                                  <div class="controls"> 
                                      
                                    <input type="text" class="large-text" 
                                           name="booking_form_field_label5" value="<?php 
    echo $booking_form_field_label5;
    ?>
">&nbsp;&nbsp;&nbsp;
                                    
                                    <label class="checkbox inline">
                                        <input type="checkbox"  name="booking_form_field_active5"
                                            <?php 
    if ($booking_form_field_active5 == 'On') {
        echo ' checked="checked" ';
    }
    ?>
  
                                            value="<?php 
    echo $booking_form_field_active5;
    ?>
" >
                                        <?php 
    _e('Active', 'wpdev-booking');
    ?>
                                    </label> 
                                    
                                    <label class="checkbox inline">
                                        <input type="checkbox"  name="booking_form_field_required5"
                                            <?php 
    if ($booking_form_field_required5 == 'On') {
        echo ' checked="checked" ';
    }
    ?>
  
                                            value="<?php 
    echo $booking_form_field_required5;
    ?>
" >
                                        <?php 
    _e('Required', 'wpdev-booking');
    ?>
                                    </label> 
                                    
                                    <p class="help-block"><?php 
    _e('Activate or deactivate field and change the label title', 'wpdev-booking');
    ?>
</p>
                                  </div>
                                </div>


                     </div></div></div>
                      
                    <div <?php 
    $my_close_open_alert_id = 'bk_alert_settings_form_in_free';
    ?>
                        class="alert alert-block alert-info <?php 
    if ('1' == get_user_option('booking_win_' . $my_close_open_alert_id)) {
        echo 'closed';
    }
    ?>
"                             
                        id="<?php 
    echo $my_close_open_alert_id;
    ?>
">
                      <a class="close tooltip_left" rel="tooltip" title="Don't show the message anymore" data-dismiss="alert" href="javascript:void(0)"
                         onclick="javascript:verify_window_opening(<?php 
    echo get_bk_current_user_id();
    ?>
, '<?php 
    echo $my_close_open_alert_id;
    ?>
');"
                         >&times;</a>
                      <strong class="alert-heading">Note!</strong>
                          Check how in <a href="http://wpbookingcalendar.com/help/versions-overview/" target="_blank" style="text-decoration:underline;">other versions of Booking Calendar</a> is possible fully <a href="http://wpbookingcalendar.com/help/booking-form-fields/" target="_blank" style="text-decoration:underline;">customize the booking form</a> <em>(add or remove fields, change structure of booking form, etc...)</em>
                    </div>
                      
                  </div>
                    
                  <input class="button-primary button" style="" type="submit" value="<?php 
    _e('Save Changes', 'wpdev-booking');
    ?>
" name="Submit" />
                  <div class="clear" style="height:10px;"></div>                  
                </form>
            </div>
         <?php 
}
function wpdev_ajax_check_bk_version()
{
    $v = array();
    if (class_exists('wpdev_bk_personal')) {
        $v[] = 'wpdev_bk_personal';
    }
    if (class_exists('wpdev_bk_biz_s')) {
        $v[] = 'wpdev_bk_biz_s';
    }
    if (class_exists('wpdev_bk_biz_m')) {
        $v[] = 'wpdev_bk_biz_m';
    }
    if (class_exists('wpdev_bk_biz_l')) {
        $v[] = 'wpdev_bk_biz_l';
    }
    if (class_exists('wpdev_bk_multiuser')) {
        $v[] = 'wpdev_bk_multiuser';
    }
    $obc_settings = array();
    $params = array('action' => 'set_register', 'order_number' => isset($_POST['order_num']) ? $_POST['order_num'] : false, 'bk' => array('bk_ver' => WPDEV_BK_VERSION, 'bk_url' => WPDEV_BK_PLUGIN_URL, 'bk_dir' => WPDEV_BK_PLUGIN_DIR, 'bk_clss' => $v), 'siteurl' => get_option('siteurl'), 'siteip' => $_SERVER['SERVER_ADDR'], 'admin_email' => get_option('admin_email'));
    update_bk_option('bk_version_data', serialize($params));
    $request = new WP_Http();
    $result = $request->request(OBC_CHECK_URL . 'register/', array('method' => 'POST', 'timeout' => 15, 'body' => $params));
    if (!is_wp_error($result) && $result['response']['code'] == '200' && true) {
        $string = $result['body'];
        //$string = str_replace( "'", '&#039;', $string );
        echo $string;
    } else {
        // Some error appear
        echo '<div id="bk_errror_loading" class="warning_message" style="font-weight:normal;font-size:12px;">';
        _e('Warning!!! Some error is occur. ', 'wpdev-booking');
        echo '<br /><strong>';
        if (is_wp_error($result)) {
            echo $result->get_error_message();
        } else {
            echo $result['response']['message'];
        }
        echo '<br />';
        _e('Please contact by email (with  info about order number and used site) for finishing the registrations', 'wpdev-booking');
        echo ' <a href="mailto:activate@wpbookingcalendar.com">activate@wpbookingcalendar.com</a>';
        echo '</strong></div>';
        echo ' <script type="text/javascript"> ';
        echo '    document.getElementById("ajax_message").style.display="none";';
        echo '    jQuery("#recheck_version").animate({opacity:1},3000).slideUp(1500);';
        echo ' </script> ';
    }
}
function wpbc_settings_emails()
{
    if (isset($_POST['email_reservation_adress'])) {
        $email_reservation_adress = htmlspecialchars(str_replace('\\"', '"', $_POST['email_reservation_adress']));
        $email_reservation_from_adress = htmlspecialchars(str_replace('\\"', '"', $_POST['email_reservation_from_adress']));
        $email_reservation_subject = htmlspecialchars(str_replace('\\"', '"', $_POST['email_reservation_subject']));
        $email_reservation_content = str_replace('\\"', '"', $_POST['email_reservation_content']);
        $email_reservation_adress = str_replace("\\'", "'", $email_reservation_adress);
        $email_reservation_from_adress = str_replace("\\'", "'", $email_reservation_from_adress);
        $email_reservation_subject = str_replace("\\'", "'", $email_reservation_subject);
        $email_reservation_content = str_replace("\\'", "'", $email_reservation_content);
        if (isset($_POST['is_email_reservation_adress'])) {
            $is_email_reservation_adress = 'On';
        } else {
            $is_email_reservation_adress = 'Off';
        }
        update_bk_option('booking_is_email_reservation_adress', $is_email_reservation_adress);
        if (get_bk_option('booking_email_reservation_adress') !== false) {
            update_bk_option('booking_email_reservation_adress', $email_reservation_adress);
        } else {
            add_bk_option('booking_email_reservation_adress', $email_reservation_adress);
        }
        if (get_bk_option('booking_email_reservation_from_adress') !== false) {
            update_bk_option('booking_email_reservation_from_adress', $email_reservation_from_adress);
        } else {
            add_bk_option('booking_email_reservation_from_adress', $email_reservation_from_adress);
        }
        if (get_bk_option('booking_email_reservation_subject') !== false) {
            update_bk_option('booking_email_reservation_subject', $email_reservation_subject);
        } else {
            add_bk_option('booking_email_reservation_subject', $email_reservation_subject);
        }
        if (get_bk_option('booking_email_reservation_content') !== false) {
            update_bk_option('booking_email_reservation_content', $email_reservation_content);
        } else {
            add_bk_option('booking_email_reservation_content', $email_reservation_content);
        }
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        $email_approval_adress = htmlspecialchars(str_replace('\\"', '"', $_POST['email_approval_adress']));
        $email_approval_subject = htmlspecialchars(str_replace('\\"', '"', $_POST['email_approval_subject']));
        $email_approval_content = str_replace('\\"', '"', $_POST['email_approval_content']);
        $email_approval_adress = str_replace("\\'", "'", $email_approval_adress);
        $email_approval_subject = str_replace("\\'", "'", $email_approval_subject);
        $email_approval_content = str_replace("\\'", "'", $email_approval_content);
        if (isset($_POST['is_email_approval_adress'])) {
            $is_email_approval_adress = 'On';
        } else {
            $is_email_approval_adress = 'Off';
        }
        update_bk_option('booking_is_email_approval_adress', $is_email_approval_adress);
        if (isset($_POST['is_email_approval_send_copy_to_admin'])) {
            $is_email_approval_send_copy_to_admin = 'On';
        } else {
            $is_email_approval_send_copy_to_admin = 'Off';
        }
        update_bk_option('booking_is_email_approval_send_copy_to_admin', $is_email_approval_send_copy_to_admin);
        if (get_bk_option('booking_email_approval_adress') !== false) {
            update_bk_option('booking_email_approval_adress', $email_approval_adress);
        } else {
            add_bk_option('booking_email_approval_adress', $email_approval_adress);
        }
        if (get_bk_option('booking_email_approval_subject') !== false) {
            update_bk_option('booking_email_approval_subject', $email_approval_subject);
        } else {
            add_bk_option('booking_email_approval_subject', $email_approval_subject);
        }
        if (get_bk_option('booking_email_approval_content') !== false) {
            update_bk_option('booking_email_approval_content', $email_approval_content);
        } else {
            add_bk_option('booking_email_approval_content', $email_approval_content);
        }
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        $email_newbookingbyperson_adress = htmlspecialchars(str_replace('\\"', '"', $_POST['email_newbookingbyperson_adress']));
        $email_newbookingbyperson_subject = htmlspecialchars(str_replace('\\"', '"', $_POST['email_newbookingbyperson_subject']));
        $email_newbookingbyperson_content = str_replace('\\"', '"', $_POST['email_newbookingbyperson_content']);
        $email_newbookingbyperson_adress = str_replace("\\'", "'", $email_newbookingbyperson_adress);
        $email_newbookingbyperson_subject = str_replace("\\'", "'", $email_newbookingbyperson_subject);
        $email_newbookingbyperson_content = str_replace("\\'", "'", $email_newbookingbyperson_content);
        if (isset($_POST['is_email_newbookingbyperson_adress'])) {
            $is_email_newbookingbyperson_adress = 'On';
        } else {
            $is_email_newbookingbyperson_adress = 'Off';
        }
        update_bk_option('booking_is_email_newbookingbyperson_adress', $is_email_newbookingbyperson_adress);
        if (get_bk_option('booking_email_newbookingbyperson_adress') !== false) {
            update_bk_option('booking_email_newbookingbyperson_adress', $email_newbookingbyperson_adress);
        } else {
            add_bk_option('booking_email_newbookingbyperson_adress', $email_newbookingbyperson_adress);
        }
        if (get_bk_option('booking_email_newbookingbyperson_subject') !== false) {
            update_bk_option('booking_email_newbookingbyperson_subject', $email_newbookingbyperson_subject);
        } else {
            add_bk_option('booking_email_newbookingbyperson_subject', $email_newbookingbyperson_subject);
        }
        if (get_bk_option('booking_email_newbookingbyperson_content') !== false) {
            update_bk_option('booking_email_newbookingbyperson_content', $email_newbookingbyperson_content);
        } else {
            add_bk_option('booking_email_newbookingbyperson_content', $email_newbookingbyperson_content);
        }
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        $email_deny_adress = htmlspecialchars(str_replace('\\"', '"', $_POST['email_deny_adress']));
        $email_deny_subject = htmlspecialchars(str_replace('\\"', '"', $_POST['email_deny_subject']));
        $email_deny_content = str_replace('\\"', '"', $_POST['email_deny_content']);
        $email_deny_adress = str_replace("\\'", "'", $email_deny_adress);
        $email_deny_subject = str_replace("\\'", "'", $email_deny_subject);
        $email_deny_content = str_replace("\\'", "'", $email_deny_content);
        if (isset($_POST['is_email_deny_adress'])) {
            $is_email_deny_adress = 'On';
        } else {
            $is_email_deny_adress = 'Off';
        }
        update_bk_option('booking_is_email_deny_adress', $is_email_deny_adress);
        if (isset($_POST['is_email_deny_send_copy_to_admin'])) {
            $is_email_deny_send_copy_to_admin = 'On';
        } else {
            $is_email_deny_send_copy_to_admin = 'Off';
        }
        update_bk_option('booking_is_email_deny_send_copy_to_admin', $is_email_deny_send_copy_to_admin);
        if (get_bk_option('booking_email_deny_adress') !== false) {
            update_bk_option('booking_email_deny_adress', $email_deny_adress);
        } else {
            add_bk_option('booking_email_deny_adress', $email_deny_adress);
        }
        if (get_bk_option('booking_email_deny_subject') !== false) {
            update_bk_option('booking_email_deny_subject', $email_deny_subject);
        } else {
            add_bk_option('booking_email_deny_subject', $email_deny_subject);
        }
        if (get_bk_option('booking_email_deny_content') !== false) {
            update_bk_option('booking_email_deny_content', $email_deny_content);
        } else {
            add_bk_option('booking_email_deny_content', $email_deny_content);
        }
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    }
    $email_reservation_adress = get_bk_option('booking_email_reservation_adress');
    $email_reservation_from_adress = get_bk_option('booking_email_reservation_from_adress');
    $email_reservation_subject = get_bk_option('booking_email_reservation_subject');
    $email_reservation_content = get_bk_option('booking_email_reservation_content');
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    $email_newbookingbyperson_adress = get_bk_option('booking_email_newbookingbyperson_adress');
    $email_newbookingbyperson_subject = get_bk_option('booking_email_newbookingbyperson_subject');
    $email_newbookingbyperson_content = get_bk_option('booking_email_newbookingbyperson_content');
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    $email_approval_adress = get_bk_option('booking_email_approval_adress');
    $email_approval_subject = get_bk_option('booking_email_approval_subject');
    $email_approval_content = get_bk_option('booking_email_approval_content');
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    $email_deny_adress = get_bk_option('booking_email_deny_adress');
    $email_deny_subject = get_bk_option('booking_email_deny_subject');
    $email_deny_content = get_bk_option('booking_email_deny_content');
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    $is_email_reservation_adress = get_bk_option('booking_is_email_reservation_adress');
    $is_email_newbookingbyperson_adress = get_bk_option('booking_is_email_newbookingbyperson_adress');
    $is_email_approval_adress = get_bk_option('booking_is_email_approval_adress');
    $is_email_approval_send_copy_to_admin = get_bk_option('booking_is_email_approval_send_copy_to_admin');
    $is_email_deny_adress = get_bk_option('booking_is_email_deny_adress');
    $is_email_deny_send_copy_to_admin = get_bk_option('booking_is_email_deny_send_copy_to_admin');
    // Replace <br> to  <br> with  new line
    $email_reservation_content = preg_replace(array("@(&lt;|<)br/?(&gt;|>)(\r\n)?@", "/\\[bookingtype\\]/"), array("<br/>", ""), $email_reservation_content);
    $email_newbookingbyperson_content = preg_replace(array("@(&lt;|<)br/?(&gt;|>)(\r\n)?@", "/\\[bookingtype\\]/"), array("<br/>", ""), $email_newbookingbyperson_content);
    $email_approval_content = preg_replace(array("@(&lt;|<)br/?(&gt;|>)(\r\n)?@", "/\\[bookingtype\\]/"), array("<br/>", ""), $email_approval_content);
    $email_deny_content = preg_replace(array("@(&lt;|<)br/?(&gt;|>)(\r\n)?@", "/\\[bookingtype\\]/"), array("<br/>", ""), $email_deny_content);
    ?>
    <div class="clear" style="height:0px;"></div>
    <div id="ajax_working"></div>
    <div id="poststuff0" class="metabox-holder">
        <form  name="post_settings_email_templates" action="" method="post" id="post_settings_email_templates" >

            <div id="visibility_container_email_new_to_admin" class="visibility_container" style="display:block;">

                <div class='meta-box'> <div <?php 
    $my_close_open_win_id = 'bk_settings_emails_to_admin';
    ?>
  id="<?php 
    echo $my_close_open_win_id;
    ?>
" class="postbox <?php 
    if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
        echo 'closed';
    }
    ?>
" > <div title="<?php 
    _e('Click to toggle', 'booking');
    ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
    echo get_bk_current_user_id();
    ?>
, '<?php 
    echo $my_close_open_win_id;
    ?>
');" ><br></div>
                      <h3 class='hndle'><span><?php 
    _e('Email to "Admin" after a new booking', 'booking');
    ?>
</span></h3> <div class="inside">

                    <table class="form-table email-table0" >
                        <tbody>
                            <tr>
                                <th scope="row"><?php 
    _e('Status', 'booking');
    ?>
:</th>
                                <td>
                                    <fieldset>
                                        <label for="is_email_reservation_adress">
                                            <input id="is_email_reservation_adress" name="is_email_reservation_adress" type="checkbox" 
                                                <?php 
    if ($is_email_reservation_adress == 'On') {
        echo "checked";
    }
    ?>
  
                                                value="<?php 
    echo $is_email_reservation_adress;
    ?>
" 
                                                onchange="document.getElementById('booking_is_email_reservation_adress_dublicated').checked=this.checked;"
                                                />
                                            <?php 
    _e('Active', 'booking');
    ?>
                                        </label>
                                    </fieldset>   
                                </td>
                            </tr>
                            <tr valign="top">
                                <th scope="row"><label for="email_reservation_adress" ><?php 
    _e('To', 'booking');
    ?>
:</label></th>
                                <td><input id="email_reservation_adress"  name="email_reservation_adress" class="regular-text code" type="text" size="45" value="<?php 
    echo $email_reservation_adress;
    ?>
" />
                                    <span class="description"><?php 
    printf(__('Type default %sadmin email%s for booking confirmation', 'booking'), '<b>', '</b>');
    ?>
</span>
                                </td>
                            </tr>

                            <tr valign="top">
                                <th scope="row"><label for="email_reservation_from_adress" ><?php 
    _e('From', 'booking');
    ?>
:</label></th>
                                <td><input id="email_reservation_from_adress" name="email_reservation_from_adress" class="regular-text code" type="text" size="45" value="<?php 
    echo $email_reservation_from_adress;
    ?>
" />
                                    <span class="description"><?php 
    printf(__('Type the default %sadmin email%s sending the booking confimation. You can use this %s shortcode.', 'booking'), '<b>', '</b>', '<code>[visitoremail]</code>');
    ?>
</span>
                                </td>
                            </tr>

                            <tr valign="top">
                                    <th scope="row"><label for="email_reservation_subject" ><?php 
    _e('Subject', 'booking');
    ?>
:</label></th>
                                    <td><input id="email_reservation_subject" name="email_reservation_subject"  class="regular-text code" type="text" size="45" value="<?php 
    echo $email_reservation_subject;
    ?>
" />
                                        <span class="description"><?php 
    printf(__('Type your email %ssubject%s for the booking confimation message.', 'booking'), '<b>', '</b>');
    ?>
</span>
                                    </td>
                            </tr>

                            <tr valign="top">
                                <th scope="row"><label for="email_reservation_content" ><?php 
    _e('Content', 'booking');
    ?>
:</label></th>
                                <td>     <?php 
    /**/
    wp_editor($email_reservation_content, 'email_reservation_content', array('wpautop' => false, 'media_buttons' => false, 'textarea_name' => 'email_reservation_content', 'textarea_rows' => 10, 'editor_class' => 'wpbc-textarea-tinymce', 'teeny' => true, 'drag_drop_upload' => false));
    /*
                                                      <textarea id="email_reservation_content" name="email_reservation_content" style="width:100%;" rows="10"><?php echo ($email_reservation_content); ?></textarea> /**/
    ?>
                                      <p class="description"><?php 
    printf(__('Type your %semail message content for checking booking%s in. ', 'booking'), '<b>', '</b>');
    ?>
</p>
                                </td>
                            </tr>
                            <tr><td></td>
                                <td>
                                      <?php 
    $skip_shortcodes = array('denyreason', 'paymentreason', 'visitorbookingediturl', 'visitorbookingcancelurl', 'visitorbookingpayurl', 'cost', 'bookingtype', 'check_in_date', 'check_out_date', 'dates_count');
    email_help_section($skip_shortcodes, sprintf(__('For example: "You have a new reservation %s on the following date(s): %s Contact information: %s You can approve or cancel this booking at: %s Thank you, Reservation service."', 'booking'), '', '[dates]&lt;br/&gt;&lt;br/&gt;', '&lt;br/&gt; [content]&lt;br/&gt;&lt;br/&gt;', htmlentities(' <a href="[moderatelink]">' . __('here', 'booking') . '</a> ') . '&lt;br/&gt;&lt;br/&gt; '));
    ?>
                                                      
                                </td>
                            </tr>
                        </tbody>
                    </table>

                </div> </div> </div>

            </div>


            <div id="visibility_container_email_new_to_visitor" class="visibility_container" style="display:none;">

                <div class='meta-box'> <div <?php 
    $my_close_open_win_id = 'bk_settings_emails_to_person_after_new';
    ?>
  id="<?php 
    echo $my_close_open_win_id;
    ?>
" class="postbox <?php 
    if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
        echo 'closed';
    }
    ?>
" > <div title="<?php 
    _e('Click to toggle', 'booking');
    ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
    echo get_bk_current_user_id();
    ?>
, '<?php 
    echo $my_close_open_win_id;
    ?>
');" ><br></div>
                      <h3 class='hndle'><span><?php 
    _e('Email to "Person" after they make a new reservation', 'booking');
    ?>
</span></h3> <div class="inside">


                    <table class="form-table email-table0" >
                        <tbody>
                            <tr>
                                <th scope="row"><?php 
    _e('Status', 'booking');
    ?>
:</th>
                                <td>
                                    <fieldset>
                                        <label for="is_email_newbookingbyperson_adress">
                                            <input id="is_email_newbookingbyperson_adress" name="is_email_newbookingbyperson_adress" 
                                                   type="checkbox" <?php 
    if ($is_email_newbookingbyperson_adress == 'On') {
        echo "checked";
    }
    ?>
  
                                                   value="<?php 
    echo $is_email_newbookingbyperson_adress;
    ?>
" 
                                                   onchange="document.getElementById('booking_is_email_newbookingbyperson_adress_dublicated').checked=this.checked;"  
                                                   />
                                            <?php 
    _e('Active', 'booking');
    ?>
                                        </label>
                                    </fieldset>   
                                </td>
                            </tr>
                            <tr valign="top">
                                <th scope="row"><label for="email_newbookingbyperson_adress" ><?php 
    _e('From', 'booking');
    ?>
:</label></th>
                                <td><input id="email_newbookingbyperson_adress"  name="email_newbookingbyperson_adress" class="regular-text code" type="text" size="45" value="<?php 
    echo $email_newbookingbyperson_adress;
    ?>
" />
                                    <span class="description"><?php 
    printf(__('Type the default %sadmin email%s sending the booking confimation', 'booking'), '<b>', '</b>');
    ?>
</span>
                                </td>
                            </tr>

                            <tr valign="top">
                                    <th scope="row"><label for="email_newbookingbyperson_subject" ><?php 
    _e('Subject', 'booking');
    ?>
:</label></th>
                                    <td><input id="email_newbookingbyperson_subject"  name="email_newbookingbyperson_subject" class="regular-text code" type="text" size="45" value="<?php 
    echo $email_newbookingbyperson_subject;
    ?>
" />
                                        <span class="description"><?php 
    printf(__('Type email subject for %svisitor after creating a new reservation%s.', 'booking'), '<b>', '</b>');
    ?>
</span>
                                    </td>
                            </tr>

                            <tr valign="top">
                                <th scope="row">
                                    <label for="email_newbookingbyperson_content" ><?php 
    _e('Content', 'booking');
    ?>
:</label></th>
                                <td>     <?php 
    /**/
    wp_editor($email_newbookingbyperson_content, 'email_newbookingbyperson_content', array('wpautop' => false, 'media_buttons' => false, 'textarea_name' => 'email_newbookingbyperson_content', 'textarea_rows' => 10, 'editor_class' => 'wpbc-textarea-tinymce', 'teeny' => true, 'drag_drop_upload' => false));
    /*
                                                      <textarea id="email_newbookingbyperson_content" name="email_newbookingbyperson_content" style="width:100%;" rows="10"><?php echo ($email_newbookingbyperson_content); ?></textarea> /**/
    ?>
                                      <p class="description"><?php 
    printf(__('Type your %semail message for visitor after creating a new reservation%s', 'booking'), '<b>', '</b>');
    ?>
</p>
                                </td>
                            </tr>
                            <tr><td></td>
                                <td>                                                      <?php 
    $skip_shortcodes = array('moderatelink', 'denyreason', 'paymentreason', 'visitorbookingpayurl', 'cost', 'bookingtype', 'check_in_date', 'check_out_date', 'dates_count');
    email_help_section($skip_shortcodes, sprintf(__('For example: "Your reservation %s on these date(s): %s is processing now! We will send confirmation by email. %s Thank you, Reservation service."', 'booking'), '', '[dates]', '&lt;br/&gt;&lt;br/&gt;[content]&lt;br/&gt;&lt;br/&gt;'));
    ?>
                            </td></tr>
                        </tbody>
                    </table>

                </div> </div> </div>

            </div>


            <div id="visibility_container_email_approved" class="visibility_container" style="display:none;">

                <div class='meta-box'> <div <?php 
    $my_close_open_win_id = 'bk_settings_emails_to_person_after_approval';
    ?>
  id="<?php 
    echo $my_close_open_win_id;
    ?>
" class="postbox <?php 
    if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
        echo 'closed';
    }
    ?>
" > <div title="<?php 
    _e('Click to toggle', 'booking');
    ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
    echo get_bk_current_user_id();
    ?>
, '<?php 
    echo $my_close_open_win_id;
    ?>
');" ><br></div>
                      <h3 class='hndle'><span><?php 
    _e('Email to "Person" after booking is approved', 'booking');
    ?>
</span></h3> <div class="inside">

                    <table class="form-table email-table0" >
                        <tbody>
                            <tr>    
                                <th scope="row"><?php 
    _e('Status', 'booking');
    ?>
:</th>
                                <td>
                                    <fieldset>
                                        <label for="is_email_approval_adress">
                                            <input id="is_email_approval_adress" name="is_email_approval_adress" type="checkbox" 
                                                   <?php 
    if ($is_email_approval_adress == 'On') {
        echo "checked";
    }
    ?>
  
                                                   value="<?php 
    echo $is_email_approval_adress;
    ?>
" 
                                                   onchange="document.getElementById('booking_is_email_approval_adress_dublicated').checked=this.checked;" 
                                                   />
                                            <?php 
    _e('Active', 'booking');
    ?>
                                        </label>
                                    </fieldset>   
                                </td>
                            </tr>
                            <tr>
                                <th scope="row"><?php 
    _e('Send to Admin', 'booking');
    ?>
:</th>
                                <td>
                                    <fieldset>
                                        <label for="is_email_approval_send_copy_to_admin">
                                            <input id="is_email_approval_send_copy_to_admin" name="is_email_approval_send_copy_to_admin" 
                                                   type="checkbox" <?php 
    if ($is_email_approval_send_copy_to_admin == 'On') {
        echo "checked";
    }
    ?>
  
                                                   value="<?php 
    echo $is_email_approval_send_copy_to_admin;
    ?>
"                                                                    
                                                   />
                                            <?php 
    _e('Check this box to send copy of this email to Admin', 'booking');
    ?>
                                        </label>
                                    </fieldset>   
                                </td>
                            </tr>                                            
                            <tr valign="top">
                                <th scope="row"><label for="email_approval_adress" ><?php 
    _e('From', 'booking');
    ?>
:</label></th>
                                <td><input id="email_approval_adress"  name="email_approval_adress" class="regular-text code" type="text" size="45" value="<?php 
    echo $email_approval_adress;
    ?>
" />
                                    <span class="description"><?php 
    printf(__('Type the default %sadmin email%s sending the booking confimation', 'booking'), '<b>', '</b>');
    ?>
</span>
                                </td>
                            </tr>

                            <tr valign="top">
                                    <th scope="row"><label for="email_approval_subject" ><?php 
    _e('Subject', 'booking');
    ?>
:</label></th>
                                    <td><input id="email_approval_subject"  name="email_approval_subject" class="regular-text code" type="text" size="45" value="<?php 
    echo $email_approval_subject;
    ?>
" />
                                        <span class="description"><?php 
    printf(__('Type your email subject for the %sapproved booking%s.', 'booking'), '<b>', '</b>');
    ?>
</span>
                                    </td>
                            </tr>

                            <tr valign="top">
                                    <th scope="row"><label for="email_approval_content" ><?php 
    _e('Content', 'booking');
    ?>
:</label></th>
                                    <td>     <?php 
    /**/
    wp_editor($email_approval_content, 'email_approval_content', array('wpautop' => false, 'media_buttons' => false, 'textarea_name' => 'email_approval_content', 'textarea_rows' => 10, 'editor_class' => 'wpbc-textarea-tinymce', 'teeny' => true, 'drag_drop_upload' => false));
    /*
                                                      <textarea id="email_approval_content" name="email_approval_content" style="width:100%;" rows="10"><?php echo ($email_approval_content); ?></textarea> /**/
    ?>
                                      <p class="description"><?php 
    printf(__('Type your %semail message for the approved booking%s from the website', 'booking'), '<b>', '</b>');
    ?>
</p>
                                    </td>
                            </tr>
                            <tr valign="top"><td></td>
                                <td>
                                      <?php 
    $skip_shortcodes = array('moderatelink', 'denyreason', 'paymentreason', 'visitorbookingpayurl', 'cost', 'bookingtype', 'check_in_date', 'check_out_date', 'dates_count');
    email_help_section($skip_shortcodes, sprintf(__('For example: "Your reservation %s on these date(s): %s has been approved.%s Thank you, Reservation service."', 'booking'), '', '[dates]', '&lt;br/&gt;&lt;br/&gt;[content]&lt;br/&gt;&lt;br/&gt;'));
    ?>
                                </td>
                            </tr>
                        </tbody>
                    </table>

                </div> </div> </div>

            </div>

            
            <div id="visibility_container_email_declined" class="visibility_container" style="display:none;">

                <div class='meta-box'> <div <?php 
    $my_close_open_win_id = 'bk_settings_emails_to_person_after_deny';
    ?>
  id="<?php 
    echo $my_close_open_win_id;
    ?>
" class="postbox <?php 
    if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
        echo 'closed';
    }
    ?>
" > <div title="<?php 
    _e('Click to toggle', 'booking');
    ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
    echo get_bk_current_user_id();
    ?>
, '<?php 
    echo $my_close_open_win_id;
    ?>
');" ><br></div>
                      <h3 class='hndle'><span><?php 
    _e('Email to "Person" after their booking has been denied', 'booking');
    ?>
</span></h3> <div class="inside">


                    <table class="form-table email-table0" >
                        <tbody>

                            <tr>    
                                <th scope="row"><?php 
    _e('Status', 'booking');
    ?>
:</th>
                                <td>
                                    <fieldset>
                                        <label for="is_email_deny_adress">
                                            <input id="is_email_deny_adress" name="is_email_deny_adress" type="checkbox" 
                                                <?php 
    if ($is_email_deny_adress == 'On') {
        echo "checked";
    }
    ?>
  
                                                   value="<?php 
    echo $is_email_deny_adress;
    ?>
" 
                                                   onchange="document.getElementById('booking_is_email_declined_adress_dublicated').checked=this.checked;"  />
                                            <?php 
    _e('Active', 'booking');
    ?>
                                        </label>
                                    </fieldset>   
                                </td>
                            </tr>
                            <tr>
                                <th scope="row"><?php 
    _e('Send to Admin', 'booking');
    ?>
:</th>
                                <td>
                                    <fieldset>
                                        <label for="is_email_deny_send_copy_to_admin">
                                            <input id="is_email_deny_send_copy_to_admin" name="is_email_deny_send_copy_to_admin" 
                                                   type="checkbox" <?php 
    if ($is_email_deny_send_copy_to_admin == 'On') {
        echo "checked";
    }
    ?>
  
                                                   value="<?php 
    echo $is_email_deny_send_copy_to_admin;
    ?>
" 
                                                   />
                                            <?php 
    _e('Check this box to send copy of this email to Admin', 'booking');
    ?>
                                        </label>
                                    </fieldset>   
                                </td>
                            </tr>                                            

                            <tr valign="top">
                                <th scope="row"><label for="email_deny_adress" ><?php 
    _e('From', 'booking');
    ?>
:</label></th>
                                <td><input id="email_deny_adress"  name="email_deny_adress" class="regular-text code" type="text" size="45" value="<?php 
    echo $email_deny_adress;
    ?>
" />
                                    <span class="description"><?php 
    printf(__('Type the default %sadmin email%s sending the booking confimation', 'booking'), '<b>', '</b>');
    ?>
</span>
                                </td>
                            </tr>

                            <tr valign="top">
                                    <th scope="row"><label for="email_deny_subject" ><?php 
    _e('Subject', 'booking');
    ?>
:</label></th>
                                    <td><input id="email_deny_subject"  name="email_deny_subject" class="regular-text code" type="text" size="45" value="<?php 
    echo $email_deny_subject;
    ?>
" />
                                        <span class="description"><?php 
    printf(__('Type your email subject for the %sdenied booking%s.', 'booking'), '<b>', '</b>');
    ?>
</span>
                                    </td>
                            </tr>

                            <tr valign="top">
                                    <th scope="row"><label for="email_deny_content" ><?php 
    _e('Content', 'booking');
    ?>
:</label></th>
                                    <td>     <?php 
    /**/
    wp_editor($email_deny_content, 'email_deny_content', array('wpautop' => false, 'media_buttons' => false, 'textarea_name' => 'email_deny_content', 'textarea_rows' => 10, 'editor_class' => 'wpbc-textarea-tinymce', 'teeny' => true, 'drag_drop_upload' => false));
    /*
                                                      <textarea id="email_deny_content" name="email_deny_content" style="width:100%;" rows="10"><?php echo ($email_deny_content); ?></textarea> /**/
    ?>
                                        <p class="description"><?php 
    printf(__('Type your %semail message for the denied booking%s from the website', 'booking'), '<b>', '</b>');
    ?>
</p>
                                    </td>
                            </tr>

                            <tr valign="top"><td></td>
                                <td>
                                      <?php 
    $skip_shortcodes = array('moderatelink', 'paymentreason', 'visitorbookingpayurl', 'visitorbookingediturl', 'visitorbookingcancelurl', 'cost', 'bookingtype', 'check_in_date', 'check_out_date', 'dates_count');
    email_help_section($skip_shortcodes, sprintf(__('For example: "Your reservation %s on these date(s): %s has been canceled. Please contact us for more information. %s Thank you, Reservation service."', 'booking'), '', '[dates]', '&lt;br/&gt;&lt;br/&gt;[denyreason]&lt;br/&gt;&lt;br/&gt;[content]&lt;br/&gt;&lt;br/&gt;'));
    ?>

                                </td>
                            </tr>
                        </tbody>
                    </table>

                </div> </div> </div>

            </div>
            <span class="wpdevbk">
                <div <?php 
    $my_close_open_alert_id = 'bk_alert_settings_email_in_free';
    ?>
                    class="alert alert-block alert-info <?php 
    if ('1' == get_user_option('booking_win_' . $my_close_open_alert_id)) {
        echo 'closed';
    }
    ?>
"                             
                    id="<?php 
    echo $my_close_open_alert_id;
    ?>
">
                  <a class="close tooltip_left" rel="tooltip" title="Don't show the message anymore" data-dismiss="alert" href="javascript:void(0)"
                     onclick="javascript:verify_window_opening(<?php 
    echo get_bk_current_user_id();
    ?>
, '<?php 
    echo $my_close_open_alert_id;
    ?>
');"
                     >&times;</a>
                  <strong class="alert-heading">Note!</strong>
                      Check how in <a href="http://wpbookingcalendar.com/demo/" target="_blank" style="text-decoration:underline;">other versions of Booking Calendar</a> possible to customize email templates with new additional shortcodes</em>
                </div>
            </span>        
        <input class="button-primary button" style="float:right;" type="submit" value="<?php 
    _e('Save Changes', 'booking');
    ?>
" name="Submit"/>
        <div class="clear" style="height:10px;"></div>

        </form>
    </div>
    <?php 
}
function wpbc_gcal_settings_submit()
{
    if (!class_exists('wpdev_bk_personal')) {
        update_bk_option('booking_gcal_feed', $_POST['booking_gcal_feed']);
    }
    //update_bk_option( 'booking_gcal_feed', wpbc_set_relative_url( $_POST['booking_gcal_feed'] ) );
    update_bk_option('booking_gcal_events_from', $_POST['booking_gcal_events_from']);
    if ($_POST['booking_gcal_events_from'] != 'date') {
        $_POST['booking_gcal_events_from_offset'] = intval($_POST['booking_gcal_events_from_offset']);
        if (empty($_POST['booking_gcal_events_from_offset'])) {
            $_POST['booking_gcal_events_from_offset'] = "-0";
        }
        update_bk_option('booking_gcal_events_from_offset', $_POST['booking_gcal_events_from_offset']);
    } else {
        update_bk_option('booking_gcal_events_from_offset', $_POST['booking_gcal_events_from_offset']);
    }
    update_bk_option('booking_gcal_events_from_offset_type', $_POST['booking_gcal_events_from_offset_type']);
    update_bk_option('booking_gcal_events_until', $_POST['booking_gcal_events_until']);
    if ($_POST['booking_gcal_events_until'] != 'date') {
        $_POST['booking_gcal_events_until_offset'] = intval($_POST['booking_gcal_events_until_offset']);
        if (empty($_POST['booking_gcal_events_from_offset'])) {
            $_POST['booking_gcal_events_from_offset'] = "-0";
        }
        update_bk_option('booking_gcal_events_until_offset', $_POST['booking_gcal_events_until_offset']);
    } else {
        update_bk_option('booking_gcal_events_until_offset', $_POST['booking_gcal_events_until_offset']);
    }
    update_bk_option('booking_gcal_events_until_offset_type', $_POST['booking_gcal_events_until_offset_type']);
    update_bk_option('booking_gcal_events_max', $_POST['booking_gcal_events_max']);
    update_bk_option('booking_gcal_api_key', $_POST['booking_gcal_api_key']);
    update_bk_option('booking_gcal_timezone', $_POST['booking_gcal_timezone']);
    // update_bk_option( 'booking_gcal_is_send_email' , ( ( isset( $_POST['booking_gcal_is_send_email'] ) ) ? 'On' : 'Off' )  );
    $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'only_super_admin');
    if ($is_can) {
        update_bk_option('booking_gcal_auto_import_is_active', isset($_POST['booking_gcal_auto_import_is_active']) ? 'On' : 'Off');
        // Update Cron //
        if (isset($_POST['booking_gcal_auto_import_is_active'])) {
            update_bk_option('booking_gcal_auto_import_time', intval($_POST['booking_gcal_auto_import_time']));
            // add
            wpbookingcalendar()->cron->update('wpbc_import_gcal', array('action' => array('wpbc_silent_import_all_events'), 'start_time' => time(), 'recurrence' => intval($_POST['booking_gcal_auto_import_time'])));
        } else {
            // delete
            wpbookingcalendar()->cron->delete('wpbc_import_gcal');
        }
    }
    $event_fields = wpbc_gcal_get_events_fields_parameters();
    $event_fields_array = array();
    foreach ($event_fields as $event_fields_key => $event_fields_value) {
        if (isset($_POST["booking_gcal_events_form_fields_" . $event_fields_key])) {
            $event_fields_array[$event_fields_key] = $_POST["booking_gcal_events_form_fields_" . $event_fields_key];
        } else {
            $event_fields_array[$event_fields_key] = '';
        }
    }
    //debuge($event_fields_array, serialize($event_fields_array));
    update_bk_option('booking_gcal_events_form_fields', serialize($event_fields_array));
    // Hook
    make_bk_action('wpbc_gcal_settings_content_submit_booking_resources_table');
}
 public function welcome()
 {
     $booking_activation_process = get_bk_option('booking_activation_process');
     if ($booking_activation_process == 'On') {
         return;
     }
     // Bail if no activation redirect transient is set
     if (!get_transient('_wpbc_activation_redirect')) {
         return;
     }
     // Delete the redirect transient
     delete_transient('_wpbc_activation_redirect');
     // Bail if DEMO or activating from network, or bulk, or within an iFrame
     if (wpdev_bk_is_this_demo() || is_network_admin() || isset($_GET['activate-multi']) || defined('IFRAME_REQUEST')) {
         return;
     }
     // Set mark,  that  we already redirected to About screen               //FixIn: 5.4.5
     $redirect_for_version = get_bk_option('booking_activation_redirect_for_version');
     if ($redirect_for_version == WP_BK_VERSION_NUM) {
         return;
     } else {
         update_bk_option('booking_activation_redirect_for_version', WP_BK_VERSION_NUM);
     }
     wp_safe_redirect(admin_url('index.php?page=wpbc-about'));
     exit;
 }
        function settings_general_content()
        {
            $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'only_super_admin');
            if ($is_can === false) {
                return;
            }
            if (isset($_POST['start_day_weeek'])) {
                $booking_skin = $_POST['booking_skin'];
                $email_reservation_adress = htmlspecialchars(str_replace('\\"', '"', $_POST['email_reservation_adress']));
                $email_reservation_adress = str_replace("\\'", "'", $email_reservation_adress);
                $bookings_num_per_page = $_POST['bookings_num_per_page'];
                $booking_sort_order = $_POST['booking_sort_order'];
                $booking_default_toolbar_tab = $_POST['booking_default_toolbar_tab'];
                //$booking_sort_order_direction = $_POST['booking_sort_order_direction'];
                $max_monthes_in_calendar = $_POST['max_monthes_in_calendar'];
                if (isset($_POST['admin_cal_count'])) {
                    $admin_cal_count = $_POST['admin_cal_count'];
                }
                if (isset($_POST['client_cal_count'])) {
                    $client_cal_count = $_POST['client_cal_count'];
                }
                $start_day_weeek = $_POST['start_day_weeek'];
                $new_booking_title = $_POST['new_booking_title'];
                $new_booking_title_time = $_POST['new_booking_title_time'];
                $type_of_thank_you_message = $_POST['type_of_thank_you_message'];
                //get_bk_option( 'booking_type_of_thank_you_message' ); //= 'message'; = 'page';
                $thank_you_page_URL = $_POST['thank_you_page_URL'];
                //get_bk_option( 'booking_thank_you_page_URL' ); //= 'message'; = 'page';
                $booking_date_format = $_POST['booking_date_format'];
                $booking_date_view_type = $_POST['booking_date_view_type'];
                //$is_dif_colors_approval_pending = $_POST['is_dif_colors_approval_pending'];
                if (isset($_POST['is_use_hints_at_admin_panel'])) {
                    $is_use_hints_at_admin_panel = $_POST['is_use_hints_at_admin_panel'];
                }
                if (isset($_POST['multiple_day_selections'])) {
                    $multiple_day_selections = $_POST['multiple_day_selections'];
                }
                if (isset($_POST['is_delete_if_deactive'])) {
                    $is_delete_if_deactive = $_POST['is_delete_if_deactive'];
                }
                // check
                if (isset($_POST['wpdev_copyright'])) {
                    $wpdev_copyright = $_POST['wpdev_copyright'];
                }
                // check
                if (isset($_POST['booking_is_show_powered_by_notice'])) {
                    $booking_is_show_powered_by_notice = $_POST['booking_is_show_powered_by_notice'];
                }
                // check
                if (isset($_POST['is_use_captcha'])) {
                    $is_use_captcha = $_POST['is_use_captcha'];
                }
                // check
                if (isset($_POST['is_use_autofill_4_logged_user'])) {
                    $is_use_autofill_4_logged_user = $_POST['is_use_autofill_4_logged_user'];
                }
                // check
                if (isset($_POST['is_show_legend'])) {
                    $is_show_legend = $_POST['is_show_legend'];
                }
                // check
                if (isset($_POST['unavailable_day0'])) {
                    $unavailable_day0 = $_POST['unavailable_day0'];
                }
                if (isset($_POST['unavailable_day1'])) {
                    $unavailable_day1 = $_POST['unavailable_day1'];
                }
                if (isset($_POST['unavailable_day2'])) {
                    $unavailable_day2 = $_POST['unavailable_day2'];
                }
                if (isset($_POST['unavailable_day3'])) {
                    $unavailable_day3 = $_POST['unavailable_day3'];
                }
                if (isset($_POST['unavailable_day4'])) {
                    $unavailable_day4 = $_POST['unavailable_day4'];
                }
                if (isset($_POST['unavailable_day5'])) {
                    $unavailable_day5 = $_POST['unavailable_day5'];
                }
                if (isset($_POST['unavailable_day6'])) {
                    $unavailable_day6 = $_POST['unavailable_day6'];
                }
                $user_role_booking = $_POST['user_role_booking'];
                $user_role_addbooking = $_POST['user_role_addbooking'];
                $user_role_settings = $_POST['user_role_settings'];
                if (isset($_POST['user_role_resources'])) {
                    $user_role_resources = $_POST['user_role_resources'];
                }
                if (wpdev_bk_is_this_demo()) {
                    $user_role_booking = 'subscriber';
                    $user_role_addbooking = 'subscriber';
                    $user_role_settings = 'subscriber';
                    $user_role_resources = 'subscriber';
                }
                ////////////////////////////////////////////////////////////////////////////////////////////////////////////
                update_bk_option('booking_user_role_booking', $user_role_booking);
                update_bk_option('booking_user_role_addbooking', $user_role_addbooking);
                if (isset($user_role_resources)) {
                    update_bk_option('booking_user_role_resources', $user_role_resources);
                }
                update_bk_option('booking_user_role_settings', $user_role_settings);
                update_bk_option('bookings_num_per_page', $bookings_num_per_page);
                update_bk_option('booking_sort_order', $booking_sort_order);
                update_bk_option('booking_default_toolbar_tab', $booking_default_toolbar_tab);
                //update_bk_option( 'booking_sort_order_direction',$booking_sort_order_direction);
                update_bk_option('booking_skin', $booking_skin);
                update_bk_option('booking_email_reservation_adress', $email_reservation_adress);
                if ($this->get_version() == 'free') {
                    // Update admin from adresses at free version
                    update_bk_option('booking_email_reservation_from_adress', $email_reservation_adress);
                    update_bk_option('booking_email_approval_adress', $email_reservation_adress);
                    update_bk_option('booking_email_deny_adress', $email_reservation_adress);
                }
                update_bk_option('booking_max_monthes_in_calendar', $max_monthes_in_calendar);
                if (!isset($admin_cal_count)) {
                    $admin_cal_count = 2;
                }
                if (!isset($client_cal_count)) {
                    $client_cal_count = 1;
                }
                if (1 * $admin_cal_count > 12) {
                    $admin_cal_count = 12;
                }
                if (1 * $admin_cal_count < 1) {
                    $admin_cal_count = 1;
                }
                update_bk_option('booking_admin_cal_count', $admin_cal_count);
                if (1 * $client_cal_count > 12) {
                    $client_cal_count = 12;
                }
                if (1 * $client_cal_count < 1) {
                    $client_cal_count = 1;
                }
                update_bk_option('booking_client_cal_count', $client_cal_count);
                update_bk_option('booking_start_day_weeek', $start_day_weeek);
                update_bk_option('booking_title_after_reservation', $new_booking_title);
                update_bk_option('booking_title_after_reservation_time', $new_booking_title_time);
                update_bk_option('booking_type_of_thank_you_message', $type_of_thank_you_message);
                update_bk_option('booking_thank_you_page_URL', $thank_you_page_URL);
                update_bk_option('booking_date_format', $booking_date_format);
                update_bk_option('booking_date_view_type', $booking_date_view_type);
                // if (isset( $is_dif_colors_approval_pending ))   $is_dif_colors_approval_pending = 'On';
                // else                                            $is_dif_colors_approval_pending = 'Off';
                // update_bk_option( 'booking_dif_colors_approval_pending' , $is_dif_colors_approval_pending );
                if (isset($is_use_hints_at_admin_panel)) {
                    $is_use_hints_at_admin_panel = 'On';
                } else {
                    $is_use_hints_at_admin_panel = 'Off';
                }
                update_bk_option('booking_is_use_hints_at_admin_panel', $is_use_hints_at_admin_panel);
                if (!wpdev_bk_is_this_demo()) {
                    // Do not allow to chnage it in  the demo
                    if (isset($_POST['is_not_load_bs_script_in_client'])) {
                        $is_not_load_bs_script_in_client = 'On';
                    } else {
                        $is_not_load_bs_script_in_client = 'Off';
                    }
                    update_bk_option('booking_is_not_load_bs_script_in_client', $is_not_load_bs_script_in_client);
                    if (isset($_POST['is_not_load_bs_script_in_admin'])) {
                        $is_not_load_bs_script_in_admin = 'On';
                    } else {
                        $is_not_load_bs_script_in_admin = 'Off';
                    }
                    update_bk_option('booking_is_not_load_bs_script_in_admin', $is_not_load_bs_script_in_admin);
                }
                if (isset($multiple_day_selections)) {
                    $multiple_day_selections = 'On';
                } else {
                    $multiple_day_selections = 'Off';
                }
                update_bk_option('booking_multiple_day_selections', $multiple_day_selections);
                ////////////////////////////////////////////////////////////////////////////////////////////////////////////
                $unavailable_days_num_from_today = $_POST['unavailable_days_num_from_today'];
                update_bk_option('booking_unavailable_days_num_from_today', $unavailable_days_num_from_today);
                if (isset($unavailable_day0)) {
                    $unavailable_day0 = 'On';
                } else {
                    $unavailable_day0 = 'Off';
                }
                update_bk_option('booking_unavailable_day0', $unavailable_day0);
                if (isset($unavailable_day1)) {
                    $unavailable_day1 = 'On';
                } else {
                    $unavailable_day1 = 'Off';
                }
                update_bk_option('booking_unavailable_day1', $unavailable_day1);
                if (isset($unavailable_day2)) {
                    $unavailable_day2 = 'On';
                } else {
                    $unavailable_day2 = 'Off';
                }
                update_bk_option('booking_unavailable_day2', $unavailable_day2);
                if (isset($unavailable_day3)) {
                    $unavailable_day3 = 'On';
                } else {
                    $unavailable_day3 = 'Off';
                }
                update_bk_option('booking_unavailable_day3', $unavailable_day3);
                if (isset($unavailable_day4)) {
                    $unavailable_day4 = 'On';
                } else {
                    $unavailable_day4 = 'Off';
                }
                update_bk_option('booking_unavailable_day4', $unavailable_day4);
                if (isset($unavailable_day5)) {
                    $unavailable_day5 = 'On';
                } else {
                    $unavailable_day5 = 'Off';
                }
                update_bk_option('booking_unavailable_day5', $unavailable_day5);
                if (isset($unavailable_day6)) {
                    $unavailable_day6 = 'On';
                } else {
                    $unavailable_day6 = 'Off';
                }
                update_bk_option('booking_unavailable_day6', $unavailable_day6);
                ////////////////////////////////////////////////////////////////////////////////////////////////////////////
                if (isset($is_delete_if_deactive)) {
                    $is_delete_if_deactive = 'On';
                } else {
                    $is_delete_if_deactive = 'Off';
                }
                update_bk_option('booking_is_delete_if_deactive', $is_delete_if_deactive);
                if (isset($booking_is_show_powered_by_notice)) {
                    $booking_is_show_powered_by_notice = 'On';
                } else {
                    $booking_is_show_powered_by_notice = 'Off';
                }
                update_bk_option('booking_is_show_powered_by_notice', $booking_is_show_powered_by_notice);
                if (isset($wpdev_copyright)) {
                    $wpdev_copyright = 'On';
                } else {
                    $wpdev_copyright = 'Off';
                }
                update_bk_option('booking_wpdev_copyright', $wpdev_copyright);
                ////////////////////////////////////////////////////////////////////////////////////////////////////////////
                if (isset($is_use_captcha)) {
                    $is_use_captcha = 'On';
                } else {
                    $is_use_captcha = 'Off';
                }
                update_bk_option('booking_is_use_captcha', $is_use_captcha);
                if (isset($is_use_autofill_4_logged_user)) {
                    $is_use_autofill_4_logged_user = '******';
                } else {
                    $is_use_autofill_4_logged_user = '******';
                }
                update_bk_option('booking_is_use_autofill_4_logged_user', $is_use_autofill_4_logged_user);
                if (isset($is_show_legend)) {
                    $is_show_legend = 'On';
                } else {
                    $is_show_legend = 'Off';
                }
                update_bk_option('booking_is_show_legend', $is_show_legend);
            } else {
                $booking_skin = get_bk_option('booking_skin');
                $email_reservation_adress = get_bk_option('booking_email_reservation_adress');
                $max_monthes_in_calendar = get_bk_option('booking_max_monthes_in_calendar');
                $bookings_num_per_page = get_bk_option('bookings_num_per_page');
                $booking_sort_order = get_bk_option('booking_sort_order');
                $booking_default_toolbar_tab = get_bk_option('booking_default_toolbar_tab');
                //$booking_sort_order_direction = get_bk_option( 'booking_sort_order_direction');
                $admin_cal_count = get_bk_option('booking_admin_cal_count');
                $new_booking_title = get_bk_option('booking_title_after_reservation');
                $new_booking_title_time = get_bk_option('booking_title_after_reservation_time');
                $type_of_thank_you_message = get_bk_option('booking_type_of_thank_you_message');
                //= 'message'; = 'page';
                $thank_you_page_URL = get_bk_option('booking_thank_you_page_URL');
                //= 'message'; = 'page';
                $booking_date_format = get_bk_option('booking_date_format');
                $booking_date_view_type = get_bk_option('booking_date_view_type');
                $client_cal_count = get_bk_option('booking_client_cal_count');
                $start_day_weeek = get_bk_option('booking_start_day_weeek');
                // $is_dif_colors_approval_pending = get_bk_option( 'booking_dif_colors_approval_pending' );
                $is_use_hints_at_admin_panel = get_bk_option('booking_is_use_hints_at_admin_panel');
                $is_not_load_bs_script_in_client = get_bk_option('booking_is_not_load_bs_script_in_client');
                $is_not_load_bs_script_in_admin = get_bk_option('booking_is_not_load_bs_script_in_admin');
                $multiple_day_selections = get_bk_option('booking_multiple_day_selections');
                $is_delete_if_deactive = get_bk_option('booking_is_delete_if_deactive');
                // check
                $wpdev_copyright = get_bk_option('booking_wpdev_copyright');
                // check
                $booking_is_show_powered_by_notice = get_bk_option('booking_is_show_powered_by_notice');
                // check
                $is_use_captcha = get_bk_option('booking_is_use_captcha');
                // check
                $is_use_autofill_4_logged_user = get_bk_option('booking_is_use_autofill_4_logged_user');
                // check
                $is_show_legend = get_bk_option('booking_is_show_legend');
                // check
                $unavailable_days_num_from_today = get_bk_option('booking_unavailable_days_num_from_today');
                $unavailable_day0 = get_bk_option('booking_unavailable_day0');
                $unavailable_day1 = get_bk_option('booking_unavailable_day1');
                $unavailable_day2 = get_bk_option('booking_unavailable_day2');
                $unavailable_day3 = get_bk_option('booking_unavailable_day3');
                $unavailable_day4 = get_bk_option('booking_unavailable_day4');
                $unavailable_day5 = get_bk_option('booking_unavailable_day5');
                $unavailable_day6 = get_bk_option('booking_unavailable_day6');
                $user_role_booking = get_bk_option('booking_user_role_booking');
                $user_role_addbooking = get_bk_option('booking_user_role_addbooking');
                $user_role_resources = get_bk_option('booking_user_role_resources');
                $user_role_settings = get_bk_option('booking_user_role_settings');
            }
            if (empty($type_of_thank_you_message)) {
                $type_of_thank_you_message = 'message';
            }
            ?>
            <div  class="clear" style="height:10px;"></div>
<form  name="post_option" action="" method="post" id="post_option" >

    <div  style="width:64%; float:left;margin-right:1%;">

        <div class='meta-box'>
            <div <?php 
            $my_close_open_win_id = 'bk_general_settings_main';
            ?>
  id="<?php 
            echo $my_close_open_win_id;
            ?>
" class="postbox <?php 
            if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
                echo 'closed';
            }
            ?>
" > <div title="<?php 
            _e('Click to toggle', 'wpdev-booking');
            ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
            echo get_bk_current_user_id();
            ?>
, '<?php 
            echo $my_close_open_win_id;
            ?>
');"><br></div>
                <h3 class='hndle'><span><?php 
            _e('Main', 'wpdev-booking');
            ?>
</span></h3> <div class="inside">
                    <table class="form-table"><tbody>

            <?php 
            // make_bk_action('wpdev_bk_general_settings_a');
            ?>


                                <tr valign="top">
                                    <th scope="row"><label for="admin_cal_count" ><?php 
            _e('Admin email', 'wpdev-booking');
            ?>
:</label></th>
                                    <td><input id="email_reservation_adress"  name="email_reservation_adress" class="regular-text code" type="text" style="width:350px;" size="145" value="<?php 
            echo $email_reservation_adress;
            ?>
" /><br/>
                                        <span class="description"><?php 
            printf(__('Type default %sadmin email%s for checking bookings', 'wpdev-booking'), '<b>', '</b>');
            ?>
</span>
                                    </td>
                                </tr>

                                <?php 
            make_bk_action('wpdev_bk_general_settings_edit_booking_url');
            ?>

                                <?php 
            do_action('settings_advanced_set_update_hash_after_approve');
            ?>

                                <tr valign="top">
                                    <th scope="row"><label for="is_use_hints_at_admin_panel" ><?php 
            _e('Show hints', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('Show / hide hints', 'wpdev-booking');
            ?>
</th>
                                    <td><input id="is_use_hints_at_admin_panel" type="checkbox" <?php 
            if ($is_use_hints_at_admin_panel == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $is_use_hints_at_admin_panel;
            ?>
" name="is_use_hints_at_admin_panel"/>
                                        <span class="description"><?php 
            _e(' Check, if you want to show help hints at the admin panel.', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>

                                <tr valign="top"><td colspan="2"><div style="border-bottom:1px solid #cccccc;"></div></td></tr>



                                <tr valign="top"> <td colspan="2">
                                    <div style="width:100%;">
                                        <span style="color:#21759B;cursor: pointer;font-weight: bold;"
                                           onclick="javascript: jQuery('#togle_settings_javascriptloading').slideToggle('normal');"
                                           style="text-decoration: none;font-weight: bold;font-size: 11px;">
                                           + <span style="border-bottom:1px dashed #21759B;"><?php 
            _e('Show advanced settings of JavaScript loading', 'wpdev-booking');
            ?>
</span>
                                        </span>
                                    </div>


                                    <table id="togle_settings_javascriptloading" style="display:none;" class="hided_settings_table">

                                    <tr valign="top">
                                        <th scope="row"><label for="is_not_load_bs_script_in_client" ><?php 
            _e('Dissable Bootstrap loading', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('Client side', 'wpdev-booking');
            ?>
</th>
                                        <td><input id="is_not_load_bs_script_in_client" type="checkbox" <?php 
            if ($is_not_load_bs_script_in_client == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $is_not_load_bs_script_in_client;
            ?>
" name="is_not_load_bs_script_in_client"
                                                                                                onclick="javascript: if (this.checked) { var answer = confirm('<?php 
            _e('Warning', 'wpdev-booking');
            echo '! ';
            _e("You are need to be sure what you are doing. You are dissbale of loading some JavaScripts Do you really want to do this?", 'wpdev-booking');
            ?>
'); if ( answer){ this.checked = true; } else {this.checked = false;} }"      
                                                   />
                                            <span class="description"><?php 
            _e(' If your theme or some other plugin is load the BootStrap JavaScripts, you can dissable  loading of this script by this plugin.', 'wpdev-booking');
            ?>
</span>
                                        </td>
                                    </tr>
                                    <tr valign="top">
                                        <th scope="row"><label for="is_not_load_bs_script_in_admin" ><?php 
            _e('Dissable Bootstrap loading', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('Admin  side', 'wpdev-booking');
            ?>
</th>
                                        <td><input id="is_not_load_bs_script_in_admin" type="checkbox" <?php 
            if ($is_not_load_bs_script_in_admin == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $is_not_load_bs_script_in_admin;
            ?>
" name="is_not_load_bs_script_in_admin"
                                             onclick="javascript: if (this.checked) { var answer = confirm('<?php 
            _e('Warning', 'wpdev-booking');
            echo '! ';
            _e("You are need to be sure what you are doing. You are dissbale of loading some JavaScripts Do you really want to do this?", 'wpdev-booking');
            ?>
'); if ( answer){ this.checked = true; } else {this.checked = false;} }"
                                                   />
                                            <span class="description"><?php 
            _e(' If your theme or some other plugin is load the BootStrap JavaScripts, you can dissable  loading of this script by this plugin.', 'wpdev-booking');
            ?>
</span>
                                        </td>
                                    </tr>

                                    </table>
                                    </td>
                                </tr>

                               


                                <tr valign="top"> <td colspan="2">
                                    <div style="width:100%;">
                                        <span style="color:#21759B;cursor: pointer;font-weight: bold;"
                                           onclick="javascript: jQuery('#togle_settings_powered').slideToggle('normal');"
                                           style="text-decoration: none;font-weight: bold;font-size: 11px;">
                                           + <span style="border-bottom:1px dashed #21759B;"><?php 
            _e('Show settings of powered by notice', 'wpdev-booking');
            ?>
</span>
                                        </span>
                                    </div>

                                    <table id="togle_settings_powered" style="display:none;" class="hided_settings_table">

                                            <tr valign="top">
                                                <th scope="row"><label for="booking_is_show_powered_by_notice" ><?php 
            _e('Powered by notice', 'wpdev-booking');
            ?>
:</label></th>
                                                <td><input id="booking_is_show_powered_by_notice" type="checkbox" <?php 
            if ($booking_is_show_powered_by_notice == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $booking_is_show_powered_by_notice;
            ?>
" name="booking_is_show_powered_by_notice"/>
                                                    <span class="description"><?php 
            printf(__(' Turn On/Off powered by "Booking Calendar" notice under the calendar.', 'wpdev-booking'), 'wpbookingcalendar.com');
            ?>
</span>
                                                </td>
                                            </tr>


                                            <tr valign="top">
                                                <th scope="row"><label for="wpdev_copyright" ><?php 
            _e('Copyright notice', 'wpdev-booking');
            ?>
:</label></th>
                                                <td><input id="wpdev_copyright" type="checkbox" <?php 
            if ($wpdev_copyright == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $wpdev_copyright;
            ?>
" name="wpdev_copyright"/>
                                                    <span class="description"><?php 
            printf(__(' Turn On/Off copyright %s notice at footer of site view.', 'wpdev-booking'), 'wpdevelop.com');
            ?>
</span>
                                                </td>
                                            </tr>

                                    </table>
                                </td></tr>



                    </tbody></table>
        </div></div></div>

        <div class='meta-box'>
            <div <?php 
            $my_close_open_win_id = 'bk_general_settings_calendar';
            ?>
  id="<?php 
            echo $my_close_open_win_id;
            ?>
" class="postbox <?php 
            if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
                echo 'closed';
            }
            ?>
" > <div title="<?php 
            _e('Click to toggle', 'wpdev-booking');
            ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
            echo get_bk_current_user_id();
            ?>
, '<?php 
            echo $my_close_open_win_id;
            ?>
');"><br></div>
                <h3 class='hndle'><span><?php 
            _e('Calendar', 'wpdev-booking');
            ?>
</span></h3> <div class="inside">
                    <table class="form-table"><tbody>

                                <tr valign="top">
                                    <th scope="row"><label for="booking_skin" ><?php 
            _e('Calendar skin', 'wpdev-booking');
            ?>
:</label></th>
                                    <td>
            <?php 
            //TODO: Read the conatct from 2 folders and show results at this select box, aqrray with values and names
            // Create 2 more skins: one black for freee versions
            // One modern light/white for paid versions
            $dir_list = $this->dirList(array('/css/skins/', '/inc/skins/'));
            ?>
                                        <select id="booking_skin" name="booking_skin" style="text-transform:capitalize;">
            <?php 
            foreach ($dir_list as $value) {
                if ($booking_skin == $value[1]) {
                    $selected_item = 'selected="SELECTED"';
                } else {
                    $selected_item = '';
                }
                echo '<option ' . $selected_item . ' value="' . $value[1] . '" >' . $value[2] . '</option>';
            }
            ?>
                                        </select>
                                        <span class="description"><?php 
            _e('Select the skin of booking calendar', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <th scope="row"><label for="start_day_weeek" ><?php 
            _e('Number of months', 'wpdev-booking');
            ?>
:</label></th>
                                    <td>
                                        <select id="max_monthes_in_calendar" name="max_monthes_in_calendar">

            <?php 
            for ($mm = 1; $mm < 13; $mm++) {
                ?>
                                            <option <?php 
                if ($max_monthes_in_calendar == $mm . 'm') {
                    echo "selected";
                }
                ?>
 value="<?php 
                echo $mm;
                ?>
m"><?php 
                echo $mm, ' ';
                _e('month(s)', 'wpdev-booking');
                ?>
</option>
                <?php 
            }
            ?>

            <?php 
            for ($mm = 1; $mm < 11; $mm++) {
                ?>
                                            <option <?php 
                if ($max_monthes_in_calendar == $mm . 'y') {
                    echo "selected";
                }
                ?>
 value="<?php 
                echo $mm;
                ?>
y"><?php 
                echo $mm, ' ';
                _e('year(s)', 'wpdev-booking');
                ?>
</option>
                <?php 
            }
            ?>

                                        </select>
                                        <span class="description"><?php 
            _e('Select your maximum number of scroll months at booking calendar', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <th scope="row"><label for="start_day_weeek" ><?php 
            _e('Start Day of week', 'wpdev-booking');
            ?>
:</label></th>
                                    <td>
                                        <select id="start_day_weeek" name="start_day_weeek">
                                            <option <?php 
            if ($start_day_weeek == '0') {
                echo "selected";
            }
            ?>
 value="0"><?php 
            _e('Sunday', 'wpdev-booking');
            ?>
</option>
                                            <option <?php 
            if ($start_day_weeek == '1') {
                echo "selected";
            }
            ?>
 value="1"><?php 
            _e('Monday', 'wpdev-booking');
            ?>
</option>
                                            <option <?php 
            if ($start_day_weeek == '2') {
                echo "selected";
            }
            ?>
 value="2"><?php 
            _e('Tuesday', 'wpdev-booking');
            ?>
</option>
                                            <option <?php 
            if ($start_day_weeek == '3') {
                echo "selected";
            }
            ?>
 value="3"><?php 
            _e('Wednesday', 'wpdev-booking');
            ?>
</option>
                                            <option <?php 
            if ($start_day_weeek == '4') {
                echo "selected";
            }
            ?>
 value="4"><?php 
            _e('Thursday', 'wpdev-booking');
            ?>
</option>
                                            <option <?php 
            if ($start_day_weeek == '5') {
                echo "selected";
            }
            ?>
 value="5"><?php 
            _e('Friday', 'wpdev-booking');
            ?>
</option>
                                            <option <?php 
            if ($start_day_weeek == '6') {
                echo "selected";
            }
            ?>
 value="6"><?php 
            _e('Saturday', 'wpdev-booking');
            ?>
</option>
                                        </select>
                                        <span class="description"><?php 
            _e('Select your start day of the week', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>

                                <tr valign="top"><td colspan="2" style="padding:10px 0px; "><div style="border-bottom:1px solid #cccccc;"></div></td></tr>

                                <tr valign="top">
                                    <th scope="row"><label for="multiple_day_selections" ><?php 
            _e('Multiple days selection', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('in calendar', 'wpdev-booking');
            ?>
</th>
                                    <td><input id="multiple_day_selections" type="checkbox" <?php 
            if ($multiple_day_selections == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $multiple_day_selections;
            ?>
" name="multiple_day_selections"/>
                                        <span class="description"><?php 
            _e(' Check, if you want have multiple days selection at calendar.', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>
                                
                                <?php 
            do_action('settings_advanced_set_range_selections');
            ?>
                                <?php 
            do_action('settings_advanced_set_fixed_time');
            ?>
                                <?php 
            do_action('settings_set_show_cost_in_tooltips');
            ?>
                                <?php 
            do_action('settings_set_show_availability_in_tooltips');
            ?>
                                

                                <tr valign="top">
                                    <th scope="row"><label for="unavailable_days_num_from_today" ><?php 
            _e('Unavailable days from today', 'wpdev-booking');
            ?>
:</label></th>
                                    <td>
                                        <select id="unavailable_days_num_from_today" name="unavailable_days_num_from_today">
                                            <?php 
            for ($i = 0; $i < 32; $i++) {
                ?>
                                            <option <?php 
                if ($unavailable_days_num_from_today == $i) {
                    echo "selected";
                }
                ?>
 value="<?php 
                echo $i;
                ?>
"><?php 
                echo $i;
                ?>
</option>
                                            <?php 
            }
            ?>
                                        </select>
                                        <span class="description"><?php 
            _e('Select number of unavailable days in calendar start from today.', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>


                                <tr valign="top">
                                    <th scope="row"><label for="is_dif_colors_approval_pending" ><?php 
            _e('Unavailable days', 'wpdev-booking');
            ?>
:</label></th>
                                    <td>    <div style="float:left;width:500px;border:0px solid red;">
                                            <input id="unavailable_day0" name="unavailable_day0" <?php 
            if ($unavailable_day0 == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $unavailable_day0;
            ?>
"  type="checkbox" />
                                            <span class="description"><?php 
            _e('Sunday', 'wpdev-booking');
            ?>
</span>&nbsp;
                                            <input id="unavailable_day1" name="unavailable_day1" <?php 
            if ($unavailable_day1 == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $unavailable_day1;
            ?>
"  type="checkbox" />
                                            <span class="description"><?php 
            _e('Monday', 'wpdev-booking');
            ?>
</span>&nbsp;
                                            <input id="unavailable_day2" name="unavailable_day2" <?php 
            if ($unavailable_day2 == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $unavailable_day2;
            ?>
"  type="checkbox" />
                                            <span class="description"><?php 
            _e('Tuesday', 'wpdev-booking');
            ?>
</span>&nbsp;
                                            <input id="unavailable_day3" name="unavailable_day3" <?php 
            if ($unavailable_day3 == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $unavailable_day3;
            ?>
"  type="checkbox" />
                                            <span class="description"><?php 
            _e('Wednesday', 'wpdev-booking');
            ?>
</span>&nbsp;
                                            <input id="unavailable_day4" name="unavailable_day4" <?php 
            if ($unavailable_day4 == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $unavailable_day4;
            ?>
"  type="checkbox" />
                                            <span class="description"><?php 
            _e('Thursday', 'wpdev-booking');
            ?>
</span>&nbsp;
                                            <input id="unavailable_day5" name="unavailable_day5" <?php 
            if ($unavailable_day5 == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $unavailable_day5;
            ?>
"  type="checkbox" />
                                            <span class="description"><?php 
            _e('Friday', 'wpdev-booking');
            ?>
</span>&nbsp;
                                            <input id="unavailable_day6" name="unavailable_day6" <?php 
            if ($unavailable_day6 == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $unavailable_day6;
            ?>
"  type="checkbox" />
                                            <span class="description"><?php 
            _e('Saturday', 'wpdev-booking');
            ?>
</span>
                                        </div>
                                        <div style="width:auto;margin-top:25px;">
                                           <span class="description"><?php 
            _e('Check unavailable days in calendars. This option is overwrite all other settings.', 'wpdev-booking');
            ?>
</span></div>
                                    </td>
                                </tr>


                    </tbody></table>
        </div></div></div>

        <div class='meta-box'>
            <div <?php 
            $my_close_open_win_id = 'bk_general_settings_form';
            ?>
  id="<?php 
            echo $my_close_open_win_id;
            ?>
" class="postbox <?php 
            if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
                echo 'closed';
            }
            ?>
" > <div title="<?php 
            _e('Click to toggle', 'wpdev-booking');
            ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
            echo get_bk_current_user_id();
            ?>
, '<?php 
            echo $my_close_open_win_id;
            ?>
');"><br></div>
                <h3 class='hndle'><span><?php 
            _e('Form', 'wpdev-booking');
            ?>
</span></h3> <div class="inside">
                    <table class="form-table"><tbody>

                                <tr valign="top">
                                    <th scope="row"><label for="is_use_captcha" ><?php 
            _e('CAPTCHA', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('at booking form', 'wpdev-booking');
            ?>
</th>
                                    <td><input id="is_use_captcha" type="checkbox" <?php 
            if ($is_use_captcha == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $is_use_captcha;
            ?>
" name="is_use_captcha"/>
                                        <span class="description"><?php 
            _e(' Check, if you want to activate CAPTCHA inside of booking form.', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>

                                <tr valign="top">
                                    <th scope="row"><label for="is_use_autofill_4_logged_user" ><?php 
            _e('Auto fill fields', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('for logged in users', 'wpdev-booking');
            ?>
</th>
                                    <td><input id="is_use_autofill_4_logged_user" type="checkbox" <?php 
            if ($is_use_autofill_4_logged_user == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $is_use_autofill_4_logged_user;
            ?>
" name="is_use_autofill_4_logged_user"/>
                                        <span class="description"><?php 
            _e(' Check, if you want activate auto fill fields of booking form for logged in users.', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>




                                <tr valign="top">
                                    <th scope="row"><label for="is_show_legend" ><?php 
            _e('Show legend', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('at booking calendar', 'wpdev-booking');
            ?>
</th>
                                    <td><input id="is_show_legend" type="checkbox" <?php 
            if ($is_show_legend == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $is_show_legend;
            ?>
" name="is_show_legend"/>
                                        <span class="description"><?php 
            _e(' Check, if you want to show legend of dates under booking calendar.', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>

                        <tr valign="top" style="padding: 0px;">


                                <td style="width:50%;font-weight: bold;"><input  <?php 
            if ($type_of_thank_you_message == 'message') {
                echo 'checked="checked"';
            }
            /**/
            ?>
 value="message" type="radio" id="type_of_thank_you_message"  name="type_of_thank_you_message"  onclick="javascript: jQuery('#togle_settings_thank-you_page').slideUp('normal');jQuery('#togle_settings_thank-you_message').slideDown('normal');"  /> <label for="type_of_thank_you_message" ><?php 
            _e('Show "thank you" message after booking is done', 'wpdev-booking');
            ?>
</label></td>
                                <td style="width:50%;font-weight: bold;"><input  <?php 
            if ($type_of_thank_you_message == 'page') {
                echo 'checked="checked"';
            }
            /**/
            ?>
 value="page" type="radio" id="type_of_thank_you_message"  name="type_of_thank_you_message"  onclick="javascript: jQuery('#togle_settings_thank-you_page').slideDown('normal');jQuery('#togle_settings_thank-you_message').slideUp('normal');"  /> <label for="type_of_thank_you_message" ><?php 
            _e('Redirect visitor to a new "thank you" page', 'wpdev-booking');
            ?>
 </label></td>



                        </tr>
                        <tr valign="top" style="padding: 0px;"><td colspan="2">
                            <table id="togle_settings_thank-you_message" style="width:100%;<?php 
            if ($type_of_thank_you_message != 'message') {
                echo 'display:none;';
            }
            /**/
            ?>
" class="hided_settings_table">
                                <tr valign="top">
                                            <th>
                                            <label for="new_booking_title" style="font-size:12px;" ><?php 
            _e('New booking title', 'wpdev-booking');
            ?>
:</label><br/>
            <?php 
            printf(__('%sshowing after%s booking', 'wpdev-booking'), '<span style="color:#888;font-weight:bold;">', '</span>');
            ?>
                                            </th>
                                            <td>
                                                <input id="new_booking_title" class="regular-text code" type="text" size="45" value="<?php 
            echo $new_booking_title;
            ?>
" name="new_booking_title" style="width:99%;"/>
                                                <span class="description"><?php 
            printf(__('Type title of new booking %safter booking has done by user%s', 'wpdev-booking'), '<b>', '</b>');
            ?>
</span>
                                                <?php 
            make_bk_action('show_additional_translation_shortcode_help');
            ?>
                                            </td>
                                </tr>
                                <tr><th>
                                            <label for="new_booking_title" style=" font-weight: bold;font-size: 12px;" ><?php 
            _e('Showing title time', 'wpdev-booking');
            ?>
:</label><br/>
            <?php 
            printf(__('%snew booking%s', 'wpdev-booking'), '<span style="color:#888;font-weight:bold;">', '</span>');
            ?>
                                            </th>
                                        <td>
                                            <input id="new_booking_title_time" class="regular-text code" type="text" size="45" value="<?php 
            echo $new_booking_title_time;
            ?>
" name="new_booking_title_time" />
                                            <span class="description"><?php 
            printf(__('Type in miliseconds count of time for showing new booking title', 'wpdev-booking'), '<b>', '</b>');
            ?>
</span>
                                        </td>
                                        </tr>
                            </table>

                            <table id="togle_settings_thank-you_page" style="width:100%;<?php 
            if ($type_of_thank_you_message != 'page') {
                echo 'display:none;';
            }
            /**/
            ?>
" class="hided_settings_table">
                                <tr valign="top">
                                <th scope="row" style="width:170px;"><label for="thank_you_page_URL" ><?php 
            _e('URL of "thank you" page', 'wpdev-booking');
            ?>
:</label></th>
                                    <td><input value="<?php 
            echo $thank_you_page_URL;
            ?>
" name="thank_you_page_URL" id="thank_you_page_URL" class="regular-text code" type="text" size="45"  style="width:99%;" />
                                        <span class="description"><?php 
            printf(__('Type URL of %s"thank you" page%s', 'wpdev-booking'), '<b>', '</b>');
            ?>
</span>
                                    </td>
                                </tr>
                            </table>


                    </td></tr>

                    </tbody></table>

        </div></div></div>

        <div class='meta-box'>
            <div <?php 
            $my_close_open_win_id = 'bk_general_settings_bktable';
            ?>
  id="<?php 
            echo $my_close_open_win_id;
            ?>
" class="postbox <?php 
            if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
                echo 'closed';
            }
            ?>
" > <div title="<?php 
            _e('Click to toggle', 'wpdev-booking');
            ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
            echo get_bk_current_user_id();
            ?>
, '<?php 
            echo $my_close_open_win_id;
            ?>
');"><br></div>
                <h3 class='hndle'><span><?php 
            _e('Listing of bookings', 'wpdev-booking');
            ?>
</span></h3> <div class="inside">
                    <table class="form-table"><tbody>

                                <tr valign="top">
                                    <th scope="row"><label for="bookings_num_per_page" ><?php 
            _e('Bookings number per page', 'wpdev-booking');
            ?>
:</label></th>
                                    <td>

                                        <?php 
            $order_array = array(5, 10, 20, 25, 50, 75, 100);
            ?>
                                        <select id="bookings_num_per_page" name="bookings_num_per_page">
                                        <?php 
            foreach ($order_array as $mm) {
                ?>
                                            <option <?php 
                if ($bookings_num_per_page == strtolower($mm)) {
                    echo "selected";
                }
                ?>
 value="<?php 
                echo strtolower($mm);
                ?>
"><?php 
                echo $mm;
                ?>
</option>
                                        <?php 
            }
            ?>
                                        </select>
                                        <span class="description"><?php 
            _e('Select number of bookings per page in booking listing', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>


                                <tr valign="top">
                                    <th scope="row"><label for="booking_sort_order" ><?php 
            _e('Bookings default order', 'wpdev-booking');
            ?>
:</label></th>
                                    <td><?php 
            $order_array = array('ID');
            $wpdevbk_selectors = array(__('ID', 'wpdev-booking') . '&nbsp;' . __('ASC', 'wpdev-booking') => '', __('ID', 'wpdev-booking') . '&nbsp;' . __('DESC', 'wpdev-booking') => 'booking_id_asc');
            if (class_exists('wpdev_bk_personal')) {
                $order_array[] = 'Resource';
                $wpdevbk_selectors[__('Resource', 'wpdev-booking') . '&nbsp;' . __('ASC', 'wpdev-booking')] = 'booking_type';
                $wpdevbk_selectors[__('Resource', 'wpdev-booking') . '&nbsp;' . __('DESC', 'wpdev-booking')] = 'booking_type_asc';
            }
            if (class_exists('wpdev_bk_biz_s')) {
                $order_array[] = 'Cost';
                $wpdevbk_selectors[__('Cost', 'wpdev-booking') . '&nbsp;' . __('ASC', 'wpdev-booking')] = 'cost';
                $wpdevbk_selectors[__('Cost', 'wpdev-booking') . '&nbsp;' . __('DESC', 'wpdev-booking')] = 'cost_asc';
            }
            ?>
                                        <select id="booking_sort_order" name="booking_sort_order">
                                        <?php 
            foreach ($wpdevbk_selectors as $kk => $mm) {
                ?>
                                            <option <?php 
                if ($booking_sort_order == strtolower($mm)) {
                    echo "selected";
                }
                ?>
 value="<?php 
                echo strtolower($mm);
                ?>
"><?php 
                echo $kk;
                ?>
</option>
                                        <?php 
            }
            ?>
                                        </select>

                                        <span class="description"><?php 
            _e('Select your default order of bookings in the booking listing', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>


                                <tr valign="top">
                                    <th scope="row"><label for="booking_default_toolbar_tab" ><?php 
            _e('Default toolbar tab', 'wpdev-booking');
            ?>
:</label></th>
                                    <td>

                                        <?php 
            $wpdevbk_selectors = array(__('Filter tab', 'wpdev-booking') => 'filter', __('Actions tab', 'wpdev-booking') => 'actions');
            ?>
                                        <select id="booking_default_toolbar_tab" name="booking_default_toolbar_tab">
                                        <?php 
            foreach ($wpdevbk_selectors as $kk => $mm) {
                ?>
                                            <option <?php 
                if ($booking_default_toolbar_tab == strtolower($mm)) {
                    echo "selected";
                }
                ?>
 value="<?php 
                echo strtolower($mm);
                ?>
"><?php 
                echo $kk;
                ?>
</option>
                                        <?php 
            }
            ?>
                                        </select>

                                        <span class="description"><?php 
            _e('Select your default opened tab in toolbar at booking listing page', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>

                                <?php 
            make_bk_action('wpdev_bk_general_settings_set_default_booking_resource');
            ?>
                                
                                <tr valign="top">
                                    <th scope="row"><label for="booking_date_format" ><?php 
            _e('Date Format', 'wpdev-booking');
            ?>
:</label></th>
                                    <td>
                                    <fieldset>
            <?php 
            $date_formats = array(__('F j, Y'), 'Y/m/d', 'm/d/Y', 'd/m/Y');
            $custom = TRUE;
            foreach ($date_formats as $format) {
                echo "\t<label title='" . esc_attr($format) . "'>";
                echo "<input type='radio' name='booking_date_format' value='" . esc_attr($format) . "'";
                if (get_bk_option('booking_date_format') === $format) {
                    echo " checked='checked'";
                    $custom = FALSE;
                }
                echo ' /> ' . date_i18n($format) . "</label> &nbsp;&nbsp;&nbsp;\n";
            }
            echo '<div style="height:7px;"></div>';
            echo '<label><input type="radio" name="booking_date_format" id="date_format_custom_radio" value="' . $booking_date_format . '"';
            if ($custom) {
                echo ' checked="checked"';
            }
            echo '/> ' . __('Custom', 'wpdev-booking') . ': </label>';
            ?>
                                            <input id="booking_date_format_custom" class="regular-text code" type="text" size="45" value="<?php 
            echo $booking_date_format;
            ?>
" name="booking_date_format_custom" style="line-height:35px;"
                                                   onchange="javascript:document.getElementById('date_format_custom_radio').value = this.value;document.getElementById('date_format_custom_radio').checked=true;"
                                                   />
            <?php 
            echo ' ' . date_i18n($booking_date_format) . "\n";
            echo '&nbsp;&nbsp;';
            ?>
            <?php 
            printf(__('Type your date format for showing in emails and booking table. %sDocumentation on date formatting.%s', 'wpdev-booking'), '<br/><a href="http://codex.wordpress.org/Formatting_Date_and_Time" target="_blank">', '</a>');
            ?>
                                    </fieldset>
                                    </td>
                                </tr>

            <?php 
            do_action('settings_advanced_set_time_format');
            ?>

                                <tr valign="top">
                                    <th scope="row"><label for="booking_date_view_type" ><?php 
            _e('Dates view', 'wpdev-booking');
            ?>
:</label></th>
                                    <td>
                                        <select id="booking_date_view_type" name="booking_date_view_type">
                                            <option <?php 
            if ($booking_date_view_type == 'short') {
                echo "selected";
            }
            ?>
 value="short"><?php 
            _e('Short days view', 'wpdev-booking');
            ?>
</option>
                                            <option <?php 
            if ($booking_date_view_type == 'wide') {
                echo "selected";
            }
            ?>
 value="wide"><?php 
            _e('Wide days view', 'wpdev-booking');
            ?>
</option>
                                        </select>
                                        <span class="description"><?php 
            _e('Select default type of dates view at the booking tables', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>

                    </tbody></table>

        </div></div></div>

        <?php 
            make_bk_action('wpdev_bk_general_settings_cost_section');
            ?>

        <?php 
            make_bk_action('wpdev_bk_general_settings_pending_auto_cancelation');
            ?>

        <?php 
            do_action('wpdev_bk_general_settings_advanced_section');
            ?>

    </div>
    <div style="width:35%; float:left;">

            <?php 
            $version = $this->get_version();
            if (wpdev_bk_is_this_demo()) {
                $version = 'free';
            }
            if ($version !== 'free' && $version !== 'biz_l') {
                $this->showUpgradeWindow($version);
            }
            ?>

        <div class='meta-box'>
                <div <?php 
            $my_close_open_win_id = 'bk_general_settings_info';
            ?>
  id="<?php 
            echo $my_close_open_win_id;
            ?>
" class="gdrgrid postbox <?php 
            if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
                echo 'closed';
            }
            ?>
" > <div title="<?php 
            _e('Click to toggle', 'wpdev-booking');
            ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
            echo get_bk_current_user_id();
            ?>
, '<?php 
            echo $my_close_open_win_id;
            ?>
');"><br></div>
                <h3 class='hndle'><span><?php 
            _e('Information', 'wpdev-booking');
            ?>
</span></h3>
                <div class="inside">
                    <?php 
            $this->dashboard_bk_widget_show();
            ?>
                </div>
                </div>
        </div>

            <?php 
            if (false && !class_exists('wpdev_crm') && $version != 'free') {
                ?>

        <div class='meta-box'>
                <div <?php 
                $my_close_open_win_id = 'bk_general_settings_recomended_plugins';
                ?>
  id="<?php 
                echo $my_close_open_win_id;
                ?>
" class="gdrgrid postbox <?php 
                if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
                    echo 'closed';
                }
                ?>
" > <div title="<?php 
                _e('Click to toggle', 'wpdev-booking');
                ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
                echo get_bk_current_user_id();
                ?>
, '<?php 
                echo $my_close_open_win_id;
                ?>
');"><br></div>
                <h3 class='hndle'><span><?php 
                _e('Recomended WordPress Plugins', 'wpdev-booking');
                ?>
</span></h3>
                <div class="inside">
                    <h2 style="margin:10px;"><?php 
                _e('Booking Manager - show all old bookings');
                ?>
 </h2>
                    <img src="<?php 
                echo WPDEV_BK_PLUGIN_URL . '/img/users-48x48.png';
                ?>
" style="float:left; padding:0px 10px 10px 0px;">

                    <p style="margin:0px;">
                <?php 
                printf(__('This wordpress plugin is  %sshow all approved and pending bookings from past%s. Show how many each customer is made bookings. Paid versions support %sexport to CSV, print loyout, advanced filter%s. ', 'wpdev-booking'), '<strong>', '</strong>', '<strong>', '</strong>');
                ?>
 <br/>
                    </p>
                    <p style="text-align:center;padding:10px 0px;">
                        <a href="http://wordpress.org/extend/plugins/booking-manager" class="button-primary" target="_blank">Download from wordpress</a>
                        <a href="http://wpbookingmanager.com" class="button-primary" target="_blank">Demo site</a>
                    </p>

                </div>
            </div>
        </div>
                <?php 
            }
            ?>


        <div class='meta-box'>
            <div <?php 
            $my_close_open_win_id = 'bk_general_settings_users_permissions';
            ?>
  id="<?php 
            echo $my_close_open_win_id;
            ?>
" class="postbox <?php 
            if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
                echo 'closed';
            }
            ?>
" > <div title="<?php 
            _e('Click to toggle', 'wpdev-booking');
            ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
            echo get_bk_current_user_id();
            ?>
, '<?php 
            echo $my_close_open_win_id;
            ?>
');"><br></div>
                <h3 class='hndle'><span><?php 
            _e('User permissions for plugin menu pages', 'wpdev-booking');
            ?>
</span></h3> <div class="inside">
                    <table class="form-table"><tbody>

                            <tr valign="top">
                                <td colspan="2">
                                    <span class="description"><?php 
            _e('Select user access level for the menu pages of plugin', 'wpdev-booking');
            ?>
</span>
                                </td>
                            </tr>
                                <tr valign="top">
                                    <!--td colspan="2"><!--div style="width:100%;">
                                        <span style="color:#21759B;cursor: pointer;font-weight: bold;"
                                           onclick="javascript: jQuery('#togle_settings_useraccess').slideToggle('normal');"
                                           style="text-decoration: none;font-weight: bold;font-size: 11px;">
                                           + <span style="border-bottom:1px dashed #21759B;"><?php 
            _e('Show settings of user access level to admin menu', 'wpdev-booking');
            ?>
</span>
                                        </span>
                                    </div>

                                    <table id="togle_settings_useraccess" style="display:none;" class="hided_settings_table">
                                        <tr valign="top"-->

                                            <th scope="row"><label for="start_day_weeek" ><?php 
            _e('Bookings', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('menu page', 'wpdev-booking');
            ?>
</th>
                                            <td>
                                                <select id="user_role_booking" name="user_role_booking">
                                                    <option <?php 
            if ($user_role_booking == 'subscriber') {
                echo "selected";
            }
            ?>
 value="subscriber" ><?php 
            echo translate_user_role('Subscriber');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_booking == 'administrator') {
                echo "selected";
            }
            ?>
 value="administrator" ><?php 
            echo translate_user_role('Administrator');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_booking == 'editor') {
                echo "selected";
            }
            ?>
 value="editor" ><?php 
            echo translate_user_role('Editor');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_booking == 'author') {
                echo "selected";
            }
            ?>
 value="author" ><?php 
            echo translate_user_role('Author');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_booking == 'contributor') {
                echo "selected";
            }
            ?>
 value="contributor" ><?php 
            echo translate_user_role('Contributor');
            ?>
</option>
                                                </select>                                                
                                            </td>
                                        </tr>


                                        <tr valign="top">
                                            <th scope="row"><label for="start_day_weeek" ><?php 
            _e('Add booking', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('access level', 'wpdev-booking');
            ?>
</th>
                                            <td>
                                                <select id="user_role_addbooking" name="user_role_addbooking">
                                                    <option <?php 
            if ($user_role_addbooking == 'subscriber') {
                echo "selected";
            }
            ?>
 value="subscriber" ><?php 
            echo translate_user_role('Subscriber');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_addbooking == 'administrator') {
                echo "selected";
            }
            ?>
 value="administrator" ><?php 
            echo translate_user_role('Administrator');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_addbooking == 'editor') {
                echo "selected";
            }
            ?>
 value="editor" ><?php 
            echo translate_user_role('Editor');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_addbooking == 'author') {
                echo "selected";
            }
            ?>
 value="author" ><?php 
            echo translate_user_role('Author');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_addbooking == 'contributor') {
                echo "selected";
            }
            ?>
 value="contributor" ><?php 
            echo translate_user_role('Contributor');
            ?>
</option>
                                                </select>
                                            </td>
                                        </tr>

                                        <?php 
            if ($version !== 'free') {
                ?>
                                        <tr valign="top">
                                            <th scope="row"><label for="user_role_resources" ><?php 
                _e('Resources', 'wpdev-booking');
                ?>
:</label><br><?php 
                _e('access level', 'wpdev-booking');
                ?>
</th>
                                            <td>
                                                <select id="user_role_resources" name="user_role_resources">
                                                    <option <?php 
                if ($user_role_resources == 'subscriber') {
                    echo "selected";
                }
                ?>
 value="subscriber" ><?php 
                echo translate_user_role('Subscriber');
                ?>
</option>
                                                    <option <?php 
                if ($user_role_resources == 'administrator') {
                    echo "selected";
                }
                ?>
 value="administrator" ><?php 
                echo translate_user_role('Administrator');
                ?>
</option>
                                                    <option <?php 
                if ($user_role_resources == 'editor') {
                    echo "selected";
                }
                ?>
 value="editor" ><?php 
                echo translate_user_role('Editor');
                ?>
</option>
                                                    <option <?php 
                if ($user_role_resources == 'author') {
                    echo "selected";
                }
                ?>
 value="author" ><?php 
                echo translate_user_role('Author');
                ?>
</option>
                                                    <option <?php 
                if ($user_role_resources == 'contributor') {
                    echo "selected";
                }
                ?>
 value="contributor" ><?php 
                echo translate_user_role('Contributor');
                ?>
</option>
                                                </select>
                                            </td>
                                        </tr>
                                        <?php 
            }
            ?>

                                        <tr valign="top">
                                            <th scope="row"><label for="start_day_weeek" ><?php 
            _e('Settings', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('access level', 'wpdev-booking');
            ?>
</th>
                                            <td>
                                                <select id="user_role_settings" name="user_role_settings">
                                                    <option <?php 
            if ($user_role_settings == 'subscriber') {
                echo "selected";
            }
            ?>
 value="subscriber" ><?php 
            echo translate_user_role('Subscriber');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_settings == 'administrator') {
                echo "selected";
            }
            ?>
 value="administrator" ><?php 
            echo translate_user_role('Administrator');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_settings == 'editor') {
                echo "selected";
            }
            ?>
 value="editor" ><?php 
            echo translate_user_role('Editor');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_settings == 'author') {
                echo "selected";
            }
            ?>
 value="author" ><?php 
            echo translate_user_role('Author');
            ?>
</option>
                                                    <option <?php 
            if ($user_role_settings == 'contributor') {
                echo "selected";
            }
            ?>
 value="contributor" ><?php 
            echo translate_user_role('Contributor');
            ?>
</option>
                                                </select>
            <?php 
            if (wpdev_bk_is_this_demo()) {
                ?>
 <br/><span class="description" style="font-weight: bold;">You do not allow to change this items because right now you test DEMO</span> <?php 
            }
            ?>
                                            </td>
                                        </tr>
                                    <!--/table>
                                    </td>
                                </tr-->


                    </tbody></table>

        </div></div></div>

        <div class='meta-box'>
            <div <?php 
            $my_close_open_win_id = 'bk_general_settings_uninstall';
            ?>
  id="<?php 
            echo $my_close_open_win_id;
            ?>
" class="postbox <?php 
            if ('1' == get_user_option('booking_win_' . $my_close_open_win_id)) {
                echo 'closed';
            }
            ?>
" > <div title="<?php 
            _e('Click to toggle', 'wpdev-booking');
            ?>
" class="handlediv"  onclick="javascript:verify_window_opening(<?php 
            echo get_bk_current_user_id();
            ?>
, '<?php 
            echo $my_close_open_win_id;
            ?>
');"><br></div>
                <h3 class='hndle'><span><?php 
            _e('Uninstal / deactivation', 'wpdev-booking');
            ?>
</span></h3> <div class="inside">
                    <table class="form-table"><tbody>


                                <tr valign="top">
                                    <th scope="row"><label for="is_delete_if_deactive" ><?php 
            _e('Delete booking data', 'wpdev-booking');
            ?>
:</label><br><?php 
            _e('when plugin deactivated', 'wpdev-booking');
            ?>
</th>
                                    <td><input id="is_delete_if_deactive" type="checkbox" <?php 
            if ($is_delete_if_deactive == 'On') {
                echo "checked";
            }
            ?>
  value="<?php 
            echo $is_delete_if_deactive;
            ?>
" name="is_delete_if_deactive"
                                            onclick="javascript: if (this.checked) { var answer = confirm('<?php 
            _e('Warning', 'wpdev-booking');
            echo '! ';
            _e("If you check this option, at uninstall process of this plugin all your booking data will be deleted. Do you really want to do this?", 'wpdev-booking');
            ?>
'); if ( answer){ this.checked = true; } else {this.checked = false;} }"
                                               />
                                        <span class="description"><?php 
            _e(' Check, if you want delete booking data during uninstalling plugin.', 'wpdev-booking');
            ?>
</span>
                                    </td>
                                </tr>

                    </tbody></table>

        </div></div></div>

    </div>

    <div class="clear" style="height:10px;"></div>
    <input class="button-primary" style="float:right;" type="submit" value="<?php 
            _e('Save Changes', 'wpdev-booking');
            ?>
" name="Submit"/>
    <div class="clear" style="height:10px;"></div>



</form>
            <?php 
        }
 public function delete($action_name)
 {
     if (isset($this->actions[$action_name])) {
         unset($this->actions[$action_name]);
     }
     // Update to DB
     $booking_cron = get_bk_option('booking_cron');
     if ($booking_cron === false) {
         $booking_cron = array();
     } else {
         if (is_serialized($booking_cron)) {
             $booking_cron = unserialize($booking_cron);
         }
         if (isset($booking_cron[$action_name])) {
             unset($booking_cron[$action_name]);
         }
     }
     ////////////////////////////////////////////////////////////////////
     update_bk_option('booking_cron', $booking_cron);
 }