← All changes
|
includes/page-resource-free/page-resource-free.php
+19
-72
11.4.2
→
11.9
View file →
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php /** |
| 2 | 2 | * @version 1.0 |
| 3 | 3 | * @package Booking > Resource page |
| 4 | 4 | * @category Settings page |
| @@ -21,12 +21,15 @@ | ||
| 21 | 21 | * Define where to show |
| 22 | 22 | */ |
| 23 | 23 | class WPBC_Page_Settings__bresource extends WPBC_Page_Structure { |
| 24 | 24 | |
| 25 | - public function in_page() { | |
| 26 | - if ( class_exists( 'wpdev_bk_personal' ) ) { | |
| 27 | - return (string) wp_rand( 100000, 1000000 ); | |
| 28 | - } | |
| 25 | + public function in_page() { | |
| 26 | + if ( | |
| 27 | + class_exists( 'wpdev_bk_personal' ) | |
| 28 | + || ( function_exists( 'wpbc_booking_resources_catalog_should_use_new_renderer' ) && wpbc_booking_resources_catalog_should_use_new_renderer() ) | |
| 29 | + ) { | |
| 30 | + return (string) wp_rand( 100000, 1000000 ); | |
| 31 | + } | |
| 29 | 32 | return 'wpbc-resources'; |
| 30 | 33 | } |
| 31 | 34 | |
| 32 | 35 | public function tabs() { |
| @@ -50,13 +53,16 @@ | ||
| 50 | 53 | return $tabs; |
| 51 | 54 | } |
| 52 | 55 | |
| 53 | 56 | |
| 54 | - /** Show Content of Settings page */ | |
| 55 | - public function content() { | |
| 57 | + /** Show Content of Settings page */ | |
| 58 | + public function content() { | |
| 59 | + if ( function_exists( 'wpbc_booking_resources_catalog_get_request_renderer' ) && 'legacy' !== wpbc_booking_resources_catalog_get_request_renderer() ) { | |
| 60 | + return false; | |
| 61 | + } | |
| 62 | + | |
| 63 | + $this->css(); | |
| 56 | 64 | |
| 57 | - $this->css(); | |
| 58 | - | |
| 59 | 65 | //////////////////////////////////////////////////////////////////////// |
| 60 | 66 | // Checking |
| 61 | 67 | //////////////////////////////////////////////////////////////////////// |
| 62 | 68 | |
| @@ -129,11 +135,9 @@ | ||
| 129 | 135 | <div class="clear"></div> |
| 130 | 136 | </span> |
| 131 | 137 | <?php |
| 132 | 138 | |
| 133 | - do_action( 'wpbc_hook_settings_page_footer', 'resources' ); | |
| 134 | - | |
| 135 | - $this->enqueue_js(); | |
| 139 | + do_action( 'wpbc_hook_settings_page_footer', 'resources' ); | |
| 136 | 140 | } |
| 137 | 141 | |
| 138 | 142 | |
| 139 | 143 | // <editor-fold defaultstate="collapsed" desc=" CSS & JS " > |
| @@ -172,70 +176,11 @@ | ||
| 172 | 176 | } |
| 173 | 177 | </style> |
| 174 | 178 | <?php |
| 175 | 179 | } |
| 176 | - | |
| 177 | - | |
| 178 | - | |
| 179 | - /** | |
| 180 | - * Add Custom JavaScript - for some specific settings options | |
| 181 | - * Executed After post content, after initial definition of settings, and possible definition after POST request. | |
| 182 | - * | |
| 183 | - * @param type $menu_slug | |
| 184 | - */ | |
| 185 | - private function enqueue_js(){ | |
| 186 | - | |
| 187 | - // JavaScript ////////////////////////////////////////////////////////////// | |
| 188 | - | |
| 189 | - $js_script = ''; | |
| 190 | - | |
| 191 | - /* | |
| 192 | - // Hide|Show on Click Checkbox | |
| 193 | - $js_script .= " jQuery('#bresources_booking_gcal_auto_import_is_active').on( 'change', function(){ | |
| 194 | - if ( this.checked ) { | |
| 195 | - jQuery('.wpbc_tr_auto_import').removeClass('hidden_items'); | |
| 196 | - } else { | |
| 197 | - jQuery('.wpbc_tr_auto_import').addClass('hidden_items'); | |
| 198 | - } | |
| 199 | - } ); "; | |
| 200 | - */ | |
| 180 | + // </editor-fold> | |
| 201 | 181 | |
| 202 | - // Open the publish controls when this page is used as the Setup Wizard "Publish" step. | |
| 203 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 204 | - if ( isset( $_GET['wpbc_setup_step'] ) && ( 'wizard_publish' === sanitize_key( wp_unslash( $_GET['wpbc_setup_step'] ) ) ) ) { | |
| 205 | - $js_script .= " | |
| 206 | - jQuery( document ).ready( function() { | |
| 207 | - setTimeout( function() { | |
| 208 | - var publishSelector = '.ui_group__publish_btn:visible'; | |
| 209 | - var tableSelector = '#wpbc_booking_resource_table:visible'; | |
| 210 | - var \$publishTarget = jQuery( publishSelector ).first(); | |
| 211 | - var targetSelector = \$publishTarget.length ? publishSelector : tableSelector; | |
| 212 | 182 | |
| 213 | - if ( ! jQuery( targetSelector ).length ) { | |
| 214 | - return; | |
| 215 | - } | |
| 216 | - | |
| 217 | - if ( 'function' === typeof wpbc_scroll_to ) { | |
| 218 | - wpbc_scroll_to( targetSelector ); | |
| 219 | - } else { | |
| 220 | - jQuery( 'html, body' ).animate( { scrollTop: jQuery( targetSelector ).first().offset().top - 80 }, 300 ); | |
| 221 | - } | |
| 222 | - | |
| 223 | - if ( 'function' === typeof wpbc_blink_element ) { | |
| 224 | - wpbc_blink_element( targetSelector, 3, 300 ); | |
| 225 | - } | |
| 226 | - }, 350 ); | |
| 227 | - } ); | |
| 228 | - "; | |
| 229 | - } | |
| 230 | - | |
| 231 | - // Enqueue JS to the footer of the page | |
| 232 | - wpbc_enqueue_js( $js_script ); | |
| 233 | - } | |
| 234 | - | |
| 235 | - // </editor-fold> | |
| 236 | - | |
| 237 | - | |
| 238 | 183 | // ----------------------------------------------------------------------------------------------------------------- |
| 239 | 184 | // Toolbar |
| 240 | 185 | // ----------------------------------------------------------------------------------------------------------------- |
| 241 | 186 | /** Show Toolbar - Add new booking resources */ |
| @@ -466,5 +411,7 @@ | ||
| 466 | 411 | } |
| 467 | 412 | |
| 468 | 413 | } |
| 469 | 414 | |
| 470 | -add_action('wpbc_menu_created', array( new WPBC_Page_Settings__bresource() , '__construct') ); // Executed after creation of Menu | |
| 415 | +if ( ! function_exists( 'wpbc_booking_resources_catalog_should_use_new_renderer' ) || ! wpbc_booking_resources_catalog_should_use_new_renderer() ) { | |
| 416 | + add_action( 'wpbc_menu_created', array( new WPBC_Page_Settings__bresource(), '__construct' ) ); // Executed after creation of Menu. | |
| 417 | +} | |