- Timestamp:
- Dec 26, 2018, 10:45:44 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Import/Csts.php
r20 r24 33 33 $MeetItem->Height = trim(GetTextBetween($Item, "výška:", 'cm')); 34 34 $MeetItem->Message = trim(html_entity_decode(strip_tags(GetTextBetween($Item, '<td colspan="3">', '</td>')))); 35 // Replace unicode non-breakable space by normal space 36 $MeetItem->Message = str_replace("\xc2\xa0", "\x20", $MeetItem->Message); 35 37 $MeetItem->Age = GetAgeFromText($MeetItem->Message); 36 38 $MeetItem->Height = GetHeightFromText($MeetItem->Message); -
trunk/Meet.php
r23 r24 104 104 } 105 105 106 function is_white_space($Char) 107 { 108 return ($Char == ' ') or ($Char == "\t"); 109 } 110 106 111 function GetNumberBeforeText($Text, $Needle) 107 112 { … … 120 125 $Text = substr($Text, $Pos + 1); 121 126 $Start = $Pos - 1; 122 while (($Start >= 0) and (is_numeric($Result[$Start]) or ($Result[$Start] == ' ')))127 while (($Start >= 0) and (is_numeric($Result[$Start]) or is_white_space($Result[$Start]))) 123 128 $Start--; 124 129 $Start++; … … 146 151 $Text = substr($Text, $Pos + 1); 147 152 $End = 0; 148 while (($End < strlen($Result)) and (is_numeric($Result[$End]) or ($Result[$End] == ' ')))153 while (($End < strlen($Result)) and (is_numeric($Result[$End]) or is_white_space($Result[$End]))) 149 154 $End++; 150 155 $End--; … … 167 172 if ($Result == '') $Result = GetNumberAfterText($Text, 'čerstvých'); 168 173 if ($Result == '') $Result = GetAgeHeightWeightFromText($Text)[0]; 169 if ($Result == '') $Result = date('Y', time()) - GetNumberAfterText($Text, 'ročník'); 174 if ($Result == '') { 175 $Year = GetNumberAfterText($Text, 'ročník'); 176 if ($Year != '') $Result = date('Y', time()) - $Year; 177 } 170 178 return $Result; 171 179 }
Note:
See TracChangeset
for help on using the changeset viewer.