Settings > (Sync) Export page * @category Settings API * @author wpdevelop * * @web-site https://wpbookingcalendar.com/ * @email info@wpbookingcalendar.com * @modified 2017-07-09 * * This is COMMERCIAL SCRIPT * We are not guarantee correct work and support of Booking Calendar, if some file(s) was modified by someone else then wpdevelop. */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) {exit;} /** * Show Content * Update Content * Define Slug * Define where to show */ class WPBC_Page_SettingsExportFeeds extends WPBC_Page_Structure { public $settings_api = false; public function in_page() { return 'wpbc-settings'; } public function tabs() { $tabs = array(); $tabs[ 'sync' ] = array( 'title' => __( 'Sync', 'booking') // Title of TAB , 'page_title'=> __( 'Sync', 'booking') // Title of Page , 'hint' => __('Import' ,'booking') . ' / ' . __('Export' ,'booking') //, 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link //, 'position' => '' // 'left' || 'right' || '' //, 'css_classes'=> '' // CSS class(es) //, 'icon' => '' // Icon - link to the real PNG img , 'font_icon' => 'wpbc_icn_get_import_export' // CSS definition of forn Icon //, 'default' => false // Is this tab activated by default or not: true || false. //, 'disabled' => false // Is this tab disbaled: true || false. //, 'hided' => false // Is this tab hided: true || false. , 'subtabs' => array() ); $subtabs = array(); $subtabs[ 'export' ] = array( 'type' => 'subtab' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html' , 'title' => __('Export' ,'booking') . ' - .ics' // Title of TAB , 'page_title' => __('Export Bookings via .ics' ,'booking') //. ' Beta' // Title of Page , 'hint' => __('Set up and configure the export of bookings into .ics feeds.' ,'booking') // Hint , 'link' => '' // link , 'position' => '' // 'left' || 'right' || '' , 'css_classes' => '' // CSS class(es) //, 'icon' => 'http://.../icon.png' // Icon - link to the real PNG img , 'font_icon' => 'wpbc-bi-box-arrow-up-right' // CSS definition of Font Icon , 'default' => false // Is this sub tab activated by default or not: true || false. , 'disabled' => false // Is this sub tab deactivated: true || false. , 'checkbox' => false // or definition array for specific checkbox: array( 'checked' => true, 'name' => 'feature1_active_status' ) //, 'checkbox' => array( 'checked' => $is_checked, 'name' => 'enabled_active_status' ) , 'content' => 'content' // Function to load as conten of this TAB ); $tabs[ 'sync' ]['subtabs'] = $subtabs; return $tabs; } /** Show Content of Settings page */ public function content() { $this->css(); //////////////////////////////////////////////////////////////////////// // Checking //////////////////////////////////////////////////////////////////////// do_action( 'wpbc_hook_settings_page_header', 'export_feeds_settings'); // Define Notices Section and show some static messages, if needed if ( ! wpbc_is_mu_user_can_be_here('activated_user') ) return false; // Check if MU user activated, otherwise show Warning message. // if ( ! wpbc_is_mu_user_can_be_here('only_super_admin') ) return false; // User is not Super admin, so exit. Basically its was already checked at the bottom of the PHP file, just in case. //////////////////////////////////////////////////////////////////////// // Load Data //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// // S u b m i t Main Form //////////////////////////////////////////////////////////////////////// $submit_form_name = 'wpbc_export_feeds'; // Define form name // $this->get_api()->validated_form_id = $submit_form_name; // Define ID of Form for ability to validate fields (like required field) before submit. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) { // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. } $nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page // Save Changes $this->update(); } //////////////////////////////////////////////////////////////////////// // JavaScript: Tooltips, Popover, Datepick (js & css) //////////////////////////////////////////////////////////////////////// echo ''; wpbc_js_for_bookings_page(); echo ''; ?>
mbstring extension.' ); ?>
' // , '' . 'Booking Manager' . ' ' . ' ' .esc_attr($wpbm_minimum_version).' ('. esc_attr__('or newer','booking') . ') ' , '' . 'Booking Manager' . '' , '' , '' ) ); ?>
'wpbc_booking_resources_search_form' , 'search_get_key' => 'wh_resource_id' , 'is_pseudo' => false ) ); //////////////////////////////////////////////////////////////////////// // Content //////////////////////////////////////////////////////////////////////// ?>
'wh_resource_id' ) ); // FixIn: 8.0.1.12. ?>
enqueue_js(); } /** Save Chanages */ public function update() { if ( function_exists( 'wpbc_export_feeds__update') ) wpbc_export_feeds__update(); else wpbc_export_ics_feed__update(); // Free version // Get Validated Email fields //$validated_fields = $this->get_api()->validate_post(); //$validated_fields = apply_filters( 'wpbc_fields_before_saving_to_db__export_feeds', $validated_fields ); //Hook for validated fields. //$this->get_api()->save_to_db( $validated_fields ); // Old way of saving: // update_bk_option( 'booking_cache_expiration' , WPBC_Settings_API::validate_text_post_static( 'booking_cache_expiration' ) ); wpbc_show_changes_saved_message(); } //TODO: claer unused CSS here // /** CSS for this page */ private function css() { ?> } add_action('wpbc_menu_created', array( new WPBC_Page_SettingsExportFeeds() , '__construct') ); // Executed after creation of Menu /** Show .ics ULR section for Free version */ function wpbc_export_ics_feed__table() { $resource_export = get_bk_option( 'booking_resource_export_ics_url' ); ?>
23 ) { echo esc_attr( substr( $wpbc_h_u, 0, 10 ) . '...' . substr( $wpbc_h_u, -10 ) ); } else { echo esc_attr( $wpbc_h_u ); }?>

.
$v_val ) { // FixIn: 8.1.1.9. if ( strpos( $v_val, '.') !== false ) { $v_val = sanitize_file_name( $v_val ); } $validated_value[ $v_i ] = $v_val; } // $validated_value = array_map( 'sanitize_file_name', $validated_value ); $validated_value = implode( '/', $validated_value ); $validated_value = strtolower( $validated_value ); $validated_value = wpbc_make_link_relative( $validated_value ); if ( empty( $validated_value ) ) $validated_value = '/ics/' . wpbc_get_slug_format( 'default' ); update_bk_option( 'booking_resource_export_ics_url', $validated_value ); return $validated_value; }