PluginProbe
BeyondWords – AI audio for publishers / 6.1.0
BeyondWords – AI audio for publishers v6.1.0
7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.7.0 All 43 releases
speechkit / src / Core / Environment.php

Environment.php in BeyondWords – AI audio for publishers 6.1.0, at src/Core/Environment.php

158 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 /**
6 * BeyondWords Environment.
7 *
8 * @package Beyondwords\Wordpress
9 * @author Stuart McAlpine <stu@beyondwords.io>
10 * @since 3.0.0
11 */
12
13 namespace Beyondwords\Wordpress\Core;
14
15 /**
16 * Environment
17 *
18 * @since 3.0.0
19 */
20 defined('ABSPATH') || exit;
21
22 class Environment
23 {
24 /**
25 * The BeyondWords API URL.
26 *
27 * Override with BEYONDWORDS_API_URL in wp-config.php.
28 *
29 * @since 3.0.0
30 * @var string
31 */
32 public const BEYONDWORDS_API_URL = 'https://api.beyondwords.io/v1';
33
34 /**
35 * The BeyondWords Backend URL.
36 *
37 * Override with BEYONDWORDS_BACKEND_URL in wp-config.php.
38 *
39 * @since 3.0.0
40 * @var string
41 */
42 public const BEYONDWORDS_BACKEND_URL = '';
43
44 /**
45 * The BeyondWords JS SDK URL.
46 *
47 * Override with BEYONDWORDS_JS_SDK_URL in wp-config.php.
48 *
49 * @since 3.0.0
50 * @var string
51 */
52 public const BEYONDWORDS_JS_SDK_URL = 'https://proxy.beyondwords.io/npm/@beyondwords/player@latest/dist/umd.js'; // phpcs:ignore Generic.Files.LineLength.TooLong
53
54 /**
55 * The BeyondWords AMP Player URL.
56 *
57 * Override with BEYONDWORDS_AMP_PLAYER_URL in wp-config.php.
58 *
59 * @since 3.0.0
60 * @var string
61 */
62 public const BEYONDWORDS_AMP_PLAYER_URL = 'https://audio.beyondwords.io/amp/%d?podcast_id=%s';
63
64 /**
65 * The BeyondWords AMP image URL.
66 *
67 * Override with BEYONDWORDS_AMP_IMG_URL in wp-config.php.
68 *
69 * @since 3.0.0 Introduced
70 * @since 5.3.0 Update asset URL to Azure Storage
71 * @var string
72 */
73 public const BEYONDWORDS_AMP_IMG_URL = 'https://beyondwords-cdn-b7fyckdeejejb6dj.a03.azurefd.net/assets/logo.svg';
74
75 /**
76 * The BeyondWords dashboard URL.
77 *
78 * Override with BEYONDWORDS_DASHBOARD_URL in wp-config.php.
79 *
80 * @since 3.0.0
81 * @var string
82 */
83 public const BEYONDWORDS_DASHBOARD_URL = 'https://dash.beyondwords.io';
84
85 /**
86 * Auto-sync settings.
87 *
88 * @since 5.2.0
89 * @var bool
90 */
91 public const BEYONDWORDS_AUTO_SYNC_SETTINGS = true;
92
93 public static function getApiUrl(): string
94 {
95 if (defined('BEYONDWORDS_API_URL') && strlen(BEYONDWORDS_API_URL)) {
96 return BEYONDWORDS_API_URL;
97 }
98
99 return static::BEYONDWORDS_API_URL;
100 }
101
102 public static function getBackendUrl(): string
103 {
104 if (defined('BEYONDWORDS_BACKEND_URL') && strlen(BEYONDWORDS_BACKEND_URL)) {
105 return BEYONDWORDS_BACKEND_URL;
106 }
107
108 return static::BEYONDWORDS_BACKEND_URL;
109 }
110
111 public static function getJsSdkUrl(): string
112 {
113 if (defined('BEYONDWORDS_JS_SDK_URL') && strlen(BEYONDWORDS_JS_SDK_URL)) {
114 return BEYONDWORDS_JS_SDK_URL;
115 }
116
117 return static::BEYONDWORDS_JS_SDK_URL;
118 }
119
120 public static function getAmpPlayerUrl(): string
121 {
122 if (defined('BEYONDWORDS_AMP_PLAYER_URL') && strlen(BEYONDWORDS_AMP_PLAYER_URL)) {
123 return BEYONDWORDS_AMP_PLAYER_URL;
124 }
125
126 return static::BEYONDWORDS_AMP_PLAYER_URL;
127 }
128
129 public static function getAmpImgUrl(): string
130 {
131 if (defined('BEYONDWORDS_AMP_IMG_URL') && strlen(BEYONDWORDS_AMP_IMG_URL)) {
132 return BEYONDWORDS_AMP_IMG_URL;
133 }
134
135 return static::BEYONDWORDS_AMP_IMG_URL;
136 }
137
138 public static function getDashboardUrl(): string
139 {
140 if (defined('BEYONDWORDS_DASHBOARD_URL') && strlen(BEYONDWORDS_DASHBOARD_URL)) {
141 return BEYONDWORDS_DASHBOARD_URL;
142 }
143
144 return static::BEYONDWORDS_DASHBOARD_URL;
145 }
146
147 public static function hasAutoSyncSettings(): bool
148 {
149 $value = static::BEYONDWORDS_AUTO_SYNC_SETTINGS;
150
151 if (defined('BEYONDWORDS_AUTO_SYNC_SETTINGS')) {
152 $value = (bool) BEYONDWORDS_AUTO_SYNC_SETTINGS;
153 }
154
155 return $value;
156 }
157 }
158