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/_pagination/pagination.php +164 -20 10.1.311.8.4 View file →
@@ -37,9 +37,9 @@
37 37
38 38 <script type="text/javascript">
39 39 jQuery( document ).ready( function (){
40 40
41 - wpbc_pagination_echo( '.wpbc_rules_pagination',
41 + wpbc_pagination_echo( '.wpbc_rules_pagination','.wpbc_rules_pagination_header','.wpbc_rules_pagination_footer',
42 42 {
43 43 'page_active': page_number,
44 44 'pages_count': Math.ceil( ajx_count / ajx_page_items_count )
45 45 }
@@ -91,15 +91,14 @@
91 91 $in_footer = true;
92 92
93 93 if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
94 94
95 - //wp_enqueue_script( 'wpbc-live_search', wpbc_plugin_url( '/_out/js/live_search.js' ), array( 'wpbc-global-vars' ), WP_BK_VERSION_NUM, $in_footer );
96 95 wp_enqueue_script( 'wpbc-pagination'
97 - , trailingslashit( plugins_url( '', __FILE__ ) ) . 'pagination.js' /* wpbc_plugin_url( '/_out/js/codemirror.js' ) */
98 - , array( 'wpbc-global-vars' ), WP_BK_VERSION_NUM, $in_footer );
96 + , trailingslashit( plugins_url( '', __FILE__ ) ) . 'pagination.js' /* wpbc_plugin_url( '/_out/js/code_mirror.js' ) */
97 + , array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer );
99 98
100 99 /**
101 - wp_localize_script( 'wpbc-global-vars', 'wpbc_live_request_obj'
100 + wp_localize_script( 'wpbc_all', 'wpbc_live_request_obj'
102 101 , array(
103 102 'contacts' => '',
104 103 'reminders' => ''
105 104 )
@@ -139,15 +138,147 @@
139 138 public function hook__page_footer_tmpl( $page ){
140 139
141 140 if ( $this->get_settings( 'load_on_page' ) === $page ) {
142 141
143 - $this->template__pagination();
142 + $this->template__prev_next();
143 + $this->template__items_per_page();
144 + $this->template__active_page_in_selectbox();
144 145 }
145 146 }
146 147
148 + /**
149 + * Pagination - " 1 - 9 of many | < > "
150 + *
151 + * @return void
152 + */
153 + private function template__prev_next() {
147 154
148 - private function template__pagination(){
155 + ?>
156 + <script type="text/html" id="tmpl-wpbc_pagination__prev_next">
157 + <div class="wpbc_pagination__prev_next wpbc_pagination_el">
158 + <#
159 + var items = {};
160 + items['start'] = ( data.page_active - 1 ) * data.page_items_count + 1;
161 + items['end'] = data.page_active * data.page_items_count;
162 + items['end'] = ( items['end'] > data.total_count ) ? data.total_count : items['end'];
163 + items['total'] = data.total_count;
164 + #>
165 + <# if ( data.pages_count > 1 ) { #>
166 + <?php
167 + echo '<div class="wpbc_ui_el">{{items.start}} - {{items.end}} ' . esc_html__( 'of', 'booking' ) . ' {{items.total}}</div>';
168 + ?>
169 + <# } else { #>
170 + <?php
171 + echo '<div class="wpbc_ui_el">{{items.start}} - {{items.end}} ' . esc_html__( 'bookings', 'booking' ) . ' </div>';
172 + ?>
173 + <# } #>
174 + <# if ( data.pages_count > 1 ) { #>
175 + <div class="wpbc_ui_el">
176 + <a class="wpbc_ui_el__a <# if ( 1 == data.page_active ) { #> disabled<# } #>"
177 + href="javascript:void(0)"
178 + <# if ( 1 != data.page_active ) { #> onclick="javascript:<?php
179 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
180 + echo $this->get_settings( 'on_click' ); ?>( parseInt( {{ data.page_active }} ) - 1 );" <# } #>
181 + >
182 + <?php
183 + echo '<i class="menu_icon icon-1x wpbc_icn_chevron_left"></i>';
184 + ?>
185 + </a>
186 + </div>
187 + <# } #>
188 + <# if ( data.pages_count > 1 ) { #>
189 + <div class="wpbc_ui_el">
190 + <a class="wpbc_ui_el__a <# if ( data.pages_count == data.page_active ) { #> disabled<# } #>"
191 + href="javascript:void(0)"
192 + <# if ( data.pages_count != data.page_active ) { #> onclick="javascript:<?php
193 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
194 + echo $this->get_settings( 'on_click' ); ?>( parseInt( {{ data.page_active }} ) + 1 );" <# } #>
195 + >
196 + <?php
197 + echo '<i class="menu_icon icon-1x wpbc_icn_chevron_right"></i>';
198 + ?>
199 + </a>
200 + </div>
201 + <# } #>
149 202
203 + </div>
204 + </script><?php
205 +
206 + }
207 +
208 +
209 + /**
210 + * Pagination - select Number of Items / Page.
211 + *
212 + * @return void
213 + */
214 + private function template__items_per_page() {
215 + ?>
216 + <script type="text/html" id="tmpl-wpbc_pagination_items_per_page">
217 + <div class="wpbc_pagination_items_per_page wpbc_pagination_el">
218 + <div class="">
219 + <label class="wpbc_ui_el"><?php esc_html_e( 'Show', 'booking' ); ?></label>
220 + <select class="wpbc_ui_el wpbc_items_per_page" autocomplete="off">
221 + <#
222 + var my_options_arr = [5, 10, 50, 100];
223 + var is_selected = '';
224 + _.each(
225 + my_options_arr,
226 + function ( p_val, p_key, p_data ) {
227 + is_selected = '';
228 + if ( data.page_items_count == p_val ) {
229 + is_selected = ' selected="selected" ';
230 + }
231 + #><option value="{{p_val}}" {{is_selected}}>{{p_val}}</option><#
232 + }
233 + );
234 + #>
235 + </select>
236 + <label class="wpbc_ui_el"><?php esc_html_e( 'per page', 'booking' ); ?></label>
237 + </div>
238 + </div>
239 + </script>
240 + <?php
241 + }
242 +
243 + /**
244 + * Pagination - Active page Number in Selectbox
245 + *
246 + * @return void
247 + */
248 + private function template__active_page_in_selectbox(){
249 + ?>
250 + <script type="text/html" id="tmpl-wpbc_pagination_active_page_in_selectbox">
251 + <div class="wpbc_pagination_active_page_in_selectbox wpbc_pagination_el">
252 + <# if ( data.pages_count > 1 ) { #>
253 + <div class="">
254 + <label class="wpbc_ui_el"><?php esc_html_e( 'Page', 'booking' ); ?>: </label>
255 + <select class="wpbc_ui_el"
256 + autocomplete="off"
257 + onchange="javascript:<?php
258 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
259 + echo $this->get_settings( 'on_click' );
260 + ?>( ( parseInt( jQuery( this ).val() ) ) );"
261 + >
262 + <#
263 + var is_selected = '';
264 + for ( var pg_num = 1; pg_num <= data.pages_count; pg_num++ ){
265 + is_selected = ( pg_num == data.page_active ) ? ' selected="selected" ' : '';
266 + #><option value="{{pg_num}}" {{is_selected}}>{{pg_num}}</option><#
267 + }
268 + #>
269 + </select>
270 + </div>
271 + <# } #>
272 + </div>
273 + </script>
274 + <?php
275 + }
276 +
277 +
278 +
279 + private function template__pagination_old(){
280 +
150 281 // Pagination
151 282 ?><script type="text/html" id="tmpl-wpbc_pagination">
152 283 <div class="wpbc-ajax-pagination wpbc-ajax-pagination-container">
153 284 <# if ( data.pages_count > 1 ) { #>
@@ -153,11 +284,13 @@
153 284 <# if ( data.pages_count > 1 ) { #>
154 285 <div class="ui_element">
155 286 <a class="wpbc_ui_control wpbc_ui_button <# if ( 1 == data.page_active ) { #> disabled<# } #>"
156 287 href="javascript:void(0)"
157 - <# if ( 1 != data.page_active ) { #> onclick="javascript:<?php echo $this->get_settings( 'on_click' ); ?>( parseInt( {{ data.page_active }} ) - 1 );" <# } #>
288 + <# if ( 1 != data.page_active ) { #> onclick="javascript:<?php
289 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
290 + echo $this->get_settings( 'on_click' ); ?>( parseInt( {{ data.page_active }} ) - 1 );" <# } #>
158 291 >
159 - <?php _e('Prev', 'booking'); ?>
292 + <?php esc_html_e('Prev', 'booking'); ?>
160 293 </a>
161 294 </div>
162 295 <# }
163 296
@@ -173,9 +306,11 @@
173 306 && ( Math.abs( data.page_active - pg_num ) > num_closed_steps )
174 307 ) )
175 308 {
176 309 #> <div class="ui_element"><a class="wpbc_ui_control wpbc_ui_button <# if ( pg_num == data.page_active ) { #> active<# } #>"
177 - href="javascript:void(0)" onclick="javascript:<?php echo $this->get_settings( 'on_click' ); ?>( {{pg_num}} );" >
310 + href="javascript:void(0)" onclick="javascript:<?php
311 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
312 + echo $this->get_settings( 'on_click' ); ?>( {{pg_num}} );" >
178 313 {{pg_num}}</a></div> <#
179 314
180 315 if ( ( data.pages_count > ( num_closed_steps * 4) )
181 316 && ( (pg_num+1) > num_closed_steps )
@@ -190,11 +325,13 @@
190 325 if ( data.pages_count > 1 ) { #>
191 326 <div class="ui_element">
192 327 <a class="wpbc_ui_control wpbc_ui_button <# if ( data.pages_count == data.page_active ) { #> disabled<# } #>"
193 328 href="javascript:void(0)"
194 - <# if ( data.pages_count != data.page_active ) { #> onclick="javascript:<?php echo $this->get_settings( 'on_click' ); ?>( parseInt( {{ data.page_active }} ) + 1 );" <# } #>
329 + <# if ( data.pages_count != data.page_active ) { #> onclick="javascript:<?php
330 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
331 + echo $this->get_settings( 'on_click' ); ?>( parseInt( {{ data.page_active }} ) + 1 );" <# } #>
195 332 >
196 - <?php _e('Next', 'booking'); ?>
333 + <?php esc_html_e('Next', 'booking'); ?>
197 334 </a>
198 335 </div>
199 336 <# } #>
200 337 </div>
@@ -218,9 +355,9 @@
218 355 #>
219 356 </select>
220 357 </div>
221 358 <div class="ui_element">
222 - <label class="wpbc_ui_control_label"><?php _e('per page','booking') ?></label>
359 + <label class="wpbc_ui_control_label"><?php esc_html_e('per page','booking'); ?></label>
223 360 </div>
224 361 <?php
225 362
226 363 if (0) {
@@ -283,24 +420,31 @@
283 420 */
284 421 public function show( $params = array() ) {
285 422 $defaults = array(
286 423 'page_active' => 1,
287 - 'pages_count' => 1
424 + 'pages_count' => 1,
425 + 'total_count' => 1
288 426 );
289 427 $params = wp_parse_args( $params, $defaults );
290 428 ?>
291 429 <script type="text/javascript">
292 430
293 - jQuery( document ).ready( function (){
431 + jQuery( document ).ready( function () {
294 432
295 - wpbc_pagination_echo( '<?php echo $this->get_settings( 'container' ); ?>', <?php
433 + wpbc_pagination_echo(
434 + '<?php echo esc_attr( $this->get_settings( 'container' ) ); ?>',
435 + '<?php echo esc_attr( $this->get_settings( 'container_header' ) ); ?>',
436 + '<?php echo esc_attr( $this->get_settings( 'container_footer' ) ); ?>',
437 + <?php
296 438 echo wp_json_encode(
297 439 array(
298 440 'page_active' => $params['page_active'],
299 - 'pages_count' => $params['pages_count']
441 + 'pages_count' => $params['pages_count'],
442 + 'total_count' => $params['total_count'],
300 443 )
301 444 );
302 - ?> );
445 + ?>
446 + );
303 447 } );
304 448 </script>
305 449 <?php
306 450 }
@@ -309,10 +453,10 @@
309 453 /**
310 454 * Just for loading CSS and JavaScript files for all Settings pages
311 455 */
312 456 if ( true ) {
313 - $js_css_loading = new WPBC_Pagination;
314 - $js_css_loading->init_load_css_js();
457 + $wpbc_js_css_loading = new WPBC_Pagination;
458 + $wpbc_js_css_loading->init_load_css_js();
315 459 }
316 460
317 461
318 462 //TODO: delete ../email-reminders/_src/css/o-pagination.css