atarim-visual-collaboration
/
third-party
/
content-model
/
jetengine
/
class-avcf-jetengine-detector.php
class-avcf-abilities-jetengine.php
4 weeks ago
class-avcf-jetengine-detector.php
4 weeks ago
class-avcf-jetengine-helpers.php
4 weeks ago
class-avcf-jetengine-detector.php
47 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Detects JetEngine and its relevant data stores. |
| 4 | * |
| 5 | * @package atarim-visual-collaboration |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined('ABSPATH') ) { |
| 9 | exit; |
| 10 | } |
| 11 | |
| 12 | class AVCF_JetEngine_Detector { |
| 13 | |
| 14 | public function __construct() {} |
| 15 | |
| 16 | public function avcf_je_is_available() { |
| 17 | return class_exists( 'Jet_Engine' ) && function_exists( 'jet_engine' ); |
| 18 | } |
| 19 | |
| 20 | public function avcf_je_version() { |
| 21 | if ( function_exists( 'jet_engine' ) && is_object( jet_engine() ) && method_exists( jet_engine(), 'get_version' ) ) { |
| 22 | return (string) jet_engine()->get_version(); |
| 23 | } |
| 24 | return ''; |
| 25 | } |
| 26 | |
| 27 | /** CCT (Custom Content Types) module. */ |
| 28 | public function avcf_je_has_cct() { |
| 29 | if ( ! $this->avcf_je_is_available() ) { |
| 30 | return false; |
| 31 | } |
| 32 | $je = jet_engine(); |
| 33 | if ( ! isset( $je->modules ) || ! is_object( $je->modules ) || ! method_exists( $je->modules, 'get_module' ) ) { |
| 34 | return false; |
| 35 | } |
| 36 | return (bool) $je->modules->get_module( 'custom-content-types' ); |
| 37 | } |
| 38 | |
| 39 | public function avcf_je_has_meta_boxes() { |
| 40 | return $this->avcf_je_is_available() && isset( jet_engine()->meta_boxes ) && is_object( jet_engine()->meta_boxes ); |
| 41 | } |
| 42 | |
| 43 | public function avcf_je_has_options_pages() { |
| 44 | return $this->avcf_je_is_available() && isset( jet_engine()->options_pages ) && is_object( jet_engine()->options_pages ); |
| 45 | } |
| 46 | } |
| 47 |