| @@ -1,225 +1,48 @@ | ||
| 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". | |
| 5 | - "</head><body>\r\n<h1>Not Found</h1>\r\n<p>The requested URL " . $_SERVER['SCRIPT_NAME'] . " was not found on ". | |
| 6 | - "this server.</p>\r\n</body></html>"); | |
| 4 | + exit("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n<html><head>\r\n<title>404 Not Found</title>\r\n</head><body>\r\n<h1>Not Found</h1>\r\n<p>The requested URL " . $_SERVER['SCRIPT_NAME'] . " was not found on this server.</p>\r\n</body></html>"); | |
| 7 | 5 | } |
| 8 | 6 | ?> |
| 9 | - | |
| 10 | 7 | <div class="wrap"> |
| 11 | 8 | <h2>VdoCipher Options</h2> |
| 12 | 9 | |
| 13 | -<form name="vdoOptionForm" method="post" action="options.php"> | |
| 10 | +<form method="post" action="options.php"> | |
| 14 | 11 | <?php |
| 15 | -settings_fields('vdo_option-group'); | |
| 16 | -do_settings_sections('vdo_option-group'); | |
| 12 | +settings_fields( 'vdo_option-group' ); | |
| 13 | +do_settings_sections( 'vdo_option-group' ); | |
| 17 | 14 | ?> |
| 18 | - <?php | |
| 19 | - $existingKey = get_option('vdo_client_key'); | |
| 20 | - $keyIsValid = $existingKey && strlen($existingKey) == 64; | |
| 21 | - $keyDescriptionDisplay = $keyIsValid ? 'none' : 'block'; | |
| 22 | - $restElementDisplay = $keyIsValid ? 'table-row-group' : 'none'; | |
| 23 | - ?> | |
| 15 | + <div class="updated"> | |
| 16 | + <p><strong>Status : </strong> Ready to use. You can now embed your videos inside posts and pages.</p> | |
| 17 | + </div> | |
| 24 | 18 | <table class="form-table"> |
| 25 | - <tbody> | |
| 26 | 19 | <tr valign="top"> |
| 27 | - <th scope="row"><label for="vdo_client_key">API Secret Key</label></th> | |
| 28 | - <td> | |
| 29 | - <div style="display: inline-flex;"> | |
| 30 | - <input id="vdo_client_key" name="vdo_client_key" style="width: 640px" | |
| 31 | - type="password" required minlength="64" maxlength="64" | |
| 32 | - value="<?php echo esc_attr(get_option('vdo_client_key')); ?>"/> | |
| 33 | - <button id="toggle_API_visibility" data-protected="On" class="button" type="button">Show API Secret Key</button> | |
| 34 | - </div> | |
| 35 | - <p class="description" style="display: <?= $keyDescriptionDisplay ?>"> | |
| 36 | - API Key is a shared secret between your website servers and vdocipher dashboard. To generate this, | |
| 37 | - login to vdocipher dashboard, go to "Config" > "API Keys". Generate a new key and copy-paste it here. | |
| 38 | - </p> | |
| 39 | - </td> | |
| 20 | + <th scope="row">Client Secret Key</th> | |
| 21 | + <td><input type="text" name="vdo_client_key" value="<?php echo esc_attr( get_option('vdo_client_key') ); ?>" max-length="64" size="60" id="vdo_client_key" /></td> | |
| 40 | 22 | </tr> |
| 41 | - </tbody> | |
| 42 | - | |
| 43 | - <tbody style="display: <?= $restElementDisplay ?>"> | |
| 23 | + | |
| 44 | 24 | <tr valign="top"> |
| 45 | - <th scope="row"><label for="vdo_default_width">Default Width</label></th> | |
| 46 | - <td> | |
| 47 | - <input id="vdo_default_width" name="vdo_default_width" | |
| 48 | - type="number" required | |
| 49 | - value="<?php echo esc_attr(get_option('vdo_default_width')); ?>" | |
| 50 | - /></td> | |
| 25 | + <th scope="row">Default Width</th> | |
| 26 | + <td><input type="text" name="vdo_default_width" value="<?php echo esc_attr( get_option('vdo_default_width') ); ?>" /></td> | |
| 51 | 27 | </tr> |
| 52 | - | |
| 28 | + | |
| 53 | 29 | <tr valign="top"> |
| 54 | - <th scope="row"><label for="vdo_default_height">Default Height</label></th> | |
| 55 | - <td> | |
| 56 | - <input type="text" id="vdo_default_height" name="vdo_default_height" | |
| 57 | - required pattern="^auto|\d+$" | |
| 58 | - value="<?php echo esc_attr(get_option('vdo_default_height')); ?>"/> | |
| 59 | - <p class="description">Can be either "auto" or a number. Set to "auto" height and max width for responsive layout.</p> | |
| 60 | - </td> | |
| 30 | + <th scope="row">Default Height</th> | |
| 31 | + <td><input type="text" name="vdo_default_height" value="<?php echo esc_attr( get_option('vdo_default_height') ); ?>" /></td> | |
| 61 | 32 | </tr> |
| 62 | - | |
| 63 | - <tr> | |
| 64 | - <th scope="row"><label for="vdo_player_speed">Playback speed</label></th> | |
| 65 | - <td> | |
| 66 | - <input type="text" id="vdo_player_speed" name="vdo_player_speed" | |
| 67 | - pattern="^\d.\d{1,2}(,\d.\d{1,2})+$" | |
| 68 | - value="<?php echo esc_attr(get_option('vdo_player_speed')); ?>" | |
| 69 | - /> | |
| 70 | - <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> | |
| 71 | - </td> | |
| 72 | - </tr> | |
| 73 | - | |
| 74 | - <!-- Version Number --> | |
| 75 | - <?php | |
| 76 | - $existingVersion = get_option('vdo_embed_version'); | |
| 77 | - $embedVersionDisplay = 'none'; | |
| 78 | - if ($existingVersion !== false && $existingVersion !== VDOCIPHER_PLAYER_VERSION) { | |
| 79 | - $embedVersionDisplay = 'table-row'; | |
| 80 | - } ?> | |
| 81 | - <tr valign="top" style="display: <?= $embedVersionDisplay ?>"> | |
| 82 | - <th scope="row"><label for="vdo_embed_version">Player Version</label></th> | |
| 83 | - <td> | |
| 84 | - <div style="display: inline-flex"> | |
| 85 | - <input type="text" name="vdo_embed_version" | |
| 86 | - id="vdo_embed_version" | |
| 87 | - value="<?= $existingVersion ?>" | |
| 88 | - readonly /> | |
| 89 | - <p class="vdo_saveChangeMessage" style="display: none; font-style: italic">Click on "save changes" below to confirm</p> | |
| 90 | - <button id="vdo_setDefaultVersionBtn" class="button" type="button">Use latest player version 1.6.10</button><br/> | |
| 91 | - <script> | |
| 92 | - document.querySelector('#vdo_setDefaultVersionBtn').addEventListener('click', (e) => { | |
| 93 | - e.preventDefault(); | |
| 94 | - e.target.parentElement.querySelector('input').value = '<?= VDOCIPHER_PLAYER_VERSION ?>' | |
| 95 | - e.target.style.display = 'none'; | |
| 96 | - e.target.parentElement.querySelector('.vdo_saveChangeMessage').style.display = ''; | |
| 97 | - }); | |
| 98 | - </script> | |
| 99 | - </div> | |
| 100 | - <p class="description"> | |
| 101 | - It is recommended to use the latest player version for best video playback. This action | |
| 102 | - can not be reverted. | |
| 103 | - </p> | |
| 104 | - </td> | |
| 105 | - </tr> | |
| 106 | - | |
| 107 | - <!-- Player Theme Options --> | |
| 108 | - <?php | |
| 109 | - $defaultThemeId = '9ae8bbe8dd964ddc9bdb932cca1cb59a'; | |
| 110 | - $existingTheme = get_option('vdo_player_theme'); | |
| 111 | - $themeSettingDisplay = 'none'; | |
| 112 | - if ($existingTheme !== false && $existingTheme !== $defaultThemeId) { | |
| 113 | - $themeSettingDisplay = 'table-row'; | |
| 114 | - } ?> | |
| 115 | - <tr valign="top" style="display: <?= $themeSettingDisplay ?>"> | |
| 116 | - <th scope="row"><label for="vdo_player_theme">Player Theme</label></th> | |
| 117 | - <td> | |
| 118 | - <div style="display:inline-flex; margin-bottom:10px;"> | |
| 119 | - <input | |
| 120 | - type="text" | |
| 121 | - name="vdo_player_theme" | |
| 122 | - id="vdo_player_theme" | |
| 123 | - value="<?php echo $existingTheme; ?>" | |
| 124 | - maxlength="32" | |
| 125 | - style="width: 320px" | |
| 126 | - readonly | |
| 127 | - /> | |
| 128 | - <p class="vdo_saveChangeMessage" style="display: none; font-style: italic">Click on "save changes" below to confirm</p> | |
| 129 | - <button id="vdo_setDefaultThemeBtn" class="button" type="button">Revert to default theme</button><br/> | |
| 130 | - <script> | |
| 131 | - document.querySelector('#vdo_setDefaultThemeBtn').addEventListener('click', (e) => { | |
| 132 | - e.preventDefault(); | |
| 133 | - e.target.parentElement.querySelector('input').value = '<?= $defaultThemeId ?>' | |
| 134 | - e.target.style.display = 'none'; | |
| 135 | - e.target.parentElement.querySelector('.vdo_saveChangeMessage').style.display = ''; | |
| 136 | - }); | |
| 137 | - </script> | |
| 138 | - </div> | |
| 139 | - <p class="description"> | |
| 140 | - We have reverted player themes in preparation for something better. If you are having any styling | |
| 141 | - issues in your player, please use the button above to revert to the default theme. Once you revert | |
| 142 | - to the default theme, there is no way to undo the selection. The default theme is the one that is | |
| 143 | - on your vdocipher dashboard when previewing any video. | |
| 144 | - </p> | |
| 145 | - <figure style="margin: 0"> | |
| 146 | - <img src="<?php echo plugin_dir_url(__FILE__).'img/default1.png' ?>" | |
| 147 | - style="width: 300px" alt="preview of default player"> | |
| 148 | - <figcaption>Screenshot of the default player theme</figcaption> | |
| 149 | - </figure> | |
| 150 | - </td> | |
| 151 | - </tr> | |
| 152 | - <!-- Player Theme Options end--> | |
| 153 | - | |
| 154 | - <!-- Player Watermark option - Flash/ HTML5 starts --> | |
| 155 | - <?php | |
| 156 | - $existingFlashSetting = get_option('vdo_watermark_flash_html'); | |
| 157 | - if ($existingFlashSetting === 'flash') { ?> | |
| 158 | - <tr id="vdo_watermark_html_flash" valign="top"> | |
| 159 | - <th scope="row"> Choice of Watermark </th> | |
| 160 | - <td> | |
| 161 | - <input type="radio" class="vdo-htmlflash" | |
| 162 | - value="html5" name="vdo_watermark_flash_html" | |
| 163 | - id="vdo_html5"> | |
| 164 | - <label for="vdo_html5">HTML5 (Overlay)</label> | |
| 165 | - | |
| 166 | - <input type="radio" class="vdo-htmlflash" | |
| 167 | - value="flash" name="vdo_watermark_flash_html" | |
| 168 | - id="vdo_flash" checked > | |
| 169 | - <label for="vdo_flash">Flash (Hard-Coded)</label> | |
| 170 | - <p class="description"> | |
| 171 | - IMPORTANT: Flash player is no longer supported by any modern browser. Selecting "Flash" here is | |
| 172 | - causing playback issues for your users. Please select HTML5 and "save changes" to use HTML5 | |
| 173 | - playback. This change will be irreversible. | |
| 174 | - </p> | |
| 175 | - </td> | |
| 176 | - </tr> | |
| 177 | - | |
| 178 | - <?php } ?> | |
| 179 | - | |
| 180 | - <!-- Player Watermark option - Flash/ HTML5 ends --> | |
| 33 | + | |
| 181 | 34 | <tr valign="top"> |
| 182 | - <th scope="row"><label for="vdo_watermarkjson">Annotation Statement</label></th> | |
| 35 | + <th scope="row">Annotation Statement</th> | |
| 183 | 36 | <td> |
| 184 | - <div style="display: inline-flex;"> | |
| 185 | - <textarea name="vdo_annotate_code" id="vdo_watermarkjson" rows="6" cols="55" | |
| 186 | - ><?php | |
| 187 | - if (get_option('vdo_annotate_code') != "") { | |
| 188 | - echo get_option('vdo_annotate_code'); | |
| 189 | - $vdo_annotation_code = get_option('vdo_annotate_code'); | |
| 190 | - } | |
| 191 | - ?></textarea> | |
| 192 | - <p class="description" style="margin-left:20px; position: relative"> | |
| 193 | - <span style="color:purple"><b>Sample Code for Dynamic Watermark</b></span><br/> | |
| 194 | - [{'type':'rtext', 'text':' {name}', 'alpha':'0.60', 'color':'0xFF0000','size':'15','interval':'5000'}] <br/> | |
| 195 | - <span style="color:purple"><b>Sample Code for Static Watermark</b></span><br/> | |
| 196 | - [{'type':'text', 'text':'{ip}', 'alpha':'0.5' , 'x':'10', 'y':'100', 'color':'0xFF0000', 'size':'12'}] <br/> | |
| 197 | - </p> | |
| 198 | - </div> | |
| 199 | - <p class="description" id="vdojsonvalidator"></p> | |
| 200 | - <p class="description"> | |
| 201 | - Leave this text blank in case you do not need watermark over all | |
| 202 | - videos. For details on writing the annotation code | |
| 203 | - <a href="https://www.vdocipher.com/blog/2014/12/add-text-to-videos-with-watermark/" target="_blank"> | |
| 204 | - check this out | |
| 205 | - </a> | |
| 206 | - </p> | |
| 207 | - </td> | |
| 37 | + <textarea name="vdo_annotate_code" type="textarea" rows="5" cols="60"><?php | |
| 38 | + if (get_option(vdo_annotate_code) != "") { | |
| 39 | + echo get_option(vdo_annotate_code); | |
| 40 | + } | |
| 41 | + ?></textarea> | |
| 42 | + <p class="description">Leave this text blank in case you do not need watermark over all Videos</p> | |
| 43 | + </td> | |
| 208 | 44 | </tr> |
| 209 | - <tr style="display:none;"> | |
| 210 | - <td>Plugin version no.: </td> | |
| 211 | - <td><input | |
| 212 | - id="vdo_plugin_version" name="vdo_plugin_version" type="hidden" | |
| 213 | - value="<?php echo esc_attr(get_option('vdo_plugin_version')); ?>" readonly> | |
| 214 | - </td> | |
| 215 | - </tr> | |
| 216 | - | |
| 217 | - </tbody> | |
| 218 | 45 | </table> |
| 219 | - <?php | |
| 220 | - wp_enqueue_script('vdo_validate_watermark', plugin_dir_url(__FILE__).'js/validatewatermark.js'); | |
| 221 | - wp_enqueue_script('vdo_hide_key', plugin_dir_url(__FILE__).'js/showkey.js'); | |
| 222 | - ?> | |
| 223 | 46 | <?php submit_button(); ?> |
| 224 | 47 | </form> |
| 225 | 48 | </div> |