Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hosting_reviews
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Ali Arshad
hosting_reviews
Commits
3b095bde
Commit
3b095bde
authored
May 15, 2019
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SpeedTest Coppied
parent
2440fc91
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
302 additions
and
0 deletions
+302
-0
footer.php
WWW_DATA/wp-content/themes/SpeedTest/footer.php
+4
-0
functions.php
WWW_DATA/wp-content/themes/SpeedTest/functions.php
+10
-0
header.php
WWW_DATA/wp-content/themes/SpeedTest/header.php
+12
-0
hosting.php
WWW_DATA/wp-content/themes/SpeedTest/hosting.php
+7
-0
admin-page.php
WWW_DATA/wp-content/themes/SpeedTest/inc/admin-page.php
+2
-0
functions-admin.php
WWW_DATA/wp-content/themes/SpeedTest/inc/functions-admin.php
+174
-0
save-hosting.php
WWW_DATA/wp-content/themes/SpeedTest/inc/save-hosting.php
+38
-0
save-locations.php
WWW_DATA/wp-content/themes/SpeedTest/inc/save-locations.php
+38
-0
index.php
WWW_DATA/wp-content/themes/SpeedTest/index.php
+5
-0
style.css
WWW_DATA/wp-content/themes/SpeedTest/style.css
+12
-0
No files found.
WWW_DATA/wp-content/themes/SpeedTest/footer.php
0 → 100644
View file @
3b095bde
<?php
wp_footer
();
?>
</body>
</html>
WWW_DATA/wp-content/themes/SpeedTest/functions.php
0 → 100644
View file @
3b095bde
<?php
include
get_template_directory
()
.
'/inc/functions-admin.php'
;
function
subscribe_hosting_shortcode
()
{
ob_start
();
get_template_part
(
'hosting'
);
return
ob_get_clean
();
}
add_shortcode
(
'subscribe-to-hosting'
,
'subscribe_hosting_shortcode'
);
WWW_DATA/wp-content/themes/SpeedTest/header.php
0 → 100644
View file @
3b095bde
<!doctype html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<title>
Website SpeedTest
</title>
<?php
wp_head
();
?>
</head>
<body>
WWW_DATA/wp-content/themes/SpeedTest/hosting.php
0 → 100644
View file @
3b095bde
<h1>
Hosting Plugin
</h1>
<form>
<input
type=
"text"
name=
"site"
>
<input
type=
"submit"
name=
"submit"
value=
"Check Speed"
>
</form>
WWW_DATA/wp-content/themes/SpeedTest/inc/admin-page.php
0 → 100644
View file @
3b095bde
<h1>
Speed Test Theme Settings
</h1>
WWW_DATA/wp-content/themes/SpeedTest/inc/functions-admin.php
0 → 100644
View file @
3b095bde
<?php
/*
==============================
ADMIN PAGE
==============================
*/
function
speedtest_add_admin_page
()
{
add_menu_page
(
'Speed Test Theme Options'
,
'Speed Test'
,
'manage_options'
,
'speedtest_options'
,
'speedtest_theme_create_page'
,
''
,
110
);
}
add_action
(
'admin_menu'
,
'speedtest_add_admin_page'
);
function
speedtest_theme_create_page
()
{
require_once
get_template_directory
()
.
'/inc/admin-page.php'
;
locations_table_creator
();
hosting_table_creator
();
}
function
locations_table_creator
()
{
global
$wpdb
;
$table_name
=
$wpdb
->
prefix
.
'locations'
;
$charset_collate
=
$wpdb
->
get_charset_collate
();
$sql
=
"CREATE TABLE
$table_name
(
id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
loc text NOT NULL,
url text NOT NULL)
$charset_collate
"
;
require_once
(
ABSPATH
.
'wp-admin/includes/upgrade.php'
);
dbDelta
(
$sql
);
$got
=
$wpdb
->
get_results
(
"SELECT * FROM
$table_name
"
);
?>
<h2>
Locations
</h2>
<form
method=
"post"
action=
"
<?php
echo
get_template_directory_uri
();
?>
/inc/save-locations.php"
>
<table
id=
"tab"
>
<thead>
<tr>
<th></th>
<th>
Location
</th>
<th>
IP Address/URL
</th>
<th>
Delete
</th>
</tr>
</thead>
<script>
var
result
=
<?php
echo
json_encode
(
$got
);
?>
;
var
deletedArray
=
[];
var
tab
=
document
.
getElementById
(
'tab'
);
for
(
let
i
=
0
;
i
<
result
.
length
;
i
++
){
let
z
=
document
.
createElement
(
'tr'
);
z
.
id
=
result
[
i
].
id
;
z
.
innerHTML
=
'<td><input type="hidden" name="result['
+
i
+
'][id]" value="'
+
result
[
i
].
id
+
'"></td>
\
n'
+
' <td><input type="text" name="result['
+
i
+
'][loc]" value="'
+
result
[
i
].
loc
+
'"></td>
\
n'
+
' <td><input type="text" name="result['
+
i
+
'][url]" value="'
+
result
[
i
].
url
+
'"></td>
\
n'
+
' <td><input type="button" onclick="deleteRow('
+
result
[
i
].
id
+
')" value="Delete"></td>'
;
tab
.
appendChild
(
z
);
}
var
index
=
result
.
length
;
var
tab
=
document
.
getElementById
(
'tab'
);
function
addNew
(){
$thisId
=
parseInt
(
result
[
result
.
length
-
1
].
id
)
+
1
;
result
.
push
({
id
:
$thisId
,
loc
:
''
,
url
:
''
});
let
x
=
document
.
createElement
(
'tr'
);
x
.
id
=
result
[
index
].
id
;
x
.
innerHTML
=
'<td><input type="hidden" name="result['
+
index
+
'][id]" value="'
+
result
[
index
].
id
+
'"></td>
\
n'
+
' <td><input type="text" name="result['
+
index
+
'][loc]" value="'
+
result
[
index
].
loc
+
'"></td>
\
n'
+
' <td><input type="text" name="result['
+
index
+
'][url]" value="'
+
result
[
index
].
url
+
'"></td>
\
n'
+
' <td><input type="button" onclick="deleteRow('
+
result
[
index
].
id
+
')" value="Delete"></td>'
;
tab
.
appendChild
(
x
);
index
++
;
}
function
deleteRow
(
id
)
{
let
deleted
=
document
.
getElementById
(
id
);
tab
.
removeChild
(
deleted
);
result
.
splice
(
id
,
1
);
let
newid
=
parseInt
(
id
);
deletedArray
.
push
(
newid
);
let
del
=
document
.
createElement
(
'input'
);
del
.
type
=
'hidden'
;
del
.
name
=
'deleted['
+
deletedArray
.
length
+
']'
;
del
.
value
=
deletedArray
[
deletedArray
.
length
-
1
];
tab
.
appendChild
(
del
);
}
</script>
</table>
<input
type=
'button'
value=
'Add New'
onclick=
"addNew()"
>
<input
name=
"submit"
type=
"submit"
value=
"Save Changes"
>
</form>
<?php
}
?>
<?php
function
hosting_table_creator
()
{
global
$wpdb
;
$table_name
=
$wpdb
->
prefix
.
'hosting_companies'
;
$charset_collate
=
$wpdb
->
get_charset_collate
();
$sql
=
"CREATE TABLE
$table_name
(
id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
name text NOT NULL,
legal_name text NOT NULL)
$charset_collate
"
;
require_once
(
ABSPATH
.
'wp-admin/includes/upgrade.php'
);
dbDelta
(
$sql
);
$got
=
$wpdb
->
get_results
(
"SELECT * FROM
$table_name
"
);
?>
<br>
<h2>
Hosting Comapnies
</h2>
<form
method=
"post"
action=
"
<?php
echo
get_template_directory_uri
();
?>
/inc/save-hosting.php"
>
<table
id=
"tab-2"
>
<thead>
<tr>
<th></th>
<th>
Name
</th>
<th>
Legal Name
</th>
<th>
Delete
</th>
</tr>
</thead>
<script>
var
results_HC
=
<?php
echo
json_encode
(
$got
);
?>
;
var
deletedArray_HC
=
[];
let
tab_HC
=
document
.
getElementById
(
'tab-2'
);
for
(
let
i
=
0
;
i
<
results_HC
.
length
;
i
++
){
let
z
=
document
.
createElement
(
'tr'
);
z
.
id
=
results_HC
[
i
].
id
;
z
.
innerHTML
=
'<td><input type="hidden" name="result['
+
i
+
'][id]" value="'
+
results_HC
[
i
].
id
+
'"></td>
\
n'
+
' <td><input type="text" name="result['
+
i
+
'][name]" value="'
+
results_HC
[
i
].
name
+
'"></td>
\
n'
+
' <td><input type="text" name="result['
+
i
+
'][legal_name]" value="'
+
results_HC
[
i
].
legal_name
+
'"></td>
\
n'
+
' <td><input type="button" onclick="deleteRow('
+
results_HC
[
i
].
id
+
')" value="Delete"></td>'
;
tab_HC
.
appendChild
(
z
);
}
var
index
=
results_HC
.
length
;
function
addNew
(){
$thisId
=
parseInt
(
results_HC
[
results_HC
.
length
-
1
].
id
)
+
1
;
results_HC
.
push
({
id
:
$thisId
,
name
:
''
,
legal_name
:
''
});
let
x
=
document
.
createElement
(
'tr'
);
x
.
id
=
results_HC
[
index
].
id
;
x
.
innerHTML
=
'<td><input type="hidden" name="results_HC['
+
index
+
'][id]" value="'
+
results_HC
[
index
].
id
+
'"></td>
\
n'
+
' <td><input type="text" name="results_HC['
+
index
+
'][name]" value="'
+
results_HC
[
index
].
name
+
'"></td>
\
n'
+
' <td><input type="text" name="results_HC['
+
index
+
'][legal_name]" value="'
+
results_HC
[
index
].
legal_name
+
'"></td>
\
n'
+
' <td><input type="button" onclick="deleteRow('
+
results_HC
[
index
].
id
+
')" value="Delete"></td>'
;
tab_HC
.
appendChild
(
x
);
index
++
;
}
function
deleteRow
(
id
)
{
let
deleted
=
document
.
getElementById
(
id
);
tab_HC
.
removeChild
(
deleted
);
results_HC
.
splice
(
id
,
1
);
let
newid
=
parseInt
(
id
);
deletedArray_HC
.
push
(
newid
);
let
del
=
document
.
createElement
(
'input'
);
del
.
type
=
'hidden'
;
del
.
name
=
'deleted_HC['
+
deletedArray_HC
.
length
+
']'
;
del
.
value
=
deletedArray_HC
[
deletedArray_HC
.
length
-
1
];
tab_HC
.
appendChild
(
del
);
}
</script>
</table>
<input
disabled
type=
"text"
name=
""
id=
""
value=
"Other"
style=
"margin-left: 7px;"
><br><br>
<input
type=
'button'
value=
'Add New'
onclick=
"addNew()"
>
<input
name=
"submit"
type=
"submit"
value=
"Save Changes"
>
</form>
<?php
}
?>
WWW_DATA/wp-content/themes/SpeedTest/inc/save-hosting.php
0 → 100644
View file @
3b095bde
<?php
$path
=
$_SERVER
[
'DOCUMENT_ROOT'
]
.
'/wordpress'
;
include_once
$path
.
'/wp-config.php'
;
include_once
$path
.
'/wp-load.php'
;
include_once
$path
.
'/wp-includes/wp-db.php'
;
include_once
$path
.
'/wp-includes/pluggable.php'
;
if
(
isset
(
$_POST
[
'submit'
]))
{
print_r
(
$_POST
);
global
$wpdb
;
$table_name
=
$wpdb
->
prefix
.
'hosting_companies'
;
$res
=
$_POST
[
'results_HC'
];
$del
=
$_POST
[
'deleted_HC'
];
$ind
=
0
;
if
(
$del
){
foreach
(
$del
as
$delt
){
$wpdb
->
delete
(
$table_name
,
array
(
'id'
=>
$delt
));
}
}
foreach
(
$res
as
$resu
)
{
$id
=
$resu
[
'id'
];
echo
$id
;
$item
=
$wpdb
->
get_var
(
'SELECT id FROM '
.
$table_name
.
' WHERE id = '
.
$id
);
if
(
$item
)
{
$success
=
$wpdb
->
update
(
$table_name
,
$resu
,
array
(
'id'
=>
$resu
[
'id'
]));
}
else
{
$success
=
$wpdb
->
insert
(
$table_name
,
array
(
"id"
=>
$resu
[
'id'
],
"name"
=>
$resu
[
'name'
],
"legal_name"
=>
$resu
[
'legal_name'
],
));
}
}
$location
=
$_SERVER
[
'HTTP_REFERER'
];
wp_safe_redirect
(
$location
);
}
WWW_DATA/wp-content/themes/SpeedTest/inc/save-locations.php
0 → 100644
View file @
3b095bde
<?php
$path
=
$_SERVER
[
'DOCUMENT_ROOT'
]
.
'/wordpress'
;
include_once
$path
.
'/wp-config.php'
;
include_once
$path
.
'/wp-load.php'
;
include_once
$path
.
'/wp-includes/wp-db.php'
;
include_once
$path
.
'/wp-includes/pluggable.php'
;
if
(
isset
(
$_POST
[
'submit'
]))
{
print_r
(
$_POST
);
global
$wpdb
;
$table_name
=
$wpdb
->
prefix
.
'locations'
;
$res
=
$_POST
[
'result'
];
$del
=
$_POST
[
'deleted'
];
$ind
=
0
;
if
(
$del
){
foreach
(
$del
as
$delt
){
$wpdb
->
delete
(
$table_name
,
array
(
'id'
=>
$delt
));
}
}
foreach
(
$res
as
$resu
)
{
$id
=
$resu
[
'id'
];
echo
$id
;
$item
=
$wpdb
->
get_var
(
'SELECT id FROM '
.
$table_name
.
' WHERE id = '
.
$id
);
if
(
$item
)
{
$success
=
$wpdb
->
update
(
$table_name
,
$resu
,
array
(
'id'
=>
$resu
[
'id'
]));
}
else
{
$success
=
$wpdb
->
insert
(
$table_name
,
array
(
"id"
=>
$resu
[
'id'
],
"loc"
=>
$resu
[
'loc'
],
"url"
=>
$resu
[
'url'
],
));
}
}
$location
=
$_SERVER
[
'HTTP_REFERER'
];
wp_safe_redirect
(
$location
);
}
WWW_DATA/wp-content/themes/SpeedTest/index.php
0 → 100644
View file @
3b095bde
<?php
get_header
();
the_content
();
?>
<?php
get_footer
();
?>
WWW_DATA/wp-content/themes/SpeedTest/style.css
0 → 100644
View file @
3b095bde
/*
Theme Name: SpeedTest
Theme URI: https://www.vqode.com
Author: Sundas Riasat
Author URI: https://www.vqode.com/
Description: The Official Theme for SpeedTest
Requires at least: WordPress 4.9.6
Version: 1.3
License: GNU General Public License v2 or later
License URI: LICENSE
*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment