$field_id = isset($_REQUEST['field_id']) ? trim($_REQUEST['field_id'], '_') : ''; $field_action = isset($_REQUEST['field_ins_upd']) ? trim($_REQUEST['field_ins_upd']) : ''; $site_field_title = isset($_REQUEST['site_field_title']) ? trim($_REQUEST['site_field_title']) : ''; /* ------- check nonce field ------- */ if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update") { $field_ids = $_REQUEST['licontainer']; $return = godir_set_advance_search_field_order($field_ids); if (is_array($return)) { $return = json_encode($return); } echo $return; } /* ---- Show field form in admin ---- */ if ($field_action == 'new') { $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : ''; $fields = geodirectory_advance_search_fields($listing_type); $_REQUEST['site_field_id'] = isset($_REQUEST['field_id']) ? $_REQUEST['field_id'] : ''; if (!empty($fields)) { foreach ($fields as $val) { $val = stripslashes_deep($val); // strip slashes if ($val['htmlvar_name'] == $_REQUEST['htmlvar_name']) { $_REQUEST['field_type'] = $val['field_type']; $_REQUEST['site_field_title'] = $val['site_title']; $_REQUEST['field_data_type'] = $val['data_type']; } } } $htmlvar_name = isset($_REQUEST['htmlvar_name']) ? trim($_REQUEST['htmlvar_name']) : ''; $field_type = isset($_REQUEST['field_type']) ? trim($_REQUEST['field_type']) : ''; geodir_custom_advance_search_field_adminhtml($field_type, $htmlvar_name, $field_action);
function geodir_advance_search_available_fields() { global $wpdb; $listing_type = $_REQUEST['listing_type'] != '' ? $_REQUEST['listing_type'] : 'gd_place'; $allready_add_fields = $wpdb->get_results("select site_htmlvar_name from " . GEODIR_ADVANCE_SEARCH_TABLE . " where post_type ='" . $listing_type . "'"); $allready_add_fields_ids = array(); if (!empty($allready_add_fields)) { foreach ($allready_add_fields as $allready_add_field) { $allready_add_fields_ids[] = $allready_add_field->site_htmlvar_name; } } ?> <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?> " /> <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo $_REQUEST['subtab']; ?> " /> <ul><?php $fields = geodirectory_advance_search_fields($listing_type); if (!empty($fields)) { foreach ($fields as $field) { $field = stripslashes_deep($field); // strip slashes $display = ''; if (in_array($field['htmlvar_name'], $allready_add_fields_ids)) { $display = 'style="display:none;"'; } ?> <li <?php echo $display; ?> ><a id="gt-<?php echo $field['htmlvar_name']; ?> " class="gt-draggable-form-items gt-<?php echo $field['field_type']; ?> " href="javascript:void(0);"><b></b><?php echo $field['site_title']; ?> </a></li> <?php } } ?> </ul> <?php }