lightspeeddevelopment /
lsx-health-plan
| 1 | <?php |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 2 | namespace lsx_health_plan\classes; |
||
| 3 | |||
| 4 | /** |
||
| 5 | * Contains all the classes for 3rd party Integrations |
||
| 6 | * |
||
| 7 | * @package lsx-health-plan |
||
| 8 | */ |
||
| 9 | class Integrations { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Holds class instance |
||
| 13 | * |
||
| 14 | * @since 1.0.0 |
||
| 15 | * |
||
| 16 | * @var object \lsx_health_plan\classes\Integrations() |
||
| 17 | */ |
||
| 18 | protected static $instance = null; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Holds class instance |
||
| 22 | * |
||
| 23 | * @since 1.0.0 |
||
| 24 | * |
||
| 25 | * @var object \MAG_CMB2_Field_Post_Search_Ajax() |
||
| 26 | */ |
||
| 27 | public $cmb2_post_search_ajax = false; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Holds class instance |
||
| 31 | * |
||
| 32 | * @since 1.0.0 |
||
| 33 | * |
||
| 34 | * @var object \lsx_health_plan\classes\Download_Monitor() |
||
| 35 | */ |
||
| 36 | public $download_monitor = false; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Holds class instance |
||
| 40 | * |
||
| 41 | * @since 1.0.0 |
||
| 42 | * |
||
| 43 | * @var object \lsx_health_plan\classes\Woocommerce() |
||
| 44 | */ |
||
| 45 | public $woocommerce = false; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Holds class instance |
||
| 49 | * |
||
| 50 | * @since 1.0.0 |
||
| 51 | * |
||
| 52 | * @var object \lsx_health_plan\classes\WP_User_Avatar() |
||
| 53 | */ |
||
| 54 | public $wp_user_avatar = false; |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Holds class instance |
||
| 58 | * |
||
| 59 | * @since 1.0.0 |
||
| 60 | * |
||
| 61 | * @var object \lsx_health_plan\classes\FacetWP() |
||
| 62 | */ |
||
| 63 | public $facetwp = false; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Constructor |
||
| 67 | */ |
||
| 68 | public function __construct() { |
||
|
0 ignored issues
–
show
|
|||
| 69 | add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) ); |
||
| 70 | add_action( 'init', array( $this, 'download_monitor_init' ) ); |
||
| 71 | add_action( 'init', array( $this, 'woocommerce_init' ) ); |
||
| 72 | add_action( 'init', array( $this, 'wp_user_avatar_init' ) ); |
||
| 73 | add_action( 'init', array( $this, 'facetwp_init' ) ); |
||
| 74 | add_action( 'init', array( $this, 'lsx_team_init' ) ); |
||
| 75 | add_action( 'init', array( $this, 'lsx_article_init' ) ); |
||
| 76 | } |
||
|
0 ignored issues
–
show
|
|||
| 77 | |||
| 78 | /** |
||
| 79 | * Return an instance of this class. |
||
| 80 | * |
||
| 81 | * @since 1.0.0 |
||
| 82 | * |
||
| 83 | * @return object \lsx_health_plan\classes\Integrations() A single instance of this class. |
||
| 84 | */ |
||
| 85 | public static function get_instance() { |
||
| 86 | // If the single instance hasn't been set, set it now. |
||
| 87 | if ( null === self::$instance ) { |
||
|
0 ignored issues
–
show
|
|||
| 88 | self::$instance = new self(); |
||
| 89 | } |
||
|
0 ignored issues
–
show
|
|||
| 90 | return self::$instance; |
||
| 91 | } |
||
|
0 ignored issues
–
show
|
|||
| 92 | |||
| 93 | /** |
||
| 94 | * Includes the Post Search Ajax if it is there. |
||
| 95 | * |
||
| 96 | * @return void |
||
| 97 | */ |
||
| 98 | public function cmb2_post_search_ajax() { |
||
| 99 | require_once LSX_HEALTH_PLAN_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php'; |
||
| 100 | if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 101 | $this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance(); |
||
| 102 | } |
||
| 103 | } |
||
|
0 ignored issues
–
show
|
|||
| 104 | |||
| 105 | /** |
||
| 106 | * Includes the Post Search Ajax if it is there. |
||
| 107 | * |
||
| 108 | * @return void |
||
| 109 | */ |
||
| 110 | public function download_monitor_init() { |
||
| 111 | if ( function_exists( 'download_monitor' ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 112 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-download-monitor.php'; |
||
| 113 | $this->download_monitor = Download_Monitor::get_instance(); |
||
| 114 | } |
||
| 115 | } |
||
|
0 ignored issues
–
show
|
|||
| 116 | |||
| 117 | /** |
||
| 118 | * Includes the Woocommerce functions. |
||
| 119 | * |
||
| 120 | * @return void |
||
| 121 | */ |
||
| 122 | public function woocommerce_init() { |
||
| 123 | if ( function_exists( 'WC' ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 124 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-woocommerce.php'; |
||
| 125 | $this->woocommerce = Woocommerce::get_instance(); |
||
| 126 | } |
||
| 127 | } |
||
|
0 ignored issues
–
show
|
|||
| 128 | |||
| 129 | /** |
||
| 130 | * Includes the Woocommerce functions. |
||
| 131 | * |
||
| 132 | * @return void |
||
| 133 | */ |
||
| 134 | public function wp_user_avatar_init() { |
||
| 135 | if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 136 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-wp-user-avatar.php'; |
||
| 137 | $this->wp_user_avatar = WP_User_Avatar::get_instance(); |
||
| 138 | } |
||
| 139 | } |
||
|
0 ignored issues
–
show
|
|||
| 140 | |||
| 141 | /** |
||
| 142 | * Includes the FacetWP Indexer Filters. |
||
| 143 | * |
||
| 144 | * @return void |
||
| 145 | */ |
||
| 146 | public function facetwp_init() { |
||
| 147 | if ( class_exists( 'FacetWP' ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 148 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-facetwp.php'; |
||
| 149 | $this->facetwp = FacetWP::get_instance(); |
||
| 150 | } |
||
| 151 | } |
||
|
0 ignored issues
–
show
|
|||
| 152 | |||
| 153 | /** |
||
| 154 | * Includes the LSX Team Integration. |
||
| 155 | * |
||
| 156 | * @return void |
||
| 157 | */ |
||
| 158 | public function lsx_team_init() { |
||
| 159 | if ( class_exists( 'LSX_Team' ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 160 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-lsx-team.php'; |
||
| 161 | $this->team = LSX_Team::get_instance(); |
||
|
0 ignored issues
–
show
|
|||
| 162 | } |
||
| 163 | } |
||
|
0 ignored issues
–
show
|
|||
| 164 | |||
| 165 | /** |
||
| 166 | * Includes the Blog Integration. |
||
| 167 | * |
||
| 168 | * @return void |
||
| 169 | */ |
||
| 170 | public function lsx_article_init() { |
||
| 171 | if ( wp_count_posts()->publish > 0 ) { |
||
|
0 ignored issues
–
show
|
|||
| 172 | require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-articles.php'; |
||
| 173 | $this->article = Articles::get_instance(); |
||
|
0 ignored issues
–
show
|
|||
| 174 | } |
||
| 175 | } |
||
|
0 ignored issues
–
show
|
|||
| 176 | } |
||
| 177 |