8889841cwp-content/plugins/the-events-calendar/common/src/Tribe/Editor/Compatibility/Divi.php000064400000004705150513370130032552 0ustar00home/clixcotz/tcchp.clix.co.tzhooks(); } /** * Hooks for loading logic outside this class. * * @since 4.14.13 */ public function hooks() { // Trying to filter out instances where we shouldn't add this to save cycles is futile. add_filter( 'tribe_editor_should_load_blocks', [ $this, 'filter_tribe_editor_should_load_blocks' ], 20 ); } public static function is_divi_active() { /** @var Tribe__Cache $cache */ $cache = tribe( 'cache' ); $divi = $cache->get( 'is_divi' ); if ( false !== $divi ) { // Stored as an int - convert to a boolean. return (bool) $divi; } // OK, do it the hard way. $theme = wp_get_theme(); // Handle theme children and variations. $divi = 'Divi' == $theme->name || 'Divi' == $theme->template || 'Divi' == $theme->parent_theme; // Cache to save us this work next time. $cache->set( 'is_divi', (int) $divi, Tribe__Cache::NON_PERSISTENT, Tribe__Cache_Listener::TRIGGER_UPDATED_OPTION ); // Stored as an int - convert to a boolean. return (bool) $divi; } /** * Filters tribe_editor_should_load_blocks based on internal logic. * * @since 4.14.13 * * @param boolean $should_load_blocks Whether we should force blocks over classic. * * @return boolean Whether we should force blocks or classic. */ public function filter_tribe_editor_should_load_blocks( $should_load_blocks ) { // et_enable_classic_editor $divi_option = get_option( 'et_divi', [] ); if ( empty( $divi_option[ static::$classic_key ] ) ) { return $should_load_blocks; } else if ( static::$classic_on === $divi_option[ static::$classic_key ] ) { return false; } return $should_load_blocks; } }