-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Jetpack integration loader, add the way to load config in local d…
…ev env
- Loading branch information
1 parent
b444319
commit 7ed5e81
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* Integration: Jetpack. | ||
*/ | ||
namespace Automattic\VIP\Integrations; | ||
|
||
class JetpackIntegration extends Integration { | ||
protected string $version = ''; | ||
|
||
public function is_loaded(): bool { | ||
return class_exists( 'Jetpack' ); | ||
} | ||
|
||
public function configure(): void { | ||
if ( isset( $this->get_env_config()['version'] ) ) { | ||
$this->version = $this->get_env_config()['version']; | ||
} elseif ( defined( 'VIP_JETPACK_PINNED_VERSION' ) ) { | ||
$this->version = constant( 'VIP_JETPACK_PINNED_VERSION' ); | ||
} else { | ||
$this->version = vip_default_jetpack_version(); | ||
} | ||
} | ||
|
||
public function load(): void { | ||
if ( $this->is_loaded() ) { | ||
return; | ||
} | ||
|
||
// Pass through to the old code for now which will respect all existing constants | ||
if ( ! defined( 'WP_INSTALLING' ) ) { | ||
vip_jetpack_load(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters