if ($term_weight <= 0) { $term_weight = 1; } if ($class->prefix == $term) { $class->weight += $term_weight * 10; } if ($class->num == $term) { $class->weight += $term_weight * 10; } if (preg_match("/" . $term . "/i", $class->title)) { $class->weight += $term_weight * 5; } if ($class->section == $term) { $class->weight += $term_weight * 7; } $instructors = $class->get_instructors(); foreach ($instructors as $instructor) { if (preg_match("/" . $term . "/i", $instructor["fullname"])) { $class->weight += $term_weight * 8; } } if ($class->term == $term) { $class->weight += $term_weight * 15; } if ($class->year == $term) { $class->weight += $term_weight * 15; } } if ($class->weight >= 5) { $classes[$class->id] = $class; }