function get_uwqsf_cmf($id, $getcmf)
 {
     $options = get_post_meta($id, 'uwpqsf-option', true);
     $cmfrel = isset($options[0]['cmf']) ? $options[0]['cmf'] : 'AND';
     if (isset($getcmf)) {
         $cmf = array('relation' => $cmfrel, '');
         foreach ($getcmf as $v) {
             $classapi = new uwpqsfclass();
             $campares = $classapi->cmf_compare();
             //avoid tags stripped
             if (!empty($v['value'])) {
                 if ($v['value'] == 'uwpqsfcmfall') {
                     $cmf[] = array('key' => strip_tags(stripslashes($v['metakey'])), 'value' => 'get_all_cmf_except_me', 'compare' => '!=');
                 } elseif ($v['compare'] == '11') {
                     $range = explode("-", strip_tags(stripslashes($v['value'])));
                     $cmf[] = array('key' => strip_tags(stripslashes($v['metakey'])), 'value' => $range, 'type' => 'numeric', 'compare' => 'BETWEEN');
                 } elseif ($v['compare'] == '12') {
                     $range = explode("-", strip_tags(stripslashes($v['value'])));
                     $cmf[] = array('key' => strip_tags(stripslashes($v['metakey'])), 'value' => $range, 'type' => 'numeric', 'compare' => 'NOT BETWEEN');
                 } elseif ($v['compare'] == '9' || $v['compare'] == '10') {
                     foreach ($campares as $ckey => $cval) {
                         if ($ckey == $v['compare']) {
                             $safec = $cval;
                         }
                     }
                     $trimmed_array = array_map('trim', $v['value']);
                     //implode(',',$v['value'])
                     $cmf[] = array('key' => strip_tags(stripslashes($v['metakey'])), 'value' => $trimmed_array, 'compare' => $safec);
                 } elseif ($v['compare'] == '3' || $v['compare'] == '4' || $v['compare'] == '5' || $v['compare'] == '6') {
                     foreach ($campares as $ckey => $cval) {
                         if ($ckey == $v['compare']) {
                             $safec = $cval;
                         }
                     }
                     $cmf[] = array('key' => strip_tags(stripslashes($v['metakey'])), 'value' => strip_tags(stripslashes($v['value'])), 'type' => 'DECIMAL', 'compare' => $safec);
                 } elseif ($v['compare'] == '1' || $v['compare'] == '2' || $v['compare'] == '7' || $v['compare'] == '8' || $v['compare'] == '13') {
                     foreach ($campares as $ckey => $cval) {
                         if ($ckey == $v['compare']) {
                             $safec = $cval;
                         }
                     }
                     $cmf[] = array('key' => strip_tags(stripslashes($v['metakey'])), 'value' => strip_tags(stripslashes($v['value'])), 'compare' => $safec);
                 }
             }
             //end isset
         }
         //end foreach
         $output = apply_filters('uwpqsf_get_cmf', $cmf, $id, $getcmf);
         unset($output[0]);
         return $output;
     }
 }
<?php

$type = $_POST['type'];
$classapi = new uwpqsfclass();
if ($type == 'form') {
    parse_str($_POST['getcmfdata'], $getdata);
    $metakey = isset($getdata['prekey']) ? sanitize_text_field($getdata['prekey']) : '';
    $label = isset($getdata['precmflabel']) ? sanitize_text_field($getdata['precmflabel']) : '';
    $all = isset($getdata['precmfall']) ? sanitize_text_field($getdata['precmfall']) : '';
    $com = isset($getdata['precompare']) ? sanitize_text_field($getdata['precompare']) : '';
    $check = isset($getdata['cmfdisplay']) ? sanitize_text_field($getdata['cmfdisplay']) : '';
    $option = isset($getdata['preopt']) ? sanitize_text_field($getdata['preopt']) : '';
    $c = isset($_POST['cmfcounter']) ? sanitize_text_field($_POST['cmfcounter']) : '';
    $campares = $classapi->cmf_compare();
    echo '<div id="dragbox" ><h3><div class="toggle2 plus"></div>' . $label . '<a href="" class="removediv">Remove</a></h3>';
    echo '<div class="cmfdragbox" style="display:none">';
    echo '<input type="hidden" id="cmfcounter" value=' . $c . '>';
    //meta key
    echo '<p><span><b>' . __("Meta Key", "UWPQSF") . '</b></span><br>';
    $keys = $classapi->get_all_metakeys();
    echo '<select id="cmfkey" name="uwpname[cmf][' . $c . '][metakey]">';
    foreach ($keys as $key) {
        $selected = $metakey == $key ? 'selected="selected"' : '';
        echo '<option value="' . $key . '" ' . $selected . '>' . $key . '</option>';
    }
    echo '</select>';
    echo '</p>';
    //for Label
    echo '<p><span><b>' . __("Label", "UWPQSF") . '</b></span><br>';
    echo '<input type="text" id="cmflabel" name="uwpname[cmf][' . $c . '][label]" value="' . sanitize_text_field($label) . '"/>';
    echo '</p>';