function reformat($data, $registration = false) {
// Initializing aircompanies codes
$iata = new iata;
for ($i = 0; $i < count($data); $i = $i + 6) {
if ($registration) {
$r = str_replace('<nobr>', '', $this->prep_value($data[$i]));
$block[$i]['reis'] = str_replace('</nobr>', '', $r);
$a = explode(' ', $block[$i]['reis']);
$block[$i]['company'] = $a[0];
} else {
$r = explode(' ', $this->prep_value($data[$i]));
$block[$i]['reis'] = (strlen($r[0]) > 2) ? strrev(substr(strrev($r[0]), 15, 2)) . ' ' . $r[1] : $r[0] . ' ' . $r[1];
$block[$i]['company'] = (strlen($r[0]) > 2) ? strrev(substr(strrev($r[0]), 15, 2)) : $r[0];
}
$block[$i]['companyname'] = $iata->aircompanies[strtoupper($block[$i]['company'])];
if (file_exists(ROOT_HTML_PATH . '/content/aircompanies/' . $block[$i]['company'] . '.png')) {
$block[$i]['company'] = $block[$i]['company'] . '.png';
} else {
/**
* @todo Write e-mail notifications, but only once;
*/
}
$block[$i]['airport'] = $this->prep_value($data[$i + 1]);
$block[$i]['terminal'] = substr(strrev($this->prep_value($data[$i + 2])), 2, 1);
$block[$i]['shedtime'] = $this->prep_value($data[$i + 3]);
$block[$i]['facttime'] = str_replace(' ', '', $this->prep_value($data[$i + 4]));
$block[$i]['status'] = str_replace(' ', '<br />', trim(strip_tags($this->prep_value($data[$i + 5]), '<img />'), ' /r/n'));
$block[$i]['status'] = str_replace(';', '', $block[$i]['status']);
}
return $block;
}
|
|||
|
But it is many questions here:
It is really bad idea. May be you need a little another cycle, like
It would be much better. But I cannot know it for sure. |
|||||||||
|