This commit is contained in:
2026-07-02 15:54:39 -06:00
commit 9883323161
17470 changed files with 4470592 additions and 0 deletions
@@ -0,0 +1,17 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
/**
* Modules can implement this interface to indicate that they change the HTML output for the site visitor and they may do it after activation.
* E.g. Critical CSS needs to be generated first.
*/
interface Changes_Output_After_Activation {
/**
* Get the action name(s) that should be used to indicate that the module is ready and changing the page output.
*
* @return string[] The names of action hooks which will be triggered to indicate when the module changes the page output.
*/
public static function get_change_output_action_names();
}
@@ -0,0 +1,8 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
/**
* Modules can implement this interface to indicate that they change the HTML output for the site visitor.
*/
interface Changes_Output_On_Activation {}
@@ -0,0 +1,17 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
/**
* Every plugin feature that's large enough
* to need setup also needs a slug
*/
interface Feature extends Has_Setup, Has_Slug {
/**
* Whether the feature is available for use.
* Use this to check for feature flags, etc.
*
* @return bool
*/
public static function is_available();
}
@@ -0,0 +1,6 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
interface Has_Activate {
public static function activate();
}
@@ -0,0 +1,15 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
use Automattic\Jetpack\WP_JS_Data_Sync\Data_Sync;
interface Has_Data_Sync {
/**
* Registers data sync for a modules that is wrapping a Feature within Features_Index.
*
* @param Data_Sync $instance The data sync instance.
*
* @return void
*/
public function register_data_sync( Data_Sync $instance );
}
@@ -0,0 +1,6 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
interface Has_Deactivate {
public static function deactivate();
}
@@ -0,0 +1,19 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
/**
* A class that has a setup step that's supposed to be executed only once.
*/
interface Has_Setup {
/**
* This class has a setup method that should be
* run only once per the request lifecycle.
*
* This is a good place to attach hooks
* or perform other tasks that need
* to be performed once.
*/
public function setup();
}
@@ -0,0 +1,11 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
interface Has_Slug {
/**
* Get the module slug.
*
* Returns a unique identifier for this module within Jetpack Boost.
*/
public static function get_slug();
}
@@ -0,0 +1,8 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
/**
* Modules can implement this interface to indicate that they are always on if available.
*/
interface Is_Always_On {}
@@ -0,0 +1,10 @@
<?php
namespace Automattic\Jetpack\Boost\App\Contracts;
/**
* Indicate that a feature is under development.
*
* If present, the feature will be only visible with JETPACK_BOOST_DEVELOPMENT_FEATURES defined as `true` or in Jurassic Ninja.
*/
interface Is_Dev_Feature {}
@@ -0,0 +1,11 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
interface Needs_To_Be_Ready {
/**
* Check if the module is ready and already optimizing.
* This is useful for modules that need preparation before they can start serving the optimized output. E.g. Critical CSS.
*/
public function is_ready();
}
@@ -0,0 +1,9 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
/**
* Modules with this interface will not work if the website is not publicly available.
*/
interface Needs_Website_To_Be_Public {
}
@@ -0,0 +1,9 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
/**
* Features can implement this interface to indicate that they are an optimization feature.
*/
interface Optimization {
}
@@ -0,0 +1,15 @@
<?php
namespace Automattic\Jetpack_Boost\Contracts;
interface Sub_Feature extends Feature {
/**
* Get the parent features that are required for this feature to work.
*
* At least one parent feature must be enabled for this feature to work.
*
* @return class-string<Feature>[] The parent features.
*/
public static function get_parent_features(): array;
}