Changeset 63 for trunk/Modules/Meet/Meet.php
- Timestamp:
- Aug 3, 2021, 11:20:41 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 nbproject2 Config.php3 1 .settings 4 2 .project 5 3 .buildpath 4 .htaccess
-
- Property svn:ignore
-
trunk/Modules/Meet/Meet.php
r61 r63 20 20 } 21 21 22 function GetTextBetween( &$Text, $Start, $End)22 function GetTextBetween(string &$Text, string $Start, string $End): string 23 23 { 24 24 $Result = ''; … … 32 32 } 33 33 34 function HumanDateTimeToTime( $DateTime)34 function HumanDateTimeToTime(string $DateTime): ?int 35 35 { 36 36 if ($DateTime == '') return NULL; … … 47 47 } 48 48 49 function HumanDateToTime( $Date)49 function HumanDateToTime(string $Date): ?int 50 50 { 51 51 if ($Date == '') return NULL; … … 53 53 } 54 54 55 function DecodeHtmlEnt( $str)55 function DecodeHtmlEnt(string $str): string 56 56 { 57 57 $prefix = '&#'; … … 90 90 } 91 91 92 function RemoveHtmlComments( $Content)92 function RemoveHtmlComments(string $Content): string 93 93 { 94 94 $Result = ''; … … 103 103 } 104 104 105 function is_alpha( $Char)105 function is_alpha(string $Char): bool 106 106 { 107 107 return (($Char >= 'a') and ($Char <= 'z')) or (($Char >= 'A') and ($Char <= 'Z')); 108 108 } 109 109 110 function is_white_space( $Char)110 function is_white_space(string $Char): bool 111 111 { 112 112 return ($Char == ' ') or ($Char == "\t"); 113 113 } 114 114 115 function GetDefaultMeetFilter( $Table = '')115 function GetDefaultMeetFilter(string $Table = ''): string 116 116 { 117 117 global $Config; … … 119 119 if ($Table != '') $Table = $Table.'.'; 120 120 121 return '('.$Table.'Hidden=0) AND ('.$Table.'Time > "'.TimeToMysqlDateTime(time() - $Config['MeetInterval']).'")';122 } 123 124 function GetNumberBeforeText( $Text, $Needle)121 return '('.$Table.'Hidden=0) AND ('.$Table.'Time > "'.TimeToMysqlDateTime(time() - (int)$Config['MeetInterval']).'")'; 122 } 123 124 function GetNumberBeforeText(string $Text, string $Needle): string 125 125 { 126 126 $Result = ''; … … 148 148 } 149 149 150 function GetNumberAfterText( $Text, $Needle)150 function GetNumberAfterText(string $Text, string $Needle): string 151 151 { 152 152 $Result = ''; … … 175 175 } 176 176 177 function GetAgeFromText( $Text)177 function GetAgeFromText(string $Text): string 178 178 { 179 179 $Text = strtolower($Text); … … 212 212 } 213 213 214 function GetHeightFromText( $Text)214 function GetHeightFromText(string $Text): string 215 215 { 216 216 $Text = strtolower($Text); … … 228 228 } 229 229 230 function GetWeightFromText( $Text)230 function GetWeightFromText(string $Text): string 231 231 { 232 232 $Text = strtolower($Text); … … 238 238 } 239 239 240 function GetAgeHeightWeightFromText( $Text)240 function GetAgeHeightWeightFromText(string $Text): array 241 241 { 242 242 $Result = array('', '', ''); … … 261 261 } 262 262 263 function GetEmailFromText( $Text)263 function GetEmailFromText(string $Text): string 264 264 { 265 265 $Result = ''; … … 302 302 ); 303 303 304 function GetLocationFromText( $Text)304 function GetLocationFromText(string $Text): string 305 305 { 306 306 global $Locations; … … 315 315 } 316 316 317 function GetGenderFromName( $Text)317 function GetGenderFromName(string $Text): string 318 318 { 319 319 $Gender = Gender::Male; … … 334 334 public $Database; 335 335 336 function Parse( $Id = null)336 function Parse(?int $Id = null): string 337 337 { 338 338 $Output = ''; … … 392 392 } 393 393 394 function Import() 394 function Import(): string 395 395 { 396 396 return ''; 397 397 } 398 398 399 function DoImport() 399 function DoImport(): string 400 400 { 401 401 $this->MeetItems = array(); … … 406 406 foreach ($this->MeetItems as $MeetItem) 407 407 { 408 if ($MeetItem->IsSpam()) continue; 408 409 $this->AddedCount += $MeetItem->AddIfNotExist($this->AddTimeInterval, $this->AddCompareTime, $this->AddCompareRemoteId); 409 410 } … … 434 435 var $RemoteId = ''; 435 436 436 function AddIfNotExist( $TimeInterval = 0, $CompareTime = true, $CompareRemoteId = false)437 function AddIfNotExist(int $TimeInterval = 0, bool $CompareTime = true, bool $CompareRemoteId = false): int 437 438 { 438 439 $Where = '(`Message` = "'.$this->Database->real_escape_string($this->Message).'") AND '. … … 473 474 return $Result; 474 475 } 475 } 476 477 function IsSpam(): bool 478 { 479 $Keywords = array('půjčk', 'úvěr'); 480 foreach ($Keywords as $Keyword) 481 { 482 if (strpos($this->Message, $Keyword) !== false) 483 { 484 return false; 485 } 486 } 487 return true; 488 } 489 }
Note:
See TracChangeset
for help on using the changeset viewer.