I want to show users what package they are, based on how many items they have in their cart. The code works, but I'm wondering if anything can be improved.
function new_thing (){
//decleare variables
global $x_subs;
$lim01 = get_option(woomps_limit01);
$lim02 = get_option(woomps_limit02);
$lim03 = get_option(woomps_limit03);
$x = $x_subs;
$plugin_url =(plugins_url("/", __FILE__ ));
//set CSS class based on value of $x
if ($x >= 1 && $x < $lim02) {
$active1 = "fb-sub-active";
$active2 = "fb-sub-deactive";
$active3 = "fb-sub-deactive";
} else if ($x >= $lim02 && $x < $lim03) {
$active1 = "fb-sub-deactive";
$active2 = "fb-sub-active";
$active3 = "fb-sub-deactive";
} else if ($x >= $lim03) {
$active1 = "fb-sub-deactive";
$active2 = "fb-sub-deactive";
$active3 = "fb-sub-active";
} else {
$active1 = "fb-sub-deactive";
$active2 = "fb-sub-deactive";
$active3 = "fb-sub-deactive";
}
//generate the content that will be displayed
$content = <<<EOD
<div class="fb-sub-img-holder">
<img src="{$plugin_url}/images/subscription_pack_1.png" class="fb-img fb-sub-table1 {$active1}"></img>
<img src="{$plugin_url}/images/subscription_pack_2.png" class="fb-img fb-sub-table2 {$active2}"></img>
<img src="{$plugin_url}/images/subscription_pack_3.png" class="fb-img fb-sub-table3 {$active3}"></img>
<p>{$x_subs}</p>
</div>
EOD;
return $content;
}
.fb-sub-img-holder {
width: 95%;
margin: 0 auto;
}
.fb-img {
width: 30%;
.fb-sub-active {
width: 50%;
}
.fb-sub-deactive {
width: 20%;
}