Changeset 11
- Timestamp:
- Aug 26, 2018, 8:53:55 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Import/Amblar.php
r10 r11 28 28 function Import() 29 29 { 30 echo('Parsing '.$this->Name.'...</br>');30 parent::Import(); 31 31 $Content = file_get_contents($this->URL); 32 32 … … 53 53 else $MeetItem->Gender = Gender::Male; 54 54 $MeetItem->Name = trim(GetTextBetween($Item, '<span class="dwqa-author">', '</span>')); 55 $MeetItem->Date = HumanDateToTime(trim(GetTextBetween($Item, '<span class="dwqa-date">', '</span>'))); 55 $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 $MeetItem->Date = HumanDateToTime($MeetItem->Date); 56 58 $MeetItem->Email = ''; 57 59 $MeetItem->Message = ''; … … 64 66 $MeetItem->Source = $this->Id; 65 67 $this->ImportItem($MeetItem); 66 $ MeetItem->AddIfNotExist();68 $this->AddedCount += $MeetItem->AddIfNotExist(); 67 69 } 68 70 } -
trunk/Import/AstraPraha.php
r8 r11 5 5 function Import() 6 6 { 7 echo('Parsing '.$this->Name.'...</br>');7 parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 $Content = RemoveHtmlComments($Content);10 9 11 $BlockStart = ' ----------------------------------------------';12 $BlockEnd = '< script type="text/javascript"';10 $BlockStart = '<h2>Tanečního partnera hledají:</h2>'; 11 $BlockEnd = '<hr />'; 13 12 $Content = GetTextBetween($Content, $BlockStart, $BlockEnd); 14 13 if ($Content == '') … … 18 17 } 19 18 20 $ItemStart = '< /div><h2></h2>';21 $ItemEnd = '< div class="clearer"></div><div class="clearer">';19 $ItemStart = '<p class=\'dating-date\'>'; 20 $ItemEnd = '<hr class=\'dating-spacer\' />'; 22 21 while (strpos($Content, $ItemStart) !== false) 23 22 { 24 23 $Item = GetTextBetween($Content, $ItemStart, $ItemEnd); 25 24 $MeetItem = new MeetItem(); 26 $MeetItem->Gender = trim(GetTextBetween($Item, ');"><u>', '</u>')); 25 $MeetItem->Date = trim(GetTextBetween($Item, 'Vloženo:', '</p>')); 26 $MeetItem->Date = HumanDateToTime($MeetItem->Date); 27 28 $MeetItem->Gender = trim(GetTextBetween($Item, '<h3 class=\'dating-heading\'>', '</h3>')); 27 29 if ($MeetItem->Gender == 'Hledám partnerku') $MeetItem->Gender = Gender::Male; 28 30 else $MeetItem->Gender = Gender::Female; 29 $End = '<em>'; 30 $MeetItem->Message = trim(substr($Item, 0, strpos($Item, $End))); 31 $Item = substr($Item, strpos($Item, $End) + strlen($End)); 32 $MeetItem->Message = trim(strip_tags($MeetItem->Message)); 33 $MeetItem->Date = trim(GetTextBetween($Item, 'datum vložení', '</em>')); 34 if (substr($MeetItem->Date, 0, 1) == ':') 35 $MeetItem->Date = trim(substr($MeetItem->Date, 1)); 36 $MeetItem->Date = HumanDateToTime($MeetItem->Date); 37 $MeetItem->Email = GetEmailFromText($MeetItem->Message); 31 $MeetItem->Message = trim(GetTextBetween($Item, '<p class=\'last-element\'>', '</p>')); 32 $MeetItem->Email = trim(GetTextBetween($Item, 'class="nowrap text-link">', '</a>')); 38 33 $MeetItem->Name = ''; 39 34 $MeetItem->Age = GetAgeFromText($MeetItem->Message); … … 44 39 $MeetItem->Database = $this->Database; 45 40 $MeetItem->Source = $this->Id; 46 $ MeetItem->AddIfNotExist();41 $this->AddedCount += $MeetItem->AddIfNotExist(); 47 42 } 48 43 } -
trunk/Import/SalsaDance.php
r8 r11 5 5 function Import() 6 6 { 7 echo('Parsing '.$this->Name.'...</br>');7 parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 9 $BlockStart = '<ul class="comments">'; … … 40 40 $MeetItem->Database = $this->Database; 41 41 $MeetItem->Source = $this->Id; 42 //print_r($MeetItem); 43 $MeetItem->AddIfNotExist(); 42 $this->AddedCount += $MeetItem->AddIfNotExist(); 44 43 } 45 44 } -
trunk/Import/Seznamka.php
r8 r11 5 5 function Import() 6 6 { 7 echo('Parsing '.$this->Name.'...</br>');7 parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 9 $BlockStart = 'Tanec ...</h1 class=\'nadpis\'>'; … … 42 42 $MeetItem->Database = $this->Database; 43 43 $MeetItem->Source = $this->Id; 44 //unset($MeetItem->Database); 45 //print_r($MeetItem); 46 $MeetItem->AddIfNotExist(); 44 $this->AddedCount += $MeetItem->AddIfNotExist(); 47 45 } 48 46 } -
trunk/Import/TanecniSkola.php
r8 r11 26 26 ); 27 27 28 echo('Parsing '.$this->Name.'...</br>');28 parent::Import(); 29 29 $Content = file_get_contents($this->URL); 30 30 … … 85 85 $MeetItem->Database = $this->Database; 86 86 $MeetItem->Source = $this->Id; 87 $ MeetItem->AddIfNotExist();87 $this->AddedCount += $MeetItem->AddIfNotExist(); 88 88 } 89 89 } -
trunk/Import/Vavruska.php
r8 r11 5 5 function Import() 6 6 { 7 echo('Parsing '.$this->Name.'...</br>');7 parent::Import(); 8 8 $Content = file_get_contents($this->URL); 9 9 … … 39 39 $MeetItem->Database = $this->Database; 40 40 $MeetItem->Source = $this->Id; 41 $ MeetItem->AddIfNotExist();41 $this->AddedCount += $MeetItem->AddIfNotExist(); 42 42 } 43 43 } -
trunk/Meet.php
r10 r11 145 145 146 146 $Result = trim(substr($Result, 0, $End + 1)); 147 break;147 if (is_numeric($Result)) break; 148 148 } else break; 149 149 } … … 153 153 function GetAgeFromText($Text) 154 154 { 155 $Text = strtolower($Text); 155 156 $Result = GetNumberBeforeText($Text, 'let'); 156 if ($Result == '') $Result = GetNumberAfterText($Text, 'Je mi'); 157 if ($Result == '') $Result = GetNumberAfterText($Text, 'je mi'); 158 if ($Result == '') $Result = GetNumberAfterText($Text, 'jsem'); 157 159 if ($Result == '') $Result = GetNumberAfterText($Text, 'čerstvých'); 158 160 if ($Result == '') $Result = GetAgeHeightWeightFromText($Text)[0]; … … 162 164 function GetHeightFromText($Text) 163 165 { 166 $Text = strtolower($Text); 164 167 $Result = GetNumberBeforeText($Text, 'cm'); 165 168 if ($Result == '') $Result = GetNumberAfterText($Text, 'měřím'); 169 if ($Result == '') $Result = GetNumberAfterText($Text, 'merim'); 166 170 if ($Result == '') $Result = GetNumberBeforeText($Text, 'bez podpatků'); 167 171 if ($Result == '') $Result = GetAgeHeightWeightFromText($Text)[1]; … … 171 175 function GetWeightFromText($Text) 172 176 { 177 $Text = strtolower($Text); 173 178 $Result = GetNumberBeforeText($Text, 'kg'); 174 179 if ($Result == '') $Result = GetAgeHeightWeightFromText($Text)[2]; … … 233 238 public $Database; 234 239 235 function ParseAll() 236 { 237 $DbResult = $this->Database->select('MeetSource', '*'); 240 function Parse($Id = null) 241 { 242 if (($Id != null) and is_numeric($Id)) $Where = 'Id='.$Id; 243 else $Where = '1'; 244 $DbResult = $this->Database->select('MeetSource', '*', $Where); 238 245 while ($DbRow = $DbResult->fetch_assoc()) 239 246 { … … 267 274 public $Id; 268 275 public $Database; 276 277 function Import() 278 { 279 $this->AddedCount = 0; 280 echo('Parsing '.$this->Name.' ('.$this->Id.')...</br>'); 281 } 269 282 } 270 283 … … 310 323 'Link' => $this->Link, 311 324 )); 312 } 313 } 314 } 325 $Result = 1; 326 } else $Result = 0; 327 return($Result); 328 } 329 } -
trunk/index.php
r9 r11 111 111 $MeetSources = new MeetSources(); 112 112 $MeetSources->Database = $this->Database; 113 $MeetSources->ParseAll(); 113 if (array_key_exists('i', $_GET)) $MeetSources->Parse($_GET['i']); 114 else $MeetSources->Parse(); 114 115 } 115 116 … … 267 268 $Output .= $PageList['Output']; 268 269 $Output .= '</div>'; 270 $Output .= '<a href="'.$this->Link('/seznamka-rss/').'"><img src="'.$this->Link('/images/rss20.png').'" alt="rss20"/></a><br/>'; 269 271 270 272 return($Output); … … 324 326 '</head><body>'; 325 327 $Output .= $Content; 326 $Output .= '< div class="footer">Kontakt: <a href="mailto:'.$Config['Contact'].'">'.$Config['Contact'].'</a> '.328 $Output .= '<br/><div class="footer">Kontakt: <a href="mailto:'.$Config['Contact'].'">'.$Config['Contact'].'</a> '. 327 329 '<a href="https://svn.zdechov.net/trac/tanec/">Zdrojový kód</a></div>'; 328 330 $Output .= '</body></html>';
Note:
See TracChangeset
for help on using the changeset viewer.