| 1 |
<?php |
| 2 |
/** |
| 3 |
* The class that provides information about VideoPress Status |
| 4 |
* |
| 5 |
* @package automattic/jetpack-videopress |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Automattic\Jetpack\VideoPress; |
| 9 |
|
| 10 |
use Automattic\Jetpack\Modules; |
| 11 |
|
| 12 |
/** |
| 13 |
* The class that provides information about VideoPress Status |
| 14 |
*/ |
| 15 |
class Status { |
| 16 |
|
| 17 |
/** |
| 18 |
* Returns whether VideoPress is active |
| 19 |
* either as a Jetpack module or as a stand alone plugin |
| 20 |
* |
| 21 |
* @return boolean |
| 22 |
*/ |
| 23 |
public static function is_active() { |
| 24 |
return self::is_jetpack_plugin_and_videopress_module_active() || self::is_standalone_plugin_active(); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Checks whether the Jetpack plugin is active |
| 29 |
*/ |
| 30 |
public static function is_jetpack_plugin_active() { |
| 31 |
return class_exists( 'Jetpack' ); |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Checks whether the Jetpack plugin |
| 36 |
* and its VideoPress module are active. |
| 37 |
* |
| 38 |
* @return boolean |
| 39 |
*/ |
| 40 |
public static function is_jetpack_plugin_and_videopress_module_active() { |
| 41 |
return class_exists( 'Jetpack' ) && ( new Modules() )->is_active( 'videopress' ); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Checks whether the Jetpack plugin is active |
| 46 |
* but the VideoPress module is not active. |
| 47 |
* |
| 48 |
* @since 0.28.2 |
| 49 |
* |
| 50 |
* @return boolean |
| 51 |
*/ |
| 52 |
public static function is_jetpack_plugin_without_videopress_module_active() { |
| 53 |
return class_exists( 'Jetpack' ) && ! ( new Modules() )->is_active( 'videopress' ); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Checks whether the VideoPress stand alone plugin is active |
| 58 |
* |
| 59 |
* @return boolean |
| 60 |
*/ |
| 61 |
public static function is_standalone_plugin_active() { |
| 62 |
return class_exists( 'Jetpack_VideoPress_Plugin' ); |
| 63 |
} |
| 64 |
|
| 65 |
/** |
| 66 |
* Checks whether the registrant plugin is active |
| 67 |
* either as a Jetpack module (via Jetpack plugin) |
| 68 |
* or as a stand-alone plugin. |
| 69 |
* |
| 70 |
* @return boolean True if the register plugin is active. |
| 71 |
*/ |
| 72 |
public static function is_registrant_plugin_active() { |
| 73 |
return self::is_jetpack_plugin_active() || self::is_standalone_plugin_active(); |
| 74 |
} |
| 75 |
} |
| 76 |
|