| @@ -15,8 +15,12 @@ | ||
| 15 | 15 | * @var number |
| 16 | 16 | */ |
| 17 | 17 | public $site_id; |
| 18 | 18 | /** |
| 19 | + * @var int | |
| 20 | + */ | |
| 21 | + public $blog_id; | |
| 22 | + /** | |
| 19 | 23 | * @var number |
| 20 | 24 | */ |
| 21 | 25 | public $plugin_id; |
| 22 | 26 | /** |
| @@ -39,12 +43,8 @@ | ||
| 39 | 43 | * @var string E.g. en-GB |
| 40 | 44 | */ |
| 41 | 45 | public $language; |
| 42 | 46 | /** |
| 43 | - * @var string E.g. UTF-8 | |
| 44 | - */ | |
| 45 | - public $charset; | |
| 46 | - /** | |
| 47 | 47 | * @var string Platform version (e.g WordPress version). |
| 48 | 48 | */ |
| 49 | 49 | public $platform_version; |
| 50 | 50 | /** |
| @@ -85,8 +85,10 @@ | ||
| 85 | 85 | /** |
| 86 | 86 | * @author Leo Fajardo (@leorw) |
| 87 | 87 | * |
| 88 | 88 | * @since 1.2.1.5 |
| 89 | + * @deprecated Since 2.5.1 | |
| 90 | + * @todo Remove after a few releases. | |
| 89 | 91 | * |
| 90 | 92 | * @var bool |
| 91 | 93 | */ |
| 92 | 94 | public $is_disconnected = false; |
| @@ -101,8 +103,16 @@ | ||
| 101 | 103 | * |
| 102 | 104 | * @var bool |
| 103 | 105 | */ |
| 104 | 106 | public $is_uninstalled = false; |
| 107 | + /** | |
| 108 | + * @author Edgar Melkonyan | |
| 109 | + * | |
| 110 | + * @since 2.4.2 | |
| 111 | + * | |
| 112 | + * @var bool | |
| 113 | + */ | |
| 114 | + public $is_beta; | |
| 105 | 115 | |
| 106 | 116 | /** |
| 107 | 117 | * @param stdClass|bool $site |
| 108 | 118 | */ |
| @@ -171,8 +181,9 @@ | ||
| 171 | 181 | // WPEngine staging. |
| 172 | 182 | fs_ends_with( $subdomain, '.staging.wpengine.com' ) || |
| 173 | 183 | fs_ends_with( $subdomain, '.dev.wpengine.com' ) || |
| 174 | 184 | fs_ends_with( $subdomain, '.wpengine.com' ) || |
| 185 | + fs_ends_with( $subdomain, '.wpenginepowered.com' ) || | |
| 175 | 186 | // Pantheon |
| 176 | 187 | ( fs_ends_with( $subdomain, 'pantheonsite.io' ) && |
| 177 | 188 | ( fs_starts_with( $subdomain, 'test-' ) || fs_starts_with( $subdomain, 'dev-' ) ) ) || |
| 178 | 189 | // Cloudways |
| @@ -177,16 +188,63 @@ | ||
| 177 | 188 | ( fs_starts_with( $subdomain, 'test-' ) || fs_starts_with( $subdomain, 'dev-' ) ) ) || |
| 178 | 189 | // Cloudways |
| 179 | 190 | fs_ends_with( $subdomain, '.cloudwaysapps.com' ) || |
| 180 | 191 | // Kinsta |
| 181 | - ( fs_starts_with( $subdomain, 'staging-' ) && ( fs_ends_with( $subdomain, '.kinsta.com' ) || fs_ends_with( $subdomain, '.kinsta.cloud' ) ) ) || | |
| 192 | + ( | |
| 193 | + ( fs_starts_with( $subdomain, 'stg-' ) || fs_starts_with( $subdomain, 'staging-' ) || fs_starts_with( $subdomain, 'env-' ) ) && | |
| 194 | + ( fs_ends_with( $subdomain, '.kinsta.com' ) || fs_ends_with( $subdomain, '.kinsta.cloud' ) ) | |
| 195 | + ) || | |
| 182 | 196 | // DesktopServer |
| 183 | 197 | fs_ends_with( $subdomain, '.dev.cc' ) || |
| 184 | 198 | // Pressable |
| 185 | - fs_ends_with( $subdomain, '.mystagingwebsite.com' ) | |
| 199 | + fs_ends_with( $subdomain, '.mystagingwebsite.com' ) || | |
| 200 | + // WPMU DEV | |
| 201 | + ( fs_ends_with( $subdomain, '.tempurl.host' ) || fs_ends_with( $subdomain, '.wpmudev.host' ) ) || | |
| 202 | + // Vendasta | |
| 203 | + ( fs_ends_with( $subdomain, '.websitepro-staging.com' ) || fs_ends_with( $subdomain, '.websitepro.hosting' ) ) || | |
| 204 | + // InstaWP | |
| 205 | + ( fs_ends_with( $subdomain, '.instawp.co' ) || fs_ends_with( $subdomain, '.instawp.link' ) || fs_ends_with( $subdomain, '.instawp.xyz' ) ) || | |
| 206 | + // 10Web Hosting | |
| 207 | + ( fs_ends_with( $subdomain, '-dev.10web.site' ) || fs_ends_with( $subdomain, '-dev.10web.cloud' ) ) | |
| 186 | 208 | ); |
| 187 | 209 | } |
| 188 | 210 | |
| 211 | + /** | |
| 212 | + * @author Leo Fajardo (@leorw) | |
| 213 | + * @since 2.9.1 | |
| 214 | + * | |
| 215 | + * @param string $host | |
| 216 | + * | |
| 217 | + * @return bool | |
| 218 | + */ | |
| 219 | + static function is_playground_wp_environment_by_host( $host ) { | |
| 220 | + // Services aimed at providing a WordPress sandbox environment. | |
| 221 | + $sandbox_wp_environment_domains = array( | |
| 222 | + // InstaWP | |
| 223 | + 'instawp.co', | |
| 224 | + 'instawp.link', | |
| 225 | + 'instawp.xyz', | |
| 226 | + | |
| 227 | + // TasteWP | |
| 228 | + 'tastewp.com', | |
| 229 | + | |
| 230 | + // WordPress Playground | |
| 231 | + 'playground.wordpress.net', | |
| 232 | + ); | |
| 233 | + | |
| 234 | + foreach ( $sandbox_wp_environment_domains as $domain) { | |
| 235 | + if ( | |
| 236 | + ( $host === $domain ) || | |
| 237 | + fs_ends_with( $host, '.' . $domain ) || | |
| 238 | + fs_ends_with( $host, '-' . $domain ) | |
| 239 | + ) { | |
| 240 | + return true; | |
| 241 | + } | |
| 242 | + } | |
| 243 | + | |
| 244 | + return false; | |
| 245 | + } | |
| 246 | + | |
| 189 | 247 | function is_localhost() { |
| 190 | 248 | return ( WP_FS__IS_LOCALHOST_FOR_SERVER || self::is_localhost_by_address( $this->url ) ); |
| 191 | 249 | } |
| 192 | 250 | |
| @@ -214,23 +272,26 @@ | ||
| 214 | 272 | return is_numeric( $this->trial_plan_id ); |
| 215 | 273 | } |
| 216 | 274 | |
| 217 | 275 | /** |
| 218 | - * @author Vova Feldman (@svovaf) | |
| 219 | - * @since 2.0.0 | |
| 276 | + * @author Edgar Melkonyan | |
| 220 | 277 | * |
| 221 | 278 | * @return bool |
| 222 | 279 | */ |
| 223 | - function is_tracking_allowed() { | |
| 224 | - return ( true !== $this->is_disconnected ); | |
| 280 | + function is_beta() { | |
| 281 | + return ( isset( $this->is_beta ) && true === $this->is_beta ); | |
| 225 | 282 | } |
| 226 | 283 | |
| 227 | 284 | /** |
| 228 | - * @author Vova Feldman (@svovaf) | |
| 229 | - * @since 2.0.0 | |
| 285 | + * @author Leo Fajardo (@leorw) | |
| 286 | + * @since 2.5.1 | |
| 230 | 287 | * |
| 288 | + * @param string $site_url | |
| 289 | + * | |
| 231 | 290 | * @return bool |
| 232 | 291 | */ |
| 233 | - function is_tracking_prohibited() { | |
| 234 | - return ! $this->is_tracking_allowed(); | |
| 292 | + function is_clone( $site_url ) { | |
| 293 | + $clone_install_url = trailingslashit( fs_strip_url_protocol( $this->url ) ); | |
| 294 | + | |
| 295 | + return ( $clone_install_url !== $site_url ); | |
| 235 | 296 | } |
| 236 | 297 | } |