[], 'version' => Plugin::version(), ]; $asset_path = Plugin::assets_dir( $path . '.min.asset.php' ); // Check asset path existence. if ( ! file_exists( $asset_path ) ) { return $fallback_assets; } $asset_file = require $asset_path; if ( ! is_array( $asset_file ) ) { return $fallback_assets; } return $asset_file; } /** * Add the console logging script to the header of all admin pages. * * @action admin_header */ public function print_console_logging_cript() { // Bail if the script is missing. if ( ! file_exists( Plugin::assets_dir('/js/block-validation-tracker.min.js') ) ) { return; } $asset_file = $this->get_assets('/js/block-validation-tracker'); wp_enqueue_script( 'logging_script', Plugin::assets_url('/js/block-validation-tracker.min.js'), // Use the generated assets file for deps and version. $asset_file['dependencies'], $asset_file['version'], array( 'strategy' => 'defer', 'in_footer' => true, ) ); } /** * Add the RUM code to the footer of all pages. * * @action wp_footer * @action admin_footer */ public function print_inline_script() { global $wp_version, $post; $env = Plugin::get_env(); $host = in_array( $env, [ 'dev', 'test' ], true ) ? "{$env}-secureserver.net" : 'secureserver.net'; $coming_soon_page_status = apply_filters( 'gdl_coming_soon_page', false ) ? 1 : 0; $scc_asset = in_array( $env, [ 'prod', 'test' ], true ) ? 'scc-c2.min.js' : 'scc-c2.js'; $scc_host = $env === 'prod' ? 'img1.wsimg.com' : ($env === 'test' ? 'img1.test-wsimg.com' : 'img1.dev-wsimg.com'); $scc_url = "https://$scc_host/signals/js/clients/scc-c2/$scc_asset"; ?> = strtotime( '-60 days' ) ); $is_valid_customer_id = ( defined( 'GD_CUSTOMER_ID' ) && wp_is_uuid( GD_CUSTOMER_ID ) ); $is_using_temp_domain = ( defined( 'GD_TEMP_DOMAIN' ) && GD_TEMP_DOMAIN === parse_url( home_url(), PHP_URL_HOST ) ); $is_enabled = $GLOBALS['wpaas_feature_flag']->get_feature_flag_value( 'fullstory_wpadmin', false ); return ( $is_admin && $is_less_than_sixty_days_old && $is_valid_customer_id && $is_using_temp_domain && $is_enabled ); } /** * Return whether RUM should be enabled on the current page load. * * @return bool */ public static function is_enabled() { $rum_enabled = Plugin::is_rum_enabled(); $temp_domain = defined( 'GD_TEMP_DOMAIN' ) ? GD_TEMP_DOMAIN : null; $is_nocache = (bool) filter_input( INPUT_GET, 'nocache' ); $is_gddebug = (bool) filter_input( INPUT_GET, 'gddebug' ); $is_amp = ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ); return ( $rum_enabled && $temp_domain && ! $is_nocache && ! $is_gddebug && ! $is_amp && ! WP_DEBUG ); } }