| 1 |
<?php // Silence is golden. |
| 2 |
// Control core classes for avoid errors |
| 3 |
if( class_exists( 'CSF' ) ) { |
| 4 |
|
| 5 |
add_action('admin_footer', function(){ |
| 6 |
?> |
| 7 |
<style> |
| 8 |
.bplugins-meta-readonly { /* pointer-events: none; */ opacity: 0.6; } .csf-field.bplugins-meta-readonly:hover::after { display: block; } .csf-field.bplugins-meta-readonly::before { display: block; width: 100%; height: 100%; content: ""; position: absolute; z-index: 999; overflow: hidden; top: 0; left: 0; } .csf-field.bplugins-meta-readonly::after { display: none; content: "The option is available in the pro version only"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999999; font-size: 22px; background: #673ab7; color: #fff; padding: 10px 13px; border-radius: 3px; } |
| 9 |
</style> |
| 10 |
<?php |
| 11 |
}); |
| 12 |
|
| 13 |
// |
| 14 |
// Set a unique slug-like ID |
| 15 |
$prefix = 'sc_'; |
| 16 |
|
| 17 |
// Create a metabox |
| 18 |
CSF::createMetabox( $prefix, array( |
| 19 |
'title' => 'Radio Player Configuration', |
| 20 |
'post_type' => 'streamcast', |
| 21 |
'data_type' => 'unserialize', |
| 22 |
'context' => 'normal', // The context within the screen where the boxes should display. `normal`, `side`, `advanced` |
| 23 |
) ); |
| 24 |
|
| 25 |
// |
| 26 |
// Create a section |
| 27 |
CSF::createSection( $prefix, array( |
| 28 |
'title' => 'Required fields are marked with an * (asterisk)', |
| 29 |
'fields' => array( |
| 30 |
array( |
| 31 |
'id' => 'opt-radio', |
| 32 |
'type' => 'radio', |
| 33 |
'title' => 'Radio Player Type *', |
| 34 |
'desc' => esc_html__( 'You must choose radio player type first to get related settings fields.', 'streamcast' ), |
| 35 |
'options' => array( |
| 36 |
'plyr' => 'Minimal', |
| 37 |
'standard' => 'Standard', |
| 38 |
'advanced' => 'Advanced', |
| 39 |
'ultimate' => 'Ultimate', |
| 40 |
), |
| 41 |
'default' => 'ultimate', |
| 42 |
'inline' => true, |
| 43 |
), |
| 44 |
|
| 45 |
|
| 46 |
array( |
| 47 |
'id' => 'stream_url', |
| 48 |
'type' => 'text', |
| 49 |
'dependency' => array( 'opt-radio', '!=', 'ultimate' ), |
| 50 |
'title' => esc_html__( 'Stream URL*', 'streamcast' ), |
| 51 |
'button_title' => esc_html__( 'Add or Upload File', 'streamcast' ), |
| 52 |
'remove_title' => esc_html__( 'Remove Mp3', 'streamcast' ), |
| 53 |
), |
| 54 |
|
| 55 |
|
| 56 |
array( |
| 57 |
'id' => 'station_name', |
| 58 |
'type' => 'text', |
| 59 |
'class' => 'bplugins-meta-readonly', |
| 60 |
'dependency' => array( 'opt-radio|opt-radio', '!=|!=', 'plyr|ultimate' ), |
| 61 |
'title' => esc_html__( 'Station Name*', 'streamcast' ), |
| 62 |
), |
| 63 |
array( |
| 64 |
'id' => 'welcome_msgs', |
| 65 |
'type' => 'text', |
| 66 |
'dependency' => array( 'opt-radio|opt-radio', '!=|!=', 'plyr|ultimate' ), |
| 67 |
'class' => 'bplugins-meta-readonly', |
| 68 |
'title' => esc_html__( 'Welcome Message*', 'streamcast' ), |
| 69 |
), |
| 70 |
array( |
| 71 |
'id' => 'player_skin', |
| 72 |
'type' => 'select', |
| 73 |
'title' => esc_html__( 'Skin', 'streamcast' ), |
| 74 |
'default' => 'mcclean', |
| 75 |
'dependency' => array( 'opt-radio', '==', 'standard' ), |
| 76 |
'class' => 'bplugins-meta-readonly', |
| 77 |
'options' => array( |
| 78 |
'' => '==Official Skins==', |
| 79 |
'mcclean' => 'McClean (180x60)', |
| 80 |
'radiovoz' => 'RadioVoz (220x69)', |
| 81 |
'faredirfare' => 'Faredirfare (269x52)', |
| 82 |
'tweety' => 'Tweety (189x62)', |
| 83 |
'compact' => 'Compact (191x46)', |
| 84 |
'cassette' => 'Tim Simz - Cassette (200x120)', |
| 85 |
'repvku-100' => 'Repvku-100 (100x25)', |
| 86 |
'darkconsole' => 'DarkConsole (190x62)', |
| 87 |
'tiny' => 'Tiny (130x60)', |
| 88 |
'universelle' => 'Universelle (155x65)', |
| 89 |
'uuskin' => 'UUSkin (166x83)', |
| 90 |
'e76' => 'E76 (130x75)', |
| 91 |
'original' => 'Original (329x21)', |
| 92 |
'arvyskin' => 'Arvy Skin [M] (560x30)', |
| 93 |
'eastanbul' => 'Eastanbul (467x26)', |
| 94 |
'substream' => 'Substream (180x30)', |
| 95 |
'banita' => 'BANita (110x25)', |
| 96 |
'listen-live' => 'Listen Live (250x100)', |
| 97 |
'easyplay' => 'EasyPlay (231x30)', |
| 98 |
'stockblue' => 'Stockblue (476x26)', |
| 99 |
'largebayfm' => 'LargeBayFM (451x90)', |
| 100 |
'simple-blue' => 'Simple Blue [M] (300x122)', |
| 101 |
'simple-gray' => 'Simple Gray [M] (300x122)', |
| 102 |
'simple-green' => 'Simple Green [M] (300x122)', |
| 103 |
'simple-orange' => 'Simple Orange [M] (300x122)', |
| 104 |
'simple-red' => 'Simple Red [M] (300x122)', |
| 105 |
'simple-violet' => 'Simple Violet [M] (300x122)', |
| 106 |
'scradio'=>'SCRadio (160x100)', |
| 107 |
'repvku-115'=>'Repvku-115 (115x25)', |
| 108 |
'rb1'=>'RB1 (250x70)', |
| 109 |
'tandem-115'=>'Tandem-115 (115x25)', |
| 110 |
'simcha-232-toggle'=>'Simcha-232 [T] (232x58)', |
| 111 |
'simcha-232'=>'Simcha-232 (232x58)', |
| 112 |
'simcha-320'=>'Simcha-320 (320x58)', |
| 113 |
'kplayer'=>'KPlayer (220x200)', |
| 114 |
'appy'=>'Appy [T] (250x213)', |
| 115 |
'blueberry'=>'Blueberry (338x102)', |
| 116 |
'oldradio'=>'OldRadio (205x132)', |
| 117 |
'oldradio-christmas'=>'OldRadio Christmas (205x132)', |
| 118 |
'oldstereo'=>'OldStereo (318x130)', |
| 119 |
'xm'=>'Xm (234x66)', |
| 120 |
'abrahadabra'=>'Abrahadabra (100x141)', |
| 121 |
'abrahadabra2'=>'Abrahadabra 2 (100x141)', |
| 122 |
'wmp'=>'WMP (386x47)', |
| 123 |
'radioport'=>'Radioport (700x150)', |
| 124 |
'alberto'=>'Alberto (250x95)', |
| 125 |
'ff'=>'FF (288x68)', |
| 126 |
'neon'=>'Neon (240x76)', |
| 127 |
'player-stm'=>'Player STM (128x30)', |
| 128 |
'neonslim'=>'NeonSlim (501x32)', |
| 129 |
'greyslim'=>'GreySlim (494x35)', |
| 130 |
'demon'=>'Demon (468x117)', |
| 131 |
'xavi'=>'Xavi (250x95)', |
| 132 |
'xavi2'=>'Xavi2 (95x95)', |
| 133 |
'xavi3'=>'Xavi3 (250x95)', |
| 134 |
'minimal'=>'Minimal (220x80)', |
| 135 |
'grind'=>'Grind (400x336)', |
| 136 |
'cpr-180'=>'CPR-180 (180x40)', |
| 137 |
'ammascota'=>'Am Mascota (290x100)', |
| 138 |
'miniradio'=>'MiniRadio (275x112)', |
| 139 |
'myradio'=>'My Radio (262x165)', |
| 140 |
'terawhite'=>'Terawhite (255x100)', |
| 141 |
'kelabu-yellow'=>'Kelabu Yellow (253x100)', |
| 142 |
'cristal'=>'Cristal (300x113)', |
| 143 |
'bintang'=>'Bintang (300x113)', |
| 144 |
'tatarradiosi'=>'Tatar Radiosi (418x150)', |
| 145 |
'redsradiosml'=>'Reds Radio SML (500x158)', |
| 146 |
'bogusblue'=>'BogusBlue (660x266)', |
| 147 |
'bones'=>'Bones (341x125)', |
| 148 |
'combat'=>'Combat (675x247)', |
| 149 |
'dragonblues'=>'DragonBlues (400x145)', |
| 150 |
'lemon'=>'Lemon (410x60)', |
| 151 |
'limed'=>'Limed (397x115)', |
| 152 |
'longtail'=>'Longtail (498x61)', |
| 153 |
'pinhead'=>'Pinhead (421x120)', |
| 154 |
'retro'=>'Retro (669x259)', |
| 155 |
'silvertune'=>'Silvertune (200x104)', |
| 156 |
'testskin'=>'Test/Develop (189x61)', |
| 157 |
'retromatic'=>'Retromatic (700x150)', |
| 158 |
'retromaticsmall'=>'Retromatic Small (298x150)', |
| 159 |
'e90'=>'E90 (190x59)', |
| 160 |
'shmusic'=>'SH Music (300x190)', |
| 161 |
'brujulalatina'=>'Brújula Latina (330x100)', |
| 162 |
'adn'=>'ADN (700x150)', |
| 163 |
|
| 164 |
) |
| 165 |
), |
| 166 |
|
| 167 |
array( |
| 168 |
'id' => 'autoplay', |
| 169 |
'type' => 'switcher', |
| 170 |
'dependency' => array( 'opt-radio', '==', 'standard' ), |
| 171 |
'title' => esc_html__( 'Auto Play', 'streamcast' ), |
| 172 |
'class' => 'bplugins-meta-readonly', |
| 173 |
'default' => true // or false |
| 174 |
), |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
array( |
| 179 |
'id' => 'volume', |
| 180 |
'type' => 'spinner', |
| 181 |
'dependency' => array( 'opt-radio', '==', 'standard' ), |
| 182 |
'title' => esc_html__( 'Initial Volume', 'streamcast' ), |
| 183 |
'class' => 'bplugins-meta-readonly', |
| 184 |
'default' => '65', |
| 185 |
'min' => '0', |
| 186 |
'max' => '100', |
| 187 |
'unit' => '%', |
| 188 |
), |
| 189 |
|
| 190 |
array( |
| 191 |
'id' => 'artwork', |
| 192 |
'type' => 'upload', |
| 193 |
'dependency' => array( 'opt-radio', '==', 'advanced' ), |
| 194 |
'title' => esc_html__( 'ArtWork', 'streamcast' ), |
| 195 |
'button_title' => esc_html__( 'Add or Upload Artwork Image', 'streamcast' ), |
| 196 |
'remove_title' => esc_html__( 'Remove', 'streamcast' ), |
| 197 |
'class' => 'bplugins-meta-readonly', |
| 198 |
'desc' => esc_html__( '94x94 px photo is the standard artwork size, accepted file type .png, .jpeg, .jpg ', 'streamcast' ), |
| 199 |
), |
| 200 |
array( |
| 201 |
'id' => 'autoplay', |
| 202 |
'type' => 'switcher', |
| 203 |
'dependency' => array( 'opt-radio', '==', 'advanced' ), |
| 204 |
'title' => esc_html__( 'Auto Play', 'streamcast' ), |
| 205 |
'class' => 'bplugins-meta-readonly', |
| 206 |
'default' => true // or false |
| 207 |
), |
| 208 |
array( |
| 209 |
'id' => 'volume', |
| 210 |
'type' => 'spinner', |
| 211 |
'dependency' => array( 'opt-radio', '==', 'advanced' ), |
| 212 |
'title' => esc_html__( 'Initial Volume', 'streamcast' ), |
| 213 |
'class' => 'bplugins-meta-readonly', |
| 214 |
'default' => '65', |
| 215 |
'min' => '0', |
| 216 |
'max' => '100', |
| 217 |
'unit' => '%', |
| 218 |
), |
| 219 |
array( |
| 220 |
'id' => 'timeholder', |
| 221 |
'type' => 'switcher', |
| 222 |
'class' => 'bplugins-meta-readonly', |
| 223 |
'dependency' => array( 'opt-radio', '==', 'advanced' ), |
| 224 |
'title' => esc_html__( 'Show Time', 'streamcast' ), |
| 225 |
'default' => true // or false |
| 226 |
), |
| 227 |
array( |
| 228 |
'id' => 'background', |
| 229 |
'type' => 'color', |
| 230 |
'class' => 'bplugins-meta-readonly', |
| 231 |
'dependency' => array( 'opt-radio', '==', 'advanced' ), |
| 232 |
'title' => esc_html__( 'Background color', 'streamcast' ), |
| 233 |
'default' => '#f09f8b' // or false |
| 234 |
), |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
array( |
| 239 |
'id' => 'player_postiion', |
| 240 |
'type' => 'radio', |
| 241 |
'title' => 'Player Position', |
| 242 |
'class' => 'bplugins-meta-readonly', |
| 243 |
'dependency' => array( 'opt-radio|opt-radio', '!=|!=', 'standard|ultimate' ), |
| 244 |
'options' => array( |
| 245 |
'left' => 'Left', |
| 246 |
'' => 'Center', |
| 247 |
'right' => 'Right', |
| 248 |
|
| 249 |
), |
| 250 |
'default' => '', |
| 251 |
'inline' => true |
| 252 |
), |
| 253 |
|
| 254 |
// Ultimate |
| 255 |
|
| 256 |
|
| 257 |
array( |
| 258 |
'id' => 'streamProvider', |
| 259 |
'type' => 'button_set', |
| 260 |
'title' => 'Stream Provider *', |
| 261 |
'options' => array( |
| 262 |
'shout-cast' => 'SHOUT cast', |
| 263 |
'ice-cast' => 'Ice cast', |
| 264 |
'other' => 'Other' |
| 265 |
), |
| 266 |
'default' => 'shout-cast', |
| 267 |
'dependency' => array( 'opt-radio', '==', 'ultimate' ), |
| 268 |
), |
| 269 |
|
| 270 |
array( |
| 271 |
'id' => 'streamURL', |
| 272 |
'type' => 'text', |
| 273 |
'title' => 'Stream URL *', |
| 274 |
'default' => 'http://74.208.71.58', |
| 275 |
'dependency' => array( 'opt-radio', '==', 'ultimate' ), |
| 276 |
), |
| 277 |
|
| 278 |
array( |
| 279 |
'id' => 'streamPort', |
| 280 |
'type' => 'number', |
| 281 |
'title' => 'Stream Port *', |
| 282 |
'default' => '8000', |
| 283 |
'dependency' => array( 'opt-radio|streamProvider', '==|!=', 'ultimate|other' ), |
| 284 |
), |
| 285 |
|
| 286 |
array( |
| 287 |
'id' => 'streamMountPoint', |
| 288 |
'type' => 'text', |
| 289 |
'title' => 'Stream Mount Point *', |
| 290 |
'dependency' => array( 'streamProvider|opt-radio', '==|==', 'ice-cast|ultimate' ), |
| 291 |
'default' => 'house.320k.mp3', |
| 292 |
), |
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
array( |
| 297 |
'id' => 'radioName', |
| 298 |
'type' => 'text', |
| 299 |
'title' => 'Station Name', |
| 300 |
'default' => 'Station Name', |
| 301 |
'dependency' => array( 'opt-radio', '==', 'ultimate' ), |
| 302 |
), |
| 303 |
|
| 304 |
// Customization |
| 305 |
array( |
| 306 |
'id' => 'playerWidth', |
| 307 |
'type' => 'text', |
| 308 |
'title' => 'Player Width', |
| 309 |
'default' => '1100px', |
| 310 |
'dependency' => array( 'opt-radio', '==', 'ultimate' ), |
| 311 |
), |
| 312 |
array( |
| 313 |
'id' => 'radioImage', |
| 314 |
'library' => 'image', |
| 315 |
'type' => 'media', |
| 316 |
'title' => 'Poster Image', |
| 317 |
'dependency' => array( 'opt-radio', '==', 'ultimate' ), |
| 318 |
), |
| 319 |
|
| 320 |
array( |
| 321 |
'id' => 'bgImage', |
| 322 |
'library' => 'image', |
| 323 |
'type' => 'media', |
| 324 |
'class' => 'bplugins-meta-readonly', |
| 325 |
'title' => 'Player Background Image', |
| 326 |
'dependency' => array( 'opt-radio', '==', 'ultimate' ), |
| 327 |
), |
| 328 |
|
| 329 |
array( |
| 330 |
'id' => 'playerColors', |
| 331 |
'type' => 'button_set', |
| 332 |
'title' => 'Player Colors', |
| 333 |
'options' => array( |
| 334 |
'theme' => 'Theme', |
| 335 |
'custom' => 'Custom Color', |
| 336 |
), |
| 337 |
'default' => 'theme', |
| 338 |
'class' => 'bplugins-meta-readonly', |
| 339 |
'dependency' => array( 'opt-radio', '==', 'ultimate' ), |
| 340 |
), |
| 341 |
|
| 342 |
// Themes |
| 343 |
array( |
| 344 |
'id' => 'playerThemes', |
| 345 |
'type' => 'button_set', |
| 346 |
'title' => 'Player Themes', |
| 347 |
'options' => array( |
| 348 |
'dodgerBlue' => 'Dodger Blue', |
| 349 |
'bittersweet' => 'Bittersweet', |
| 350 |
'lightSeaGreen' => 'Light Sea Green', |
| 351 |
), |
| 352 |
'dependency' => array( 'playerColors|opt-radio', '==|==', 'theme|ultimate' ), |
| 353 |
'default' => 'dodgerBlue', |
| 354 |
'class' => 'bplugins-meta-readonly', |
| 355 |
), |
| 356 |
|
| 357 |
// Custom Colors |
| 358 |
array( |
| 359 |
'id' => 'playerOverlayColor', |
| 360 |
'type' => 'color', |
| 361 |
'title' => 'Player Overlay Color', |
| 362 |
'dependency' => array( 'playerColors|opt-radio', '==|==', 'custom|ultimate' ), |
| 363 |
'class' => 'bplugins-meta-readonly', |
| 364 |
'default' => 'rgba(15, 17, 21, 0.5)', |
| 365 |
), |
| 366 |
array( |
| 367 |
'id' => 'imgBorderColor', |
| 368 |
'type' => 'color', |
| 369 |
'title' => 'Thumbnail Border Color', |
| 370 |
'dependency' => array( 'playerColors|opt-radio', '==|==', 'custom|ultimate' ), |
| 371 |
'class' => 'bplugins-meta-readonly', |
| 372 |
'default' => 'rgba(255, 255, 255, 0.2)', |
| 373 |
), |
| 374 |
array( |
| 375 |
'id' => 'contentColor', |
| 376 |
'type' => 'color', |
| 377 |
'title' => 'Content Color', |
| 378 |
'dependency' => array( 'playerColors|opt-radio', '==|==', 'custom|ultimate' ), |
| 379 |
'class' => 'bplugins-meta-readonly', |
| 380 |
'default' => '#fff', |
| 381 |
), |
| 382 |
array( |
| 383 |
'id' => 'btnHoverColor', |
| 384 |
'type' => 'color', |
| 385 |
'title' => 'Button Hover Color', |
| 386 |
'dependency' => array( 'playerColors|opt-radio', '==|==', 'custom|ultimate' ), |
| 387 |
'class' => 'bplugins-meta-readonly', |
| 388 |
'default' => 'orangered', |
| 389 |
), |
| 390 |
array( |
| 391 |
'id' => 'progressColor', |
| 392 |
'type' => 'color', |
| 393 |
'title' => 'Progress Active Color', |
| 394 |
'dependency' => array( 'playerColors|opt-radio', '==|==', 'custom|ultimate' ), |
| 395 |
'class' => 'bplugins-meta-readonly', |
| 396 |
'default' => 'orangered', |
| 397 |
), |
| 398 |
array( |
| 399 |
'id' => 'visualizerColor', |
| 400 |
'type' => 'color', |
| 401 |
'title' => 'Visualizer Color', |
| 402 |
'dependency' => array( 'playerColors|opt-radio', '==|==', 'custom|ultimate' ), |
| 403 |
'default' => 'orangered', |
| 404 |
'class' => 'bplugins-meta-readonly', |
| 405 |
), |
| 406 |
|
| 407 |
array( |
| 408 |
'id' => 'custom_css', |
| 409 |
'type' => 'code_editor', |
| 410 |
'title' => 'Custom CSS', |
| 411 |
'desc' => 'This field is optional. ', |
| 412 |
'default' => '/* Your Custom CSS here */', |
| 413 |
'class' => 'bplugins-meta-readonly', |
| 414 |
'sanitize' => false, |
| 415 |
'settings' => array( |
| 416 |
'mode' => 'css', |
| 417 |
), |
| 418 |
|
| 419 |
), |
| 420 |
) |
| 421 |
) ); |
| 422 |
} |
| 423 |
|
| 424 |
|
| 425 |
function streamcast_exclude_fields_before_save( $data ) { |
| 426 |
|
| 427 |
$exclude = array( |
| 428 |
'station_name', |
| 429 |
'welcome_msgs', |
| 430 |
'player_skin', |
| 431 |
'autoplay', |
| 432 |
'volume', |
| 433 |
'artwork', |
| 434 |
'timeholder', |
| 435 |
'background', |
| 436 |
'player_postiion', |
| 437 |
'custom_css', |
| 438 |
); |
| 439 |
|
| 440 |
foreach ( $exclude as $id ) { |
| 441 |
unset( $data[$id] ); |
| 442 |
} |
| 443 |
|
| 444 |
return $data; |
| 445 |
|
| 446 |
} |
| 447 |
|
| 448 |
add_filter( 'csf_sc__save', 'streamcast_exclude_fields_before_save', 10, 1 ); |