Skip to content

Commit f788c99

Browse files
committed
Refactor CSS, remove old school gradients + rounded corners; remove inline CSS.
1 parent cb1382c commit f788c99

File tree

1 file changed

+43
-47
lines changed

1 file changed

+43
-47
lines changed

unzipper.php

Lines changed: 43 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct() {
4040
self::$status = '.zip or .gz files found, ready for extraction';
4141
}
4242
else {
43-
self::$status = '<span style="color:red; font-weight:bold;font-size:120%;">Error: No .zip or .gz files found.</span>';
43+
self::$status = '<span class="status--ERROR">Error: No .zip or .gz files found.</span>';
4444
}
4545
}
4646

@@ -87,7 +87,7 @@ public static function extract($archive, $destination) {
8787
public static function extractZipArchive($archive, $destination) {
8888
// Check if webserver supports unzipping.
8989
if (!class_exists('ZipArchive')) {
90-
self::$status = '<span style="color:red; font-weight:bold;font-size:120%;">Error: Your PHP version does not support unzip functionality.</span>';
90+
self::$status = '<span class="status--ERROR">Error: Your PHP version does not support unzip functionality.</span>';
9191
return;
9292
}
9393

@@ -99,14 +99,14 @@ public static function extractZipArchive($archive, $destination) {
9999
if (is_writeable($destination . '/')) {
100100
$zip->extractTo($destination);
101101
$zip->close();
102-
self::$status = '<span style="color:green; font-weight:bold;font-size:120%;">Files unzipped successfully</span>';
102+
self::$status = '<span class="status--OK">Files unzipped successfully</span>';
103103
}
104104
else {
105-
self::$status = '<span style="color:red; font-weight:bold;font-size:120%;">Error: Directory not writeable by webserver.</span>';
105+
self::$status = '<span class="status--ERROR">Error: Directory not writeable by webserver.</span>';
106106
}
107107
}
108108
else {
109-
self::$status = '<span style="color:red; font-weight:bold;font-size:120%;">Error: Cannot read .zip archive.</span>';
109+
self::$status = '<span class="status--ERROR">Error: Cannot read .zip archive.</span>';
110110
}
111111
}
112112

@@ -119,7 +119,7 @@ public static function extractZipArchive($archive, $destination) {
119119
public static function extractGzipFile($archive, $destination) {
120120
// Check if zlib is enabled
121121
if (!function_exists('gzopen')) {
122-
self::$status = '<span style="color:red; font-weight:bold;font-size:120%;">Error: Your PHP has no zlib support enabled.</span>';
122+
self::$status = '<span class="status--ERROR">Error: Your PHP has no zlib support enabled.</span>';
123123
return;
124124
}
125125

@@ -135,10 +135,10 @@ public static function extractGzipFile($archive, $destination) {
135135

136136
// Check if file was extracted.
137137
if (file_exists($destination . '/' . $filename)) {
138-
self::$status = '<span style="color:green; font-weight:bold;font-size:120%;">File unzipped successfully.</span>';
138+
self::$status = '<span class="status--OK">File unzipped successfully.</span>';
139139
}
140140
else {
141-
self::$status = '<span style="color:red; font-weight:bold;font-size:120%;">Error unzipping file.</span>';
141+
self::$status = '<span class="status--ERROR">Error unzipping file.</span>';
142142
}
143143

144144
}
@@ -147,6 +147,7 @@ public static function extractGzipFile($archive, $destination) {
147147
?>
148148

149149
<!DOCTYPE html>
150+
<html>
150151
<head>
151152
<title>File Unzipper</title>
152153
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@@ -157,8 +158,13 @@ public static function extractGzipFile($archive, $destination) {
157158
line-height: 150%;
158159
}
159160

161+
label {
162+
display: block;
163+
margin-top: 20px;
164+
}
165+
160166
fieldset {
161-
border: 0px solid #000;
167+
border: 0;
162168
}
163169

164170
.select {
@@ -174,72 +180,62 @@ public static function extractGzipFile($archive, $destination) {
174180
border: 1px dotted #DDD;
175181
}
176182

183+
.status--ERROR {
184+
color: red;
185+
font-weight: bold;
186+
font-size: 120%;
187+
}
188+
189+
.status--OK {
190+
color: green;
191+
font-weight: bold;
192+
font-size: 120%
193+
}
194+
177195
.form-field {
178-
border: 2px solid black;
179-
-webkit-border-radius: 10px;
180-
-moz-border-radius: 10px;
181-
border-radius: 10px;
182-
-webkit-box-shadow: rgba(255, 255, 255, 0.4) 0 0px 0, inset rgba(000, 000, 000, 0.7) 0 0px 0px;
183-
-moz-box-shadow: rgba(255, 255, 255, 0.4) 0 0px 0, inset rgba(000, 000, 000, 0.7) 0 0px 0px;
184-
box-shadow: rgba(255, 255, 255, 0.4) 0 0px 0, inset rgba(000, 000, 000, 0.7) 0 0px 0px;
196+
border: 1px solid #AAA;
185197
padding: 8px;
186-
margin-bottom: 20px;
187198
width: 280px;
188199
}
189200

201+
.info {
202+
margin-top: 0;
203+
font-size: 80%;
204+
color: #777;
205+
}
206+
190207
.submit {
191-
-moz-box-shadow: inset 0px 1px 0px 0px #bbdaf7;
192-
-webkit-box-shadow: inset 0px 1px 0px 0px #bbdaf7;
193-
box-shadow: inset 0px 1px 0px 0px #bbdaf7;
194-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #79bbff), color-stop(1, #378de5));
195-
background: -moz-linear-gradient(center top, #79bbff 5%, #378de5 100%);
196-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#79bbff', endColorstr='#378de5');
197-
background-color: #79bbff;
198-
-moz-border-radius: 4px;
199-
-webkit-border-radius: 4px;
200-
border-radius: 4px;
201-
border: 1px solid #84bbf3;
202-
display: inline-block;
208+
background-color: #378de5;
209+
border: 0;
203210
color: #ffffff;
204-
font-family: arial;
205211
font-size: 15px;
206-
font-weight: bold;
207212
padding: 10px 24px;
213+
margin: 20px 0 20px 0;
208214
text-decoration: none;
209-
text-shadow: 1px 1px 0px #528ecc;
210215
}
211216

212217
.submit:hover {
213-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #378de5), color-stop(1, #79bbff));
214-
background: -moz-linear-gradient(center top, #378de5 5%, #79bbff 100%);
215-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#378de5', endColorstr='#79bbff');
216-
background-color: #378de5;
217-
}
218-
219-
.submit:active {
220-
position: relative;
221-
top: 1px;
218+
background-color: #2c6db2;
219+
cursor: pointer;
222220
}
223221
-->
224222
</style>
225223
</head>
226224
<body>
227225
<h1>Archive Unzipper</h1>
228-
<p>Select .zip archive or .gz file you want to extract:</p>
229226
<form action="" method="POST">
230227
<fieldset>
228+
<label for="zipfile">Select .zip archive or .gz file you want to extract:</label>
231229
<select name="zipfile" size="1" class="select">
232230
<?php foreach ($arc->zipfiles as $zip) {
233231
echo "<option>$zip</option>";
234232
}
235233
?>
236234
</select>
237-
<br/>
238-
<br/>
235+
<label for="extpath">Extraction path (optional):</label>
239236
<input type="text" name="extpath" class="form-field"
240-
placeholder="extraction_path"/>
241-
<label>Optional, if blank current dir will be used.</label>
242-
<br/>
237+
placeholder="mypath"/>
238+
<p class="info">Enter extraction path without leading or trailing slashes (e.g. "mypath"). If left blank current directory will be used.</p>
243239
<input type="submit" name="submit" class="submit" value="Unzip Archive"/>
244240
</fieldset>
245241
</form>

0 commit comments

Comments
 (0)