function StreamVideoOptions() { global $site_url; $message = ''; $g = array(0 => __('Video Properties', 'stream-video-player'), 1 => __('Layout', 'stream-video-player'), 2 => __('Behavior', 'stream-video-player'), 3 => __('System', 'stream-video-player')); $options = get_option('StreamVideoSettings'); $options_lang = StreamVideoLoadDefaults(); // Process form submission if ($_POST) { for ($i = 0; $i < count($options); $i++) { foreach ((array) $options[$i] as $key => $value) { // Handle Checkboxes that don't send a value in the POST if ($value['t'] == 'cb' && !isset($_POST[$options[$i][$key]['on']])) { $options[$i][$key]['v'] = 'false'; } if ($value['t'] == 'cb' && isset($_POST[$options[$i][$key]['on']])) { $options[$i][$key]['v'] = 'true'; } // Handle all other changed values if (isset($_POST[$options[$i][$key]['on']]) && $value['t'] != 'cb') { // Fix for quotes $spval = $_POST[$options[$i][$key]['on']]; if (get_magic_quotes_gpc()) { $spval = stripslashes($spval); } $options[$i][$key]['v'] = $spval; } } } update_option('StreamVideoSettings', $options); $message = '<div class="updated"><p><strong>' . __('Options saved.', 'stream-video-player') . '</strong></p></div>'; } echo '<div class="wrap">'; echo '<h2>' . __('Stream Video Options', 'stream-video-player') . '</h2>'; echo $message; echo '<form method="post" action="admin.php?page=stream-video-player/stream-video-player.php">'; echo "<p>" . __('Here you can set some default global options for all your videos, if you need help or more information on how to encode and prepare your video to be a pseudo stream compliant check out the', 'stream-video-player') . ' <a href="http://rodrigopolo.com/about/wp-stream-video/faq" target="_blank">Plug-in ' . __('FAQs', 'stream-video-player') . '</a> ' . __('where you can find a lot of free and open resources to encode your video.', 'stream-video-player') . "</p>"; // For tests: //echo "<pre>"; //echo print_r($options); //echo "</pre>"; $options[1][2]['op'] = StreamVideoReadSkins(); // Generate the admin HTML based on the options foreach ((array) $options as $key => $value) { echo '<h3>' . $g[$key] . '</h3>' . "\n"; echo '<table class="form-table">' . "\n"; foreach ((array) $value as $sk => $setting) { echo '<tr><th scope="row">' . $options_lang[$key][$sk]['dn'] . '</th><td>' . "\n"; switch ($setting['t']) { case 'tx': echo '<input type="text" name="' . $setting['on'] . '" value="' . htmlentities($setting['v']) . '" />'; break; case 'dd': echo '<select name="' . $setting['on'] . '">'; foreach ((array) $setting['op'] as $v) { $selected = ''; if ($v == $setting['v']) { $selected = ' selected'; } echo '<option value="' . $v . '"' . $selected . '>' . $v . '</option>'; // remove ucfirst } echo '</select>'; break; case 'cb': echo '<input type="checkbox" class="check" name="' . $setting['on'] . '" '; if ($setting['v'] == 'true') { echo 'checked="checked"'; } echo ' />'; break; } echo '</td></tr>' . "\n"; } echo '</table>' . "\n"; } echo '<p class="submit"><input class="button-primary" type="submit" method="post" value="' . __('Update Options', 'stream-video-player') . '"></p>'; echo '</form>'; echo '</div>'; }
<div class="clear"> </div> <div class="col1"> <label class="info" title="<?php _e('Skin for this player', 'stream-video-player'); ?> " for="skin"><?php _e('Skin:', 'stream-video-player'); ?> </label> </div> <div class="col4"> <select name="skin" id="skin"> <?php // to load defaults foreach (StreamVideoReadSkins() as $value) { $sel = $def_options[1][2]['v'] == $value ? ' selected="selected"' : ''; echo '<option value="' . $value . '"' . $sel . '>' . ucfirst($value) . '</option>'; } ?> </select> </div> <div class="clear"> </div> <div class="col1"> <label class="info" title="<?php _e('The absolute path to your configuration XML File', 'stream-video-player'); ?> " for="config"><?php _e('Config XML:', 'stream-video-player'); ?>