PluginProbe
VdoCipher: Secure Video Player and Hosting / 1.24
VdoCipher: Secure Video Player and Hosting v1.24
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 +116 -249 1.301.24 View file →
@@ -1,246 +1,159 @@
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"><button id="toggle_API_visibility" href="#" data-protected="On">Show API Secret Key</button></span>
31 + </p>
84 32 </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 33 </td>
90 34 </tr>
91 - </tbody>
92 35
93 - <tbody style="display: <?= $restElementDisplay ?>">
94 36 <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')); ?>"
37 + <th scope="row">Default Width</th>
38 + <td><input type="text" id="vdo_default_width" name="vdo_default_width"
39 + value="<?php echo esc_attr(get_option('vdo_default_width')); ?>"
100 40 /></td>
101 41 </tr>
102 42
103 43 <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>
44 + <th scope="row">Default Height</th>
45 + <td><input type="text" id="vdo_default_height" name="vdo_default_height"
46 + value="<?php echo esc_attr(get_option('vdo_default_height')); ?>"
47 + /></td>
111 48 </tr>
112 49
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 50 <!-- Version Number -->
126 51 <?php
127 - $existingVersion = get_option('vdo_embed_version');
128 - $embedVersionDisplay = 'none';
129 - if ($existingVersion !== false && $existingVersion !== VDOCIPHER_PLAYER_VERSION) {
130 - $embedVersionDisplay = 'table-row';
131 - } ?>
52 + if ((get_option('vdo_embed_version')) == false) {
53 + update_option('vdo_embed_version', '1.6.4');
54 + }
55 + ?>
132 56 <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>
57 + <th scope="row">Player Version</th>
58 + <td>
59 + <div style="display: inline-flex">
60 + <select id="vdo_embed_version">
61 + <?php
62 + $vdo_embed_version_vars = array(
63 + '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'
64 + );
65 + $vdo_embed_version_str = get_option('vdo_embed_version');
66 + foreach ($vdo_embed_version_vars as $vdo_embed_version_var) {
67 + if ($vdo_embed_version_str == $vdo_embed_version_var) {
68 + $selected = 'selected';
69 + } else {
70 + $selected = '';
71 + }
72 + switch ($vdo_embed_version_var) {
73 + case '0.5':
74 + $version_old_new = ' (old player)';
75 + break;
76 + case '1.6.4':
77 + $version_old_new = ' (newest player)' ;
78 + break;
79 + default:
80 + $version_old_new = ' (new player)';
81 + break;
82 + }
83 + ?>
84 + <option value="<?php echo $vdo_embed_version_var; ?>" <?php echo $selected; ?> >
85 + <?php echo $vdo_embed_version_var . $version_old_new ; ?>
86 + </option>
87 + <?php } ?>
88 + <option value="Custom Version">
89 + <?php echo 'Custom Version' ?>
90 + </option>
91 + </select>
92 + <input type="text" name="vdo_embed_version"
93 + id="vdo_custom_version"
94 + style="margin-left:20px; position: relative; width:120px;" />
95 + </div>
96 + <p class="description">It is recommended that you use the latest player version for best video playback.</p>
97 + </td>
151 98 </tr>
152 99
153 100 <!-- Player Theme Options -->
154 101 <?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');
102 + if ((get_option('vdo_player_theme')) == false) {
103 + update_option('vdo_player_theme', '9ae8bbe8dd964ddc9bdb932cca1cb59a');
104 + }
164 105 ?>
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>
106 + <tr valign="top">
107 + <th scope="row">Player Theme</th>
171 108 <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'); ?>
109 + <div style="display:inline-flex; margin-bottom:10px;">
110 + <input type="text" name="vdo_player_theme"
111 + value="<?php echo esc_attr(get_option('vdo_player_theme')); ?>" max-length = "32" style="width: 320px" disabled
112 + />
113 + <p style="margin-left:20px; position: relative">
114 + <span><a href="<?php menu_page_url( 'themesvdo', 1 ); ?> " >Select Custom Player Theme</a><br/>
115 + </p>
116 + </div>
117 + <p class="description">
118 + Player theme is not available for old player version(0.5). The default theme will be applied for old player.
119 + </p>
120 +
234 121 </td>
235 122 </tr>
236 123 <!-- Player Theme Options end-->
237 124
125 + <!-- Player Watermark option - Flash/ HTML5 starts -->
126 + <tr id="vdo_watermark_html_flash" valign="top">
127 + <th scope="row"> Choice of Watermark </th>
128 + <td>
129 + <?php
130 + if ((get_option('vdo_watermark_flash_html') == 'html5')) {
131 + $vdocheckedhtml5 = 'checked';
132 + $vdocheckedflash = '';
133 + } elseif ((get_option('vdo_watermark_flash_html') == 'flash')) {
134 + $vdocheckedhtml5 = '';
135 + $vdocheckedflash = 'checked';
136 + }
137 + ?>
138 + <input type="radio" class="vdo-htmlflash"
139 + value="html5" name="vdo_watermark_flash_html"
140 + id="vdo_html5" <?php echo $vdocheckedhtml5; ?> >
141 + <label for="vdo_html5">HTML5 (Overlay)</label>
142 + &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
143 + <input type="radio" class="vdo-htmlflash"
144 + value="flash" name="vdo_watermark_flash_html"
145 + id="vdo_flash" <?php echo $vdocheckedflash; ?> >
146 + <label for="vdo_flash">Flash (Hard-Coded)</label>
147 + </td>
148 + </tr>
149 + <!-- Player Watermark option - Flash/ HTML5 ends -->
238 150 <tr valign="top">
239 - <th scope="row"><label for="vdo_watermarkjson">Annotation Statement</label></th>
151 + <th scope="row">Annotation Statement</th>
240 152 <td>
241 153 <div style="display: inline-flex;">
242 - <textarea name="vdo_annotate_code" id="vdo_watermarkjson" rows="6" cols="55" style="font-family: monospace"
154 + <textarea name="vdo_annotate_code" id="vdo_watermarkjson"
155 + type="textarea" rows="6" cols="55" style="display: float-left"
243 156 ><?php
244 157 if (get_option('vdo_annotate_code') != "") {
245 158 echo get_option('vdo_annotate_code');
246 159 $vdo_annotation_code = get_option('vdo_annotate_code');
@@ -262,66 +175,20 @@
262 175 </a>
263 176 </p>
264 177 </td>
265 178 </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 - <tr style="display:none;">
312 - <td>Plugin version no.: </td>
313 - <td><input
314 - id="vdo_plugin_version" name="vdo_plugin_version" type="hidden"
315 - value="<?php echo esc_attr(get_option('vdo_plugin_version')); ?>" readonly>
316 - </td>
317 - </tr>
318 -
319 - </tbody>
320 179 </table>
321 180 <?php
322 181 wp_enqueue_script('vdo_validate_watermark', plugin_dir_url(__FILE__).'js/validatewatermark.js');
182 + wp_localize_script('vdo_validate_watermark', 'vdoValidateWatermark', array(
183 + 'vdoWatermark' => $vdo_annotation_code
184 + ));
185 + wp_enqueue_script('vdo_html_flash_choice', plugin_dir_url(__FILE__).'js/flashhtml5choice.js');
323 186 wp_enqueue_script('vdo_hide_key', plugin_dir_url(__FILE__).'js/showkey.js');
187 + wp_localize_script('vdo_html_flash_choice', 'vdoVD', array(
188 + 'vdoAV' => $vdo_embed_version_vars,
189 + 'vdoSV' => $vdo_embed_version_str
190 + ));
324 191 ?>
325 192 <?php submit_button(); ?>
326 193 </form>
327 194 </div>