Changeset 20 for trunk/Import/Amblar.php


Ignore:
Timestamp:
Dec 26, 2018, 11:55:16 AM (6 years ago)
Author:
chronos
Message:
  • Added: Meet list filtering by name, location and message text.
  • Fixed: Amblar meet source date parsing.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Import/Amblar.php

    r17 r20  
    5353        else $MeetItem->Gender = Gender::Male;
    5454      $MeetItem->Name = trim(GetTextBetween($Item, '<span class="dwqa-author">', '</span>'));
     55      $Type = trim(GetTextBetween($Item, ' ', ' '));
     56      if ($Type == 'odpovězeno') continue;
    5557      $MeetItem->Date = trim(GetTextBetween($Item, '<span class="dwqa-date">', '</span>'));
    56       if ($MeetItem->Date == 'před 1 dní') $MeetItem->Date = strtotime("-1 days");
    57         else if ($MeetItem->Date == 'před 2 dny') $MeetItem->Date = strtotime("-2 days");
    58         else $MeetItem->Date = HumanDateToTime($MeetItem->Date);
     58      if (mb_substr($MeetItem->Date, 0, 4) == 'před')
     59      {           
     60        $Parts = explode(' ', $MeetItem->Date);
     61        if ($Parts[2] == 'hours') $MeetItem->Date = strtotime("-".$Parts[1]." hours");
     62        else if ($Parts[2] == 'dní') $MeetItem->Date = strtotime("-".$Parts[1]." days");
     63        else if ($Parts[2] == 'dny') $MeetItem->Date = strtotime("-".$Parts[1]." days");
     64      } else $MeetItem->Date = HumanDateToTime($MeetItem->Date);
    5965      $MeetItem->Email = '';
    6066      $MeetItem->Message = '';
Note: See TracChangeset for help on using the changeset viewer.