Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/google-site-kit/includes/Modules/Ads/PAX_Config.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
/**
3
+
* Class Google\Site_Kit\Modules\Ads\PAX_Config
4
+
*
5
+
* @package Google\Site_Kit
6
+
* @copyright 2024 Google LLC
7
+
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
8
+
* @link https://sitekit.withgoogle.com
9
+
*/
10
+
11
+
namespace Google\Site_Kit\Modules\Ads;
12
+
13
+
use Google\Site_Kit\Context;
14
+
use Google\Site_Kit\Core\Authentication\Token;
15
+
16
+
/**
17
+
* Class representing PAX configuration.
18
+
*
19
+
* @since 1.128.0
20
+
* @access private
21
+
* @ignore
22
+
*/
23
+
class PAX_Config {
24
+
25
+
/**
26
+
* Context instance.
27
+
*
28
+
* @since 1.128.0
29
+
* @var Context
30
+
*/
31
+
private $context;
32
+
33
+
/**
34
+
* Token instance.
35
+
*
36
+
* @since 1.128.0
37
+
* @var Token
38
+
*/
39
+
private $token;
40
+
41
+
/**
42
+
* Constructor.
43
+
*
44
+
* @since 1.128.0
45
+
*
46
+
* @param Context $context Context instance.
47
+
* @param Token $token Token instance.
48
+
*/
49
+
public function __construct( Context $context, Token $token ) {
50
+
$this->context = $context;
51
+
$this->token = $token;
52
+
}
53
+
54
+
/**
55
+
* Gets the configuration data.
56
+
*
57
+
* @since 1.128.0
58
+
* @return array
59
+
*/
60
+
public function get() {
61
+
$token = $this->token->get();
62
+
63
+
return array(
64
+
'authAccess' => array(
65
+
'oauthTokenAccess' => array(
66
+
'token' => $token['access_token'] ?? '',
67
+
),
68
+
),
69
+
'locale' => substr( $this->context->get_locale( 'user' ), 0, 2 ),
70
+
'debuggingConfig' => array(
71
+
'env' => $this->get_env(),
72
+
),
73
+
);
74
+
}
75
+
76
+
/**
77
+
* Gets the environment configuration.
78
+
*
79
+
* @since 1.128.0
80
+
* @return string
81
+
*/
82
+
protected function get_env() {
83
+
$allowed = array( 'PROD', 'QA_PROD' );
84
+
85
+
if ( defined( 'GOOGLESITEKIT_PAX_ENV' ) && in_array( GOOGLESITEKIT_PAX_ENV, $allowed, true ) ) {
86
+
return GOOGLESITEKIT_PAX_ENV;
87
+
}
88
+
89
+
return 'PROD';
90
+
}
91
+
}
92
+