1 | <?php
|
---|
2 |
|
---|
3 | class MeetSourceSalsaDance extends MeetSource
|
---|
4 | {
|
---|
5 | function Import(): string
|
---|
6 | {
|
---|
7 | $Output = parent::Import();
|
---|
8 | $Content = file_get_contents($this->URL);
|
---|
9 | $BlockStart = '<ul class="comments">';
|
---|
10 | $BlockEnd = '<div class="content-paginator clearfix">';
|
---|
11 | $Content = GetTextBetween($Content, $BlockStart, $BlockEnd);
|
---|
12 | if ($Content == '')
|
---|
13 | {
|
---|
14 | $Output .= 'Main block not isolated.</br>';
|
---|
15 | return $Output;
|
---|
16 | }
|
---|
17 |
|
---|
18 | $ItemStart = '<li class="comment level-0">';
|
---|
19 | $ItemEnd = '</li>';
|
---|
20 | while (strpos($Content, $ItemStart) !== false)
|
---|
21 | {
|
---|
22 | $Item = GetTextBetween($Content, $ItemStart, $ItemEnd);
|
---|
23 | $MeetItem = new MeetItem();
|
---|
24 | $Time = trim(GetTextBetween($Item, '<span class="created">', '</span>'));
|
---|
25 | $Time = str_replace('. ', '.', $Time);
|
---|
26 | if (strpos($Time, 'dnes v') !== false)
|
---|
27 | $Time = str_replace('dnes v', HumanDate(time()), $Time);
|
---|
28 | if (strpos($Time, 'včera v') !== false)
|
---|
29 | $Time = str_replace('včera v', HumanDate(strtotime('-1 day', time())), $Time);
|
---|
30 | $MeetItem->Time = HumanDateTimeToTime($MeetItem->Time);
|
---|
31 | $MeetItem->Name = trim(GetTextBetween($Item, '<div class="comment-name">', '</div>'));
|
---|
32 | $MeetItem->Message = trim(GetTextBetween($Item, '<p>', '</p>'));
|
---|
33 | $MeetItem->Gender = Gender::Undefined;
|
---|
34 | $MeetItem->Email = GetEmailFromText($MeetItem->Message);
|
---|
35 | $MeetItem->Phone = '';
|
---|
36 | $MeetItem->Height = GetHeightFromText($MeetItem->Message);
|
---|
37 | $MeetItem->Weight = GetWeightFromText($MeetItem->Message);
|
---|
38 | $MeetItem->Age = GetAgeFromText($MeetItem->Message);
|
---|
39 | $MeetItem->Location = GetLocationFromText($MeetItem->Message);
|
---|
40 | $MeetItem->Database = $this->Database;
|
---|
41 | $MeetItem->Source = $this->Id;
|
---|
42 | $this->MeetItems[] = $MeetItem;
|
---|
43 | }
|
---|
44 | return $Output;
|
---|
45 | }
|
---|
46 | }
|
---|