Blocks
7 months ago
Contracts
1 year ago
Database
1 year ago
Integrations
1 year ago
Libraries
1 year ago
Models
7 months ago
Seeds
1 year ago
Services
6 months ago
Support
7 months ago
config
9 months ago
Activator.php
1 year ago
Attachment.php
1 year ago
Controller.php
1 year ago
Core.php
1 year ago
Deactivator.php
1 year ago
Factory.php
1 year ago
Files.php
1 year ago
Playlist.php
1 year ago
Plugin.php
9 months ago
Requirements.php
1 year ago
support.php
1 year ago
Controller.php
48 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 = array(); |
| 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 | $this->core = $core; |
| 31 | $this->components = $components; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Starts the plugin for real. |
| 36 | * |
| 37 | * @return void |
| 38 | */ |
| 39 | public function run() { |
| 40 | // Set plugin singleton. |
| 41 | Core::set_instance( $this->core ); |
| 42 | |
| 43 | foreach ( $this->components as $component ) { |
| 44 | $component->register(); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 |