PluginProbe ʕ •ᴥ•ʔ
Presto Player / 2.2.3-beta1
Presto Player v2.2.3-beta1
4.4.1 4.4.0 4.3.3 4.3.2 4.3.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 / Services / Menu.php
presto-player / inc / Services Last commit date
API 2 years ago Blocks 5 years ago License 5 years ago AdminNotice.php 5 years ago AdminNotices.php 4 years ago AjaxActions.php 2 years ago Blocks.php 5 years ago Compatibility.php 4 years ago Menu.php 3 years ago Migrations.php 5 years ago Player.php 2 years ago ProCompatibility.php 2 years ago ReusableVideos.php 4 years ago Scripts.php 2 years ago Settings.php 4 years ago Shortcodes.php 2 years ago Streamer.php 4 years ago Translation.php 2 years ago VideoPostType.php 4 years ago
Menu.php
156 lines
1 <?php
2
3 namespace PrestoPlayer\Services;
4
5 use PrestoPlayer\Plugin;
6 use PrestoPlayer\WPackio\Enqueue;
7
8 class Menu
9 {
10 protected $enqueue;
11
12 public function register()
13 {
14 add_action('admin_menu', [$this, 'addMenu']);
15 }
16
17 public function addMenu()
18 {
19 add_menu_page(
20 __('Presto Player', 'presto-player'),
21 __('Presto Player', 'presto-player'),
22 'publish_posts',
23 'edit.php?post_type=pp_video_block',
24 '',
25 PRESTO_PLAYER_PLUGIN_URL . 'img/menu-icon.svg'
26 );
27
28 add_submenu_page(
29 'edit.php?post_type=pp_video_block',
30 __('Media Hub', 'presto-player'),
31 __('Media Hub', 'presto-player'),
32 'publish_posts',
33 'edit.php?post_type=pp_video_block'
34 );
35
36 $analyics_page = add_submenu_page(
37 'edit.php?post_type=pp_video_block',
38 __('Analytics', 'presto-player'),
39 !Plugin::isPro() ? __('Analytics', 'presto-player') . ' <span class="update-plugins" style="background-color: #ffffff1c"><span class="plugin-count">Pro</span></span>' : __('Analytics', 'presto-player'),
40 'publish_posts',
41 'presto-analytics',
42 function () {
43 ob_start();
44 ?>
45 <div class="presto-player-dashboard__header">
46 <img class="presto-player-dashboard__logo" src="<?php echo esc_url(PRESTO_PLAYER_PLUGIN_URL . '/img/logo.svg'); ?>" />
47 <div class="presto-player-dashboard__version">v<?php echo esc_html(Plugin::version()); ?></div>
48 </div>
49 <div id="presto-analytics-page"></div>
50 <?php wp_auth_check_html(); ?>
51 <?php
52 $page = ob_get_clean();
53 echo $page;
54 }
55 );
56
57 add_action("admin_print_scripts-{$analyics_page}", [$this, 'analyticsAssets']);
58
59 $settings_page = add_submenu_page(
60 'edit.php?post_type=pp_video_block',
61 __('Presto Player Settings', 'presto-player'),
62 __('Settings', 'presto-player'),
63 'manage_options',
64 'presto-player-settings',
65 "PrestoPlayer\Services\Settings::template",
66 5
67 );
68
69 add_action("admin_print_scripts-{$settings_page}", [$this, 'settingsAssets']);
70 }
71
72 /**
73 * Scripts needed on settings page
74 */
75 public function settingsAssets()
76 {
77 wp_enqueue_media();
78 wp_enqueue_code_editor(['type' => "text/css"]);
79
80 $assets = include trailingslashit(PRESTO_PLAYER_PLUGIN_DIR) . 'dist/settings.asset.php';
81 wp_enqueue_script(
82 'surecart/settings/admin',
83 trailingslashit(PRESTO_PLAYER_PLUGIN_URL) . 'dist/settings.js',
84 array_merge(['wp-codemirror'], $assets['dependencies']),
85 $assets['version'],
86 true
87 );
88 // setting style.
89 wp_enqueue_style('surecart/settings/admin', trailingslashit(PRESTO_PLAYER_PLUGIN_URL) . 'dist/settings.css', [], $assets['version']);
90
91 wp_enqueue_style('wp-components');
92
93 if (function_exists('wp_set_script_translations')) {
94 wp_set_script_translations('surecart/settings/admin', 'presto-player');
95 }
96
97 wp_localize_script(
98 'surecart/settings/admin',
99 'prestoPlayer',
100 apply_filters('presto-settings-js-options', [
101 'root' => esc_url_raw(get_rest_url()),
102 'nonce' => wp_create_nonce('wp_rest'),
103 'proVersion' => Plugin::proVersion(),
104 'isSetup' => [
105 'bunny' => false
106 ],
107 'isPremium' => Plugin::isPro(),
108 'ajaxurl' => admin_url('admin-ajax.php'),
109 'wpVersionString' => 'wp/v2/',
110 'prestoVersionString' => 'presto-player/v1/',
111 'debug' => defined('SCRIPT_DEBUG') && SCRIPT_DEBUG
112 ])
113 );
114 }
115
116 /**
117 * Scripts needed on analytics page
118 */
119 public function analyticsAssets()
120 {
121
122 $assets = include trailingslashit(PRESTO_PLAYER_PLUGIN_DIR) . 'dist/analytics.asset.php';
123 wp_enqueue_script(
124 'surecart/analytics/admin',
125 trailingslashit(PRESTO_PLAYER_PLUGIN_URL) . 'dist/analytics.js',
126 array_merge(['hls.js', 'presto-components', 'media'], $assets['dependencies']),
127 $assets['version'],
128 true
129 );
130 wp_enqueue_style('surecart/analytics/admin', trailingslashit(PRESTO_PLAYER_PLUGIN_URL) . 'dist/analytics.css', [], $assets['version']);
131
132 wp_enqueue_style('wp-components');
133 wp_enqueue_media();
134
135 if (function_exists('wp_set_script_translations')) {
136 wp_set_script_translations('surecart/analytics/admin', 'presto-player');
137 }
138
139 wp_localize_script('surecart/analytics/admin', 'prestoPlayer', [
140 'root' => esc_url_raw(get_rest_url()),
141 'isPremium' => Plugin::isPro(),
142 'plugin_url' => esc_url_raw(trailingslashit(PRESTO_PLAYER_PLUGIN_URL)),
143 'nonce' => wp_create_nonce('wp_rest'),
144 'ajaxurl' => admin_url('admin-ajax.php'),
145 'wpVersionString' => 'wp/v2/',
146 'prestoVersionString' => 'presto-player/v1/',
147 'i18n' => Translation::geti18n()
148 ]);
149 }
150
151 public function template()
152 {
153 echo '<div id="presto-player-dashboard"></div>';
154 }
155 }
156