} echo '>' . __('Video or Playlist', 'youtube-embed') . '</option><option value="s"'; if (attribute_escape($instance['id_type']) == 's') { echo " selected='selected'"; } echo '>' . __('Search', 'youtube-embed') . '</option><option value="u"'; if (attribute_escape($instance['id_type']) == 'u') { echo " selected='selected'"; } echo '>' . __('User', 'youtube-embed') . '</option></select></td></tr>'; echo "</table>\n"; // Profile field $field_id = $this->get_field_id('profile'); $field_name = $this->get_field_name('profile'); echo "\r\n" . '<p><label for="' . $field_id . '">' . __('Profile', 'youtube-embed') . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '">'; vye_generate_profile_list(attribute_escape($instance['profile']), $general['profile_no']); echo '</select></p>'; // Template $field_id = $this->get_field_id('template'); $field_name = $this->get_field_name('template'); echo "\r\n" . '<p><label for="' . $field_id . '">' . __('Template', 'youtube-embed') . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape($instance['template']) . '" /></p>'; // Style $field_id = $this->get_field_id('style'); $field_name = $this->get_field_name('style'); echo "\r\n" . '<p><label for="' . $field_id . '">' . __('Style', 'youtube-embed') . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape($instance['style']) . '" /></p>'; // Size fields $field_id = $this->get_field_id('width'); $field_name = $this->get_field_name('width'); echo "\r\n" . '<p><label for="' . $field_id . '">' . __('Size', 'youtube-embed') . ': </label><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape($instance['width']) . '" /> x '; $field_id = $this->get_field_id('height'); $field_name = $this->get_field_name('height');
if (!empty($_POST['Video'])) { $video_type = $_POST['youtube_embed_video_type']; } else { $video_type = 'd'; } // Generate Profile list ?> <form method="post" action="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=ye-profile-options'; ?> "> <span class="alignright"> <select name="youtube_embed_profile_no"> <?php vye_generate_profile_list($profile_no, $general['profile_no'], true); ?> </select> <input type="submit" name="Profile" class="button-secondary" value="<?php _e('Change profile', 'youtube-embed'); ?> "/> </span><br/> <?php // Show explanatory message at top of screen if ($profile_no == '0') { _e('These are the options for the default profile.', 'youtube-embed'); } else { sprintf(_e('These are the options for profile %s.', 'youtube-embed'), $profile_no); }
/** * Widget Admin control form * * Define admin file * * @since 2.0 * * @param string $instance Instance */ function form($instance) { // Set default options $default = array('titles' => 'YouTube', 'id' => '', 'profile' => '', 'start' => '', 'list' => '', 'stop' => '', 'id_type' => 'v'); $instance = wp_parse_args((array) $instance, $default); $general = vye_set_general_defaults(); // Widget Title field $field_id = $this->get_field_id('titles'); $field_name = $this->get_field_name('titles'); echo "\r\n" . '<p><label for="' . $field_id . '">' . __('Widget Title', 'youtube-embed') . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape($instance['titles']) . '" /></p>'; // Video ID field $field_id = $this->get_field_id('id'); $field_name = $this->get_field_name('id'); echo "\r\n" . '<p><label for="' . $field_id . '">' . __('Video ID', 'youtube-embed') . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape($instance['id']) . '" /></p>'; // ID Type echo "<table>\n"; $field_id = $this->get_field_id('id_type'); $field_name = $this->get_field_name('id_type'); echo "\r\n" . '<tr><td width="100%">' . __('ID Type', 'youtube-embed') . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value="v"'; if (attribute_escape($instance['id_type']) == 'v') { echo " selected='selected'"; } echo '>' . __('Video or Playlist', 'youtube-embed') . '</option><option value="s"'; if (attribute_escape($instance['id_type']) == 's') { echo " selected='selected'"; } echo '>' . __('Search', 'youtube-embed') . '</option><option value="u"'; if (attribute_escape($instance['id_type']) == 'u') { echo " selected='selected'"; } echo '>' . __('User', 'youtube-embed') . '</option></select></td></tr>'; echo "</table>\n"; // Profile field $field_id = $this->get_field_id('profile'); $field_name = $this->get_field_name('profile'); echo "\r\n" . '<p><label for="' . $field_id . '">' . __('Profile', 'youtube-embed') . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '">'; vye_generate_profile_list(attribute_escape($instance['profile']), $general['profile_no']); echo '</select></p>'; echo "<table>\n"; // Start field $field_id = $this->get_field_id('start'); $field_name = $this->get_field_name('start'); echo "\r\n" . '<tr><td width="100%">' . __('Start (seconds)', 'youtube-embed') . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape($instance['start']) . '" /></td></tr>'; // Stop field $field_id = $this->get_field_id('stop'); $field_name = $this->get_field_name('stop'); echo "\r\n" . '<tr><td width="100%">' . __('Stop (seconds)', 'youtube-embed') . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape($instance['stop']) . '" /></td></tr>'; echo "</table><table>\n"; // List field $field_id = $this->get_field_id('list'); $field_name = $this->get_field_name('list'); echo "\r\n" . '<tr><td width="100%">' . __('List Playback', 'youtube-embed') . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""'; if (attribute_escape($instance['list']) == '') { echo " selected='selected'"; } echo '>' . __('Profile default', 'youtube-embed') . '</option><option value="order"'; if (attribute_escape($instance['list']) == 'order') { echo " selected='selected'"; } echo '>' . __('Play each video in order', 'youtube-embed') . '</option><option value="random"'; if (attribute_escape($instance['list']) == 'random') { echo " selected='selected'"; } echo '>' . __('Play videos randomly', 'youtube-embed') . '</option><option value="single"'; if (attribute_escape($instance['list']) == 'single') { echo " selected='selected'"; } echo '>' . __('Play one random video', 'youtube-embed') . '</option></select></td></tr>'; echo "</table>\n"; }
<p class="description"><?php _e('An alternative shortcode to use.', 'youtube-embed'); ?> </p></td> </tr> <!-- Alternative Shortcode Profile --> <tr> <th scope="row"> <?php _e('Profile to use', 'youtube-embed'); ?> </th> <td><label for="youtube_embed_alt_profile"><select name="youtube_embed_alt_profile"> <?php vye_generate_profile_list($options['alt_profile'], $options['profile_no']); ?> </select></label></td> </tr> <!-- Shortcode Re-Use Prompt --> <tr> <th scope="row"><?php _e('Show Shortcode Re-use Prompt', 'youtube-embed'); ?> </th> <td><label for="youtube_embed_prompt"><input type="checkbox" name="youtube_embed_prompt" value="1"<?php if ($options['prompt'] == "1") { echo ' checked="checked"'; }