@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $error = null; |
31 | 31 | $activeSyntax = $syntaxes[0]->getTypeID(); |
32 | 32 | |
33 | -if($request->getBool('translate')) |
|
33 | +if ($request->getBool('translate')) |
|
34 | 34 | { |
35 | 35 | $commandsText = $request->getParam('mailcode'); |
36 | 36 | $activeSyntax = (string)$request->registerParam('syntax') |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | $error = $e->getMessage(); |
48 | 48 | |
49 | 49 | $collection = $e->getCollection(); |
50 | - if($collection) |
|
50 | + if ($collection) |
|
51 | 51 | { |
52 | 52 | $first = $collection->getFirstError(); |
53 | 53 | $error = $first->getMessage(); |
54 | 54 | $matched = $first->getMatchedText(); |
55 | - if(!empty($matched)) { |
|
55 | + if (!empty($matched)) { |
|
56 | 56 | $error .= '<br>'.t('In command:').' <code>'.$matched.'</code>'; |
57 | 57 | } |
58 | 58 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $selected = ''; |
120 | 120 | $typeID = $syntax->getTypeID(); |
121 | 121 | |
122 | - if($typeID === $activeSyntax) { |
|
122 | + if ($typeID === $activeSyntax) { |
|
123 | 123 | $selected = ' selected'; |
124 | 124 | } |
125 | 125 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | <p></p><br> |
140 | 140 | <h2><?php pt('Translated commands') ?></h2> |
141 | 141 | <?php |
142 | - if(empty($commandsText)) |
|
142 | + if (empty($commandsText)) |
|
143 | 143 | { |
144 | 144 | ?> |
145 | 145 | <div class="alert alert-info"> |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | </div> |
148 | 148 | <?php |
149 | 149 | } |
150 | - else if($error) |
|
150 | + else if ($error) |
|
151 | 151 | { |
152 | 152 | ?> |
153 | 153 | <div class="alert alert-danger"> |
@@ -40,8 +40,7 @@ discard block |
||
40 | 40 | try |
41 | 41 | { |
42 | 42 | $translated = translateMailcode($commandsText, $activeSyntax); |
43 | - } |
|
44 | - catch (Mailcode_Exception $e) |
|
43 | + } catch (Mailcode_Exception $e) |
|
45 | 44 | { |
46 | 45 | $translated = ''; |
47 | 46 | $error = $e->getMessage(); |
@@ -146,8 +145,7 @@ discard block |
||
146 | 145 | <?php pt('No commands specified.') ?> |
147 | 146 | </div> |
148 | 147 | <?php |
149 | - } |
|
150 | - else if($error) |
|
148 | + } else if($error) |
|
151 | 149 | { |
152 | 150 | ?> |
153 | 151 | <div class="alert alert-danger"> |
@@ -155,8 +153,7 @@ discard block |
||
155 | 153 | <?php echo $error ?> |
156 | 154 | </div> |
157 | 155 | <?php |
158 | - } |
|
159 | - else |
|
156 | + } else |
|
160 | 157 | { |
161 | 158 | ?> |
162 | 159 | <textarea class="form-control" rows="10"><?php echo htmlspecialchars($translated) ?></textarea> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $cacheFile = 'libphone.xml'; |
21 | 21 | $cacheExpiry = 60 * 60; // 1 hour |
22 | 22 | |
23 | -if(!file_exists($cacheFile) || (filemtime($cacheFile) + $cacheExpiry) < time()) |
|
23 | +if (!file_exists($cacheFile) || (filemtime($cacheFile) + $cacheExpiry) < time()) |
|
24 | 24 | { |
25 | 25 | try |
26 | 26 | { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | preg_match_all('/<!-- (\w+) \(([A-Z]+)\) -->/si', $xml, $result, PREG_PATTERN_ORDER); |
41 | 41 | |
42 | 42 | $lines = array(); |
43 | -foreach($result[1] as $idx => $country) |
|
43 | +foreach ($result[1] as $idx => $country) |
|
44 | 44 | { |
45 | 45 | $lines[] = sprintf( |
46 | 46 | " '%s' => '%s'", |
@@ -26,13 +26,11 @@ |
||
26 | 26 | { |
27 | 27 | $xml = FileHelper::downloadFile($xmlURL); |
28 | 28 | FileHelper::saveFile($cacheFile, $xml); |
29 | - } |
|
30 | - catch (FileHelper_Exception $e) |
|
29 | + } catch (FileHelper_Exception $e) |
|
31 | 30 | { |
32 | 31 | die('Unable to download the current libphonenumber XML from <a href="'.$xmlURL.'">'.$xmlURL.'</a>'); |
33 | 32 | } |
34 | -} |
|
35 | -else |
|
33 | +} else |
|
36 | 34 | { |
37 | 35 | $xml = FileHelper::readContents($cacheFile); |
38 | 36 | } |