| @@ -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 | /** |
| @@ -228,9 +227,8 @@ | ||
| 228 | 227 | |
| 229 | 228 | // Register scripts and styles first |
| 230 | 229 | if ( $this->is_request( 'admin' ) ) { |
| 231 | 230 | add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] ); |
| 232 | - add_action( 'admin_footer', [ $this, 'admin_helpscout_beacon' ] ); | |
| 233 | 231 | } |
| 234 | 232 | |
| 235 | 233 | if ( $this->is_request( 'frontend' ) ) { |
| 236 | 234 | add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) ); |
| @@ -275,10 +273,9 @@ | ||
| 275 | 273 | wp_register_style( 'timetics-feedback-modal', TIMETICS_ASSETS_URL . 'css/feedback-modal.css', [], TIMETICS_VERSION, 'all' ); |
| 276 | 274 | wp_enqueue_style( 'timetics-feedback-modal', TIMETICS_ASSETS_URL . 'css/feedback-modal.css', [], TIMETICS_VERSION, 'all' ); |
| 277 | 275 | |
| 278 | 276 | $feedback_obj = array( |
| 279 | - 'site_url' => site_url(), | |
| 280 | - 'admin_email' => get_option( 'admin_email' ) | |
| 277 | + 'site_url' => site_url() | |
| 281 | 278 | ); |
| 282 | 279 | |
| 283 | 280 | wp_localize_script( 'timetics-feedback-modal', 'timetics_feedback', $feedback_obj ); |
| 284 | 281 | |
| @@ -338,25 +335,8 @@ | ||
| 338 | 335 | |
| 339 | 336 | wp_register_style( 'timetics-vendor', TIMETICS_ASSETS_URL . 'css/vendor.css', [], TIMETICS_VERSION, 'all' ); |
| 340 | 337 | wp_register_style( 'timetics-frontend', TIMETICS_ASSETS_URL . 'css/frontend.css', [], TIMETICS_VERSION, 'all' ); |
| 341 | 338 | |
| 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 | 339 | 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 | 340 | wp_enqueue_script( 'timetics-packages', TIMETICS_ASSETS_URL . 'js/packages.js', [ 'timetics-flatpickr-scripts' ], TIMETICS_VERSION, true ); |
| 361 | 341 | |
| 362 | 342 | 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 +418,9 @@ | ||
| 438 | 418 | * |
| 439 | 419 | * @return void |
| 440 | 420 | */ |
| 441 | 421 | 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'] ) ) : ''; | |
| 422 | + $page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : ''; | |
| 444 | 423 | |
| 445 | 424 | |
| 446 | 425 | if ( 'timetics' !== $page ) { |
| 447 | 426 | return; |
| @@ -463,53 +442,14 @@ | ||
| 463 | 442 | |
| 464 | 443 | \Wpmet\Libs\Banner::instance('timetics') |
| 465 | 444 | ->is_test(true) |
| 466 | 445 | ->set_filter(ltrim($filter_string, ',')) |
| 467 | - ->set_api_url('https://banner.themefunction.com/public/jhanda') | |
| 446 | + ->set_api_url('https://product.themewinter.com/auth/public/jhanda') | |
| 468 | 447 | ->set_plugin_screens('timetics') |
| 469 | 448 | ->set_plugin_screens('toplevel_page_timetics') |
| 470 | 449 | ->call(); |
| 471 | 450 | // show get-help and upgrade-to-premium menu. |
| 472 | 451 | // $this->handle_get_help_and_upgrade_menu(); |
| 473 | - } | |
| 474 | - | |
| 475 | - /** | |
| 476 | - * Add HelpScout script to admin footer | |
| 477 | - * | |
| 478 | - * @return void | |
| 479 | - */ | |
| 480 | - public function admin_helpscout_beacon() { | |
| 481 | - $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; | |
| 482 | - $is_timetics_screen = false; | |
| 483 | - | |
| 484 | - if ( $screen ) { | |
| 485 | - $screen_id = isset( $screen->id ) ? $screen->id : ''; | |
| 486 | - | |
| 487 | - // Check: only load on Timetics top-level admin page | |
| 488 | - if ( 'toplevel_page_timetics' === $screen_id ) { | |
| 489 | - $is_timetics_screen = true; | |
| 490 | - } | |
| 491 | - } | |
| 492 | - | |
| 493 | - // Allow overriding detection via filter. | |
| 494 | - $is_timetics_screen = apply_filters( 'timetics_is_admin_screen', $is_timetics_screen, $screen ); | |
| 495 | - | |
| 496 | - if ( ! $is_timetics_screen ) { | |
| 497 | - return; | |
| 498 | - } | |
| 499 | - ?> | |
| 500 | - <script type="text/javascript">!function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)a();else if(e.attachEvent)e.attachEvent("onload",a);else e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){});</script> | |
| 501 | - <script type="text/javascript"> | |
| 502 | - window.Beacon('config', { | |
| 503 | - color: "#0060e5", | |
| 504 | - }); | |
| 505 | - window.Beacon('init', '4be24aa2-ee50-483c-a90c-db4216664d65'); | |
| 506 | - window.Beacon('on', 'ready', function(){ | |
| 507 | - window.Beacon('show'); | |
| 508 | - }); | |
| 509 | - | |
| 510 | - </script> | |
| 511 | - <?php | |
| 512 | 452 | } |
| 513 | 453 | |
| 514 | 454 | } |
| 515 | 455 | |