| @@ -1,8 +1,8 @@ | ||
| 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 | ?> |
| @@ -14,176 +14,153 @@ | ||
| 14 | 14 | <?php |
| 15 | 15 | settings_fields('vdo_option-group'); |
| 16 | 16 | do_settings_sections('vdo_option-group'); |
| 17 | 17 | ?> |
| 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 | - ?> | |
| 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> | |
| 24 | 21 | <table class="form-table"> |
| 25 | - <tbody> | |
| 26 | 22 | <tr valign="top"> |
| 27 | - <th scope="row"><label for="vdo_client_key">API Secret Key</label></th> | |
| 23 | + <th scope="row">API Secret Key</th> | |
| 28 | 24 | <td> |
| 29 | 25 | <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> | |
| 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> | |
| 34 | 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 | 35 | </td> |
| 40 | 36 | </tr> |
| 41 | - </tbody> | |
| 42 | 37 | |
| 43 | - <tbody style="display: <?= $restElementDisplay ?>"> | |
| 44 | 38 | <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')); ?>" | |
| 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')); ?>" | |
| 50 | 42 | /></td> |
| 51 | 43 | </tr> |
| 52 | 44 | |
| 53 | 45 | <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> | |
| 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> | |
| 61 | 50 | </tr> |
| 62 | 51 | |
| 63 | - <tr> | |
| 64 | - <th scope="row"><label for="vdo_player_speed">Playback speed</label></th> | |
| 52 | + <!-- Version Number --> | |
| 53 | + <?php | |
| 54 | + if ((get_option('vdo_embed_version')) == false) { | |
| 55 | + update_option('vdo_embed_version', VDOCIPHER_PLAYER_VERSION); | |
| 56 | + } | |
| 57 | + ?> | |
| 58 | + <tr valign="top"> | |
| 59 | + <th scope="row">Player Version</th> | |
| 65 | 60 | <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> | |
| 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> | |
| 71 | 99 | </td> |
| 72 | 100 | </tr> |
| 73 | 101 | |
| 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 | 102 | <!-- Player Theme Options --> |
| 108 | 103 | <?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> | |
| 104 | + if (!(get_option('vdo_player_theme'))) { | |
| 105 | + update_option('vdo_player_theme', '9ae8bbe8dd964ddc9bdb932cca1cb59a'); | |
| 106 | + } | |
| 107 | + ?> | |
| 108 | + <tr valign="top"> | |
| 109 | + <th scope="row">Player Theme</th> | |
| 117 | 110 | <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> | |
| 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 | + | |
| 150 | 128 | </td> |
| 151 | 129 | </tr> |
| 152 | 130 | <!-- Player Theme Options end--> |
| 153 | 131 | |
| 154 | 132 | <!-- 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 | - | |
| 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 | + | |
| 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> | |
| 180 | 156 | <!-- Player Watermark option - Flash/ HTML5 ends --> |
| 181 | 157 | <tr valign="top"> |
| 182 | - <th scope="row"><label for="vdo_watermarkjson">Annotation Statement</label></th> | |
| 158 | + <th scope="row">Annotation Statement</th> | |
| 183 | 159 | <td> |
| 184 | 160 | <div style="display: inline-flex;"> |
| 185 | - <textarea name="vdo_annotate_code" id="vdo_watermarkjson" rows="6" cols="55" | |
| 161 | + <textarea name="vdo_annotate_code" id="vdo_watermarkjson" | |
| 162 | + type="textarea" rows="6" cols="55" style="display: float-left" | |
| 186 | 163 | ><?php |
| 187 | 164 | if (get_option('vdo_annotate_code') != "") { |
| 188 | 165 | echo get_option('vdo_annotate_code'); |
| 189 | 166 | $vdo_annotation_code = get_option('vdo_annotate_code'); |
| @@ -208,18 +185,24 @@ | ||
| 208 | 185 | </tr> |
| 209 | 186 | <tr style="display:none;"> |
| 210 | 187 | <td>Plugin version no.: </td> |
| 211 | 188 | <td><input |
| 212 | - id="vdo_plugin_version" name="vdo_plugin_version" type="hidden" | |
| 189 | + id="vdo_plugin_version" name="vdo_plugin_version" | |
| 213 | 190 | value="<?php echo esc_attr(get_option('vdo_plugin_version')); ?>" readonly> |
| 214 | 191 | </td> |
| 215 | 192 | </tr> |
| 216 | - | |
| 217 | - </tbody> | |
| 218 | 193 | </table> |
| 219 | 194 | <?php |
| 220 | 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'); | |
| 221 | 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 | + )); | |
| 222 | 205 | ?> |
| 223 | 206 | <?php submit_button(); ?> |
| 224 | 207 | </form> |
| 225 | 208 | </div> |