init_admin(); $this->init_integrations(); } /** * Initialize admin-only functionality. */ protected function init_admin() { if ( is_admin() ) { new DeveloperSD_LS_Admin(); } } /** * Load optional third-party builder integrations only when the builder * plugin they target is actually active. */ protected function init_integrations() { if ( $this->integration_enabled( 'elementor' ) && ( did_action( 'elementor/loaded' ) || class_exists( '\Elementor\Plugin' ) ) ) { require_once DEVELOPERSD_LS_PATH . 'includes/integrations/class-elementor.php'; new DeveloperSD_LS_Elementor_Integration(); } if ( $this->integration_enabled( 'divi' ) && ( function_exists( 'et_setup_theme' ) || class_exists( 'ET_Builder_Module' ) || defined( 'ET_BUILDER_VERSION' ) ) ) { require_once DEVELOPERSD_LS_PATH . 'includes/integrations/class-divi.php'; new DeveloperSD_LS_Divi_Integration(); } } /** * Whether a given builder integration is enabled in global settings. * * @param string $key 'elementor' or 'divi'. * @return bool */ protected function integration_enabled( $key ) { $settings = get_option( 'developersd_logo_slider_settings', array() ); $settings = is_array( $settings ) ? $settings : array(); $field = 'enable_' . $key; return ! isset( $settings[ $field ] ) || DeveloperSD_LS_Security::sanitize_bool( $settings[ $field ] ); } /** * Default global plugin settings (Settings screen). * * @return array */ public static function default_settings() { return array( 'default_slides_desktop' => 5, 'default_slides_tablet' => 3, 'default_slides_mobile' => 2, 'breakpoint_desktop' => 1200, 'breakpoint_tablet' => 768, 'breakpoint_mobile' => 480, 'lazy_load' => true, 'enable_elementor' => true, 'enable_divi' => true, 'debug_mode' => false, 'delete_data_on_uninstall' => false, ); } /** * Prevent cloning of the singleton. */ private function __clone() {} /** * Prevent unserializing of the singleton. */ public function __wakeup() { throw new \Exception( 'Cannot unserialize a singleton.' ); } }