PluginProbe
Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar / 2.1.21
Booking Manager – Sync WP Booking Calendar – Import Events, Export Bookings to ICS Calendar v2.1.21
2.1.22 2.1.21 2.1.20 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 trunk 1.1 2.0 2.0.1 2.0.10.2 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.17 2.0.18 2.0.2 2.0.20 2.0.21 All 56 releases
← All changes | core/admin/page-settings-listing.php +91 -90 2.0.1 → 2.1.21 View file →
@@ -3,9 +3,9 @@
3 3 * @package Booking Manager
4 4 * @category Content of item Listing page
5 5 * @author wpdevelop
6 6 *
7 - * @web-site http://oplugins.com/
7 + * @web-site https://oplugins.com/
8 8 * @email [email protected]
9 9 *
10 10 * @modified 2015-11-13
11 11 */
@@ -67,59 +67,67 @@
67 67 }
68 68
69 69
70 70 public function content() {
71 -
71 +
72 + if ( ! $this->can_manage_listing_template() ) {
73 + wp_die(
74 + esc_html__( 'Sorry, you are not allowed to manage the Booking Manager listing template.', 'booking-manager' )
75 + , esc_html__( 'Forbidden', 'booking-manager' )
76 + , array( 'response' => 403 )
77 + );
78 + }
79 +
72 80 do_action( 'wpbm_hook_settings_page_header', array( 'page' => $this->in_page() ) ); // Define Notices Section and show some static messages, if needed.
73 -
74 - ////////////////////////////////////////////////////////////////////////
81 +
82 + ////////////////////////////////////////////////////////////////////////
75 83 // Submit /////////////////////////////////////////////////////////////
76 -
84 +
77 85 $submit_form_name = 'wpbm_form_listing'; // Define form name
78 -
86 +
79 87 if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) {
80 88
81 89 // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. }
82 90 $nonce_gen_time = check_admin_referer( 'wpbm_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page
83 91
84 - // Save Changes
92 + // Save Changes
85 93 $this->update();
86 - }
94 + }
87 95
88 96 ////////////////////////////////////////////////////////////////////////
89 - // Get Data from DB ////////////////////////////////////////////////////
90 - $data_list_tmpl = get_wpbm_option( 'wpbm_listing_template' );
97 + // Get Data from DB ////////////////////////////////////////////////////
98 + $data_list_tmpl = get_wpbm_option( 'wpbm_listing_template' );
91 99 //$data_list_tmpl = wpbm_nl_after_br( $data_list_tmpl );
92 -
93 -
100 +
101 +
94 102 ////////////////////////////////////////////////////////////////////////
95 103 // Toolbar /////////////////////////////////////////////////////////////
96 104 wpbm_bs_toolbar_sub_html_container_start();
97 105
98 - ?><span class="wpdevelop"><div class="visibility_container clearfix-height" style="display:block;"><?php
106 + ?><span class="wpdevelop0"><div class="visibility_container clearfix-height" style="display:block;"><?php
99 107
100 108 wpbm_js_for_items_page(); // JavaScript functions
101 -
109 +
102 110 $this->toolbar_reset_to_default(); // Reset to Default Forms
103 -
111 +
104 112 $save_button = array( 'title' => __('Save Changes', 'booking-manager'), 'form' => $submit_form_name );
105 - $this->toolbar_save_button( $save_button ); // Save Button
106 -
113 + $this->toolbar_save_button( $save_button ); // Save Button
114 +
107 115 ?></div></span><?php
108 -
116 +
109 117 wpbm_bs_toolbar_sub_html_container_end();
110 -
118 +
111 119 ?><div class="clear"></div><?php
112 -
120 +
113 121 if ( 0 ) {
114 122 // Scroll links ////////////////////////////////////////////////////////
115 123 ?>
116 124 <div class="wpdvlp-sub-tabs" style="background:none;border:none;box-shadow: none;padding:0;"><span class="nav-tabs" style="text-align:right;">
117 - <a href="javascript:void(0);" onclick="javascript:wpbm_scroll_to('#wpbm_settings_listing_metabox' );" original-title="" class="nav-tab go-to-link"><span><?php echo ucwords( __('Listing', 'booking-manager') ); ?></span></a>
125 + <a href="javascript:void(0);" onclick="javascript:wpbm_scroll_to('#wpbm_settings_listing_metabox' );" original-title="" class="nav-tab go-to-link"><span><?php echo ucwords( __('Listing', 'booking-manager') ); ?></span></a>
118 126 </span></div>
119 127 <?php
120 128 }
121 -
129 +
122 130 ////////////////////////////////////////////////////////////////////////
123 131 // Content ////////////////////////////////////////////////////////////
124 132 ?>
125 133 <div class="clear" style="margin-bottom:10px;"></div>
@@ -124,59 +132,77 @@
124 132 ?>
125 133 <div class="clear" style="margin-bottom:10px;"></div>
126 134 <span class="metabox-holder">
127 135 <form name="<?php echo $submit_form_name; ?>" id="<?php echo $submit_form_name; ?>" action="" method="post">
128 - <?php
129 - // N o n c e field, and key for checking S u b m i t
136 + <?php
137 + // N o n c e field, and key for checking S u b m i t
130 138 wp_nonce_field( 'wpbm_settings_page_' . $submit_form_name );
131 - ?><input type="hidden" name="is_form_sbmitted_<?php echo $submit_form_name; ?>" id="is_form_sbmitted_<?php echo $submit_form_name; ?>" value="1" /><?php
132 -
133 - ?><input type="hidden" name="reset_to_default_form" id="reset_to_default_form" value="" /><?php
134 -
139 + ?><input type="hidden" name="is_form_sbmitted_<?php echo $submit_form_name; ?>" id="is_form_sbmitted_<?php echo $submit_form_name; ?>" value="1" /><?php
140 +
141 + ?><input type="hidden" name="reset_to_default_form" id="reset_to_default_form" value="" /><?php
142 +
135 143 ?><div class="wpbm_settings_row wpbm_settings_row_left"><?php
136 -
144 +
137 145 wpbm_open_meta_box_section( 'wpbm_settings_listing', __('Event template - row for event listing', 'booking-manager') );
138 -
139 - $this->show_listing_template( $data_list_tmpl );
140 -
146 +
147 + $this->show_listing_template( $data_list_tmpl );
148 +
141 149 wpbm_close_meta_box_section();
142 150 ?>
143 - </div>
144 - <div class="wpbm_settings_row wpbm_settings_row_right"><?php
145 -
151 + </div>
152 + <div class="wpbm_settings_row wpbm_settings_row_right"><?php
153 +
146 154 wpbm_open_meta_box_section( 'wpbm_settings_listing_help', __('Help', 'booking-manager') );
147 -
148 - $this->show_content_data_form_help();
149 -
155 +
156 + $this->show_content_data_form_help();
157 +
150 158 wpbm_close_meta_box_section();
151 159 ?>
152 160 </div>
153 161 <div class="clear"></div>
154 - <input type="submit" value="<?php _e('Save Changes','booking-manager'); ?>" class="button button-primary wpbm_submit_button" />
162 + <input type="submit" value="<?php _e('Save Changes','booking-manager'); ?>" class="button button-primary wpbm_submit_button" />
155 163 </form>
156 164 </span>
157 - <?php
158 -
165 + <?php
166 +
159 167 $this->css();
160 168 $this->js();
161 -
169 +
162 170 do_action( 'wpbm_hook_settings_page_footer', 'listing_template' );
163 -
171 +
164 172 }
165 173
166 -
167 - /** Save Chanages */
174 +
175 + /** Save Chanages */
168 176 public function update() {
169 -
170 - // We can not use here such code:
171 - // WPBM_Settings_API::validate_textarea_post_static( 'listing_template' );
172 - // becuse its will remove also JavaScript, which possible to use for wizard form or in some other cases.
173 - $data_list_tmpl = trim( stripslashes( $_POST['listing_template'] ) );
177 +
178 + if ( ! $this->can_manage_listing_template() ) {
179 + wp_die(
180 + esc_html__( 'Sorry, you are not allowed to manage the Booking Manager listing template.', 'booking-manager' )
181 + , esc_html__( 'Forbidden', 'booking-manager' )
182 + , array( 'response' => 403 )
183 + );
184 + }
185 +
186 + $data_list_tmpl = isset( $_POST['listing_template'] ) ? trim( wp_unslash( $_POST['listing_template'] ) ) : '';
187 + $data_list_tmpl = wpbm_sanitize_listing_template( $data_list_tmpl );
174 188 update_wpbm_option( 'wpbm_listing_template' , $data_list_tmpl );
175 189
176 - wpbm_show_changes_saved_message();
190 + wpbm_show_changes_saved_message();
177 191 }
178 192
193 +
194 + /**
195 + * Listing template is a global frontend template, so managing it requires
196 + * administrator-level options access rather than the general plugin menu role.
197 + *
198 + * @return bool
199 + */
200 + private function can_manage_listing_template() {
201 +
202 + return current_user_can( 'manage_options' );
203 + }
204 +
179 205
180 206 // <editor-fold defaultstate="collapsed" desc=" CSS / JS " >
181 207
182 208 /** CSS for this page */
@@ -272,45 +298,9 @@
272 298 form_content +='<hr />';
273 299 }
274 300 return form_content;
275 301 }
276 -
277 - /*
278 - // Catch data for summary
279 - jQuery('#wpbm_textdata').on( "keypress", function( event ) {
280 - if( event.which != 13) {
281 - // wpbm_generate_send_info();
282 - //return false;
283 - }
284 - });
285 - jQuery('#wpbm_textdata').on( 'change', function(){
286 - // wpbm_generate_send_info();
287 - } );
288 - jQuery(document).ready( function(){
289 - // wpbm_generate_send_info();
290 - });
291 - // On click submit form
292 - jQuery( '.wpbm_send_button' ).on( 'click', function() {
293 - if ( jQuery( '.wpbm_send_button' ).hasClass( 'disabled' ) ) {
294 - return false; // Prevent submit form, if button disabled.
295 - }
296 - jQuery('#wpbm_action').val('go_send');
297 - jQuery('#wpbm_send_links_form<?php //echo $submit_form_name; ?>').submit();
298 - return false;
299 - });
300 - //Allow enter key on textareas and submit buttons only
301 - jQuery(document).on( "keypress", ":input:not(textarea):not([type=submit])", function( event ) {
302 - if( event.which == 13) {
303 - if ( jQuery( '.wpbm_send_button' ).hasClass( 'disabled' ) ) {
304 - return false; // Prevent submit form, if button disabled.
305 - }
306 - //alert('You pressed enter!');
307 - jQuery('#wpbm_action').val('go_send');
308 - jQuery('#wpbm_send_links_form<?php //echo $submit_form_name; ?>').submit();
309 - return false;
310 - }
311 - });
312 - */
302 +
313 303 </script>
314 304 <?php
315 305 }
316 306
@@ -457,12 +447,12 @@
457 447 , 'font_icon' => 'glyphicon glyphicon-repeat'
458 448 , 'icon_position' => 'right'
459 449 , 'action' => " var sel_res_val = document.getElementById('select_default_form_template').options[ document.getElementById('select_default_form_template').selectedIndex ].value;"
460 450 . " if ( sel_res_val == 'selector_hint') { "
461 - . " wpbm_field_highlight( '#select_default_form_template' ); return;" //. " jQuery('#wpbm_form_field').submit();"
451 + . " wpbm_field_highlight( '#select_default_form_template' ); return;" //. " jQuery('#wpbm_form_field').trigger( 'submit' );"
462 452 . " }"
463 453 //. " if ( wpbm_are_you_sure('" . esc_js(__('Do you really want to do this ?' ,'booking-manager')) . "') ) {"
464 - . " wpbm_reset_from_to_template( sel_res_val ); " //. " jQuery('#wpbm_form_field').submit();"
454 + . " wpbm_reset_from_to_template( sel_res_val ); " //. " jQuery('#wpbm_form_field').trigger( 'submit' );"
465 455 //. " }"
466 456 )
467 457 )
468 458 );
@@ -525,8 +515,19 @@
525 515 printf( __( '%s - date of event editing, creation', 'booking-manager' ), '<code>[MODIFIED]</code>' );
526 516 ?></span><br/>
527 517 <span class="description"><?php
528 518 printf( __( '%s - location of event', 'booking-manager' ) , '<code>[LOCATION]</code>' );
519 + ?></span><br/>
520 + <hr/>
521 + <span class="description"><?php //FixIn: 2.0.11.4
522 + printf( __( '%s - ID of booking (in Booking Calendar plugin), if event has been imported', 'booking-manager' ) , '<code>[BOOKING_ID]</code>' );
523 + ?></span><br/>
524 + <span class="description"><?php //FixIn: 2.0.11.5
525 + printf( __( '%s - link to booking (in Booking Calendar plugin), if event has been imported', 'booking-manager' ) , '<code>[BOOKING_LINK]</code>' );
526 + ?></span><br/>
527 + <span class="description"><?php //FixIn: 2.0.11.5
528 + echo '<strong>' . __('Example' ,'booking-manager') . ':</strong><br/>';
529 + echo '<em>' . '&lt;a href="[BOOKING_LINK]" target="_blank"&gt;[BOOKING_ID]&lt;/a&gt;' . '</em>'
529 530 ?></span><br/>
530 531
531 532 <hr/>
532 533 <span class="description"><?php printf(__('%s - inserting new line' ,'booking-manager'),'<code>&lt;br/&gt;</code>');?></span><br/>