function data($data) { $title = clean($data['title']); $jobtype = clean($data['jobtype']); $deadline = clean($data['deadline']); $duration = str2float(clean($data['duration'])); $startdate = clean($data['startdate']); $enddate = clean($data['enddate']); $salarytype = clean($data['salarytype']); $salary = clean($data['salary']); if ($salarytype != 'other') { $salary = str2float($salary); } if ($jobtype == 'fulltime' || $jobtype == 'parttime') { $duration = ''; $enddate = ''; } $company = $data['company']; $desc = clean($data['desc']); $location = clean($data['location']); $locationtype = ''; if (isset($data['locationtype'])) { $locationtype = clean($data['locationtype']); } $geocode = geocode($location); if ($locationtype) { $location = ''; $geocode = ''; } $requirements = clean($data['requirements']); $link = clean($data['link']); if (!filter_var($link, FILTER_VALIDATE_EMAIL) && !preg_match('`^(https?:\\/\\/)`', $link)) { $link = "http://{$link}"; } return array('title' => $title, 'deadline' => $deadline, 'duration' => $duration, 'desc' => $desc, 'geocode' => $geocode, 'location' => $location, 'requirements' => $requirements, 'link' => $link, 'salary' => $salary, 'company' => $company, 'salarytype' => $salarytype, 'startdate' => $startdate, 'enddate' => $enddate, 'jobtype' => $jobtype, 'locationtype' => $locationtype); }
function cleanfloat($s) { return str2float(clean($s)); }
function data($data) { $title = clean($data['title']); $jobtype = clean($data['jobtype']); $deadline = clean($data['deadline']); $duration = str2float(clean($data['duration'])); $startdate = clean($data['startdate']); $enddate = clean($data['enddate']); $salarytype = clean($data['salarytype']); $salary = clean($data['salary']); if ($salarytype != 'other') { $salary = str2float($salary); } if ($jobtype == 'fulltime' || $jobtype == 'parttime') { $duration = ''; $enddate = ''; } $company = $data['company']; $desc = clean($data['desc']); $location = clean($data['location']); $locationtype = ''; if (isset($data['locationtype'])) { $locationtype = clean($data['locationtype']); } $geocode = Geocode::geocode($location); if ($locationtype) { $location = ''; $geocode = ''; } $requirements = clean($data['requirements']); return array('title' => $title, 'deadline' => $deadline, 'duration' => $duration, 'desc' => $desc, 'geocode' => $geocode, 'location' => $location, 'requirements' => $requirements, 'salary' => $salary, 'company' => $company, 'salarytype' => $salarytype, 'startdate' => $startdate, 'enddate' => $enddate, 'jobtype' => $jobtype, 'locationtype' => $locationtype); }
<?php global $MSublet, $MStudent; $sublets = $MSublet->getAll(); foreach ($sublets as $sublet) { $sublet['price'] = str2float($sublet['price']); if (preg_match('/^\\$/', $sublet['price'])) { $sublet['price'] = preg_replace('/^\\$/', '', $sublet['price']) . '<br/>'; } $MSublet->save($sublet, false); }