/**
 * Adds admin html for custom fields selected fields.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $wpdb WordPress Database object.
 */
function geodir_custom_selected_fields()
{
    $listing_type = $_REQUEST['listing_type'] != '' ? $_REQUEST['listing_type'] : 'gd_place';
    ?>
    <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php 
    echo $_REQUEST['subtab'];
    ?>
"/>
    <ul class="core"><?php 
    global $wpdb;
    $fields = $wpdb->get_results($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s order by sort_order asc", array($listing_type)));
    if (!empty($fields)) {
        foreach ($fields as $field) {
            //$result_str = $field->id;
            $result_str = $field;
            $field_type = $field->field_type;
            $field_ins_upd = 'display';
            geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd);
        }
    }
    ?>
</ul>
<?php 
}
        return;
    }
    foreach ($_REQUEST as $pkey => $pval) {
        if (is_array($_REQUEST[$pkey])) {
            $tags = 'skip_field';
        } else {
            $tags = '';
        }
        if ($tags != 'skip_field') {
            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
        }
    }
    $return = geodir_custom_field_save($_REQUEST);
    if (is_int($return)) {
        $lastid = $return;
        geodir_custom_field_adminhtml($field_type, $lastid, 'submit');
    } else {
        echo $return;
    }
}
/* ---- Save sort field  ---- */
if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
        return;
    }
    foreach ($_REQUEST as $pkey => $pval) {
        if (is_array($_REQUEST[$pkey])) {
            $tags = 'skip_field';
        } else {
            $tags = '';
        }