| 1 |
<?php |
| 2 |
|
| 3 |
namespace ImportWP; |
| 4 |
|
| 5 |
use ImportWP\Common\Attachment\Attachment; |
| 6 |
use ImportWP\Common\Compatibility\CompatibilityManager; |
| 7 |
use ImportWP\Common\Filesystem\Filesystem; |
| 8 |
use ImportWP\Common\Filesystem\ZipArchive; |
| 9 |
use ImportWP\Common\Ftp\Ftp; |
| 10 |
use ImportWP\Common\Http\Http; |
| 11 |
use ImportWP\Common\Importer\Template\TemplateManager; |
| 12 |
use ImportWP\Common\Properties\Properties; |
| 13 |
use ImportWP\Common\Rest\RestManager; |
| 14 |
use ImportWP\Common\UI\AdminNotices; |
| 15 |
use ImportWP\Common\UI\ViewManager; |
| 16 |
use ImportWP\Common\Util\Util; |
| 17 |
|
| 18 |
class ServiceProvider |
| 19 |
{ |
| 20 |
/** |
| 21 |
* @var Properties |
| 22 |
*/ |
| 23 |
public $properties; |
| 24 |
/** |
| 25 |
* @var Filesystem |
| 26 |
*/ |
| 27 |
public $filesystem; |
| 28 |
/** |
| 29 |
* @var Attachment |
| 30 |
*/ |
| 31 |
public $attachment; |
| 32 |
/** |
| 33 |
* @var Ftp |
| 34 |
*/ |
| 35 |
public $ftp; |
| 36 |
/** |
| 37 |
* @var Http |
| 38 |
*/ |
| 39 |
public $http; |
| 40 |
/** |
| 41 |
* @var ViewManager |
| 42 |
*/ |
| 43 |
public $view_manager; |
| 44 |
/** |
| 45 |
* @var RestManager |
| 46 |
*/ |
| 47 |
public $rest_manager; |
| 48 |
|
| 49 |
/** |
| 50 |
* @var TemplateManager |
| 51 |
*/ |
| 52 |
protected $template_manager; |
| 53 |
|
| 54 |
/** |
| 55 |
* @var ZipArchive |
| 56 |
*/ |
| 57 |
protected $zip_archive; |
| 58 |
|
| 59 |
/** |
| 60 |
* @var Util |
| 61 |
*/ |
| 62 |
public $util; |
| 63 |
|
| 64 |
/** |
| 65 |
* @var AdminNotices |
| 66 |
*/ |
| 67 |
public $admin_notices; |
| 68 |
|
| 69 |
/** |
| 70 |
* @var CompatibilityManager |
| 71 |
*/ |
| 72 |
public $compatibility_manager; |
| 73 |
|
| 74 |
public function __construct($event_handler) |
| 75 |
{ |
| 76 |
$this->util = new Util(); |
| 77 |
$this->properties = new Properties(); |
| 78 |
$this->filesystem = new Filesystem($event_handler); |
| 79 |
$this->attachment = new Attachment(); |
| 80 |
$this->ftp = new Ftp($this->filesystem); |
| 81 |
$this->http = new Http($this->properties); |
| 82 |
|
| 83 |
$this->view_manager = new ViewManager($this->properties); |
| 84 |
$this->template_manager = new TemplateManager($event_handler); |
| 85 |
$this->zip_archive = new ZipArchive(); |
| 86 |
$this->admin_notices = new AdminNotices(); |
| 87 |
|
| 88 |
$this->properties->mu_plugin_version = 2; |
| 89 |
$this->properties->mu_plugin_dir = (defined('WPMU_PLUGIN_DIR') && defined('WPMU_PLUGIN_URL')) ? WPMU_PLUGIN_DIR : trailingslashit(WP_CONTENT_DIR) . 'mu-plugins'; |
| 90 |
$this->properties->mu_plugin_source = trailingslashit($this->properties->plugin_dir_path) . 'compatibility/importwp-compatibility.php'; |
| 91 |
$this->properties->mu_plugin_dest = trailingslashit($this->properties->mu_plugin_dir) . 'importwp-compatibility.php'; |
| 92 |
|
| 93 |
$this->compatibility_manager = new CompatibilityManager($this->properties, $this->filesystem); |
| 94 |
} |
| 95 |
} |
| 96 |
|