Changeset 894 for trunk/Modules/Export/CreateAddon.php
- Timestamp:
- Mar 6, 2023, 12:16:38 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/CreateAddon.php
r893 r894 6 6 { 7 7 // Replace special codes by lua functions 8 function ReplaceVarInText( $string, $strlower = 'strlower')8 function ReplaceVarInText(string $string, string $strlower = 'strlower'): string 9 9 { 10 10 $string = str_replace('$N', '"..'.$strlower.'(UnitName("player")).."', $string); … … 47 47 } 48 48 49 function ReplaceEnText($string) 50 { 51 // $string = mysql_escape_string($string); 49 function ReplaceEnText(string $string): string 50 { 52 51 $string = strtolower($string); 53 54 52 $string = str_replace('"', '\"', $string); 55 53 $string = str_replace('$b$b', ' ', $string); … … 62 60 $string = str_replace('\\n', ' ', $string); 63 61 $string = str_replace(' ', '', $string); 64 // while (strpos($string, ' '))65 // $string = str_replace(' ', ' ', $string);66 62 return $string; 67 63 } 68 64 69 function ReplaceCzText( $string)65 function ReplaceCzText(string $string): string 70 66 { 71 67 $string = $this->Database->real_escape_string($string); … … 76 72 } 77 73 78 function NotCancel($string) 79 { 80 //echo (strpos($string,'<html>')); 74 function NotCancel(string $string): bool 75 { 81 76 if (strpos($string,'<html>') > -1) return false; 82 77 else return true; 83 78 } 84 79 85 function my_trim( $string)80 function my_trim(string $string): string 86 81 { 87 82 $string = addslashes($string); … … 99 94 } 100 95 101 function MakeLanguageFiles() 102 { 103 global $CreatedFileList; 104 96 function MakeLanguageFiles(): string 97 { 105 98 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 106 99 … … 116 109 while ($Group = $DbResult->fetch_assoc()) 117 110 { 118 //získání čísla verze pro export111 // získání čísla verze pro export 119 112 $ID = $this->Database->query('SELECT LastVersion FROM `Group` WHERE Id = '.$Group['Id']); 120 113 $LastVersion = $ID->fetch_assoc(); … … 141 134 $TableTexts = array(); 142 135 143 // old version144 // get version before136 // old version 137 // get version before 145 138 $BuildNumber = $ExportVersion; 146 139 if ($ExportVersion == '') $BuildNumber = $this->ClientVersion['BuildNumber']; … … 152 145 $ExportVersionOld = $ExportVersionOld['BuildNumber']; 153 146 154 $DbResult2 = $this->Database->query($this->BuildQuery($Group, $ExportVersionOld));147 $DbResult2 = $this->Database->query($this->BuildQuery($Group, $ExportVersionOld)); 155 148 while ($Line = $DbResult2->fetch_assoc()) 156 149 { 157 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 158 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 150 $Text = $Line['En'.$Column['Column']]; 151 if ($Text == null) $Text = ''; 152 $en = trim($this->ReplaceEnText($Text)); 153 $Text = $Line[$Column['Column']]; 154 if ($Text == null) $Text = ''; 155 $cz = $this->ReplaceCzText($Text); 159 156 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 160 157 { … … 165 162 //last version 166 163 167 $DbResult2 = $this->Database->query($this->BuildQuery($Group, $ExportVersion));164 $DbResult2 = $this->Database->query($this->BuildQuery($Group, $ExportVersion)); 168 165 while ($Line = $DbResult2->fetch_assoc()) 169 166 { 170 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 171 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 167 $Text = $Line['En'.$Column['Column']]; 168 if ($Text == null) $Text = ''; 169 $en = trim($this->ReplaceEnText($Text)); 170 $Text = $Line[$Column['Column']]; 171 if ($Text == null) $Text = ''; 172 $cz = $this->ReplaceCzText($Text); 172 173 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 173 174 { … … 221 222 } 222 223 223 function MakeClientStrings() 224 function MakeClientStrings(): void 224 225 { 225 226 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); … … 232 233 233 234 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`TablePrefix` != "" AND `Group`.`Id` = 14'); 234 //$Group = $DbResult->fetch_assoc();235 235 if ($DbResult->num_rows == 0) 236 236 $CanGenerated = '-1'; … … 255 255 } 256 256 257 function MakeAddon() 257 function MakeAddon(): string 258 258 { 259 259 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true); … … 264 264 } 265 265 266 function MakeReadme() 266 function MakeReadme(): void 267 267 { 268 268 $DbResult = $this->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC');
Note:
See TracChangeset
for help on using the changeset viewer.