Add upstream plugins

Signed-off-by: Adrian Nöthlich <git@promasu.tech>
This commit is contained in:
2019-10-25 22:42:20 +02:00
parent 5d3c2ec184
commit 290736650a
1186 changed files with 302577 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
<?php
/**
* A factory class for events.
*
* @author Time.ly Network, Inc.
* @since 2.0
* @package Ai1EC
* @subpackage Ai1EC.Factory
*/
class Ai1ec_Factory_Event extends Ai1ec_Base {
/**
* @var bool whether the theme is legacy
*/
protected $_legacy;
/**
* Public constructor
*
* @param Ai1ec_Registry_Object $registry
*/
public function __construct( Ai1ec_Registry_Object $registry ) {
parent::__construct( $registry );
$this->_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
);
}
}