Changeset 31 for trunk/Import


Ignore:
Timestamp:
Dec 30, 2018, 7:37:55 PM (6 years ago)
Author:
chronos
Message:
  • Modified: Store date of meet items including time. For items without specified time, just use current time (time of import).
Location:
trunk/Import
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Import/Amblar.php

    r20 r31  
    5555      $Type = trim(GetTextBetween($Item, ' ', ' '));
    5656      if ($Type == 'odpovězeno') continue;
    57       $MeetItem->Date = trim(GetTextBetween($Item, '<span class="dwqa-date">', '</span>'));
    58       if (mb_substr($MeetItem->Date, 0, 4) == 'před')
     57      $MeetItem->Time = trim(GetTextBetween($Item, '<span class="dwqa-date">', '</span>'));
     58      if (mb_substr($MeetItem->Time, 0, 4) == 'před')
    5959      {           
    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);
     60        $Parts = explode(' ', $MeetItem->Time);
     61        if ($Parts[2] == 'hours') $MeetItem->Time = strtotime("-".$Parts[1]." hours");
     62        else if ($Parts[2] == 'dní') $MeetItem->Time = strtotime("-".$Parts[1]." days");
     63        else if ($Parts[2] == 'dny') $MeetItem->Time = strtotime("-".$Parts[1]." days");
     64      } else $MeetItem->Time = HumanDateTimeToTime($MeetItem->Time.' '.HumanTime(time()));
    6565      $MeetItem->Email = '';
    6666      $MeetItem->Message = '';
  • trunk/Import/AstraPraha.php

    r26 r31  
    2323      $Item = GetTextBetween($Content, $ItemStart, $ItemEnd);
    2424      $MeetItem = new MeetItem();
    25       $MeetItem->Date = trim(GetTextBetween($Item, 'Vloženo:', '</p>'));
    26       $MeetItem->Date = HumanDateToTime($MeetItem->Date);
     25      $MeetItem->Time = trim(GetTextBetween($Item, 'Vloženo:', '</p>'));
     26      $MeetItem->Time = HumanDateTimeToTime($MeetItem->Time.' '.HumanTime(time()));
    2727
    2828      $MeetItem->Gender = trim(GetTextBetween($Item, '<h3 class=\'dating-heading\'>', '</h3>'));
  • trunk/Import/Csts.php

    r26 r31  
    2929        else $MeetItem->Gender = Gender::Undefined;
    3030      $MeetItem->Name = trim(html_entity_decode(GetTextBetween($Item, 'Vložil/a', ',')));
    31       $MeetItem->Date = trim(GetTextBetween($Item, ' ', '</th>'));
    32       $MeetItem->Date = HumanDateTimeToTime($MeetItem->Date);
     31      $MeetItem->Time = trim(GetTextBetween($Item, ' ', '</th>'));
     32      $MeetItem->Time = HumanDateTimeToTime($MeetItem->Time);
    3333      $MeetItem->Height = trim(GetTextBetween($Item, "výška:", 'cm'));
    3434      $MeetItem->Message = trim(html_entity_decode(strip_tags(GetTextBetween($Item, '<td colspan="3">', '</td>'))));
  • trunk/Import/Eso.php

    r23 r31  
    3535        $Small = substr($Small, strpos($Small, '/') + 1);
    3636      }     
    37       $MeetItem->Date = trim($Small);
    38       $MeetItem->Date = HumanDateTimeToTime($MeetItem->Date);
     37      $MeetItem->Time = trim($Small);
     38      $MeetItem->Time = HumanDateTimeToTime($MeetItem->Time.' '.HumanTime(time()));
    3939      $MeetItem->Message = trim(GetTextBetween($Item, '<p class="lead">', '</p>'));
    4040      $MeetItem->Age = GetAgeFromText($MeetItem->Message);     
  • trunk/Import/Facebook.php

    r23 r31  
    3232        else $MeetItem->Gender = Gender::Undefined;
    3333      $MeetItem->Name = trim(html_entity_decode(GetTextBetween($Item, '<span class="_39_n">', '</span>')));
    34       $MeetItem->Date = trim(GetTextBetween($Item, ' ', '</th>'));
    35       $MeetItem->Date = HumanDateTimeToTime($MeetItem->Date);
     34      $MeetItem->Time = trim(GetTextBetween($Item, ' ', '</th>'));
     35      $MeetItem->Time = HumanDateTimeToTime($MeetItem->Time);
    3636      $MeetItem->Height = trim(GetTextBetween($Item, "výška:", 'cm'));
    3737      $MeetItem->Message = trim(html_entity_decode(strip_tags(GetTextBetween($Item, 'data-ft="&#123;&quot;tn&quot;:&quot;K&quot;&#125;">', '</div>'))));
  • trunk/Import/MajkluvSvet.php

    r14 r31  
    4242        $MeetItem->Email = trim(substr($MeetItem->Email, strpos($MeetItem->Email, '|') + 1));
    4343      } else $MeetItem->Phone = '';
    44       $MeetItem->Date = trim(GetTextBetween($Item, "<span id='datum1", '</span>'));
    45       $MeetItem->Date = substr($MeetItem->Date, strpos($MeetItem->Date, '>') + 1);
    46       $MeetItem->Date = HumanDateTimeToTime($MeetItem->Date);
     44      $MeetItem->Time = trim(GetTextBetween($Item, "<span id='datum1", '</span>'));
     45      $MeetItem->Time = substr($MeetItem->Time, strpos($MeetItem->Time, '>') + 1);
     46      $MeetItem->Time = HumanDateTimeToTime($MeetItem->Time);
    4747      $MeetItem->Link = 'http://www.majkluvsvet.cz'.trim(GetTextBetween($Item, "<span class='linkk pravo'><a href='", "'>odkaz"));
    4848      $MeetItem->Database = $this->Database;
  • trunk/Import/SalsaDance.php

    r11 r31  
    2222      $Item = GetTextBetween($Content, $ItemStart, $ItemEnd);
    2323      $MeetItem = new MeetItem();
    24       $MeetItem->Date = trim(GetTextBetween($Item, '<span class="created">', '</span>'));
    25       $MeetItem->Date = str_replace('. ', '.', $MeetItem->Date);
    26       if (strpos($MeetItem->Date, 'dnes v') !== false)
    27         $MeetItem->Date = str_replace('dnes v', HumanDate(time()), $MeetItem->Date);
    28       if (strpos($MeetItem->Date, 'včera v') !== false)
    29         $MeetItem->Date = str_replace('včera v', HumanDate(strtotime('-1 day', time())), $MeetItem->Date);
    30       $MeetItem->Date = HumanDateTimeToTime($MeetItem->Date);
     24      $MeetItem->Time = trim(GetTextBetween($Item, '<span class="created">', '</span>'));
     25      $MeetItem->Time = str_replace('. ', '.', $MeetItem->Time);
     26      if (strpos($MeetItem->Time, 'dnes v') !== false)
     27        $MeetItem->Time = str_replace('dnes v', HumanDate(time()), $MeetItem->Time);
     28      if (strpos($MeetItem->Time, 'včera v') !== false)
     29        $MeetItem->Time = str_replace('včera v', HumanDate(strtotime('-1 day', time())), $MeetItem->Time);
     30      $MeetItem->Time = HumanDateTimeToTime($MeetItem->Time);
    3131      $MeetItem->Name = trim(GetTextBetween($Item, '<div class="comment-name">', '</div>'));
    3232      $MeetItem->Message = trim(GetTextBetween($Item, '<p>', '</p>'));
  • trunk/Import/Seznamka.php

    r30 r31  
    4040      $MeetItem->Age = trim(str_replace('let', '', $MeetItem->Age));
    4141      $MeetItem->Location = trim(GetTextBetween($Item, ' rel="nofollow">', '</a></span>'));
    42       $MeetItem->Date = HumanDateToTime(trim(GetTextBetween($Item, '> </a>', '</span>')));
     42      $MeetItem->Time = HumanDateTimeToTime(trim(GetTextBetween($Item, '> </a>', '</span>')).' '.HumanTime(time()));
    4343      $MeetItem->Message = trim(strip_tags(GetTextBetween($Item, 'margin-top:10px;\'>', '</div>')));
    4444      $MeetItem->Link = GetTextBetween($Item, "<a href='", "'");
  • trunk/Import/TanecniSkola.php

    r16 r31  
    4747      {
    4848        $MeetItem = new MeetItem();
    49         $MeetItem->Date = HumanDateToTime(trim(GetTextBetween($Item, '<h3>', '</h3>')));
    50         if ($MeetItem->Date != null)
     49        $MeetItem->Time = HumanDateTimeToTime(trim(GetTextBetween($Item, '<h3>', '</h3>')).' '.HumanTime(time()));
     50        if ($MeetItem->Time != null)
    5151        {
    52           $PreviousTime = $MeetItem->Date;
    53         } else $MeetItem->Date = $PreviousTime;
     52          $PreviousTime = $MeetItem->Time;
     53        } else $MeetItem->Time = $PreviousTime;
    5454
    5555        $Part = GetTextBetween($Item, '</strong>', '<strong>');
  • trunk/Import/Vavruska.php

    r11 r31  
    2525      $MeetItem = new MeetItem();
    2626
    27       $MeetItem->Date = MysqlDateTimeToTime(trim(GetTextBetween($Item, 'přidáno:', '</i>')));
     27      $MeetItem->Time = MysqlDateTimeToTime(trim(GetTextBetween($Item, 'přidáno:', '</i>')));
    2828      $MeetItem->Gender = trim(GetTextBetween($Item, '<img src=/design/', 'alt="avatar"'));
    2929      if ($MeetItem->Gender == 'avatar_m_03.png') $MeetItem->Gender = Gender::Male;
Note: See TracChangeset for help on using the changeset viewer.