File tree Expand file tree Collapse file tree 1 file changed +1
-23
lines changed Expand file tree Collapse file tree 1 file changed +1
-23
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public static function setup() {
4040 * @return string
4141 */
4242 public static function woocommerce_session_handler ( $ session_class ) {
43- if ( self ::is_graphql_request () ) {
43+ if ( \ WPGraphQL \Router ::is_graphql_request () ) {
4444 $ session_class = '\WPGraphQL\WooCommerce\Utils\QL_Session_Handler ' ;
4545 }
4646
@@ -75,26 +75,4 @@ public static function add_session_header_to_allow_headers( array $allowed_heade
7575 $ allowed_headers [] = self ::$ session_header ;
7676 return $ allowed_headers ;
7777 }
78-
79- /**
80- * Confirm that the current request is being made to the GraphQL endpoint.
81- *
82- * @return bool
83- */
84- private static function is_graphql_request () {
85- // If before 'init' check $_SERVER.
86- if ( isset ( $ _SERVER ['HTTP_HOST ' ] ) && isset ( $ _SERVER ['REQUEST_URI ' ] ) ) {
87- $ haystack = esc_url_raw ( wp_unslash ( $ _SERVER ['HTTP_HOST ' ] ) )
88- . esc_url_raw ( wp_unslash ( $ _SERVER ['REQUEST_URI ' ] ) );
89- $ needle = \home_url ( \WPGraphQL \Router::$ route );
90-
91- // Strip protocol.
92- $ haystack = preg_replace ( '#^(http(s)?://)# ' , '' , $ haystack );
93- $ needle = preg_replace ( '#^(http(s)?://)# ' , '' , $ needle );
94- $ len = strlen ( $ needle );
95- return ( substr ( $ haystack , 0 , $ len ) === $ needle );
96- }
97-
98- return false ;
99- }
10078}
You can’t perform that action at this time.
0 commit comments