PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
← All changes | includes/ui_modal__shortcodes/tiny-button-popup.php +114 -101 10.1011.8.4 View file →
@@ -18,27 +18,27 @@
18 18
19 19 class WPBC_TinyMCE_Buttons {
20 20
21 21 // <editor-fold defaultstate="collapsed" desc=" I n i t + H o o k s" >
22 - private $settings = array();
22 + private $settings = array();
23 +
24 + public function __construct( $params ) {
25 +
26 + $this->settings = array(
27 + 'tiny_prefix' => 'wpbc_tiny',
28 + 'tiny_icon_url' => '', // WPBC_PLUGIN_URL . '/assets/img/bc_black-16x16.png'.
29 + 'tiny_js_plugin' => WPBC_PLUGIN_URL . '/js/wpbc_tinymce_btn.js',
30 + 'tiny_js_function' => 'wpbc_init_tinymce_buttons', // This function NAME exist inside of this JS file: ['tiny_js_plugin'].
31 + 'tiny_btn_row' => 1,
32 + 'pages_where_insert' => array(), // FixIn: 10.6.5.1.
33 + 'buttons' => array(), // FixIn: 10.6.5.1.
34 + );
35 +
36 + $this->settings = wp_parse_args( $params, $this->settings );
37 +
38 + add_action( 'init', array( $this, 'define_init_hooks' ) ); // Define init hooks.
39 + }
23 40
24 - function __construct( $params ) {
25 -
26 - $this->settings = array(
27 - 'tiny_prefix' => 'wpbc_tiny'
28 - , 'tiny_icon_url' => '' //WPBC_PLUGIN_URL . '/assets/img/bc_black-16x16.png'
29 - , 'tiny_js_plugin' => WPBC_PLUGIN_URL . '/js/wpbc_tinymce_btn.js'
30 - , 'tiny_js_function' => 'wpbc_init_tinymce_buttons' // This function NAME exist inside of this JS file: ['tiny_js_plugin']
31 - , 'tiny_btn_row' => 1
32 - , 'pages_where_insert' => array() // FixIn: 10.6.5.1.
33 - , 'buttons' => array() // FixIn: 10.6.5.1.
34 - );
35 -
36 - $this->settings = wp_parse_args( $params, $this->settings );
37 -
38 - add_action( 'init', array( $this, 'define_init_hooks' ) ); // Define init hooks
39 - }
40 -
41 41 /** Init all hooks for showing Button in Tiny Toolbar */
42 42 public function define_init_hooks() {
43 43
44 44 if ( wpbc_can_i_load_on_this_page__shortcode_config() ) {
@@ -69,9 +69,10 @@
69 69 // Add the old style button to the non-TinyMCE editor views //Fix: 8.4.2.10 - compatibility with Gutenberg 4.1- 4.3 ( or newer ) at edit post page.
70 70 add_action( 'edit_page_form', array( $this, 'add_html_button' ) );
71 71 add_action( 'admin_head', array( $this, 'insert_button') ); // Tiny Button
72 72 add_action( 'admin_footer', array( $this, 'modal_content' ) ); // Modal Content
73 -
73 +
74 +
74 75 // JS & CSS
75 76 wpbc_load_js__required_for_modals();
76 77
77 78 add_action( 'customize_controls_print_footer_scripts', array( $this, 'add_html_button' ) ); // FixIn: 8.8.2.12.
@@ -79,101 +80,106 @@
79 80 add_action( 'customize_controls_print_footer_scripts', array( $this, 'modal_content' ) ); // Modal Content
80 81 }
81 82 }
82 83 // </editor-fold>
83 -
84 -
84 +
85 +
85 86 // <editor-fold defaultstate="collapsed" desc=" TinyMCE - Add Button " >
86 87
87 - /**
88 + /**
88 89 * Load JS file - TinyMCE plugin
89 - *
90 - * @param array $plugins
91 - * @return array
92 - */
93 - public function load_tiny_js_plugin( $plugins ){
94 -
95 - $plugins[ $this->settings['tiny_prefix'] . '_quicktags'] = $this->settings['tiny_js_plugin'];
96 -
97 - return $plugins;
98 - }
99 -
100 -
101 - /**
90 + *
91 + * @param array $plugins
92 + *
93 + * @return array
94 + */
95 + public function load_tiny_js_plugin( $plugins ) {
96 +
97 + $plugins[ $this->settings['tiny_prefix'] . '_quicktags' ] = $this->settings['tiny_js_plugin'];
98 +
99 + return $plugins;
100 + }
101 +
102 +
103 + /**
102 104 * Add the custom TinyMCE buttons
103 - *
104 - * @param array $buttons
105 - * @return array
106 - */
107 - public function add_tiny_button( $buttons ) {
108 -
109 - array_push( $buttons, "separator" );
110 -
111 - foreach ( $this->settings['buttons'] as $type => $strings ) {
112 - array_push( $buttons, $this->settings['tiny_prefix'] . '_' . $type );
113 - }
105 + *
106 + * @param array $buttons
107 + *
108 + * @return array
109 + */
110 + public function add_tiny_button( $buttons ) {
114 111
115 - return $buttons;
116 - }
117 -
118 -
119 - /** Add the old style button to the non-TinyMCE editor views */
120 - public function add_html_button() {
121 -
122 - $buttonshtml = '';
123 - $datajs='';
124 -
125 - foreach ( $this->settings['buttons'] as $type => $props ) {
112 + array_push( $buttons, 'separator' );
126 113
127 - $buttonshtml .= '<input type="button" class="ed_button button button-small" onclick="'
128 - .$props['js_func_name_click'].'(\'' . $type . '\')" title="' . $props['hint'] . '" value="' . $props['title'] . '" />';
114 + foreach ( $this->settings['buttons'] as $type => $strings ) {
115 + array_push( $buttons, $this->settings['tiny_prefix'] . '_' . $type );
116 + }
129 117
130 - $datajs.= " wpbc_tiny_btn_data['$type'] = {\n";
131 - $datajs.= ' title: "' . esc_js( $props['title'] ) . '",' . "\n";
132 - $datajs.= ' tag: "' . esc_js( $props['bookmark'] ) . '",' . "\n";
133 - $datajs.= ' tag_close: "' . esc_js( $props['is_close_bookmark'] ) . '",' . "\n";
134 - $datajs.= ' cal_count: "' . get_bk_option( 'booking_client_cal_count' ) . '"' . "\n";
135 - $datajs.= "\n };\n";
136 - }
137 -
138 - ?><script type="text/javascript">
139 - // <![CDATA[
140 -
141 - function wpbc_add_html_button_to_toolbar(){ // Add buttons ( HTML view )
142 - if ( jQuery( '#ed_toolbar' ).length == 0 )
143 - setTimeout( 'wpbc_add_html_button_to_toolbar()' , 100 );
144 - else
145 - jQuery("#ed_toolbar").append( '<?php
146 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
147 - echo wp_specialchars_decode( esc_js( $buttonshtml ), ENT_COMPAT ); ?>');
148 - }
149 - jQuery(document).ready(function(){
150 - setTimeout( 'wpbc_add_html_button_to_toolbar()' , 100 );
151 - });
118 + return $buttons;
119 + }
152 120
153 - var selected_booking_shortcode = 'bookingform';
154 - var wpbc_tiny_btn_data={};
155 - <?php
156 - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
157 - echo $datajs; ?>
158 -
159 - // ]]>
160 - </script><?php
161 -
162 - }
163 -
164 -
121 +
122 + /** Add the old style button to the non-TinyMCE editor views */
123 + public function add_html_button() {
124 +
125 + $buttonshtml = '';
126 + $datajs = '';
127 +
128 + foreach ( $this->settings['buttons'] as $type => $props ) {
129 +
130 + $buttonshtml .= '<input type="button" class="ed_button button button-small" onclick="' . $props['js_func_name_click'] . '(\'' . $type . '\')" title="' . $props['hint'] . '" value="' . $props['title'] . '" />';
131 +
132 + $datajs .= " wpbc_tiny_btn_data['$type'] = {\n";
133 + $datajs .= ' title: "' . esc_js( $props['title'] ) . '",' . "\n";
134 + $datajs .= ' tag: "' . esc_js( $props['bookmark'] ) . '",' . "\n";
135 + $datajs .= ' tag_close: "' . esc_js( $props['is_close_bookmark'] ) . '",' . "\n";
136 + $datajs .= ' cal_count: "' . get_bk_option( 'booking_client_cal_count' ) . '"' . "\n";
137 + $datajs .= "\n };\n";
138 + }
139 +
140 + ?>
141 + <script type="text/javascript">
142 + // <![CDATA[
143 + function wpbc_add_html_button_to_toolbar() { // Add buttons ( HTML view ).
144 + if ( jQuery( '#ed_toolbar' ).length == 0 )
145 + setTimeout( 'wpbc_add_html_button_to_toolbar()', 100 );
146 + else {
147 + jQuery( "#ed_toolbar" ).append( '<?php
148 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
149 + echo wp_specialchars_decode( esc_js( $buttonshtml ), ENT_COMPAT ); ?>' );
150 + }
151 + }
152 +
153 + jQuery( document ).ready( function () {
154 + setTimeout( 'wpbc_add_html_button_to_toolbar()', 100 );
155 + } );
156 +
157 + var selected_booking_shortcode = 'bookingform';
158 + var wpbc_tiny_btn_data = {};
159 + <?php
160 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
161 + echo $datajs; ?>
162 + // ]]>
163 + </script>
164 + <?php
165 +
166 + }
167 +
168 +
165 169 public function insert_button() {
166 170
167 171 $script = '';
168 172
169 - // calendar3-range https://icons.getbootstrap.com/icons/calendar3-range/
170 - $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-calendar3-range" viewBox="-2 -1 20 20">'
171 - . '<path d="M14 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zM1 3.857C1 3.384 1.448 3 2 3h12c.552 0 1 .384 1 .857v10.286c0 .473-.448.857-1 .857H2c-.552 0-1-.384-1-.857V3.857z"/>'
172 - . '<path d="M7 10a1 1 0 0 0 0-2H1v2h6zm2-3h6V5H9a1 1 0 0 0 0 2z"/>'
173 - . '</svg>';
174 - $mune_icon_url = sprintf( 'data:image/svg+xml;base64,%s', base64_encode( $svg_icon_integarted ) );
173 +// // calendar3-range https://icons.getbootstrap.com/icons/calendar3-range/
174 +// $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-calendar3-range" viewBox="-2 -1 20 20">'
175 +// . '<path d="M14 0H2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zM1 3.857C1 3.384 1.448 3 2 3h12c.552 0 1 .384 1 .857v10.286c0 .473-.448.857-1 .857H2c-.552 0-1-.384-1-.857V3.857z"/>'
176 +// . '<path d="M7 10a1 1 0 0 0 0-2H1v2h6zm2-3h6V5H9a1 1 0 0 0 0 2z"/>'
177 +// . '</svg>';
178 +// $mune_icon_url = sprintf( 'data:image/svg+xml;base64,%s', base64_encode( $svg_icon_integarted ) );
175 179
180 + // FixIn: 10.11.3.3.
181 + $mune_icon_url = wpbc_get_svg_logo_for_background( '#000', '#aaa', '0.3' ); // '#aaa', '#aaa', '0.2' .
176 182
177 183 if ( ! empty( $this->settings['buttons'] ) ){
178 184
179 185 $script .= '<script type="text/javascript">';
@@ -207,9 +213,9 @@
207 213 // <editor-fold defaultstate="collapsed" desc=" M o d a l C o n t e n t " >
208 214 public function modal_content() {
209 215
210 216 ?><span class="wpdevelop wpbc_page"><div class="visibility_container clearfix-height" style="display:block;"><?php
211 - ?><div id="wpbc_tiny_modal" class="modal wpbc_popup_modal wpbc_tiny_modal" tabindex="-1" role="dialog">
217 + ?><div id="wpbc_tiny_modal" class="modal wpbc_popup_modal wpbc_tiny_modal wpbc_shortcode_config__scroll_mode" tabindex="-1" role="dialog">
212 218 <div class="modal-dialog modal-lg">
213 219 <div class="modal-content">
214 220 <div class="modal-header">
215 221 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
@@ -237,8 +243,14 @@
237 243
238 244 // [bookingcalendar ... ] ----------------------------------------------------------
239 245 wpbc_shortcode_config__content__bookingcalendar();
240 246
247 + // [booking_appointment ... ] --------------------------------------------------
248 + wpbc_shortcode_config__content__booking_appointment();
249 +
250 + // [booking_resource_selector ... ] --------------------------------------------
251 + wpbc_shortcode_config__content__booking_resource_selector();
252 +
241 253 // [bookingselect ... ] ------------------------------------------------------------
242 254 wpbc_shortcode_config__content__bookingselect();
243 255
244 256 // [bookingtimeline ... ] ----------------------------------------------------------
@@ -310,10 +322,11 @@
310 322
311 323
312 324 if (
313 325 ( in_array( basename( $_SERVER['PHP_SELF'] ), wpbc_get_pages_where_insert_tiny_mce_buttons() ) ) // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
314 - || ( ( isset( $_REQUEST['page'] ) && ( 'wpbc-resources' === $_REQUEST['page'] ) ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
326 + || wpbc_can_i_load_on__resources_page()
315 327 || wpbc_is_setup_wizard_page() // || wpbc_is_bookings_page() // FixIn: 10.6.6.2.
328 + || wpbc_is_builder_booking_form_page()
316 329 ) {
317 330 // FixIn: 10.6.5.1.
318 331 new WPBC_TinyMCE_Buttons( array(
319 332 'tiny_prefix' => 'wpbc_tiny',