Blocks
4 years ago
Contracts
5 years ago
Database
3 years ago
Integrations
3 years ago
Libraries
5 years ago
Models
3 years ago
Seeds
4 years ago
Services
3 years ago
Support
3 years ago
config
3 years ago
Activator.php
5 years ago
Attachment.php
4 years ago
Controller.php
5 years ago
Core.php
5 years ago
Deactivator.php
3 years ago
Factory.php
5 years ago
Files.php
5 years ago
Plugin.php
5 years ago
Requirements.php
4 years ago
support.php
4 years ago
Controller.php
50 lines
| 1 | <?php |
| 2 | |
| 3 | namespace PrestoPlayer; |
| 4 | |
| 5 | class Controller |
| 6 | { |
| 7 | /** |
| 8 | * The settings page handler. |
| 9 | * |
| 10 | * @var Component[] |
| 11 | */ |
| 12 | private $components = []; |
| 13 | |
| 14 | /** |
| 15 | * The core plugin API. |
| 16 | * |
| 17 | * @var Core |
| 18 | */ |
| 19 | private $core; |
| 20 | |
| 21 | /** |
| 22 | * Creates an instance of the plugin controller. |
| 23 | * |
| 24 | * @since 2.3.0 Component parameters replaced with factory-cofigured array. |
| 25 | * |
| 26 | * @param Core $core The core API. |
| 27 | * @param Component[] $components An array of plugin components. |
| 28 | */ |
| 29 | public function __construct(Core $core, array $components) |
| 30 | { |
| 31 | $this->core = $core; |
| 32 | $this->components = $components; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Starts the plugin for real. |
| 37 | * |
| 38 | * @return void |
| 39 | */ |
| 40 | public function run() |
| 41 | { |
| 42 | // Set plugin singleton. |
| 43 | Core::set_instance($this->core); |
| 44 | |
| 45 | foreach ($this->components as $component) { |
| 46 | $component->register(); |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 |