/**
 * Renders HTML code for Package dropdown.
 *
 * @param	arr		$settings		See @$defaults
 * @param	bool	$structure		True to echo the select field structure, false just returns options.
 * @return	HTML output for select field
 */
function mdjm_package_dropdown($args = array(), $structure = true)
{
    global $current_user;
    $defaults = array('name' => '_mdjm_event_package', 'id' => '', 'class' => '', 'selected' => '', 'first_entry' => '', 'first_entry_val' => '', 'employee' => is_user_logged_in() && !current_user_can('client') ? $current_user->ID : '', 'event_type' => false, 'event_date' => false, 'titles' => true, 'cost' => true, 'required' => false);
    $args = wp_parse_args($args, $defaults);
    // For backwards compatibility
    if (isset($args['dj'])) {
        $args['employee'] = $args['dj'];
    }
    $args['required'] = !empty($args['required']) ? ' required' : '';
    $args['id'] = !empty($args['id']) ? $args['id'] : $args['name'];
    $output = '';
    if ($structure) {
        $output = sprintf('<select name="%s" id="%s" class="%s"%s>', esc_attr($args['name']), esc_attr(mdjm_sanitize_key($args['id'])), sanitize_html_class($args['class']), $args['required']) . "\n";
    }
    $args = array_merge($args, array('show_option_none' => !empty($args['first_entry']) ? $args['first_entry'] : false, 'show_option_all' => false, 'options_only' => true, 'blank_first' => false));
    $output .= MDJM()->html->packages_dropdown($args);
    if ($structure) {
        $output .= '</select>' . "\n";
    }
    return $output;
}
 /**
  * Renders an HTML Number field
  *
  * @since	1.3.7
  *
  * @param	arr		$args	Arguments for the text field
  * @return	str		Text field
  */
 public function number($args = array())
 {
     $defaults = array('id' => '', 'name' => isset($name) ? $name : 'text', 'value' => isset($value) ? $value : null, 'label' => isset($label) ? $label : null, 'desc' => isset($desc) ? $desc : null, 'placeholder' => '', 'class' => 'small-text', 'min' => '', 'max' => '', 'disabled' => false, 'autocomplete' => '', 'data' => false);
     $args = wp_parse_args($args, $defaults);
     $args['id'] = !empty($args['id']) ? $args['id'] : $args['name'];
     $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
     $disabled = '';
     if ($args['disabled']) {
         $disabled = ' disabled="disabled"';
     }
     $data = '';
     if (!empty($args['data'])) {
         foreach ($args['data'] as $key => $value) {
             $data .= 'data-' . mdjm_sanitize_key($key) . '="' . esc_attr($value) . '" ';
         }
     }
     $min = !empty($args['min']) ? ' min="' . $args['min'] . '"' : '';
     $max = !empty($args['max']) ? ' max="' . $args['max'] . '"' : '';
     if ($max > 5) {
         $max = 5;
     }
     $output = '<span id="mdjm-' . mdjm_sanitize_key($args['name']) . '-wrap">';
     $output .= '<label for="' . mdjm_sanitize_key($args['id']) . '">' . esc_html($args['label']) . '</label>';
     if (!empty($args['desc'])) {
         $output .= '<span class="mdjm-description">' . esc_html($args['desc']) . '</span>';
     }
     $output .= '<input type="number" name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['id']) . '" autocomplete="' . esc_attr($args['autocomplete']) . '" value="' . esc_attr($args['value']) . '" placeholder="' . esc_attr($args['placeholder']) . '" class="' . $class . '" ' . $data . '' . $min . '' . $max . '' . $disabled . '/>';
     $output .= '</span>';
     return $output;
 }
/**
 * Gateways Callback (drop down)
 *
 * Renders gateways select menu
 *
 * @since	1.8
 * @param	arr		$args	Arguments passed by the setting
 * @global	$mdjm_options	Array of all the MDJM Options
 * @return	void
 */
function mdjm_gateway_select_callback($args)
{
    $mdjm_option = mdjm_get_option($args['id']);
    $html = '';
    $html .= '<select name="mdjm_settings[' . mdjm_sanitize_key($args['id']) . ']" id="mdjm_settings[' . mdjm_sanitize_key($args['id']) . ']">';
    foreach ($args['options'] as $key => $option) {
        $selected = isset($mdjm_option) ? selected($key, $mdjm_option, false) : '';
        $html .= '<option value="' . mdjm_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>';
    }
    $html .= '</select>';
    $html .= '<label for="mdjm_settings[' . mdjm_sanitize_key($args['id']) . ']"> ' . wp_kses_post($args['desc']) . '</label>';
    echo apply_filters('mdjm_after_setting_output', $html, $args);
}