| @@ -1,23 +1,37 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * @version 1.0 | |
| 4 | + * @package FEEDBACK | |
| 5 | + * @subpackage FEEDBACK functions | |
| 6 | + * @category Functions | |
| 7 | + * | |
| 8 | + * @author wpdevelop | |
| 9 | + * @link https://wpbookingcalendar.com/ | |
| 10 | + * @email info@wpbookingcalendar.com | |
| 11 | + * | |
| 12 | + * @modified 2024-05-14 | |
| 13 | + */ | |
| 2 | 14 | |
| 15 | +if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
| 16 | + | |
| 3 | 17 | if ( ! defined( 'WPBC_FEEDBACK_TIMEOUT' ) ) { define( 'WPBC_FEEDBACK_TIMEOUT', '+2 days' ); } |
| 4 | 18 | //if ( ! defined( 'WPBC_FEEDBACK_TIMEOUT' ) ) { define( 'WPBC_FEEDBACK_TIMEOUT', '+30 seconds' ); } |
| 5 | 19 | |
| 6 | 20 | // == For testing == |
| 7 | -//update_option( 'booking_feedback_03', date( 'Y-m-d H:i:s', strtotime( '+10 seconds', strtotime( 'now' ) ) ) ); | |
| 21 | +//update_option( 'booking_feedback_04', gmdate( 'Y-m-d H:i:s', strtotime( '+10 seconds', strtotime( 'now' ) ) ) ); | |
| 8 | 22 | |
| 9 | 23 | // Init Timer |
| 10 | -// update_option( 'booking_feedback_03', date( 'Y-m-d H:i:s', strtotime( WPBC_FEEDBACK_TIMEOUT, strtotime( 'now' ) ) ) ); | |
| 24 | +// update_option( 'booking_feedback_04', gmdate( 'Y-m-d H:i:s', strtotime( WPBC_FEEDBACK_TIMEOUT, strtotime( 'now' ) ) ) ); | |
| 11 | 25 | |
| 12 | 26 | // Reset |
| 13 | -// delete_option( 'booking_feedback_03'); | |
| 27 | +// delete_option( 'booking_feedback_04'); | |
| 14 | 28 | |
| 15 | 29 | function wpbc_get_feedback_defaults( $param_name ){ |
| 16 | 30 | |
| 17 | 31 | $defaults = array( |
| 18 | 32 | 'page_where_load' => 'wpbc-ajx_booking_availability', // Name of page, where to load feedback. Defined in pages, like this: do_action( 'wpbc_hook_settings_page_footer', 'wpbc-ajx_booking_availability' ); |
| 19 | - 'max_version' => '11.1', // If version of Booking Calendar 9.6 or newer than do not show this Feedback | |
| 33 | + 'max_version' => '12.0', // If version of Booking Calendar 12.0 or newer than do not show this Feedback | |
| 20 | 34 | 'feedback_email' => 'feedback2@wpbookingcalendar.com' |
| 21 | 35 | ); |
| 22 | 36 | |
| 23 | 37 | return $defaults[ $param_name ]; |
| @@ -47,8 +61,9 @@ | ||
| 47 | 61 | * Ajax - Get Listing Data and Response to JS script |
| 48 | 62 | */ |
| 49 | 63 | public function ajax_WPBC_AJX_FEEDBACK() { |
| 50 | 64 | |
| 65 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 51 | 66 | if ( ! isset( $_POST['action_params'] ) || empty( $_POST['action_params'] ) ) { exit; } |
| 52 | 67 | |
| 53 | 68 | $ajax_errors = new WPBC_AJAX_ERROR_CATCHING(); |
| 54 | 69 | |
| @@ -56,9 +71,9 @@ | ||
| 56 | 71 | $action_name = 'wpbc_ajx__feedback_ajx' . '_wpbcnonce'; |
| 57 | 72 | $nonce_post_key = 'nonce'; |
| 58 | 73 | $result_check = check_ajax_referer( $action_name, $nonce_post_key ); |
| 59 | 74 | |
| 60 | - $user_id = ( isset( $_REQUEST['wpbc_ajx_user_id'] ) ) ? intval( $_REQUEST['wpbc_ajx_user_id'] ) : wpbc_get_current_user_id(); | |
| 75 | + $user_id = ( isset( $_REQUEST['wpbc_ajx_user_id'] ) ) ? intval( $_REQUEST['wpbc_ajx_user_id'] ) : wpbc_get_current_user_id(); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 61 | 76 | |
| 62 | 77 | /** |
| 63 | 78 | * SQL --------------------------------------------------------------------------- |
| 64 | 79 | * |
| @@ -92,9 +107,10 @@ | ||
| 92 | 107 | |
| 93 | 108 | $defaults = array( |
| 94 | 109 | 'new_listing_params' => false // required for Import Google Calendar bookings |
| 95 | 110 | , 'after_action_result' => false |
| 96 | - , 'after_action_message' => sprintf( __('No actions %s has been processed.', 'booking') | |
| 111 | + /* translators: 1: ... */ | |
| 112 | + , 'after_action_message' => sprintf( __( 'No actions %s has been processed.', 'booking') | |
| 97 | 113 | , ' <strong>' . $request_params['booking_action'] . '</strong> ' ) |
| 98 | 114 | ); |
| 99 | 115 | $action_result = wp_parse_args( $action_result, $defaults ); |
| 100 | 116 | |
| @@ -108,8 +124,9 @@ | ||
| 108 | 124 | |
| 109 | 125 | //------------------------------------------------------------------------------------------------------------------ |
| 110 | 126 | // Send JSON. Its will make "wp_json_encode" - so pass only array, and This function call wp_die( '', '', array( 'response' => null, ) ) Pass JS OBJ: response_data in "jQuery.post( " function on success. |
| 111 | 127 | wp_send_json( array( |
| 128 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 112 | 129 | 'ajx_action_params' => $_REQUEST['action_params'], // Do not clean input parameters |
| 113 | 130 | 'ajx_cleaned_params' => $request_params, // Cleaned input parameters |
| 114 | 131 | 'ajx_after_action_message' => $action_result['after_action_message'], // Message to show |
| 115 | 132 | 'ajx_after_action_result' => (int) $action_result['after_action_result'], // Result key 0 | 1 |
| @@ -138,12 +155,12 @@ | ||
| 138 | 155 | $in_footer = true; |
| 139 | 156 | |
| 140 | 157 | if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) { |
| 141 | 158 | |
| 142 | - wp_enqueue_script( 'wpbc-feedback_02', trailingslashit( plugins_url( '', __FILE__ ) ) . 'feedback.js' /* wpbc_plugin_url( '/_out/js/codemirror.js' ) */ | |
| 143 | - , array( 'wpbc-global-vars' ), WP_BK_VERSION_NUM, $in_footer ); | |
| 159 | + wp_enqueue_script( 'wpbc-feedback_02', trailingslashit( plugins_url( '', __FILE__ ) ) . 'feedback.js' /* wpbc_plugin_url( '/_out/js/code_mirror.js' ) */ | |
| 160 | + , array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer ); | |
| 144 | 161 | /** |
| 145 | - wp_localize_script( 'wpbc-global-vars', 'wpbc_live_request_obj' | |
| 162 | + wp_localize_script( 'wpbc_all', 'wpbc_live_request_obj' | |
| 146 | 163 | , array( |
| 147 | 164 | 'contacts' => '', |
| 148 | 165 | 'reminders' => '' |
| 149 | 166 | ) |
| @@ -168,9 +185,9 @@ | ||
| 168 | 185 | return false; |
| 169 | 186 | } |
| 170 | 187 | |
| 171 | 188 | if ( wpbc_is__feedback_01__timeout_need_to_show() ) { // Check if time go out |
| 172 | - update_option( 'booking_feedback_03', '' ); | |
| 189 | + update_option( 'booking_feedback_04', '' ); | |
| 173 | 190 | } else { |
| 174 | 191 | return false; |
| 175 | 192 | } |
| 176 | 193 | |
| @@ -176,10 +193,10 @@ | ||
| 176 | 193 | |
| 177 | 194 | |
| 178 | 195 | // Nonce for Ajax and some other data |
| 179 | 196 | ?><div id="wpbc_ajax__feedback_01" style="display:none;" |
| 180 | - data-nonce="<?php echo wp_create_nonce( 'wpbc_ajx__feedback_ajx' . '_wpbcnonce' ); ?>" | |
| 181 | - data-user-id="<?php echo wpbc_get_current_user_id(); ?>" | |
| 197 | + data-nonce="<?php echo esc_attr( wp_create_nonce( 'wpbc_ajx__feedback_ajx' . '_wpbcnonce' ) ); ?>" | |
| 198 | + data-user-id="<?php echo esc_attr( wpbc_get_current_user_id() ); ?>" | |
| 182 | 199 | ></div><?php |
| 183 | 200 | |
| 184 | 201 | |
| 185 | 202 | ?><div id="wpbc_modal__feedback_01__section_mover"> |
| @@ -188,9 +205,9 @@ | ||
| 188 | 205 | <div class="modal-dialog"> |
| 189 | 206 | <div class="modal-content"> |
| 190 | 207 | <div class="modal-header"> |
| 191 | 208 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 192 | - <h4 class="modal-title"><?php _e( 'Feedback' ); ?></h4> | |
| 209 | + <h4 class="modal-title"><?php esc_html_e( 'Feedback', 'booking' ); ?></h4> | |
| 193 | 210 | </div> |
| 194 | 211 | <div class="modal-body"> |
| 195 | 212 | <?php |
| 196 | 213 | |
| @@ -204,9 +221,9 @@ | ||
| 204 | 221 | <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal" style="float: left;margin-left: 1em;">Remind me later</a> |
| 205 | 222 | |
| 206 | 223 | <a id="wpbc_modal__feedback_01__button_send" class="button button-primary" |
| 207 | 224 | onclick="javascript: wpbc_ajx_booking__ui_click__send_feedback_01();" href="javascript:void(0);" |
| 208 | - ><?php _e('Next' ,'booking'); ?> 1/3</a> | |
| 225 | + ><?php esc_html_e('Next' ,'booking'); ?> 1/3</a> | |
| 209 | 226 | </div> |
| 210 | 227 | </div><!-- /.modal-content --> |
| 211 | 228 | </div><!-- /.modal-dialog --> |
| 212 | 229 | </div><!-- /.modal --> |
| @@ -228,18 +245,20 @@ | ||
| 228 | 245 | function wpbc_hidden_template__content_for_feedback_01_steps(){ |
| 229 | 246 | |
| 230 | 247 | /* S T A R S */ ?> |
| 231 | 248 | <div class="wpbc_modal__feedback_01__steps wpbc_modal__feedback_01__step_1" > |
| 232 | - <h4 class="modal-title"><?php printf( 'Do you like the new %sNew Update%s of Booking Calendar?' ,'<strong>','</strong>'); ?></h4> | |
| 249 | + <h4 class="modal-title"><?php echo wp_kses_post( sprintf( 'Do you like the new %sNew Update%s of Booking Calendar?' ,'<strong>','</strong>') ); ?></h4> | |
| 233 | 250 | <div class="wpbc_feedback_01__content_rating"> |
| 234 | 251 | <div class="wpbc_feedback_01__content_rating_stars"><?php |
| 235 | 252 | for( $i = 1; $i < 6; $i++) { |
| 236 | - ?><a id="wpbc_feedback_01_star_<?php echo $i; ?>" | |
| 253 | + ?><a id="wpbc_feedback_01_star_<?php echo esc_attr( $i ); ?>" | |
| 237 | 254 | href="javascript:void(0)" |
| 238 | - onmouseover="javascript:wpbc_feedback_01__over_star(<?php echo $i; ?>, 'over');" | |
| 239 | - onmouseout="javascript:wpbc_feedback_01__over_star(<?php echo $i; ?>, 'out');" | |
| 240 | - onclick="javascript:wpbc_feedback_01__over_star(<?php echo $i; ?>, 'click');" | |
| 241 | - data-original-title="<?php echo esc_attr( sprintf( __('Rate with %s star', 'booking'), $i ) ); ?>" | |
| 255 | + onmouseover="javascript:wpbc_feedback_01__over_star(<?php echo esc_attr( $i ); ?>, 'over');" | |
| 256 | + onmouseout="javascript:wpbc_feedback_01__over_star(<?php echo esc_attr( $i ); ?>, 'out');" | |
| 257 | + onclick="javascript:wpbc_feedback_01__over_star(<?php echo esc_attr( $i ); ?>, 'click');" | |
| 258 | + data-original-title="<?php | |
| 259 | + /* translators: 1: ... */ | |
| 260 | + echo esc_attr( sprintf( __('Rate with %s star', 'booking'), $i ) ); ?>" | |
| 242 | 261 | class="tooltip_top "><i class="menu_icon icon-1x wpbc-bi-star 0wpbc_icn_star_outline"></i></a><?php |
| 243 | 262 | } |
| 244 | 263 | ?> |
| 245 | 264 | </div> |
| @@ -244,22 +263,24 @@ | ||
| 244 | 263 | ?> |
| 245 | 264 | </div> |
| 246 | 265 | </div> |
| 247 | 266 | <div class="modal-footer modal-footer-inside"> |
| 248 | - <a href="javascript:void(0)" class="wpbc_btn_as_link" data-dismiss="modal"><?php _e('Do not show anymore' ,'booking'); ?></a> | |
| 249 | - <a href="javascript:void(0)" class="wpbc_btn_as_link" onclick="javascript: wpbc_ajx_booking__ui_click__feedback_01_remind_later();"><?php _e('Remind me later' ,'booking'); ?></a> | |
| 267 | + <a href="javascript:void(0)" class="wpbc_btn_as_link" data-dismiss="modal"><?php esc_html_e('Do not show anymore' ,'booking'); ?></a> | |
| 268 | + <a href="javascript:void(0)" class="wpbc_btn_as_link" onclick="javascript: wpbc_ajx_booking__ui_click__feedback_01_remind_later();"><?php esc_html_e('Remind me later' ,'booking'); ?></a> | |
| 250 | 269 | <a id="wpbc_modal__feedback_01__button_next__step_1" class="button button-primary wpbc_btn_next disabled" |
| 251 | 270 | onclick="javascript: wpbc_ajx_booking__ui_click__send_feedback_01(this);" href="javascript:void(0);" |
| 252 | - ><?php _e('Next' ,'booking'); ?> <!--span>1/2</span--></a> | |
| 271 | + ><?php esc_html_e('Next' ,'booking'); ?> <!--span>1/2</span--></a> | |
| 253 | 272 | </div> |
| 254 | 273 | </div> |
| 255 | 274 | |
| 256 | 275 | <?php // Star 1 - 2 Reason ?> |
| 257 | 276 | <div class="wpbc_modal__feedback_01__steps wpbc_modal__feedback_01__step_2" style="display:none;"> |
| 258 | - <h5 class="modal-title"><?php printf(__('Sorry to hear that... %s' ,'booking') | |
| 259 | - ,'<i class="menu_icon icon-1x wpbc-bi-emoji-frown 0wpbc_icn_sentiment_very_dissatisfied" style="color:#ca930b;"></i>'); | |
| 277 | + <h5 class="modal-title"><?php | |
| 278 | + /* translators: 1: ... */ | |
| 279 | + echo wp_kses_post( sprintf(__('Sorry to hear that... %s' ,'booking') | |
| 280 | + ,'<i class="menu_icon icon-1x wpbc-bi-emoji-frown 0wpbc_icn_sentiment_very_dissatisfied" style="color:#ca930b;"></i>') ); | |
| 260 | 281 | ?></h5><br> |
| 261 | - <h4 class="modal-title"><?php _e('How can we improve it for you?' ,'booking'); ?></h4> | |
| 282 | + <h4 class="modal-title"><?php esc_html_e('How can we improve it for you?' ,'booking'); ?></h4> | |
| 262 | 283 | <textarea id="wpbc_modal__feedback_01__reason_of_action__step_2" name="wpbc_modal__feedback_01__reason_of_action__step_2" |
| 263 | 284 | style="width:100%;" cols="57" rows="3" autocomplete="off" |
| 264 | 285 | onkeyup="javascript:if(jQuery( this ).val() != '' ){ jQuery( '#wpbc_modal__feedback_01__button_next__step_2').removeClass('disabled'); }" |
| 265 | 286 | ></textarea> |
| @@ -265,71 +286,80 @@ | ||
| 265 | 286 | ></textarea> |
| 266 | 287 | <div class="modal-footer modal-footer-inside"> |
| 267 | 288 | |
| 268 | 289 | <a onclick="javascript: wpbc_ajx_booking__ui_click__send_feedback_01( this, '.wpbc_modal__feedback_01__step_1' );" href="javascript:void(0);" |
| 269 | - class="button button-secondary"><?php _e('Back' ,'booking'); ?></a> | |
| 290 | + class="button button-secondary"><?php esc_html_e('Back' ,'booking'); ?></a> | |
| 270 | 291 | |
| 271 | 292 | <a id="wpbc_modal__feedback_01__button_next__step_2" class="button button-primary wpbc_btn_next" |
| 272 | 293 | onclick="javascript: wpbc_ajx_booking__ui_click__send_feedback_01( this, '.wpbc_modal__feedback_01__step_3');" href="javascript:void(0);" |
| 273 | - ><?php _e('Next' ,'booking'); ?> <span>2/3</span></a> | |
| 294 | + ><?php esc_html_e('Next' ,'booking'); ?> <span>2/3</span></a> | |
| 274 | 295 | </div> |
| 275 | 296 | </div> |
| 276 | 297 | |
| 277 | 298 | <?php /* Star 1 - 2 Done */ ?> |
| 278 | 299 | <div class="wpbc_modal__feedback_01__steps wpbc_modal__feedback_01__step_3" style="display:none;"> |
| 279 | - <h5 class="modal-title"><?php printf(__('Thank you for your feedback! %s' ,'booking') | |
| 280 | - ,'<i class="menu_icon icon-1x wpbc-bi-hand-thumbs-up" style="color: #dd2e44;"></i>' ); | |
| 300 | + <h5 class="modal-title"><?php | |
| 301 | + /* translators: 1: ... */ | |
| 302 | + echo wp_kses_post( sprintf(__('Thank you for your feedback! %s' ,'booking') | |
| 303 | + ,'<i class="menu_icon icon-1x wpbc-bi-hand-thumbs-up" style="color: #dd2e44;"></i>' ) ); | |
| 281 | 304 | ?></h5><br> |
| 282 | - <h4 class="modal-title"><?php printf(__('You\'re helping us do a better job. :) We appreciate that!' ,'booking') | |
| 283 | - ,'<i class="menu_icon icon-1x wpbc-bi-hand-thumbs-up" style="color: #dd2e44;"></i>' ); | |
| 305 | + <h4 class="modal-title"><?php echo wp_kses_post( sprintf(__('You\'re helping us do a better job. :) We appreciate that!' ,'booking') | |
| 306 | + ,'<i class="menu_icon icon-1x wpbc-bi-hand-thumbs-up" style="color: #dd2e44;"></i>' ) ); | |
| 284 | 307 | ?></h4><br> |
| 285 | - <h4 class="modal-title"><?php printf(__('Thanks for being with us! %s' ,'booking') | |
| 286 | - ,'<i class="menu_icon icon-1x wpbc-bi-heart-fill 0wpbc_icn_favorite" style="color: #dd2e44;"></i>' ); | |
| 308 | + <h4 class="modal-title"><?php | |
| 309 | + /* translators: 1: ... */ | |
| 310 | + echo wp_kses_post( sprintf(__('Thanks for being with us! %s' ,'booking') | |
| 311 | + ,'<i class="menu_icon icon-1x wpbc-bi-heart-fill 0wpbc_icn_favorite" style="color: #dd2e44;"></i>' ) ); | |
| 287 | 312 | ?></h4> |
| 288 | 313 | <div class="modal-footer modal-footer-inside ui_element"> |
| 289 | 314 | <a class="button button-primary wpbc_ui_button wpbc_ui_button_primary" id="wpbc_modal__feedback_01__submit_1_2" |
| 290 | 315 | onclick="javascript: wpbc_ajx_booking__ui_click__submit_feedback_01( this, '.wpbc_modal__feedback_01__step_3');" href="javascript:void(0);" |
| 291 | - ><span><?php _e('Done' ,'booking'); ?></span> <i class="menu_icon icon-1x wpbc_icn_done_all"></i></a> | |
| 316 | + ><span><?php esc_html_e('Done' ,'booking'); ?></span> <i class="menu_icon icon-1x wpbc_icn_done_all"></i></a> | |
| 292 | 317 | </div> |
| 293 | 318 | </div> |
| 294 | 319 | |
| 295 | 320 | <?php /* Star 3 - 4 Reason */ ?> |
| 296 | 321 | <div class="wpbc_modal__feedback_01__steps wpbc_modal__feedback_01__step_4" style="display:none;"> |
| 297 | - <h4 class="modal-title"><?php _e('What functionality important to you are missing in the plugin?'); ?></h4><br> | |
| 322 | + <h4 class="modal-title"><?php esc_html_e('What functionality important to you are missing in the plugin?', 'booking'); ?></h4><br> | |
| 298 | 323 | <textarea id="wpbc_modal__feedback_01__reason_of_action__step_4" name="wpbc_modal__feedback_01__reason_of_action__step_4" |
| 299 | 324 | style="width:100%;" cols="57" rows="3" autocomplete="off" |
| 300 | 325 | onkeyup="javascript:if(jQuery( this ).val() != '' ){ jQuery( '#wpbc_modal__feedback_01__button_next__step_4').removeClass('disabled'); }" |
| 301 | 326 | ></textarea> |
| 302 | - <label class="help-block"><?php printf(__('It\'s an %soptional question%s. But, we\'d love to hear your thoughts!' ,'booking'),'<b>','</b>');?></label> | |
| 327 | + <label class="help-block"><?php | |
| 328 | + /* translators: 1: ... */ | |
| 329 | + echo wp_kses_post( sprintf( __( 'It\'s an %1$soptional question%2$s. But, we\'d love to hear your thoughts!', 'booking' ), '<b>', '</b>' ) ); ?></label> | |
| 303 | 330 | <div class="modal-footer modal-footer-inside"> |
| 304 | 331 | |
| 305 | 332 | <a onclick="javascript: wpbc_ajx_booking__ui_click__send_feedback_01( this, '.wpbc_modal__feedback_01__step_1' );" href="javascript:void(0);" |
| 306 | - class="button button-secondary"><?php _e('Back' ,'booking'); ?></a> | |
| 333 | + class="button button-secondary"><?php esc_html_e('Back' ,'booking'); ?></a> | |
| 307 | 334 | |
| 308 | 335 | <a id="wpbc_modal__feedback_01__button_next__step_4" class="button button-primary wpbc_btn_next " |
| 309 | 336 | onclick="javascript: wpbc_ajx_booking__ui_click__send_feedback_01( this, '.wpbc_modal__feedback_01__step_5');" href="javascript:void(0);" |
| 310 | - ><?php _e('Next' ,'booking'); ?> <span>2/3</span></a> | |
| 337 | + ><?php esc_html_e('Next' ,'booking'); ?> <span>2/3</span></a> | |
| 311 | 338 | </div> |
| 312 | 339 | </div> |
| 313 | 340 | |
| 314 | 341 | <?php /* Star 3 - 4 Done */ ?> |
| 315 | 342 | <div class="wpbc_modal__feedback_01__steps wpbc_modal__feedback_01__step_5" style="display:none;"> |
| 316 | - <h4 class="modal-title"><?php printf(__('%sFantastic!%s Thanks for taking the time! %s' ,'booking') | |
| 343 | + <h4 class="modal-title"><?php | |
| 344 | + /* translators: 1: ... */ | |
| 345 | + echo wp_kses_post( sprintf( __( '%1$sFantastic!%2$s Thanks for taking the time! %3$s', 'booking' ) | |
| 317 | 346 | ,'<strong>','</strong>' |
| 318 | - ,'<i class="menu_icon icon-1x wpbc-bi-heart-fill 0wpbc_icn_favorite" style="color: #dd2e44;"></i>' ); | |
| 347 | + ,'<i class="menu_icon icon-1x wpbc-bi-heart-fill 0wpbc_icn_favorite" style="color: #dd2e44;"></i>' ) ); | |
| 319 | 348 | ?></h4><br> |
| 320 | - <h4 class="modal-title"><?php _e('Your answers will help us to make the plugin better for you!' ,'booking'); ?></h4><br> | |
| 321 | - <h4 class="modal-title"><?php _e('Thanks for sharing your feedback! Have a great day :)' ,'booking'); ?></h4> | |
| 349 | + <h4 class="modal-title"><?php esc_html_e('Your answers will help us to make the plugin better for you!' ,'booking'); ?></h4><br> | |
| 350 | + <h4 class="modal-title"><?php esc_html_e('Thanks for sharing your feedback! Have a great day :)' ,'booking'); ?></h4> | |
| 322 | 351 | <div class="modal-footer modal-footer-inside ui_element"> |
| 323 | 352 | <a class="button button-primary wpbc_ui_button wpbc_ui_button_primary" id="wpbc_modal__feedback_01__submit_3_4" |
| 324 | 353 | onclick="javascript: wpbc_ajx_booking__ui_click__submit_feedback_01( this, '.wpbc_modal__feedback_01__step_5');" href="javascript:void(0);" |
| 325 | - ><span><?php _e('Done' ,'booking'); ?></span> <i class="menu_icon icon-1x wpbc_icn_done_all"></i></a> | |
| 354 | + ><span><?php esc_html_e('Done' ,'booking'); ?></span> <i class="menu_icon icon-1x wpbc_icn_done_all"></i></a> | |
| 326 | 355 | </div> |
| 327 | 356 | </div> |
| 328 | 357 | |
| 329 | 358 | <?php /* Star 5 Review */ ?> |
| 330 | 359 | <div class="wpbc_modal__feedback_01__steps wpbc_modal__feedback_01__step_6" style="display:none;"> |
| 331 | - <h4 class="modal-title" style="line-height: 2.4em;"><?php //printf(__('%sFantastic!%s Would you like to leave a small review about the product? %s' ,'booking') | |
| 360 | + <h4 class="modal-title" style="line-height: 2.4em;"><?php | |
| 361 | + /* translators: 1: ... */ | |
| 332 | 362 | printf( '%sAwesome!%s Can you do us a HUGE favor and leave a 5-star rating for our plugin on WordPress to help us spread the word and boost our motivation? %s' |
| 333 | 363 | ,'<strong>','</strong>' |
| 334 | 364 | ,'<i class="menu_icon icon-1x wpbc-bi-heart-fill" style="color: #dd2e44;"></i>' |
| 335 | 365 | ,'<i class="menu_icon icon-1x wpbc-bi-balloon-heart" style="color: #dd2e44;"></i>' |
| @@ -335,11 +365,11 @@ | ||
| 335 | 365 | ,'<i class="menu_icon icon-1x wpbc-bi-balloon-heart" style="color: #dd2e44;"></i>' |
| 336 | 366 | ,'<i class="menu_icon icon-1x wpbc-bi-balloon-heart" style="color: #dd2e44;"></i>' |
| 337 | 367 | ); |
| 338 | 368 | ?></h4><br> |
| 339 | - <h4 class="modal-title"><?php //printf(__('It will support us to include more features in the plugin. %s%s%s' ,'booking') | |
| 369 | + <h4 class="modal-title"><?php | |
| 340 | 370 | printf( 'Your support would mean a lot to us and we would be over the moon! :) %s%s%s' |
| 341 | - //printf(__('Your support would mean a lot to us and we would be incredibly appreciative! :) %s%s%s' ,'booking') | |
| 371 | + | |
| 342 | 372 | ,'<i class="menu_icon icon-1x wpbc-bi-balloon-heart" style="color: #dd2e44;"></i>' |
| 343 | 373 | ,'<i class="menu_icon icon-1x wpbc-bi-balloon-heart" style="color: #dd2e44;"></i>' |
| 344 | 374 | ,'<i class="menu_icon icon-1x wpbc-bi-balloon-heart" style="color: #dd2e44;"></i>' |
| 345 | 375 | ); ?></h4><br> |
| @@ -345,9 +375,9 @@ | ||
| 345 | 375 | ); ?></h4><br> |
| 346 | 376 | <textarea id="wpbc_modal__feedback_01__reason_of_action__step_7" name="wpbc_modal__feedback_01__reason_of_action__step_7" style="display:none;" |
| 347 | 377 | style="width:100%;" cols="57" rows="3" autocomplete="off" |
| 348 | 378 | onkeyup="javascript:if(jQuery( this ).val() != '' ){ jQuery( '#wpbc_modal__feedback_01__button_next__step_7').removeClass('disabled'); }" |
| 349 | - placeholder="<?php esc_attr_e('What\'s the main benefit from Booking Calendar for you?'); ?>" | |
| 379 | + placeholder="<?php esc_attr_e( 'What\'s the main benefit from Booking Calendar for you?', 'booking' ); ?>" | |
| 350 | 380 | >not_now</textarea> |
| 351 | 381 | <?php //echo 'How it helps you or your business? Is it ease of use? Do you like the Product design ? Value for money...' ; ?> |
| 352 | 382 | |
| 353 | 383 | <div class="modal-footer modal-footer-inside ui_element" style="justify-content: flex-end;"> |
| @@ -352,20 +382,17 @@ | ||
| 352 | 382 | |
| 353 | 383 | <div class="modal-footer modal-footer-inside ui_element" style="justify-content: flex-end;"> |
| 354 | 384 | <a id="wpbc_modal__feedback_01__button_next__step_6" class="button button-primary wpbc_btn_next " |
| 355 | 385 | onclick="javascript: jQuery( '#wpbc_modal__feedback_01__reason_of_action__step_7').val('rate5'); wpbc_ajx_booking__ui_click__submit_feedback_01( this, '.wpbc_modal__feedback_01__step_7');" href="javascript:void(0);" |
| 356 | - ><?php _e('Yes! Sure, I\'d love to help!' ,'booking'); | |
| 357 | - ?> <i class="menu_icon icon-1x wpbc-bi-emoji-smile"></i></a> | |
| 386 | + ><?php esc_html_e('Yes! Sure, I\'d love to help!' ,'booking'); ?> <i class="menu_icon icon-1x wpbc-bi-emoji-smile"></i></a> | |
| 358 | 387 | |
| 359 | 388 | <a onclick="javascript: wpbc_ajx_booking__ui_click__submit_feedback_01( this, '.wpbc_modal__feedback_01__step_7');" href="javascript:void(0);" |
| 360 | - class="button button-secondary wpbc_ui_button" id="wpbc_modal__feedback_01__submit_5_none"><?php _e('No, sorry - not this time.' ,'booking'); | |
| 361 | - ?> <i class="menu_icon icon-1x wpbc-bi-emoji-neutral"></i></a> | |
| 389 | + class="button button-secondary wpbc_ui_button" id="wpbc_modal__feedback_01__submit_5_none"><?php esc_html_e('No, sorry - not this time.' ,'booking'); ?> <i class="menu_icon icon-1x wpbc-bi-emoji-neutral"></i></a> | |
| 362 | 390 | |
| 363 | 391 | <?php /* ?> |
| 364 | 392 | <a id="wpbc_modal__feedback_01__button_next__step_6" class="button button-primary wpbc_btn_next " |
| 365 | 393 | onclick="javascript: wpbc_ajx_booking__ui_click__send_feedback_01( this, '.wpbc_modal__feedback_01__step_7');" href="javascript:void(0);" |
| 366 | - ><?php _e('Yes! Sure, I\'d love to help!' ,'booking'); | |
| 367 | - ?> <i class="menu_icon icon-1x wpbc-bi-emoji-smile"></i></a> | |
| 394 | + ><?php esc_html_e('Yes! Sure, I\'d love to help!' ,'booking'); ?> <i class="menu_icon icon-1x wpbc-bi-emoji-smile"></i></a> | |
| 368 | 395 | <?php */ ?> |
| 369 | 396 | </div> |
| 370 | 397 | |
| 371 | 398 | </div> |
| @@ -371,18 +398,20 @@ | ||
| 371 | 398 | </div> |
| 372 | 399 | |
| 373 | 400 | <?php /* Star 5 Done */ ?> |
| 374 | 401 | <div class="wpbc_modal__feedback_01__steps wpbc_modal__feedback_01__step_7" style="display:none;"> |
| 375 | - <h4 class="modal-title"><?php printf(__('%sPerfect!%s Thanks for taking the time! %s' ,'booking') | |
| 402 | + <h4 class="modal-title"><?php | |
| 403 | + /* translators: 1: ... */ | |
| 404 | + echo wp_kses_post( sprintf( __( '%1$sPerfect!%2$s Thanks for taking the time! %3$s', 'booking' ) | |
| 376 | 405 | ,'<strong>','</strong>' |
| 377 | - ,'<i class="menu_icon icon-1x wpbc-bi-heart-fill 0wpbc_icn_favorite" style="color: #dd2e44;"></i>' ); | |
| 406 | + ,'<i class="menu_icon icon-1x wpbc-bi-heart-fill 0wpbc_icn_favorite" style="color: #dd2e44;"></i>' ) ); | |
| 378 | 407 | ?></h4><br> |
| 379 | - <h4 class="modal-title"><?php _e('Your answers will help us to make the plugin better for you!' ,'booking'); ?></h4><br> | |
| 380 | - <h4 class="modal-title"><?php _e('Thanks for sharing your feedback! Have a great day :)' ,'booking'); ?></h4> | |
| 408 | + <h4 class="modal-title"><?php esc_html_e('Your answers will help us to make the plugin better for you!' ,'booking'); ?></h4><br> | |
| 409 | + <h4 class="modal-title"><?php esc_html_e('Thanks for sharing your feedback! Have a great day :)' ,'booking'); ?></h4> | |
| 381 | 410 | <div class="modal-footer modal-footer-inside ui_element"> |
| 382 | 411 | <a class="button button-primary wpbc_ui_button wpbc_ui_button_primary" id="wpbc_modal__feedback_01__submit_5" |
| 383 | 412 | onclick="javascript: wpbc_ajx_booking__ui_click__submit_feedback_01( this, '.wpbc_modal__feedback_01__step_7');" href="javascript:void(0);" |
| 384 | - ><span><?php _e('Done' ,'booking'); ?></span> <i class="menu_icon icon-1x wpbc_icn_done_all"></i></a> | |
| 413 | + ><span><?php esc_html_e('Done' ,'booking'); ?></span> <i class="menu_icon icon-1x wpbc_icn_done_all"></i></a> | |
| 385 | 414 | </div> |
| 386 | 415 | </div> |
| 387 | 416 | <?php |
| 388 | 417 | } |
| @@ -402,8 +431,9 @@ | ||
| 402 | 431 | $feedback_stars = intval( $request_params['feedback_stars'] ); |
| 403 | 432 | $feedback__note = $request_params['feedback__note'];//esc_textarea( $request_params['feedback__note'] ); |
| 404 | 433 | |
| 405 | 434 | $after_action_result = true; |
| 435 | + /* translators: 1: ... */ | |
| 406 | 436 | $after_action_message = sprintf( __( 'Thanks for sharing your rating %s', 'booking' ), '<strong style="font-size: 1.1em;">' . $feedback_stars . '</strong>/5' ); |
| 407 | 437 | |
| 408 | 438 | if ( 'remind_later' == $feedback__note ) { |
| 409 | 439 | |
| @@ -409,16 +439,16 @@ | ||
| 409 | 439 | |
| 410 | 440 | $after_action_message = __( 'Done', 'booking' ); |
| 411 | 441 | |
| 412 | 442 | // Update new period for showing Feedback |
| 413 | - $feedback_date = date('Y-m-d H:i:s', strtotime( WPBC_FEEDBACK_TIMEOUT, strtotime( 'now' ) ) ); | |
| 414 | - update_option('booking_feedback_03', $feedback_date ); | |
| 443 | + $feedback_date = gmdate('Y-m-d H:i:s', strtotime( WPBC_FEEDBACK_TIMEOUT, strtotime( 'now' ) ) ); | |
| 444 | + update_option('booking_feedback_04', $feedback_date ); | |
| 415 | 445 | |
| 416 | 446 | } elseif ( ( $feedback_stars > 0 ) && ( $feedback_stars <= 5 ) ) { |
| 417 | 447 | |
| 418 | 448 | // Send email |
| 419 | 449 | wpbc_feedback_01__send_email( $feedback_stars, $feedback__note ); |
| 420 | - update_option('booking_feedback_03_rating', $feedback_stars ); | |
| 450 | + update_option('booking_feedback_04_rating', $feedback_stars ); | |
| 421 | 451 | |
| 422 | 452 | } |
| 423 | 453 | |
| 424 | 454 | if ( ( 5 == $feedback_stars ) && ( 'rate5' != $feedback__note ) ) { |
| @@ -465,18 +495,13 @@ | ||
| 465 | 495 | $message .= '---------------------------------------------' . "\n"; |
| 466 | 496 | |
| 467 | 497 | $message .= 'Booking Calendar ' . wpbc_feedback_01_get_version() . "\n"; |
| 468 | 498 | |
| 469 | - global $wpdb; | |
| 470 | - $sql = "SELECT modification_date FROM {$wpdb->prefix}booking as bk ORDER by booking_id LIMIT 0,1"; | |
| 471 | - $res = $wpdb->get_results( $sql ); | |
| 472 | - if ( ! empty( $res ) ) { | |
| 473 | - $first_booking_date = wpbc_datetime_localized( date( 'Y-m-d H:i:s', strtotime( $res[0]->modification_date ) ), 'Y-m-d H:i:s' ); | |
| 499 | + $how_old_info_arr = wpbc_get_info__about_how_old(); | |
| 500 | + if ( ! empty( $how_old_info_arr ) ) { | |
| 474 | 501 | $message .= "\n"; |
| 475 | - $message .= 'From: ' . $first_booking_date; | |
| 476 | - | |
| 477 | - $dif_days = wpbc_get_difference_in_days( date( 'Y-m-d 00:00:00', strtotime( 'now' ) ), date( 'Y-m-d 00:00:00', strtotime( $res[0]->modification_date ) ) ); | |
| 478 | - $message .= ' - ' . $dif_days . ' days ago.'; | |
| 502 | + $message .= 'From: ' . $how_old_info_arr['date_echo']; | |
| 503 | + $message .= ' - ' . $how_old_info_arr['days'] . ' days ago.'; | |
| 479 | 504 | } |
| 480 | 505 | |
| 481 | 506 | $message .="\n"; |
| 482 | 507 | $message .= '---------------------------------------------' . "\n"; |
| @@ -505,11 +530,11 @@ | ||
| 505 | 530 | $to = wpbc_get_feedback_defaults( 'feedback_email' ); |
| 506 | 531 | |
| 507 | 532 | // debuge('In email', htmlentities($to), $subject, htmlentities($message), $headers, $attachments) ; |
| 508 | 533 | // debuge( '$to, $subject, $message, $headers, $attachments',htmlspecialchars($to), htmlspecialchars($subject), htmlspecialchars($message), htmlspecialchars($headers), htmlspecialchars($attachments)); |
| 509 | - | |
| 510 | - $return = wp_mail( $to, $subject, $message, $headers, $attachments ); | |
| 511 | - | |
| 534 | + if ( wpbc_email_api_is_allow_send( true, '', '' ) ) { | |
| 535 | + $return = wp_mail( $to, $subject, $message, $headers, $attachments ); | |
| 536 | + } | |
| 512 | 537 | } |
| 513 | 538 | |
| 514 | 539 | |
| 515 | 540 | |
| @@ -518,18 +543,20 @@ | ||
| 518 | 543 | * @return string |
| 519 | 544 | */ |
| 520 | 545 | function wpbc_feedback_01_get_version(){ |
| 521 | 546 | |
| 522 | - if ( substr( WPDEV_BK_VERSION, 0, 3 ) == '10.' ) { | |
| 523 | - $show_version = substr( WPDEV_BK_VERSION, 3 ); | |
| 524 | - if ( substr( $show_version, ( - 1 * ( strlen( WP_BK_VERSION_NUM ) ) ) ) === WP_BK_VERSION_NUM ) { | |
| 525 | - $show_version = substr( $show_version, 0, ( - 1 * ( strlen( WP_BK_VERSION_NUM ) ) - 1 ) ); | |
| 526 | - $show_version = str_replace( '.', ' ', $show_version ) . ' ' . WP_BK_VERSION_NUM; | |
| 527 | - } | |
| 547 | + // if ( substr( WPDEV_BK_VERSION, 0, 3 ) == '11.' ) { | |
| 548 | + // $show_version = substr( WPDEV_BK_VERSION, 3 ); | |
| 549 | + // if ( substr( $show_version, ( - 1 * ( strlen( WP_BK_VERSION_NUM ) ) ) ) === WP_BK_VERSION_NUM ) { | |
| 550 | + // $show_version = substr( $show_version, 0, ( - 1 * ( strlen( WP_BK_VERSION_NUM ) ) - 1 ) ); | |
| 551 | + // $show_version = str_replace( '.', ' ', $show_version ) . ' ' . WP_BK_VERSION_NUM; | |
| 552 | + // } | |
| 553 | + // | |
| 554 | + // } else { | |
| 555 | + // $show_version = WPDEV_BK_VERSION; | |
| 556 | + // } | |
| 528 | 557 | |
| 529 | - } else { | |
| 530 | - $show_version = WPDEV_BK_VERSION; | |
| 531 | - } | |
| 558 | + $show_version = wpbc_get_wpbc_versions_numbers(); | |
| 532 | 559 | |
| 533 | 560 | $ver = wpbc_get_plugin_version_type(); |
| 534 | 561 | if ( class_exists( 'wpdev_bk_multiuser' ) ) { |
| 535 | 562 | $ver = 'MultiUser'; |
| @@ -554,9 +581,9 @@ | ||
| 554 | 581 | } |
| 555 | 582 | |
| 556 | 583 | return $ver . ' (' . $show_version . ') ' |
| 557 | 584 | . ( ( 'Free' !== $ver ) ? ' :: ' . $v_type . '.' : '' ) |
| 558 | - . ' :: ' . date( "d.m.Y", filemtime( WPBC_FILE ) ); | |
| 585 | + . ' :: ' . gmdate( "d.m.Y", filemtime( WPBC_FILE ) ); | |
| 559 | 586 | } |
| 560 | 587 | |
| 561 | 588 | |
| 562 | 589 | /** |
| @@ -566,9 +593,9 @@ | ||
| 566 | 593 | function wpbc_is__feedback_01__timeout_need_to_show() { |
| 567 | 594 | |
| 568 | 595 | //return true; |
| 569 | 596 | |
| 570 | - $feedback_01_date = get_option( 'booking_feedback_03' ); | |
| 597 | + $feedback_01_date = get_option( 'booking_feedback_04' ); | |
| 571 | 598 | |
| 572 | 599 | if ( |
| 573 | 600 | ( ! empty( $feedback_01_date ) ) |
| 574 | 601 | && ( ( strtotime( 'now' ) - strtotime( $feedback_01_date ) ) > 0 ) |
| @@ -591,10 +618,10 @@ | ||
| 591 | 618 | // If version of Booking Calendar 9.6 (e.g. 'max_version') or newer than do not show this Feedback |
| 592 | 619 | if ( version_compare( WP_BK_VERSION_NUM, wpbc_get_feedback_defaults( 'max_version' ) , '>=') ) { |
| 593 | 620 | return false; |
| 594 | 621 | } |
| 595 | - $feedback_date = date( 'Y-m-d H:i:s', strtotime( WPBC_FEEDBACK_TIMEOUT, strtotime( 'now' ) ) ); | |
| 596 | - add_option( 'booking_feedback_03', $feedback_date ); | |
| 622 | + $feedback_date = gmdate( 'Y-m-d H:i:s', strtotime( WPBC_FEEDBACK_TIMEOUT, strtotime( 'now' ) ) ); | |
| 623 | + add_option( 'booking_feedback_04', $feedback_date ); | |
| 597 | 624 | } |
| 598 | 625 | add_bk_action( 'wpbc_before_activation' , 'wpbc_is__feedback_01__timer_install' ); |
| 599 | 626 | |
| 600 | 627 | |
| @@ -604,11 +631,11 @@ | ||
| 604 | 631 | */ |
| 605 | 632 | if ( |
| 606 | 633 | ( ! wpbc_is_this_demo() ) |
| 607 | 634 | ) { |
| 608 | - $js_css_loading = new WPBC_Feedback_01; | |
| 609 | - $js_css_loading->define_ajax_hook(); | |
| 635 | + $wpbc_js_css_loading = new WPBC_Feedback_01; | |
| 636 | + $wpbc_js_css_loading->define_ajax_hook(); | |
| 610 | 637 | |
| 611 | - if ( ! empty( get_option( 'booking_feedback_03' ) ) ){ | |
| 612 | - $js_css_loading->init_load_css_js(); | |
| 638 | + if ( ! empty( get_option( 'booking_feedback_04' ) ) ){ | |
| 639 | + $wpbc_js_css_loading->init_load_css_js(); | |
| 613 | 640 | } |
| 614 | 641 | } |