1 | <?php |
||
19 | class GraphQLEndpoint extends WordPressOption |
||
20 | { |
||
21 | const DEFAULT_ENDPOINT = 'graphql'; |
||
22 | |||
23 | const OPTION_NAME = 'ee-graphql-endpoint'; |
||
24 | |||
25 | /** |
||
26 | * @var boolean |
||
27 | */ |
||
28 | private $is_gql_request; |
||
29 | |||
30 | |||
31 | /** |
||
32 | * GraphQLEndpoint constructor. |
||
33 | */ |
||
34 | public function __construct() |
||
39 | |||
40 | |||
41 | /** |
||
42 | * @return false|mixed|void |
||
43 | */ |
||
44 | public function getEndpoint() |
||
48 | |||
49 | |||
50 | /** |
||
51 | * @return mixed|void|bool |
||
52 | */ |
||
53 | public function isGraphqlRequest() |
||
71 | |||
72 | |||
73 | /** |
||
74 | * callback hooked into the graphql_register_settings action |
||
75 | * basically grabs the value for the 'graphql_endpoint' setting and saves it to our own WP option. |
||
76 | * |
||
77 | * i know, i know, i know... |
||
78 | * WHY are we saving the graphql_endpoint to a WP option if WP GraphQL is already doing the same ?!?! |
||
79 | * |
||
80 | * Because we perform our request type detection during `plugins_loaded`, |
||
81 | * but they don't settle on their endpoint until `after_setup_theme` has run, |
||
82 | * which is too late for us, so we are just going to save this separately so that we have it. |
||
83 | * Oh, and this will essentially recheck this value on EVERY request |
||
84 | * but will only update our saved value if it has actually changed |
||
85 | */ |
||
86 | public function verifyAndSetEndpoint() |
||
99 | } |
||
100 |