/**
  * Prepare options for select elements, or prepare many checkbox or radio buttons
  *
  * @uses SCPT_Markup::tag
  * @param array $options The options as either an array of values or associative array of values => labels
  * @param string $meta_key The meta_key for this element
  * @param array $post_meta The stored post meta
  * @param array $default_args Optional. The default arguments to attach to this HTML element
  * @param string $tag Optional. The HTML tag we're creating
  * @return array of HTML elements
  * @author Matthew Boynes
  */
 public function prune_options($options, $meta_key, $post_meta, $default_args = array(), $tag = 'option')
 {
     $has_values = $this->is_assoc($options) || !isset($options[0]);
     # Allow developers to hook into this before the HTML is generated to override it
     $html = apply_filters('scpt_plugin_custom_meta_pre_' . $meta_key . '_options', array());
     if (!empty($html)) {
         return $html;
     }
     foreach ($options as $key => $option) {
         $this_args = $default_args;
         $this_args['value'] = $has_values ? $key : $option;
         if (isset($this_args['id'])) {
             $this_args['id'] .= "_{$key}";
         }
         if ('input' == $tag) {
             if (isset($post_meta[$meta_key]) && in_array($this_args['value'], $post_meta[$meta_key])) {
                 $this_args['checked'] = 'checked';
             }
             $html[] = SCPT_Markup::tag('label', array('for' => $this_args['id'], 'class' => 'scpt-meta-label choice scpt-meta-' . $this_args['type'] . ' label-' . $meta_key), SCPT_Markup::tag('input', $this_args) . ' ' . $option);
         } else {
             if (isset($post_meta[$meta_key]) && in_array($this_args['value'], $post_meta[$meta_key])) {
                 $this_args['selected'] = 'selected';
             }
             $html[] = SCPT_Markup::tag('option', $this_args, $option);
         }
     }
     return apply_filters('scpt_plugin_custom_meta_' . $meta_key . '_options', $html);
 }