/**
  * add_to_featured_image_meta_box
  * @param $event_meta
  */
 public function add_to_featured_image_meta_box($event_meta)
 {
     EE_Registry::instance()->load_helper('Form_Fields');
     $html = '<p>';
     $html .= EEH_Form_Fields::select(__('Add image to event calendar', 'event_espresso'), isset($event_meta['display_thumb_in_calendar']) ? $event_meta['display_thumb_in_calendar'] : '', array(array('id' => true, 'text' => __('Yes', 'event_espresso')), array('id' => false, 'text' => __('No', 'event_espresso'))), 'show_on_calendar', 'show_on_calendar');
     $html .= '</p>';
     echo $html;
 }
    /**
     * Back-end widget form.
     *
     * @see WP_Widget::form()
     * @param array $instance Previously saved values from database.
     * @return string|void
     */
    public function form($instance)
    {
        EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE);
        // Set up some default widget settings.
        $defaults = array('title' => __('Upcoming Events', 'event_espresso'), 'category_name' => '', 'show_expired' => FALSE, 'show_desc' => TRUE, 'show_dates' => TRUE, 'show_everywhere' => FALSE, 'date_limit' => 2, 'limit' => 10, 'date_range' => FALSE, 'image_size' => 'medium');
        $instance = wp_parse_args((array) $instance, $defaults);
        // don't add HTML labels for EE_Form_Fields generated inputs
        add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
        $yes_no_values = array(EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))));
        ?>

		<!-- Widget Title: Text Input -->

		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
				<?php 
        _e('Title:', 'event_espresso');
        ?>
			</label>
			<input id="<?php 
        echo $this->get_field_id('title');
        ?>
" class="widefat" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo esc_attr($instance['title']);
        ?>
" type="text" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('category_name');
        ?>
">
				<?php 
        _e('Event Category:', 'event_espresso');
        ?>
			</label>
			<?php 
        $event_categories = array();
        /** @type EEM_Term $EEM_Term */
        $EEM_Term = EE_Registry::instance()->load_model('Term');
        $categories = $EEM_Term->get_all_ee_categories(TRUE);
        if ($categories) {
            foreach ($categories as $category) {
                if ($category instanceof EE_Term) {
                    $event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name')));
                }
            }
        }
        array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso'))));
        echo EEH_Form_Fields::select(__('Event Category:', 'event_espresso'), $instance['category_name'], $event_categories, $this->get_field_name('category_name'), $this->get_field_id('category_name'));
        ?>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('limit');
        ?>
">
				<?php 
        _e('Number of Events to Display:', 'event_espresso');
        ?>
			</label>
			<input id="<?php 
        echo $this->get_field_id('limit');
        ?>
" name="<?php 
        echo $this->get_field_name('limit');
        ?>
" value="<?php 
        echo $instance['limit'];
        ?>
" size="3" type="text" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_expired');
        ?>
">
				<?php 
        _e('Show Expired Events:', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Show Expired Events:', 'event_espresso'), $instance['show_expired'], $yes_no_values, $this->get_field_name('show_expired'), $this->get_field_id('show_expired'));
        ?>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('image_size');
        ?>
">
				<?php 
        _e('Image Size:', 'event_espresso');
        ?>
			</label>
			<?php 
        $image_sizes = array();
        $sizes = get_intermediate_image_sizes();
        if ($sizes) {
            // loop thru images and create option objects out of them
            foreach ($sizes as $image_size) {
                $image_size = trim($image_size);
                // no big images plz
                if (!in_array($image_size, array('large', 'post-thumbnail'))) {
                    $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size));
                }
            }
            $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso')));
        }
        echo EEH_Form_Fields::select(__('Image Size:', 'event_espresso'), $instance['image_size'], $image_sizes, $this->get_field_name('image_size'), $this->get_field_id('image_size'));
        ?>

		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_desc');
        ?>
">
				<?php 
        _e('Show Description:', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Show Description:', 'event_espresso'), $instance['show_desc'], $yes_no_values, $this->get_field_name('show_desc'), $this->get_field_id('show_desc'));
        ?>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_dates');
        ?>
">
				<?php 
        _e('Show Dates:', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Show Dates:', 'event_espresso'), $instance['show_dates'], $yes_no_values, $this->get_field_name('show_dates'), $this->get_field_id('show_dates'));
        ?>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_everywhere');
        ?>
">
		        <?php 
        _e('Show on all Pages:', 'event_espresso');
        ?>
			</label>
	 	    <?php 
        echo EEH_Form_Fields::select(__('Show on all Pages:', 'event_espresso'), $instance['show_everywhere'], $yes_no_values, $this->get_field_name('show_everywhere'), $this->get_field_id('show_everywhere'));
        ?>
	 	</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('date_limit');
        ?>
">
				<?php 
        _e('Number of Dates to Display:', 'event_espresso');
        ?>
			</label>
			<input id="<?php 
        echo $this->get_field_id('date_limit');
        ?>
" name="<?php 
        echo $this->get_field_name('date_limit');
        ?>
" value="<?php 
        echo esc_attr($instance['date_limit']);
        ?>
" size="3" type="text" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('date_range');
        ?>
">
				<?php 
        _e('Show Date Range:', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Show Date Range:', 'event_espresso'), $instance['date_range'], $yes_no_values, $this->get_field_name('date_range'), $this->get_field_id('date_range'));
        ?>
<span class="description"><br /><?php 
        _e('This setting will replace the list of dates in the widget.', 'event_espresso');
        ?>
</span>
		</p>

		<?php 
    }
?>
 <?php 
echo EEH_Template::get_help_tab_link('display_expired_events_info');
?>
					</label>
				</th>
				<td>
					<?php 
echo EEH_Form_Fields::select('expired_events', $display_expired_events, $values, 'EED_Events_Archive_display_expired_events', 'EED_Events_Archive_display_expired_events');
?>
				</td>
			</tr>

		<tr>
			<th>
				<label for="EED_Events_Archive_reset_event_list_settings">
					<?php 
_e('Reset Event List Settings', 'event_espresso');
?>
				</label>
			</th>
			<td>
				<?php 
echo EEH_Form_Fields::select('reset_event_list_settings', 0, $values, 'EED_Events_Archive_reset_event_list_settings', 'EED_Events_Archive_reset_event_list_settings');
?>
			</td>
		</tr>

	</tbody>
</table>
    /**
     * Back-end widget form.
     *
     * @see WP_Widget::form()
     *
     * @param array $instance Previously saved values from database.
     * @return string|void
     */
    public function form($instance)
    {
        EE_Registry::instance()->load_helper('Form_Fields');
        EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE);
        // Set up some default widget settings.
        $defaults = array('title' => 'Calendar', 'show_expired' => FALSE, 'category_id' => '', 'calendar_page' => '');
        $instance = wp_parse_args((array) $instance, $defaults);
        add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
        $yes_no_values = array(EE_Question_Option::new_instance(array('QSO_value' => 0, 'QSO_desc' => __('No', 'event_espresso'))), EE_Question_Option::new_instance(array('QSO_value' => 1, 'QSO_desc' => __('Yes', 'event_espresso'))));
        ?>

		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
				<?php 
        _e('Title:', 'event_espresso');
        ?>
			</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" width="20" value="<?php 
        echo $instance['title'];
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('show_expired');
        ?>
">
				<?php 
        _e('Display Expired Events?', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Display Expired Events?', 'event_espresso'), $instance['show_expired'], $yes_no_values, $this->get_field_name('show_expired'), $this->get_field_id('show_expired'));
        ?>
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('category_id');
        ?>
">
				<?php 
        _e('Single Category Name (optional)', 'event_espresso');
        ?>
			</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('category_id');
        ?>
" name="<?php 
        echo $this->get_field_name('category_id');
        ?>
" width="20" value="<?php 
        echo $instance['category_id'];
        ?>
" /><br/>
			<span class="small-text">
			<?php 
        printf(__('Enter the Category Slug from the %sEvent Categories%s page', 'event_espresso'), '<a href="' . admin_url('admin.php?page=espresso_events&action=category_list') . '" target="_blank">', '</a>');
        ?>
			</span>
		</p>

<?php 
    }
 /**
  * generate_form_input
  *
  * @param EE_Question_Form_Input $QFI
  * @return string HTML
  */
 static function generate_form_input(EE_Question_Form_Input $QFI)
 {
     if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && !is_admin()) {
         return '';
     }
     $QFI = self::_load_system_dropdowns($QFI);
     $QFI = self::_load_specialized_dropdowns($QFI);
     //we also need to verify
     $display_text = $QFI->get('QST_display_text');
     $input_name = $QFI->get('QST_input_name');
     $answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value');
     $input_id = $QFI->get('QST_input_id');
     $input_class = $QFI->get('QST_input_class');
     //		$disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
     $disabled = $QFI->get('QST_disabled') ? TRUE : FALSE;
     $required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
     $QST_required = $QFI->get('QST_required');
     $required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array();
     $use_html_entities = $QFI->get_meta('htmlentities');
     $required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso');
     $required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer($required_text, $use_html_entities) . '</div>' : '';
     $label_class = 'espresso-form-input-lbl';
     $QST_options = $QFI->options(true, $answer);
     $options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array();
     $system_ID = $QFI->get('QST_system');
     $label_b4 = $QFI->get_meta('label_b4');
     $use_desc_4_label = $QFI->get_meta('use_desc_4_label');
     switch ($QFI->get('QST_type')) {
         case 'TEXTAREA':
             return EEH_Form_Fields::textarea($display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
             break;
         case 'DROPDOWN':
             return EEH_Form_Fields::select($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE);
             break;
         case 'RADIO_BTN':
             return EEH_Form_Fields::radio($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label);
             break;
         case 'CHECKBOX':
             return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities);
             break;
         case 'DATE':
             return EEH_Form_Fields::datepicker($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
             break;
         case 'TEXT':
         default:
             return EEH_Form_Fields::text($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
             break;
     }
 }
?>
</p>
				</td>
			</tr>

			<tr>
				<th>
					<label for="EED_Events_Single_use_sortable_display_order">
						<?php 
_e('Use Custom Display Order?', 'event_espresso');
?>
					</label>
				</th>
				<td>
					<?php 
echo EEH_Form_Fields::select('use_sortable_display_order', $use_sortable_display_order, $values, 'EED_Events_Single_use_sortable_display_order', 'EED_Events_Single_use_sortable_display_order');
?>
					<p class="description ">
						<?php 
echo sprintf(__('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'), '<span class="important-notice">', '</span>', '<br />');
?>
					</p>
				</td>
			</tr>

			<tr>
				<th>
					<?php 
_e('Display Order', 'event_espresso');
echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');
?>
    /**
     * Back-end widget form.
     *
     * @see WP_Widget::form()
     *
     * @param array $instance Previously saved values from database.
     * @return string|void
     */
    public function form($instance)
    {
        EE_Registry::instance()->load_helper('Form_Fields');
        EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE);
        // Set up some default widget settings.
        $defaults = array('title' => 'New_Addon');
        $instance = wp_parse_args((array) $instance, $defaults);
        add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
        $yes_no_values = array(EE_Question_Option::new_instance(array('QSO_value' => 0, 'QSO_desc' => __('No', 'event_espresso'))), EE_Question_Option::new_instance(array('QSO_value' => 1, 'QSO_desc' => __('Yes', 'event_espresso'))));
        ?>

		<p>
			<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">
				<?php 
        _e('Title:', 'event_espresso');
        ?>
			</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" width="20" value="<?php 
        echo $instance['title'];
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('yes_or_no_question');
        ?>
">
				<?php 
        _e('Yes or No?', 'event_espresso');
        ?>
			</label>
			<?php 
        echo EEH_Form_Fields::select(__('Yes or No?', 'event_espresso'), $instance['yes_or_no_question'], $yes_no_values, $this->get_field_name('yes_or_no_question'), $this->get_field_id('yes_or_no_question'));
        ?>
		</p>
<?php 
    }
 /**
  * 		generate s HTML for the billing info form during registration
  * 		@access 		protected
  * 		@param		array	$billing_inputs - array of input field details
  * 		@param		array	$section - what part of the billing info form, "address", "credit_card", or "other"
  * 		@return 		string
  */
 protected function _generate_billing_info_form_fields($billing_inputs = array(), $section = FALSE)
 {
     do_action('AHEE_log', __FILE__, __FUNCTION__, '');
     if (empty($billing_inputs) || !$section) {
         return;
     }
     global $wp_filter, $css_class;
     // fill out section name
     $section = '_billing_info_' . $section . '_fields';
     // if you don't behave - this is what you're gonna get !!!
     $output = '';
     // cycle thru billing inputs
     foreach ($billing_inputs as $input_key => $billing_input) {
         // is the billing input in the requested section	?
         if (in_array($input_key, $this->{$section})) {
             // required fields get a *
             $required = $billing_input['required'] ? EEH_Form_Fields::prep_required(array('class' => 'required', 'label' => '<em>*</em>')) : '';
             // answer
             $answer = EE_Registry::instance()->REQ->is_set($input_key) ? EE_Registry::instance()->REQ->get($input_key) : $billing_input['value'];
             if ($input_key == '_reg-page-billing-card-exp-date-mnth-' . $this->_gateway_name) {
                 // Credit Card MONTH
                 add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_month_input_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= EEH_Form_Fields::select(__('Expiry Date', 'event_espresso'), $answer, EEH_Form_Fields::two_digit_months_dropdown_options(), $input_key, $input_key, $css_class . ' ee-credit-card-month display-inline small-txt', $required, '', '', '', FALSE, TRUE, FALSE);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_month_input_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= "\n\t\t\t" . '&nbsp;/&nbsp;';
             } elseif ($input_key == '_reg-page-billing-card-exp-date-year-' . $this->_gateway_name) {
                 // Credit Card YEAR
                 // remove label
                 add_filter('FHEE__EEH_Form_Fields__label_html', array('EEH_Form_Fields', 'remove_label_keep_required_msg'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_year_input_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= EEH_Form_Fields::select(__('Year', 'event_espresso'), $answer, EEH_Form_Fields::next_decade_two_digit_year_dropdown_options(), $input_key, $input_key, $css_class . ' ee-credit-card-year display-inline small-txt', $required, '', '', '', FALSE, TRUE, FALSE);
                 // remove filter that removes label, or else no other inputs will have labels
                 remove_filter('FHEE__EEH_Form_Fields__label_html', array('EEH_Form_Fields', 'remove_label_keep_required_msg'), 10, 2);
                 remove_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'reg_form_billing_cc_year_input_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__label_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_label_wrap'), 10, 2);
                 add_filter('FHEE__EEH_Form_Fields__input_html', array('EED_Single_Page_Checkout', 'reg_form_form_field_input__wrap'), 10, 2);
                 $output .= "\n\t\t\t" . '<span class="small-text lt-grey-text">' . __('(mm/yy)', 'event_espresso') . '</span>';
             } else {
                 // create question form input
                 $QFI = new EE_Question_Form_Input(EE_Question::new_instance(array('QST_display_text' => $billing_input['label'], 'QST_system' => $billing_input['db-col'], 'QST_type' => $billing_input['input'], 'QST_required' => $billing_input['required'])), EE_Answer::new_instance(array('ANS_value' => $answer)), array('input_name' => $input_key, 'input_id' => $input_key, 'input_class' => $css_class, 'input_prefix' => '', 'append_qstn_id' => FALSE));
                 // add options
                 if (isset($billing_input['options'])) {
                     $options = is_array($billing_input['options']) ? $billing_input['options'] : explode(',', $billing_input['options']);
                     foreach ($options as $option) {
                         $QSO = EE_Question_Option::new_instance(array('QSO_value' => $option, 'QSO_desc' => $option));
                         $QFI->add_temp_option($QSO);
                     }
                 }
                 $output .= EEH_Form_Fields::generate_form_input($QFI);
             }
         }
         // end if ( in_array( $input_key, $this->$section ))
     }
     // end foreach( $billing_inputs as $input_key => $billing_input )
     return $output;
 }
	<h4>
		<?php 
_e('New Addon Settings', 'event_espresso');
?>
	</h4>
	<table class="form-table">
		<tbody>

			<tr>
				<th><?php 
_e("Reset New Addon Settings?", 'event_espresso');
?>
</th>
				<td>
					<?php 
echo EEH_Form_Fields::select(__('Reset New Addon Settings?', 'event_espresso'), 0, $yes_no_values, 'reset_new_addon', 'reset_new_addon');
?>
<br/>
					<span class="description">
						<?php 
_e('Set to \'Yes\' and then click \'Save\' to confirm reset all basic and advanced Event Espresso New Addon settings to their plugin defaults.', 'event_espresso');
?>
					</span>
				</td>
			</tr>

		</tbody>
	</table>

</div>