_legacy = $registry->get( 'theme.loader' )->is_legacy_theme(); } /** * Factory method for events * * @param string $data * @param string $instance * * @return Ai1ec_Event */ public function create_event_instance( Ai1ec_Registry_Object $registry, $data = null, $instance = false ) { $use_backward_compatibility = $registry->get( 'compatibility.check' )->use_backward_compatibility(); if ( $use_backward_compatibility && true === $this->_legacy ) { return new Ai1ec_Event_Legacy( $registry, $data, $instance ); } $class_name = 'Ai1ec_Event'; if ( $use_backward_compatibility && 'Ai1ec_Event' === $class_name ) { $class_name = 'Ai1ec_Event_Compatibility'; } return new $class_name( $registry, $data, $instance ); } }