-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
178 lines (114 loc) · 5.15 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php
/*
______ __ __ ___ __ __ ____ ____ ____ ____ ____
| | | | / _] | | |/ | \ / |/ | \
| | | |/ [_ | | | o | _ | __| o | D )
|_| |_| _ | _] | _ | | | | | | | /
| | | | | [_ | | | _ | | | |_ | _ | \
| | | | | | | | | | | | | | | | . \
|__| |__|__|_____| |__|__|__|__|__|__|___,_|__|__|__|\_|
*/
define('MAX_FILE_SIZE', 2000000); // Simple HTML parser has a low limit of 600000
if($_GET['url']) :
$url = rtrim($_GET['url'], '/').'/';
$url_nocache = $_GET['url'] .'?nowprocket';
endif;
include('classes/loader.php');
include('inc/header.php');
include('inc/nav.php');
include('inc/form-index.php');
// include('indicators');
if ($url) :
// TOGGLE ELEMENTS
// GET SITE HTML
$html = new html();
$site_html = $html->get_html($url);
// URL PARTS
$url_parts = explode('://', $url);
///////////////////////
// WIDGETS SECTION
///////////////////////
// cached headers
$widget = new widget();
$cached = new headers();
$cached->build_url_headers($url);
$widget_body = $cached->display_headers();
echo $widget->display_widget('Headers Cached', $widget_body, 'information ', 'fa-code');
// non-cached headers
$widget = new widget();
$cached = new headers();
$cached->build_url_headers($url_nocache);
$widget_body = $cached->display_headers();
echo $widget->display_widget('Headers non_cached', $widget_body, 'information ', 'fa-code');
// server information
$widget = new widget();
$hosting = new hosting();
$widget_body = $hosting->get_hosting($url);
echo $widget->display_widget('Hosting', $widget_body, 'information ', 'fa-server');
// wprocket - enabled options
$widget = new widget;
$rocket = new Rocket( $site_html, $url );
$widget_body = '';
if( $rocket->is_wpr_installed ){
$features_enabled = $rocket->enabled_features;
asort($features_enabled);
$widget_body = '<h5><span class="badge badge-success">WP Rocket is enabled!</span></h5>';
foreach( $features_enabled as $feature ){
$widget_body .= '<i class="far fa-check-square"></i> ' . $feature . '<br>';
}
// FILE DETECTIONS
$widget_body .= '<br><h5><span class="badge badge-primary">FILES</h5>';
$file_exists = new files();
$widget_body .= '<table class="table table-striped table-sm">';
// contributors file
$widget_body .= '<tr><td><trong>Contributors.txt</strong></td><td>'. $file_exists->checkURL($url.'/wp-content/plugins/wp-rocket/contributors.txt') .'</td></tr>';
//desktop cache
$widget_body .= '<tr><td><trong>Desktop HTML Cache</strong></td><td>'. $file_exists->checkURL($url.'wp-content/cache/wp-rocket/'.$url_parts[1].'index-'.$url_parts[0].'.html') .'</td></tr>';
// mobile cache
$widget_body .= '<tr><td><trong>Mobile HTML cache</strong></td><td>'. $file_exists->checkURL($url.'wp-content/cache/wp-rocket/'.$url_parts[1].'index-mobile-'.$url_parts[0].'.html') .'</td></tr>';
// webp cache
$widget_body .= '<tr><td><trong>WebP HTML cache</strong></td><td>'. $file_exists->checkURL($url.'wp-content/cache/wp-rocket/'.$url_parts[1].'index-'.$url_parts[0].'-webp.html') .'</td></tr>';
$widget_body .= '</table>';
} else {
$widget_body = '<h5><span class="badge badge-danger">Oops! WP Rocket is not installed!</h5>';
}
echo $widget->display_widget('WP Rocket Enabled Features', $widget_body, 'rocket ', 'fa-rocket');
// wprocket - HTML scanner
$widget = new widget();
$scanner = new scanner();
$widget_body = $scanner->html_scan($site_html);
echo $widget->display_widget('Potential issues', $widget_body, 'rocket scanner ', 'fa-bug');
/*
// info - CSS files
$widget = new widget();
$css_files = $rocket->css_files;
$widget_body = '';
foreach( $css_files as $css_file){
$widget_body .= $css_file . '<br>';
}
echo $widget->display_widget('CSS Files', $widget_body, 'information css', 'fa-file');
*/
//info - JS files
$widget = new widget();
$widget_body = 'List of JS files';
$javascript_files = $rocket->javascript_files;
foreach( $javascript_files as $javascript_file ){
$widget_body_javascript_files .= $javascript_file . '<br>';
}
echo $widget->display_widget('JavaScript Files', $widget_body_javascript_files, 'information js', 'fa-file');
// info - Inline Javascript
$widget = new widget();
$widget_body = 'Inline JS';
echo $widget->display_widget('Inline JS', $widget_body, 'information js', 'fa-file');
/*
// info - Prefetch DNS
$widget = new widget();
$widget_body = 'Prefetch DNS requests URLs';
echo $widget->display_widget('Prefetch DNS', $widget_body, 'information', 'fa-file');
// info - LazyLoaded Images
$widget = new widget();
$widget_body = 'This will help troubleshooting features such as lazy load by providing info about how many images are lazy loaded and possible explanation for those that aren’t, e.g. background images in CSS.';
echo $widget->display_widget('LazyLoaded Images', $widget_body, 'information files', 'fa-image');
*/
endif;
include('inc/footer.php');