-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
125 lines (111 loc) · 4.81 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
/**
* Qobo Web Tester
*
* @author Leonid Mamchenkov <[email protected]>
*/
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'WebTester' . DIRECTORY_SEPARATOR . 'autoload.php';
$result = null;
if (isset($_SERVER['REQUEST_METHOD']) && (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST')) {
$_POST['httpClient'] = \WebTester\HttpClient::init();
$result = \WebTester\TestFactory::runTests($_POST);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Qobo Web Tester</title>
<!-- Bootstrap -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<!-- Sticky footer -->
<link href="css/sticky-footer.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="<?php echo $_SERVER['PHP_SELF']; ?>">Qobo Web Tester</a>
</div>
<form class="navbar-form navbar-right" role="form" method="post">
<div class="form-group">
<input type="url" name="url" class="form-control" id="url" placeholder="http://test.qobo.biz" value="<?php echo empty($_POST['url']) ? 'http://test.qobo.biz' : $_POST['url']; ?>">
</div>
<input type="submit" class="btn btn-primary" value="Test">
</form>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<?php if (!empty($result)) : ?>
<h3>Test Results</h3>
<small>
<strong>URL:</strong> <a target="_blank" href="<?php echo $_POST['url']; ?>"><?php echo $_POST['url']; ?></a><br />
<strong>Date:</strong> <?php echo date('F j, Y, g:i a'); ?><br />
</small>
<br />
<table class="table table-condensed">
<thead>
<tr>
<th width="25%">Test</th>
<th>Result</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<?php
$result->rewind();
while($result->valid()) {
$test = $result->current();
$last = $test->getLastResult();
echo '<tr class="' . ($last->isSuccess() ? 'success' : 'danger') . '">';
echo '<td>' . $test->getName() . '<br /><small>' . $test->getDescription() . '</small></td>';
echo '<td>' . ($last->isSuccess() ? \WebTester\Result\Result::DEFAULT_DESCRIPTION_SUCCESS : \WebTester\Result\Result::DEFAULT_DESCRIPTION_FAIL) . '</td>';
echo '<td><small>' . $last->getDescription() . '</small></td';
echo '</tr>';
$result->next();
}
?>
</tbody>
</table>
<?php else: ?>
<div class="well">
<h4>Welcome to the Qobo Web Tester</h4>
<p>Here, at Qobo, we strive to build high quality web site and applications. In an effort to delivery the best possible results we've created a few tools to help us. Qobo Web Tester is just one such tool.</p>
<p>Use the form above to test URLs. Qobo Web Tester will automagically examine the given page and provide you will some suggestions on how to make it better.</p>
</div>
<?php endif; ?>
</div>
</div>
</div>
<a href="https://github.com/QoboLtd/test.qobo.biz"><img style="position:absolute;top:0;right:0;border:0;" src="img/github_forkme_right_green.png" /></a>
<div class="footer">
<div class="container">
<p class="text-right text-muted">© Copyright <?php echo date('Y'); ?> <a href="http://www.qobo.biz">Qobo Ltd</a></p>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-42307744-2', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>