<?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>';
示例#2
0
 function ufront_js()
 {
     $variables = array('url' => admin_url('admin-ajax.php'));
     $themeopt = new uwpqsfclass();
     $themeops = $themeopt->uwpqsf_theme();
     $themenames = $themeopt->uwpqsf_theme_val();
     if (isset($themenames)) {
         foreach ($themeops as $k) {
             if (in_array($k['themeid'], $themenames)) {
                 wp_register_style($k['themeid'], $k['link'], array(), 'all');
                 wp_enqueue_style($k['themeid']);
             }
             wp_enqueue_script('uwpqsfscript', plugins_url('/scripts/uwpqsfscript.js', __FILE__), array('jquery'), '1.0', true);
             wp_localize_script('uwpqsfscript', 'ajax', $variables);
         }
         // end foreach
     }
     //end if
 }
<?php

add_thickbox();
$html = '<div class="cbox"><h3>' . __("Form's Theme", "UWPQSF") . '</h3>';
$themes = get_post_meta($postid, 'uwpqsf-theme', true);
$extheme = '';
$themeopt = new uwpqsfclass();
$themeops = $themeopt->uwpqsf_theme();
if (!empty($themes)) {
    $extheme = explode('|', $themes);
}
$html .= '<div class="fullwide">';
$c = 1;
foreach ($themeops as $k) {
    $default = empty($extheme) && $k['themeid'] == 'udefault' ? 'checked="checked"' : '';
    $checked = !empty($extheme) && $k['themeid'] == $extheme[0] ? 'checked="checked"' : '';
    $value = $k['themeid'] . '|' . $k['link'] . '|' . $k['id'] . '|' . $k['class'];
    $html .= '<label class="ptheme">';
    $html .= '<input type="radio" name="themeopt" value="' . $value . '" ' . $checked . '  ' . $default . '">' . $k['name'] . '<br>';
    $html .= '<a href="#TB_inline?width=600&height=600&inlineId=themethumb_' . $c . '" class="thickbox">' . __(" Preview", "UWPQSF") . '</a>';
    $html .= '<div class="clear"></div></label>';
    $html .= '<div id="themethumb_' . $c . '"  style="display:none"><img src="' . $k['thumb'] . '"></div>';
    $c++;
}
$html .= '<div class="clear"></div></div></div><br><br>';
echo $html;
<div class="leftcol">
<div class="add_tax_form_div" >
	<div id="addCmfForm" >
	
	<h3><?php 
_e("Add Meta Field", "UWPQSF");
?>
</h3>
	<p><span><b><?php 
_e("Meta Key", "UWPQSF");
?>
</b></span><br>
	<select type="text" id="precmfkey" name="prekey"><br>
	<?php 
$classapi = new uwpqsfclass();
$keys = $classapi->get_all_metakeys();
echo '<option value="">' . __("Choose a meta key", "UWPQSF") . '</option>';
foreach ($keys as $key) {
    echo '<option value="' . $key . '">' . $key . '</option>';
}
?>
	
	</select>
	</p>
	
	<p><span><b><?php 
_e("Label", "UWPQSF");
?>
</b></span><br>
	<input type="text" id="precmflabel" name="precmflabel" value=""/><br>	
示例#5
0
$desc = !empty($options[0]['sorder']) && $options[0]['sorder'] == 'DESC' ? 'checked="checked"' : null;
$asc = !empty($options[0]['sorder']) && $options[0]['sorder'] == 'ASC' ? 'checked="checked"' : null;
$button = !empty($options[0]['button']) ? sanitize_text_field($options[0]['button']) : 'Search';
$defualtresult = get_option('posts_per_page');
$result = !empty($options[0]['resultc']) ? sanitize_text_field($options[0]['resultc']) : $defualtresult;
$incative = $ordertype == 'meta_value' || $ordertype == 'meta_value_num' ? '' : 'disabled="disabled" class="inactive"';
$html = '<div class="cbox">';
$html .= '<h3>' . __("Result Setting and Others", "UWPQSF") . '</h3>';
$html .= '<div class="fullwide">';
$html .= '<h3>' . __("Add String Search?", "UWPQSF") . '</h3>';
$html .= '<p><input ' . $string . '  name="uwpname[rel][0][strchk]" type="checkbox" value="1" />' . __("Enabling string search", "UWPQSF") . '<br>';
$html .= '<span class="desciption">' . __("This will add string search in the form. Note that when user using this to search, the taxonomy and custom meta filter that defined above will not be used. However, the search will still go through the post type defined above.", "UWPQSF") . '</span></p>';
$html .= '<p><label>' . __("Label for string search.", "UWPQSF") . ':</label><br>';
$html .= '<input type="text"  name="uwpname[rel][0][strlabel]" id="stringlabel" value="' . $slabel . '" /><br></p>';
$html .= '<p><input ' . $snf . '  name="uwpname[rel][0][snf]" type="checkbox" value="1" />' . __("Combine string search with filters above", "UWPQSF") . '</p>';
$api = new uwpqsfclass();
$orderbys = $api->orderby_options();
$html .= '<h3>' . __("Result Page Setting", "UWPQSF") . '</h3>';
$html .= '<p><label>' . __("Orderby", "UWPQSF") . ':</label><br>';
$html .= '<select name="uwpname[rel][0][otype]" class="uorderby">';
foreach ($orderbys as $k => $v) {
    $select = $ordertype == $k ? 'selected="selected"' : '';
    $html .= '<option value="' . $k . '" ' . $select . '>' . $v . '</option>';
}
$html .= '</select><br>';
$html .= '<span class="desciption">' . __("Sort retrieved posts by parameter. For Meta Value or Numeric Meta Value, must insert Sorting Meta Key below.", "UWPQSF") . '</span></p>';
$html .= '<p><label>' . __("Sorting Meta Key.", "UWPQSF") . ':</label><br>';
$keys = $api->get_all_metakeys();
$html .= '<select name="uwpname[rel][0][smetekey]" id="ormkey" ' . $incative . '><option value=""></option>';
foreach ($keys as $key) {
    $selected = $meta == $key ? 'selected="selected"' : '';
     $check0 = 'checked="checked"';
 }
 echo '<label><input ' . $check1 . ' type="radio" id="taxhide" name="uwpname[taxo][' . $c . '][hide]" value="1"/>Yes</label>';
 echo '<label><input ' . $check0 . ' type="radio" id="taxhide" name="uwpname[taxo][' . $c . '][hide]" value="0"/>No</label>';
 echo '</p>';
 //exclude ids
 echo '<p>';
 echo '<span><b>' . __("Exculde Term ID", "UWPQSF") . '</b></span><br>';
 echo '<input type="text" id="taxexculde" class="extids_', $c + 1, '" name="uwpname[taxo][' . $c . '][exc]" value="' . sanitize_text_field($v['exc']) . '"/>';
 echo '<a href="#TB_inline?width=600&height=600&inlineId=extermhidden" class="thickbox exterm">' . __("Choose Terms", "UWPQSF") . '</a><br>';
 echo '<input type="checkbox" ', $v['exsearch'] == '1' ? 'checked="checked"' : '', ' id="enex" name="uwpname[taxo][' . $c . '][exsearch]" value="1" >' . __("Exclude the term from being searched", "UWPQSF");
 echo '</p>';
 //display type
 echo '<p>';
 echo '<span><b>' . __("Display Type?", "UWPQSF") . '</b></span><br>';
 $taxofields = new uwpqsfclass();
 $feilds = $taxofields->utaxo_display();
 foreach ($feilds as $val => $key) {
     $checked = $v['type'] == $val ? 'checked="checked"' : '';
     echo '<label><input type="radio" id="taxtype" name="uwpname[taxo][' . $c . '][type]" value="' . $val . '" ' . $checked . '/>' . $key . '</label><br>';
 }
 echo '</p>';
 //operator
 echo '<p>';
 echo '<span><b>' . __("Operator", "UWPQSF") . '</b></span><br>';
 foreach ($taxoperator as $value => $name) {
     $checkoperate = $v['operator'] == $value ? 'checked="checked"' : '';
     echo '<label><input type="radio"  name="uwpname[taxo][' . $c . '][operator]" value="' . $value . '" ' . $checkoperate . ' />' . $name . '</label>';
 }
 echo '</p><br>';
 $fhook = do_action('uwpqsftaxo_form_main', $v);