Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| Module_Control | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| init | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| add_videopress_to_array | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Jetpack VideoPress: Module_Control class |
| 4 | * |
| 5 | * @package automattic/jetpack-videopress |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\Jetpack\VideoPress; |
| 9 | |
| 10 | /** |
| 11 | * To handle VideoPress module statuses |
| 12 | */ |
| 13 | class Module_Control { |
| 14 | |
| 15 | /** |
| 16 | * Initializer |
| 17 | * |
| 18 | * This method should onlybe called once by the Initializer class. Do not call this method again. |
| 19 | */ |
| 20 | public static function init() { |
| 21 | add_filter( 'jetpack_get_available_standalone_modules', array( __CLASS__, 'add_videopress_to_array' ), 10, 1 ); |
| 22 | if ( Status::is_standalone_plugin_active() ) { |
| 23 | // If the stand-alone plugin is active, videopress module will always be considered active |
| 24 | add_filter( 'jetpack_active_modules', array( __CLASS__, 'add_videopress_to_array' ), 10, 2 ); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Adds videopress to the list of available/active modules |
| 30 | * |
| 31 | * @param array $modules Array with modules slugs. |
| 32 | * @return array |
| 33 | */ |
| 34 | public static function add_videopress_to_array( $modules ) { |
| 35 | return array_merge( array( 'videopress' ), $modules ); |
| 36 | } |
| 37 | } |