| @@ -27,8 +27,19 @@ | ||
| 27 | 27 | |
| 28 | 28 | function __construct() {} |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | + * Returns whether the current module is enabled. | |
| 32 | + * | |
| 33 | + * @since 0.9.1 | |
| 34 | + * | |
| 35 | + * @return <code>true</code> if the module is enabled, <code>false</code> otherwise | |
| 36 | + */ | |
| 37 | + public function is_enabled() { | |
| 38 | + return $this->module->options->enabled === 'on'; | |
| 39 | + } | |
| 40 | + | |
| 41 | + /** | |
| 31 | 42 | * Returns whether the module with the given name is enabled. |
| 32 | 43 | * |
| 33 | 44 | * @since 0.7 |
| 34 | 45 | * |
| @@ -37,9 +48,9 @@ | ||
| 37 | 48 | */ |
| 38 | 49 | function module_enabled( $slug ) { |
| 39 | 50 | global $edit_flow; |
| 40 | 51 | |
| 41 | - return isset( $edit_flow->$slug ) && $edit_flow->$slug->module->options->enabled == 'on'; | |
| 52 | + return isset( $edit_flow->$slug ) && $edit_flow->$slug->is_enabled(); | |
| 42 | 53 | } |
| 43 | 54 | |
| 44 | 55 | /** |
| 45 | 56 | * Gets an array of allowed post types for a module |