PluginProbe ʕ •ᴥ•ʔ
Presto Player / 4.1.1
Presto Player v4.1.1
4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.13 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3-beta1 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.0-beta1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1.0 3.1.1 3.1.2 3.1.3 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4
presto-player / inc / Factory.php
presto-player / inc Last commit date
Blocks 6 months ago Contracts 1 year ago Database 4 months ago Integrations 3 months ago Libraries 3 months ago Models 3 months ago Seeds 1 year ago Services 3 months ago Support 4 months ago config 4 months ago lib 4 months ago Activator.php 1 year ago Attachment.php 4 months ago Controller.php 1 year ago Core.php 1 year ago Deactivator.php 1 year ago Factory.php 3 months 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
Factory.php
128 lines
1 <?php
2
3 namespace PrestoPlayer;
4
5 use PrestoPlayer\Plugin;
6 use PrestoPlayer\Attachment;
7 use PrestoPlayer\Controller;
8 use PrestoPlayer\Support\Block;
9 use PrestoPlayer\Services\Scripts;
10 // Disabled: PrestoPlayer\Services\BunnyCDN class does not exist. Kept for reference.
11 // use PrestoPlayer\Services\BunnyCDN;
12 use PrestoPlayer\Services\Settings;
13 use PrestoPlayer\Services\AdminNotices;
14 use PrestoPlayer\Services\Usage;
15
16 class Factory {
17
18 const SHARED = array( 'shared' => true );
19
20 public $instance;
21
22 public function __construct( $instance ) {
23 $this->instance = $instance;
24 }
25
26 public function isPro() {
27 return Plugin::isPro();
28 }
29
30 /**
31 * Retrieves the rules for setting up the plugin.
32 *
33 * @since 2.1.0
34 *
35 * @return array
36 */
37 public function getRules() {
38 return array(
39 // Disabled: BunnyCDN service class does not exist; this was a stale reference.
40 // BunnyCDN::class => self::SHARED,
41 Visits::class => self::SHARED,
42 ReusableVideos::class => self::SHARED,
43 AdminNotices::class => self::SHARED,
44 Usage::class => self::SHARED,
45
46 Settings::class => array(
47 'constructParams' => array(
48 $this->isPro(),
49 ),
50 ),
51
52 Attachment::class => array(
53 'constructParams' => array(
54 $this->isPro(),
55 ),
56 ),
57
58 // blocks
59 Block::class => array(
60 'constructParams' => array(
61 $this->isPro(),
62 $this->getPluginVersion( PRESTO_PLAYER_PLUGIN_FILE ),
63 ),
64 ),
65
66 // plugin controller
67 Controller::class => array(
68 'constructParams' => array( $this->getComponents() ),
69 ),
70
71 Scripts::class => array(
72 'shared' => true,
73 'constructParams' => array(
74 $this->isPro(),
75 $this->getPluginVersion( PRESTO_PLAYER_PLUGIN_FILE ),
76 ),
77 ),
78 );
79 }
80
81 /**
82 * Retrieves the plugin version.
83 *
84 * @param string $plugin_file The full plugin path.
85 *
86 * @return string
87 */
88 protected function getPluginVersion( $plugin_file ) {
89 // Load version from plugin data.
90 if ( ! \function_exists( 'get_plugin_data' ) ) {
91 require_once \ABSPATH . 'wp-admin/includes/plugin.php';
92 }
93
94 return \get_plugin_data( $plugin_file, false, false )['Version'];
95 }
96
97 /**
98 * Retrieves the list of plugin components run during normal operations
99 * (i.e. not including the Uninstallation component).
100 */
101 public function getComponents() {
102 $config = require_once 'config/app.php';
103 $components = $config['components'];
104 $components = array_merge( $components, $config['pro_components'] );
105
106 return $this->formatComponents( $components );
107 }
108
109 /**
110 * Formats components to use in DICE
111 *
112 * @param array $components
113 * @return array
114 */
115 public function formatComponents( $components = array() ) {
116 $formatted = array();
117
118 if ( ! $components ) {
119 return array();
120 }
121
122 foreach ( array_filter( $components ) as $component ) {
123 $formatted[] = array( $this->instance::INSTANCE => $component );
124 }
125 return $formatted;
126 }
127 }
128