first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
{
"name": "wpdesk\/wp-plugin-flow",
"authors": [
{
"name": "Krzysiek",
"email": "krzysiek@wpdesk.pl"
}
],
"require": {
"php": ">=5.6",
"wpdesk\/wp-basic-requirements": "^3",
"wpdesk\/wp-builder": "^1.4",
"wpdesk\/wp-wpdesk-license": "^2.4",
"wpdesk\/wp-wpdesk-helper": "^2.0.3",
"wpdesk\/wp-wpdesk-tracker": "^2.0.4"
},
"require-dev": {
"phpunit\/phpunit": "<7",
"wp-coding-standards\/wpcs": "^0.14.1",
"squizlabs\/php_codesniffer": "^3.4.2",
"10up\/wp_mock": "^0.2",
"wpdesk\/wp-wpdesk-composer": "^2.3"
},
"autoload": {
"classmap": [
"src"
]
},
"autoload-dev": {
"classmap": [
"vendor\/wpdesk\/wp-basic-requirements",
"tests\/Stub"
]
},
"scripts": {
"phpunit-unit": "phpunit --configuration phpunit-unit.xml --coverage-text --colors=never",
"phpunit-unit-fast": "phpunit --configuration phpunit-unit.xml --no-coverage",
"phpunit-integration": "phpunit --configuration phpunit-integration.xml --coverage-text --colors=never",
"phpunit-integration-fast": "phpunit --configuration phpunit-integration.xml --no-coverage"
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization;
use ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\Activateable;
use ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\Deactivateable;
use ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\SlimPlugin;
use ActivePaymentsVendor\WPDesk\PluginBuilder\Storage\StorageFactory;
/**
* Helps with plugin building concepts.
*
* @package WPDesk\Plugin\Flow\Initialization
*/
trait BuilderTrait
{
/**
* Build plugin from info.
*
* @param \WPDesk_Plugin_Info $plugin_info
*
* @return SlimPlugin
*/
private function build_plugin(\ActivePaymentsVendor\WPDesk_Plugin_Info $plugin_info)
{
$class_name = \apply_filters('wp_builder_plugin_class', $plugin_info->get_class_name());
/** @var SlimPlugin $plugin */
$plugin = new $class_name($plugin_info);
return $plugin;
}
/**
* Initialize WP register hooks that have to be fire before any other.
*
* @param \WPDesk_Plugin_Info $plugin_info
* @param SlimPlugin $plugin
*
* @return SlimPlugin
*/
private function init_register_hooks(\ActivePaymentsVendor\WPDesk_Plugin_Info $plugin_info, \ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\SlimPlugin $plugin)
{
if ($plugin instanceof \ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\Activateable) {
\register_activation_hook($plugin_info->get_plugin_file_name(), [$plugin, 'activate']);
}
if ($plugin instanceof \ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\Deactivateable) {
\register_deactivation_hook($plugin_info->get_plugin_file_name(), [$plugin, 'deactivate']);
}
return $plugin;
}
/**
* Store plugin for others to use.
*
* @param SlimPlugin $plugin
*/
private function store_plugin(\ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\SlimPlugin $plugin)
{
$storageFactory = new \ActivePaymentsVendor\WPDesk\PluginBuilder\Storage\StorageFactory();
$storageFactory->create_storage()->add_to_storage(\get_class($plugin), $plugin);
}
/**
* Init integration layer of the plugin.
*
* @param SlimPlugin $plugin
*/
private function init_plugin(\ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\SlimPlugin $plugin)
{
\do_action('wp_builder_before_plugin_init', $plugin);
$plugin->init();
\do_action('wp_builder_before_init', $plugin);
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\Simple;
use ActivePaymentsVendor\WPDesk\Helper\PrefixedHelperAsLibrary;
/**
* Trait helps with helper initialization
*
* @package WPDesk\Plugin\Flow\Initialization\Simple
*/
trait HelperInstanceAsFilterTrait
{
/** @var \WPDesk\Helper\PrefixedHelperAsLibrary */
private static $helper_instance;
/**
* Returns filter action name for helper instance
*
* @return string
*/
private function get_helper_action_name()
{
return 'wpdesk_helper_instance';
}
/**
* Instantiate helper and return it
*
* @return PrefixedHelperAsLibrary
*/
private function get_helper_instance()
{
return \apply_filters($this->get_helper_action_name(), null);
}
/**
* Prepare helper to be instantiated using wpdesk_helper_instance filter
*
* @return void|PrefixedHelperAsLibrary
*/
private function prepare_helper_action()
{
\class_exists(\WPDesk\Helper\HelperAsLibrary::class);
// autoload this class
\add_filter($this->get_helper_action_name(), function ($helper_instance) {
if (\is_object($helper_instance)) {
return $helper_instance;
}
if (\is_object(self::$helper_instance)) {
return self::$helper_instance;
}
if (\apply_filters('wpdesk_can_start_helper', \true, $this->plugin_info)) {
self::$helper_instance = new \ActivePaymentsVendor\WPDesk\Helper\PrefixedHelperAsLibrary();
self::$helper_instance->hooks();
\do_action('wpdesk_helper_started', self::$helper_instance, $this->plugin_info);
return self::$helper_instance;
}
});
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization;
/**
* Interface for factory of plugin initialization strategy
*/
interface InitializationFactory
{
/**
* @param \WPDesk_Plugin_Info $info
*
* @return InitializationStrategy
*/
public function create_initialization_strategy(\ActivePaymentsVendor\WPDesk_Plugin_Info $info);
}

View File

@@ -0,0 +1,27 @@
<?php
namespace ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization;
use ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\SlimPlugin;
/**
* Interface for initialization strategy for plugin. How to initialize it?
*/
interface InitializationStrategy
{
/**
* Run tasks that prepares plugin to work. Have to run before plugin loaded.
*
* @param \WPDesk_Plugin_Info $plugin_info
*
* @return SlimPlugin
*/
public function run_before_init(\ActivePaymentsVendor\WPDesk_Plugin_Info $plugin_info);
/**
* Run task that integrates plugin with other dependencies. Can be run in plugins_loaded.
*
* @param \WPDesk_Plugin_Info $plugin_info
*
* @return SlimPlugin
*/
public function run_init(\ActivePaymentsVendor\WPDesk_Plugin_Info $plugin_info);
}

View File

@@ -0,0 +1,48 @@
<?php
namespace ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization;
/**
* Can disable shared plugin before it's loaded using plugin filename
*/
class PluginDisablerByFileTrait
{
/** @var string */
private $plugin_file;
/**
* @param string $plugin_file
*/
public function __construct($plugin_file)
{
$this->plugin_file = $plugin_file;
}
/**
* @return void
*/
public function disable()
{
/**
* @param WPDesk_Loader[] $loaders
*
* @return array
*/
$false_for_helper = function ($loaders) {
return \array_filter($loaders, function ($loader) {
try {
// BIG HACK TO GET PRIVATE PROPERTY
$reflection = new \ReflectionClass($loader);
$property = $reflection->getProperty('loader_info');
$property->setAccessible(\true);
/** @var WPDesk_Composer_Loader_Info $inner_info */
$inner_info = $property->getValue($loader);
$plugin_info = $inner_info->get_plugin_info();
return \basename($plugin_info->get_plugin_file_name()) !== \basename($this->plugin_file);
} catch (\Exception $e) {
return \true;
}
});
};
\add_filter('wp_autoloader_loader_loaders_to_load', $false_for_helper);
\add_filter('wp_autoloader_loader_loaders_to_create', $false_for_helper);
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\Simple;
use ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\InitializationFactory;
use ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\InitializationStrategy;
/**
* Can decide if strategy is for free plugin or paid plugin
*/
class SimpleFactory implements \ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\InitializationFactory
{
/** @var bool */
private $free;
/**
* @param bool $free True for free/repository plugin
*/
public function __construct($free = \false)
{
$this->free = $free;
}
/**
* Create strategy according to the given flag
*
* @param \WPDesk_Plugin_Info $info
*
* @return InitializationStrategy
*/
public function create_initialization_strategy(\ActivePaymentsVendor\WPDesk_Plugin_Info $info)
{
if ($this->free) {
return new \ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\Simple\SimpleFreeStrategy($info);
}
return new \ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\Simple\SimplePaidStrategy($info);
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\Simple;
use ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\BuilderTrait;
use ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\InitializationStrategy;
use ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\SlimPlugin;
/**
* Initialize free plugin
* - just build it already
*/
class SimpleFreeStrategy implements \ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\InitializationStrategy
{
use HelperInstanceAsFilterTrait;
use TrackerInstanceAsFilterTrait;
use BuilderTrait;
/** @var \WPDesk_Plugin_Info */
private $plugin_info;
/** @var SlimPlugin */
private $plugin;
public function __construct(\ActivePaymentsVendor\WPDesk_Plugin_Info $plugin_info)
{
$this->plugin_info = $plugin_info;
}
/**
* Run tasks that prepares plugin to work. Have to run before plugin loaded.
*
* @param \WPDesk_Plugin_Info $plugin_info
*
* @return SlimPlugin
*/
public function run_before_init(\ActivePaymentsVendor\WPDesk_Plugin_Info $plugin_info)
{
$this->plugin = $this->build_plugin($plugin_info);
$this->init_register_hooks($plugin_info, $this->plugin);
}
/**
* Run task that integrates plugin with other dependencies. Can be run in plugins_loaded.
*
* @param \WPDesk_Plugin_Info $plugin_info
*
* @return SlimPlugin
*/
public function run_init(\ActivePaymentsVendor\WPDesk_Plugin_Info $plugin_info)
{
if (!$this->plugin) {
$this->plugin = $this->build_plugin($plugin_info);
}
$this->prepare_helper_action();
$this->prepare_tracker_action();
$this->store_plugin($this->plugin);
$this->init_plugin($this->plugin);
return $this->plugin;
}
}

View File

@@ -0,0 +1,132 @@
<?php
namespace ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\Simple;
use ActivePaymentsVendor\WPDesk\Helper\HelperRemover;
use ActivePaymentsVendor\WPDesk\Helper\PrefixedHelperAsLibrary;
use ActivePaymentsVendor\WPDesk\License\PluginRegistrator;
use ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\BuilderTrait;
use ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\PluginDisablerByFileTrait;
use ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\InitializationStrategy;
use ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\ActivationAware;
use ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\SlimPlugin;
/**
* Initialize standard paid plugin
* - register to helper
* - initialize helper
* - build with info about plugin active flag
*/
class SimplePaidStrategy implements \ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\InitializationStrategy
{
use HelperInstanceAsFilterTrait;
use TrackerInstanceAsFilterTrait;
use BuilderTrait;
/** @var \WPDesk_Plugin_Info */
private $plugin_info;
/** @var SlimPlugin */
private $plugin;
public function __construct(\ActivePaymentsVendor\WPDesk_Plugin_Info $plugin_info)
{
$this->plugin_info = $plugin_info;
}
/**
* Run tasks that prepares plugin to work. Have to run before plugin loaded.
*
* @param \WPDesk_Plugin_Info $plugin_info
*
* @return SlimPlugin
*/
public function run_before_init(\ActivePaymentsVendor\WPDesk_Plugin_Info $plugin_info)
{
$this->plugin = $this->build_plugin($plugin_info);
$this->init_register_hooks($plugin_info, $this->plugin);
}
/**
* Run task that integrates plugin with other dependencies. Can be run in plugins_loaded.
*
* @param \WPDesk_Plugin_Info $plugin_info
*
* @return SlimPlugin
*/
public function run_init(\ActivePaymentsVendor\WPDesk_Plugin_Info $plugin_info)
{
if (!$this->plugin) {
$this->plugin = $this->build_plugin($plugin_info);
}
$this->prepare_tracker_action();
$registrator = $this->register_plugin();
$this->init_helper();
$is_plugin_subscription_active = $registrator instanceof \ActivePaymentsVendor\WPDesk\License\PluginRegistrator && $registrator->is_active();
if ($this->plugin instanceof \ActivePaymentsVendor\WPDesk\PluginBuilder\Plugin\ActivationAware && $is_plugin_subscription_active) {
$this->plugin->set_active();
}
$this->store_plugin($this->plugin);
$this->init_plugin($this->plugin);
return $this->plugin;
}
/**
* Register plugin for subscriptions and updates
*
* @return PluginRegistrator
*
* @see init_helper note
*
*/
private function register_plugin()
{
if (\apply_filters('wpdesk_can_register_plugin', \true, $this->plugin_info)) {
$registrator = new \ActivePaymentsVendor\WPDesk\License\PluginRegistrator($this->plugin_info);
$registrator->add_plugin_to_installed_plugins();
return $registrator;
}
}
/**
* Helper is a component that gives:
* - activation interface
* - automatic updates
* - logs
* - some other feats
*
* NOTE:
*
* It's possible for this method to not found classes embedded here.
* OTHER plugin in unlikely scenario that THIS plugin is disabled
* can use this class and do not have this library dependencies as
* these are loaded using composer.
*
* @return PrefixedHelperAsLibrary|null
*/
private function init_helper()
{
$this->prevent_older_helpers();
$this->prepare_helper_action();
return $this->get_helper_instance();
}
/**
* Try to disable all other types of helpers
*/
private function prevent_older_helpers()
{
if (\apply_filters('wpdesk_can_hack_shared_helper', \true, $this->plugin_info)) {
// hack to ensure that the class is loaded so other helpers are disabled
\class_exists(\WPDesk\Helper\HelperAsLibrary::class, \true);
}
if (\apply_filters('wpdesk_can_supress_original_helper', \true, $this->plugin_info)) {
$this->try_suppress_original_helper_load();
// start supression only once. Prevent doing it again
\add_filter('wpdesk_can_supress_original_helper', function () {
return \false;
});
}
if (\apply_filters('wpdesk_can_remove_old_helper_hooks', \true, $this->plugin_info)) {
(new \ActivePaymentsVendor\WPDesk\Helper\HelperRemover())->hooks();
}
}
/**
* Tries to prevent original Helper from loading
*/
private function try_suppress_original_helper_load()
{
(new \ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\PluginDisablerByFileTrait('wpdesk-helper/wpdesk-helper.php'))->disable();
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\Simple;
/**
* Trait helps with tracker initialization
*
* @package WPDesk\Plugin\Flow\Initialization\Simple\
*/
trait TrackerInstanceAsFilterTrait
{
/** @var \WPDesk_Tracker_Interface */
private static $tracker_instance;
/**
* Returns filter action name for tracker instance
*
* @return string
*/
private function get_tracker_action_name()
{
return 'wpdesk_tracker_instance';
}
/**
* @return \WPDesk_Tracker_Interface
*/
private function get_tracker_instance()
{
return \apply_filters($this->get_tracker_action_name(), null);
}
/**
* Prepare tracker to be instantiated using wpdesk_tracker_instance filter
*
* @return void|\WPDesk_Tracker
*/
private function prepare_tracker_action()
{
\class_exists(\WPDesk_Tracker_Factory::class);
//autoload this class
\add_filter($this->get_tracker_action_name(), function ($tracker_instance) {
if (\is_object($tracker_instance)) {
return $tracker_instance;
}
if (\is_object(self::$tracker_instance)) {
return self::$tracker_instance;
}
if (\apply_filters('wpdesk_can_start_tracker', \true, $this->plugin_info)) {
$tracker_factory = new \ActivePaymentsVendor\WPDesk_Tracker_Factory_Prefixed();
self::$tracker_instance = $tracker_factory->create_tracker(\basename($this->plugin_info->get_plugin_file_name()));
\do_action('wpdesk_tracker_started', self::$tracker_instance, $this->plugin_info);
return self::$tracker_instance;
}
});
}
}

View File

@@ -0,0 +1,136 @@
<?php
namespace ActivePaymentsVendor\WPDesk\Plugin\Flow;
use ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\InitializationFactory;
/**
* Bootstrap plugin loading
* - check requirements
* - prepare plugin info
* - delegate plugin building to the initializator
*/
final class PluginBootstrap
{
const LIBRARY_TEXT_DOMAIN = 'wp-plugin-flow';
const PRIORITY_BEFORE_SHARED_CLASS_LOADER = -40;
/** @var string */
private $plugin_version;
/** @var string */
private $plugin_release_timestamp;
/** @var string */
private $plugin_name;
/** @var string */
private $plugin_class_name;
/** @var string */
private $plugin_text_domain;
/** @var string */
private $plugin_dir;
/** @var string */
private $plugin_file;
/** @var array */
private $requirements;
/** @var string */
private $product_id;
/**
* Factory to build strategy how initialize that plugin
*
* @var InitializationFactory
*/
private $initialization_factory;
/**
* WPDesk_Plugin_Bootstrap constructor.
*
* @param string $plugin_version
* @param string $plugin_release_timestamp
* @param string $plugin_name
* @param string $plugin_class_name
* @param string $plugin_text_domain
* @param string $plugin_dir
* @param string $plugin_file
* @param array $requirements
* @param string $product_id
* @param InitializationFactory $build_factory
*/
public function __construct($plugin_version, $plugin_release_timestamp, $plugin_name, $plugin_class_name, $plugin_text_domain, $plugin_dir, $plugin_file, array $requirements, $product_id, \ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\InitializationFactory $build_factory)
{
$this->plugin_version = $plugin_version;
$this->plugin_release_timestamp = $plugin_release_timestamp;
$this->plugin_name = $plugin_name;
$this->plugin_class_name = $plugin_class_name;
$this->plugin_text_domain = $plugin_text_domain;
$this->plugin_dir = $plugin_dir;
$this->plugin_file = $plugin_file;
$this->requirements = $requirements;
$this->product_id = $product_id;
$this->initialization_factory = $build_factory;
}
/**
* Run the plugin bootstrap
*/
public function run()
{
$this->init_translations();
$plugin_info = $this->get_plugin_info();
$strategy = $this->initialization_factory->create_initialization_strategy($plugin_info);
$requirements_checker = $this->create_requirements_checker();
if ($requirements_checker->are_requirements_met()) {
$strategy->run_before_init($plugin_info);
}
\add_action('plugins_loaded', static function () use($strategy, $requirements_checker, $plugin_info) {
if ($requirements_checker->are_requirements_met()) {
$strategy->run_init($plugin_info);
} else {
$requirements_checker->render_notices();
}
}, self::PRIORITY_BEFORE_SHARED_CLASS_LOADER);
}
/**
* Adds text domain used in a library
*/
private function init_translations()
{
if (\function_exists('determine_locale')) {
$locale = \determine_locale();
} else {
// before WP 5.0 compatibility
$locale = \get_locale();
}
$locale = \apply_filters('plugin_locale', $locale, self::LIBRARY_TEXT_DOMAIN);
$lang_mo_file = __DIR__ . '/../../lang/' . self::LIBRARY_TEXT_DOMAIN . '-' . $locale . '.mo';
if (\file_exists($lang_mo_file)) {
\load_textdomain(self::LIBRARY_TEXT_DOMAIN, $lang_mo_file);
}
}
/**
* Factory method creates requirement checker to run the checks
*
* @return \WPDesk_Requirement_Checker
*/
private function create_requirements_checker()
{
/** @var \WPDesk_Requirement_Checker_Factory $requirements_checker_factory */
$requirements_checker_factory = new \ActivePaymentsVendor\WPDesk_Basic_Requirement_Checker_Factory();
return $requirements_checker_factory->create_from_requirement_array(__FILE__, $this->plugin_name, $this->requirements);
}
/**
* Factory method creates \WPDesk_Plugin_Info to bootstrap info about plugin in one place
*
* TODO: move to WPDesk_Plugin_Info factory
*
* @return \WPDesk_Plugin_Info
*/
private function get_plugin_info()
{
$plugin_info = new \ActivePaymentsVendor\WPDesk_Plugin_Info();
$plugin_info->set_plugin_file_name(\plugin_basename($this->plugin_file));
$plugin_info->set_plugin_name($this->plugin_name);
$plugin_info->set_plugin_dir($this->plugin_dir);
$plugin_info->set_class_name($this->plugin_class_name);
$plugin_info->set_version($this->plugin_version);
$plugin_info->set_product_id($this->product_id);
$plugin_info->set_text_domain($this->plugin_text_domain);
$plugin_info->set_release_date(new \DateTime($this->plugin_release_timestamp));
$plugin_info->set_plugin_url(\plugins_url(\dirname(\plugin_basename($this->plugin_file))));
return $plugin_info;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace ActivePaymentsVendor;
/**
* @var string $plugin_version
* @var string $plugin_release_timestamp
* @var string $plugin_name
* @var string $plugin_class_name
* @var string $plugin_text_domain
* @var string $plugin_dir
* @var string $plugin_file
* @var array $requirements
* @var string $product_id
*/
if (!\defined('ABSPATH')) {
die;
}
// Code in PHP >= 5.3 but understandable by older parsers
if (\PHP_VERSION_ID > 50300) {
require_once $plugin_dir . '/vendor/autoload.php';
$plugin_init_factory = new \ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\Simple\SimpleFactory(\true);
}
require \dirname(__FILE__) . '/plugin-init-php52.php';

View File

@@ -0,0 +1,34 @@
<?php
namespace ActivePaymentsVendor;
/**
* @var string $plugin_version
* @var string $plugin_release_timestamp
* @var string $plugin_name
* @var string $plugin_class_name
* @var string $plugin_text_domain
* @var string $plugin_dir
* @var string $plugin_file
* @var array $requirements
* @var string $product_id
* @var WPDesk\Plugin\Flow\Initialization\InitializationFactory|void $plugin_init_factory
*/
if (!\defined('ABSPATH')) {
die;
}
// Code in PHP >= 5.3 but understandable by older parsers
if (\PHP_VERSION_ID > 50300) {
require_once $plugin_dir . '/vendor/autoload.php';
if (!isset($plugin_init_factory)) {
$plugin_init_factory = new \ActivePaymentsVendor\WPDesk\Plugin\Flow\Initialization\Simple\SimpleFactory();
}
$bootstrap = new \ActivePaymentsVendor\WPDesk\Plugin\Flow\PluginBootstrap($plugin_version, $plugin_release_timestamp, $plugin_name, $plugin_class_name, $plugin_text_domain, $plugin_dir, $plugin_file, $requirements, $product_id, $plugin_init_factory);
$bootstrap->run();
// all optional vars must be cleared
unset($plugin_init_factory);
} else {
/** @noinspection PhpDeprecationInspection */
$php52_function = \create_function('', 'echo sprintf( __("<p><strong style=\'color: red;\'>PHP version is older than 5.3 so no WP Desk plugins will work. Please contact your host and ask them to upgrade. </strong></p>", \'wp-plugin-flow\') );');
\add_action('admin_notices', $php52_function);
}