| @@ -174,15 +174,14 @@ | ||
| 174 | 174 | /** |
| 175 | 175 | * Define constant if not already set. |
| 176 | 176 | * |
| 177 | 177 | * @since 1.0.0 |
| 178 | - * @param string $timetics_constant_name Constant name. | |
| 178 | + * @param string $name Constant name. | |
| 179 | 179 | * @param string|bool $value Constant value. |
| 180 | 180 | */ |
| 181 | - private function define( $timetics_constant_name, $value ) { | |
| 182 | - if ( ! defined( $timetics_constant_name ) ) { | |
| 183 | - // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.VariableConstantNameFound -- Constant name is dynamic but prefixed by caller | |
| 184 | - define( $timetics_constant_name, $value ); | |
| 181 | + private function define( $name, $value ) { | |
| 182 | + if ( ! defined( $name ) ) { | |
| 183 | + define( $name, $value ); | |
| 185 | 184 | } |
| 186 | 185 | } |
| 187 | 186 | |
| 188 | 187 | /** |
| @@ -338,25 +337,8 @@ | ||
| 338 | 337 | |
| 339 | 338 | wp_register_style( 'timetics-vendor', TIMETICS_ASSETS_URL . 'css/vendor.css', [], TIMETICS_VERSION, 'all' ); |
| 340 | 339 | wp_register_style( 'timetics-frontend', TIMETICS_ASSETS_URL . 'css/frontend.css', [], TIMETICS_VERSION, 'all' ); |
| 341 | 340 | |
| 342 | - global $post; | |
| 343 | - if ( $post ) { | |
| 344 | - $is_timetics_cpt = ( 'timetics-appointment' === get_post_type( $post ) ); | |
| 345 | - $timetics_shortcodes = [ 'timetics-booking-form', 'timetics-meeting-list', 'timetics-user-dashboard', 'timetics-category' ]; | |
| 346 | - $has_timetics_shortcode = false; | |
| 347 | - foreach ( $timetics_shortcodes as $shortcode ) { | |
| 348 | - if ( has_shortcode( $post->post_content, $shortcode ) ) { | |
| 349 | - $has_timetics_shortcode = true; | |
| 350 | - break; | |
| 351 | - } | |
| 352 | - } | |
| 353 | - if ( $is_timetics_cpt || $has_timetics_shortcode ) { | |
| 354 | - wp_enqueue_style( 'timetics-vendor' ); | |
| 355 | - wp_enqueue_style( 'timetics-frontend' ); | |
| 356 | - } | |
| 357 | - } | |
| 358 | - | |
| 359 | 341 | wp_register_script( 'timetics-flatpickr-scripts', TIMETICS_ASSETS_URL . 'js/vendors/flatpickr.js', [ 'wp-plugins', 'wp-i18n', 'wp-element', 'wp-dom', 'wp-data' ], TIMETICS_VERSION, true ); |
| 360 | 342 | wp_enqueue_script( 'timetics-packages', TIMETICS_ASSETS_URL . 'js/packages.js', [ 'timetics-flatpickr-scripts' ], TIMETICS_VERSION, true ); |
| 361 | 343 | |
| 362 | 344 | wp_register_script( 'timetics-frontend-scripts', TIMETICS_ASSETS_URL . 'js/frontend.js', [ 'jquery', 'wp-plugins', 'wp-i18n', 'wp-element', 'wp-dom', 'wp-data' ], TIMETICS_VERSION, true ); |
| @@ -438,10 +420,9 @@ | ||
| 438 | 420 | * |
| 439 | 421 | * @return void |
| 440 | 422 | */ |
| 441 | 423 | public function handle_buy_pro_module() { |
| 442 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only page parameter check, no form processing | |
| 443 | - $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; | |
| 424 | + $page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : ''; | |
| 444 | 425 | |
| 445 | 426 | |
| 446 | 427 | if ( 'timetics' !== $page ) { |
| 447 | 428 | return; |