| 1 |
<?php |
| 2 |
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { |
| 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>"); |
| 7 |
} |
| 8 |
?> |
| 9 |
|
| 10 |
<div class="wrap"> |
| 11 |
<h2>VdoCipher Options</h2> |
| 12 |
|
| 13 |
<form name="vdoOptionForm" method="post" action="options.php"> |
| 14 |
<?php |
| 15 |
settings_fields('vdo_option-group'); |
| 16 |
do_settings_sections('vdo_option-group'); |
| 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 |
?> |
| 24 |
<table class="form-table"> |
| 25 |
<tbody> |
| 26 |
<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> |
| 40 |
</tr> |
| 41 |
</tbody> |
| 42 |
|
| 43 |
<tbody style="display: <?= $restElementDisplay ?>"> |
| 44 |
<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> |
| 51 |
</tr> |
| 52 |
|
| 53 |
<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> |
| 61 |
</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 --> |
| 181 |
<tr valign="top"> |
| 182 |
<th scope="row"><label for="vdo_watermarkjson">Annotation Statement</label></th> |
| 183 |
<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> |
| 208 |
</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 |
</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 |
<?php submit_button(); ?> |
| 224 |
</form> |
| 225 |
</div> |
| 226 |
|