120, '120 cm - 130 cm' => 125, '125 cm - 135 cm' => 130, '130 cm - 140 cm' => 135, '135 cm - 145 cm' => 140, '140 cm - 150 cm' => 145, '145 cm - 155 cm' => 150, '150 cm - 160 cm' => 155, '155 cm - 165 cm' => 160, '160 cm - 170 cm' => 165, '165 cm - 175 cm' => 170, '170 cm - 180 cm' => 175, '175 cm - 185 cm' => 180, '180 cm - 190 cm' => 185, '185 cm - 195 cm' => 190, '190 cm - 200 cm' => 195, '195 cm - 205 cm' => 200, '200 cm <' => 205, ); $Content = file_get_contents($this->URL); $BlockStart = 'data-content="inzeraty">'; $BlockEnd = ''; $Content = GetTextBetween($Content, $BlockStart, $BlockEnd); if ($Content == '') { $Output .= 'Main block not isolated.
'; return $Output; } $ItemStart = '
'; $ItemEnd = 'Odpovědět na inzerát

'; $PreviousTime = null; while (strpos($Content, $ItemStart) !== false) { $Item = GetTextBetween($Content, $ItemStart, $ItemEnd); if ($Item != '') { $MeetItem = new MeetItem(); $Time = trim(GetTextBetween($Item, '

', '

')); if ($Time == 'Včera') $Time = HumanDate(time() - 60*60*24); else if ($Time == 'Dnes') $Time = HumanDate(time()); else { $Time = str_replace('ledna', '1.', $Time); $Time = str_replace('února', '2.', $Time); $Time = str_replace('března', '3.', $Time); $Time = str_replace('dubna', '4.', $Time); $Time = str_replace('května', '5.', $Time); $Time = str_replace('června', '6.', $Time); $Time = str_replace('července', '7.', $Time); $Time = str_replace('srpna', '8.', $Time); $Time = str_replace('září', '9.', $Time); $Time = str_replace('října', '10.', $Time); $Time = str_replace('listopadu', '11.', $Time); $Time = str_replace('prosince', '1.', $Time); } $MeetItem->Time = HumanDateToTime($Time); if ($MeetItem->Time != null) { $PreviousTime = $MeetItem->Time; } else $MeetItem->Time = $PreviousTime; $Part = GetTextBetween($Item, '

', '

'); if (strpos($Part, '(') !== false) { $MeetItem->Name = substr($Part, 0, strpos($Part, '(')); $MeetItem->Age = substr($Part, strpos($Part, '(') + 1); $MeetItem->Age = substr($MeetItem->Age, 0, strpos($MeetItem->Age, ')')); $MeetItem->Age = trim(str_replace('let', '', $MeetItem->Age)); } else { $MeetItem->Name = $Part; $MeetItem->Age = ''; } $Gender = trim(GetTextBetween($Item, '', '

')); if ($Gender == 'Hledám partnera') $MeetItem->Gender = Gender::Female; else if ($Gender == 'Hledám partnerku') $MeetItem->Gender = Gender::Male; else $MeetItem->Gender = Gender::Undefined; $MeetItem->Height = trim(GetTextBetween($Item, '

', '

')); while (strpos($MeetItem->Height, ' ') !== false) { $MeetItem->Height = str_replace(' ', ' ', $MeetItem->Height); } if (array_key_exists($MeetItem->Height, $HeightRange)) $MeetItem->Height = $HeightRange[$MeetItem->Height]; $MeetItem->Message = trim(GetTextBetween($Item, '

', '

')); $MeetItem->Email = GetEmailFromText($MeetItem->Message); $MeetItem->Weight = GetWeightFromText($MeetItem->Message); // Update age only if it is not set already if ($MeetItem->Age == '') { $MessageAge = GetAgeFromText($MeetItem->Message); if ($MessageAge != '') $MeetItem->Age = $MessageAge; } // Update height from message text even if height is already set // because it can be more precise $MessageHeight = GetHeightFromText($MeetItem->Message); if ($MessageHeight != '') $MeetItem->Height = $MessageHeight; $MeetItem->Location = 'Praha'; $MeetItem->Database = $this->Database; $MeetItem->Source = $this->Id; //print_r($MeetItem); $this->MeetItems[] = $MeetItem; } } return $Output; } }