@ 2014-02-06T12:27:26Z <?php
<?php
function category_select_value($array, $parentid, $cat_array, $count) {
$count++;
foreach ($array[$parentid] as $cat) {
if(isset($cat_array) && in_array($cat->name, $cat_array)) {
echo "<option value=\"".$cat->name."\" checked=\"checked\" selected>";
} else {
echo "<option value=\"".$cat->name."\">";
}
for ($i=0;$i<$count;$i++)
echo " ";
echo $cat->name."</option>";
//echo $cat->name."<br>";
if (array_key_exists ($cat->term_id, $array))
category_select_value($array, $cat->term_id, $cat_array, $count);
}
}
global $wpdb;
$blog_cat = $cat_exclude;
/*
if(is_array($blog_cat) && $blog_cat[0]!=''){
$blog_cat = get_blog_sub_cats_str($type='string');
}else{
$blog_cat = '';
}
if($blog_cat)
{
$blog_cat .= ",1";
}else
{
$blog_cat .= "1";
}*/
global $price_db_table_name;
if($_REQUEST['pkg']){
$pkg_id = mysql_real_escape_string($_REQUEST['pkg']);
$package_cats = $wpdb->get_var("select cat from $price_db_table_name where pid=$pkg_id");
}
if($package_cats)
{
if($blog_cat){
$blog_cat .= ",".$package_cats;
}else
{
$blog_cat .= $package_cats;
}
}
if($blog_cat)
{
$substr = " and c.term_id not in ($blog_cat)";
}
$catsql = "select c.term_id, c.name, tt.parent from $wpdb->terms c,$wpdb->term_taxonomy tt where tt.term_id=c.term_id and tt.taxonomy='placecategory' $substr order by c.name";
$catinfo = $wpdb->get_results($catsql);
$parentsql = "select c.term_id, c.name, tt.parent from $wpdb->terms c,$wpdb->term_taxonomy tt where tt.term_id=c.term_id and tt.taxonomy='placecategory' $substr order by tt.parent, c.name";
$parentinfo = $wpdb->get_results($parentsql);
$categories=array();
foreach ($parentinfo as $key=>$info) {
$categories[$info->parent][$info->term_id]=$info;
}
global $cat_array;
if($catinfo) {
$cat_display=get_option('ptthemes_category_dislay');
if($cat_display==''){$cat_display='checkbox';}
$counter = 0;
if($cat_display=='select'){?>
<div class="form_cat" >
<select name="category[]" id="category_<?php echo $counter;?>" class="textfield" >
<?php
category_select_value ($categories, 0, $cat_array, 0);
}
foreach($catinfo as $catinfo_obj) {
$counter++;
$termid = $catinfo_obj->term_id;
$name = $catinfo_obj->name;
if($cat_display=='checkbox'){
?>
<?php
}elseif($cat_display=='radio'){
?>
<?php
}elseif($cat_display=='select') {
continue;?>
<option <?php if(isset($cat_array) && in_array($name,$cat_array)){
echo 'selected="selected"'; }?> value="<?php echo $name; ?>">
<?php echo "$name"; ?></option>
<?php
}
}
if($cat_display=='select'){?>
</select></div>
<?php }
}
?><?php
$cat_display=get_option('ptthemes_category_dislay');
if($cat_display=='checkbox') {
$limit_code ='';
if($cat_limit){?>
<script type="text/javascript">
/*<![CDATA[*/
var checked = 0;
function addCheck(box)
{
// allow checked box to be unchecked
if(!box.checked) return true;
// get ref to collection // see Alt:
var boxes = document.getElementsByName(box.name);
// count checked
var cb, count=0, k=0;
while(cb=boxes[k++])
if(cb.checked && ++count><?php echo $cat_limit; ?>){
alert("<?php printf( _n( 'Sorry, you can select only %d category with this package.', 'Sorry, you can select only %d categories with this package.', $cat_limit ), $cat_limit );?>");
return false;
}
return true;
}
/*]]>*/
</script>
<?php $limit_code = 'onclick="return addCheck(this);"';}
$args=array(
'orderby' => 'name',
'include' => $catstring,
'exclude' => $blog_cat,
'hide_empty'=> 0,
'parent'=>0,
'taxonomy'=> 'placecategory',
);
$counter=0;
$categories=get_categories($args);
foreach ($categories as $category)
{
$counter++;
?>
<div class="form_cat" style="width:400px;" ><label><input type="checkbox" name="category[]" <?php echo $limit_code; ?> id="category_<?php echo $counter;?>" value="<?php echo $category->name; ?>" class="checkbox" <?php if(isset($cat_array) && in_array($category->name,$cat_array)){echo 'checked="checked"'; }?> /> <?php echo $category->name;?></label></div>
<div class="togglecats" id="togglecatscategory_<?php echo $counter;?>">
<?php $args=array(
'orderby' => 'name',
'include' => $catstring,
'exclude' => $blog_cat,
'hide_empty'=> 0,
'taxonomy'=> 'placecategory',
'parent'=>$category->term_id,
);
$subcategories=get_categories($args);
foreach ($subcategories as $subcategory)
{
$counter++;
?>
<div class="form_subcat" style="width:400px; padding-left:15px;" ><label><input type="checkbox" name="category[]" <?php echo $limit_code; ?> id="category_<?php echo $counter;?>" value="<?php echo $subcategory->name; ?>" class="checkbox" <?php if(isset($cat_array) && in_array($subcategory->name,$cat_array)){echo 'checked="checked"'; }?> /> <?php echo $subcategory->name;?></label></div>
<?php } ?></div>
<?php }
} ?>
<?php
//echo '###'.$cat_exclude.'###'.$blog_cat;
$cat_display=get_option('ptthemes_category_dislay');
if($cat_display=='radio')
{
$args=array(
'orderby' => 'name',
'include' => $catstring,
'exclude' => $blog_cat,
'hide_empty'=> 0,
'taxonomy'=> 'placecategory',
'parent'=>0,
);
$counter=0;
$categories=get_categories($args);
foreach ($categories as $category)
{
$counter++;
?>
<div class="form_cat" style="width:400px;" ><label><input type="radio" name="category[]" id="category_<?php echo $counter;?>" value="<?php echo $category->name; ?>" class="checkbox" <?php if(isset($cat_array) && in_array($category->name,$cat_array)){echo 'checked="checked"'; }?> /> <?php echo $category->name;?></label></div>
<div class="togglecats" id="togglecats<?php echo $category->name; ?>">
<?php $args=array(
'orderby' => 'name',
'include' => $catstring,
'exclude' => $blog_cat,
'hide_empty'=> 0,
'parent'=>$category->term_id,
);
$subcategories=get_categories($args);
foreach ($subcategories as $subcategory)
{
$counter++;
?>
<div class="form_subcat" style="width:400px; padding-left:15px;" ><label><input type="radio" name="category[]" id="category_<?php echo $counter;?>" value="<?php echo $subcategory->name; ?>" class="checkbox" <?php if(isset($cat_array) && in_array($subcategory->term_id,$cat_array)){echo 'checked="checked"'; }?> /> <?php echo $subcategory->name;?></label></div>
<?php } ?></div>
<?php }
} ?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.4.25 0.010 0.037 12.39 5.4.24 0.005 0.036 12.36 5.4.23 0.006 0.041 12.36 5.4.22 0.006 0.038 12.36 5.4.21 0.010 0.031 12.36 5.4.20 0.009 0.036 12.36 5.4.19 0.005 0.036 12.35 5.4.18 0.006 0.038 12.36 5.4.17 0.009 0.033 12.36 5.4.16 0.005 0.042 12.35 5.4.15 0.010 0.038 12.35 5.4.14 0.005 0.041 12.04 5.4.13 0.008 0.034 12.02 5.4.12 0.005 0.037 11.98 5.4.11 0.003 0.039 11.98 5.4.10 0.006 0.036 11.98 5.4.9 0.009 0.034 11.98 5.4.8 0.002 0.040 11.98 5.4.7 0.008 0.034 11.98 5.4.6 0.004 0.038 11.98 5.4.5 0.004 0.038 11.97 5.4.4 0.006 0.036 11.96 5.4.3 0.007 0.035 11.96 5.4.2 0.006 0.039 11.96 5.4.1 0.005 0.038 11.96 5.4.0 0.003 0.038 11.45 5.3.28 0.006 0.038 12.71 5.3.27 0.003 0.041 12.72 5.3.26 0.006 0.039 12.72 5.3.25 0.005 0.040 12.72 5.3.24 0.008 0.051 12.72 5.3.23 0.007 0.039 12.71 5.3.22 0.004 0.040 12.68 5.3.21 0.011 0.037 12.68 5.3.20 0.007 0.045 12.68 5.3.19 0.007 0.037 12.68 5.3.18 0.005 0.039 12.68 5.3.17 0.008 0.035 12.67 5.3.16 0.009 0.037 12.67 5.3.15 0.005 0.043 12.68 5.3.14 0.009 0.036 12.66 5.3.13 0.007 0.041 12.66 5.3.12 0.003 0.043 12.66 5.3.11 0.008 0.037 12.65 5.3.10 0.006 0.038 12.12 5.3.9 0.007 0.037 12.08 5.3.8 0.004 0.038 12.08 5.3.7 0.006 0.047 12.07 5.3.6 0.005 0.051 12.06 5.3.5 0.010 0.039 12.00 5.3.4 0.009 0.058 12.00 5.3.3 0.007 0.048 11.94 5.3.2 0.011 0.042 11.70 5.3.1 0.007 0.048 11.66 5.3.0 0.003 0.051 11.64
preferences:dark mode live preview
140.18 ms | 1394 KiB | 7 Q