/** * Return an array with all registered Extra Fields */ function awpcp_get_extra_fields($where = '', $order = '') { global $wpdb; $where = empty($where) ? "WHERE field_name <> ''" : $where; $order = empty($order) ? 'ORDER BY weight ASC, field_id ASC' : $order; $query = "SELECT * FROM " . AWPCP_TABLE_EXTRA_FIELDS . " {$where} {$order}"; $results = $wpdb->get_results($query); // field options and cantegories may be serialized $extra_fields = array(); foreach ($results as $field) { $field->field_options = array_filter((array) maybe_unserialize($field->field_options), 'strlen'); $field->field_category = array_filter((array) maybe_unserialize($field->field_category), 'strlen'); $extra_fields["awpcp-{$field->field_name}"] = $field; } $sorted_fields = array(); foreach (awpcp_form_fields()->get_fields_order() as $field_slug) { if (isset($extra_fields[$field_slug])) { $sorted_fields[$field_slug] = $extra_fields[$field_slug]; unset($extra_fields[$field_slug]); } } return array_merge($sorted_fields, $extra_fields); }
<?php $dropdown = new AWPCP_CategoriesDropdown(); ?> <?php echo $dropdown->render(array('selected' => awpcp_array_data('ad_category', '', $form), 'name' => 'ad_category')); ?> <?php echo awpcp_form_error('ad_category', $errors); ?> </p> <?php } ?> <?php echo awpcp_form_fields()->render_fields($form, $errors, isset($listing) ? $listing : null, array('category' => $form['ad_category'], 'action' => 'normal')); ?> <?php if ($ui['terms-of-service']) { ?> <p class="awpcp-form-spacer"> <?php $text = get_awpcp_option('tos'); ?> <?php if (string_starts_with($text, 'http://', false) || string_starts_with($text, 'https://', false)) { ?> <a href="<?php echo esc_attr($text);
function awpcp_update_form_fields_order_ajax_handler() { return new AWPCP_UpdateFormFieldsOrderAjaxHandler(awpcp_form_fields(), awpcp_request(), awpcp_ajax_response()); }
function awpcp_form_fields_admin_page() { return new AWPCP_FormFieldsAdminPage('awpcp-form-fields', awpcp_admin_page_title(__('Form Fields', 'AWPCP')), awpcp_form_fields(), awpcp_form_fields_table_factory()); }
echo esc_attr($form['max_price']); ?> "> </label> <?php echo awpcp_form_error('min_price', $errors); ?> <?php echo awpcp_form_error('max_price', $errors); ?> </p> <?php } ?> <?php $options = array('showTextField' => true, 'maxRegions' => $ui['allow-user-to-search-in-multiple-regions'] ? 10 : 1); $selector = awpcp_multiple_region_selector($form['regions'], $options); echo $selector->render('search', array(), $errors); ?> <?php echo awpcp_form_fields()->render_fields($form, $errors, null, array('category' => 0, 'action' => 'search')); ?> <input type="submit" class="button" value="<?php echo esc_attr(_x('Start Search', 'ad search form', "AWPCP")); ?> " /> </form>