PluginProbe
VdoCipher: Secure Video Player and Hosting / 1.26
VdoCipher: Secure Video Player and Hosting v1.26
trunk 1.10 1.11 1.12 1.13 1.14 1.15 1.17 1.18 1.19 1.20 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.28 1.29 1.3 1.30 1.4 1.5 1.6 All 28 releases
← All changes | include/options.php +124 -243 1.301.26 View file →
@@ -1,246 +1,166 @@
1 1 <?php
2 2 if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
3 3 header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
4 - exit("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n<html lang='en'><head>\r\n<title>404 Not Found</title>\r\n".
4 + exit("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n<html><head>\r\n<title>404 Not Found</title>\r\n".
5 5 "</head><body>\r\n<h1>Not Found</h1>\r\n<p>The requested URL " . $_SERVER['SCRIPT_NAME'] . " was not found on ".
6 6 "this server.</p>\r\n</body></html>");
7 7 }
8 8 ?>
9 9
10 -<style>
11 - details.vdo_docs {
12 - border: 1px solid #aaa;
13 - border-radius: 4px;
14 - padding: 0.5em 0.5em 0;
15 - max-width: 600px;
16 - margin-top: 15px;
17 - }
18 -
19 - details.vdo_docs ul {
20 - list-style: revert;
21 - padding: revert;
22 - }
23 -
24 - details.vdo_docs > summary {
25 - font-weight: bold;
26 - margin: -0.5em -0.5em 0;
27 - padding: 0.5em;
28 - cursor: pointer;
29 - user-select: none;
30 - }
31 -
32 - details.vdo_docs[open] {
33 - padding: 0.5em;
34 - }
35 -
36 - details.vdo_docs[open] summary {
37 - border-bottom: 1px solid #aaa;
38 - margin-bottom: 0.5em;
39 - }
40 -
41 - details.vdo_docs table {
42 - border: 1px solid #aaaaaa;
43 - border-collapse: collapse;
44 - }
45 - details.vdo_docs td, details.vdo_docs th {
46 - border: 1px solid #aaaaaa;
47 - padding: 5px 10px;
48 - }
49 -
50 -</style>
51 -
52 10 <div class="wrap">
53 11 <h2>VdoCipher Options</h2>
54 12
55 -<details style="width: min(100%, 500px);background: #ffffff;padding: 5px 20px;" open>
56 - <summary style="cursor: pointer">Any questions or feedback for us?</summary>
57 - <p>
58 - Send us your questions and feedback from <a target="_blank" href="https://www.vdocipher.com/dashboard/zen-desk">the "Support" section in your vdocipher dashboard</a> or send email to <a href="mailto:support@vdocipher.com">support@vdocipher.com</a>
59 - </p>
60 -</details>
61 -<?php include('shortcode-doc.html') ?>
62 -
63 13 <form name="vdoOptionForm" method="post" action="options.php">
64 14 <?php
65 15 settings_fields('vdo_option-group');
66 16 do_settings_sections('vdo_option-group');
67 17 ?>
68 - <?php
69 - $existingKey = get_option('vdo_client_key');
70 - $keyIsValid = $existingKey && strlen($existingKey) == 64;
71 - $keyDescriptionDisplay = $keyIsValid ? 'none' : 'block';
72 - $restElementDisplay = $keyIsValid ? 'table-row-group' : 'none';
73 - ?>
18 + <div class="updated">
19 + <p><strong>Status : </strong> Ready to use. You can now embed your videos inside posts and pages.</p>
20 + </div>
74 21 <table class="form-table">
75 - <tbody>
76 22 <tr valign="top">
77 - <th scope="row"><label for="vdo_client_key">API Secret Key</label></th>
23 + <th scope="row">API Secret Key</th>
78 24 <td>
79 25 <div style="display: inline-flex;">
80 - <input id="vdo_client_key" name="vdo_client_key" style="width: 640px"
81 - type="password" required minlength="64" maxlength="64"
82 - value="<?php echo esc_attr(get_option('vdo_client_key')); ?>"/>
83 - <button id="toggle_API_visibility" data-protected="On" class="button" type="button">Show API Secret Key</button>
26 + <input type="password" name="vdo_client_key"
27 + value="<?php echo esc_attr(get_option('vdo_client_key')); ?>"
28 + max-length="64" style="width: 640px" id="vdo_client_key" />
29 + <p style="margin-left:20px; position: relative">
30 + <span id="toggle_span">
31 + <button id="toggle_API_visibility" href="#" data-protected="On">Show API Secret Key</button>
32 + </span>
33 + </p>
84 34 </div>
85 - <p class="description" style="display: <?= $keyDescriptionDisplay ?>">
86 - API Key is a shared secret between your website servers and vdocipher dashboard. To generate this,
87 - login to vdocipher dashboard, go to "Config" > "API Keys". Generate a new key and copy-paste it here.
88 - </p>
89 35 </td>
90 36 </tr>
91 - </tbody>
92 37
93 - <tbody style="display: <?= $restElementDisplay ?>">
94 38 <tr valign="top">
95 - <th scope="row"><label for="vdo_default_width">Default Width</label></th>
96 - <td>
97 - <input id="vdo_default_width" name="vdo_default_width"
98 - type="number" required
99 - value="<?php echo esc_attr(get_option('vdo_default_width')); ?>"
39 + <th scope="row">Default Width</th>
40 + <td><input type="text" id="vdo_default_width" name="vdo_default_width"
41 + value="<?php echo esc_attr(get_option('vdo_default_width')); ?>"
100 42 /></td>
101 43 </tr>
102 44
103 45 <tr valign="top">
104 - <th scope="row"><label for="vdo_default_height">Default Height</label></th>
105 - <td>
106 - <input type="text" id="vdo_default_height" name="vdo_default_height"
107 - required pattern="^auto|\d+$"
108 - value="<?php echo esc_attr(get_option('vdo_default_height')); ?>"/>
109 - <p class="description">Can be either "auto" or a number. Set to "auto" height and max width for responsive layout.</p>
110 - </td>
46 + <th scope="row">Default Height</th>
47 + <td><input type="text" id="vdo_default_height" name="vdo_default_height"
48 + value="<?php echo esc_attr(get_option('vdo_default_height')); ?>"
49 + /></td>
111 50 </tr>
112 51
113 - <tr>
114 - <th scope="row"><label for="vdo_player_speed">Playback speed</label></th>
115 - <td>
116 - <input type="text" id="vdo_player_speed" name="vdo_player_speed"
117 - pattern="^\d.\d{1,2}(,\d.\d{1,2})+$"
118 - value="<?php echo esc_attr(get_option('vdo_player_speed')); ?>"
119 - />
120 - <p class="description">Speed can be defined as comma separated decimal values e.g. 0.75,1.0,1.25,1.5,1.75,2.0</p>
121 - <p class="description">With player v2, there is an option to set this as part of custom player configuration. This setting will override any options set as part of custom player.</p>
122 - </td>
123 - </tr>
124 -
125 52 <!-- Version Number -->
126 53 <?php
127 - $existingVersion = get_option('vdo_embed_version');
128 - $embedVersionDisplay = 'none';
129 - if ($existingVersion !== false && $existingVersion !== VDOCIPHER_PLAYER_VERSION) {
130 - $embedVersionDisplay = 'table-row';
131 - } ?>
54 + if ((get_option('vdo_embed_version')) == false) {
55 + update_option('vdo_embed_version', VDOCIPHER_PLAYER_VERSION);
56 + }
57 + ?>
132 58 <tr valign="top">
133 - <?php
134 - function vdo_selected($match) {
135 - $existingEmbedVersion = get_option('vdo_embed_version');
136 - // global $existingEmbedVersion;
137 - // return $GLOBALS['existingEmbedVersion'] ;
138 - return $existingEmbedVersion === $match ? 'selected="selected"' : '';
139 - }
140 - ?>
141 - <th scope="row"><label for="vdo_embed_version">Player Version</label></th>
142 - <td>
143 - <div style="display: inline-flex">
144 - <select name="vdo_embed_version" id="vdo_embed_version" onchange="" autocomplete="off">
145 - <option value="1.6.10" <?= vdo_selected('1.6.10') ?>>v1</option>
146 - <option value="v2" <?= vdo_selected('v2') ?>>v2 (Recommended)</option>
147 - </select>
148 - </div>
149 - <?php include( 'player-versions-doc.php' ) ?>
150 - </td>
59 + <th scope="row">Player Version</th>
60 + <td>
61 + <div style="display: inline-flex">
62 + <select id="vdo_embed_version">
63 + <?php
64 + $vdo_embed_version_vars = array(
65 + '0.5', '1.0.0', '1.1.0', '1.1.3', '1.2.7', '1.3.3', '1.4.5','1.5.0','1.6.4','1.6.10'
66 + );
67 + $vdo_embed_version_string = get_option('vdo_embed_version');
68 + foreach ($vdo_embed_version_vars as $vdo_embed_version_var) {
69 + if ($vdo_embed_version_string == $vdo_embed_version_var) {
70 + $selected = 'selected';
71 + } else {
72 + $selected = '';
73 + }
74 + switch ($vdo_embed_version_var) {
75 + case '0.5':
76 + $version_old_new = ' (old player)';
77 + break;
78 + case VDOCIPHER_PLAYER_VERSION:
79 + $version_old_new = ' (newest player)' ;
80 + break;
81 + default:
82 + $version_old_new = ' (new player)';
83 + break;
84 + }
85 + ?>
86 + <option value="<?php echo $vdo_embed_version_var; ?>" <?php echo $selected; ?> >
87 + <?php echo $vdo_embed_version_var . $version_old_new ; ?>
88 + </option>
89 + <?php } ?>
90 + <option value="Custom Version">
91 + <?php echo 'Custom Version' ?>
92 + </option>
93 + </select>
94 + <input type="text" name="vdo_embed_version"
95 + id="vdo_custom_version"
96 + style="margin-left:20px; position: relative; width:120px;" />
97 + </div>
98 + <p class="description">It is recommended that you use the latest player version for best video playback.</p>
99 + </td>
151 100 </tr>
152 101
153 102 <!-- Player Theme Options -->
154 103 <?php
155 - /**
156 - * if the player is v1 and non-standard theme, then only allow disabling non-standard themes
157 - * if the player is v1 and standard theme, do not show anything
158 - * if the player is v2, allow adding player IDs. But validate the length of id
159 - *
160 - * This can be implemented in both PHP and JS. But if the JS is essential, then we can skip
161 - * writing in PHP and run the JS function after page load.
162 - */
163 - $existingTheme = get_option('vdo_player_theme');
104 + if (!(get_option('vdo_player_theme'))) {
105 + update_option('vdo_player_theme', '9ae8bbe8dd964ddc9bdb932cca1cb59a');
106 + }
164 107 ?>
165 - <tr valign="top" id="vdo_theme_editing_row" >
166 - <th scope="row">
167 - <label for="vdo_player_theme">Player ID</label>
168 - <br />
169 - <small style="font-weight: normal"><em>Leave this blank for using default theme. Player id can also be specified in the shortcode if needed to be different for different videos.</em></small>
170 - </th>
108 + <tr valign="top">
109 + <th scope="row">Player Theme</th>
171 110 <td>
172 - <div style="display:inline-flex; margin-bottom:10px;">
173 - <input
174 - type="text"
175 - name="vdo_player_theme"
176 - id="vdo_player_theme"
177 - value="<?php echo $existingTheme; ?>"
178 - maxlength="32"
179 - style="width: 320px"
180 - />
181 - <p class="vdo_saveChangeMessage" style="display: none; font-style: italic">Click on "save changes" below to confirm</p>
182 - <button id="vdo_setDefaultThemeBtn" style="display: none" class="button" type="button">Revert to default theme</button><br/>
183 - <script>
184 - (function () {
185 - const themeInputRow = document.querySelector('#vdo_theme_editing_row');
186 - const themeInputField = themeInputRow.querySelector('input');
187 - const playerVersionField = document.querySelector('[name=vdo_embed_version]');
188 - const setDefaultButton = document.querySelector('#vdo_setDefaultThemeBtn');
189 - playerVersionField.addEventListener('change', updateThemeInput);
190 - const defaultV1Theme = '9ae8bbe8dd964ddc9bdb932cca1cb59a';
191 - const originalTheme = "<?= get_option('vdo_player_theme') ?>";
192 - let resetV2Theme, resetV1Theme;
193 - function updateThemeInput() {
194 - if (playerVersionField.value === 'v2') {
195 - themeInputRow.style.display = '';
196 - if (themeInputField.value.match(/^\w{32}$/)) resetV1Theme = themeInputField.value;
197 - if (resetV2Theme) themeInputField.value = resetV2Theme;
198 - // if the input is not valid for v2, clear the field
199 - if (!themeInputField.value.match(/^\w{16}$/)) themeInputField.value = '';
200 - // set the max and min length for v2 players
201 - themeInputField.setAttribute('maxlength', '16');
202 - themeInputField.setAttribute('minlength', '16');
203 - setDefaultButton.style.display = 'none';
204 - } else {
205 - // if input valid for v2, save in reset variable
206 - if (themeInputField.value.match(/^\w{16}$/)) resetV2Theme = themeInputField.value;
207 - if (resetV1Theme) themeInputField.value = resetV1Theme;
208 - // if input is not valid for v1, reset to default theme
209 - if (!themeInputField.value.match(/^\w{32}$/)) themeInputField.value = defaultV1Theme;
210 - themeInputField.setAttribute('maxlength', '32');
211 - themeInputField.setAttribute('minlength', '32');
212 - // if original theme was some custom v1 theme, hide the entire row
213 - // else, show reset button
214 - if (originalTheme.length !== 32 || originalTheme === defaultV1Theme) {
215 - themeInputRow.style.display = 'none';
216 - } else {
217 - setDefaultButton.style.display = '';
218 - setDefaultButton.addEventListener('click', (e) => {
219 - e.preventDefault();
220 - themeInputField.value = '9ae8bbe8dd964ddc9bdb932cca1cb59a'
221 - e.target.style.display = 'none';
222 - e.target.parentElement.querySelector('.vdo_saveChangeMessage').style.display = '';
223 - });
224 - }
225 - }
226 - }
227 - setTimeout(() => {
228 - updateThemeInput();
229 - }, 0);
230 - })()
231 - </script>
232 - </div>
233 - <?php include('player-id-doc.html'); ?>
111 + <div style="display:inline-flex; margin-bottom:10px;">
112 + <input
113 + type="text"
114 + name="vdo_player_theme"
115 + value="<?php echo esc_attr(get_option('vdo_player_theme')); ?>"
116 + max-length = "32"
117 + style="width: 320px"
118 + readonly
119 + />
120 + <p style="margin-left:20px; position: relative">
121 + <span><a href="<?php menu_page_url('themesvdo', 1); ?> " >Select Custom Player Theme</a><br/>
122 + </p>
123 + </div>
124 + <p class="description">
125 + Player theme is not available for old player version(0.5). The default theme will be applied for old player.
126 + </p>
127 +
234 128 </td>
235 129 </tr>
236 130 <!-- Player Theme Options end-->
237 131
132 + <!-- Player Watermark option - Flash/ HTML5 starts -->
133 + <tr id="vdo_watermark_html_flash" valign="top">
134 + <th scope="row"> Choice of Watermark </th>
135 + <td>
136 + <?php
137 + if ((get_option('vdo_watermark_flash_html') == 'html5')) {
138 + $vdocheckedhtml5 = 'checked';
139 + $vdocheckedflash = '';
140 + } elseif ((get_option('vdo_watermark_flash_html') == 'flash')) {
141 + $vdocheckedhtml5 = '';
142 + $vdocheckedflash = 'checked';
143 + }
144 + ?>
145 + <input type="radio" class="vdo-htmlflash"
146 + value="html5" name="vdo_watermark_flash_html"
147 + id="vdo_html5" <?php echo $vdocheckedhtml5; ?> >
148 + <label for="vdo_html5">HTML5 (Overlay)</label>
149 + &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
150 + <input type="radio" class="vdo-htmlflash"
151 + value="flash" name="vdo_watermark_flash_html"
152 + id="vdo_flash" <?php echo $vdocheckedflash; ?> >
153 + <label for="vdo_flash">Flash (Hard-Coded)</label>
154 + </td>
155 + </tr>
156 + <!-- Player Watermark option - Flash/ HTML5 ends -->
238 157 <tr valign="top">
239 - <th scope="row"><label for="vdo_watermarkjson">Annotation Statement</label></th>
158 + <th scope="row">Annotation Statement</th>
240 159 <td>
241 160 <div style="display: inline-flex;">
242 - <textarea name="vdo_annotate_code" id="vdo_watermarkjson" rows="6" cols="55" style="font-family: monospace"
161 + <textarea name="vdo_annotate_code" id="vdo_watermarkjson"
162 + type="textarea" rows="6" cols="55" style="display: float-left"
243 163 ><?php
244 164 if (get_option('vdo_annotate_code') != "") {
245 165 echo get_option('vdo_annotate_code');
246 166 $vdo_annotation_code = get_option('vdo_annotate_code');
@@ -262,66 +182,27 @@
262 182 </a>
263 183 </p>
264 184 </td>
265 185 </tr>
266 -
267 - <!-- Advanced Options -->
268 -
269 - <tr valign="top">
270 - <th scope="row"></th>
271 - <td>
272 - <details>
273 - <summary style="cursor: pointer">Advanced Options</summary>
274 - <div style="margin: 40px 0">
275 - <div style="display: inline-flex;">
276 - <div style="width: 300px;">
277 - <label for="vdo_send_user_id_in_api"><strong>Track userId with each video session</strong></label>
278 - </div>
279 - <div>
280 - <input type="checkbox" name="vdo_send_user_id_in_api" id="vdo_send_user_id_in_api"
281 - value="true" <?php echo esc_attr(get_option('vdo_send_user_id_in_api')) == 'true' ? 'checked' : ''; ?>/>
282 - </div>
283 - </div>
284 - <p class="description">
285 - Sending the userId with each dynamically generated embed code makes it possible to track userId<br>
286 - for higher security. It provides piracy tracking and watch time analytics. The primary key of<br>
287 - your users table is used for this purpose.
288 - </p>
289 - </div>
290 - <div style="margin: 40px 0">
291 - <div style="display: inline-flex;">
292 - <div style="width: 300px;">
293 - <label for="vdo_show_plugin_in_sidebar"><strong>Show VdoCipher in sidebar</strong></label>
294 - </div>
295 - <div>
296 - <input type="checkbox" name="vdo_show_plugin_in_sidebar" id="vdo_show_plugin_in_sidebar"
297 - value="true" <?php echo esc_attr(get_option('vdo_show_plugin_in_sidebar')) == 'true' ? 'checked' : ''; ?>/>
298 - </div>
299 - </div>
300 - <p class="description">
301 - Not recommended to be changed. Mark this option unchecked if you like to hide the VdoCipher settings page from the sidebar.<br/>
302 - Once changed, you will need to access this page from inside the Wordpress Settings / Plugins page.
303 - </p>
304 - </div>
305 - </details>
306 -
307 - </td>
308 - </tr>
309 -
310 - <!-- Footer -->
311 186 <tr style="display:none;">
312 187 <td>Plugin version no.: </td>
313 188 <td><input
314 - id="vdo_plugin_version" name="vdo_plugin_version" type="hidden"
189 + id="vdo_plugin_version" name="vdo_plugin_version"
315 190 value="<?php echo esc_attr(get_option('vdo_plugin_version')); ?>" readonly>
316 191 </td>
317 192 </tr>
318 -
319 - </tbody>
320 193 </table>
321 194 <?php
322 195 wp_enqueue_script('vdo_validate_watermark', plugin_dir_url(__FILE__).'js/validatewatermark.js');
196 + wp_localize_script('vdo_validate_watermark', 'vdoValidateWatermark', array(
197 + 'vdoWatermark' => $vdo_annotation_code
198 + ));
199 + wp_enqueue_script('vdo_html_flash_choice', plugin_dir_url(__FILE__).'js/flashhtml5choice.js');
323 200 wp_enqueue_script('vdo_hide_key', plugin_dir_url(__FILE__).'js/showkey.js');
201 + wp_localize_script('vdo_html_flash_choice', 'vdoVD', array(
202 + 'vdoAV' => $vdo_embed_version_vars,
203 + 'vdoSV' => $vdo_embed_version_string
204 + ));
324 205 ?>
325 206 <?php submit_button(); ?>
326 207 </form>
327 208 </div>