| @@ -1,327 +1,127 @@ | ||
| 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 | -<form name="vdoOptionForm" method="post" action="options.php"> | |
| 13 | +<form 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> | |
| 78 | - <td> | |
| 79 | - <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> | |
| 84 | - </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 | - </td> | |
| 23 | + <th scope="row">Client Secret Key</th> | |
| 24 | + <td><input type="text" name="vdo_client_key" | |
| 25 | + value="<?php echo esc_attr(get_option('vdo_client_key')); ?>" | |
| 26 | + max-length="64" style="width: 640px" id="vdo_client_key" /></td> | |
| 90 | 27 | </tr> |
| 91 | - </tbody> | |
| 92 | 28 | |
| 93 | - <tbody style="display: <?= $restElementDisplay ?>"> | |
| 94 | 29 | <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')); ?>" | |
| 30 | + <th scope="row">Default Width</th> | |
| 31 | + <td><input type="text" name="vdo_default_width" | |
| 32 | + value="<?php echo esc_attr(get_option('vdo_default_width')); ?>" | |
| 100 | 33 | /></td> |
| 101 | 34 | </tr> |
| 102 | 35 | |
| 103 | 36 | <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> | |
| 37 | + <th scope="row">Default Height</th> | |
| 38 | + <td><input type="text" name="vdo_default_height" | |
| 39 | + value="<?php echo esc_attr(get_option('vdo_default_height')); ?>" | |
| 40 | + /></td> | |
| 111 | 41 | </tr> |
| 112 | 42 | |
| 113 | - <tr> | |
| 114 | - <th scope="row"><label for="vdo_player_speed">Playback speed</label></th> | |
| 43 | + <!-- Version Number --> | |
| 44 | + <?php | |
| 45 | + if ((get_option('vdo_embed_version')) == false) { | |
| 46 | + update_option('vdo_embed_version', '1.5.0'); | |
| 47 | + } | |
| 48 | + ?> | |
| 49 | + <tr valign="top"> | |
| 50 | + <th scope="row">Player Version</th> | |
| 115 | 51 | <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> | |
| 52 | + <?php $vdo_embed_version_vars = array('0.5', '1.0.0', '1.1.0', '1.1.3', '1.2.7', '1.3.3', '1.4.5','1.5.0'); ?> | |
| 53 | + <select name="vdo_embed_version" id="vdo_embed_version"> | |
| 54 | + <?php | |
| 55 | + $vdo_embed_version_str = get_option('vdo_embed_version'); | |
| 56 | + ?> | |
| 57 | + <?php | |
| 58 | + foreach($vdo_embed_version_vars as $vdo_embed_version_var) { | |
| 59 | + if ($vdo_embed_version_str == $vdo_embed_version_var) { | |
| 60 | + $selected = 'selected="selected"'; } | |
| 61 | + else { $selected = ''; } | |
| 62 | + | |
| 63 | + if($vdo_embed_version_var === '0.5') { | |
| 64 | + $version_old_new = ' (old player)' ; } | |
| 65 | + elseif ($vdo_embed_version_var === '1.5.0'){ | |
| 66 | + $version_old_new = ' (newest player)' ; } | |
| 67 | + else { | |
| 68 | + $version_old_new = ' (new player)' ; } | |
| 69 | + ?> | |
| 70 | + <option value="<?php echo $vdo_embed_version_var; ?>" <?php echo $selected; ?> > | |
| 71 | + <?php echo $vdo_embed_version_var . $version_old_new ; ?> | |
| 72 | + </option> | |
| 73 | + <?php } ?> | |
| 74 | + </select> | |
| 75 | + <p class="description">It is recommended that you use the latest player version for best video playback.</p> | |
| 122 | 76 | </td> |
| 123 | 77 | </tr> |
| 124 | 78 | |
| 125 | - <!-- Version Number --> | |
| 79 | + <!-- Player Theme Options --> | |
| 126 | 80 | <?php |
| 127 | - $existingVersion = get_option('vdo_embed_version'); | |
| 128 | - $embedVersionDisplay = 'none'; | |
| 129 | - if ($existingVersion !== false && $existingVersion !== VDOCIPHER_PLAYER_VERSION) { | |
| 130 | - $embedVersionDisplay = 'table-row'; | |
| 131 | - } ?> | |
| 132 | - <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"' : ''; | |
| 81 | + if ((get_option('vdo_player_theme')) == false) { | |
| 82 | + update_option('vdo_player_theme','9ae8bbe8dd964ddc9bdb932cca1cb59a'); | |
| 139 | 83 | } |
| 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> | |
| 151 | - </tr> | |
| 152 | - | |
| 153 | - <!-- Player Theme Options --> | |
| 154 | - <?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'); | |
| 164 | 84 | ?> |
| 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> | |
| 85 | + <tr valign="top"> | |
| 86 | + <th scope="row">Player Theme</th> | |
| 171 | 87 | <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'); ?> | |
| 88 | + <input type="text" name="vdo_player_theme" | |
| 89 | + value="<?php echo esc_attr(get_option('vdo_player_theme')); ?>" max-length = "32" style="width: 320px" | |
| 90 | + /> | |
| 91 | + <p class="description">Player theme is not available for old player version(0.5). The default theme will be applied for old player.</p> | |
| 234 | 92 | </td> |
| 235 | 93 | </tr> |
| 236 | - <!-- Player Theme Options end--> | |
| 237 | 94 | |
| 238 | 95 | <tr valign="top"> |
| 239 | - <th scope="row"><label for="vdo_watermarkjson">Annotation Statement</label></th> | |
| 96 | + <th scope="row">Annotation Statement</th> | |
| 240 | 97 | <td> |
| 241 | 98 | <div style="display: inline-flex;"> |
| 242 | - <textarea name="vdo_annotate_code" id="vdo_watermarkjson" rows="6" cols="55" style="font-family: monospace" | |
| 243 | - ><?php | |
| 99 | + <textarea name="vdo_annotate_code" id="vdo_watermarkjson" type="textarea" rows="6" cols="55" style="display: float-left"> <?php | |
| 244 | 100 | if (get_option('vdo_annotate_code') != "") { |
| 245 | - echo get_option('vdo_annotate_code'); | |
| 246 | - $vdo_annotation_code = get_option('vdo_annotate_code'); | |
| 247 | - } | |
| 248 | - ?></textarea> | |
| 101 | + echo get_option('vdo_annotate_code'); | |
| 102 | + $vdo_annotation_code = get_option('vdo_annotate_code'); | |
| 103 | + } | |
| 104 | + ?> | |
| 105 | + </textarea> | |
| 249 | 106 | <p class="description" style="margin-left:20px; position: relative"> |
| 250 | 107 | <span style="color:purple"><b>Sample Code for Dynamic Watermark</b></span><br/> |
| 251 | - [{'type':'rtext', 'text':' {name}', 'alpha':'0.60', 'color':'0xFF0000','size':'15','interval':'5000'}] <br/> | |
| 108 | + [{'type':'rtext', 'text':' {name}', 'alpha':'0.60', 'color':'0xFF0000','size':'17','interval':'5000'}] <br/> | |
| 252 | 109 | <span style="color:purple"><b>Sample Code for Static Watermark</b></span><br/> |
| 253 | 110 | [{'type':'text', 'text':'{ip}', 'alpha':'0.5' , 'x':'10', 'y':'100', 'color':'0xFF0000', 'size':'12'}] <br/> |
| 254 | 111 | </p> |
| 255 | 112 | </div> |
| 256 | 113 | <p class="description" id="vdojsonvalidator"></p> |
| 257 | - <p class="description"> | |
| 258 | - Leave this text blank in case you do not need watermark over all | |
| 259 | - videos. For details on writing the annotation code | |
| 260 | - <a href="https://www.vdocipher.com/blog/2014/12/add-text-to-videos-with-watermark/" target="_blank"> | |
| 261 | - check this out | |
| 262 | - </a> | |
| 263 | - </p> | |
| 114 | + <p class="description">Leave this text blank in case you do not need watermark over all videos. For details on writing the annotation code <a href="https://www.vdocipher.com/blog/2014/12/add-text-to-videos-with-watermark/" target="_blank">check this out</a></p> | |
| 264 | 115 | </td> |
| 265 | 116 | </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 | 117 | </table> |
| 321 | 118 | <?php |
| 322 | - wp_enqueue_script('vdo_validate_watermark', plugin_dir_url(__FILE__).'js/validatewatermark.js'); | |
| 323 | - wp_enqueue_script('vdo_hide_key', plugin_dir_url(__FILE__).'js/showkey.js'); | |
| 119 | + wp_enqueue_script('vdo_change_player_version',plugin_dir_url(__FILE__).'js/validatewatermark.js'); | |
| 120 | + wp_localize_script('vdo_change_player_version', 'vdoVersionData', array( | |
| 121 | + 'vdoWatermark' => $vdo_annotation_code | |
| 122 | + ) | |
| 123 | + ); | |
| 324 | 124 | ?> |
| 325 | 125 | <?php submit_button(); ?> |
| 326 | 126 | </form> |
| 327 | 127 | </div> |